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.8 2007/02/19 18:55:26 decaro
19 Added getter methods for volume path (for Event Display)
21 Revision 1.17.1 2006/12/15
23 DetToSectorRF(...) to get pad corners
24 coordinates in its sector reference frame;
25 GetVolumePath(Int_t sector, Char_t *path)
26 to get the volume path for a sector
27 GetVolumePath(Int_t sector, Int_t plate, Int_t strip, Char_t *path)
28 to get the volume path for a strip
29 (A.De Caro, M.Di Stefano)
30 Revision 1.7 2006/07/12 16:03:59 arcelli
31 updates to match the new numbering of the TOF/TRD mother volumes in FRAME (ALICE convention)
33 Revision 1.6 2006/05/04 19:41:42 hristov
34 Possibility for partial TOF geometry (S.Arcelli)
36 Revision 1.5 2006/04/20 22:30:50 hristov
37 Coding conventions (Annalisa)
39 Revision 1.4 2006/04/16 22:29:05 hristov
40 Coding conventions (Annalisa)
42 Revision 1.3 2006/03/12 14:38:05 arcelli
43 Changes for TOF Reconstruction using TGeo
45 Revision 1.2 2006/02/28 10:38:00 decaro
46 AliTOFGeometry::fAngles, AliTOFGeometry::fHeights, AliTOFGeometry::fDistances arrays: dimension definition in the right location
48 Revision 1.1 2005/12/15 08:55:33 decaro
49 New TOF geometry description (V5) -G. Cara Romeo and A. De Caro
51 Revision 0.1 2005/07/19 G. Cara Romeo and A. De Caro
52 Modify Global methods IsInsideThePad & DistanceToPad
53 according to the new TOF geometry
54 Implement Global methods GetPadDx & GetPadDy & GetPadDz
55 Implement Private methods Translation & Rotation & InverseRotation
56 Modify Global methods GetDetID & GetPlate & GetSector &
57 GetStrip & GetPadX & GetPadZ
58 according to the new TOF geometry
59 Modify Global methods GetPos & GetX & GetY & GetZ
60 according to the new TOF geometry
63 ///////////////////////////////////////////////////////////////////////////////
65 // TOF Geometry class (new version) //
67 ///////////////////////////////////////////////////////////////////////////////
69 #include "TGeoManager.h"
74 #include "AliTOFGeometryV5.h"
76 extern TGeoManager *gGeoManager;
78 ClassImp(AliTOFGeometryV5)
81 const Float_t AliTOFGeometryV5::fgkZlenA = 370.6*2.; // length (cm) of the A module
82 const Float_t AliTOFGeometryV5::fgkZlenB = 146.5; // length (cm) of the B module
83 const Float_t AliTOFGeometryV5::fgkZlenC = 170.45; // length (cm) of the C module
84 const Float_t AliTOFGeometryV5::fgkMaxhZtof = 370.6; // Max half z-size of TOF (cm)
86 const Float_t AliTOFGeometryV5::fgkxTOF = 371.-0.01;// Inner radius of the TOF for Reconstruction (cm)
87 const Float_t AliTOFGeometryV5::fgkRmin = 370.-0.01;// Inner radius of the TOF (cm)
88 const Float_t AliTOFGeometryV5::fgkRmax = 399.-0.01;// Outer radius of the TOF (cm)
90 //_____________________________________________________________________________
91 AliTOFGeometryV5::AliTOFGeometryV5()
95 // AliTOFGeometryV5 default constructor
98 AliTOFGeometry::fNStripC = kNStripC; // number of strips in C type module
100 AliTOFGeometry::fZlenA = fgkZlenA; // length of the TOF supermodule (cm)
101 AliTOFGeometry::fZlenB = fgkZlenB; // length of the B module (cm)
102 AliTOFGeometry::fZlenC = fgkZlenC; // length of the C module (cm)
103 AliTOFGeometry::fMaxhZtof = fgkMaxhZtof; // Max half z-size of TOF supermodule (cm)
105 AliTOFGeometry::fxTOF = fgkxTOF; // Inner radius of the TOF for Reconstruction (cm)
106 AliTOFGeometry::fRmin = fgkRmin; // Inner radius of the TOF (cm)
107 AliTOFGeometry::fRmax = fgkRmax; // Outer radius of the TOF (cm)
113 //_____________________________________________________________________________
114 AliTOFGeometryV5::~AliTOFGeometryV5()
117 // AliTOFGeometryV5 destructor
121 //_____________________________________________________________________________
122 void AliTOFGeometryV5::ImportGeometry(){
123 TGeoManager::Import("geometry.root");
125 //_____________________________________________________________________________
126 void AliTOFGeometryV5::Init()
129 // Initialize strip Tilt Angles, Heights and Distances
131 // Strips Tilt Angles
133 // For each strip to be positoned in FLTA/FLTB/FLTC,
134 // define 3 arrays containing:
135 // the angle of the normal with respect to the Y axis of FLTA/FLTB/FLTC
136 // the Y of the center with respect to the FLTA/FLTB/FLTC reference frame
137 // the Z of the center with respect to the BT01/BT02/BT03 reference frame
140 fPhiSec = 360./kNSectors;
142 Float_t const kangles[kNPlates][kMaxNstrip] ={
143 { 43.99, 43.20, 42.40, 41.59, 40.77, 39.94, 39.11, 38.25, 37.40, 36.53,
144 35.65, 34.76, 33.87, 32.96, 32.05, 31.13, 30.19, 29.24, 12.33, 0.00},
146 { 27.26, 26.28, 25.30, 24.31, 23.31, 22.31, 21.30, 20.29, 19.26, 18.24,
147 17.20, 16.16, 15.11, 14.05, 13.00, 11.93, 10.87, 9.80, 8.74, 0.00},
149 { 0.00, 6.30, 5.31, 4.25, 3.19, 2.12, 1.06, 0.00, -1.06, -2.12,
150 -3.19, -4.25, -5.31, -6.30, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00},
152 { -8.74, -9.80, -10.87, -11.93, -13.00, -14.05, -15.11, -16.16, -17.20, -18.24,
153 -19.26, -20.29, -21.30, -22.31, -23.31, -24.31, -25.30, -26.28, -27.26, 0.00},
155 {-12.33, -29.24, -30.19, -31.13, -32.05, -32.96, -33.87, -34.76, -35.65, -36.53,
156 -37.40, -38.25, -39.11, -39.94, -40.77, -41.59, -42.40, -43.20, -43.99, 0.00}
159 Float_t const kheights[kNPlates][kMaxNstrip]= {
160 {-8.2, -7.5, -8.2, -7.7, -8.1, -7.6, -7.7, -7.7, -7.7, -7.7,
161 -7.5, -7.2, -7.3, -7.5, -7.6, -7.8, -8.3, -9.3, -3.1, 0.0},
163 {-7.9, -8.1, -8.5, -9.0, -10.1, -3.9, -5.9, -7.7, -10.1, -3.6,
164 -5.8, -8.0, -10.4, -4.4, -7.2, -10.2, -4.6, -7.4, -10.4, 0.0},
166 {-2.5, -10.4, -5.0, -9.9, -4.8, -9.9, -4.7, -10.2, -4.7, -9.9,
167 -4.8, -9.9, -5.0, -10.4, -2.5, 0.0, 0.0, 0.0, 0.0, 0.0},
169 {-10.4, -7.4, -4.6, -10.2, -7.2, -4.4, -10.4, -8.0, -5.8, -3.6,
170 -10.1, -7.7, -5.9, -3.9, -10.1, -9.0, -8.5, -8.1, -7.9, 0.0},
172 { -3.1, -9.3, -8.3, -7.8, -7.6, -7.5, -7.3, -7.2, -7.5, -7.7,
173 -7.7, -7.7, -7.7, -7.6, -8.1, -7.7, -8.2, -7.5, -8.2, 0.0}
177 Float_t const kdistances[kNPlates][kMaxNstrip]= {
178 { 364.1, 354.9, 344.5, 335.4, 325.5, 316.6, 307.2, 298.0, 288.9, 280.0,
179 271.3, 262.7, 254.0, 244.8, 236.1, 227.7, 219.1, 210.3, 205.7, 0.0},
181 { 194.2, 186.1, 177.9, 169.8, 161.5, 156.3, 147.8, 139.4, 130.9, 125.6,
182 117.3, 109.2, 101.1, 95.3, 87.1, 79.2, 73.0, 65.1, 57.6, 0.0},
184 { 49.5, 41.3, 35.3, 27.8, 21.2, 13.9, 7.0, 0.0, -7.0, -13.9,
185 -21.2, -27.8, -35.3, -41.3, -49.5, 0.0, 0.0, 0.0, 0.0, 0.0},
187 { -57.6, -65.1, -73.0, -79.2, -87.1, -95.3, -101.1, -109.2, -117.3, -125.6,
188 -130.9, -139.4, -147.8, -156.3, -161.5, -169.8, -177.9, -186.1, -194.2, 0.0},
190 {-205.7, -210.3, -219.1, -227.7, -236.1, -244.8, -254.0, -262.7, -271.3, -280.0,
191 -288.9, -298.0, -307.2, -316.6, -325.5, -335.4, -344.5, -354.9, -364.1, 0.0}
195 for (Int_t iplate = 0; iplate < kNPlates; iplate++) {
196 for (Int_t istrip = 0; istrip < kMaxNstrip; istrip++) {
197 AliTOFGeometry::fAngles[iplate][istrip] = kangles[iplate][istrip];
198 AliTOFGeometry::fHeights[iplate][istrip] = kheights[iplate][istrip];
199 AliTOFGeometry::fDistances[iplate][istrip]= kdistances[iplate][istrip];
205 //_____________________________________________________________________________
206 Float_t AliTOFGeometryV5::DistanceToPadPar(Int_t *det, Float_t *pos, Float_t *dist3d) const
209 // Returns distance of space point with coor pos (x,y,z) (cm) wrt
210 // pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ)
213 //Transform pos into Sector Frame
219 Float_t radius = TMath::Sqrt(x*x+y*y);
220 //Float_t phi=TMath::ATan(y/x);
221 //if(phi<0) phi = k2PI+phi; //2.*TMath::Pi()+phi;
222 Float_t phi = TMath::Pi()+TMath::ATan2(-y,-x);
223 // Get the local angle in the sector philoc
224 Float_t angle = phi*kRaddeg-( Int_t (kRaddeg*phi/fPhiSec) + 0.5)*fPhiSec;
225 Float_t xs = radius*TMath::Cos(angle/kRaddeg);
226 Float_t ys = radius*TMath::Sin(angle/kRaddeg);
229 // Do the same for the selected pad
234 Float_t padRadius = TMath::Sqrt(g[0]*g[0]+g[1]*g[1]);
235 //Float_t padPhi = TMath::ATan(g[1]/g[0]);
236 //if(padPhi<0) padPhi = k2Pi + padPhi;
237 Float_t padPhi = TMath::Pi()+TMath::ATan2(-g[1],-g[0]);
239 // Get the local angle in the sector philoc
240 Float_t padAngle = padPhi*kRaddeg-( Int_t (padPhi*kRaddeg/fPhiSec)+ 0.5) * fPhiSec;
241 Float_t padxs = padRadius*TMath::Cos(padAngle/kRaddeg);
242 Float_t padys = padRadius*TMath::Sin(padAngle/kRaddeg);
243 Float_t padzs = g[2];
245 //Now move to local pad coordinate frame. Translate:
247 Float_t xt = xs-padxs;
248 Float_t yt = ys-padys;
249 Float_t zt = zs-padzs;
252 Float_t alpha = GetAngles(det[1],det[2]);
253 Float_t xr = xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg);
255 Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg);
257 Float_t dist = TMath::Sqrt(xr*xr+yr*yr+zr*zr);
269 //_____________________________________________________________________________
270 Bool_t AliTOFGeometryV5::IsInsideThePadPar(Int_t *det, Float_t *pos) const
273 // Returns true if space point with coor pos (x,y,z) (cm) falls
274 // inside pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ)
277 Bool_t isInside=false;
280 const Float_t khhony = 1.0 ; // heigth of HONY Layer
281 const Float_t khpcby = 0.08 ; // heigth of PCB Layer
282 const Float_t khrgly = 0.055 ; // heigth of RED GLASS Layer
283 const Float_t khglfy = 0.285 ; // heigth of GLASS+FISHLINE Layer
284 const Float_t khcpcby = 0.16 ; // heigth of PCB Central Layer
285 //const Float_t kwcpcbz = 12.4 ; // z dimension of PCB Central Layer
286 const Float_t khstripy = 2.*khhony+2.*khpcby+4.*khrgly+2.*khglfy+khcpcby;//3.11
287 //const Float_t kwstripz = kwcpcbz;
288 //const Float_t klstripx = fgkStripLength;
291 const Float_t padDepth = 0.5;//0.05;//0.11;//0.16;// // heigth of Sensitive Layer
293 //Transform pos into Sector Frame
299 Float_t radius = TMath::Sqrt(x*x+y*y);
300 Float_t phi = TMath::Pi()+TMath::ATan2(-y,-x);
302 // Get the local angle in the sector philoc
303 Float_t angle = phi*kRaddeg-( Int_t (kRaddeg*phi/fPhiSec) + 0.5) *fPhiSec;
304 Float_t xs = radius*TMath::Cos(angle/kRaddeg);
305 Float_t ys = radius*TMath::Sin(angle/kRaddeg);
308 // Do the same for the selected pad
313 Float_t padRadius = TMath::Sqrt(g[0]*g[0]+g[1]*g[1]);
314 Float_t padPhi = TMath::Pi()+TMath::ATan2(-g[1],-g[0]);
316 // Get the local angle in the sector philoc
317 Float_t padAngle = padPhi*kRaddeg-( Int_t (padPhi*kRaddeg/fPhiSec)+ 0.5) * fPhiSec;
318 Float_t padxs = padRadius*TMath::Cos(padAngle/kRaddeg);
319 Float_t padys = padRadius*TMath::Sin(padAngle/kRaddeg);
320 Float_t padzs = g[2];
322 //Now move to local pad coordinate frame. Translate:
324 Float_t xt = xs-padxs;
325 Float_t yt = ys-padys;
326 Float_t zt = zs-padzs;
330 Float_t alpha = GetAngles(det[1],det[2]);
331 Float_t xr = xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg);
333 Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg);
335 if(TMath::Abs(xr)<=padDepth*0.5 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5))
342 //_____________________________________________________________________________
343 Bool_t AliTOFGeometryV5::IsInsideThePad(TGeoHMatrix mat, Float_t *pos, Float_t *dist3d) const
346 // Returns true if space point with coor pos (x,y,z) (cm) falls
347 // inside pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ)
350 const Float_t padDepth = 0.5; // heigth of Sensitive Layer
355 Double_t veclr[3]={-1.,-1.,-1.};
356 Double_t vecl[3]={-1.,-1.,-1.};
357 mat.MasterToLocal(vecg,veclr);
360 //take into account reflections
363 Float_t xr = vecl[0];
364 Float_t yr = vecl[1];
365 Float_t zr = vecl[2];
373 Bool_t isInside=false;
374 if(TMath::Abs(xr)<= padDepth*0.5 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5))
379 //_____________________________________________________________________________
380 //_____________________________________________________________________________
381 Float_t AliTOFGeometryV5::GetX(Int_t *det) const
384 // Returns X coordinate (cm)
387 Int_t isector = det[0];
388 Int_t iplate = det[1];
389 Int_t istrip = det[2];
390 Int_t ipadz = det[3];
391 Int_t ipadx = det[4];
394 // Find out distance d on the plane wrt median phi:
395 Float_t d = (ipadx+0.5-kNpadX*0.5)*fgkXPad;
397 // The radius r in xy plane:
398 //Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
399 // (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg)-0.25; ???
400 Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
401 (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg);
403 // local azimuthal angle in the sector philoc
404 Float_t philoc = TMath::ATan(d/r);
405 //if(philoc<0.) philoc = k2PI + philoc;
407 // azimuthal angle in the global frame phi
408 Float_t phi = philoc*kRaddeg+(isector+0.5)*fPhiSec;
410 Float_t xCoor = r/TMath::Cos(philoc)*TMath::Cos(phi/kRaddeg);
413 // Pad reference frame -> FSTR reference frame
415 Float_t posLocal[3] = {0., 0., 0.};
416 Float_t step[3] = {-(ipadx+0.5)*fgkXPad, 0., -(ipadz+0.5)*fgkZPad};
417 Translation(posLocal,step);
419 step[0] = kNpadX*0.5*fgkXPad;
421 step[2] = kNpadZ*0.5*fgkZPad;
424 Float_t posLocal[3] = {(ipadx+0.5)*fgkXPad, 0., (ipadz+0.5)*fgkZPad};
425 Float_t step[3]= {kNpadX*0.5*fgkXPad, 0., kNpadZ*0.5*fgkZPad};
427 Translation(posLocal,step);
429 // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame
431 if (GetAngles(iplate,istrip) >0.) {
434 angles[2] = 90.+GetAngles(iplate,istrip);
436 angles[4] = GetAngles(iplate,istrip);
439 else if (GetAngles(iplate,istrip)==0.) {
447 else if (GetAngles(iplate,istrip) <0.) {
450 angles[2] = 90.+GetAngles(iplate,istrip);
452 angles[4] =-GetAngles(iplate,istrip);
456 InverseRotation(posLocal,angles);
459 step[1] = -GetHeights(iplate,istrip);
460 step[2] = GetDistances(iplate,istrip);
461 Translation(posLocal,step);
463 // FTOA = FLTA reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
471 InverseRotation(posLocal,angles);
473 // B071/B074/B075 = BTO1/2/3 reference frame -> ALICE reference frame
476 step[2] = -((fgkRmax+fgkRmin)*0.5);
477 Translation(posLocal,step);
480 angles[1] = 90.+(isector+0.5)*fPhiSec;
484 angles[5] = (isector+0.5)*fPhiSec;
486 InverseRotation(posLocal,angles);
488 Float_t xCoor = posLocal[0];
493 //_____________________________________________________________________________
494 Float_t AliTOFGeometryV5::GetY(Int_t *det) const
497 // Returns Y coordinate (cm)
500 Int_t isector = det[0];
501 Int_t iplate = det[1];
502 Int_t istrip = det[2];
503 Int_t ipadz = det[3];
504 Int_t ipadx = det[4];
507 // Find out distance d on the plane wrt median phi:
508 Float_t d = (ipadx+0.5-kNpadX*0.5)*fgkXPad;
510 // The radius r in xy plane:
511 //Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
512 // (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg)-0.25; ???
513 Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
514 (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg);
516 // local azimuthal angle in the sector philoc
517 Float_t philoc = TMath::ATan(d/r);
518 //if(philoc<0.) philoc = k2PI + philoc;
520 // azimuthal angle in the global frame phi
521 Float_t phi = philoc*kRaddeg+(isector+0.5)*fPhiSec;
523 Float_t yCoor = r/TMath::Cos(philoc)*TMath::Sin(phi/kRaddeg);
526 // Pad reference frame -> FSTR reference frame
528 Float_t posLocal[3] = {0., 0., 0.};
529 Float_t step[3] = {-(ipadx+0.5)*fgkXPad, 0., -(ipadz+0.5)*fgkZPad};
530 Translation(posLocal,step);
532 step[0] = kNpadX*0.5*fgkXPad;
534 step[2] = kNpadZ*0.5*fgkZPad;
537 Float_t posLocal[3] = {(ipadx+0.5)*fgkXPad, 0., (ipadz+0.5)*fgkZPad};
538 Float_t step[3]= {kNpadX*0.5*fgkXPad, 0., kNpadZ*0.5*fgkZPad};
540 Translation(posLocal,step);
542 // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame
545 if (GetAngles(iplate,istrip) >0.) {
548 angles[2] = 90.+GetAngles(iplate,istrip);
550 angles[4] = GetAngles(iplate,istrip);
553 else if (GetAngles(iplate,istrip)==0.) {
561 else if (GetAngles(iplate,istrip) <0.) {
564 angles[2] = 90.+GetAngles(iplate,istrip);
566 angles[4] =-GetAngles(iplate,istrip);
570 InverseRotation(posLocal,angles);
573 step[1] = -GetHeights(iplate,istrip);
574 step[2] = GetDistances(iplate,istrip);
575 Translation(posLocal,step);
577 // FTOA = FLTA reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
585 InverseRotation(posLocal,angles);
587 // B071/B074/B075 = BTO1/2/3 reference frame -> ALICE reference frame
590 step[2] = -((fgkRmax+fgkRmin)*0.5);
591 Translation(posLocal,step);
594 angles[1] = 90.+(isector+0.5)*fPhiSec;
598 angles[5] = (isector+0.5)*fPhiSec;
600 InverseRotation(posLocal,angles);
602 Float_t yCoor = posLocal[1];
608 //_____________________________________________________________________________
609 Float_t AliTOFGeometryV5::GetZ(Int_t *det) const
612 // Returns Z coordinate (cm)
615 Int_t isector = det[0];
616 Int_t iplate = det[1];
617 Int_t istrip = det[2];
618 Int_t ipadz = det[3];
619 Int_t ipadx = det[4];
622 Float_t zCoor = GetDistances(iplate,istrip) +
623 (0.5-ipadz) * fgkZPad * TMath::Cos(GetAngles(iplate,istrip)*kDegrad);
626 // Pad reference frame -> FSTR reference frame
628 Float_t posLocal[3] = {0., 0., 0.};
629 Float_t step[3] = {-(ipadx+0.5)*fgkXPad, 0., -(ipadz+0.5)*fgkZPad};
630 Translation(posLocal,step);
632 step[0] = kNpadX*0.5*fgkXPad;
634 step[2] = kNpadZ*0.5*fgkZPad;
637 Float_t posLocal[3] = {(ipadx+0.5)*fgkXPad, 0., (ipadz+0.5)*fgkZPad};
638 Float_t step[3]= {kNpadX*0.5*fgkXPad, 0., kNpadZ*0.5*fgkZPad};
640 Translation(posLocal,step);
642 // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame
644 if (GetAngles(iplate,istrip) >0.) {
647 angles[2] = 90.+GetAngles(iplate,istrip);
649 angles[4] = GetAngles(iplate,istrip);
652 else if (GetAngles(iplate,istrip)==0.) {
660 else if (GetAngles(iplate,istrip) <0.) {
663 angles[2] = 90.+GetAngles(iplate,istrip);
665 angles[4] =-GetAngles(iplate,istrip);
669 InverseRotation(posLocal,angles);
672 step[1] = -GetHeights(iplate,istrip);
673 step[2] = GetDistances(iplate,istrip);
674 Translation(posLocal,step);
676 // FTOA = FLTA reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
684 InverseRotation(posLocal,angles);
686 // B071/B074/B075 = BTO1/2/3 reference frame -> ALICE reference frame
689 step[2] = -((fgkRmax+fgkRmin)*0.5);
690 Translation(posLocal,step);
693 angles[1] = 90.+(isector+0.5)*fPhiSec;
697 angles[5] = (isector+0.5)*fPhiSec;
699 InverseRotation(posLocal,angles);
701 Float_t zCoor = posLocal[2];
707 //_____________________________________________________________________________
708 Int_t AliTOFGeometryV5::GetSector(Float_t *pos) const
711 // Returns the Sector index
714 //const Float_t khAlWall = 0.1;
715 //const Float_t kModuleWallThickness = 0.3;
723 Float_t rho = TMath::Sqrt(x*x + y*y);
725 //if (!((z>=-fgkMaxhZtof && z<=fgkMaxhZtof) &&
726 if (!((z>=-fgkZlenA*0.5 && z<=fgkZlenA*0.5) &&
727 (rho>=(fgkRmin) && rho<=(fgkRmax)))) {
728 //(rho>=(fgkRmin-0.05)+kModuleWallThickness && rho<=(fgkRmax-0.05)-kModuleWallThickness-khAlWall-kModuleWallThickness))) {
729 //AliError("Detector Index could not be determined");
733 Float_t phi = TMath::Pi() + TMath::ATan2(-y,-x);
735 iSect = (Int_t) (phi*kRaddeg/fPhiSec);
740 //_____________________________________________________________________________
742 Int_t AliTOFGeometryV5::GetPlate(Float_t *pos) const
745 // Returns the Plate index
747 const Float_t kInterCentrModBorder1 = 49.5;
748 const Float_t kInterCentrModBorder2 = 57.5;
749 const Float_t kExterInterModBorder1 = 196.0;
750 const Float_t kExterInterModBorder2 = 203.5;
752 const Float_t kLengthExInModBorder = 4.7;
753 const Float_t kLengthInCeModBorder = 7.0;
755 //const Float_t khAlWall = 0.1;
756 const Float_t kModuleWallThickness = 0.3;
757 //const Float_t kHoneycombLayerThickness = 1.5;
762 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
764 Int_t isector = GetSector(posLocal);
766 //AliError("Detector Index could not be determined");
770 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
772 {90., 90.+(isector+0.5)*fPhiSec,
774 90., (isector+0.5)*fPhiSec
776 Rotation(posLocal,angles);
778 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
779 Translation(posLocal,step);
781 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame
789 Rotation(posLocal,angles);
791 Float_t yLocal = posLocal[1];
792 Float_t zLocal = posLocal[2];
794 Float_t deltaRhoLoc = (fgkRmax-fgkRmin)*0.5 - kModuleWallThickness + yLocal;
795 Float_t deltaZetaLoc = TMath::Abs(zLocal);
797 Float_t deltaRHOmax = 0.;
799 if (TMath::Abs(zLocal)>=kExterInterModBorder1 && TMath::Abs(zLocal)<=kExterInterModBorder2)
801 deltaRhoLoc -= kLengthExInModBorder;
802 deltaZetaLoc = kExterInterModBorder2-deltaZetaLoc;
803 deltaRHOmax = (fgkRmax - fgkRmin)*0.5 - kModuleWallThickness - 2.*kLengthExInModBorder; // old 5.35, new 4.8
805 if (deltaRhoLoc > deltaZetaLoc*deltaRHOmax/(kInterCentrModBorder2-kInterCentrModBorder1)) {
806 if (zLocal<0) iPlate = 0;
810 if (zLocal<0) iPlate = 1;
814 else if (TMath::Abs(zLocal)>=kInterCentrModBorder1 && TMath::Abs(zLocal)<=kInterCentrModBorder2)
816 deltaRhoLoc -= kLengthInCeModBorder;
817 deltaZetaLoc = deltaZetaLoc-kInterCentrModBorder1;
818 deltaRHOmax = (fgkRmax - fgkRmin)*0.5 - kModuleWallThickness - 2.*kLengthInCeModBorder; // old 0.39, new 0.2
820 if (deltaRhoLoc>deltaZetaLoc*deltaRHOmax/(kInterCentrModBorder2-kInterCentrModBorder1)) iPlate = 2;
822 if (zLocal<0) iPlate = 1;
827 if (zLocal>-fgkZlenA*0.5/*fgkMaxhZtof*/ && zLocal<-kExterInterModBorder2) iPlate = 0;
828 else if (zLocal>-kExterInterModBorder1 && zLocal<-kInterCentrModBorder2) iPlate = 1;
829 else if (zLocal>-kInterCentrModBorder1 && zLocal< kInterCentrModBorder1) iPlate = 2;
830 else if (zLocal> kInterCentrModBorder2 && zLocal< kExterInterModBorder1) iPlate = 3;
831 else if (zLocal> kExterInterModBorder2 && zLocal< fgkZlenA*0.5/*fgkMaxhZtof*/) iPlate = 4;
837 //_____________________________________________________________________________
838 Int_t AliTOFGeometryV5::GetStrip(Float_t *pos) const
841 // Returns the Strip index
843 const Float_t khhony = 1.0 ; // heigth of HONY Layer
844 const Float_t khpcby = 0.08 ; // heigth of PCB Layer
845 const Float_t khrgly = 0.055 ; // heigth of RED GLASS Layer
846 const Float_t khglfy = 0.285 ; // heigth of GLASS+FISHLINE Layer
847 const Float_t khcpcby = 0.16 ; // heigth of PCB Central Layer
848 const Float_t kwcpcbz = 12.4 ; // z dimension of PCB Central Layer
849 const Float_t khstripy = 2.*khhony+2.*khpcby+4.*khrgly+2.*khglfy+khcpcby;//3.11
850 const Float_t kwstripz = kwcpcbz;
851 const Float_t klstripx = fgkStripLength;
856 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
858 Int_t isector = GetSector(posLocal);
860 //AliError("Detector Index could not be determined");
862 Int_t iplate = GetPlate(posLocal);
864 //AliError("Detector Index could not be determined");
886 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
888 {90., 90.+(isector+0.5)*fPhiSec,
890 90., (isector+0.5)*fPhiSec
892 Rotation(posLocal,angles);
894 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
895 Translation(posLocal,step);
897 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame
905 Rotation(posLocal,angles);
907 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
909 for (Int_t istrip=0; istrip<nstrips; istrip++){
911 Float_t posLoc2[3]={posLocal[0],posLocal[1],posLocal[2]};
914 step[1] = GetHeights(iplate,istrip);
915 step[2] = -GetDistances(iplate,istrip);
916 Translation(posLoc2,step);
918 if (GetAngles(iplate,istrip) >0.) {
921 angles[2] = 90.+GetAngles(iplate,istrip);
923 angles[4] = GetAngles(iplate,istrip);
926 else if (GetAngles(iplate,istrip)==0.) {
934 else if (GetAngles(iplate,istrip) <0.) {
937 angles[2] = 90.+GetAngles(iplate,istrip);
939 angles[4] =-GetAngles(iplate,istrip);
942 Rotation(posLoc2,angles);
944 if ((TMath::Abs(posLoc2[0])<=klstripx*0.5) &&
945 (TMath::Abs(posLoc2[1])<=khstripy*0.5) &&
946 (TMath::Abs(posLoc2[2])<=kwstripz*0.5)) {
949 for (Int_t jj=0; jj<3; jj++) posLocal[jj]=posLoc2[jj];
950 //AliInfo(Form(" posLocal[0] = %f, posLocal[1] = %f, posLocal[2] = %f ", posLocal[0],posLocal[1],posLocal[2]));
952 //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]));
956 if (totStrip>1) AliInfo(Form("total strip number found %2i",totStrip));
963 //_____________________________________________________________________________
964 Int_t AliTOFGeometryV5::GetPadZ(Float_t *pos) const
967 // Returns the Pad index along Z
969 //const Float_t klsensmx = kNpadX*fgkXPad; // length of Sensitive Layer
970 //const Float_t khsensmy = 0.05;//0.11;//0.16;// heigth of Sensitive Layer
971 //const Float_t kwsensmz = kNpadZ*fgkZPad; // width of Sensitive Layer
976 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
978 Int_t isector = GetSector(posLocal);
980 //AliError("Detector Index could not be determined");
982 Int_t iplate = GetPlate(posLocal);
984 //AliError("Detector Index could not be determined");
986 Int_t istrip = GetStrip(posLocal);
988 //AliError("Detector Index could not be determined");
991 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
993 {90., 90.+(isector+0.5)*fPhiSec,
995 90., (isector+0.5)*fPhiSec
997 Rotation(posLocal,angles);
999 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1000 Translation(posLocal,step);
1002 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame
1010 Rotation(posLocal,angles);
1012 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1014 step[1] = GetHeights(iplate,istrip);
1015 step[2] = -GetDistances(iplate,istrip);
1016 Translation(posLocal,step);
1018 if (GetAngles(iplate,istrip) >0.) {
1021 angles[2] = 90.+GetAngles(iplate,istrip);
1023 angles[4] = GetAngles(iplate,istrip);
1026 else if (GetAngles(iplate,istrip)==0.) {
1034 else if (GetAngles(iplate,istrip) <0.) {
1037 angles[2] = 90.+GetAngles(iplate,istrip);
1039 angles[4] =-GetAngles(iplate,istrip);
1042 Rotation(posLocal,angles);
1044 //if (TMath::Abs(posLocal[0])<=klsensmx*0.5 && /*TMath::Abs(posLocal[1])<=khsensmy*0.5+0.005 &&*/ TMath::Abs(posLocal[2])<=kwsensmz*0.5) {
1045 //if (TMath::Abs(posLocal[1])<=khsensmy*0.5) {
1047 step[0] =-0.5*kNpadX*fgkXPad;
1049 step[2] =-0.5*kNpadZ*fgkZPad;
1050 Translation(posLocal,step);
1052 iPadZ = (Int_t)(posLocal[2]/fgkZPad);
1053 if (iPadZ==kNpadZ) iPadZ--;
1054 else if (iPadZ>kNpadZ) iPadZ=-1;
1057 // else AliError("Detector Index could not be determined");
1062 //_____________________________________________________________________________
1063 Int_t AliTOFGeometryV5::GetPadX(Float_t *pos) const
1066 // Returns the Pad index along X
1068 //const Float_t klsensmx = kNpadX*fgkXPad; // length of Sensitive Layer
1069 //const Float_t khsensmy = 0.05;//0.11;//0.16;// heigth of Sensitive Layer
1070 //const Float_t kwsensmz = kNpadZ*fgkZPad; // width of Sensitive Layer
1074 Float_t posLocal[3];
1075 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
1077 Int_t isector = GetSector(posLocal);
1079 //AliError("Detector Index could not be determined");
1081 Int_t iplate = GetPlate(posLocal);
1083 //AliError("Detector Index could not be determined");
1085 Int_t istrip = GetStrip(posLocal);
1087 //AliError("Detector Index could not be determined");
1090 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1091 Double_t angles[6] =
1092 {90., 90.+(isector+0.5)*fPhiSec,
1094 90., (isector+0.5)*fPhiSec
1096 Rotation(posLocal,angles);
1098 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1099 Translation(posLocal,step);
1101 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
1109 Rotation(posLocal,angles);
1111 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1113 step[1] = GetHeights(iplate,istrip);
1114 step[2] = -GetDistances(iplate,istrip);
1115 Translation(posLocal,step);
1117 if (GetAngles(iplate,istrip) >0.) {
1120 angles[2] = 90.+GetAngles(iplate,istrip);
1122 angles[4] = GetAngles(iplate,istrip);
1125 else if (GetAngles(iplate,istrip)==0.) {
1133 else if (GetAngles(iplate,istrip) <0.) {
1136 angles[2] = 90.+GetAngles(iplate,istrip);
1138 angles[4] =-GetAngles(iplate,istrip);
1141 Rotation(posLocal,angles);
1143 //if (TMath::Abs(posLocal[0])<=klsensmx*0.5 && /*TMath::Abs(posLocal[1])<=khsensmy*0.5+0.005 &&*/ TMath::Abs(posLocal[2])<=kwsensmz*0.5) {
1144 //if (TMath::Abs(posLocal[1])<=khsensmy*0.5) {
1146 step[0] =-0.5*kNpadX*fgkXPad;
1148 step[2] =-0.5*kNpadZ*fgkZPad;
1149 Translation(posLocal,step);
1151 iPadX = (Int_t)(posLocal[0]/fgkXPad);
1152 if (iPadX==kNpadX) iPadX--;
1153 else if (iPadX>kNpadX) iPadX=-1;
1156 //else AliError("Detector Index could not be determined");
1161 //_____________________________________________________________________________
1163 Float_t AliTOFGeometryV5::GetPadDx(Float_t *pos)
1166 // Returns the x coordinate in the Pad reference frame
1171 Float_t posLocal[3];
1172 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
1174 Int_t isector = GetSector(posLocal);
1176 //AliError("Detector Index could not be determined");
1178 Int_t iplate = GetPlate(posLocal);
1180 //AliError("Detector Index could not be determined");
1182 Int_t istrip = GetStrip(posLocal);
1184 //AliError("Detector Index could not be determined");
1186 Int_t ipadz = GetPadZ(posLocal);
1188 //AliError("Detector Index could not be determined");
1190 Int_t ipadx = GetPadX(posLocal);
1192 //AliError("Detector Index could not be determined");
1195 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1196 Double_t angles[6] =
1197 {90., 90.+(isector+0.5)*fPhiSec,
1199 90., (isector+0.5)*fPhiSec
1201 Rotation(posLocal,angles);
1203 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1204 Translation(posLocal,step);
1206 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
1214 Rotation(posLocal,angles);
1216 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1218 step[1] = GetHeights(iplate,istrip);
1219 step[2] = -GetDistances(iplate,istrip);
1220 Translation(posLocal,step);
1222 if (GetAngles(iplate,istrip) >0.) {
1225 angles[2] = 90.+GetAngles(iplate,istrip);
1227 angles[4] = GetAngles(iplate,istrip);
1230 else if (GetAngles(iplate,istrip)==0.) {
1238 else if (GetAngles(iplate,istrip) <0.) {
1241 angles[2] = 90.+GetAngles(iplate,istrip);
1243 angles[4] =-GetAngles(iplate,istrip);
1246 Rotation(posLocal,angles);
1248 step[0] =-0.5*kNpadX*fgkXPad;
1250 step[2] =-0.5*kNpadZ*fgkZPad;
1251 Translation(posLocal,step);
1253 step[0] = (ipadx+0.5)*fgkXPad;
1255 step[2] = (ipadz+0.5)*fgkZPad;
1256 Translation(posLocal,step);
1263 //_____________________________________________________________________________
1264 Float_t AliTOFGeometryV5::GetPadDy(Float_t *pos)
1267 // Returns the y coordinate in the Pad reference frame
1272 Float_t posLocal[3];
1273 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
1275 Int_t isector = GetSector(posLocal);
1277 //AliError("Detector Index could not be determined");
1279 Int_t iplate = GetPlate(posLocal);
1281 //AliError("Detector Index could not be determined");
1283 Int_t istrip = GetStrip(posLocal);
1285 //AliError("Detector Index could not be determined");
1287 Int_t ipadz = GetPadZ(posLocal);
1289 //AliError("Detector Index could not be determined");
1291 Int_t ipadx = GetPadX(posLocal);
1293 //AliError("Detector Index could not be determined");
1296 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1297 Double_t angles[6] =
1298 {90., 90.+(isector+0.5)*fPhiSec,
1300 90., (isector+0.5)*fPhiSec
1302 Rotation(posLocal,angles);
1304 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1305 Translation(posLocal,step);
1307 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
1315 Rotation(posLocal,angles);
1317 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1319 step[1] = GetHeights(iplate,istrip);
1320 step[2] = -GetDistances(iplate,istrip);
1321 Translation(posLocal,step);
1323 if (GetAngles(iplate,istrip) >0.) {
1326 angles[2] = 90.+GetAngles(iplate,istrip);
1328 angles[4] = GetAngles(iplate,istrip);
1331 else if (GetAngles(iplate,istrip)==0.) {
1339 else if (GetAngles(iplate,istrip) <0.) {
1342 angles[2] = 90.+GetAngles(iplate,istrip);
1344 angles[4] =-GetAngles(iplate,istrip);
1347 Rotation(posLocal,angles);
1349 step[0] =-0.5*kNpadX*fgkXPad;
1351 step[2] =-0.5*kNpadZ*fgkZPad;
1352 Translation(posLocal,step);
1354 step[0] = (ipadx+0.5)*fgkXPad;
1356 step[2] = (ipadz+0.5)*fgkZPad;
1357 Translation(posLocal,step);
1364 //_____________________________________________________________________________
1365 Float_t AliTOFGeometryV5::GetPadDz(Float_t *pos)
1368 // Returns the z coordinate in the Pad reference frame
1373 Float_t posLocal[3];
1374 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
1376 Int_t isector = GetSector(posLocal);
1378 //AliError("Detector Index could not be determined");
1380 Int_t iplate = GetPlate(posLocal);
1382 //AliError("Detector Index could not be determined");
1384 Int_t istrip = GetStrip(posLocal);
1386 //AliError("Detector Index could not be determined");
1388 Int_t ipadz = GetPadZ(posLocal);
1390 //AliError("Detector Index could not be determined");
1392 Int_t ipadx = GetPadX(posLocal);
1394 //AliError("Detector Index could not be determined");
1397 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1398 Double_t angles[6] =
1399 {90., 90.+(isector+0.5)*fPhiSec,
1401 90., (isector+0.5)*fPhiSec
1403 Rotation(posLocal,angles);
1405 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1406 Translation(posLocal,step);
1408 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
1416 Rotation(posLocal,angles);
1418 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1420 step[1] = GetHeights(iplate,istrip);
1421 step[2] = -GetDistances(iplate,istrip);
1422 Translation(posLocal,step);
1424 if (GetAngles(iplate,istrip) >0.) {
1427 angles[2] = 90.+GetAngles(iplate,istrip);
1429 angles[4] = GetAngles(iplate,istrip);
1432 else if (GetAngles(iplate,istrip)==0.) {
1440 else if (GetAngles(iplate,istrip) <0.) {
1443 angles[2] = 90.+GetAngles(iplate,istrip);
1445 angles[4] =-GetAngles(iplate,istrip);
1448 Rotation(posLocal,angles);
1450 step[0] =-0.5*kNpadX*fgkXPad;
1452 step[2] =-0.5*kNpadZ*fgkZPad;
1453 Translation(posLocal,step);
1455 step[0] = (ipadx+0.5)*fgkXPad;
1457 step[2] = (ipadz+0.5)*fgkZPad;
1458 Translation(posLocal,step);
1465 //_____________________________________________________________________________
1467 void AliTOFGeometryV5::Translation(Float_t *xyz, Float_t translationVector[3]) const
1470 // Return the vector xyz translated by translationVector vector
1475 for (ii=0; ii<3; ii++)
1476 xyz[ii] -= translationVector[ii];
1481 //_____________________________________________________________________________
1483 void AliTOFGeometryV5::Rotation(Float_t *xyz, Double_t rotationAngles[6]) const
1486 // Return the vector xyz rotated according to the rotationAngles angles
1491 TRotMatrix *matrix = new TRotMatrix("matrix","matrix", angles[0], angles[1],
1492 angles[2], angles[3],
1493 angles[4], angles[5]);
1496 for (ii=0; ii<6; ii++) rotationAngles[ii]*=kDegrad;
1498 Float_t xyzDummy[3] = {0., 0., 0.};
1500 for (ii=0; ii<3; ii++) {
1502 xyz[0]*TMath::Sin(rotationAngles[2*ii])*TMath::Cos(rotationAngles[2*ii+1]) +
1503 xyz[1]*TMath::Sin(rotationAngles[2*ii])*TMath::Sin(rotationAngles[2*ii+1]) +
1504 xyz[2]*TMath::Cos(rotationAngles[2*ii]);
1507 for (ii=0; ii<3; ii++) xyz[ii]=xyzDummy[ii];
1512 //_____________________________________________________________________________
1513 void AliTOFGeometryV5::InverseRotation(Float_t *xyz, Double_t rotationAngles[6]) const
1521 for (ii=0; ii<6; ii++) rotationAngles[ii]*=kDegrad;
1523 Float_t xyzDummy[3] = {0., 0., 0.};
1526 xyz[0]*TMath::Sin(rotationAngles[0])*TMath::Cos(rotationAngles[1]) +
1527 xyz[1]*TMath::Sin(rotationAngles[2])*TMath::Cos(rotationAngles[3]) +
1528 xyz[2]*TMath::Sin(rotationAngles[4])*TMath::Cos(rotationAngles[5]);
1531 xyz[0]*TMath::Sin(rotationAngles[0])*TMath::Sin(rotationAngles[1]) +
1532 xyz[1]*TMath::Sin(rotationAngles[2])*TMath::Sin(rotationAngles[3]) +
1533 xyz[2]*TMath::Sin(rotationAngles[4])*TMath::Sin(rotationAngles[5]);
1536 xyz[0]*TMath::Cos(rotationAngles[0]) +
1537 xyz[1]*TMath::Cos(rotationAngles[2]) +
1538 xyz[2]*TMath::Cos(rotationAngles[4]);
1540 for (ii=0; ii<3; ii++) xyz[ii]=xyzDummy[ii];
1545 //_____________________________________________________________________________
1546 void AliTOFGeometryV5::GetVolumePath(Int_t *ind, Char_t *path ) {
1547 //--------------------------------------------------------------------
1548 // This function returns the colume path of a given pad
1549 //--------------------------------------------------------------------
1550 Int_t sector = ind[0];
1551 Char_t string1[100];
1552 Char_t string2[100];
1553 Char_t string3[100];
1557 // Old 6h convention
1560 // else{ icopy=sector-13;}
1561 sprintf(string1,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1/FTOA_0/FLTA_0",icopy,icopy);
1563 Int_t iplate=ind[1];
1564 Int_t istrip=ind[2];
1565 if( iplate==0) icopy=istrip;
1566 if( iplate==1) icopy=istrip+NStripC();
1567 if( iplate==2) icopy=istrip+NStripC()+NStripB();
1568 if( iplate==3) icopy=istrip+NStripC()+NStripB()+NStripA();
1569 if( iplate==4) icopy=istrip+NStripC()+2*NStripB()+NStripA();
1571 sprintf(string2,"FSTR_%i",icopy);
1572 if(fHoles && (sector==11 || sector==12)){
1573 if(iplate<2) sprintf(string2,"FTOB_0/FLTB_0/FSTR_%i",icopy);
1574 if(iplate>2) sprintf(string2,"FTOC_0/FLTC_0/FSTR_%i",icopy);
1578 Int_t padz = ind[3]+1;
1579 Int_t padx = ind[4]+1;
1580 sprintf(string3,"FPCB_1/FSEN_1/FSEZ_%i/FPAD_%i",padz,padx);
1581 sprintf(path,"%s/%s/%s",string1,string2,string3);
1584 //_____________________________________________________________________________
1585 void AliTOFGeometryV5::GetVolumePath(Int_t sector, Char_t *path ){
1586 //--------------------------------------------------------------------
1587 // This function returns the colume path of a given sector
1588 //--------------------------------------------------------------------
1592 Int_t icopy = sector;
1593 // Old 6h convention
1596 // else{ icopy=sector-13;}
1598 sprintf(string,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1",icopy,icopy);
1599 sprintf(path,"%s",string);
1602 //_____________________________________________________________________________
1603 void AliTOFGeometryV5::GetVolumePath(Int_t sector, Int_t plate, Int_t strip, Char_t *path ) {
1604 //--------------------------------------------------------------------
1605 // This function returns the colume path of a given strip
1606 //--------------------------------------------------------------------
1608 Char_t string1[100];
1609 Char_t string2[100];
1610 Char_t string3[100];
1612 Int_t icopy = sector;
1613 // Old 6h convention
1616 // else{ icopy=sector-13;}
1617 sprintf(string1,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1/FTOA_0/FLTA_0",icopy,icopy);
1619 if(plate==0) icopy=strip;
1620 if(plate==1) icopy=strip+NStripC();
1621 if(plate==2) icopy=strip+NStripC()+NStripB();
1622 if(plate==3) icopy=strip+NStripC()+NStripB()+NStripA();
1623 if(plate==4) icopy=strip+NStripC()+2*NStripB()+NStripA();
1625 sprintf(string2,"FSTR_%i",icopy);
1626 if(fHoles && (sector==11 || sector==12)) {
1627 if(plate<2) sprintf(string2,"FTOB_0/FLTB_0/FSTR_%i",icopy);
1628 if(plate>2) sprintf(string2,"FTOC_0/FLTC_0/FSTR_%i",icopy);
1631 sprintf(string3,"FPCB_1/FSEN_1");
1632 sprintf(path,"%s/%s/%s",string1,string2,string3);
1635 //_____________________________________________________________________________
1636 void AliTOFGeometryV5::GetPos(Int_t *det, Float_t *pos)
1639 // Returns space point coor (x,y,z) (cm) for Detector
1640 // Indices (iSect,iPlate,iStrip,iPadX,iPadZ)
1643 GetVolumePath(det,path );
1645 printf("ERROR: no TGeo\n");
1647 gGeoManager->cd(path);
1649 global = *gGeoManager->GetCurrentMatrix();
1650 const Double_t *tr = global.GetTranslation();
1656 //_____________________________________________________________________________
1658 void AliTOFGeometryV5::DetToSectorRF(Int_t vol[5], Double_t **coord)
1661 // Returns the local coordinates (x, y, z) in sector reference frame
1662 // for the 4 corners of each sector pad (vol[1], vol[2], vol[3], vol[4])
1665 if (!gGeoManager) printf("ERROR: no TGeo\n");
1667 // ALICE -> TOF Sector
1668 Char_t path1[100]="";
1669 GetVolumePath(vol[0],path1);
1670 gGeoManager->cd(path1);
1671 TGeoHMatrix aliceToSector;
1672 aliceToSector = *gGeoManager->GetCurrentMatrix();
1674 // TOF Sector -> ALICE
1675 //TGeoHMatrix sectorToALICE = aliceToSector.Inverse();
1678 Char_t path2[100]="";
1679 GetVolumePath(vol,path2);
1680 gGeoManager->cd(path2);
1681 TGeoHMatrix aliceToPad;
1682 aliceToPad = *gGeoManager->GetCurrentMatrix();
1685 TGeoHMatrix padToALICE = aliceToPad.Inverse();
1687 // TOF Pad -> TOF Sector
1688 TGeoHMatrix padToSector = padToALICE*aliceToSector;
1690 // TOF Sector -> TOF Pad
1691 //TGeoHMatrix sectorToPad = sectorToALICE*aliceToPad;
1693 // coordinates of the pad bottom corner
1694 Double_t **cornerPad = new Double_t*[4];
1695 for (Int_t ii=0; ii<4; ii++) cornerPad[ii] = new Double_t[3];
1697 cornerPad[0][0] = -fgkXPad/2.;
1698 cornerPad[0][1] = 0.;
1699 cornerPad[0][2] = -fgkZPad/2.;
1701 cornerPad[1][0] = fgkXPad/2.;
1702 cornerPad[1][1] = 0.;
1703 cornerPad[1][2] = -fgkZPad/2.;
1705 cornerPad[2][0] = fgkXPad/2.;
1706 cornerPad[2][1] = 0.;
1707 cornerPad[2][2] = fgkZPad/2.;
1709 cornerPad[3][0] = -fgkXPad/2.;
1710 cornerPad[3][1] = 0.;
1711 cornerPad[3][2] = fgkZPad/2.;
1713 for(Int_t aa=0; aa<4; aa++) for(Int_t bb=0; bb<3; bb++) coord[aa][bb]=0.;
1715 for (Int_t jj=0; jj<4; jj++) padToSector.MasterToLocal(&cornerPad[jj][0], &coord[jj][0]);
1719 //sectorToPad.LocalToMaster(cornerPad, coord);