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.19 2007/10/04 14:05:09 zampolli
19 AliTOFGeometryV5 becoming AliTOFGeometry
21 Revision 1.18 2007/02/19 18:55:26 decaro
22 Added getter methods for volume path (for Event Display)
24 Revision 1.17.1 2006/12/15
25 Added method DetToStripRF(...) to get
26 a pad corner coordinates in its strip reference frame
27 (A.De Caro, M.Di Stefano)
28 Revision 1.17 2006/08/22 13:30:02 arcelli
29 removal of effective c++ warnings (C.Zampolli)
31 Revision 1.16 2006/04/20 22:30:50 hristov
32 Coding conventions (Annalisa)
34 Revision 1.15 2006/04/16 22:29:05 hristov
35 Coding conventions (Annalisa)
37 Revision 1.14 2006/04/05 08:35:38 hristov
38 Coding conventions (S.Arcelli, C.Zampolli)
40 Revision 1.13 2006/03/12 14:37:54 arcelli
41 Changes for TOF Reconstruction using TGeo
43 Revision 1.12 2006/02/28 10:38:00 decaro
44 AliTOFGeometry::fAngles, AliTOFGeometry::fHeights, AliTOFGeometry::fDistances arrays: dimension definition in the right location
46 Revision 1.11 2005/12/15 14:17:29 decaro
47 Correction of some parameter values
49 Revision 1.10 2005/12/15 08:55:32 decaro
50 New TOF geometry description (V5) -G. Cara Romeo and A. De Caro
52 Revision 1.9.1 2005/07/19 A. De Caro
53 Created daughter-classes AliTOFGeometryV4 and AliTOFGeometryV5
54 => moved global methods IsInsideThePad, DistanceToPad,
55 GetPlate, GetSector, GetStrip, GetPadX, GetPadZ,
56 GetX, GetY, GetZ, GetPadDx, GetPadDy and GetPadDz
59 Revision 1.9 2005/10/20 12:41:35 hristov
60 Implementation of parallel tracking. It is not the default version, one can use it passing option MI from AliReconstruction to TOF (M.Ivanov)
62 Revision 1.8 2004/11/29 08:28:01 decaro
63 Introduction of a new TOF constant (i.e. TDC bin width)
65 Revision 1.7 2004/11/05 07:20:08 decaro
66 TOF library splitting and conversion of some printout messages in AliLog schema (T.Kuhr)
68 Revision 1.6 2004/06/15 15:27:59 decaro
69 TOF raw data: preliminary implementation and style changes
71 Revision 1.5 2004/04/20 14:37:22 hristov
72 Using TMath::Abs instead of fabs, arrays of variable size created/deleted correctly (HP,Sun)
74 Revision 1.4 2004/04/13 09:42:51 decaro
75 Track reconstruction code for TOF: updating
77 Revision 1.3 2003/12/29 18:40:39 hristov
78 Copy/paste error corrected
80 Revision 1.2 2003/12/29 17:26:01 hristov
81 Using enum to initaialize static ints in the header file, the initialization of static floats moved to the implementation file
83 Revision 1.1 2003/12/29 15:18:03 decaro
84 TOF geometry updating (addition of AliTOFGeometry)
86 Revision 0.05 2004/6/11 A.De Caro
87 Implement Global method NpadXStrip
88 Insert four float constants (originally in AliTOF class)
89 Revision 0.04 2004/4/05 S.Arcelli
90 Implement Global methods IsInsideThePad
92 Revision 0.03 2003/12/14 S.Arcelli
93 Set Phi range [-180,180]->[0,360]
94 Revision 0.02 2003/12/10 S.Arcelli:
95 Implement Global methods GetPos & GetDetID
96 Revision 0.01 2003/12/04 S.Arcelli
99 ///////////////////////////////////////////////////////////////////////////////
101 // TOF Geometry class //
103 ///////////////////////////////////////////////////////////////////////////////
105 #include "TGeoManager.h"
106 #include "AliTOFGeometry.h"
108 #include "AliConst.h"
110 extern TGeoManager *gGeoManager;
112 ClassImp(AliTOFGeometry)
114 const Float_t AliTOFGeometry::fgkZlenA = 370.6*2.; // length (cm) of the A module
115 const Float_t AliTOFGeometry::fgkZlenB = 146.5; // length (cm) of the B module
116 const Float_t AliTOFGeometry::fgkZlenC = 170.45; // length (cm) of the C module
117 const Float_t AliTOFGeometry::fgkMaxhZtof = 370.6; // Max half z-size of TOF (cm)
119 const Float_t AliTOFGeometry::fgkxTOF = 371.-0.01;// Inner radius of the TOF for Reconstruction (cm)
120 const Float_t AliTOFGeometry::fgkRmin = 370.-0.01;// Inner radius of the TOF (cm)
121 const Float_t AliTOFGeometry::fgkRmax = 399.-0.01;// Outer radius of the TOF (cm)
123 const Int_t AliTOFGeometry::fgkTimeDiff = 25000; // Min signal separation (ps)
124 const Float_t AliTOFGeometry::fgkXPad = 2.5; // Pad size in the x direction (cm)
125 const Float_t AliTOFGeometry::fgkZPad = 3.5; // Pad size in the z direction (cm)
127 const Float_t AliTOFGeometry::fgkStripLength = 122.;// Strip Length (rho X phi direction) (cm)
129 const Float_t AliTOFGeometry::fgkSigmaForTail1= 2.; //Sig1 for simulation of TDC tails
130 const Float_t AliTOFGeometry::fgkSigmaForTail2= 0.5;//Sig2 for simulation of TDC tails
132 const Float_t AliTOFGeometry::fgkPhiSec= 20;//sector Phi width (deg)
134 const Float_t AliTOFGeometry::fgkTdcBin = 24.4; // time-of-flight bin width [ps]
135 const Float_t AliTOFGeometry::fgkToTBin = 48.8; // time-over-threshold bin width [ps]
137 const Float_t AliTOFGeometry::fgkAngles[kNPlates][kMaxNstrip] ={
138 { 43.99, 43.20, 42.40, 41.59, 40.77, 39.94, 39.11, 38.25, 37.40, 36.53,
139 35.65, 34.76, 33.87, 32.96, 32.05, 31.13, 30.19, 29.24, 12.33, 0.00},
141 { 27.26, 26.28, 25.30, 24.31, 23.31, 22.31, 21.30, 20.29, 19.26, 18.24,
142 17.20, 16.16, 15.11, 14.05, 13.00, 11.93, 10.87, 9.80, 8.74, 0.00},
144 { 0.00, 6.30, 5.31, 4.25, 3.19, 2.12, 1.06, 0.00, -1.06, -2.12,
145 -3.19, -4.25, -5.31, -6.30, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00},
147 { -8.74, -9.80, -10.87, -11.93, -13.00, -14.05, -15.11, -16.16, -17.20, -18.24,
148 -19.26, -20.29, -21.30, -22.31, -23.31, -24.31, -25.30, -26.28, -27.26, 0.00},
150 {-12.33, -29.24, -30.19, -31.13, -32.05, -32.96, -33.87, -34.76, -35.65, -36.53,
151 -37.40, -38.25, -39.11, -39.94, -40.77, -41.59, -42.40, -43.20, -43.99, 0.00}
153 const Float_t AliTOFGeometry::fgkHeights[kNPlates][kMaxNstrip]= {
154 {-8.2, -7.5, -8.2, -7.7, -8.1, -7.6, -7.7, -7.7, -7.7, -7.7,
155 -7.5, -7.2, -7.3, -7.5, -7.6, -7.8, -8.3, -9.3, -3.1, 0.0},
157 {-7.9, -8.1, -8.5, -9.0, -10.1, -3.9, -5.9, -7.7, -10.1, -3.6,
158 -5.8, -8.0, -10.4, -4.4, -7.2, -10.2, -4.6, -7.4, -10.4, 0.0},
160 {-2.5, -10.4, -5.0, -9.9, -4.8, -9.9, -4.7, -10.2, -4.7, -9.9,
161 -4.8, -9.9, -5.0, -10.4, -2.5, 0.0, 0.0, 0.0, 0.0, 0.0},
163 {-10.4, -7.4, -4.6, -10.2, -7.2, -4.4, -10.4, -8.0, -5.8, -3.6,
164 -10.1, -7.7, -5.9, -3.9, -10.1, -9.0, -8.5, -8.1, -7.9, 0.0},
166 { -3.1, -9.3, -8.3, -7.8, -7.6, -7.5, -7.3, -7.2, -7.5, -7.7,
167 -7.7, -7.7, -7.7, -7.6, -8.1, -7.7, -8.2, -7.5, -8.2, 0.0}
171 const Float_t AliTOFGeometry::fgkDistances[kNPlates][kMaxNstrip]= {
172 { 364.1, 354.9, 344.5, 335.4, 325.5, 316.6, 307.2, 298.0, 288.9, 280.0,
173 271.3, 262.7, 254.0, 244.8, 236.1, 227.7, 219.1, 210.3, 205.7, 0.0},
175 { 194.2, 186.1, 177.9, 169.8, 161.5, 156.3, 147.8, 139.4, 130.9, 125.6,
176 117.3, 109.2, 101.1, 95.3, 87.1, 79.2, 73.0, 65.1, 57.6, 0.0},
178 { 49.5, 41.3, 35.3, 27.8, 21.2, 13.9, 7.0, 0.0, -7.0, -13.9,
179 -21.2, -27.8, -35.3, -41.3, -49.5, 0.0, 0.0, 0.0, 0.0, 0.0},
181 { -57.6, -65.1, -73.0, -79.2, -87.1, -95.3, -101.1, -109.2, -117.3, -125.6,
182 -130.9, -139.4, -147.8, -156.3, -161.5, -169.8, -177.9, -186.1, -194.2, 0.0},
184 {-205.7, -210.3, -219.1, -227.7, -236.1, -244.8, -254.0, -262.7, -271.3, -280.0,
185 -288.9, -298.0, -307.2, -316.6, -325.5, -335.4, -344.5, -354.9, -364.1, 0.0}
187 //_____________________________________________________________________________
188 AliTOFGeometry::AliTOFGeometry():
192 // AliTOFGeometry default constructor
197 //_____________________________________________________________________________
198 AliTOFGeometry::~AliTOFGeometry()
201 // AliTOFGeometry destructor
204 //_____________________________________________________________________________
205 void AliTOFGeometry::ImportGeometry(){
206 TGeoManager::Import("geometry.root");
208 //_____________________________________________________________________________
209 void AliTOFGeometry::GetPosPar(Int_t *det, Float_t *pos) const
212 // Returns space point coor (x,y,z) (cm) for Detector
213 // Indices (iSect,iPlate,iStrip,iPadX,iPadZ)
221 //_____________________________________________________________________________
222 void AliTOFGeometry::GetDetID( Float_t *pos, Int_t *det) const
225 // Returns Detector Indices (iSect,iPlate,iStrip,iPadX,iPadZ)
226 // space point coor (x,y,z) (cm)
229 det[0]=GetSector(pos);
230 det[1]=GetPlate(pos);
231 det[2]=GetStrip(pos);
236 //_____________________________________________________________________________
238 void AliTOFGeometry::DetToStripRF(Int_t nPadX, Int_t nPadZ, Float_t &x, Float_t &z) const
241 // Returns the local coordinates (x, z) in strip reference frame
242 // for the bottom corner of the pad number (nPadX, nPadZ)
245 const Float_t xCenterStrip = kNpadX * fgkXPad / 2.;
246 const Float_t zCenterStrip = kNpadZ * fgkZPad / 2.;
248 const Float_t xCenterPad = nPadX*fgkXPad + fgkXPad / 2.;
249 const Float_t zCenterPad = nPadZ*fgkZPad + fgkZPad / 2.;
251 x = xCenterPad - xCenterStrip;
252 z = zCenterPad - zCenterStrip;
256 x = (nPadX - kNpadX*0.5) * fgkXPad;
257 z = (nPadZ - kNpadZ*0.5) * fgkZPad;
261 //_____________________________________________________________________________
262 Float_t AliTOFGeometry::DistanceToPadPar(Int_t *det, Float_t *pos, Float_t *dist3d) const
265 // Returns distance of space point with coor pos (x,y,z) (cm) wrt
266 // pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ)
269 //Transform pos into Sector Frame
275 Float_t radius = TMath::Sqrt(x*x+y*y);
276 //Float_t phi=TMath::ATan(y/x);
277 //if(phi<0) phi = k2PI+phi; //2.*TMath::Pi()+phi;
278 Float_t phi = TMath::Pi()+TMath::ATan2(-y,-x);
279 // Get the local angle in the sector philoc
280 Float_t angle = phi*kRaddeg-( Int_t (kRaddeg*phi/fgkPhiSec) + 0.5)*fgkPhiSec;
281 Float_t xs = radius*TMath::Cos(angle/kRaddeg);
282 Float_t ys = radius*TMath::Sin(angle/kRaddeg);
285 // Do the same for the selected pad
290 Float_t padRadius = TMath::Sqrt(g[0]*g[0]+g[1]*g[1]);
291 //Float_t padPhi = TMath::ATan(g[1]/g[0]);
292 //if(padPhi<0) padPhi = k2Pi + padPhi;
293 Float_t padPhi = TMath::Pi()+TMath::ATan2(-g[1],-g[0]);
295 // Get the local angle in the sector philoc
296 Float_t padAngle = padPhi*kRaddeg-( Int_t (padPhi*kRaddeg/fgkPhiSec)+ 0.5) * fgkPhiSec;
297 Float_t padxs = padRadius*TMath::Cos(padAngle/kRaddeg);
298 Float_t padys = padRadius*TMath::Sin(padAngle/kRaddeg);
299 Float_t padzs = g[2];
301 //Now move to local pad coordinate frame. Translate:
303 Float_t xt = xs-padxs;
304 Float_t yt = ys-padys;
305 Float_t zt = zs-padzs;
308 Float_t alpha = GetAngles(det[1],det[2]);
309 Float_t xr = xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg);
311 Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg);
313 Float_t dist = TMath::Sqrt(xr*xr+yr*yr+zr*zr);
324 //_____________________________________________________________________________
325 Bool_t AliTOFGeometry::IsInsideThePadPar(Int_t *det, Float_t *pos) const
328 // Returns true if space point with coor pos (x,y,z) (cm) falls
329 // inside pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ)
332 Bool_t isInside=false;
335 const Float_t khhony = 1.0 ; // heigth of HONY Layer
336 const Float_t khpcby = 0.08 ; // heigth of PCB Layer
337 const Float_t khrgly = 0.055 ; // heigth of RED GLASS Layer
338 const Float_t khglfy = 0.285 ; // heigth of GLASS+FISHLINE Layer
339 const Float_t khcpcby = 0.16 ; // heigth of PCB Central Layer
340 //const Float_t kwcpcbz = 12.4 ; // z dimension of PCB Central Layer
341 const Float_t khstripy = 2.*khhony+2.*khpcby+4.*khrgly+2.*khglfy+khcpcby;//3.11
342 //const Float_t kwstripz = kwcpcbz;
343 //const Float_t klstripx = fgkStripLength;
346 const Float_t kPadDepth = 0.5;//0.05;//0.11;//0.16;// // heigth of Sensitive Layer
348 //Transform pos into Sector Frame
354 Float_t radius = TMath::Sqrt(x*x+y*y);
355 Float_t phi = TMath::Pi()+TMath::ATan2(-y,-x);
357 // Get the local angle in the sector philoc
358 Float_t angle = phi*kRaddeg-( Int_t (kRaddeg*phi/fgkPhiSec) + 0.5) *fgkPhiSec;
359 Float_t xs = radius*TMath::Cos(angle/kRaddeg);
360 Float_t ys = radius*TMath::Sin(angle/kRaddeg);
363 // Do the same for the selected pad
368 Float_t padRadius = TMath::Sqrt(g[0]*g[0]+g[1]*g[1]);
369 Float_t padPhi = TMath::Pi()+TMath::ATan2(-g[1],-g[0]);
371 // Get the local angle in the sector philoc
372 Float_t padAngle = padPhi*kRaddeg-( Int_t (padPhi*kRaddeg/fgkPhiSec)+ 0.5) * fgkPhiSec;
373 Float_t padxs = padRadius*TMath::Cos(padAngle/kRaddeg);
374 Float_t padys = padRadius*TMath::Sin(padAngle/kRaddeg);
375 Float_t padzs = g[2];
377 //Now move to local pad coordinate frame. Translate:
379 Float_t xt = xs-padxs;
380 Float_t yt = ys-padys;
381 Float_t zt = zs-padzs;
385 Float_t alpha = GetAngles(det[1],det[2]);
386 Float_t xr = xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg);
388 Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg);
390 if(TMath::Abs(xr)<=kPadDepth*0.5 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5))
395 //_____________________________________________________________________________
396 Bool_t AliTOFGeometry::IsInsideThePad(TGeoHMatrix mat, Float_t *pos, Float_t *dist3d) const
399 // Returns true if space point with coor pos (x,y,z) (cm) falls
400 // inside pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ)
403 const Float_t kPadDepth = 0.5; // heigth of Sensitive Layer
408 Double_t veclr[3]={-1.,-1.,-1.};
409 Double_t vecl[3]={-1.,-1.,-1.};
410 mat.MasterToLocal(vecg,veclr);
413 //take into account reflections
416 Float_t xr = vecl[0];
417 Float_t yr = vecl[1];
418 Float_t zr = vecl[2];
426 Bool_t isInside=false;
427 if(TMath::Abs(xr)<= kPadDepth*0.5 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5))
432 //_____________________________________________________________________________
433 void AliTOFGeometry::GetVolumePath(Int_t *ind, Char_t *path ) {
434 //--------------------------------------------------------------------
435 // This function returns the colume path of a given pad
436 //--------------------------------------------------------------------
437 Int_t sector = ind[0];
445 sprintf(string1,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1",icopy,icopy);
449 if( iplate==0) icopy=istrip;
450 if( iplate==1) icopy=istrip+NStripC();
451 if( iplate==2) icopy=istrip+NStripC()+NStripB();
452 if( iplate==3) icopy=istrip+NStripC()+NStripB()+NStripA();
453 if( iplate==4) icopy=istrip+NStripC()+2*NStripB()+NStripA();
455 sprintf(string2,"FTOA_0/FLTA_0/FSTR_%i",icopy);
456 if(fHoles && (sector==13 || sector==14 || sector==15)){
457 if(iplate<2) sprintf(string2,"FTOB_0/FLTB_0/FSTR_%i",icopy);
458 if(iplate>2) sprintf(string2,"FTOC_0/FLTC_0/FSTR_%i",icopy);
461 Int_t padz = ind[3]+1;
462 Int_t padx = ind[4]+1;
463 sprintf(string3,"FPCB_1/FSEN_1/FSEZ_%i/FPAD_%i",padz,padx);
464 sprintf(path,"%s/%s/%s",string1,string2,string3);
467 //_____________________________________________________________________________
468 void AliTOFGeometry::GetVolumePath(Int_t sector, Char_t *path ){
469 //--------------------------------------------------------------------
470 // This function returns the colume path of a given sector
471 //--------------------------------------------------------------------
475 Int_t icopy = sector;
477 sprintf(string,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1",icopy,icopy);
478 sprintf(path,"%s",string);
481 //_____________________________________________________________________________
482 void AliTOFGeometry::GetVolumePath(Int_t sector, Int_t plate, Int_t strip, Char_t *path ) {
483 //--------------------------------------------------------------------
484 // This function returns the colume path of a given strip
485 //--------------------------------------------------------------------
491 Int_t icopy = sector;
493 sprintf(string1,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1",icopy,icopy);
495 if(plate==0) icopy=strip;
496 if(plate==1) icopy=strip+NStripC();
497 if(plate==2) icopy=strip+NStripC()+NStripB();
498 if(plate==3) icopy=strip+NStripC()+NStripB()+NStripA();
499 if(plate==4) icopy=strip+NStripC()+2*NStripB()+NStripA();
501 sprintf(string2,"FTOA_0/FLTA_0/FSTR_%i",icopy);
502 if(fHoles && (sector==13 || sector==14 || sector==15)){
503 if(plate<2) sprintf(string2,"FTOB_0/FLTB_0/FSTR_%i",icopy);
504 if(plate>2) sprintf(string2,"FTOC_0/FLTC_0/FSTR_%i",icopy);
507 sprintf(string3,"FPCB_1/FSEN_1");
508 sprintf(path,"%s/%s/%s",string1,string2,string3);
511 //_____________________________________________________________________________
512 void AliTOFGeometry::GetPos(Int_t *det, Float_t *pos)
515 // Returns space point coor (x,y,z) (cm) for Detector
516 // Indices (iSect,iPlate,iStrip,iPadX,iPadZ)
519 GetVolumePath(det,path );
521 printf("ERROR: no TGeo\n");
523 gGeoManager->cd(path);
525 global = *gGeoManager->GetCurrentMatrix();
526 const Double_t *tr = global.GetTranslation();
532 //_____________________________________________________________________________
533 Int_t AliTOFGeometry::GetPlate(Float_t *pos) const
536 // Returns the Plate index
538 const Float_t kInterCentrModBorder1 = 49.5;
539 const Float_t kInterCentrModBorder2 = 57.5;
540 const Float_t kExterInterModBorder1 = 196.0;
541 const Float_t kExterInterModBorder2 = 203.5;
543 const Float_t kLengthExInModBorder = 4.7;
544 const Float_t kLengthInCeModBorder = 7.0;
546 //const Float_t khAlWall = 0.1;
547 const Float_t kModuleWallThickness = 0.3;
548 //const Float_t kHoneycombLayerThickness = 1.5;
553 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
555 Int_t isector = GetSector(posLocal);
557 //AliError("Detector Index could not be determined");
561 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
563 {90., 90.+(isector+0.5)*fgkPhiSec,
565 90., (isector+0.5)*fgkPhiSec
567 Rotation(posLocal,angles);
569 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
570 Translation(posLocal,step);
572 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame
580 Rotation(posLocal,angles);
582 Float_t yLocal = posLocal[1];
583 Float_t zLocal = posLocal[2];
585 Float_t deltaRhoLoc = (fgkRmax-fgkRmin)*0.5 - kModuleWallThickness + yLocal;
586 Float_t deltaZetaLoc = TMath::Abs(zLocal);
588 Float_t deltaRHOmax = 0.;
590 if (TMath::Abs(zLocal)>=kExterInterModBorder1 && TMath::Abs(zLocal)<=kExterInterModBorder2)
592 deltaRhoLoc -= kLengthExInModBorder;
593 deltaZetaLoc = kExterInterModBorder2-deltaZetaLoc;
594 deltaRHOmax = (fgkRmax - fgkRmin)*0.5 - kModuleWallThickness - 2.*kLengthExInModBorder; // old 5.35, new 4.8
596 if (deltaRhoLoc > deltaZetaLoc*deltaRHOmax/(kInterCentrModBorder2-kInterCentrModBorder1)) {
597 if (zLocal<0) iPlate = 0;
601 if (zLocal<0) iPlate = 1;
605 else if (TMath::Abs(zLocal)>=kInterCentrModBorder1 && TMath::Abs(zLocal)<=kInterCentrModBorder2)
607 deltaRhoLoc -= kLengthInCeModBorder;
608 deltaZetaLoc = deltaZetaLoc-kInterCentrModBorder1;
609 deltaRHOmax = (fgkRmax - fgkRmin)*0.5 - kModuleWallThickness - 2.*kLengthInCeModBorder; // old 0.39, new 0.2
611 if (deltaRhoLoc>deltaZetaLoc*deltaRHOmax/(kInterCentrModBorder2-kInterCentrModBorder1)) iPlate = 2;
613 if (zLocal<0) iPlate = 1;
618 if (zLocal>-fgkZlenA*0.5/*fgkMaxhZtof*/ && zLocal<-kExterInterModBorder2) iPlate = 0;
619 else if (zLocal>-kExterInterModBorder1 && zLocal<-kInterCentrModBorder2) iPlate = 1;
620 else if (zLocal>-kInterCentrModBorder1 && zLocal< kInterCentrModBorder1) iPlate = 2;
621 else if (zLocal> kInterCentrModBorder2 && zLocal< kExterInterModBorder1) iPlate = 3;
622 else if (zLocal> kExterInterModBorder2 && zLocal< fgkZlenA*0.5/*fgkMaxhZtof*/) iPlate = 4;
628 //_____________________________________________________________________________
629 Int_t AliTOFGeometry::GetSector(Float_t *pos) const
632 // Returns the Sector index
635 //const Float_t khAlWall = 0.1;
636 //const Float_t kModuleWallThickness = 0.3;
644 Float_t rho = TMath::Sqrt(x*x + y*y);
646 //if (!((z>=-fgkMaxhZtof && z<=fgkMaxhZtof) &&
647 if (!((z>=-fgkZlenA*0.5 && z<=fgkZlenA*0.5) &&
648 (rho>=(fgkRmin) && rho<=(fgkRmax)))) {
649 //(rho>=(fgkRmin-0.05)+kModuleWallThickness && rho<=(fgkRmax-0.05)-kModuleWallThickness-khAlWall-kModuleWallThickness))) {
650 //AliError("Detector Index could not be determined");
654 Float_t phi = TMath::Pi() + TMath::ATan2(-y,-x);
656 iSect = (Int_t) (phi*kRaddeg/fgkPhiSec);
661 //_____________________________________________________________________________
662 Int_t AliTOFGeometry::GetStrip(Float_t *pos) const
665 // Returns the Strip index
667 const Float_t khhony = 1.0 ; // heigth of HONY Layer
668 const Float_t khpcby = 0.08 ; // heigth of PCB Layer
669 const Float_t khrgly = 0.055 ; // heigth of RED GLASS Layer
670 const Float_t khglfy = 0.285 ; // heigth of GLASS+FISHLINE Layer
671 const Float_t khcpcby = 0.16 ; // heigth of PCB Central Layer
672 const Float_t kwcpcbz = 12.4 ; // z dimension of PCB Central Layer
673 const Float_t khstripy = 2.*khhony+2.*khpcby+4.*khrgly+2.*khglfy+khcpcby;//3.11
674 const Float_t kwstripz = kwcpcbz;
675 const Float_t klstripx = fgkStripLength;
680 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
682 Int_t isector = GetSector(posLocal);
684 //AliError("Detector Index could not be determined");
686 Int_t iplate = GetPlate(posLocal);
688 //AliError("Detector Index could not be determined");
710 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
712 {90., 90.+(isector+0.5)*fgkPhiSec,
714 90., (isector+0.5)*fgkPhiSec
716 Rotation(posLocal,angles);
718 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
719 Translation(posLocal,step);
721 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame
729 Rotation(posLocal,angles);
731 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
733 for (Int_t istrip=0; istrip<nstrips; istrip++){
735 Float_t posLoc2[3]={posLocal[0],posLocal[1],posLocal[2]};
738 step[1] = GetHeights(iplate,istrip);
739 step[2] = -GetDistances(iplate,istrip);
740 Translation(posLoc2,step);
742 if (GetAngles(iplate,istrip) >0.) {
745 angles[2] = 90.+GetAngles(iplate,istrip);
747 angles[4] = GetAngles(iplate,istrip);
750 else if (GetAngles(iplate,istrip)==0.) {
758 else if (GetAngles(iplate,istrip) <0.) {
761 angles[2] = 90.+GetAngles(iplate,istrip);
763 angles[4] =-GetAngles(iplate,istrip);
766 Rotation(posLoc2,angles);
768 if ((TMath::Abs(posLoc2[0])<=klstripx*0.5) &&
769 (TMath::Abs(posLoc2[1])<=khstripy*0.5) &&
770 (TMath::Abs(posLoc2[2])<=kwstripz*0.5)) {
773 for (Int_t jj=0; jj<3; jj++) posLocal[jj]=posLoc2[jj];
774 //AliInfo(Form(" posLocal[0] = %f, posLocal[1] = %f, posLocal[2] = %f ", posLocal[0],posLocal[1],posLocal[2]));
776 //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]));
780 if (totStrip>1) AliInfo(Form("total strip number found %2i",totStrip));
787 //_____________________________________________________________________________
788 Int_t AliTOFGeometry::GetPadZ(Float_t *pos) const
791 // Returns the Pad index along Z
793 //const Float_t klsensmx = kNpadX*fgkXPad; // length of Sensitive Layer
794 //const Float_t khsensmy = 0.05;//0.11;//0.16;// heigth of Sensitive Layer
795 //const Float_t kwsensmz = kNpadZ*fgkZPad; // width of Sensitive Layer
800 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
802 Int_t isector = GetSector(posLocal);
804 //AliError("Detector Index could not be determined");
806 Int_t iplate = GetPlate(posLocal);
808 //AliError("Detector Index could not be determined");
810 Int_t istrip = GetStrip(posLocal);
812 //AliError("Detector Index could not be determined");
815 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
817 {90., 90.+(isector+0.5)*fgkPhiSec,
819 90., (isector+0.5)*fgkPhiSec
821 Rotation(posLocal,angles);
823 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
824 Translation(posLocal,step);
826 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame
834 Rotation(posLocal,angles);
836 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
838 step[1] = GetHeights(iplate,istrip);
839 step[2] = -GetDistances(iplate,istrip);
840 Translation(posLocal,step);
842 if (GetAngles(iplate,istrip) >0.) {
845 angles[2] = 90.+GetAngles(iplate,istrip);
847 angles[4] = GetAngles(iplate,istrip);
850 else if (GetAngles(iplate,istrip)==0.) {
858 else if (GetAngles(iplate,istrip) <0.) {
861 angles[2] = 90.+GetAngles(iplate,istrip);
863 angles[4] =-GetAngles(iplate,istrip);
866 Rotation(posLocal,angles);
868 //if (TMath::Abs(posLocal[0])<=klsensmx*0.5 && /*TMath::Abs(posLocal[1])<=khsensmy*0.5+0.005 &&*/ TMath::Abs(posLocal[2])<=kwsensmz*0.5) {
869 //if (TMath::Abs(posLocal[1])<=khsensmy*0.5) {
871 step[0] =-0.5*kNpadX*fgkXPad;
873 step[2] =-0.5*kNpadZ*fgkZPad;
874 Translation(posLocal,step);
876 iPadZ = (Int_t)(posLocal[2]/fgkZPad);
877 if (iPadZ==kNpadZ) iPadZ--;
878 else if (iPadZ>kNpadZ) iPadZ=-1;
881 // else AliError("Detector Index could not be determined");
886 //_____________________________________________________________________________
887 Int_t AliTOFGeometry::GetPadX(Float_t *pos) const
890 // Returns the Pad index along X
892 //const Float_t klsensmx = kNpadX*fgkXPad; // length of Sensitive Layer
893 //const Float_t khsensmy = 0.05;//0.11;//0.16;// heigth of Sensitive Layer
894 //const Float_t kwsensmz = kNpadZ*fgkZPad; // width of Sensitive Layer
899 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
901 Int_t isector = GetSector(posLocal);
903 //AliError("Detector Index could not be determined");
905 Int_t iplate = GetPlate(posLocal);
907 //AliError("Detector Index could not be determined");
909 Int_t istrip = GetStrip(posLocal);
911 //AliError("Detector Index could not be determined");
914 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
916 {90., 90.+(isector+0.5)*fgkPhiSec,
918 90., (isector+0.5)*fgkPhiSec
920 Rotation(posLocal,angles);
922 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
923 Translation(posLocal,step);
925 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
933 Rotation(posLocal,angles);
935 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
937 step[1] = GetHeights(iplate,istrip);
938 step[2] = -GetDistances(iplate,istrip);
939 Translation(posLocal,step);
941 if (GetAngles(iplate,istrip) >0.) {
944 angles[2] = 90.+GetAngles(iplate,istrip);
946 angles[4] = GetAngles(iplate,istrip);
949 else if (GetAngles(iplate,istrip)==0.) {
957 else if (GetAngles(iplate,istrip) <0.) {
960 angles[2] = 90.+GetAngles(iplate,istrip);
962 angles[4] =-GetAngles(iplate,istrip);
965 Rotation(posLocal,angles);
967 //if (TMath::Abs(posLocal[0])<=klsensmx*0.5 && /*TMath::Abs(posLocal[1])<=khsensmy*0.5+0.005 &&*/ TMath::Abs(posLocal[2])<=kwsensmz*0.5) {
968 //if (TMath::Abs(posLocal[1])<=khsensmy*0.5) {
970 step[0] =-0.5*kNpadX*fgkXPad;
972 step[2] =-0.5*kNpadZ*fgkZPad;
973 Translation(posLocal,step);
975 iPadX = (Int_t)(posLocal[0]/fgkXPad);
976 if (iPadX==kNpadX) iPadX--;
977 else if (iPadX>kNpadX) iPadX=-1;
980 //else AliError("Detector Index could not be determined");
985 //_____________________________________________________________________________
986 Float_t AliTOFGeometry::GetX(Int_t *det) const
989 // Returns X coordinate (cm)
992 Int_t isector = det[0];
993 Int_t iplate = det[1];
994 Int_t istrip = det[2];
995 Int_t ipadz = det[3];
996 Int_t ipadx = det[4];
999 // Find out distance d on the plane wrt median phi:
1000 Float_t d = (ipadx+0.5-kNpadX*0.5)*fgkXPad;
1002 // The radius r in xy plane:
1003 //Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
1004 // (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg)-0.25; ???
1005 Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
1006 (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg);
1008 // local azimuthal angle in the sector philoc
1009 Float_t philoc = TMath::ATan(d/r);
1010 //if(philoc<0.) philoc = k2PI + philoc;
1012 // azimuthal angle in the global frame phi
1013 Float_t phi = philoc*kRaddeg+(isector+0.5)*fgkPhiSec;
1015 Float_t xCoor = r/TMath::Cos(philoc)*TMath::Cos(phi/kRaddeg);
1018 // Pad reference frame -> FSTR reference frame
1020 Float_t posLocal[3] = {0., 0., 0.};
1021 Float_t step[3] = {-(ipadx+0.5)*fgkXPad, 0., -(ipadz+0.5)*fgkZPad};
1022 Translation(posLocal,step);
1024 step[0] = kNpadX*0.5*fgkXPad;
1026 step[2] = kNpadZ*0.5*fgkZPad;
1029 Float_t posLocal[3] = {(ipadx+0.5)*fgkXPad, 0., (ipadz+0.5)*fgkZPad};
1030 Float_t step[3]= {kNpadX*0.5*fgkXPad, 0., kNpadZ*0.5*fgkZPad};
1032 Translation(posLocal,step);
1034 // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame
1036 if (GetAngles(iplate,istrip) >0.) {
1039 angles[2] = 90.+GetAngles(iplate,istrip);
1041 angles[4] = GetAngles(iplate,istrip);
1044 else if (GetAngles(iplate,istrip)==0.) {
1052 else if (GetAngles(iplate,istrip) <0.) {
1055 angles[2] = 90.+GetAngles(iplate,istrip);
1057 angles[4] =-GetAngles(iplate,istrip);
1061 InverseRotation(posLocal,angles);
1064 step[1] = -GetHeights(iplate,istrip);
1065 step[2] = GetDistances(iplate,istrip);
1066 Translation(posLocal,step);
1068 // FTOA = FLTA reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1076 InverseRotation(posLocal,angles);
1078 // B071/B074/B075 = BTO1/2/3 reference frame -> ALICE reference frame
1081 step[2] = -((fgkRmax+fgkRmin)*0.5);
1082 Translation(posLocal,step);
1085 angles[1] = 90.+(isector+0.5)*fgkPhiSec;
1089 angles[5] = (isector+0.5)*fgkPhiSec;
1091 InverseRotation(posLocal,angles);
1093 Float_t xCoor = posLocal[0];
1098 //_____________________________________________________________________________
1099 Float_t AliTOFGeometry::GetY(Int_t *det) const
1102 // Returns Y coordinate (cm)
1105 Int_t isector = det[0];
1106 Int_t iplate = det[1];
1107 Int_t istrip = det[2];
1108 Int_t ipadz = det[3];
1109 Int_t ipadx = det[4];
1112 // Find out distance d on the plane wrt median phi:
1113 Float_t d = (ipadx+0.5-kNpadX*0.5)*fgkXPad;
1115 // The radius r in xy plane:
1116 //Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
1117 // (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg)-0.25; ???
1118 Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
1119 (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg);
1121 // local azimuthal angle in the sector philoc
1122 Float_t philoc = TMath::ATan(d/r);
1123 //if(philoc<0.) philoc = k2PI + philoc;
1125 // azimuthal angle in the global frame phi
1126 Float_t phi = philoc*kRaddeg+(isector+0.5)*fgkPhiSec;
1128 Float_t yCoor = r/TMath::Cos(philoc)*TMath::Sin(phi/kRaddeg);
1131 // Pad reference frame -> FSTR reference frame
1133 Float_t posLocal[3] = {0., 0., 0.};
1134 Float_t step[3] = {-(ipadx+0.5)*fgkXPad, 0., -(ipadz+0.5)*fgkZPad};
1135 Translation(posLocal,step);
1137 step[0] = kNpadX*0.5*fgkXPad;
1139 step[2] = kNpadZ*0.5*fgkZPad;
1142 Float_t posLocal[3] = {(ipadx+0.5)*fgkXPad, 0., (ipadz+0.5)*fgkZPad};
1143 Float_t step[3]= {kNpadX*0.5*fgkXPad, 0., kNpadZ*0.5*fgkZPad};
1145 Translation(posLocal,step);
1147 // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame
1150 if (GetAngles(iplate,istrip) >0.) {
1153 angles[2] = 90.+GetAngles(iplate,istrip);
1155 angles[4] = GetAngles(iplate,istrip);
1158 else if (GetAngles(iplate,istrip)==0.) {
1166 else if (GetAngles(iplate,istrip) <0.) {
1169 angles[2] = 90.+GetAngles(iplate,istrip);
1171 angles[4] =-GetAngles(iplate,istrip);
1175 InverseRotation(posLocal,angles);
1178 step[1] = -GetHeights(iplate,istrip);
1179 step[2] = GetDistances(iplate,istrip);
1180 Translation(posLocal,step);
1182 // FTOA = FLTA reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1190 InverseRotation(posLocal,angles);
1192 // B071/B074/B075 = BTO1/2/3 reference frame -> ALICE reference frame
1195 step[2] = -((fgkRmax+fgkRmin)*0.5);
1196 Translation(posLocal,step);
1199 angles[1] = 90.+(isector+0.5)*fgkPhiSec;
1203 angles[5] = (isector+0.5)*fgkPhiSec;
1205 InverseRotation(posLocal,angles);
1207 Float_t yCoor = posLocal[1];
1213 //_____________________________________________________________________________
1214 Float_t AliTOFGeometry::GetZ(Int_t *det) const
1217 // Returns Z coordinate (cm)
1220 Int_t isector = det[0];
1221 Int_t iplate = det[1];
1222 Int_t istrip = det[2];
1223 Int_t ipadz = det[3];
1224 Int_t ipadx = det[4];
1227 Float_t zCoor = GetDistances(iplate,istrip) +
1228 (0.5-ipadz) * fgkZPad * TMath::Cos(GetAngles(iplate,istrip)*kDegrad);
1231 // Pad reference frame -> FSTR reference frame
1233 Float_t posLocal[3] = {0., 0., 0.};
1234 Float_t step[3] = {-(ipadx+0.5)*fgkXPad, 0., -(ipadz+0.5)*fgkZPad};
1235 Translation(posLocal,step);
1237 step[0] = kNpadX*0.5*fgkXPad;
1239 step[2] = kNpadZ*0.5*fgkZPad;
1242 Float_t posLocal[3] = {(ipadx+0.5)*fgkXPad, 0., (ipadz+0.5)*fgkZPad};
1243 Float_t step[3]= {kNpadX*0.5*fgkXPad, 0., kNpadZ*0.5*fgkZPad};
1245 Translation(posLocal,step);
1247 // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame
1249 if (GetAngles(iplate,istrip) >0.) {
1252 angles[2] = 90.+GetAngles(iplate,istrip);
1254 angles[4] = GetAngles(iplate,istrip);
1257 else if (GetAngles(iplate,istrip)==0.) {
1265 else if (GetAngles(iplate,istrip) <0.) {
1268 angles[2] = 90.+GetAngles(iplate,istrip);
1270 angles[4] =-GetAngles(iplate,istrip);
1274 InverseRotation(posLocal,angles);
1277 step[1] = -GetHeights(iplate,istrip);
1278 step[2] = GetDistances(iplate,istrip);
1279 Translation(posLocal,step);
1281 // FTOA = FLTA reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1289 InverseRotation(posLocal,angles);
1291 // B071/B074/B075 = BTO1/2/3 reference frame -> ALICE reference frame
1294 step[2] = -((fgkRmax+fgkRmin)*0.5);
1295 Translation(posLocal,step);
1298 angles[1] = 90.+(isector+0.5)*fgkPhiSec;
1302 angles[5] = (isector+0.5)*fgkPhiSec;
1304 InverseRotation(posLocal,angles);
1306 Float_t zCoor = posLocal[2];
1311 //_____________________________________________________________________________
1313 void AliTOFGeometry::DetToSectorRF(Int_t vol[5], Double_t **coord)
1316 // Returns the local coordinates (x, y, z) in sector reference frame
1317 // for the 4 corners of each sector pad (vol[1], vol[2], vol[3], vol[4])
1320 if (!gGeoManager) printf("ERROR: no TGeo\n");
1322 // ALICE -> TOF Sector
1323 Char_t path1[100]="";
1324 GetVolumePath(vol[0],path1);
1325 gGeoManager->cd(path1);
1326 TGeoHMatrix aliceToSector;
1327 aliceToSector = *gGeoManager->GetCurrentMatrix();
1329 // TOF Sector -> ALICE
1330 //TGeoHMatrix sectorToALICE = aliceToSector.Inverse();
1333 Char_t path2[100]="";
1334 GetVolumePath(vol,path2);
1335 gGeoManager->cd(path2);
1336 TGeoHMatrix aliceToPad;
1337 aliceToPad = *gGeoManager->GetCurrentMatrix();
1340 TGeoHMatrix padToALICE = aliceToPad.Inverse();
1342 // TOF Pad -> TOF Sector
1343 TGeoHMatrix padToSector = padToALICE*aliceToSector;
1345 // TOF Sector -> TOF Pad
1346 //TGeoHMatrix sectorToPad = sectorToALICE*aliceToPad;
1348 // coordinates of the pad bottom corner
1349 Double_t **cornerPad = new Double_t*[4];
1350 for (Int_t ii=0; ii<4; ii++) cornerPad[ii] = new Double_t[3];
1352 cornerPad[0][0] = -fgkXPad/2.;
1353 cornerPad[0][1] = 0.;
1354 cornerPad[0][2] = -fgkZPad/2.;
1356 cornerPad[1][0] = fgkXPad/2.;
1357 cornerPad[1][1] = 0.;
1358 cornerPad[1][2] = -fgkZPad/2.;
1360 cornerPad[2][0] = fgkXPad/2.;
1361 cornerPad[2][1] = 0.;
1362 cornerPad[2][2] = fgkZPad/2.;
1364 cornerPad[3][0] = -fgkXPad/2.;
1365 cornerPad[3][1] = 0.;
1366 cornerPad[3][2] = fgkZPad/2.;
1368 for(Int_t aa=0; aa<4; aa++) for(Int_t bb=0; bb<3; bb++) coord[aa][bb]=0.;
1370 for (Int_t jj=0; jj<4; jj++) padToSector.MasterToLocal(&cornerPad[jj][0], &coord[jj][0]);
1374 //sectorToPad.LocalToMaster(cornerPad, coord);
1377 //_____________________________________________________________________________
1378 Float_t AliTOFGeometry::GetPadDx(Float_t *pos)
1381 // Returns the x coordinate in the Pad reference frame
1386 Float_t posLocal[3];
1387 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
1389 Int_t isector = GetSector(posLocal);
1391 //AliError("Detector Index could not be determined");
1393 Int_t iplate = GetPlate(posLocal);
1395 //AliError("Detector Index could not be determined");
1397 Int_t istrip = GetStrip(posLocal);
1399 //AliError("Detector Index could not be determined");
1401 Int_t ipadz = GetPadZ(posLocal);
1403 //AliError("Detector Index could not be determined");
1405 Int_t ipadx = GetPadX(posLocal);
1407 //AliError("Detector Index could not be determined");
1410 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1411 Double_t angles[6] =
1412 {90., 90.+(isector+0.5)*fgkPhiSec,
1414 90., (isector+0.5)*fgkPhiSec
1416 Rotation(posLocal,angles);
1418 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1419 Translation(posLocal,step);
1421 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
1429 Rotation(posLocal,angles);
1431 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1433 step[1] = GetHeights(iplate,istrip);
1434 step[2] = -GetDistances(iplate,istrip);
1435 Translation(posLocal,step);
1437 if (GetAngles(iplate,istrip) >0.) {
1440 angles[2] = 90.+GetAngles(iplate,istrip);
1442 angles[4] = GetAngles(iplate,istrip);
1445 else if (GetAngles(iplate,istrip)==0.) {
1453 else if (GetAngles(iplate,istrip) <0.) {
1456 angles[2] = 90.+GetAngles(iplate,istrip);
1458 angles[4] =-GetAngles(iplate,istrip);
1461 Rotation(posLocal,angles);
1463 step[0] =-0.5*kNpadX*fgkXPad;
1465 step[2] =-0.5*kNpadZ*fgkZPad;
1466 Translation(posLocal,step);
1468 step[0] = (ipadx+0.5)*fgkXPad;
1470 step[2] = (ipadz+0.5)*fgkZPad;
1471 Translation(posLocal,step);
1478 //_____________________________________________________________________________
1479 Float_t AliTOFGeometry::GetPadDy(Float_t *pos)
1482 // Returns the y coordinate in the Pad reference frame
1487 Float_t posLocal[3];
1488 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
1490 Int_t isector = GetSector(posLocal);
1492 //AliError("Detector Index could not be determined");
1494 Int_t iplate = GetPlate(posLocal);
1496 //AliError("Detector Index could not be determined");
1498 Int_t istrip = GetStrip(posLocal);
1500 //AliError("Detector Index could not be determined");
1502 Int_t ipadz = GetPadZ(posLocal);
1504 //AliError("Detector Index could not be determined");
1506 Int_t ipadx = GetPadX(posLocal);
1508 //AliError("Detector Index could not be determined");
1511 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1512 Double_t angles[6] =
1513 {90., 90.+(isector+0.5)*fgkPhiSec,
1515 90., (isector+0.5)*fgkPhiSec
1517 Rotation(posLocal,angles);
1519 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1520 Translation(posLocal,step);
1522 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
1530 Rotation(posLocal,angles);
1532 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1534 step[1] = GetHeights(iplate,istrip);
1535 step[2] = -GetDistances(iplate,istrip);
1536 Translation(posLocal,step);
1538 if (GetAngles(iplate,istrip) >0.) {
1541 angles[2] = 90.+GetAngles(iplate,istrip);
1543 angles[4] = GetAngles(iplate,istrip);
1546 else if (GetAngles(iplate,istrip)==0.) {
1554 else if (GetAngles(iplate,istrip) <0.) {
1557 angles[2] = 90.+GetAngles(iplate,istrip);
1559 angles[4] =-GetAngles(iplate,istrip);
1562 Rotation(posLocal,angles);
1564 step[0] =-0.5*kNpadX*fgkXPad;
1566 step[2] =-0.5*kNpadZ*fgkZPad;
1567 Translation(posLocal,step);
1569 step[0] = (ipadx+0.5)*fgkXPad;
1571 step[2] = (ipadz+0.5)*fgkZPad;
1572 Translation(posLocal,step);
1579 //_____________________________________________________________________________
1580 Float_t AliTOFGeometry::GetPadDz(Float_t *pos)
1583 // Returns the z coordinate in the Pad reference frame
1588 Float_t posLocal[3];
1589 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
1591 Int_t isector = GetSector(posLocal);
1593 //AliError("Detector Index could not be determined");
1595 Int_t iplate = GetPlate(posLocal);
1597 //AliError("Detector Index could not be determined");
1599 Int_t istrip = GetStrip(posLocal);
1601 //AliError("Detector Index could not be determined");
1603 Int_t ipadz = GetPadZ(posLocal);
1605 //AliError("Detector Index could not be determined");
1607 Int_t ipadx = GetPadX(posLocal);
1609 //AliError("Detector Index could not be determined");
1612 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1613 Double_t angles[6] =
1614 {90., 90.+(isector+0.5)*fgkPhiSec,
1616 90., (isector+0.5)*fgkPhiSec
1618 Rotation(posLocal,angles);
1620 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1621 Translation(posLocal,step);
1623 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
1631 Rotation(posLocal,angles);
1633 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1635 step[1] = GetHeights(iplate,istrip);
1636 step[2] = -GetDistances(iplate,istrip);
1637 Translation(posLocal,step);
1639 if (GetAngles(iplate,istrip) >0.) {
1642 angles[2] = 90.+GetAngles(iplate,istrip);
1644 angles[4] = GetAngles(iplate,istrip);
1647 else if (GetAngles(iplate,istrip)==0.) {
1655 else if (GetAngles(iplate,istrip) <0.) {
1658 angles[2] = 90.+GetAngles(iplate,istrip);
1660 angles[4] =-GetAngles(iplate,istrip);
1663 Rotation(posLocal,angles);
1665 step[0] =-0.5*kNpadX*fgkXPad;
1667 step[2] =-0.5*kNpadZ*fgkZPad;
1668 Translation(posLocal,step);
1670 step[0] = (ipadx+0.5)*fgkXPad;
1672 step[2] = (ipadz+0.5)*fgkZPad;
1673 Translation(posLocal,step);
1680 //_____________________________________________________________________________
1682 void AliTOFGeometry::Translation(Float_t *xyz, Float_t translationVector[3]) const
1685 // Return the vector xyz translated by translationVector vector
1690 for (ii=0; ii<3; ii++)
1691 xyz[ii] -= translationVector[ii];
1696 //_____________________________________________________________________________
1698 void AliTOFGeometry::Rotation(Float_t *xyz, Double_t rotationAngles[6]) const
1701 // Return the vector xyz rotated according to the rotationAngles angles
1706 TRotMatrix *matrix = new TRotMatrix("matrix","matrix", angles[0], angles[1],
1707 angles[2], angles[3],
1708 angles[4], angles[5]);
1711 for (ii=0; ii<6; ii++) rotationAngles[ii]*=kDegrad;
1713 Float_t xyzDummy[3] = {0., 0., 0.};
1715 for (ii=0; ii<3; ii++) {
1717 xyz[0]*TMath::Sin(rotationAngles[2*ii])*TMath::Cos(rotationAngles[2*ii+1]) +
1718 xyz[1]*TMath::Sin(rotationAngles[2*ii])*TMath::Sin(rotationAngles[2*ii+1]) +
1719 xyz[2]*TMath::Cos(rotationAngles[2*ii]);
1722 for (ii=0; ii<3; ii++) xyz[ii]=xyzDummy[ii];
1727 //_____________________________________________________________________________
1728 void AliTOFGeometry::InverseRotation(Float_t *xyz, Double_t rotationAngles[6]) const
1736 for (ii=0; ii<6; ii++) rotationAngles[ii]*=kDegrad;
1738 Float_t xyzDummy[3] = {0., 0., 0.};
1741 xyz[0]*TMath::Sin(rotationAngles[0])*TMath::Cos(rotationAngles[1]) +
1742 xyz[1]*TMath::Sin(rotationAngles[2])*TMath::Cos(rotationAngles[3]) +
1743 xyz[2]*TMath::Sin(rotationAngles[4])*TMath::Cos(rotationAngles[5]);
1746 xyz[0]*TMath::Sin(rotationAngles[0])*TMath::Sin(rotationAngles[1]) +
1747 xyz[1]*TMath::Sin(rotationAngles[2])*TMath::Sin(rotationAngles[3]) +
1748 xyz[2]*TMath::Sin(rotationAngles[4])*TMath::Sin(rotationAngles[5]);
1751 xyz[0]*TMath::Cos(rotationAngles[0]) +
1752 xyz[1]*TMath::Cos(rotationAngles[2]) +
1753 xyz[2]*TMath::Cos(rotationAngles[4]);
1755 for (ii=0; ii<3; ii++) xyz[ii]=xyzDummy[ii];
1760 //_____________________________________________________________________________
1762 Int_t AliTOFGeometry::GetIndex(Int_t *detId)
1764 //Retrieve calibration channel index
1765 Int_t isector = detId[0];
1766 if (isector >= kNSectors){
1767 printf("Wrong sector number in TOF (%d) !",isector);
1770 Int_t iplate = detId[1];
1771 if (iplate >= kNPlates){
1772 printf("Wrong plate number in TOF (%d) !",iplate);
1775 Int_t istrip = detId[2];
1776 Int_t ipadz = detId[3];
1777 Int_t ipadx = detId[4];
1778 Int_t stripOffset = 0;
1784 stripOffset = kNStripC;
1787 stripOffset = kNStripC+kNStripB;
1790 stripOffset = kNStripC+kNStripB+kNStripA;
1793 stripOffset = kNStripC+kNStripB+kNStripA+kNStripB;
1796 printf("Wrong plate number in TOF (%d) !",iplate);
1800 Int_t idet = ((2*(kNStripC+kNStripB)+kNStripA)
1801 *kNpadZ*kNpadX)*isector +
1802 (stripOffset*kNpadZ*kNpadX)+
1803 (kNpadZ*kNpadX)*istrip+