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.20 2007/10/08 17:52:55 decaro
19 hole region in front of PHOS detector: update of sectors' numbers
21 Revision 1.19 2007/10/04 14:05:09 zampolli
22 AliTOFGeometryV5 becoming AliTOFGeometry
24 Revision 1.18 2007/02/19 18:55:26 decaro
25 Added getter methods for volume path (for Event Display)
27 Revision 1.17.1 2006/12/15
28 Added method DetToStripRF(...) to get
29 a pad corner coordinates in its strip reference frame
30 (A.De Caro, M.Di Stefano)
31 Revision 1.17 2006/08/22 13:30:02 arcelli
32 removal of effective c++ warnings (C.Zampolli)
34 Revision 1.16 2006/04/20 22:30:50 hristov
35 Coding conventions (Annalisa)
37 Revision 1.15 2006/04/16 22:29:05 hristov
38 Coding conventions (Annalisa)
40 Revision 1.14 2006/04/05 08:35:38 hristov
41 Coding conventions (S.Arcelli, C.Zampolli)
43 Revision 1.13 2006/03/12 14:37:54 arcelli
44 Changes for TOF Reconstruction using TGeo
46 Revision 1.12 2006/02/28 10:38:00 decaro
47 AliTOFGeometry::fAngles, AliTOFGeometry::fHeights, AliTOFGeometry::fDistances arrays: dimension definition in the right location
49 Revision 1.11 2005/12/15 14:17:29 decaro
50 Correction of some parameter values
52 Revision 1.10 2005/12/15 08:55:32 decaro
53 New TOF geometry description (V5) -G. Cara Romeo and A. De Caro
55 Revision 1.9.1 2005/07/19 A. De Caro
56 Created daughter-classes AliTOFGeometryV4 and AliTOFGeometryV5
57 => moved global methods IsInsideThePad, DistanceToPad,
58 GetPlate, GetSector, GetStrip, GetPadX, GetPadZ,
59 GetX, GetY, GetZ, GetPadDx, GetPadDy and GetPadDz
62 Revision 1.9 2005/10/20 12:41:35 hristov
63 Implementation of parallel tracking. It is not the default version, one can use it passing option MI from AliReconstruction to TOF (M.Ivanov)
65 Revision 1.8 2004/11/29 08:28:01 decaro
66 Introduction of a new TOF constant (i.e. TDC bin width)
68 Revision 1.7 2004/11/05 07:20:08 decaro
69 TOF library splitting and conversion of some printout messages in AliLog schema (T.Kuhr)
71 Revision 1.6 2004/06/15 15:27:59 decaro
72 TOF raw data: preliminary implementation and style changes
74 Revision 1.5 2004/04/20 14:37:22 hristov
75 Using TMath::Abs instead of fabs, arrays of variable size created/deleted correctly (HP,Sun)
77 Revision 1.4 2004/04/13 09:42:51 decaro
78 Track reconstruction code for TOF: updating
80 Revision 1.3 2003/12/29 18:40:39 hristov
81 Copy/paste error corrected
83 Revision 1.2 2003/12/29 17:26:01 hristov
84 Using enum to initaialize static ints in the header file, the initialization of static floats moved to the implementation file
86 Revision 1.1 2003/12/29 15:18:03 decaro
87 TOF geometry updating (addition of AliTOFGeometry)
89 Revision 0.05 2004/6/11 A.De Caro
90 Implement Global method NpadXStrip
91 Insert four float constants (originally in AliTOF class)
92 Revision 0.04 2004/4/05 S.Arcelli
93 Implement Global methods IsInsideThePad
95 Revision 0.03 2003/12/14 S.Arcelli
96 Set Phi range [-180,180]->[0,360]
97 Revision 0.02 2003/12/10 S.Arcelli:
98 Implement Global methods GetPos & GetDetID
99 Revision 0.01 2003/12/04 S.Arcelli
102 ///////////////////////////////////////////////////////////////////////////////
104 // TOF Geometry class //
106 ///////////////////////////////////////////////////////////////////////////////
108 #include "TGeoManager.h"
109 //#include "TGeoMatrix.h"
113 #include "AliConst.h"
115 #include "AliTOFGeometry.h"
117 extern TGeoManager *gGeoManager;
119 ClassImp(AliTOFGeometry)
121 const Float_t AliTOFGeometry::fgkZlenA = 370.6*2.; // length (cm) of the A module
122 const Float_t AliTOFGeometry::fgkZlenB = 146.5; // length (cm) of the B module
123 const Float_t AliTOFGeometry::fgkZlenC = 170.45; // length (cm) of the C module
124 const Float_t AliTOFGeometry::fgkMaxhZtof = 370.6; // Max half z-size of TOF (cm)
126 const Float_t AliTOFGeometry::fgkxTOF = 371.-0.01;// Inner radius of the TOF for Reconstruction (cm)
127 const Float_t AliTOFGeometry::fgkRmin = 370.-0.01;// Inner radius of the TOF (cm)
128 const Float_t AliTOFGeometry::fgkRmax = 399.-0.01;// Outer radius of the TOF (cm)
130 const Int_t AliTOFGeometry::fgkTimeDiff = 25000; // Min signal separation (ps)
131 const Float_t AliTOFGeometry::fgkXPad = 2.5; // Pad size in the x direction (cm)
132 const Float_t AliTOFGeometry::fgkZPad = 3.5; // Pad size in the z direction (cm)
134 const Float_t AliTOFGeometry::fgkStripLength = 122.;// Strip Length (rho X phi direction) (cm)
136 const Float_t AliTOFGeometry::fgkSigmaForTail1= 2.; //Sig1 for simulation of TDC tails
137 const Float_t AliTOFGeometry::fgkSigmaForTail2= 0.5;//Sig2 for simulation of TDC tails
139 const Float_t AliTOFGeometry::fgkPhiSec= 20;//sector Phi width (deg)
141 const Float_t AliTOFGeometry::fgkTdcBin = 24.4; // time-of-flight bin width [ps]
142 const Float_t AliTOFGeometry::fgkToTBin = 48.8; // time-over-threshold bin width [ps]
144 const Float_t AliTOFGeometry::fgkAngles[kNPlates][kMaxNstrip] ={
145 { 43.99, 43.20, 42.40, 41.59, 40.77, 39.94, 39.11, 38.25, 37.40, 36.53,
146 35.65, 34.76, 33.87, 32.96, 32.05, 31.13, 30.19, 29.24, 12.33, 0.00},
148 { 27.26, 26.28, 25.30, 24.31, 23.31, 22.31, 21.30, 20.29, 19.26, 18.24,
149 17.20, 16.16, 15.11, 14.05, 13.00, 11.93, 10.87, 9.80, 8.74, 0.00},
151 { 0.00, 6.30, 5.31, 4.25, 3.19, 2.12, 1.06, 0.00, -1.06, -2.12,
152 -3.19, -4.25, -5.31, -6.30, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00},
154 { -8.74, -9.80, -10.87, -11.93, -13.00, -14.05, -15.11, -16.16, -17.20, -18.24,
155 -19.26, -20.29, -21.30, -22.31, -23.31, -24.31, -25.30, -26.28, -27.26, 0.00},
157 {-12.33, -29.24, -30.19, -31.13, -32.05, -32.96, -33.87, -34.76, -35.65, -36.53,
158 -37.40, -38.25, -39.11, -39.94, -40.77, -41.59, -42.40, -43.20, -43.99, 0.00}
160 const Float_t AliTOFGeometry::fgkHeights[kNPlates][kMaxNstrip]= {
161 {-8.2, -7.5, -8.2, -7.7, -8.1, -7.6, -7.7, -7.7, -7.7, -7.7,
162 -7.5, -7.2, -7.3, -7.5, -7.6, -7.8, -8.3, -9.3, -3.1, 0.0},
164 {-7.9, -8.1, -8.5, -9.0, -10.1, -3.9, -5.9, -7.7, -10.1, -3.6,
165 -5.8, -8.0, -10.4, -4.4, -7.2, -10.2, -4.6, -7.4, -10.4, 0.0},
167 {-2.5, -10.4, -5.0, -9.9, -4.8, -9.9, -4.7, -10.2, -4.7, -9.9,
168 -4.8, -9.9, -5.0, -10.4, -2.5, 0.0, 0.0, 0.0, 0.0, 0.0},
170 {-10.4, -7.4, -4.6, -10.2, -7.2, -4.4, -10.4, -8.0, -5.8, -3.6,
171 -10.1, -7.7, -5.9, -3.9, -10.1, -9.0, -8.5, -8.1, -7.9, 0.0},
173 { -3.1, -9.3, -8.3, -7.8, -7.6, -7.5, -7.3, -7.2, -7.5, -7.7,
174 -7.7, -7.7, -7.7, -7.6, -8.1, -7.7, -8.2, -7.5, -8.2, 0.0}
178 const Float_t AliTOFGeometry::fgkDistances[kNPlates][kMaxNstrip]= {
179 { 364.1, 354.9, 344.5, 335.4, 325.5, 316.6, 307.2, 298.0, 288.9, 280.0,
180 271.3, 262.7, 254.0, 244.8, 236.1, 227.7, 219.1, 210.3, 205.7, 0.0},
182 { 194.2, 186.1, 177.9, 169.8, 161.5, 156.3, 147.8, 139.4, 130.9, 125.6,
183 117.3, 109.2, 101.1, 95.3, 87.1, 79.2, 73.0, 65.1, 57.6, 0.0},
185 { 49.5, 41.3, 35.3, 27.8, 21.2, 13.9, 7.0, 0.0, -7.0, -13.9,
186 -21.2, -27.8, -35.3, -41.3, -49.5, 0.0, 0.0, 0.0, 0.0, 0.0},
188 { -57.6, -65.1, -73.0, -79.2, -87.1, -95.3, -101.1, -109.2, -117.3, -125.6,
189 -130.9, -139.4, -147.8, -156.3, -161.5, -169.8, -177.9, -186.1, -194.2, 0.0},
191 {-205.7, -210.3, -219.1, -227.7, -236.1, -244.8, -254.0, -262.7, -271.3, -280.0,
192 -288.9, -298.0, -307.2, -316.6, -325.5, -335.4, -344.5, -354.9, -364.1, 0.0}
194 //_____________________________________________________________________________
195 AliTOFGeometry::AliTOFGeometry():
199 // AliTOFGeometry default constructor
204 //_____________________________________________________________________________
205 AliTOFGeometry::~AliTOFGeometry()
208 // AliTOFGeometry destructor
211 //_____________________________________________________________________________
212 void AliTOFGeometry::ImportGeometry(){
213 TGeoManager::Import("geometry.root");
215 //_____________________________________________________________________________
216 void AliTOFGeometry::GetPosPar(Int_t *det, Float_t *pos) const
219 // Returns space point coor (x,y,z) (cm) for Detector
220 // Indices (iSect,iPlate,iStrip,iPadX,iPadZ)
228 //_____________________________________________________________________________
229 void AliTOFGeometry::GetDetID( Float_t *pos, Int_t *det) const
232 // Returns Detector Indices (iSect,iPlate,iStrip,iPadX,iPadZ)
233 // space point coor (x,y,z) (cm)
236 det[0]=GetSector(pos);
237 det[1]=GetPlate(pos);
238 det[2]=GetStrip(pos);
243 //_____________________________________________________________________________
245 void AliTOFGeometry::DetToStripRF(Int_t nPadX, Int_t nPadZ, Float_t &x, Float_t &z) const
248 // Returns the local coordinates (x, z) in strip reference frame
249 // for the bottom corner of the pad number (nPadX, nPadZ)
252 const Float_t xCenterStrip = kNpadX * fgkXPad / 2.;
253 const Float_t zCenterStrip = kNpadZ * fgkZPad / 2.;
255 const Float_t xCenterPad = nPadX*fgkXPad + fgkXPad / 2.;
256 const Float_t zCenterPad = nPadZ*fgkZPad + fgkZPad / 2.;
258 x = xCenterPad - xCenterStrip;
259 z = zCenterPad - zCenterStrip;
263 x = (nPadX - kNpadX*0.5) * fgkXPad;
264 z = (nPadZ - kNpadZ*0.5) * fgkZPad;
268 //_____________________________________________________________________________
269 Float_t AliTOFGeometry::DistanceToPadPar(Int_t *det, Float_t *pos, Float_t *dist3d) const
272 // Returns distance of space point with coor pos (x,y,z) (cm) wrt
273 // pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ)
276 //Transform pos into Sector Frame
282 Float_t radius = TMath::Sqrt(x*x+y*y);
283 //Float_t phi=TMath::ATan(y/x);
284 //if(phi<0) phi = k2PI+phi; //2.*TMath::Pi()+phi;
285 Float_t phi = TMath::Pi()+TMath::ATan2(-y,-x);
286 // Get the local angle in the sector philoc
287 Float_t angle = phi*kRaddeg-( Int_t (kRaddeg*phi/fgkPhiSec) + 0.5)*fgkPhiSec;
288 Float_t xs = radius*TMath::Cos(angle/kRaddeg);
289 Float_t ys = radius*TMath::Sin(angle/kRaddeg);
292 // Do the same for the selected pad
297 Float_t padRadius = TMath::Sqrt(g[0]*g[0]+g[1]*g[1]);
298 //Float_t padPhi = TMath::ATan(g[1]/g[0]);
299 //if(padPhi<0) padPhi = k2Pi + padPhi;
300 Float_t padPhi = TMath::Pi()+TMath::ATan2(-g[1],-g[0]);
302 // Get the local angle in the sector philoc
303 Float_t padAngle = padPhi*kRaddeg-( Int_t (padPhi*kRaddeg/fgkPhiSec)+ 0.5) * fgkPhiSec;
304 Float_t padxs = padRadius*TMath::Cos(padAngle/kRaddeg);
305 Float_t padys = padRadius*TMath::Sin(padAngle/kRaddeg);
306 Float_t padzs = g[2];
308 //Now move to local pad coordinate frame. Translate:
310 Float_t xt = xs-padxs;
311 Float_t yt = ys-padys;
312 Float_t zt = zs-padzs;
315 Float_t alpha = GetAngles(det[1],det[2]);
316 Float_t xr = xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg);
318 Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg);
320 Float_t dist = TMath::Sqrt(xr*xr+yr*yr+zr*zr);
331 //_____________________________________________________________________________
332 Bool_t AliTOFGeometry::IsInsideThePadPar(Int_t *det, Float_t *pos) const
335 // Returns true if space point with coor pos (x,y,z) (cm) falls
336 // inside pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ)
339 Bool_t isInside=false;
342 const Float_t khhony = 1.0 ; // heigth of HONY Layer
343 const Float_t khpcby = 0.08 ; // heigth of PCB Layer
344 const Float_t khrgly = 0.055 ; // heigth of RED GLASS Layer
345 const Float_t khglfy = 0.285 ; // heigth of GLASS+FISHLINE Layer
346 const Float_t khcpcby = 0.16 ; // heigth of PCB Central Layer
347 //const Float_t kwcpcbz = 12.4 ; // z dimension of PCB Central Layer
348 const Float_t khstripy = 2.*khhony+2.*khpcby+4.*khrgly+2.*khglfy+khcpcby;//3.11
349 //const Float_t kwstripz = kwcpcbz;
350 //const Float_t klstripx = fgkStripLength;
353 const Float_t kPadDepth = 0.5;//0.05;//0.11;//0.16;// // heigth of Sensitive Layer
355 //Transform pos into Sector Frame
361 Float_t radius = TMath::Sqrt(x*x+y*y);
362 Float_t phi = TMath::Pi()+TMath::ATan2(-y,-x);
364 // Get the local angle in the sector philoc
365 Float_t angle = phi*kRaddeg-( Int_t (kRaddeg*phi/fgkPhiSec) + 0.5) *fgkPhiSec;
366 Float_t xs = radius*TMath::Cos(angle/kRaddeg);
367 Float_t ys = radius*TMath::Sin(angle/kRaddeg);
370 // Do the same for the selected pad
375 Float_t padRadius = TMath::Sqrt(g[0]*g[0]+g[1]*g[1]);
376 Float_t padPhi = TMath::Pi()+TMath::ATan2(-g[1],-g[0]);
378 // Get the local angle in the sector philoc
379 Float_t padAngle = padPhi*kRaddeg-( Int_t (padPhi*kRaddeg/fgkPhiSec)+ 0.5) * fgkPhiSec;
380 Float_t padxs = padRadius*TMath::Cos(padAngle/kRaddeg);
381 Float_t padys = padRadius*TMath::Sin(padAngle/kRaddeg);
382 Float_t padzs = g[2];
384 //Now move to local pad coordinate frame. Translate:
386 Float_t xt = xs-padxs;
387 Float_t yt = ys-padys;
388 Float_t zt = zs-padzs;
392 Float_t alpha = GetAngles(det[1],det[2]);
393 Float_t xr = xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg);
395 Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg);
397 if(TMath::Abs(xr)<=kPadDepth*0.5 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5))
402 //_____________________________________________________________________________
403 Bool_t AliTOFGeometry::IsInsideThePad(TGeoHMatrix mat, Float_t *pos, Float_t *dist3d) const
406 // Returns true if space point with coor pos (x,y,z) (cm) falls
407 // inside pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ)
410 const Float_t kPadDepth = 0.5; // heigth of Sensitive Layer
415 Double_t veclr[3]={-1.,-1.,-1.};
416 Double_t vecl[3]={-1.,-1.,-1.};
417 mat.MasterToLocal(vecg,veclr);
420 //take into account reflections
423 Float_t xr = vecl[0];
424 Float_t yr = vecl[1];
425 Float_t zr = vecl[2];
433 Bool_t isInside=false;
434 if(TMath::Abs(xr)<= kPadDepth*0.5 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5))
439 //_____________________________________________________________________________
440 void AliTOFGeometry::GetVolumePath(Int_t *ind, Char_t *path ) {
441 //--------------------------------------------------------------------
442 // This function returns the colume path of a given pad
443 //--------------------------------------------------------------------
444 Int_t sector = ind[0];
452 sprintf(string1,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1",icopy,icopy);
456 if( iplate==0) icopy=istrip;
457 if( iplate==1) icopy=istrip+NStripC();
458 if( iplate==2) icopy=istrip+NStripC()+NStripB();
459 if( iplate==3) icopy=istrip+NStripC()+NStripB()+NStripA();
460 if( iplate==4) icopy=istrip+NStripC()+2*NStripB()+NStripA();
462 sprintf(string2,"FTOA_0/FLTA_0/FSTR_%i",icopy);
463 if(fHoles && (sector==13 || sector==14 || sector==15)){
464 if(iplate<2) sprintf(string2,"FTOB_0/FLTB_0/FSTR_%i",icopy);
465 if(iplate>2) sprintf(string2,"FTOC_0/FLTC_0/FSTR_%i",icopy);
468 Int_t padz = ind[3]+1;
469 Int_t padx = ind[4]+1;
470 sprintf(string3,"FPCB_1/FSEN_1/FSEZ_%i/FPAD_%i",padz,padx);
471 sprintf(path,"%s/%s/%s",string1,string2,string3);
474 //_____________________________________________________________________________
475 void AliTOFGeometry::GetVolumePath(Int_t sector, Char_t *path ){
476 //--------------------------------------------------------------------
477 // This function returns the colume path of a given sector
478 //--------------------------------------------------------------------
482 Int_t icopy = sector;
484 sprintf(string,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1",icopy,icopy);
485 sprintf(path,"%s",string);
488 //_____________________________________________________________________________
489 void AliTOFGeometry::GetVolumePath(Int_t sector, Int_t plate, Int_t strip, Char_t *path ) {
490 //--------------------------------------------------------------------
491 // This function returns the colume path of a given strip
492 //--------------------------------------------------------------------
498 Int_t icopy = sector;
500 sprintf(string1,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1",icopy,icopy);
502 if(plate==0) icopy=strip;
503 if(plate==1) icopy=strip+NStripC();
504 if(plate==2) icopy=strip+NStripC()+NStripB();
505 if(plate==3) icopy=strip+NStripC()+NStripB()+NStripA();
506 if(plate==4) icopy=strip+NStripC()+2*NStripB()+NStripA();
508 sprintf(string2,"FTOA_0/FLTA_0/FSTR_%i",icopy);
509 if(fHoles && (sector==13 || sector==14 || sector==15)){
510 if(plate<2) sprintf(string2,"FTOB_0/FLTB_0/FSTR_%i",icopy);
511 if(plate>2) sprintf(string2,"FTOC_0/FLTC_0/FSTR_%i",icopy);
514 sprintf(string3,"FPCB_1/FSEN_1");
515 sprintf(path,"%s/%s/%s",string1,string2,string3);
518 //_____________________________________________________________________________
519 void AliTOFGeometry::GetPos(Int_t *det, Float_t *pos)
522 // Returns space point coor (x,y,z) (cm) for Detector
523 // Indices (iSect,iPlate,iStrip,iPadX,iPadZ)
526 GetVolumePath(det,path );
528 printf("ERROR: no TGeo\n");
530 gGeoManager->cd(path);
532 global = *gGeoManager->GetCurrentMatrix();
533 const Double_t *tr = global.GetTranslation();
539 //_____________________________________________________________________________
540 Int_t AliTOFGeometry::GetPlate(Float_t *pos) const
543 // Returns the Plate index
545 const Float_t kInterCentrModBorder1 = 49.5;
546 const Float_t kInterCentrModBorder2 = 57.5;
547 const Float_t kExterInterModBorder1 = 196.0;
548 const Float_t kExterInterModBorder2 = 203.5;
550 const Float_t kLengthExInModBorder = 4.7;
551 const Float_t kLengthInCeModBorder = 7.0;
553 //const Float_t khAlWall = 0.1;
554 const Float_t kModuleWallThickness = 0.3;
555 //const Float_t kHoneycombLayerThickness = 1.5;
560 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
562 Int_t isector = GetSector(posLocal);
564 //AliError("Detector Index could not be determined");
568 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
570 {90., 90.+(isector+0.5)*fgkPhiSec,
572 90., (isector+0.5)*fgkPhiSec
574 Rotation(posLocal,angles);
576 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
577 Translation(posLocal,step);
579 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame
587 Rotation(posLocal,angles);
589 Float_t yLocal = posLocal[1];
590 Float_t zLocal = posLocal[2];
592 Float_t deltaRhoLoc = (fgkRmax-fgkRmin)*0.5 - kModuleWallThickness + yLocal;
593 Float_t deltaZetaLoc = TMath::Abs(zLocal);
595 Float_t deltaRHOmax = 0.;
597 if (TMath::Abs(zLocal)>=kExterInterModBorder1 && TMath::Abs(zLocal)<=kExterInterModBorder2)
599 deltaRhoLoc -= kLengthExInModBorder;
600 deltaZetaLoc = kExterInterModBorder2-deltaZetaLoc;
601 deltaRHOmax = (fgkRmax - fgkRmin)*0.5 - kModuleWallThickness - 2.*kLengthExInModBorder; // old 5.35, new 4.8
603 if (deltaRhoLoc > deltaZetaLoc*deltaRHOmax/(kInterCentrModBorder2-kInterCentrModBorder1)) {
604 if (zLocal<0) iPlate = 0;
608 if (zLocal<0) iPlate = 1;
612 else if (TMath::Abs(zLocal)>=kInterCentrModBorder1 && TMath::Abs(zLocal)<=kInterCentrModBorder2)
614 deltaRhoLoc -= kLengthInCeModBorder;
615 deltaZetaLoc = deltaZetaLoc-kInterCentrModBorder1;
616 deltaRHOmax = (fgkRmax - fgkRmin)*0.5 - kModuleWallThickness - 2.*kLengthInCeModBorder; // old 0.39, new 0.2
618 if (deltaRhoLoc>deltaZetaLoc*deltaRHOmax/(kInterCentrModBorder2-kInterCentrModBorder1)) iPlate = 2;
620 if (zLocal<0) iPlate = 1;
625 if (zLocal>-fgkZlenA*0.5/*fgkMaxhZtof*/ && zLocal<-kExterInterModBorder2) iPlate = 0;
626 else if (zLocal>-kExterInterModBorder1 && zLocal<-kInterCentrModBorder2) iPlate = 1;
627 else if (zLocal>-kInterCentrModBorder1 && zLocal< kInterCentrModBorder1) iPlate = 2;
628 else if (zLocal> kInterCentrModBorder2 && zLocal< kExterInterModBorder1) iPlate = 3;
629 else if (zLocal> kExterInterModBorder2 && zLocal< fgkZlenA*0.5/*fgkMaxhZtof*/) iPlate = 4;
635 //_____________________________________________________________________________
636 Int_t AliTOFGeometry::GetSector(Float_t *pos) const
639 // Returns the Sector index
642 //const Float_t khAlWall = 0.1;
643 //const Float_t kModuleWallThickness = 0.3;
651 Float_t rho = TMath::Sqrt(x*x + y*y);
653 //if (!((z>=-fgkMaxhZtof && z<=fgkMaxhZtof) &&
654 if (!((z>=-fgkZlenA*0.5 && z<=fgkZlenA*0.5) &&
655 (rho>=(fgkRmin) && rho<=(fgkRmax)))) {
656 //(rho>=(fgkRmin-0.05)+kModuleWallThickness && rho<=(fgkRmax-0.05)-kModuleWallThickness-khAlWall-kModuleWallThickness))) {
657 //AliError("Detector Index could not be determined");
661 Float_t phi = TMath::Pi() + TMath::ATan2(-y,-x);
663 iSect = (Int_t) (phi*kRaddeg/fgkPhiSec);
668 //_____________________________________________________________________________
669 Int_t AliTOFGeometry::GetStrip(Float_t *pos) const
672 // Returns the Strip index
674 const Float_t khhony = 1.0 ; // heigth of HONY Layer
675 const Float_t khpcby = 0.08 ; // heigth of PCB Layer
676 const Float_t khrgly = 0.055 ; // heigth of RED GLASS Layer
677 const Float_t khglfy = 0.285 ; // heigth of GLASS+FISHLINE Layer
678 const Float_t khcpcby = 0.16 ; // heigth of PCB Central Layer
679 const Float_t kwcpcbz = 12.4 ; // z dimension of PCB Central Layer
680 const Float_t khstripy = 2.*khhony+2.*khpcby+4.*khrgly+2.*khglfy+khcpcby;//3.11
681 const Float_t kwstripz = kwcpcbz;
682 const Float_t klstripx = fgkStripLength;
687 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
689 Int_t isector = GetSector(posLocal);
691 //AliError("Detector Index could not be determined");
693 Int_t iplate = GetPlate(posLocal);
695 //AliError("Detector Index could not be determined");
717 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
719 {90., 90.+(isector+0.5)*fgkPhiSec,
721 90., (isector+0.5)*fgkPhiSec
723 Rotation(posLocal,angles);
725 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
726 Translation(posLocal,step);
728 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame
736 Rotation(posLocal,angles);
738 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
740 for (Int_t istrip=0; istrip<nstrips; istrip++){
742 Float_t posLoc2[3]={posLocal[0],posLocal[1],posLocal[2]};
745 step[1] = GetHeights(iplate,istrip);
746 step[2] = -GetDistances(iplate,istrip);
747 Translation(posLoc2,step);
749 if (GetAngles(iplate,istrip) >0.) {
752 angles[2] = 90.+GetAngles(iplate,istrip);
754 angles[4] = GetAngles(iplate,istrip);
757 else if (GetAngles(iplate,istrip)==0.) {
765 else if (GetAngles(iplate,istrip) <0.) {
768 angles[2] = 90.+GetAngles(iplate,istrip);
770 angles[4] =-GetAngles(iplate,istrip);
773 Rotation(posLoc2,angles);
775 if ((TMath::Abs(posLoc2[0])<=klstripx*0.5) &&
776 (TMath::Abs(posLoc2[1])<=khstripy*0.5) &&
777 (TMath::Abs(posLoc2[2])<=kwstripz*0.5)) {
780 for (Int_t jj=0; jj<3; jj++) posLocal[jj]=posLoc2[jj];
781 //AliInfo(Form(" posLocal[0] = %f, posLocal[1] = %f, posLocal[2] = %f ", posLocal[0],posLocal[1],posLocal[2]));
783 //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]));
787 if (totStrip>1) AliInfo(Form("total strip number found %2i",totStrip));
794 //_____________________________________________________________________________
795 Int_t AliTOFGeometry::GetPadZ(Float_t *pos) const
798 // Returns the Pad index along Z
800 //const Float_t klsensmx = kNpadX*fgkXPad; // length of Sensitive Layer
801 //const Float_t khsensmy = 0.05;//0.11;//0.16;// heigth of Sensitive Layer
802 //const Float_t kwsensmz = kNpadZ*fgkZPad; // width of Sensitive Layer
807 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
809 Int_t isector = GetSector(posLocal);
811 //AliError("Detector Index could not be determined");
813 Int_t iplate = GetPlate(posLocal);
815 //AliError("Detector Index could not be determined");
817 Int_t istrip = GetStrip(posLocal);
819 //AliError("Detector Index could not be determined");
822 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
824 {90., 90.+(isector+0.5)*fgkPhiSec,
826 90., (isector+0.5)*fgkPhiSec
828 Rotation(posLocal,angles);
830 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
831 Translation(posLocal,step);
833 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame
841 Rotation(posLocal,angles);
843 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
845 step[1] = GetHeights(iplate,istrip);
846 step[2] = -GetDistances(iplate,istrip);
847 Translation(posLocal,step);
849 if (GetAngles(iplate,istrip) >0.) {
852 angles[2] = 90.+GetAngles(iplate,istrip);
854 angles[4] = GetAngles(iplate,istrip);
857 else if (GetAngles(iplate,istrip)==0.) {
865 else if (GetAngles(iplate,istrip) <0.) {
868 angles[2] = 90.+GetAngles(iplate,istrip);
870 angles[4] =-GetAngles(iplate,istrip);
873 Rotation(posLocal,angles);
875 //if (TMath::Abs(posLocal[0])<=klsensmx*0.5 && /*TMath::Abs(posLocal[1])<=khsensmy*0.5+0.005 &&*/ TMath::Abs(posLocal[2])<=kwsensmz*0.5) {
876 //if (TMath::Abs(posLocal[1])<=khsensmy*0.5) {
878 step[0] =-0.5*kNpadX*fgkXPad;
880 step[2] =-0.5*kNpadZ*fgkZPad;
881 Translation(posLocal,step);
883 iPadZ = (Int_t)(posLocal[2]/fgkZPad);
884 if (iPadZ==kNpadZ) iPadZ--;
885 else if (iPadZ>kNpadZ) iPadZ=-1;
888 // else AliError("Detector Index could not be determined");
893 //_____________________________________________________________________________
894 Int_t AliTOFGeometry::GetPadX(Float_t *pos) const
897 // Returns the Pad index along X
899 //const Float_t klsensmx = kNpadX*fgkXPad; // length of Sensitive Layer
900 //const Float_t khsensmy = 0.05;//0.11;//0.16;// heigth of Sensitive Layer
901 //const Float_t kwsensmz = kNpadZ*fgkZPad; // width of Sensitive Layer
906 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
908 Int_t isector = GetSector(posLocal);
910 //AliError("Detector Index could not be determined");
912 Int_t iplate = GetPlate(posLocal);
914 //AliError("Detector Index could not be determined");
916 Int_t istrip = GetStrip(posLocal);
918 //AliError("Detector Index could not be determined");
921 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
923 {90., 90.+(isector+0.5)*fgkPhiSec,
925 90., (isector+0.5)*fgkPhiSec
927 Rotation(posLocal,angles);
929 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
930 Translation(posLocal,step);
932 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
940 Rotation(posLocal,angles);
942 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
944 step[1] = GetHeights(iplate,istrip);
945 step[2] = -GetDistances(iplate,istrip);
946 Translation(posLocal,step);
948 if (GetAngles(iplate,istrip) >0.) {
951 angles[2] = 90.+GetAngles(iplate,istrip);
953 angles[4] = GetAngles(iplate,istrip);
956 else if (GetAngles(iplate,istrip)==0.) {
964 else if (GetAngles(iplate,istrip) <0.) {
967 angles[2] = 90.+GetAngles(iplate,istrip);
969 angles[4] =-GetAngles(iplate,istrip);
972 Rotation(posLocal,angles);
974 //if (TMath::Abs(posLocal[0])<=klsensmx*0.5 && /*TMath::Abs(posLocal[1])<=khsensmy*0.5+0.005 &&*/ TMath::Abs(posLocal[2])<=kwsensmz*0.5) {
975 //if (TMath::Abs(posLocal[1])<=khsensmy*0.5) {
977 step[0] =-0.5*kNpadX*fgkXPad;
979 step[2] =-0.5*kNpadZ*fgkZPad;
980 Translation(posLocal,step);
982 iPadX = (Int_t)(posLocal[0]/fgkXPad);
983 if (iPadX==kNpadX) iPadX--;
984 else if (iPadX>kNpadX) iPadX=-1;
987 //else AliError("Detector Index could not be determined");
992 //_____________________________________________________________________________
993 Float_t AliTOFGeometry::GetX(Int_t *det) const
996 // Returns X coordinate (cm)
999 Int_t isector = det[0];
1000 Int_t iplate = det[1];
1001 Int_t istrip = det[2];
1002 Int_t ipadz = det[3];
1003 Int_t ipadx = det[4];
1006 // Find out distance d on the plane wrt median phi:
1007 Float_t d = (ipadx+0.5-kNpadX*0.5)*fgkXPad;
1009 // The radius r in xy plane:
1010 //Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
1011 // (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg)-0.25; ???
1012 Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
1013 (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg);
1015 // local azimuthal angle in the sector philoc
1016 Float_t philoc = TMath::ATan(d/r);
1017 //if(philoc<0.) philoc = k2PI + philoc;
1019 // azimuthal angle in the global frame phi
1020 Float_t phi = philoc*kRaddeg+(isector+0.5)*fgkPhiSec;
1022 Float_t xCoor = r/TMath::Cos(philoc)*TMath::Cos(phi/kRaddeg);
1025 // Pad reference frame -> FSTR reference frame
1027 Float_t posLocal[3] = {0., 0., 0.};
1028 Float_t step[3] = {-(ipadx+0.5)*fgkXPad, 0., -(ipadz+0.5)*fgkZPad};
1029 Translation(posLocal,step);
1031 step[0] = kNpadX*0.5*fgkXPad;
1033 step[2] = kNpadZ*0.5*fgkZPad;
1036 Float_t posLocal[3] = {(ipadx+0.5)*fgkXPad, 0., (ipadz+0.5)*fgkZPad};
1037 Float_t step[3]= {kNpadX*0.5*fgkXPad, 0., kNpadZ*0.5*fgkZPad};
1039 Translation(posLocal,step);
1041 // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame
1043 if (GetAngles(iplate,istrip) >0.) {
1046 angles[2] = 90.+GetAngles(iplate,istrip);
1048 angles[4] = GetAngles(iplate,istrip);
1051 else if (GetAngles(iplate,istrip)==0.) {
1059 else if (GetAngles(iplate,istrip) <0.) {
1062 angles[2] = 90.+GetAngles(iplate,istrip);
1064 angles[4] =-GetAngles(iplate,istrip);
1068 InverseRotation(posLocal,angles);
1071 step[1] = -GetHeights(iplate,istrip);
1072 step[2] = GetDistances(iplate,istrip);
1073 Translation(posLocal,step);
1075 // FTOA = FLTA reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1083 InverseRotation(posLocal,angles);
1085 // B071/B074/B075 = BTO1/2/3 reference frame -> ALICE reference frame
1088 step[2] = -((fgkRmax+fgkRmin)*0.5);
1089 Translation(posLocal,step);
1092 angles[1] = 90.+(isector+0.5)*fgkPhiSec;
1096 angles[5] = (isector+0.5)*fgkPhiSec;
1098 InverseRotation(posLocal,angles);
1100 Float_t xCoor = posLocal[0];
1105 //_____________________________________________________________________________
1106 Float_t AliTOFGeometry::GetY(Int_t *det) const
1109 // Returns Y coordinate (cm)
1112 Int_t isector = det[0];
1113 Int_t iplate = det[1];
1114 Int_t istrip = det[2];
1115 Int_t ipadz = det[3];
1116 Int_t ipadx = det[4];
1119 // Find out distance d on the plane wrt median phi:
1120 Float_t d = (ipadx+0.5-kNpadX*0.5)*fgkXPad;
1122 // The radius r in xy plane:
1123 //Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
1124 // (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg)-0.25; ???
1125 Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
1126 (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg);
1128 // local azimuthal angle in the sector philoc
1129 Float_t philoc = TMath::ATan(d/r);
1130 //if(philoc<0.) philoc = k2PI + philoc;
1132 // azimuthal angle in the global frame phi
1133 Float_t phi = philoc*kRaddeg+(isector+0.5)*fgkPhiSec;
1135 Float_t yCoor = r/TMath::Cos(philoc)*TMath::Sin(phi/kRaddeg);
1138 // Pad reference frame -> FSTR reference frame
1140 Float_t posLocal[3] = {0., 0., 0.};
1141 Float_t step[3] = {-(ipadx+0.5)*fgkXPad, 0., -(ipadz+0.5)*fgkZPad};
1142 Translation(posLocal,step);
1144 step[0] = kNpadX*0.5*fgkXPad;
1146 step[2] = kNpadZ*0.5*fgkZPad;
1149 Float_t posLocal[3] = {(ipadx+0.5)*fgkXPad, 0., (ipadz+0.5)*fgkZPad};
1150 Float_t step[3]= {kNpadX*0.5*fgkXPad, 0., kNpadZ*0.5*fgkZPad};
1152 Translation(posLocal,step);
1154 // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame
1157 if (GetAngles(iplate,istrip) >0.) {
1160 angles[2] = 90.+GetAngles(iplate,istrip);
1162 angles[4] = GetAngles(iplate,istrip);
1165 else if (GetAngles(iplate,istrip)==0.) {
1173 else if (GetAngles(iplate,istrip) <0.) {
1176 angles[2] = 90.+GetAngles(iplate,istrip);
1178 angles[4] =-GetAngles(iplate,istrip);
1182 InverseRotation(posLocal,angles);
1185 step[1] = -GetHeights(iplate,istrip);
1186 step[2] = GetDistances(iplate,istrip);
1187 Translation(posLocal,step);
1189 // FTOA = FLTA reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1197 InverseRotation(posLocal,angles);
1199 // B071/B074/B075 = BTO1/2/3 reference frame -> ALICE reference frame
1202 step[2] = -((fgkRmax+fgkRmin)*0.5);
1203 Translation(posLocal,step);
1206 angles[1] = 90.+(isector+0.5)*fgkPhiSec;
1210 angles[5] = (isector+0.5)*fgkPhiSec;
1212 InverseRotation(posLocal,angles);
1214 Float_t yCoor = posLocal[1];
1220 //_____________________________________________________________________________
1221 Float_t AliTOFGeometry::GetZ(Int_t *det) const
1224 // Returns Z coordinate (cm)
1227 Int_t isector = det[0];
1228 Int_t iplate = det[1];
1229 Int_t istrip = det[2];
1230 Int_t ipadz = det[3];
1231 Int_t ipadx = det[4];
1234 Float_t zCoor = GetDistances(iplate,istrip) +
1235 (0.5-ipadz) * fgkZPad * TMath::Cos(GetAngles(iplate,istrip)*kDegrad);
1238 // Pad reference frame -> FSTR reference frame
1240 Float_t posLocal[3] = {0., 0., 0.};
1241 Float_t step[3] = {-(ipadx+0.5)*fgkXPad, 0., -(ipadz+0.5)*fgkZPad};
1242 Translation(posLocal,step);
1244 step[0] = kNpadX*0.5*fgkXPad;
1246 step[2] = kNpadZ*0.5*fgkZPad;
1249 Float_t posLocal[3] = {(ipadx+0.5)*fgkXPad, 0., (ipadz+0.5)*fgkZPad};
1250 Float_t step[3]= {kNpadX*0.5*fgkXPad, 0., kNpadZ*0.5*fgkZPad};
1252 Translation(posLocal,step);
1254 // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame
1256 if (GetAngles(iplate,istrip) >0.) {
1259 angles[2] = 90.+GetAngles(iplate,istrip);
1261 angles[4] = GetAngles(iplate,istrip);
1264 else if (GetAngles(iplate,istrip)==0.) {
1272 else if (GetAngles(iplate,istrip) <0.) {
1275 angles[2] = 90.+GetAngles(iplate,istrip);
1277 angles[4] =-GetAngles(iplate,istrip);
1281 InverseRotation(posLocal,angles);
1284 step[1] = -GetHeights(iplate,istrip);
1285 step[2] = GetDistances(iplate,istrip);
1286 Translation(posLocal,step);
1288 // FTOA = FLTA reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1296 InverseRotation(posLocal,angles);
1298 // B071/B074/B075 = BTO1/2/3 reference frame -> ALICE reference frame
1301 step[2] = -((fgkRmax+fgkRmin)*0.5);
1302 Translation(posLocal,step);
1305 angles[1] = 90.+(isector+0.5)*fgkPhiSec;
1309 angles[5] = (isector+0.5)*fgkPhiSec;
1311 InverseRotation(posLocal,angles);
1313 Float_t zCoor = posLocal[2];
1318 //_____________________________________________________________________________
1320 void AliTOFGeometry::DetToSectorRF(Int_t vol[5], Double_t **coord)
1323 // Returns the local coordinates (x, y, z) in sector reference frame
1324 // for the 4 corners of each sector pad (vol[1], vol[2], vol[3], vol[4])
1327 if (!gGeoManager) printf("ERROR: no TGeo\n");
1329 // ALICE -> TOF Sector
1330 Char_t path1[100]="";
1331 GetVolumePath(vol[0],path1);
1332 gGeoManager->cd(path1);
1333 TGeoHMatrix aliceToSector;
1334 aliceToSector = *gGeoManager->GetCurrentMatrix();
1336 // TOF Sector -> ALICE
1337 //TGeoHMatrix sectorToALICE = aliceToSector.Inverse();
1340 Char_t path2[100]="";
1341 GetVolumePath(vol,path2);
1342 gGeoManager->cd(path2);
1343 TGeoHMatrix aliceToPad;
1344 aliceToPad = *gGeoManager->GetCurrentMatrix();
1347 TGeoHMatrix padToALICE = aliceToPad.Inverse();
1349 // TOF Pad -> TOF Sector
1350 TGeoHMatrix padToSector = padToALICE*aliceToSector;
1352 // TOF Sector -> TOF Pad
1353 //TGeoHMatrix sectorToPad = sectorToALICE*aliceToPad;
1355 // coordinates of the pad bottom corner
1356 Double_t **cornerPad = new Double_t*[4];
1357 for (Int_t ii=0; ii<4; ii++) cornerPad[ii] = new Double_t[3];
1359 cornerPad[0][0] = -fgkXPad/2.;
1360 cornerPad[0][1] = 0.;
1361 cornerPad[0][2] = -fgkZPad/2.;
1363 cornerPad[1][0] = fgkXPad/2.;
1364 cornerPad[1][1] = 0.;
1365 cornerPad[1][2] = -fgkZPad/2.;
1367 cornerPad[2][0] = fgkXPad/2.;
1368 cornerPad[2][1] = 0.;
1369 cornerPad[2][2] = fgkZPad/2.;
1371 cornerPad[3][0] = -fgkXPad/2.;
1372 cornerPad[3][1] = 0.;
1373 cornerPad[3][2] = fgkZPad/2.;
1375 for(Int_t aa=0; aa<4; aa++) for(Int_t bb=0; bb<3; bb++) coord[aa][bb]=0.;
1377 for (Int_t jj=0; jj<4; jj++) padToSector.MasterToLocal(&cornerPad[jj][0], &coord[jj][0]);
1381 //sectorToPad.LocalToMaster(cornerPad, coord);
1384 //_____________________________________________________________________________
1385 Float_t AliTOFGeometry::GetPadDx(Float_t *pos)
1388 // Returns the x coordinate in the Pad reference frame
1393 Float_t posLocal[3];
1394 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
1396 Int_t isector = GetSector(posLocal);
1398 //AliError("Detector Index could not be determined");
1400 Int_t iplate = GetPlate(posLocal);
1402 //AliError("Detector Index could not be determined");
1404 Int_t istrip = GetStrip(posLocal);
1406 //AliError("Detector Index could not be determined");
1408 Int_t ipadz = GetPadZ(posLocal);
1410 //AliError("Detector Index could not be determined");
1412 Int_t ipadx = GetPadX(posLocal);
1414 //AliError("Detector Index could not be determined");
1417 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1418 Double_t angles[6] =
1419 {90., 90.+(isector+0.5)*fgkPhiSec,
1421 90., (isector+0.5)*fgkPhiSec
1423 Rotation(posLocal,angles);
1425 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1426 Translation(posLocal,step);
1428 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
1436 Rotation(posLocal,angles);
1438 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1440 step[1] = GetHeights(iplate,istrip);
1441 step[2] = -GetDistances(iplate,istrip);
1442 Translation(posLocal,step);
1444 if (GetAngles(iplate,istrip) >0.) {
1447 angles[2] = 90.+GetAngles(iplate,istrip);
1449 angles[4] = GetAngles(iplate,istrip);
1452 else if (GetAngles(iplate,istrip)==0.) {
1460 else if (GetAngles(iplate,istrip) <0.) {
1463 angles[2] = 90.+GetAngles(iplate,istrip);
1465 angles[4] =-GetAngles(iplate,istrip);
1468 Rotation(posLocal,angles);
1470 step[0] =-0.5*kNpadX*fgkXPad;
1472 step[2] =-0.5*kNpadZ*fgkZPad;
1473 Translation(posLocal,step);
1475 step[0] = (ipadx+0.5)*fgkXPad;
1477 step[2] = (ipadz+0.5)*fgkZPad;
1478 Translation(posLocal,step);
1485 //_____________________________________________________________________________
1486 Float_t AliTOFGeometry::GetPadDy(Float_t *pos)
1489 // Returns the y coordinate in the Pad reference frame
1494 Float_t posLocal[3];
1495 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
1497 Int_t isector = GetSector(posLocal);
1499 //AliError("Detector Index could not be determined");
1501 Int_t iplate = GetPlate(posLocal);
1503 //AliError("Detector Index could not be determined");
1505 Int_t istrip = GetStrip(posLocal);
1507 //AliError("Detector Index could not be determined");
1509 Int_t ipadz = GetPadZ(posLocal);
1511 //AliError("Detector Index could not be determined");
1513 Int_t ipadx = GetPadX(posLocal);
1515 //AliError("Detector Index could not be determined");
1518 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1519 Double_t angles[6] =
1520 {90., 90.+(isector+0.5)*fgkPhiSec,
1522 90., (isector+0.5)*fgkPhiSec
1524 Rotation(posLocal,angles);
1526 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1527 Translation(posLocal,step);
1529 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
1537 Rotation(posLocal,angles);
1539 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1541 step[1] = GetHeights(iplate,istrip);
1542 step[2] = -GetDistances(iplate,istrip);
1543 Translation(posLocal,step);
1545 if (GetAngles(iplate,istrip) >0.) {
1548 angles[2] = 90.+GetAngles(iplate,istrip);
1550 angles[4] = GetAngles(iplate,istrip);
1553 else if (GetAngles(iplate,istrip)==0.) {
1561 else if (GetAngles(iplate,istrip) <0.) {
1564 angles[2] = 90.+GetAngles(iplate,istrip);
1566 angles[4] =-GetAngles(iplate,istrip);
1569 Rotation(posLocal,angles);
1571 step[0] =-0.5*kNpadX*fgkXPad;
1573 step[2] =-0.5*kNpadZ*fgkZPad;
1574 Translation(posLocal,step);
1576 step[0] = (ipadx+0.5)*fgkXPad;
1578 step[2] = (ipadz+0.5)*fgkZPad;
1579 Translation(posLocal,step);
1586 //_____________________________________________________________________________
1587 Float_t AliTOFGeometry::GetPadDz(Float_t *pos)
1590 // Returns the z coordinate in the Pad reference frame
1595 Float_t posLocal[3];
1596 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
1598 Int_t isector = GetSector(posLocal);
1600 //AliError("Detector Index could not be determined");
1602 Int_t iplate = GetPlate(posLocal);
1604 //AliError("Detector Index could not be determined");
1606 Int_t istrip = GetStrip(posLocal);
1608 //AliError("Detector Index could not be determined");
1610 Int_t ipadz = GetPadZ(posLocal);
1612 //AliError("Detector Index could not be determined");
1614 Int_t ipadx = GetPadX(posLocal);
1616 //AliError("Detector Index could not be determined");
1619 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1620 Double_t angles[6] =
1621 {90., 90.+(isector+0.5)*fgkPhiSec,
1623 90., (isector+0.5)*fgkPhiSec
1625 Rotation(posLocal,angles);
1627 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1628 Translation(posLocal,step);
1630 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
1638 Rotation(posLocal,angles);
1640 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1642 step[1] = GetHeights(iplate,istrip);
1643 step[2] = -GetDistances(iplate,istrip);
1644 Translation(posLocal,step);
1646 if (GetAngles(iplate,istrip) >0.) {
1649 angles[2] = 90.+GetAngles(iplate,istrip);
1651 angles[4] = GetAngles(iplate,istrip);
1654 else if (GetAngles(iplate,istrip)==0.) {
1662 else if (GetAngles(iplate,istrip) <0.) {
1665 angles[2] = 90.+GetAngles(iplate,istrip);
1667 angles[4] =-GetAngles(iplate,istrip);
1670 Rotation(posLocal,angles);
1672 step[0] =-0.5*kNpadX*fgkXPad;
1674 step[2] =-0.5*kNpadZ*fgkZPad;
1675 Translation(posLocal,step);
1677 step[0] = (ipadx+0.5)*fgkXPad;
1679 step[2] = (ipadz+0.5)*fgkZPad;
1680 Translation(posLocal,step);
1687 //_____________________________________________________________________________
1689 void AliTOFGeometry::Translation(Float_t *xyz, Float_t translationVector[3]) const
1692 // Return the vector xyz translated by translationVector vector
1697 for (ii=0; ii<3; ii++)
1698 xyz[ii] -= translationVector[ii];
1703 //_____________________________________________________________________________
1705 void AliTOFGeometry::Rotation(Float_t *xyz, Double_t rotationAngles[6]) const
1708 // Return the vector xyz rotated according to the rotationAngles angles
1713 TRotMatrix *matrix = new TRotMatrix("matrix","matrix", angles[0], angles[1],
1714 angles[2], angles[3],
1715 angles[4], angles[5]);
1718 for (ii=0; ii<6; ii++) rotationAngles[ii]*=kDegrad;
1720 Float_t xyzDummy[3] = {0., 0., 0.};
1722 for (ii=0; ii<3; ii++) {
1724 xyz[0]*TMath::Sin(rotationAngles[2*ii])*TMath::Cos(rotationAngles[2*ii+1]) +
1725 xyz[1]*TMath::Sin(rotationAngles[2*ii])*TMath::Sin(rotationAngles[2*ii+1]) +
1726 xyz[2]*TMath::Cos(rotationAngles[2*ii]);
1729 for (ii=0; ii<3; ii++) xyz[ii]=xyzDummy[ii];
1734 //_____________________________________________________________________________
1735 void AliTOFGeometry::InverseRotation(Float_t *xyz, Double_t rotationAngles[6]) const
1743 for (ii=0; ii<6; ii++) rotationAngles[ii]*=kDegrad;
1745 Float_t xyzDummy[3] = {0., 0., 0.};
1748 xyz[0]*TMath::Sin(rotationAngles[0])*TMath::Cos(rotationAngles[1]) +
1749 xyz[1]*TMath::Sin(rotationAngles[2])*TMath::Cos(rotationAngles[3]) +
1750 xyz[2]*TMath::Sin(rotationAngles[4])*TMath::Cos(rotationAngles[5]);
1753 xyz[0]*TMath::Sin(rotationAngles[0])*TMath::Sin(rotationAngles[1]) +
1754 xyz[1]*TMath::Sin(rotationAngles[2])*TMath::Sin(rotationAngles[3]) +
1755 xyz[2]*TMath::Sin(rotationAngles[4])*TMath::Sin(rotationAngles[5]);
1758 xyz[0]*TMath::Cos(rotationAngles[0]) +
1759 xyz[1]*TMath::Cos(rotationAngles[2]) +
1760 xyz[2]*TMath::Cos(rotationAngles[4]);
1762 for (ii=0; ii<3; ii++) xyz[ii]=xyzDummy[ii];
1767 //_____________________________________________________________________________
1769 Int_t AliTOFGeometry::GetIndex(Int_t *detId)
1771 //Retrieve calibration channel index
1772 Int_t isector = detId[0];
1773 if (isector >= kNSectors){
1774 printf("Wrong sector number in TOF (%d) !",isector);
1777 Int_t iplate = detId[1];
1778 if (iplate >= kNPlates){
1779 printf("Wrong plate number in TOF (%d) !",iplate);
1782 Int_t istrip = detId[2];
1783 Int_t ipadz = detId[3];
1784 Int_t ipadx = detId[4];
1785 Int_t stripOffset = 0;
1791 stripOffset = kNStripC;
1794 stripOffset = kNStripC+kNStripB;
1797 stripOffset = kNStripC+kNStripB+kNStripA;
1800 stripOffset = kNStripC+kNStripB+kNStripA+kNStripB;
1803 printf("Wrong plate number in TOF (%d) !",iplate);
1807 Int_t idet = ((2*(kNStripC+kNStripB)+kNStripA)
1808 *kNpadZ*kNpadX)*isector +
1809 (stripOffset*kNpadZ*kNpadX)+
1810 (kNpadZ*kNpadX)*istrip+