1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 Revision 1.18 2007/02/19 18:55:26 decaro
19 Added getter methods for volume path (for Event Display)
21 Revision 1.17.1 2006/12/15
22 Added method DetToStripRF(...) to get
23 a pad corner coordinates in its strip reference frame
24 (A.De Caro, M.Di Stefano)
25 Revision 1.17 2006/08/22 13:30:02 arcelli
26 removal of effective c++ warnings (C.Zampolli)
28 Revision 1.16 2006/04/20 22:30:50 hristov
29 Coding conventions (Annalisa)
31 Revision 1.15 2006/04/16 22:29:05 hristov
32 Coding conventions (Annalisa)
34 Revision 1.14 2006/04/05 08:35:38 hristov
35 Coding conventions (S.Arcelli, C.Zampolli)
37 Revision 1.13 2006/03/12 14:37:54 arcelli
38 Changes for TOF Reconstruction using TGeo
40 Revision 1.12 2006/02/28 10:38:00 decaro
41 AliTOFGeometry::fAngles, AliTOFGeometry::fHeights, AliTOFGeometry::fDistances arrays: dimension definition in the right location
43 Revision 1.11 2005/12/15 14:17:29 decaro
44 Correction of some parameter values
46 Revision 1.10 2005/12/15 08:55:32 decaro
47 New TOF geometry description (V5) -G. Cara Romeo and A. De Caro
49 Revision 1.9.1 2005/07/19 A. De Caro
50 Created daughter-classes AliTOFGeometryV4 and AliTOFGeometryV5
51 => moved global methods IsInsideThePad, DistanceToPad,
52 GetPlate, GetSector, GetStrip, GetPadX, GetPadZ,
53 GetX, GetY, GetZ, GetPadDx, GetPadDy and GetPadDz
56 Revision 1.9 2005/10/20 12:41:35 hristov
57 Implementation of parallel tracking. It is not the default version, one can use it passing option MI from AliReconstruction to TOF (M.Ivanov)
59 Revision 1.8 2004/11/29 08:28:01 decaro
60 Introduction of a new TOF constant (i.e. TDC bin width)
62 Revision 1.7 2004/11/05 07:20:08 decaro
63 TOF library splitting and conversion of some printout messages in AliLog schema (T.Kuhr)
65 Revision 1.6 2004/06/15 15:27:59 decaro
66 TOF raw data: preliminary implementation and style changes
68 Revision 1.5 2004/04/20 14:37:22 hristov
69 Using TMath::Abs instead of fabs, arrays of variable size created/deleted correctly (HP,Sun)
71 Revision 1.4 2004/04/13 09:42:51 decaro
72 Track reconstruction code for TOF: updating
74 Revision 1.3 2003/12/29 18:40:39 hristov
75 Copy/paste error corrected
77 Revision 1.2 2003/12/29 17:26:01 hristov
78 Using enum to initaialize static ints in the header file, the initialization of static floats moved to the implementation file
80 Revision 1.1 2003/12/29 15:18:03 decaro
81 TOF geometry updating (addition of AliTOFGeometry)
83 Revision 0.05 2004/6/11 A.De Caro
84 Implement Global method NpadXStrip
85 Insert four float constants (originally in AliTOF class)
86 Revision 0.04 2004/4/05 S.Arcelli
87 Implement Global methods IsInsideThePad
89 Revision 0.03 2003/12/14 S.Arcelli
90 Set Phi range [-180,180]->[0,360]
91 Revision 0.02 2003/12/10 S.Arcelli:
92 Implement Global methods GetPos & GetDetID
93 Revision 0.01 2003/12/04 S.Arcelli
96 ///////////////////////////////////////////////////////////////////////////////
98 // TOF Geometry class //
100 ///////////////////////////////////////////////////////////////////////////////
102 #include "TGeoManager.h"
103 #include "AliTOFGeometry.h"
105 #include "AliConst.h"
107 extern TGeoManager *gGeoManager;
109 ClassImp(AliTOFGeometry)
111 const Float_t AliTOFGeometry::fgkZlenA = 370.6*2.; // length (cm) of the A module
112 const Float_t AliTOFGeometry::fgkZlenB = 146.5; // length (cm) of the B module
113 const Float_t AliTOFGeometry::fgkZlenC = 170.45; // length (cm) of the C module
114 const Float_t AliTOFGeometry::fgkMaxhZtof = 370.6; // Max half z-size of TOF (cm)
116 const Float_t AliTOFGeometry::fgkxTOF = 371.-0.01;// Inner radius of the TOF for Reconstruction (cm)
117 const Float_t AliTOFGeometry::fgkRmin = 370.-0.01;// Inner radius of the TOF (cm)
118 const Float_t AliTOFGeometry::fgkRmax = 399.-0.01;// Outer radius of the TOF (cm)
120 const Int_t AliTOFGeometry::fgkTimeDiff = 25000; // Min signal separation (ps)
121 const Float_t AliTOFGeometry::fgkXPad = 2.5; // Pad size in the x direction (cm)
122 const Float_t AliTOFGeometry::fgkZPad = 3.5; // Pad size in the z direction (cm)
124 const Float_t AliTOFGeometry::fgkStripLength = 122.;// Strip Length (rho X phi direction) (cm)
126 const Float_t AliTOFGeometry::fgkSigmaForTail1= 2.; //Sig1 for simulation of TDC tails
127 const Float_t AliTOFGeometry::fgkSigmaForTail2= 0.5;//Sig2 for simulation of TDC tails
129 const Float_t AliTOFGeometry::fgkPhiSec= 20;//sector Phi width (deg)
131 const Float_t AliTOFGeometry::fgkTdcBin = 24.4; // time-of-flight bin width [ps]
132 const Float_t AliTOFGeometry::fgkToTBin = 48.8; // time-over-threshold bin width [ps]
134 const Float_t AliTOFGeometry::fgkAngles[kNPlates][kMaxNstrip] ={
135 { 43.99, 43.20, 42.40, 41.59, 40.77, 39.94, 39.11, 38.25, 37.40, 36.53,
136 35.65, 34.76, 33.87, 32.96, 32.05, 31.13, 30.19, 29.24, 12.33, 0.00},
138 { 27.26, 26.28, 25.30, 24.31, 23.31, 22.31, 21.30, 20.29, 19.26, 18.24,
139 17.20, 16.16, 15.11, 14.05, 13.00, 11.93, 10.87, 9.80, 8.74, 0.00},
141 { 0.00, 6.30, 5.31, 4.25, 3.19, 2.12, 1.06, 0.00, -1.06, -2.12,
142 -3.19, -4.25, -5.31, -6.30, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00},
144 { -8.74, -9.80, -10.87, -11.93, -13.00, -14.05, -15.11, -16.16, -17.20, -18.24,
145 -19.26, -20.29, -21.30, -22.31, -23.31, -24.31, -25.30, -26.28, -27.26, 0.00},
147 {-12.33, -29.24, -30.19, -31.13, -32.05, -32.96, -33.87, -34.76, -35.65, -36.53,
148 -37.40, -38.25, -39.11, -39.94, -40.77, -41.59, -42.40, -43.20, -43.99, 0.00}
150 const Float_t AliTOFGeometry::fgkHeights[kNPlates][kMaxNstrip]= {
151 {-8.2, -7.5, -8.2, -7.7, -8.1, -7.6, -7.7, -7.7, -7.7, -7.7,
152 -7.5, -7.2, -7.3, -7.5, -7.6, -7.8, -8.3, -9.3, -3.1, 0.0},
154 {-7.9, -8.1, -8.5, -9.0, -10.1, -3.9, -5.9, -7.7, -10.1, -3.6,
155 -5.8, -8.0, -10.4, -4.4, -7.2, -10.2, -4.6, -7.4, -10.4, 0.0},
157 {-2.5, -10.4, -5.0, -9.9, -4.8, -9.9, -4.7, -10.2, -4.7, -9.9,
158 -4.8, -9.9, -5.0, -10.4, -2.5, 0.0, 0.0, 0.0, 0.0, 0.0},
160 {-10.4, -7.4, -4.6, -10.2, -7.2, -4.4, -10.4, -8.0, -5.8, -3.6,
161 -10.1, -7.7, -5.9, -3.9, -10.1, -9.0, -8.5, -8.1, -7.9, 0.0},
163 { -3.1, -9.3, -8.3, -7.8, -7.6, -7.5, -7.3, -7.2, -7.5, -7.7,
164 -7.7, -7.7, -7.7, -7.6, -8.1, -7.7, -8.2, -7.5, -8.2, 0.0}
168 const Float_t AliTOFGeometry::fgkDistances[kNPlates][kMaxNstrip]= {
169 { 364.1, 354.9, 344.5, 335.4, 325.5, 316.6, 307.2, 298.0, 288.9, 280.0,
170 271.3, 262.7, 254.0, 244.8, 236.1, 227.7, 219.1, 210.3, 205.7, 0.0},
172 { 194.2, 186.1, 177.9, 169.8, 161.5, 156.3, 147.8, 139.4, 130.9, 125.6,
173 117.3, 109.2, 101.1, 95.3, 87.1, 79.2, 73.0, 65.1, 57.6, 0.0},
175 { 49.5, 41.3, 35.3, 27.8, 21.2, 13.9, 7.0, 0.0, -7.0, -13.9,
176 -21.2, -27.8, -35.3, -41.3, -49.5, 0.0, 0.0, 0.0, 0.0, 0.0},
178 { -57.6, -65.1, -73.0, -79.2, -87.1, -95.3, -101.1, -109.2, -117.3, -125.6,
179 -130.9, -139.4, -147.8, -156.3, -161.5, -169.8, -177.9, -186.1, -194.2, 0.0},
181 {-205.7, -210.3, -219.1, -227.7, -236.1, -244.8, -254.0, -262.7, -271.3, -280.0,
182 -288.9, -298.0, -307.2, -316.6, -325.5, -335.4, -344.5, -354.9, -364.1, 0.0}
184 //_____________________________________________________________________________
185 AliTOFGeometry::AliTOFGeometry():
189 // AliTOFGeometry default constructor
194 //_____________________________________________________________________________
195 AliTOFGeometry::~AliTOFGeometry()
198 // AliTOFGeometry destructor
201 //_____________________________________________________________________________
202 void AliTOFGeometry::ImportGeometry(){
203 TGeoManager::Import("geometry.root");
205 //_____________________________________________________________________________
206 void AliTOFGeometry::GetPosPar(Int_t *det, Float_t *pos) const
209 // Returns space point coor (x,y,z) (cm) for Detector
210 // Indices (iSect,iPlate,iStrip,iPadX,iPadZ)
218 //_____________________________________________________________________________
219 void AliTOFGeometry::GetDetID( Float_t *pos, Int_t *det) const
222 // Returns Detector Indices (iSect,iPlate,iStrip,iPadX,iPadZ)
223 // space point coor (x,y,z) (cm)
226 det[0]=GetSector(pos);
227 det[1]=GetPlate(pos);
228 det[2]=GetStrip(pos);
233 //_____________________________________________________________________________
235 void AliTOFGeometry::DetToStripRF(Int_t nPadX, Int_t nPadZ, Float_t &x, Float_t &z) const
238 // Returns the local coordinates (x, z) in strip reference frame
239 // for the bottom corner of the pad number (nPadX, nPadZ)
242 const Float_t xCenterStrip = kNpadX * fgkXPad / 2.;
243 const Float_t zCenterStrip = kNpadZ * fgkZPad / 2.;
245 const Float_t xCenterPad = nPadX*fgkXPad + fgkXPad / 2.;
246 const Float_t zCenterPad = nPadZ*fgkZPad + fgkZPad / 2.;
248 x = xCenterPad - xCenterStrip;
249 z = zCenterPad - zCenterStrip;
253 x = (nPadX - kNpadX*0.5) * fgkXPad;
254 z = (nPadZ - kNpadZ*0.5) * fgkZPad;
258 //_____________________________________________________________________________
259 Float_t AliTOFGeometry::DistanceToPadPar(Int_t *det, Float_t *pos, Float_t *dist3d) const
262 // Returns distance of space point with coor pos (x,y,z) (cm) wrt
263 // pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ)
266 //Transform pos into Sector Frame
272 Float_t radius = TMath::Sqrt(x*x+y*y);
273 //Float_t phi=TMath::ATan(y/x);
274 //if(phi<0) phi = k2PI+phi; //2.*TMath::Pi()+phi;
275 Float_t phi = TMath::Pi()+TMath::ATan2(-y,-x);
276 // Get the local angle in the sector philoc
277 Float_t angle = phi*kRaddeg-( Int_t (kRaddeg*phi/fgkPhiSec) + 0.5)*fgkPhiSec;
278 Float_t xs = radius*TMath::Cos(angle/kRaddeg);
279 Float_t ys = radius*TMath::Sin(angle/kRaddeg);
282 // Do the same for the selected pad
287 Float_t padRadius = TMath::Sqrt(g[0]*g[0]+g[1]*g[1]);
288 //Float_t padPhi = TMath::ATan(g[1]/g[0]);
289 //if(padPhi<0) padPhi = k2Pi + padPhi;
290 Float_t padPhi = TMath::Pi()+TMath::ATan2(-g[1],-g[0]);
292 // Get the local angle in the sector philoc
293 Float_t padAngle = padPhi*kRaddeg-( Int_t (padPhi*kRaddeg/fgkPhiSec)+ 0.5) * fgkPhiSec;
294 Float_t padxs = padRadius*TMath::Cos(padAngle/kRaddeg);
295 Float_t padys = padRadius*TMath::Sin(padAngle/kRaddeg);
296 Float_t padzs = g[2];
298 //Now move to local pad coordinate frame. Translate:
300 Float_t xt = xs-padxs;
301 Float_t yt = ys-padys;
302 Float_t zt = zs-padzs;
305 Float_t alpha = GetAngles(det[1],det[2]);
306 Float_t xr = xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg);
308 Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg);
310 Float_t dist = TMath::Sqrt(xr*xr+yr*yr+zr*zr);
321 //_____________________________________________________________________________
322 Bool_t AliTOFGeometry::IsInsideThePadPar(Int_t *det, Float_t *pos) const
325 // Returns true if space point with coor pos (x,y,z) (cm) falls
326 // inside pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ)
329 Bool_t isInside=false;
332 const Float_t khhony = 1.0 ; // heigth of HONY Layer
333 const Float_t khpcby = 0.08 ; // heigth of PCB Layer
334 const Float_t khrgly = 0.055 ; // heigth of RED GLASS Layer
335 const Float_t khglfy = 0.285 ; // heigth of GLASS+FISHLINE Layer
336 const Float_t khcpcby = 0.16 ; // heigth of PCB Central Layer
337 //const Float_t kwcpcbz = 12.4 ; // z dimension of PCB Central Layer
338 const Float_t khstripy = 2.*khhony+2.*khpcby+4.*khrgly+2.*khglfy+khcpcby;//3.11
339 //const Float_t kwstripz = kwcpcbz;
340 //const Float_t klstripx = fgkStripLength;
343 const Float_t kPadDepth = 0.5;//0.05;//0.11;//0.16;// // heigth of Sensitive Layer
345 //Transform pos into Sector Frame
351 Float_t radius = TMath::Sqrt(x*x+y*y);
352 Float_t phi = TMath::Pi()+TMath::ATan2(-y,-x);
354 // Get the local angle in the sector philoc
355 Float_t angle = phi*kRaddeg-( Int_t (kRaddeg*phi/fgkPhiSec) + 0.5) *fgkPhiSec;
356 Float_t xs = radius*TMath::Cos(angle/kRaddeg);
357 Float_t ys = radius*TMath::Sin(angle/kRaddeg);
360 // Do the same for the selected pad
365 Float_t padRadius = TMath::Sqrt(g[0]*g[0]+g[1]*g[1]);
366 Float_t padPhi = TMath::Pi()+TMath::ATan2(-g[1],-g[0]);
368 // Get the local angle in the sector philoc
369 Float_t padAngle = padPhi*kRaddeg-( Int_t (padPhi*kRaddeg/fgkPhiSec)+ 0.5) * fgkPhiSec;
370 Float_t padxs = padRadius*TMath::Cos(padAngle/kRaddeg);
371 Float_t padys = padRadius*TMath::Sin(padAngle/kRaddeg);
372 Float_t padzs = g[2];
374 //Now move to local pad coordinate frame. Translate:
376 Float_t xt = xs-padxs;
377 Float_t yt = ys-padys;
378 Float_t zt = zs-padzs;
382 Float_t alpha = GetAngles(det[1],det[2]);
383 Float_t xr = xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg);
385 Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg);
387 if(TMath::Abs(xr)<=kPadDepth*0.5 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5))
392 //_____________________________________________________________________________
393 Bool_t AliTOFGeometry::IsInsideThePad(TGeoHMatrix mat, Float_t *pos, Float_t *dist3d) const
396 // Returns true if space point with coor pos (x,y,z) (cm) falls
397 // inside pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ)
400 const Float_t kPadDepth = 0.5; // heigth of Sensitive Layer
405 Double_t veclr[3]={-1.,-1.,-1.};
406 Double_t vecl[3]={-1.,-1.,-1.};
407 mat.MasterToLocal(vecg,veclr);
410 //take into account reflections
413 Float_t xr = vecl[0];
414 Float_t yr = vecl[1];
415 Float_t zr = vecl[2];
423 Bool_t isInside=false;
424 if(TMath::Abs(xr)<= kPadDepth*0.5 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5))
429 //_____________________________________________________________________________
430 void AliTOFGeometry::GetVolumePath(Int_t *ind, Char_t *path ) {
431 //--------------------------------------------------------------------
432 // This function returns the colume path of a given pad
433 //--------------------------------------------------------------------
434 Int_t sector = ind[0];
442 sprintf(string1,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1",icopy,icopy);
446 if( iplate==0) icopy=istrip;
447 if( iplate==1) icopy=istrip+NStripC();
448 if( iplate==2) icopy=istrip+NStripC()+NStripB();
449 if( iplate==3) icopy=istrip+NStripC()+NStripB()+NStripA();
450 if( iplate==4) icopy=istrip+NStripC()+2*NStripB()+NStripA();
452 sprintf(string2,"FTOA_0/FLTA_0/FSTR_%i",icopy);
453 if(fHoles && (sector==11 || sector==12)){
454 if(iplate<2) sprintf(string2,"FTOB_0/FLTB_0/FSTR_%i",icopy);
455 if(iplate>2) sprintf(string2,"FTOC_0/FLTC_0/FSTR_%i",icopy);
458 Int_t padz = ind[3]+1;
459 Int_t padx = ind[4]+1;
460 sprintf(string3,"FPCB_1/FSEN_1/FSEZ_%i/FPAD_%i",padz,padx);
461 sprintf(path,"%s/%s/%s",string1,string2,string3);
464 //_____________________________________________________________________________
465 void AliTOFGeometry::GetVolumePath(Int_t sector, Char_t *path ){
466 //--------------------------------------------------------------------
467 // This function returns the colume path of a given sector
468 //--------------------------------------------------------------------
472 Int_t icopy = sector;
474 sprintf(string,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1",icopy,icopy);
475 sprintf(path,"%s",string);
478 //_____________________________________________________________________________
479 void AliTOFGeometry::GetVolumePath(Int_t sector, Int_t plate, Int_t strip, Char_t *path ) {
480 //--------------------------------------------------------------------
481 // This function returns the colume path of a given strip
482 //--------------------------------------------------------------------
488 Int_t icopy = sector;
490 sprintf(string1,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1",icopy,icopy);
492 if(plate==0) icopy=strip;
493 if(plate==1) icopy=strip+NStripC();
494 if(plate==2) icopy=strip+NStripC()+NStripB();
495 if(plate==3) icopy=strip+NStripC()+NStripB()+NStripA();
496 if(plate==4) icopy=strip+NStripC()+2*NStripB()+NStripA();
498 sprintf(string2,"FTOA_0/FLTA_0/FSTR_%i",icopy);
499 if(fHoles && (sector==11 || sector==12)) {
500 if(plate<2) sprintf(string2,"FTOB_0/FLTB_0/FSTR_%i",icopy);
501 if(plate>2) sprintf(string2,"FTOC_0/FLTC_0/FSTR_%i",icopy);
504 sprintf(string3,"FPCB_1/FSEN_1");
505 sprintf(path,"%s/%s/%s",string1,string2,string3);
508 //_____________________________________________________________________________
509 void AliTOFGeometry::GetPos(Int_t *det, Float_t *pos)
512 // Returns space point coor (x,y,z) (cm) for Detector
513 // Indices (iSect,iPlate,iStrip,iPadX,iPadZ)
516 GetVolumePath(det,path );
518 printf("ERROR: no TGeo\n");
520 gGeoManager->cd(path);
522 global = *gGeoManager->GetCurrentMatrix();
523 const Double_t *tr = global.GetTranslation();
529 //_____________________________________________________________________________
530 Int_t AliTOFGeometry::GetPlate(Float_t *pos) const
533 // Returns the Plate index
535 const Float_t kInterCentrModBorder1 = 49.5;
536 const Float_t kInterCentrModBorder2 = 57.5;
537 const Float_t kExterInterModBorder1 = 196.0;
538 const Float_t kExterInterModBorder2 = 203.5;
540 const Float_t kLengthExInModBorder = 4.7;
541 const Float_t kLengthInCeModBorder = 7.0;
543 //const Float_t khAlWall = 0.1;
544 const Float_t kModuleWallThickness = 0.3;
545 //const Float_t kHoneycombLayerThickness = 1.5;
550 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
552 Int_t isector = GetSector(posLocal);
554 //AliError("Detector Index could not be determined");
558 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
560 {90., 90.+(isector+0.5)*fgkPhiSec,
562 90., (isector+0.5)*fgkPhiSec
564 Rotation(posLocal,angles);
566 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
567 Translation(posLocal,step);
569 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame
577 Rotation(posLocal,angles);
579 Float_t yLocal = posLocal[1];
580 Float_t zLocal = posLocal[2];
582 Float_t deltaRhoLoc = (fgkRmax-fgkRmin)*0.5 - kModuleWallThickness + yLocal;
583 Float_t deltaZetaLoc = TMath::Abs(zLocal);
585 Float_t deltaRHOmax = 0.;
587 if (TMath::Abs(zLocal)>=kExterInterModBorder1 && TMath::Abs(zLocal)<=kExterInterModBorder2)
589 deltaRhoLoc -= kLengthExInModBorder;
590 deltaZetaLoc = kExterInterModBorder2-deltaZetaLoc;
591 deltaRHOmax = (fgkRmax - fgkRmin)*0.5 - kModuleWallThickness - 2.*kLengthExInModBorder; // old 5.35, new 4.8
593 if (deltaRhoLoc > deltaZetaLoc*deltaRHOmax/(kInterCentrModBorder2-kInterCentrModBorder1)) {
594 if (zLocal<0) iPlate = 0;
598 if (zLocal<0) iPlate = 1;
602 else if (TMath::Abs(zLocal)>=kInterCentrModBorder1 && TMath::Abs(zLocal)<=kInterCentrModBorder2)
604 deltaRhoLoc -= kLengthInCeModBorder;
605 deltaZetaLoc = deltaZetaLoc-kInterCentrModBorder1;
606 deltaRHOmax = (fgkRmax - fgkRmin)*0.5 - kModuleWallThickness - 2.*kLengthInCeModBorder; // old 0.39, new 0.2
608 if (deltaRhoLoc>deltaZetaLoc*deltaRHOmax/(kInterCentrModBorder2-kInterCentrModBorder1)) iPlate = 2;
610 if (zLocal<0) iPlate = 1;
615 if (zLocal>-fgkZlenA*0.5/*fgkMaxhZtof*/ && zLocal<-kExterInterModBorder2) iPlate = 0;
616 else if (zLocal>-kExterInterModBorder1 && zLocal<-kInterCentrModBorder2) iPlate = 1;
617 else if (zLocal>-kInterCentrModBorder1 && zLocal< kInterCentrModBorder1) iPlate = 2;
618 else if (zLocal> kInterCentrModBorder2 && zLocal< kExterInterModBorder1) iPlate = 3;
619 else if (zLocal> kExterInterModBorder2 && zLocal< fgkZlenA*0.5/*fgkMaxhZtof*/) iPlate = 4;
625 //_____________________________________________________________________________
626 Int_t AliTOFGeometry::GetSector(Float_t *pos) const
629 // Returns the Sector index
632 //const Float_t khAlWall = 0.1;
633 //const Float_t kModuleWallThickness = 0.3;
641 Float_t rho = TMath::Sqrt(x*x + y*y);
643 //if (!((z>=-fgkMaxhZtof && z<=fgkMaxhZtof) &&
644 if (!((z>=-fgkZlenA*0.5 && z<=fgkZlenA*0.5) &&
645 (rho>=(fgkRmin) && rho<=(fgkRmax)))) {
646 //(rho>=(fgkRmin-0.05)+kModuleWallThickness && rho<=(fgkRmax-0.05)-kModuleWallThickness-khAlWall-kModuleWallThickness))) {
647 //AliError("Detector Index could not be determined");
651 Float_t phi = TMath::Pi() + TMath::ATan2(-y,-x);
653 iSect = (Int_t) (phi*kRaddeg/fgkPhiSec);
658 //_____________________________________________________________________________
659 Int_t AliTOFGeometry::GetStrip(Float_t *pos) const
662 // Returns the Strip index
664 const Float_t khhony = 1.0 ; // heigth of HONY Layer
665 const Float_t khpcby = 0.08 ; // heigth of PCB Layer
666 const Float_t khrgly = 0.055 ; // heigth of RED GLASS Layer
667 const Float_t khglfy = 0.285 ; // heigth of GLASS+FISHLINE Layer
668 const Float_t khcpcby = 0.16 ; // heigth of PCB Central Layer
669 const Float_t kwcpcbz = 12.4 ; // z dimension of PCB Central Layer
670 const Float_t khstripy = 2.*khhony+2.*khpcby+4.*khrgly+2.*khglfy+khcpcby;//3.11
671 const Float_t kwstripz = kwcpcbz;
672 const Float_t klstripx = fgkStripLength;
677 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
679 Int_t isector = GetSector(posLocal);
681 //AliError("Detector Index could not be determined");
683 Int_t iplate = GetPlate(posLocal);
685 //AliError("Detector Index could not be determined");
707 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
709 {90., 90.+(isector+0.5)*fgkPhiSec,
711 90., (isector+0.5)*fgkPhiSec
713 Rotation(posLocal,angles);
715 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
716 Translation(posLocal,step);
718 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame
726 Rotation(posLocal,angles);
728 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
730 for (Int_t istrip=0; istrip<nstrips; istrip++){
732 Float_t posLoc2[3]={posLocal[0],posLocal[1],posLocal[2]};
735 step[1] = GetHeights(iplate,istrip);
736 step[2] = -GetDistances(iplate,istrip);
737 Translation(posLoc2,step);
739 if (GetAngles(iplate,istrip) >0.) {
742 angles[2] = 90.+GetAngles(iplate,istrip);
744 angles[4] = GetAngles(iplate,istrip);
747 else if (GetAngles(iplate,istrip)==0.) {
755 else if (GetAngles(iplate,istrip) <0.) {
758 angles[2] = 90.+GetAngles(iplate,istrip);
760 angles[4] =-GetAngles(iplate,istrip);
763 Rotation(posLoc2,angles);
765 if ((TMath::Abs(posLoc2[0])<=klstripx*0.5) &&
766 (TMath::Abs(posLoc2[1])<=khstripy*0.5) &&
767 (TMath::Abs(posLoc2[2])<=kwstripz*0.5)) {
770 for (Int_t jj=0; jj<3; jj++) posLocal[jj]=posLoc2[jj];
771 //AliInfo(Form(" posLocal[0] = %f, posLocal[1] = %f, posLocal[2] = %f ", posLocal[0],posLocal[1],posLocal[2]));
773 //AliInfo(Form(" GetAngles(%1i,%2i) = %f, pos[0] = %f, pos[1] = %f, pos[2] = %f", iplate, istrip, GetAngles(iplate,istrip), pos[0], pos[1], pos[2]));
777 if (totStrip>1) AliInfo(Form("total strip number found %2i",totStrip));
784 //_____________________________________________________________________________
785 Int_t AliTOFGeometry::GetPadZ(Float_t *pos) const
788 // Returns the Pad index along Z
790 //const Float_t klsensmx = kNpadX*fgkXPad; // length of Sensitive Layer
791 //const Float_t khsensmy = 0.05;//0.11;//0.16;// heigth of Sensitive Layer
792 //const Float_t kwsensmz = kNpadZ*fgkZPad; // width of Sensitive Layer
797 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
799 Int_t isector = GetSector(posLocal);
801 //AliError("Detector Index could not be determined");
803 Int_t iplate = GetPlate(posLocal);
805 //AliError("Detector Index could not be determined");
807 Int_t istrip = GetStrip(posLocal);
809 //AliError("Detector Index could not be determined");
812 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
814 {90., 90.+(isector+0.5)*fgkPhiSec,
816 90., (isector+0.5)*fgkPhiSec
818 Rotation(posLocal,angles);
820 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
821 Translation(posLocal,step);
823 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame
831 Rotation(posLocal,angles);
833 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
835 step[1] = GetHeights(iplate,istrip);
836 step[2] = -GetDistances(iplate,istrip);
837 Translation(posLocal,step);
839 if (GetAngles(iplate,istrip) >0.) {
842 angles[2] = 90.+GetAngles(iplate,istrip);
844 angles[4] = GetAngles(iplate,istrip);
847 else if (GetAngles(iplate,istrip)==0.) {
855 else if (GetAngles(iplate,istrip) <0.) {
858 angles[2] = 90.+GetAngles(iplate,istrip);
860 angles[4] =-GetAngles(iplate,istrip);
863 Rotation(posLocal,angles);
865 //if (TMath::Abs(posLocal[0])<=klsensmx*0.5 && /*TMath::Abs(posLocal[1])<=khsensmy*0.5+0.005 &&*/ TMath::Abs(posLocal[2])<=kwsensmz*0.5) {
866 //if (TMath::Abs(posLocal[1])<=khsensmy*0.5) {
868 step[0] =-0.5*kNpadX*fgkXPad;
870 step[2] =-0.5*kNpadZ*fgkZPad;
871 Translation(posLocal,step);
873 iPadZ = (Int_t)(posLocal[2]/fgkZPad);
874 if (iPadZ==kNpadZ) iPadZ--;
875 else if (iPadZ>kNpadZ) iPadZ=-1;
878 // else AliError("Detector Index could not be determined");
883 //_____________________________________________________________________________
884 Int_t AliTOFGeometry::GetPadX(Float_t *pos) const
887 // Returns the Pad index along X
889 //const Float_t klsensmx = kNpadX*fgkXPad; // length of Sensitive Layer
890 //const Float_t khsensmy = 0.05;//0.11;//0.16;// heigth of Sensitive Layer
891 //const Float_t kwsensmz = kNpadZ*fgkZPad; // width of Sensitive Layer
896 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
898 Int_t isector = GetSector(posLocal);
900 //AliError("Detector Index could not be determined");
902 Int_t iplate = GetPlate(posLocal);
904 //AliError("Detector Index could not be determined");
906 Int_t istrip = GetStrip(posLocal);
908 //AliError("Detector Index could not be determined");
911 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
913 {90., 90.+(isector+0.5)*fgkPhiSec,
915 90., (isector+0.5)*fgkPhiSec
917 Rotation(posLocal,angles);
919 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
920 Translation(posLocal,step);
922 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
930 Rotation(posLocal,angles);
932 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
934 step[1] = GetHeights(iplate,istrip);
935 step[2] = -GetDistances(iplate,istrip);
936 Translation(posLocal,step);
938 if (GetAngles(iplate,istrip) >0.) {
941 angles[2] = 90.+GetAngles(iplate,istrip);
943 angles[4] = GetAngles(iplate,istrip);
946 else if (GetAngles(iplate,istrip)==0.) {
954 else if (GetAngles(iplate,istrip) <0.) {
957 angles[2] = 90.+GetAngles(iplate,istrip);
959 angles[4] =-GetAngles(iplate,istrip);
962 Rotation(posLocal,angles);
964 //if (TMath::Abs(posLocal[0])<=klsensmx*0.5 && /*TMath::Abs(posLocal[1])<=khsensmy*0.5+0.005 &&*/ TMath::Abs(posLocal[2])<=kwsensmz*0.5) {
965 //if (TMath::Abs(posLocal[1])<=khsensmy*0.5) {
967 step[0] =-0.5*kNpadX*fgkXPad;
969 step[2] =-0.5*kNpadZ*fgkZPad;
970 Translation(posLocal,step);
972 iPadX = (Int_t)(posLocal[0]/fgkXPad);
973 if (iPadX==kNpadX) iPadX--;
974 else if (iPadX>kNpadX) iPadX=-1;
977 //else AliError("Detector Index could not be determined");
982 //_____________________________________________________________________________
983 Float_t AliTOFGeometry::GetX(Int_t *det) const
986 // Returns X coordinate (cm)
989 Int_t isector = det[0];
990 Int_t iplate = det[1];
991 Int_t istrip = det[2];
992 Int_t ipadz = det[3];
993 Int_t ipadx = det[4];
996 // Find out distance d on the plane wrt median phi:
997 Float_t d = (ipadx+0.5-kNpadX*0.5)*fgkXPad;
999 // The radius r in xy plane:
1000 //Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
1001 // (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg)-0.25; ???
1002 Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
1003 (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg);
1005 // local azimuthal angle in the sector philoc
1006 Float_t philoc = TMath::ATan(d/r);
1007 //if(philoc<0.) philoc = k2PI + philoc;
1009 // azimuthal angle in the global frame phi
1010 Float_t phi = philoc*kRaddeg+(isector+0.5)*fgkPhiSec;
1012 Float_t xCoor = r/TMath::Cos(philoc)*TMath::Cos(phi/kRaddeg);
1015 // Pad reference frame -> FSTR reference frame
1017 Float_t posLocal[3] = {0., 0., 0.};
1018 Float_t step[3] = {-(ipadx+0.5)*fgkXPad, 0., -(ipadz+0.5)*fgkZPad};
1019 Translation(posLocal,step);
1021 step[0] = kNpadX*0.5*fgkXPad;
1023 step[2] = kNpadZ*0.5*fgkZPad;
1026 Float_t posLocal[3] = {(ipadx+0.5)*fgkXPad, 0., (ipadz+0.5)*fgkZPad};
1027 Float_t step[3]= {kNpadX*0.5*fgkXPad, 0., kNpadZ*0.5*fgkZPad};
1029 Translation(posLocal,step);
1031 // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame
1033 if (GetAngles(iplate,istrip) >0.) {
1036 angles[2] = 90.+GetAngles(iplate,istrip);
1038 angles[4] = GetAngles(iplate,istrip);
1041 else if (GetAngles(iplate,istrip)==0.) {
1049 else if (GetAngles(iplate,istrip) <0.) {
1052 angles[2] = 90.+GetAngles(iplate,istrip);
1054 angles[4] =-GetAngles(iplate,istrip);
1058 InverseRotation(posLocal,angles);
1061 step[1] = -GetHeights(iplate,istrip);
1062 step[2] = GetDistances(iplate,istrip);
1063 Translation(posLocal,step);
1065 // FTOA = FLTA reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1073 InverseRotation(posLocal,angles);
1075 // B071/B074/B075 = BTO1/2/3 reference frame -> ALICE reference frame
1078 step[2] = -((fgkRmax+fgkRmin)*0.5);
1079 Translation(posLocal,step);
1082 angles[1] = 90.+(isector+0.5)*fgkPhiSec;
1086 angles[5] = (isector+0.5)*fgkPhiSec;
1088 InverseRotation(posLocal,angles);
1090 Float_t xCoor = posLocal[0];
1095 //_____________________________________________________________________________
1096 Float_t AliTOFGeometry::GetY(Int_t *det) const
1099 // Returns Y coordinate (cm)
1102 Int_t isector = det[0];
1103 Int_t iplate = det[1];
1104 Int_t istrip = det[2];
1105 Int_t ipadz = det[3];
1106 Int_t ipadx = det[4];
1109 // Find out distance d on the plane wrt median phi:
1110 Float_t d = (ipadx+0.5-kNpadX*0.5)*fgkXPad;
1112 // The radius r in xy plane:
1113 //Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
1114 // (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg)-0.25; ???
1115 Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
1116 (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg);
1118 // local azimuthal angle in the sector philoc
1119 Float_t philoc = TMath::ATan(d/r);
1120 //if(philoc<0.) philoc = k2PI + philoc;
1122 // azimuthal angle in the global frame phi
1123 Float_t phi = philoc*kRaddeg+(isector+0.5)*fgkPhiSec;
1125 Float_t yCoor = r/TMath::Cos(philoc)*TMath::Sin(phi/kRaddeg);
1128 // Pad reference frame -> FSTR reference frame
1130 Float_t posLocal[3] = {0., 0., 0.};
1131 Float_t step[3] = {-(ipadx+0.5)*fgkXPad, 0., -(ipadz+0.5)*fgkZPad};
1132 Translation(posLocal,step);
1134 step[0] = kNpadX*0.5*fgkXPad;
1136 step[2] = kNpadZ*0.5*fgkZPad;
1139 Float_t posLocal[3] = {(ipadx+0.5)*fgkXPad, 0., (ipadz+0.5)*fgkZPad};
1140 Float_t step[3]= {kNpadX*0.5*fgkXPad, 0., kNpadZ*0.5*fgkZPad};
1142 Translation(posLocal,step);
1144 // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame
1147 if (GetAngles(iplate,istrip) >0.) {
1150 angles[2] = 90.+GetAngles(iplate,istrip);
1152 angles[4] = GetAngles(iplate,istrip);
1155 else if (GetAngles(iplate,istrip)==0.) {
1163 else if (GetAngles(iplate,istrip) <0.) {
1166 angles[2] = 90.+GetAngles(iplate,istrip);
1168 angles[4] =-GetAngles(iplate,istrip);
1172 InverseRotation(posLocal,angles);
1175 step[1] = -GetHeights(iplate,istrip);
1176 step[2] = GetDistances(iplate,istrip);
1177 Translation(posLocal,step);
1179 // FTOA = FLTA reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1187 InverseRotation(posLocal,angles);
1189 // B071/B074/B075 = BTO1/2/3 reference frame -> ALICE reference frame
1192 step[2] = -((fgkRmax+fgkRmin)*0.5);
1193 Translation(posLocal,step);
1196 angles[1] = 90.+(isector+0.5)*fgkPhiSec;
1200 angles[5] = (isector+0.5)*fgkPhiSec;
1202 InverseRotation(posLocal,angles);
1204 Float_t yCoor = posLocal[1];
1210 //_____________________________________________________________________________
1211 Float_t AliTOFGeometry::GetZ(Int_t *det) const
1214 // Returns Z coordinate (cm)
1217 Int_t isector = det[0];
1218 Int_t iplate = det[1];
1219 Int_t istrip = det[2];
1220 Int_t ipadz = det[3];
1221 Int_t ipadx = det[4];
1224 Float_t zCoor = GetDistances(iplate,istrip) +
1225 (0.5-ipadz) * fgkZPad * TMath::Cos(GetAngles(iplate,istrip)*kDegrad);
1228 // Pad reference frame -> FSTR reference frame
1230 Float_t posLocal[3] = {0., 0., 0.};
1231 Float_t step[3] = {-(ipadx+0.5)*fgkXPad, 0., -(ipadz+0.5)*fgkZPad};
1232 Translation(posLocal,step);
1234 step[0] = kNpadX*0.5*fgkXPad;
1236 step[2] = kNpadZ*0.5*fgkZPad;
1239 Float_t posLocal[3] = {(ipadx+0.5)*fgkXPad, 0., (ipadz+0.5)*fgkZPad};
1240 Float_t step[3]= {kNpadX*0.5*fgkXPad, 0., kNpadZ*0.5*fgkZPad};
1242 Translation(posLocal,step);
1244 // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame
1246 if (GetAngles(iplate,istrip) >0.) {
1249 angles[2] = 90.+GetAngles(iplate,istrip);
1251 angles[4] = GetAngles(iplate,istrip);
1254 else if (GetAngles(iplate,istrip)==0.) {
1262 else if (GetAngles(iplate,istrip) <0.) {
1265 angles[2] = 90.+GetAngles(iplate,istrip);
1267 angles[4] =-GetAngles(iplate,istrip);
1271 InverseRotation(posLocal,angles);
1274 step[1] = -GetHeights(iplate,istrip);
1275 step[2] = GetDistances(iplate,istrip);
1276 Translation(posLocal,step);
1278 // FTOA = FLTA reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1286 InverseRotation(posLocal,angles);
1288 // B071/B074/B075 = BTO1/2/3 reference frame -> ALICE reference frame
1291 step[2] = -((fgkRmax+fgkRmin)*0.5);
1292 Translation(posLocal,step);
1295 angles[1] = 90.+(isector+0.5)*fgkPhiSec;
1299 angles[5] = (isector+0.5)*fgkPhiSec;
1301 InverseRotation(posLocal,angles);
1303 Float_t zCoor = posLocal[2];
1308 //_____________________________________________________________________________
1310 void AliTOFGeometry::DetToSectorRF(Int_t vol[5], Double_t **coord)
1313 // Returns the local coordinates (x, y, z) in sector reference frame
1314 // for the 4 corners of each sector pad (vol[1], vol[2], vol[3], vol[4])
1317 if (!gGeoManager) printf("ERROR: no TGeo\n");
1319 // ALICE -> TOF Sector
1320 Char_t path1[100]="";
1321 GetVolumePath(vol[0],path1);
1322 gGeoManager->cd(path1);
1323 TGeoHMatrix aliceToSector;
1324 aliceToSector = *gGeoManager->GetCurrentMatrix();
1326 // TOF Sector -> ALICE
1327 //TGeoHMatrix sectorToALICE = aliceToSector.Inverse();
1330 Char_t path2[100]="";
1331 GetVolumePath(vol,path2);
1332 gGeoManager->cd(path2);
1333 TGeoHMatrix aliceToPad;
1334 aliceToPad = *gGeoManager->GetCurrentMatrix();
1337 TGeoHMatrix padToALICE = aliceToPad.Inverse();
1339 // TOF Pad -> TOF Sector
1340 TGeoHMatrix padToSector = padToALICE*aliceToSector;
1342 // TOF Sector -> TOF Pad
1343 //TGeoHMatrix sectorToPad = sectorToALICE*aliceToPad;
1345 // coordinates of the pad bottom corner
1346 Double_t **cornerPad = new Double_t*[4];
1347 for (Int_t ii=0; ii<4; ii++) cornerPad[ii] = new Double_t[3];
1349 cornerPad[0][0] = -fgkXPad/2.;
1350 cornerPad[0][1] = 0.;
1351 cornerPad[0][2] = -fgkZPad/2.;
1353 cornerPad[1][0] = fgkXPad/2.;
1354 cornerPad[1][1] = 0.;
1355 cornerPad[1][2] = -fgkZPad/2.;
1357 cornerPad[2][0] = fgkXPad/2.;
1358 cornerPad[2][1] = 0.;
1359 cornerPad[2][2] = fgkZPad/2.;
1361 cornerPad[3][0] = -fgkXPad/2.;
1362 cornerPad[3][1] = 0.;
1363 cornerPad[3][2] = fgkZPad/2.;
1365 for(Int_t aa=0; aa<4; aa++) for(Int_t bb=0; bb<3; bb++) coord[aa][bb]=0.;
1367 for (Int_t jj=0; jj<4; jj++) padToSector.MasterToLocal(&cornerPad[jj][0], &coord[jj][0]);
1371 //sectorToPad.LocalToMaster(cornerPad, coord);
1374 //_____________________________________________________________________________
1375 Float_t AliTOFGeometry::GetPadDx(Float_t *pos)
1378 // Returns the x coordinate in the Pad reference frame
1383 Float_t posLocal[3];
1384 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
1386 Int_t isector = GetSector(posLocal);
1388 //AliError("Detector Index could not be determined");
1390 Int_t iplate = GetPlate(posLocal);
1392 //AliError("Detector Index could not be determined");
1394 Int_t istrip = GetStrip(posLocal);
1396 //AliError("Detector Index could not be determined");
1398 Int_t ipadz = GetPadZ(posLocal);
1400 //AliError("Detector Index could not be determined");
1402 Int_t ipadx = GetPadX(posLocal);
1404 //AliError("Detector Index could not be determined");
1407 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1408 Double_t angles[6] =
1409 {90., 90.+(isector+0.5)*fgkPhiSec,
1411 90., (isector+0.5)*fgkPhiSec
1413 Rotation(posLocal,angles);
1415 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1416 Translation(posLocal,step);
1418 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
1426 Rotation(posLocal,angles);
1428 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1430 step[1] = GetHeights(iplate,istrip);
1431 step[2] = -GetDistances(iplate,istrip);
1432 Translation(posLocal,step);
1434 if (GetAngles(iplate,istrip) >0.) {
1437 angles[2] = 90.+GetAngles(iplate,istrip);
1439 angles[4] = GetAngles(iplate,istrip);
1442 else if (GetAngles(iplate,istrip)==0.) {
1450 else if (GetAngles(iplate,istrip) <0.) {
1453 angles[2] = 90.+GetAngles(iplate,istrip);
1455 angles[4] =-GetAngles(iplate,istrip);
1458 Rotation(posLocal,angles);
1460 step[0] =-0.5*kNpadX*fgkXPad;
1462 step[2] =-0.5*kNpadZ*fgkZPad;
1463 Translation(posLocal,step);
1465 step[0] = (ipadx+0.5)*fgkXPad;
1467 step[2] = (ipadz+0.5)*fgkZPad;
1468 Translation(posLocal,step);
1475 //_____________________________________________________________________________
1476 Float_t AliTOFGeometry::GetPadDy(Float_t *pos)
1479 // Returns the y coordinate in the Pad reference frame
1484 Float_t posLocal[3];
1485 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
1487 Int_t isector = GetSector(posLocal);
1489 //AliError("Detector Index could not be determined");
1491 Int_t iplate = GetPlate(posLocal);
1493 //AliError("Detector Index could not be determined");
1495 Int_t istrip = GetStrip(posLocal);
1497 //AliError("Detector Index could not be determined");
1499 Int_t ipadz = GetPadZ(posLocal);
1501 //AliError("Detector Index could not be determined");
1503 Int_t ipadx = GetPadX(posLocal);
1505 //AliError("Detector Index could not be determined");
1508 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1509 Double_t angles[6] =
1510 {90., 90.+(isector+0.5)*fgkPhiSec,
1512 90., (isector+0.5)*fgkPhiSec
1514 Rotation(posLocal,angles);
1516 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1517 Translation(posLocal,step);
1519 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
1527 Rotation(posLocal,angles);
1529 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1531 step[1] = GetHeights(iplate,istrip);
1532 step[2] = -GetDistances(iplate,istrip);
1533 Translation(posLocal,step);
1535 if (GetAngles(iplate,istrip) >0.) {
1538 angles[2] = 90.+GetAngles(iplate,istrip);
1540 angles[4] = GetAngles(iplate,istrip);
1543 else if (GetAngles(iplate,istrip)==0.) {
1551 else if (GetAngles(iplate,istrip) <0.) {
1554 angles[2] = 90.+GetAngles(iplate,istrip);
1556 angles[4] =-GetAngles(iplate,istrip);
1559 Rotation(posLocal,angles);
1561 step[0] =-0.5*kNpadX*fgkXPad;
1563 step[2] =-0.5*kNpadZ*fgkZPad;
1564 Translation(posLocal,step);
1566 step[0] = (ipadx+0.5)*fgkXPad;
1568 step[2] = (ipadz+0.5)*fgkZPad;
1569 Translation(posLocal,step);
1576 //_____________________________________________________________________________
1577 Float_t AliTOFGeometry::GetPadDz(Float_t *pos)
1580 // Returns the z coordinate in the Pad reference frame
1585 Float_t posLocal[3];
1586 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
1588 Int_t isector = GetSector(posLocal);
1590 //AliError("Detector Index could not be determined");
1592 Int_t iplate = GetPlate(posLocal);
1594 //AliError("Detector Index could not be determined");
1596 Int_t istrip = GetStrip(posLocal);
1598 //AliError("Detector Index could not be determined");
1600 Int_t ipadz = GetPadZ(posLocal);
1602 //AliError("Detector Index could not be determined");
1604 Int_t ipadx = GetPadX(posLocal);
1606 //AliError("Detector Index could not be determined");
1609 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1610 Double_t angles[6] =
1611 {90., 90.+(isector+0.5)*fgkPhiSec,
1613 90., (isector+0.5)*fgkPhiSec
1615 Rotation(posLocal,angles);
1617 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1618 Translation(posLocal,step);
1620 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
1628 Rotation(posLocal,angles);
1630 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1632 step[1] = GetHeights(iplate,istrip);
1633 step[2] = -GetDistances(iplate,istrip);
1634 Translation(posLocal,step);
1636 if (GetAngles(iplate,istrip) >0.) {
1639 angles[2] = 90.+GetAngles(iplate,istrip);
1641 angles[4] = GetAngles(iplate,istrip);
1644 else if (GetAngles(iplate,istrip)==0.) {
1652 else if (GetAngles(iplate,istrip) <0.) {
1655 angles[2] = 90.+GetAngles(iplate,istrip);
1657 angles[4] =-GetAngles(iplate,istrip);
1660 Rotation(posLocal,angles);
1662 step[0] =-0.5*kNpadX*fgkXPad;
1664 step[2] =-0.5*kNpadZ*fgkZPad;
1665 Translation(posLocal,step);
1667 step[0] = (ipadx+0.5)*fgkXPad;
1669 step[2] = (ipadz+0.5)*fgkZPad;
1670 Translation(posLocal,step);
1677 //_____________________________________________________________________________
1679 void AliTOFGeometry::Translation(Float_t *xyz, Float_t translationVector[3]) const
1682 // Return the vector xyz translated by translationVector vector
1687 for (ii=0; ii<3; ii++)
1688 xyz[ii] -= translationVector[ii];
1693 //_____________________________________________________________________________
1695 void AliTOFGeometry::Rotation(Float_t *xyz, Double_t rotationAngles[6]) const
1698 // Return the vector xyz rotated according to the rotationAngles angles
1703 TRotMatrix *matrix = new TRotMatrix("matrix","matrix", angles[0], angles[1],
1704 angles[2], angles[3],
1705 angles[4], angles[5]);
1708 for (ii=0; ii<6; ii++) rotationAngles[ii]*=kDegrad;
1710 Float_t xyzDummy[3] = {0., 0., 0.};
1712 for (ii=0; ii<3; ii++) {
1714 xyz[0]*TMath::Sin(rotationAngles[2*ii])*TMath::Cos(rotationAngles[2*ii+1]) +
1715 xyz[1]*TMath::Sin(rotationAngles[2*ii])*TMath::Sin(rotationAngles[2*ii+1]) +
1716 xyz[2]*TMath::Cos(rotationAngles[2*ii]);
1719 for (ii=0; ii<3; ii++) xyz[ii]=xyzDummy[ii];
1724 //_____________________________________________________________________________
1725 void AliTOFGeometry::InverseRotation(Float_t *xyz, Double_t rotationAngles[6]) const
1733 for (ii=0; ii<6; ii++) rotationAngles[ii]*=kDegrad;
1735 Float_t xyzDummy[3] = {0., 0., 0.};
1738 xyz[0]*TMath::Sin(rotationAngles[0])*TMath::Cos(rotationAngles[1]) +
1739 xyz[1]*TMath::Sin(rotationAngles[2])*TMath::Cos(rotationAngles[3]) +
1740 xyz[2]*TMath::Sin(rotationAngles[4])*TMath::Cos(rotationAngles[5]);
1743 xyz[0]*TMath::Sin(rotationAngles[0])*TMath::Sin(rotationAngles[1]) +
1744 xyz[1]*TMath::Sin(rotationAngles[2])*TMath::Sin(rotationAngles[3]) +
1745 xyz[2]*TMath::Sin(rotationAngles[4])*TMath::Sin(rotationAngles[5]);
1748 xyz[0]*TMath::Cos(rotationAngles[0]) +
1749 xyz[1]*TMath::Cos(rotationAngles[2]) +
1750 xyz[2]*TMath::Cos(rotationAngles[4]);
1752 for (ii=0; ii<3; ii++) xyz[ii]=xyzDummy[ii];
1757 //_____________________________________________________________________________
1759 Int_t AliTOFGeometry::GetIndex(Int_t *detId)
1761 //Retrieve calibration channel index
1762 Int_t isector = detId[0];
1763 if (isector >= kNSectors){
1764 printf("Wrong sector number in TOF (%d) !",isector);
1767 Int_t iplate = detId[1];
1768 if (iplate >= kNPlates){
1769 printf("Wrong plate number in TOF (%d) !",iplate);
1772 Int_t istrip = detId[2];
1773 Int_t ipadz = detId[3];
1774 Int_t ipadx = detId[4];
1775 Int_t stripOffset = 0;
1781 stripOffset = kNStripC;
1784 stripOffset = kNStripC+kNStripB;
1787 stripOffset = kNStripC+kNStripB+kNStripA;
1790 stripOffset = kNStripC+kNStripB+kNStripA+kNStripB;
1793 printf("Wrong plate number in TOF (%d) !",iplate);
1797 Int_t idet = ((2*(kNStripC+kNStripB)+kNStripA)
1798 *kNpadZ*kNpadX)*isector +
1799 (stripOffset*kNpadZ*kNpadX)+
1800 (kNpadZ*kNpadX)*istrip+