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 "AliTOFGeometry.h"
111 #include "AliConst.h"
113 extern TGeoManager *gGeoManager;
115 ClassImp(AliTOFGeometry)
117 const Float_t AliTOFGeometry::fgkZlenA = 370.6*2.; // length (cm) of the A module
118 const Float_t AliTOFGeometry::fgkZlenB = 146.5; // length (cm) of the B module
119 const Float_t AliTOFGeometry::fgkZlenC = 170.45; // length (cm) of the C module
120 const Float_t AliTOFGeometry::fgkMaxhZtof = 370.6; // Max half z-size of TOF (cm)
122 const Float_t AliTOFGeometry::fgkxTOF = 371.-0.01;// Inner radius of the TOF for Reconstruction (cm)
123 const Float_t AliTOFGeometry::fgkRmin = 370.-0.01;// Inner radius of the TOF (cm)
124 const Float_t AliTOFGeometry::fgkRmax = 399.-0.01;// Outer radius of the TOF (cm)
126 const Int_t AliTOFGeometry::fgkTimeDiff = 25000; // Min signal separation (ps)
127 const Float_t AliTOFGeometry::fgkXPad = 2.5; // Pad size in the x direction (cm)
128 const Float_t AliTOFGeometry::fgkZPad = 3.5; // Pad size in the z direction (cm)
130 const Float_t AliTOFGeometry::fgkStripLength = 122.;// Strip Length (rho X phi direction) (cm)
132 const Float_t AliTOFGeometry::fgkSigmaForTail1= 2.; //Sig1 for simulation of TDC tails
133 const Float_t AliTOFGeometry::fgkSigmaForTail2= 0.5;//Sig2 for simulation of TDC tails
135 const Float_t AliTOFGeometry::fgkPhiSec= 20;//sector Phi width (deg)
137 const Float_t AliTOFGeometry::fgkTdcBin = 24.4; // time-of-flight bin width [ps]
138 const Float_t AliTOFGeometry::fgkToTBin = 48.8; // time-over-threshold bin width [ps]
140 const Float_t AliTOFGeometry::fgkAngles[kNPlates][kMaxNstrip] ={
141 { 43.99, 43.20, 42.40, 41.59, 40.77, 39.94, 39.11, 38.25, 37.40, 36.53,
142 35.65, 34.76, 33.87, 32.96, 32.05, 31.13, 30.19, 29.24, 12.33, 0.00},
144 { 27.26, 26.28, 25.30, 24.31, 23.31, 22.31, 21.30, 20.29, 19.26, 18.24,
145 17.20, 16.16, 15.11, 14.05, 13.00, 11.93, 10.87, 9.80, 8.74, 0.00},
147 { 0.00, 6.30, 5.31, 4.25, 3.19, 2.12, 1.06, 0.00, -1.06, -2.12,
148 -3.19, -4.25, -5.31, -6.30, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00},
150 { -8.74, -9.80, -10.87, -11.93, -13.00, -14.05, -15.11, -16.16, -17.20, -18.24,
151 -19.26, -20.29, -21.30, -22.31, -23.31, -24.31, -25.30, -26.28, -27.26, 0.00},
153 {-12.33, -29.24, -30.19, -31.13, -32.05, -32.96, -33.87, -34.76, -35.65, -36.53,
154 -37.40, -38.25, -39.11, -39.94, -40.77, -41.59, -42.40, -43.20, -43.99, 0.00}
156 const Float_t AliTOFGeometry::fgkHeights[kNPlates][kMaxNstrip]= {
157 {-8.2, -7.5, -8.2, -7.7, -8.1, -7.6, -7.7, -7.7, -7.7, -7.7,
158 -7.5, -7.2, -7.3, -7.5, -7.6, -7.8, -8.3, -9.3, -3.1, 0.0},
160 {-7.9, -8.1, -8.5, -9.0, -10.1, -3.9, -5.9, -7.7, -10.1, -3.6,
161 -5.8, -8.0, -10.4, -4.4, -7.2, -10.2, -4.6, -7.4, -10.4, 0.0},
163 {-2.5, -10.4, -5.0, -9.9, -4.8, -9.9, -4.7, -10.2, -4.7, -9.9,
164 -4.8, -9.9, -5.0, -10.4, -2.5, 0.0, 0.0, 0.0, 0.0, 0.0},
166 {-10.4, -7.4, -4.6, -10.2, -7.2, -4.4, -10.4, -8.0, -5.8, -3.6,
167 -10.1, -7.7, -5.9, -3.9, -10.1, -9.0, -8.5, -8.1, -7.9, 0.0},
169 { -3.1, -9.3, -8.3, -7.8, -7.6, -7.5, -7.3, -7.2, -7.5, -7.7,
170 -7.7, -7.7, -7.7, -7.6, -8.1, -7.7, -8.2, -7.5, -8.2, 0.0}
174 const Float_t AliTOFGeometry::fgkDistances[kNPlates][kMaxNstrip]= {
175 { 364.1, 354.9, 344.5, 335.4, 325.5, 316.6, 307.2, 298.0, 288.9, 280.0,
176 271.3, 262.7, 254.0, 244.8, 236.1, 227.7, 219.1, 210.3, 205.7, 0.0},
178 { 194.2, 186.1, 177.9, 169.8, 161.5, 156.3, 147.8, 139.4, 130.9, 125.6,
179 117.3, 109.2, 101.1, 95.3, 87.1, 79.2, 73.0, 65.1, 57.6, 0.0},
181 { 49.5, 41.3, 35.3, 27.8, 21.2, 13.9, 7.0, 0.0, -7.0, -13.9,
182 -21.2, -27.8, -35.3, -41.3, -49.5, 0.0, 0.0, 0.0, 0.0, 0.0},
184 { -57.6, -65.1, -73.0, -79.2, -87.1, -95.3, -101.1, -109.2, -117.3, -125.6,
185 -130.9, -139.4, -147.8, -156.3, -161.5, -169.8, -177.9, -186.1, -194.2, 0.0},
187 {-205.7, -210.3, -219.1, -227.7, -236.1, -244.8, -254.0, -262.7, -271.3, -280.0,
188 -288.9, -298.0, -307.2, -316.6, -325.5, -335.4, -344.5, -354.9, -364.1, 0.0}
190 //_____________________________________________________________________________
191 AliTOFGeometry::AliTOFGeometry():
195 // AliTOFGeometry default constructor
200 //_____________________________________________________________________________
201 AliTOFGeometry::~AliTOFGeometry()
204 // AliTOFGeometry destructor
207 //_____________________________________________________________________________
208 void AliTOFGeometry::ImportGeometry(){
209 TGeoManager::Import("geometry.root");
211 //_____________________________________________________________________________
212 void AliTOFGeometry::GetPosPar(Int_t *det, Float_t *pos) const
215 // Returns space point coor (x,y,z) (cm) for Detector
216 // Indices (iSect,iPlate,iStrip,iPadX,iPadZ)
224 //_____________________________________________________________________________
225 void AliTOFGeometry::GetDetID( Float_t *pos, Int_t *det) const
228 // Returns Detector Indices (iSect,iPlate,iStrip,iPadX,iPadZ)
229 // space point coor (x,y,z) (cm)
232 det[0]=GetSector(pos);
233 det[1]=GetPlate(pos);
234 det[2]=GetStrip(pos);
239 //_____________________________________________________________________________
241 void AliTOFGeometry::DetToStripRF(Int_t nPadX, Int_t nPadZ, Float_t &x, Float_t &z) const
244 // Returns the local coordinates (x, z) in strip reference frame
245 // for the bottom corner of the pad number (nPadX, nPadZ)
248 const Float_t xCenterStrip = kNpadX * fgkXPad / 2.;
249 const Float_t zCenterStrip = kNpadZ * fgkZPad / 2.;
251 const Float_t xCenterPad = nPadX*fgkXPad + fgkXPad / 2.;
252 const Float_t zCenterPad = nPadZ*fgkZPad + fgkZPad / 2.;
254 x = xCenterPad - xCenterStrip;
255 z = zCenterPad - zCenterStrip;
259 x = (nPadX - kNpadX*0.5) * fgkXPad;
260 z = (nPadZ - kNpadZ*0.5) * fgkZPad;
264 //_____________________________________________________________________________
265 Float_t AliTOFGeometry::DistanceToPadPar(Int_t *det, Float_t *pos, Float_t *dist3d) const
268 // Returns distance of space point with coor pos (x,y,z) (cm) wrt
269 // pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ)
272 //Transform pos into Sector Frame
278 Float_t radius = TMath::Sqrt(x*x+y*y);
279 //Float_t phi=TMath::ATan(y/x);
280 //if(phi<0) phi = k2PI+phi; //2.*TMath::Pi()+phi;
281 Float_t phi = TMath::Pi()+TMath::ATan2(-y,-x);
282 // Get the local angle in the sector philoc
283 Float_t angle = phi*kRaddeg-( Int_t (kRaddeg*phi/fgkPhiSec) + 0.5)*fgkPhiSec;
284 Float_t xs = radius*TMath::Cos(angle/kRaddeg);
285 Float_t ys = radius*TMath::Sin(angle/kRaddeg);
288 // Do the same for the selected pad
293 Float_t padRadius = TMath::Sqrt(g[0]*g[0]+g[1]*g[1]);
294 //Float_t padPhi = TMath::ATan(g[1]/g[0]);
295 //if(padPhi<0) padPhi = k2Pi + padPhi;
296 Float_t padPhi = TMath::Pi()+TMath::ATan2(-g[1],-g[0]);
298 // Get the local angle in the sector philoc
299 Float_t padAngle = padPhi*kRaddeg-( Int_t (padPhi*kRaddeg/fgkPhiSec)+ 0.5) * fgkPhiSec;
300 Float_t padxs = padRadius*TMath::Cos(padAngle/kRaddeg);
301 Float_t padys = padRadius*TMath::Sin(padAngle/kRaddeg);
302 Float_t padzs = g[2];
304 //Now move to local pad coordinate frame. Translate:
306 Float_t xt = xs-padxs;
307 Float_t yt = ys-padys;
308 Float_t zt = zs-padzs;
311 Float_t alpha = GetAngles(det[1],det[2]);
312 Float_t xr = xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg);
314 Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg);
316 Float_t dist = TMath::Sqrt(xr*xr+yr*yr+zr*zr);
327 //_____________________________________________________________________________
328 Bool_t AliTOFGeometry::IsInsideThePadPar(Int_t *det, Float_t *pos) const
331 // Returns true if space point with coor pos (x,y,z) (cm) falls
332 // inside pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ)
335 Bool_t isInside=false;
338 const Float_t khhony = 1.0 ; // heigth of HONY Layer
339 const Float_t khpcby = 0.08 ; // heigth of PCB Layer
340 const Float_t khrgly = 0.055 ; // heigth of RED GLASS Layer
341 const Float_t khglfy = 0.285 ; // heigth of GLASS+FISHLINE Layer
342 const Float_t khcpcby = 0.16 ; // heigth of PCB Central Layer
343 //const Float_t kwcpcbz = 12.4 ; // z dimension of PCB Central Layer
344 const Float_t khstripy = 2.*khhony+2.*khpcby+4.*khrgly+2.*khglfy+khcpcby;//3.11
345 //const Float_t kwstripz = kwcpcbz;
346 //const Float_t klstripx = fgkStripLength;
349 const Float_t kPadDepth = 0.5;//0.05;//0.11;//0.16;// // heigth of Sensitive Layer
351 //Transform pos into Sector Frame
357 Float_t radius = TMath::Sqrt(x*x+y*y);
358 Float_t phi = TMath::Pi()+TMath::ATan2(-y,-x);
360 // Get the local angle in the sector philoc
361 Float_t angle = phi*kRaddeg-( Int_t (kRaddeg*phi/fgkPhiSec) + 0.5) *fgkPhiSec;
362 Float_t xs = radius*TMath::Cos(angle/kRaddeg);
363 Float_t ys = radius*TMath::Sin(angle/kRaddeg);
366 // Do the same for the selected pad
371 Float_t padRadius = TMath::Sqrt(g[0]*g[0]+g[1]*g[1]);
372 Float_t padPhi = TMath::Pi()+TMath::ATan2(-g[1],-g[0]);
374 // Get the local angle in the sector philoc
375 Float_t padAngle = padPhi*kRaddeg-( Int_t (padPhi*kRaddeg/fgkPhiSec)+ 0.5) * fgkPhiSec;
376 Float_t padxs = padRadius*TMath::Cos(padAngle/kRaddeg);
377 Float_t padys = padRadius*TMath::Sin(padAngle/kRaddeg);
378 Float_t padzs = g[2];
380 //Now move to local pad coordinate frame. Translate:
382 Float_t xt = xs-padxs;
383 Float_t yt = ys-padys;
384 Float_t zt = zs-padzs;
388 Float_t alpha = GetAngles(det[1],det[2]);
389 Float_t xr = xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg);
391 Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg);
393 if(TMath::Abs(xr)<=kPadDepth*0.5 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5))
398 //_____________________________________________________________________________
399 Bool_t AliTOFGeometry::IsInsideThePad(TGeoHMatrix mat, Float_t *pos, Float_t *dist3d) const
402 // Returns true if space point with coor pos (x,y,z) (cm) falls
403 // inside pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ)
406 const Float_t kPadDepth = 0.5; // heigth of Sensitive Layer
411 Double_t veclr[3]={-1.,-1.,-1.};
412 Double_t vecl[3]={-1.,-1.,-1.};
413 mat.MasterToLocal(vecg,veclr);
416 //take into account reflections
419 Float_t xr = vecl[0];
420 Float_t yr = vecl[1];
421 Float_t zr = vecl[2];
429 Bool_t isInside=false;
430 if(TMath::Abs(xr)<= kPadDepth*0.5 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5))
435 //_____________________________________________________________________________
436 void AliTOFGeometry::GetVolumePath(Int_t *ind, Char_t *path ) {
437 //--------------------------------------------------------------------
438 // This function returns the colume path of a given pad
439 //--------------------------------------------------------------------
440 Int_t sector = ind[0];
448 sprintf(string1,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1",icopy,icopy);
452 if( iplate==0) icopy=istrip;
453 if( iplate==1) icopy=istrip+NStripC();
454 if( iplate==2) icopy=istrip+NStripC()+NStripB();
455 if( iplate==3) icopy=istrip+NStripC()+NStripB()+NStripA();
456 if( iplate==4) icopy=istrip+NStripC()+2*NStripB()+NStripA();
458 sprintf(string2,"FTOA_0/FLTA_0/FSTR_%i",icopy);
459 if(fHoles && (sector==13 || sector==14 || sector==15)){
460 if(iplate<2) sprintf(string2,"FTOB_0/FLTB_0/FSTR_%i",icopy);
461 if(iplate>2) sprintf(string2,"FTOC_0/FLTC_0/FSTR_%i",icopy);
464 Int_t padz = ind[3]+1;
465 Int_t padx = ind[4]+1;
466 sprintf(string3,"FPCB_1/FSEN_1/FSEZ_%i/FPAD_%i",padz,padx);
467 sprintf(path,"%s/%s/%s",string1,string2,string3);
470 //_____________________________________________________________________________
471 void AliTOFGeometry::GetVolumePath(Int_t sector, Char_t *path ){
472 //--------------------------------------------------------------------
473 // This function returns the colume path of a given sector
474 //--------------------------------------------------------------------
478 Int_t icopy = sector;
480 sprintf(string,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1",icopy,icopy);
481 sprintf(path,"%s",string);
484 //_____________________________________________________________________________
485 void AliTOFGeometry::GetVolumePath(Int_t sector, Int_t plate, Int_t strip, Char_t *path ) {
486 //--------------------------------------------------------------------
487 // This function returns the colume path of a given strip
488 //--------------------------------------------------------------------
494 Int_t icopy = sector;
496 sprintf(string1,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1",icopy,icopy);
498 if(plate==0) icopy=strip;
499 if(plate==1) icopy=strip+NStripC();
500 if(plate==2) icopy=strip+NStripC()+NStripB();
501 if(plate==3) icopy=strip+NStripC()+NStripB()+NStripA();
502 if(plate==4) icopy=strip+NStripC()+2*NStripB()+NStripA();
504 sprintf(string2,"FTOA_0/FLTA_0/FSTR_%i",icopy);
505 if(fHoles && (sector==13 || sector==14 || sector==15)){
506 if(plate<2) sprintf(string2,"FTOB_0/FLTB_0/FSTR_%i",icopy);
507 if(plate>2) sprintf(string2,"FTOC_0/FLTC_0/FSTR_%i",icopy);
510 sprintf(string3,"FPCB_1/FSEN_1");
511 sprintf(path,"%s/%s/%s",string1,string2,string3);
514 //_____________________________________________________________________________
515 void AliTOFGeometry::GetPos(Int_t *det, Float_t *pos)
518 // Returns space point coor (x,y,z) (cm) for Detector
519 // Indices (iSect,iPlate,iStrip,iPadX,iPadZ)
522 GetVolumePath(det,path );
524 printf("ERROR: no TGeo\n");
526 gGeoManager->cd(path);
528 global = *gGeoManager->GetCurrentMatrix();
529 const Double_t *tr = global.GetTranslation();
535 //_____________________________________________________________________________
536 Int_t AliTOFGeometry::GetPlate(Float_t *pos) const
539 // Returns the Plate index
541 const Float_t kInterCentrModBorder1 = 49.5;
542 const Float_t kInterCentrModBorder2 = 57.5;
543 const Float_t kExterInterModBorder1 = 196.0;
544 const Float_t kExterInterModBorder2 = 203.5;
546 const Float_t kLengthExInModBorder = 4.7;
547 const Float_t kLengthInCeModBorder = 7.0;
549 //const Float_t khAlWall = 0.1;
550 const Float_t kModuleWallThickness = 0.3;
551 //const Float_t kHoneycombLayerThickness = 1.5;
556 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
558 Int_t isector = GetSector(posLocal);
560 //AliError("Detector Index could not be determined");
564 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
566 {90., 90.+(isector+0.5)*fgkPhiSec,
568 90., (isector+0.5)*fgkPhiSec
570 Rotation(posLocal,angles);
572 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
573 Translation(posLocal,step);
575 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame
583 Rotation(posLocal,angles);
585 Float_t yLocal = posLocal[1];
586 Float_t zLocal = posLocal[2];
588 Float_t deltaRhoLoc = (fgkRmax-fgkRmin)*0.5 - kModuleWallThickness + yLocal;
589 Float_t deltaZetaLoc = TMath::Abs(zLocal);
591 Float_t deltaRHOmax = 0.;
593 if (TMath::Abs(zLocal)>=kExterInterModBorder1 && TMath::Abs(zLocal)<=kExterInterModBorder2)
595 deltaRhoLoc -= kLengthExInModBorder;
596 deltaZetaLoc = kExterInterModBorder2-deltaZetaLoc;
597 deltaRHOmax = (fgkRmax - fgkRmin)*0.5 - kModuleWallThickness - 2.*kLengthExInModBorder; // old 5.35, new 4.8
599 if (deltaRhoLoc > deltaZetaLoc*deltaRHOmax/(kInterCentrModBorder2-kInterCentrModBorder1)) {
600 if (zLocal<0) iPlate = 0;
604 if (zLocal<0) iPlate = 1;
608 else if (TMath::Abs(zLocal)>=kInterCentrModBorder1 && TMath::Abs(zLocal)<=kInterCentrModBorder2)
610 deltaRhoLoc -= kLengthInCeModBorder;
611 deltaZetaLoc = deltaZetaLoc-kInterCentrModBorder1;
612 deltaRHOmax = (fgkRmax - fgkRmin)*0.5 - kModuleWallThickness - 2.*kLengthInCeModBorder; // old 0.39, new 0.2
614 if (deltaRhoLoc>deltaZetaLoc*deltaRHOmax/(kInterCentrModBorder2-kInterCentrModBorder1)) iPlate = 2;
616 if (zLocal<0) iPlate = 1;
621 if (zLocal>-fgkZlenA*0.5/*fgkMaxhZtof*/ && zLocal<-kExterInterModBorder2) iPlate = 0;
622 else if (zLocal>-kExterInterModBorder1 && zLocal<-kInterCentrModBorder2) iPlate = 1;
623 else if (zLocal>-kInterCentrModBorder1 && zLocal< kInterCentrModBorder1) iPlate = 2;
624 else if (zLocal> kInterCentrModBorder2 && zLocal< kExterInterModBorder1) iPlate = 3;
625 else if (zLocal> kExterInterModBorder2 && zLocal< fgkZlenA*0.5/*fgkMaxhZtof*/) iPlate = 4;
631 //_____________________________________________________________________________
632 Int_t AliTOFGeometry::GetSector(Float_t *pos) const
635 // Returns the Sector index
638 //const Float_t khAlWall = 0.1;
639 //const Float_t kModuleWallThickness = 0.3;
647 Float_t rho = TMath::Sqrt(x*x + y*y);
649 //if (!((z>=-fgkMaxhZtof && z<=fgkMaxhZtof) &&
650 if (!((z>=-fgkZlenA*0.5 && z<=fgkZlenA*0.5) &&
651 (rho>=(fgkRmin) && rho<=(fgkRmax)))) {
652 //(rho>=(fgkRmin-0.05)+kModuleWallThickness && rho<=(fgkRmax-0.05)-kModuleWallThickness-khAlWall-kModuleWallThickness))) {
653 //AliError("Detector Index could not be determined");
657 Float_t phi = TMath::Pi() + TMath::ATan2(-y,-x);
659 iSect = (Int_t) (phi*kRaddeg/fgkPhiSec);
664 //_____________________________________________________________________________
665 Int_t AliTOFGeometry::GetStrip(Float_t *pos) const
668 // Returns the Strip index
670 const Float_t khhony = 1.0 ; // heigth of HONY Layer
671 const Float_t khpcby = 0.08 ; // heigth of PCB Layer
672 const Float_t khrgly = 0.055 ; // heigth of RED GLASS Layer
673 const Float_t khglfy = 0.285 ; // heigth of GLASS+FISHLINE Layer
674 const Float_t khcpcby = 0.16 ; // heigth of PCB Central Layer
675 const Float_t kwcpcbz = 12.4 ; // z dimension of PCB Central Layer
676 const Float_t khstripy = 2.*khhony+2.*khpcby+4.*khrgly+2.*khglfy+khcpcby;//3.11
677 const Float_t kwstripz = kwcpcbz;
678 const Float_t klstripx = fgkStripLength;
683 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
685 Int_t isector = GetSector(posLocal);
687 //AliError("Detector Index could not be determined");
689 Int_t iplate = GetPlate(posLocal);
691 //AliError("Detector Index could not be determined");
713 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
715 {90., 90.+(isector+0.5)*fgkPhiSec,
717 90., (isector+0.5)*fgkPhiSec
719 Rotation(posLocal,angles);
721 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
722 Translation(posLocal,step);
724 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame
732 Rotation(posLocal,angles);
734 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
736 for (Int_t istrip=0; istrip<nstrips; istrip++){
738 Float_t posLoc2[3]={posLocal[0],posLocal[1],posLocal[2]};
741 step[1] = GetHeights(iplate,istrip);
742 step[2] = -GetDistances(iplate,istrip);
743 Translation(posLoc2,step);
745 if (GetAngles(iplate,istrip) >0.) {
748 angles[2] = 90.+GetAngles(iplate,istrip);
750 angles[4] = GetAngles(iplate,istrip);
753 else if (GetAngles(iplate,istrip)==0.) {
761 else if (GetAngles(iplate,istrip) <0.) {
764 angles[2] = 90.+GetAngles(iplate,istrip);
766 angles[4] =-GetAngles(iplate,istrip);
769 Rotation(posLoc2,angles);
771 if ((TMath::Abs(posLoc2[0])<=klstripx*0.5) &&
772 (TMath::Abs(posLoc2[1])<=khstripy*0.5) &&
773 (TMath::Abs(posLoc2[2])<=kwstripz*0.5)) {
776 for (Int_t jj=0; jj<3; jj++) posLocal[jj]=posLoc2[jj];
777 //AliInfo(Form(" posLocal[0] = %f, posLocal[1] = %f, posLocal[2] = %f ", posLocal[0],posLocal[1],posLocal[2]));
779 //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]));
783 if (totStrip>1) AliInfo(Form("total strip number found %2i",totStrip));
790 //_____________________________________________________________________________
791 Int_t AliTOFGeometry::GetPadZ(Float_t *pos) const
794 // Returns the Pad index along Z
796 //const Float_t klsensmx = kNpadX*fgkXPad; // length of Sensitive Layer
797 //const Float_t khsensmy = 0.05;//0.11;//0.16;// heigth of Sensitive Layer
798 //const Float_t kwsensmz = kNpadZ*fgkZPad; // width of Sensitive Layer
803 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
805 Int_t isector = GetSector(posLocal);
807 //AliError("Detector Index could not be determined");
809 Int_t iplate = GetPlate(posLocal);
811 //AliError("Detector Index could not be determined");
813 Int_t istrip = GetStrip(posLocal);
815 //AliError("Detector Index could not be determined");
818 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
820 {90., 90.+(isector+0.5)*fgkPhiSec,
822 90., (isector+0.5)*fgkPhiSec
824 Rotation(posLocal,angles);
826 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
827 Translation(posLocal,step);
829 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame
837 Rotation(posLocal,angles);
839 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
841 step[1] = GetHeights(iplate,istrip);
842 step[2] = -GetDistances(iplate,istrip);
843 Translation(posLocal,step);
845 if (GetAngles(iplate,istrip) >0.) {
848 angles[2] = 90.+GetAngles(iplate,istrip);
850 angles[4] = GetAngles(iplate,istrip);
853 else if (GetAngles(iplate,istrip)==0.) {
861 else if (GetAngles(iplate,istrip) <0.) {
864 angles[2] = 90.+GetAngles(iplate,istrip);
866 angles[4] =-GetAngles(iplate,istrip);
869 Rotation(posLocal,angles);
871 //if (TMath::Abs(posLocal[0])<=klsensmx*0.5 && /*TMath::Abs(posLocal[1])<=khsensmy*0.5+0.005 &&*/ TMath::Abs(posLocal[2])<=kwsensmz*0.5) {
872 //if (TMath::Abs(posLocal[1])<=khsensmy*0.5) {
874 step[0] =-0.5*kNpadX*fgkXPad;
876 step[2] =-0.5*kNpadZ*fgkZPad;
877 Translation(posLocal,step);
879 iPadZ = (Int_t)(posLocal[2]/fgkZPad);
880 if (iPadZ==kNpadZ) iPadZ--;
881 else if (iPadZ>kNpadZ) iPadZ=-1;
884 // else AliError("Detector Index could not be determined");
889 //_____________________________________________________________________________
890 Int_t AliTOFGeometry::GetPadX(Float_t *pos) const
893 // Returns the Pad index along X
895 //const Float_t klsensmx = kNpadX*fgkXPad; // length of Sensitive Layer
896 //const Float_t khsensmy = 0.05;//0.11;//0.16;// heigth of Sensitive Layer
897 //const Float_t kwsensmz = kNpadZ*fgkZPad; // width of Sensitive Layer
902 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
904 Int_t isector = GetSector(posLocal);
906 //AliError("Detector Index could not be determined");
908 Int_t iplate = GetPlate(posLocal);
910 //AliError("Detector Index could not be determined");
912 Int_t istrip = GetStrip(posLocal);
914 //AliError("Detector Index could not be determined");
917 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
919 {90., 90.+(isector+0.5)*fgkPhiSec,
921 90., (isector+0.5)*fgkPhiSec
923 Rotation(posLocal,angles);
925 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
926 Translation(posLocal,step);
928 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
936 Rotation(posLocal,angles);
938 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
940 step[1] = GetHeights(iplate,istrip);
941 step[2] = -GetDistances(iplate,istrip);
942 Translation(posLocal,step);
944 if (GetAngles(iplate,istrip) >0.) {
947 angles[2] = 90.+GetAngles(iplate,istrip);
949 angles[4] = GetAngles(iplate,istrip);
952 else if (GetAngles(iplate,istrip)==0.) {
960 else if (GetAngles(iplate,istrip) <0.) {
963 angles[2] = 90.+GetAngles(iplate,istrip);
965 angles[4] =-GetAngles(iplate,istrip);
968 Rotation(posLocal,angles);
970 //if (TMath::Abs(posLocal[0])<=klsensmx*0.5 && /*TMath::Abs(posLocal[1])<=khsensmy*0.5+0.005 &&*/ TMath::Abs(posLocal[2])<=kwsensmz*0.5) {
971 //if (TMath::Abs(posLocal[1])<=khsensmy*0.5) {
973 step[0] =-0.5*kNpadX*fgkXPad;
975 step[2] =-0.5*kNpadZ*fgkZPad;
976 Translation(posLocal,step);
978 iPadX = (Int_t)(posLocal[0]/fgkXPad);
979 if (iPadX==kNpadX) iPadX--;
980 else if (iPadX>kNpadX) iPadX=-1;
983 //else AliError("Detector Index could not be determined");
988 //_____________________________________________________________________________
989 Float_t AliTOFGeometry::GetX(Int_t *det) const
992 // Returns X coordinate (cm)
995 Int_t isector = det[0];
996 Int_t iplate = det[1];
997 Int_t istrip = det[2];
998 Int_t ipadz = det[3];
999 Int_t ipadx = det[4];
1002 // Find out distance d on the plane wrt median phi:
1003 Float_t d = (ipadx+0.5-kNpadX*0.5)*fgkXPad;
1005 // The radius r in xy plane:
1006 //Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
1007 // (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg)-0.25; ???
1008 Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
1009 (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg);
1011 // local azimuthal angle in the sector philoc
1012 Float_t philoc = TMath::ATan(d/r);
1013 //if(philoc<0.) philoc = k2PI + philoc;
1015 // azimuthal angle in the global frame phi
1016 Float_t phi = philoc*kRaddeg+(isector+0.5)*fgkPhiSec;
1018 Float_t xCoor = r/TMath::Cos(philoc)*TMath::Cos(phi/kRaddeg);
1021 // Pad reference frame -> FSTR reference frame
1023 Float_t posLocal[3] = {0., 0., 0.};
1024 Float_t step[3] = {-(ipadx+0.5)*fgkXPad, 0., -(ipadz+0.5)*fgkZPad};
1025 Translation(posLocal,step);
1027 step[0] = kNpadX*0.5*fgkXPad;
1029 step[2] = kNpadZ*0.5*fgkZPad;
1032 Float_t posLocal[3] = {(ipadx+0.5)*fgkXPad, 0., (ipadz+0.5)*fgkZPad};
1033 Float_t step[3]= {kNpadX*0.5*fgkXPad, 0., kNpadZ*0.5*fgkZPad};
1035 Translation(posLocal,step);
1037 // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame
1039 if (GetAngles(iplate,istrip) >0.) {
1042 angles[2] = 90.+GetAngles(iplate,istrip);
1044 angles[4] = GetAngles(iplate,istrip);
1047 else if (GetAngles(iplate,istrip)==0.) {
1055 else if (GetAngles(iplate,istrip) <0.) {
1058 angles[2] = 90.+GetAngles(iplate,istrip);
1060 angles[4] =-GetAngles(iplate,istrip);
1064 InverseRotation(posLocal,angles);
1067 step[1] = -GetHeights(iplate,istrip);
1068 step[2] = GetDistances(iplate,istrip);
1069 Translation(posLocal,step);
1071 // FTOA = FLTA reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1079 InverseRotation(posLocal,angles);
1081 // B071/B074/B075 = BTO1/2/3 reference frame -> ALICE reference frame
1084 step[2] = -((fgkRmax+fgkRmin)*0.5);
1085 Translation(posLocal,step);
1088 angles[1] = 90.+(isector+0.5)*fgkPhiSec;
1092 angles[5] = (isector+0.5)*fgkPhiSec;
1094 InverseRotation(posLocal,angles);
1096 Float_t xCoor = posLocal[0];
1101 //_____________________________________________________________________________
1102 Float_t AliTOFGeometry::GetY(Int_t *det) const
1105 // Returns Y coordinate (cm)
1108 Int_t isector = det[0];
1109 Int_t iplate = det[1];
1110 Int_t istrip = det[2];
1111 Int_t ipadz = det[3];
1112 Int_t ipadx = det[4];
1115 // Find out distance d on the plane wrt median phi:
1116 Float_t d = (ipadx+0.5-kNpadX*0.5)*fgkXPad;
1118 // The radius r in xy plane:
1119 //Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
1120 // (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg)-0.25; ???
1121 Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
1122 (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg);
1124 // local azimuthal angle in the sector philoc
1125 Float_t philoc = TMath::ATan(d/r);
1126 //if(philoc<0.) philoc = k2PI + philoc;
1128 // azimuthal angle in the global frame phi
1129 Float_t phi = philoc*kRaddeg+(isector+0.5)*fgkPhiSec;
1131 Float_t yCoor = r/TMath::Cos(philoc)*TMath::Sin(phi/kRaddeg);
1134 // Pad reference frame -> FSTR reference frame
1136 Float_t posLocal[3] = {0., 0., 0.};
1137 Float_t step[3] = {-(ipadx+0.5)*fgkXPad, 0., -(ipadz+0.5)*fgkZPad};
1138 Translation(posLocal,step);
1140 step[0] = kNpadX*0.5*fgkXPad;
1142 step[2] = kNpadZ*0.5*fgkZPad;
1145 Float_t posLocal[3] = {(ipadx+0.5)*fgkXPad, 0., (ipadz+0.5)*fgkZPad};
1146 Float_t step[3]= {kNpadX*0.5*fgkXPad, 0., kNpadZ*0.5*fgkZPad};
1148 Translation(posLocal,step);
1150 // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame
1153 if (GetAngles(iplate,istrip) >0.) {
1156 angles[2] = 90.+GetAngles(iplate,istrip);
1158 angles[4] = GetAngles(iplate,istrip);
1161 else if (GetAngles(iplate,istrip)==0.) {
1169 else if (GetAngles(iplate,istrip) <0.) {
1172 angles[2] = 90.+GetAngles(iplate,istrip);
1174 angles[4] =-GetAngles(iplate,istrip);
1178 InverseRotation(posLocal,angles);
1181 step[1] = -GetHeights(iplate,istrip);
1182 step[2] = GetDistances(iplate,istrip);
1183 Translation(posLocal,step);
1185 // FTOA = FLTA reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1193 InverseRotation(posLocal,angles);
1195 // B071/B074/B075 = BTO1/2/3 reference frame -> ALICE reference frame
1198 step[2] = -((fgkRmax+fgkRmin)*0.5);
1199 Translation(posLocal,step);
1202 angles[1] = 90.+(isector+0.5)*fgkPhiSec;
1206 angles[5] = (isector+0.5)*fgkPhiSec;
1208 InverseRotation(posLocal,angles);
1210 Float_t yCoor = posLocal[1];
1216 //_____________________________________________________________________________
1217 Float_t AliTOFGeometry::GetZ(Int_t *det) const
1220 // Returns Z coordinate (cm)
1223 Int_t isector = det[0];
1224 Int_t iplate = det[1];
1225 Int_t istrip = det[2];
1226 Int_t ipadz = det[3];
1227 Int_t ipadx = det[4];
1230 Float_t zCoor = GetDistances(iplate,istrip) +
1231 (0.5-ipadz) * fgkZPad * TMath::Cos(GetAngles(iplate,istrip)*kDegrad);
1234 // Pad reference frame -> FSTR reference frame
1236 Float_t posLocal[3] = {0., 0., 0.};
1237 Float_t step[3] = {-(ipadx+0.5)*fgkXPad, 0., -(ipadz+0.5)*fgkZPad};
1238 Translation(posLocal,step);
1240 step[0] = kNpadX*0.5*fgkXPad;
1242 step[2] = kNpadZ*0.5*fgkZPad;
1245 Float_t posLocal[3] = {(ipadx+0.5)*fgkXPad, 0., (ipadz+0.5)*fgkZPad};
1246 Float_t step[3]= {kNpadX*0.5*fgkXPad, 0., kNpadZ*0.5*fgkZPad};
1248 Translation(posLocal,step);
1250 // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame
1252 if (GetAngles(iplate,istrip) >0.) {
1255 angles[2] = 90.+GetAngles(iplate,istrip);
1257 angles[4] = GetAngles(iplate,istrip);
1260 else if (GetAngles(iplate,istrip)==0.) {
1268 else if (GetAngles(iplate,istrip) <0.) {
1271 angles[2] = 90.+GetAngles(iplate,istrip);
1273 angles[4] =-GetAngles(iplate,istrip);
1277 InverseRotation(posLocal,angles);
1280 step[1] = -GetHeights(iplate,istrip);
1281 step[2] = GetDistances(iplate,istrip);
1282 Translation(posLocal,step);
1284 // FTOA = FLTA reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1292 InverseRotation(posLocal,angles);
1294 // B071/B074/B075 = BTO1/2/3 reference frame -> ALICE reference frame
1297 step[2] = -((fgkRmax+fgkRmin)*0.5);
1298 Translation(posLocal,step);
1301 angles[1] = 90.+(isector+0.5)*fgkPhiSec;
1305 angles[5] = (isector+0.5)*fgkPhiSec;
1307 InverseRotation(posLocal,angles);
1309 Float_t zCoor = posLocal[2];
1314 //_____________________________________________________________________________
1316 void AliTOFGeometry::DetToSectorRF(Int_t vol[5], Double_t **coord)
1319 // Returns the local coordinates (x, y, z) in sector reference frame
1320 // for the 4 corners of each sector pad (vol[1], vol[2], vol[3], vol[4])
1323 if (!gGeoManager) printf("ERROR: no TGeo\n");
1325 // ALICE -> TOF Sector
1326 Char_t path1[100]="";
1327 GetVolumePath(vol[0],path1);
1328 gGeoManager->cd(path1);
1329 TGeoHMatrix aliceToSector;
1330 aliceToSector = *gGeoManager->GetCurrentMatrix();
1332 // TOF Sector -> ALICE
1333 //TGeoHMatrix sectorToALICE = aliceToSector.Inverse();
1336 Char_t path2[100]="";
1337 GetVolumePath(vol,path2);
1338 gGeoManager->cd(path2);
1339 TGeoHMatrix aliceToPad;
1340 aliceToPad = *gGeoManager->GetCurrentMatrix();
1343 TGeoHMatrix padToALICE = aliceToPad.Inverse();
1345 // TOF Pad -> TOF Sector
1346 TGeoHMatrix padToSector = padToALICE*aliceToSector;
1348 // TOF Sector -> TOF Pad
1349 //TGeoHMatrix sectorToPad = sectorToALICE*aliceToPad;
1351 // coordinates of the pad bottom corner
1352 Double_t **cornerPad = new Double_t*[4];
1353 for (Int_t ii=0; ii<4; ii++) cornerPad[ii] = new Double_t[3];
1355 cornerPad[0][0] = -fgkXPad/2.;
1356 cornerPad[0][1] = 0.;
1357 cornerPad[0][2] = -fgkZPad/2.;
1359 cornerPad[1][0] = fgkXPad/2.;
1360 cornerPad[1][1] = 0.;
1361 cornerPad[1][2] = -fgkZPad/2.;
1363 cornerPad[2][0] = fgkXPad/2.;
1364 cornerPad[2][1] = 0.;
1365 cornerPad[2][2] = fgkZPad/2.;
1367 cornerPad[3][0] = -fgkXPad/2.;
1368 cornerPad[3][1] = 0.;
1369 cornerPad[3][2] = fgkZPad/2.;
1371 for(Int_t aa=0; aa<4; aa++) for(Int_t bb=0; bb<3; bb++) coord[aa][bb]=0.;
1373 for (Int_t jj=0; jj<4; jj++) padToSector.MasterToLocal(&cornerPad[jj][0], &coord[jj][0]);
1377 //sectorToPad.LocalToMaster(cornerPad, coord);
1380 //_____________________________________________________________________________
1381 Float_t AliTOFGeometry::GetPadDx(Float_t *pos)
1384 // Returns the x coordinate in the Pad reference frame
1389 Float_t posLocal[3];
1390 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
1392 Int_t isector = GetSector(posLocal);
1394 //AliError("Detector Index could not be determined");
1396 Int_t iplate = GetPlate(posLocal);
1398 //AliError("Detector Index could not be determined");
1400 Int_t istrip = GetStrip(posLocal);
1402 //AliError("Detector Index could not be determined");
1404 Int_t ipadz = GetPadZ(posLocal);
1406 //AliError("Detector Index could not be determined");
1408 Int_t ipadx = GetPadX(posLocal);
1410 //AliError("Detector Index could not be determined");
1413 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1414 Double_t angles[6] =
1415 {90., 90.+(isector+0.5)*fgkPhiSec,
1417 90., (isector+0.5)*fgkPhiSec
1419 Rotation(posLocal,angles);
1421 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1422 Translation(posLocal,step);
1424 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
1432 Rotation(posLocal,angles);
1434 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1436 step[1] = GetHeights(iplate,istrip);
1437 step[2] = -GetDistances(iplate,istrip);
1438 Translation(posLocal,step);
1440 if (GetAngles(iplate,istrip) >0.) {
1443 angles[2] = 90.+GetAngles(iplate,istrip);
1445 angles[4] = GetAngles(iplate,istrip);
1448 else if (GetAngles(iplate,istrip)==0.) {
1456 else if (GetAngles(iplate,istrip) <0.) {
1459 angles[2] = 90.+GetAngles(iplate,istrip);
1461 angles[4] =-GetAngles(iplate,istrip);
1464 Rotation(posLocal,angles);
1466 step[0] =-0.5*kNpadX*fgkXPad;
1468 step[2] =-0.5*kNpadZ*fgkZPad;
1469 Translation(posLocal,step);
1471 step[0] = (ipadx+0.5)*fgkXPad;
1473 step[2] = (ipadz+0.5)*fgkZPad;
1474 Translation(posLocal,step);
1481 //_____________________________________________________________________________
1482 Float_t AliTOFGeometry::GetPadDy(Float_t *pos)
1485 // Returns the y coordinate in the Pad reference frame
1490 Float_t posLocal[3];
1491 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
1493 Int_t isector = GetSector(posLocal);
1495 //AliError("Detector Index could not be determined");
1497 Int_t iplate = GetPlate(posLocal);
1499 //AliError("Detector Index could not be determined");
1501 Int_t istrip = GetStrip(posLocal);
1503 //AliError("Detector Index could not be determined");
1505 Int_t ipadz = GetPadZ(posLocal);
1507 //AliError("Detector Index could not be determined");
1509 Int_t ipadx = GetPadX(posLocal);
1511 //AliError("Detector Index could not be determined");
1514 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1515 Double_t angles[6] =
1516 {90., 90.+(isector+0.5)*fgkPhiSec,
1518 90., (isector+0.5)*fgkPhiSec
1520 Rotation(posLocal,angles);
1522 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1523 Translation(posLocal,step);
1525 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
1533 Rotation(posLocal,angles);
1535 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1537 step[1] = GetHeights(iplate,istrip);
1538 step[2] = -GetDistances(iplate,istrip);
1539 Translation(posLocal,step);
1541 if (GetAngles(iplate,istrip) >0.) {
1544 angles[2] = 90.+GetAngles(iplate,istrip);
1546 angles[4] = GetAngles(iplate,istrip);
1549 else if (GetAngles(iplate,istrip)==0.) {
1557 else if (GetAngles(iplate,istrip) <0.) {
1560 angles[2] = 90.+GetAngles(iplate,istrip);
1562 angles[4] =-GetAngles(iplate,istrip);
1565 Rotation(posLocal,angles);
1567 step[0] =-0.5*kNpadX*fgkXPad;
1569 step[2] =-0.5*kNpadZ*fgkZPad;
1570 Translation(posLocal,step);
1572 step[0] = (ipadx+0.5)*fgkXPad;
1574 step[2] = (ipadz+0.5)*fgkZPad;
1575 Translation(posLocal,step);
1582 //_____________________________________________________________________________
1583 Float_t AliTOFGeometry::GetPadDz(Float_t *pos)
1586 // Returns the z coordinate in the Pad reference frame
1591 Float_t posLocal[3];
1592 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
1594 Int_t isector = GetSector(posLocal);
1596 //AliError("Detector Index could not be determined");
1598 Int_t iplate = GetPlate(posLocal);
1600 //AliError("Detector Index could not be determined");
1602 Int_t istrip = GetStrip(posLocal);
1604 //AliError("Detector Index could not be determined");
1606 Int_t ipadz = GetPadZ(posLocal);
1608 //AliError("Detector Index could not be determined");
1610 Int_t ipadx = GetPadX(posLocal);
1612 //AliError("Detector Index could not be determined");
1615 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1616 Double_t angles[6] =
1617 {90., 90.+(isector+0.5)*fgkPhiSec,
1619 90., (isector+0.5)*fgkPhiSec
1621 Rotation(posLocal,angles);
1623 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1624 Translation(posLocal,step);
1626 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
1634 Rotation(posLocal,angles);
1636 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1638 step[1] = GetHeights(iplate,istrip);
1639 step[2] = -GetDistances(iplate,istrip);
1640 Translation(posLocal,step);
1642 if (GetAngles(iplate,istrip) >0.) {
1645 angles[2] = 90.+GetAngles(iplate,istrip);
1647 angles[4] = GetAngles(iplate,istrip);
1650 else if (GetAngles(iplate,istrip)==0.) {
1658 else if (GetAngles(iplate,istrip) <0.) {
1661 angles[2] = 90.+GetAngles(iplate,istrip);
1663 angles[4] =-GetAngles(iplate,istrip);
1666 Rotation(posLocal,angles);
1668 step[0] =-0.5*kNpadX*fgkXPad;
1670 step[2] =-0.5*kNpadZ*fgkZPad;
1671 Translation(posLocal,step);
1673 step[0] = (ipadx+0.5)*fgkXPad;
1675 step[2] = (ipadz+0.5)*fgkZPad;
1676 Translation(posLocal,step);
1683 //_____________________________________________________________________________
1685 void AliTOFGeometry::Translation(Float_t *xyz, Float_t translationVector[3]) const
1688 // Return the vector xyz translated by translationVector vector
1693 for (ii=0; ii<3; ii++)
1694 xyz[ii] -= translationVector[ii];
1699 //_____________________________________________________________________________
1701 void AliTOFGeometry::Rotation(Float_t *xyz, Double_t rotationAngles[6]) const
1704 // Return the vector xyz rotated according to the rotationAngles angles
1709 TRotMatrix *matrix = new TRotMatrix("matrix","matrix", angles[0], angles[1],
1710 angles[2], angles[3],
1711 angles[4], angles[5]);
1714 for (ii=0; ii<6; ii++) rotationAngles[ii]*=kDegrad;
1716 Float_t xyzDummy[3] = {0., 0., 0.};
1718 for (ii=0; ii<3; ii++) {
1720 xyz[0]*TMath::Sin(rotationAngles[2*ii])*TMath::Cos(rotationAngles[2*ii+1]) +
1721 xyz[1]*TMath::Sin(rotationAngles[2*ii])*TMath::Sin(rotationAngles[2*ii+1]) +
1722 xyz[2]*TMath::Cos(rotationAngles[2*ii]);
1725 for (ii=0; ii<3; ii++) xyz[ii]=xyzDummy[ii];
1730 //_____________________________________________________________________________
1731 void AliTOFGeometry::InverseRotation(Float_t *xyz, Double_t rotationAngles[6]) const
1739 for (ii=0; ii<6; ii++) rotationAngles[ii]*=kDegrad;
1741 Float_t xyzDummy[3] = {0., 0., 0.};
1744 xyz[0]*TMath::Sin(rotationAngles[0])*TMath::Cos(rotationAngles[1]) +
1745 xyz[1]*TMath::Sin(rotationAngles[2])*TMath::Cos(rotationAngles[3]) +
1746 xyz[2]*TMath::Sin(rotationAngles[4])*TMath::Cos(rotationAngles[5]);
1749 xyz[0]*TMath::Sin(rotationAngles[0])*TMath::Sin(rotationAngles[1]) +
1750 xyz[1]*TMath::Sin(rotationAngles[2])*TMath::Sin(rotationAngles[3]) +
1751 xyz[2]*TMath::Sin(rotationAngles[4])*TMath::Sin(rotationAngles[5]);
1754 xyz[0]*TMath::Cos(rotationAngles[0]) +
1755 xyz[1]*TMath::Cos(rotationAngles[2]) +
1756 xyz[2]*TMath::Cos(rotationAngles[4]);
1758 for (ii=0; ii<3; ii++) xyz[ii]=xyzDummy[ii];
1763 //_____________________________________________________________________________
1765 Int_t AliTOFGeometry::GetIndex(Int_t *detId)
1767 //Retrieve calibration channel index
1768 Int_t isector = detId[0];
1769 if (isector >= kNSectors){
1770 printf("Wrong sector number in TOF (%d) !",isector);
1773 Int_t iplate = detId[1];
1774 if (iplate >= kNPlates){
1775 printf("Wrong plate number in TOF (%d) !",iplate);
1778 Int_t istrip = detId[2];
1779 Int_t ipadz = detId[3];
1780 Int_t ipadx = detId[4];
1781 Int_t stripOffset = 0;
1787 stripOffset = kNStripC;
1790 stripOffset = kNStripC+kNStripB;
1793 stripOffset = kNStripC+kNStripB+kNStripA;
1796 stripOffset = kNStripC+kNStripB+kNStripA+kNStripB;
1799 printf("Wrong plate number in TOF (%d) !",iplate);
1803 Int_t idet = ((2*(kNStripC+kNStripB)+kNStripA)
1804 *kNpadZ*kNpadX)*isector +
1805 (stripOffset*kNpadZ*kNpadX)+
1806 (kNpadZ*kNpadX)*istrip+