13 StBbcGeom::~StBbcGeom(){
17 void StBbcGeom::InitializeGeometry(){
23 double xh = h/(4.0*sin(60.0*TMath::Pi()/180.0));
25 mX[0] = -2.0*xh; mY[0] = 0.0;
26 mX[1] = -xh; mY[1] = yh;
27 mX[2] = xh; mY[2] = yh;
28 mX[3] = 2.0*xh; mY[3] = 0.0;
29 mX[4] = xh; mY[4] = -yh;
30 mX[5] = -xh; mY[5] = -yh;
34 double radius,phi,xc,yc,zc;
37 for (
int iTile=1; iTile<19; iTile++){
40 phi = TMath::Pi()/2.0 + (iTile-1)*60.0*TMath::Pi()/180.0;
42 if ((iTile>6)&&(iTile%2==0)){
44 phi = TMath::Pi()/2.0 +(iTile/2-4)*60.0*TMath::Pi()/180.0;
46 if ((iTile>6)&&(iTile%2==1)){
47 radius = h*(1.0+cos(60.0*TMath::Pi()/180.0))/sin(60.0*TMath::Pi()/180.0);
48 phi = TMath::Pi()*60.0/180.0 + ((iTile-1)/2-3)*60*TMath::Pi()/180.0;
53 mEastTileCenter[iTile-1].SetXYZ(xc,yc,zc);
57 for (
int iTile=1; iTile<19; iTile++){
60 phi = TMath::Pi()/2.0 - (iTile-1)*60.0*TMath::Pi()/180.0;
62 if ((iTile>6)&&(iTile%2==0)){
64 phi = TMath::Pi()/2.0 -(iTile/2-4)*60.0*TMath::Pi()/180.0;
66 if ((iTile>6)&&(iTile%2==1)){
67 radius = h*(1.0+cos(60.0*TMath::Pi()/180.0))/sin(60.0*TMath::Pi()/180.0);
68 phi = TMath::Pi()*120.0/180.0 - ((iTile-1)/2-3)*60*TMath::Pi()/180.0;
73 mWestTileCenter[iTile-1].SetXYZ(xc,yc,zc);
79 for (
int pmt=0; pmt<16; pmt++){
80 mNtilesOfPmt[pmt] = 0;
81 mTileNumbersOfPmt[pmt][0] = 0;
82 mTileNumbersOfPmt[pmt][1] = 0;
87 unsigned short pmt[18] = {1, 2, 3, 4, 5, 6, 7, 8, 7, 9, 10, 11, 12, 13, 12, 14, 15, 16};
88 for (
int itile=0; itile<18; itile++){
89 mPMT[itile] = pmt[itile];
91 mTileNumbersOfPmt[pmt[itile]-1][mNtilesOfPmt[pmt[itile]-1]] = itile+1;
92 mNtilesOfPmt[pmt[itile]-1]++;
98 *nTiles = mNtilesOfPmt[pmtNumber-1];
99 tileNumbers[0] = mTileNumbersOfPmt[pmtNumber-1][0];
100 tileNumbers[1] = mTileNumbersOfPmt[pmtNumber-1][1];
111 unsigned short absValTile = abs(tileId);
112 return (tileId<0)?TileCenter(absValTile,0):TileCenter(absValTile,1);
115 return (eastwest>0)?mWestTileCenter[absValueTileNumber-1]:mEastTileCenter[absValueTileNumber-1];
122 unsigned short absValTile = abs(tileId);
123 return (tileId<0)?GetCorners(absValTile,0,x,y):GetCorners(absValTile,1,x,y);
137 TVector3 cent = this->TileCenter(absValueTileNumber,eastwest);
138 double xcent = cent.X();
139 double ycent = cent.Y();
140 for (
int i=0; i<6; i++){
148 unsigned short absValTile = abs(tileId);
149 return (tileId<0)?IsInTile(absValTile,0,x,y):IsInTile(absValTile,1,x,y);
154 GetCorners(absValueTileNumber,eastwest,PolygonX,PolygonY);
155 PolygonX[6]=PolygonX[0];
156 PolygonY[6]=PolygonY[0];
157 return TMath::IsInside(x,y,7,PolygonX,PolygonY);
162 int* nOverlappingEpdTiles,
short* EpdTileIDs){
163 unsigned short absValTile = abs(tileId);
164 if (tileId<0) {GetOverlappingEpdTiles(absValTile,-1,nOverlappingEpdTiles,EpdTileIDs);}
165 else {GetOverlappingEpdTiles(absValTile,1,nOverlappingEpdTiles,EpdTileIDs);}
168 int* nOverlappingEpdTiles,
short* EpdTileIDs){
169 if ((BB==0)||(BB>18)){
170 *nOverlappingEpdTiles=0;
174 *nOverlappingEpdTiles = mEastNumberOfOverlappingEpdTiles[BB-1];
175 for (
int i=0; i<*nOverlappingEpdTiles; i++){
176 EpdTileIDs[i] = mEastEpdTilesWhichOverlap[BB-1][i];
180 *nOverlappingEpdTiles = mWestNumberOfOverlappingEpdTiles[BB-1];
181 for (
int i=0; i<*nOverlappingEpdTiles; i++){
182 EpdTileIDs[i] = mWestEpdTilesWhichOverlap[BB-1][i];
185 for (
int i=*nOverlappingEpdTiles; i<10; i++){
194 short StBbcGeom::mEastNumberOfOverlappingEpdTiles[18] = { 8, 8, 8, 8, 8, 8, 10, 8, 10, 8, 10, 8, 9, 8, 10, 8, 10, 8};
197 short StBbcGeom::mEastEpdTilesWhichOverlap[18][10] = {
198 { -101, -102, -103, -105, -1201, -1202, -1203, -1204, 0, 0},
199 { -1001, -1002, -1003, -1004, -1101, -1102, -1103, -1105, 0, 0},
200 { -801, -802, -803, -804, -901, -902, -903, -905, 0, 0},
201 { -601, -602, -603, -604, -701, -702, -703, -705, 0, 0},
202 { -401, -402, -403, -404, -501, -502, -503, -505, 0, 0},
203 { -201, -202, -203, -204, -301, -302, -303, -305, 0, 0},
204 { -102, -104, -105, -106, -107, -203, -204, -205, -206, -207},
205 { -105, -106, -107, -109, -1204, -1206, -1207, -1208, 0, 0},
206 { -1102, -1104, -1105, -1106, -1107, -1203, -1204, -1205, -1206, -1207},
207 { -1004, -1006, -1007, -1008, -1105, -1106, -1107, -1109, 0, 0},
208 { -902, -904, -905, -906, -907, -1003, -1004, -1005, -1006, -1007},
209 { -804, -806, -807, -808, -905, -906, -907, -909, 0, 0},
210 { -702, -704, -705, -706, -707, -803, -804, -805, -807, 0},
211 { -604, -606, -607, -608, -705, -706, -707, -709, 0, 0},
212 { -502, -504, -505, -506, -507, -603, -604, -605, -606, -607},
213 { -404, -406, -407, -408, -505, -506, -507, -509, 0, 0},
214 { -302, -304, -305, -306, -307, -403, -404, -405, -406, -407},
215 { -204, -206, -207, -208, -305, -306, -307, -309, 0, 0}
219 short StBbcGeom::mWestNumberOfOverlappingEpdTiles[18] = { 8, 8, 8, 8, 8, 8, 10, 8, 10, 8, 10, 8, 10, 8, 10, 8, 10, 8};
222 short StBbcGeom::mWestEpdTilesWhichOverlap[18][10] = {
223 { 101, 102, 103, 105, 1201, 1202, 1203, 1204, 0, 0},
224 { 1001, 1002, 1003, 1004, 1101, 1102, 1103, 1105, 0, 0},
225 { 801, 802, 803, 804, 901, 902, 903, 905, 0, 0},
226 { 601, 602, 603, 604, 701, 702, 703, 705, 0, 0},
227 { 401, 402, 403, 404, 501, 502, 503, 505, 0, 0},
228 { 201, 202, 203, 204, 301, 302, 303, 305, 0, 0},
229 { 102, 104, 105, 106, 107, 203, 204, 205, 206, 207},
230 { 105, 106, 107, 109, 1204, 1206, 1207, 1208, 0, 0},
231 { 1102, 1104, 1105, 1106, 1107, 1203, 1204, 1205, 1206, 1207},
232 { 1004, 1006, 1007, 1008, 1105, 1106, 1107, 1109, 0, 0},
233 { 902, 904, 905, 906, 907, 1003, 1004, 1005, 1006, 1007},
234 { 804, 806, 807, 808, 905, 906, 907, 909, 0, 0},
235 { 702, 704, 705, 706, 707, 803, 804, 805, 806, 807},
236 { 604, 606, 607, 608, 705, 706, 707, 709, 0, 0},
237 { 502, 504, 505, 506, 507, 603, 604, 605, 606, 607},
238 { 404, 406, 407, 408, 505, 506, 507, 509, 0, 0},
239 { 302, 304, 305, 306, 307, 403, 404, 405, 406, 407},
240 { 204, 206, 207, 208, 305, 306, 307, 309, 0, 0}
bool IsInTile(short tileId, double x, double y)
void GetOverlappingEpdTiles(short tileId, int *nOverlappingEpdTiles, short *EpdTileIDs)
void GetTilesOfPmt(unsigned short pmtNumber, unsigned short *nTiles, unsigned short *tileNumbers)
TVector3 TileCenter(short tileId)
void GetCorners(short tileId, double *x, double *y)