StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEpdGeom.h
1 #ifndef _StEpdGeom
2 #define _StEpdGeom
3 
4 //#include "Rtypes.h"
5 #include "TVector3.h"
6 
7 /*************************************
8  * \author Mike Lisa
9  * \date 4 Jan 2018
10  *
11  * \description:
12  * class defining geometrical aspects of an EPD Tile
13  * (position of center, RandomPointOnTile(), etc.)
14  *
15  * The user may pass the PP/TT/EW _or_ the uniqueID to
16  * most functions. No option to pass StEpdHit object,
17  * because we want to avoid StObject-dependence.
18  * Instead, simply use StEpdHit::id(),
19  * e.g. RandomPointOnTile(hit->id())
20  *************************************/
21 
22 class TRandom3;
23 
24 class StEpdGeom{
25  private:
26  short mPP;
27  short mTT;
28  short mEW;
29  TRandom3* pRan;
30 
31  double mPhiCenter[12][31][2]; // PP,TT,EW
32  double mRmin[16]; // row
33  double mRmax[16]; // row
34  double mRave[16]; // row
35 
36  // EastNumberOfOverlappingBbcTiles[PP-1][TT-1] = number of BBC tiles that overlap
37  static short mEastNumberOfOverlappingBbcTiles[12][9];
38  // EastBbcTilesWhichOverlap[PP-1][TT-1][j] gives the BBC tile ID of the jth overlapping BBC tile
39  static short mEastBbcTilesWhichOverlap[12][9][3]; //
40 
41  // WestNumberOfOverlappingBbcTiles[PP-1][TT-1] = number of BBC tiles that overlap
42  static short mWestNumberOfOverlappingBbcTiles[12][9];
43  // WestBbcTilesWhichOverlap[PP-1][TT-1][j] gives the BBC tile ID of the jth overlapping BBC tile
44  static short mWestBbcTilesWhichOverlap[12][9][3]; //
45 
46 
47  void InitializeGeometry();
48 
49  /* these methods are used internally */
52  double GetZwheel();
53 
56  //--------- obsolete (always the plan; that's why it was private) double GetPhiCenter();
59  //--------- obsolete (always the plan; that's why it was private) void GetRminRmax(double *Rmin, double *Rmax);
62  short Row();
63 
66  void SetPpTtEw(short uniqueID);
67 
70  TVector3 TileCenter();
71 
76  TVector3 RandomPointOnTile();
77 
83  void GetCorners(int* nCorners, double* x, double* y);
84 
91  bool IsInTile(double x, double y);
92 
96  void GetOverlappingBbcTiles(int* nOverlappingBbcTiles, short* BbcTileIDs);
97 
98 
99 
100 
101 
102  public:
103 
104  StEpdGeom();
105  ~StEpdGeom();
106 
107  unsigned short position(short uniqueID);
108  unsigned short tile(short uniqueID);
109 
110 
113  TVector3 TileCenter(short uniqueID);
114 
119  TVector3 TileCenter(short position, short tilenumber, short eastwest);
120 
125  TVector3 RandomPointOnTile(short uniqueID);
126 
133  TVector3 RandomPointOnTile(short position, short tilenumber, short eastwest);
134 
140  void GetCorners(short uniqueID,
141  int* nCorners, double* x, double* y);
149  void GetCorners(short position, short tilenumber, short eastwest,
150  int* nCorners, double* x, double* y);
151 
156  void GetOverlappingBbcTiles(short uniqueID,
157  int* nOverlappingBbcTiles, short* BbcTileIDs);
158 
165  void GetOverlappingBbcTiles(short position, short tilenumber, short eastwest,
166  int* nOverlappingBbcTiles, short* BbcTileIDs);
167 
168 
169 
176  bool IsInTile(short uniqueID,
177  double x, double y);
178 
187  bool IsInTile(short position, short tilenumber, short eastwest,
188  double x, double y);
189 
192  bool IsWest(short uniqueID);
193 
198  bool IsWest(short position, short tilenumber, short eastwest);
199 
202  bool IsEast(short uniqueID);
207  bool IsEast(short position, short tilenumber, short eastwest);
208 
211  short Row(short uniqueID);
212 
217  short Row(short position, short tilenumber, short eastwest);
218 };
219 
220 inline bool StEpdGeom::IsWest(short uniqueID){return uniqueID>0;}
221 inline bool StEpdGeom::IsWest(short position, short tilenumber, short eastwest){return eastwest>0;}
222 inline bool StEpdGeom::IsEast(short uniqueID){return uniqueID<0;}
223 inline bool StEpdGeom::IsEast(short position, short tilenumber, short eastwest){return eastwest<0;}
224 inline unsigned short StEpdGeom::position(short uniqueID){return abs(uniqueID/100);}
225 inline unsigned short StEpdGeom::tile(short uniqueID){return abs(uniqueID%100);}
226 
227 
228 
229 
230 #endif
bool IsWest(short uniqueID)
Definition: StEpdGeom.h:220
bool IsEast(short uniqueID)
Definition: StEpdGeom.h:222