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.9 2007/04/27 17:41:01 arcelli
19 merge DistanceToPad and IsInsideThePad methods
21 Revision 1.8 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
26 DetToSectorRF(...) to get pad corners
27 coordinates in its sector reference frame;
28 GetVolumePath(Int_t sector, Char_t *path)
29 to get the volume path for a sector
30 GetVolumePath(Int_t sector, Int_t plate, Int_t strip, Char_t *path)
31 to get the volume path for a strip
32 (A.De Caro, M.Di Stefano)
33 Revision 1.7 2006/07/12 16:03:59 arcelli
34 updates to match the new numbering of the TOF/TRD mother volumes in FRAME (ALICE convention)
36 Revision 1.6 2006/05/04 19:41:42 hristov
37 Possibility for partial TOF geometry (S.Arcelli)
39 Revision 1.5 2006/04/20 22:30:50 hristov
40 Coding conventions (Annalisa)
42 Revision 1.4 2006/04/16 22:29:05 hristov
43 Coding conventions (Annalisa)
45 Revision 1.3 2006/03/12 14:38:05 arcelli
46 Changes for TOF Reconstruction using TGeo
48 Revision 1.2 2006/02/28 10:38:00 decaro
49 AliTOFGeometry::fAngles, AliTOFGeometry::fHeights, AliTOFGeometry::fDistances arrays: dimension definition in the right location
51 Revision 1.1 2005/12/15 08:55:33 decaro
52 New TOF geometry description (V5) -G. Cara Romeo and A. De Caro
54 Revision 0.1 2005/07/19 G. Cara Romeo and A. De Caro
55 Modify Global methods IsInsideThePad & DistanceToPad
56 according to the new TOF geometry
57 Implement Global methods GetPadDx & GetPadDy & GetPadDz
58 Implement Private methods Translation & Rotation & InverseRotation
59 Modify Global methods GetDetID & GetPlate & GetSector &
60 GetStrip & GetPadX & GetPadZ
61 according to the new TOF geometry
62 Modify Global methods GetPos & GetX & GetY & GetZ
63 according to the new TOF geometry
66 ///////////////////////////////////////////////////////////////////////////////
68 // TOF Geometry class (new version) //
70 ///////////////////////////////////////////////////////////////////////////////
72 #include "TGeoManager.h"
77 #include "AliTOFGeometryV5.h"
79 extern TGeoManager *gGeoManager;
81 ClassImp(AliTOFGeometryV5)
84 const Float_t AliTOFGeometryV5::fgkZlenA = 370.6*2.; // length (cm) of the A module
85 const Float_t AliTOFGeometryV5::fgkZlenB = 146.5; // length (cm) of the B module
86 const Float_t AliTOFGeometryV5::fgkZlenC = 170.45; // length (cm) of the C module
87 const Float_t AliTOFGeometryV5::fgkMaxhZtof = 370.6; // Max half z-size of TOF (cm)
89 const Float_t AliTOFGeometryV5::fgkxTOF = 371.-0.01;// Inner radius of the TOF for Reconstruction (cm)
90 const Float_t AliTOFGeometryV5::fgkRmin = 370.-0.01;// Inner radius of the TOF (cm)
91 const Float_t AliTOFGeometryV5::fgkRmax = 399.-0.01;// Outer radius of the TOF (cm)
93 //_____________________________________________________________________________
94 AliTOFGeometryV5::AliTOFGeometryV5()
98 // AliTOFGeometryV5 default constructor
101 AliTOFGeometry::fNStripC = kNStripC; // number of strips in C type module
103 AliTOFGeometry::fZlenA = fgkZlenA; // length of the TOF supermodule (cm)
104 AliTOFGeometry::fZlenB = fgkZlenB; // length of the B module (cm)
105 AliTOFGeometry::fZlenC = fgkZlenC; // length of the C module (cm)
106 AliTOFGeometry::fMaxhZtof = fgkMaxhZtof; // Max half z-size of TOF supermodule (cm)
108 AliTOFGeometry::fxTOF = fgkxTOF; // Inner radius of the TOF for Reconstruction (cm)
109 AliTOFGeometry::fRmin = fgkRmin; // Inner radius of the TOF (cm)
110 AliTOFGeometry::fRmax = fgkRmax; // Outer radius of the TOF (cm)
116 //_____________________________________________________________________________
117 AliTOFGeometryV5::~AliTOFGeometryV5()
120 // AliTOFGeometryV5 destructor
124 //_____________________________________________________________________________
125 void AliTOFGeometryV5::ImportGeometry(){
126 TGeoManager::Import("geometry.root");
128 //_____________________________________________________________________________
129 void AliTOFGeometryV5::Init()
132 // Initialize strip Tilt Angles, Heights and Distances
134 // Strips Tilt Angles
136 // For each strip to be positoned in FLTA/FLTB/FLTC,
137 // define 3 arrays containing:
138 // the angle of the normal with respect to the Y axis of FLTA/FLTB/FLTC
139 // the Y of the center with respect to the FLTA/FLTB/FLTC reference frame
140 // the Z of the center with respect to the BT01/BT02/BT03 reference frame
143 fPhiSec = 360./kNSectors;
145 Float_t const kangles[kNPlates][kMaxNstrip] ={
146 { 43.99, 43.20, 42.40, 41.59, 40.77, 39.94, 39.11, 38.25, 37.40, 36.53,
147 35.65, 34.76, 33.87, 32.96, 32.05, 31.13, 30.19, 29.24, 12.33, 0.00},
149 { 27.26, 26.28, 25.30, 24.31, 23.31, 22.31, 21.30, 20.29, 19.26, 18.24,
150 17.20, 16.16, 15.11, 14.05, 13.00, 11.93, 10.87, 9.80, 8.74, 0.00},
152 { 0.00, 6.30, 5.31, 4.25, 3.19, 2.12, 1.06, 0.00, -1.06, -2.12,
153 -3.19, -4.25, -5.31, -6.30, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00},
155 { -8.74, -9.80, -10.87, -11.93, -13.00, -14.05, -15.11, -16.16, -17.20, -18.24,
156 -19.26, -20.29, -21.30, -22.31, -23.31, -24.31, -25.30, -26.28, -27.26, 0.00},
158 {-12.33, -29.24, -30.19, -31.13, -32.05, -32.96, -33.87, -34.76, -35.65, -36.53,
159 -37.40, -38.25, -39.11, -39.94, -40.77, -41.59, -42.40, -43.20, -43.99, 0.00}
162 Float_t const kheights[kNPlates][kMaxNstrip]= {
163 {-8.2, -7.5, -8.2, -7.7, -8.1, -7.6, -7.7, -7.7, -7.7, -7.7,
164 -7.5, -7.2, -7.3, -7.5, -7.6, -7.8, -8.3, -9.3, -3.1, 0.0},
166 {-7.9, -8.1, -8.5, -9.0, -10.1, -3.9, -5.9, -7.7, -10.1, -3.6,
167 -5.8, -8.0, -10.4, -4.4, -7.2, -10.2, -4.6, -7.4, -10.4, 0.0},
169 {-2.5, -10.4, -5.0, -9.9, -4.8, -9.9, -4.7, -10.2, -4.7, -9.9,
170 -4.8, -9.9, -5.0, -10.4, -2.5, 0.0, 0.0, 0.0, 0.0, 0.0},
172 {-10.4, -7.4, -4.6, -10.2, -7.2, -4.4, -10.4, -8.0, -5.8, -3.6,
173 -10.1, -7.7, -5.9, -3.9, -10.1, -9.0, -8.5, -8.1, -7.9, 0.0},
175 { -3.1, -9.3, -8.3, -7.8, -7.6, -7.5, -7.3, -7.2, -7.5, -7.7,
176 -7.7, -7.7, -7.7, -7.6, -8.1, -7.7, -8.2, -7.5, -8.2, 0.0}
180 Float_t const kdistances[kNPlates][kMaxNstrip]= {
181 { 364.1, 354.9, 344.5, 335.4, 325.5, 316.6, 307.2, 298.0, 288.9, 280.0,
182 271.3, 262.7, 254.0, 244.8, 236.1, 227.7, 219.1, 210.3, 205.7, 0.0},
184 { 194.2, 186.1, 177.9, 169.8, 161.5, 156.3, 147.8, 139.4, 130.9, 125.6,
185 117.3, 109.2, 101.1, 95.3, 87.1, 79.2, 73.0, 65.1, 57.6, 0.0},
187 { 49.5, 41.3, 35.3, 27.8, 21.2, 13.9, 7.0, 0.0, -7.0, -13.9,
188 -21.2, -27.8, -35.3, -41.3, -49.5, 0.0, 0.0, 0.0, 0.0, 0.0},
190 { -57.6, -65.1, -73.0, -79.2, -87.1, -95.3, -101.1, -109.2, -117.3, -125.6,
191 -130.9, -139.4, -147.8, -156.3, -161.5, -169.8, -177.9, -186.1, -194.2, 0.0},
193 {-205.7, -210.3, -219.1, -227.7, -236.1, -244.8, -254.0, -262.7, -271.3, -280.0,
194 -288.9, -298.0, -307.2, -316.6, -325.5, -335.4, -344.5, -354.9, -364.1, 0.0}
198 for (Int_t iplate = 0; iplate < kNPlates; iplate++) {
199 for (Int_t istrip = 0; istrip < kMaxNstrip; istrip++) {
200 AliTOFGeometry::fAngles[iplate][istrip] = kangles[iplate][istrip];
201 AliTOFGeometry::fHeights[iplate][istrip] = kheights[iplate][istrip];
202 AliTOFGeometry::fDistances[iplate][istrip]= kdistances[iplate][istrip];
208 //_____________________________________________________________________________
209 Float_t AliTOFGeometryV5::DistanceToPadPar(Int_t *det, Float_t *pos, Float_t *dist3d) const
212 // Returns distance of space point with coor pos (x,y,z) (cm) wrt
213 // pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ)
216 //Transform pos into Sector Frame
222 Float_t radius = TMath::Sqrt(x*x+y*y);
223 //Float_t phi=TMath::ATan(y/x);
224 //if(phi<0) phi = k2PI+phi; //2.*TMath::Pi()+phi;
225 Float_t phi = TMath::Pi()+TMath::ATan2(-y,-x);
226 // Get the local angle in the sector philoc
227 Float_t angle = phi*kRaddeg-( Int_t (kRaddeg*phi/fPhiSec) + 0.5)*fPhiSec;
228 Float_t xs = radius*TMath::Cos(angle/kRaddeg);
229 Float_t ys = radius*TMath::Sin(angle/kRaddeg);
232 // Do the same for the selected pad
237 Float_t padRadius = TMath::Sqrt(g[0]*g[0]+g[1]*g[1]);
238 //Float_t padPhi = TMath::ATan(g[1]/g[0]);
239 //if(padPhi<0) padPhi = k2Pi + padPhi;
240 Float_t padPhi = TMath::Pi()+TMath::ATan2(-g[1],-g[0]);
242 // Get the local angle in the sector philoc
243 Float_t padAngle = padPhi*kRaddeg-( Int_t (padPhi*kRaddeg/fPhiSec)+ 0.5) * fPhiSec;
244 Float_t padxs = padRadius*TMath::Cos(padAngle/kRaddeg);
245 Float_t padys = padRadius*TMath::Sin(padAngle/kRaddeg);
246 Float_t padzs = g[2];
248 //Now move to local pad coordinate frame. Translate:
250 Float_t xt = xs-padxs;
251 Float_t yt = ys-padys;
252 Float_t zt = zs-padzs;
255 Float_t alpha = GetAngles(det[1],det[2]);
256 Float_t xr = xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg);
258 Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg);
260 Float_t dist = TMath::Sqrt(xr*xr+yr*yr+zr*zr);
272 //_____________________________________________________________________________
273 Bool_t AliTOFGeometryV5::IsInsideThePadPar(Int_t *det, Float_t *pos) const
276 // Returns true if space point with coor pos (x,y,z) (cm) falls
277 // inside pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ)
280 Bool_t isInside=false;
283 const Float_t khhony = 1.0 ; // heigth of HONY Layer
284 const Float_t khpcby = 0.08 ; // heigth of PCB Layer
285 const Float_t khrgly = 0.055 ; // heigth of RED GLASS Layer
286 const Float_t khglfy = 0.285 ; // heigth of GLASS+FISHLINE Layer
287 const Float_t khcpcby = 0.16 ; // heigth of PCB Central Layer
288 //const Float_t kwcpcbz = 12.4 ; // z dimension of PCB Central Layer
289 const Float_t khstripy = 2.*khhony+2.*khpcby+4.*khrgly+2.*khglfy+khcpcby;//3.11
290 //const Float_t kwstripz = kwcpcbz;
291 //const Float_t klstripx = fgkStripLength;
294 const Float_t kPadDepth = 0.5;//0.05;//0.11;//0.16;// // heigth of Sensitive Layer
296 //Transform pos into Sector Frame
302 Float_t radius = TMath::Sqrt(x*x+y*y);
303 Float_t phi = TMath::Pi()+TMath::ATan2(-y,-x);
305 // Get the local angle in the sector philoc
306 Float_t angle = phi*kRaddeg-( Int_t (kRaddeg*phi/fPhiSec) + 0.5) *fPhiSec;
307 Float_t xs = radius*TMath::Cos(angle/kRaddeg);
308 Float_t ys = radius*TMath::Sin(angle/kRaddeg);
311 // Do the same for the selected pad
316 Float_t padRadius = TMath::Sqrt(g[0]*g[0]+g[1]*g[1]);
317 Float_t padPhi = TMath::Pi()+TMath::ATan2(-g[1],-g[0]);
319 // Get the local angle in the sector philoc
320 Float_t padAngle = padPhi*kRaddeg-( Int_t (padPhi*kRaddeg/fPhiSec)+ 0.5) * fPhiSec;
321 Float_t padxs = padRadius*TMath::Cos(padAngle/kRaddeg);
322 Float_t padys = padRadius*TMath::Sin(padAngle/kRaddeg);
323 Float_t padzs = g[2];
325 //Now move to local pad coordinate frame. Translate:
327 Float_t xt = xs-padxs;
328 Float_t yt = ys-padys;
329 Float_t zt = zs-padzs;
333 Float_t alpha = GetAngles(det[1],det[2]);
334 Float_t xr = xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg);
336 Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg);
338 if(TMath::Abs(xr)<=kPadDepth*0.5 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5))
345 //_____________________________________________________________________________
346 Bool_t AliTOFGeometryV5::IsInsideThePad(TGeoHMatrix mat, Float_t *pos, Float_t *dist3d) const
349 // Returns true if space point with coor pos (x,y,z) (cm) falls
350 // inside pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ)
353 const Float_t kPadDepth = 0.5; // heigth of Sensitive Layer
358 Double_t veclr[3]={-1.,-1.,-1.};
359 Double_t vecl[3]={-1.,-1.,-1.};
360 mat.MasterToLocal(vecg,veclr);
363 //take into account reflections
366 Float_t xr = vecl[0];
367 Float_t yr = vecl[1];
368 Float_t zr = vecl[2];
376 Bool_t isInside=false;
377 if(TMath::Abs(xr)<= kPadDepth*0.5 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5))
382 //_____________________________________________________________________________
383 //_____________________________________________________________________________
384 Float_t AliTOFGeometryV5::GetX(Int_t *det) const
387 // Returns X coordinate (cm)
390 Int_t isector = det[0];
391 Int_t iplate = det[1];
392 Int_t istrip = det[2];
393 Int_t ipadz = det[3];
394 Int_t ipadx = det[4];
397 // Find out distance d on the plane wrt median phi:
398 Float_t d = (ipadx+0.5-kNpadX*0.5)*fgkXPad;
400 // The radius r in xy plane:
401 //Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
402 // (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg)-0.25; ???
403 Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
404 (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg);
406 // local azimuthal angle in the sector philoc
407 Float_t philoc = TMath::ATan(d/r);
408 //if(philoc<0.) philoc = k2PI + philoc;
410 // azimuthal angle in the global frame phi
411 Float_t phi = philoc*kRaddeg+(isector+0.5)*fPhiSec;
413 Float_t xCoor = r/TMath::Cos(philoc)*TMath::Cos(phi/kRaddeg);
416 // Pad reference frame -> FSTR reference frame
418 Float_t posLocal[3] = {0., 0., 0.};
419 Float_t step[3] = {-(ipadx+0.5)*fgkXPad, 0., -(ipadz+0.5)*fgkZPad};
420 Translation(posLocal,step);
422 step[0] = kNpadX*0.5*fgkXPad;
424 step[2] = kNpadZ*0.5*fgkZPad;
427 Float_t posLocal[3] = {(ipadx+0.5)*fgkXPad, 0., (ipadz+0.5)*fgkZPad};
428 Float_t step[3]= {kNpadX*0.5*fgkXPad, 0., kNpadZ*0.5*fgkZPad};
430 Translation(posLocal,step);
432 // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame
434 if (GetAngles(iplate,istrip) >0.) {
437 angles[2] = 90.+GetAngles(iplate,istrip);
439 angles[4] = GetAngles(iplate,istrip);
442 else if (GetAngles(iplate,istrip)==0.) {
450 else if (GetAngles(iplate,istrip) <0.) {
453 angles[2] = 90.+GetAngles(iplate,istrip);
455 angles[4] =-GetAngles(iplate,istrip);
459 InverseRotation(posLocal,angles);
462 step[1] = -GetHeights(iplate,istrip);
463 step[2] = GetDistances(iplate,istrip);
464 Translation(posLocal,step);
466 // FTOA = FLTA reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
474 InverseRotation(posLocal,angles);
476 // B071/B074/B075 = BTO1/2/3 reference frame -> ALICE reference frame
479 step[2] = -((fgkRmax+fgkRmin)*0.5);
480 Translation(posLocal,step);
483 angles[1] = 90.+(isector+0.5)*fPhiSec;
487 angles[5] = (isector+0.5)*fPhiSec;
489 InverseRotation(posLocal,angles);
491 Float_t xCoor = posLocal[0];
496 //_____________________________________________________________________________
497 Float_t AliTOFGeometryV5::GetY(Int_t *det) const
500 // Returns Y coordinate (cm)
503 Int_t isector = det[0];
504 Int_t iplate = det[1];
505 Int_t istrip = det[2];
506 Int_t ipadz = det[3];
507 Int_t ipadx = det[4];
510 // Find out distance d on the plane wrt median phi:
511 Float_t d = (ipadx+0.5-kNpadX*0.5)*fgkXPad;
513 // The radius r in xy plane:
514 //Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
515 // (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg)-0.25; ???
516 Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
517 (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg);
519 // local azimuthal angle in the sector philoc
520 Float_t philoc = TMath::ATan(d/r);
521 //if(philoc<0.) philoc = k2PI + philoc;
523 // azimuthal angle in the global frame phi
524 Float_t phi = philoc*kRaddeg+(isector+0.5)*fPhiSec;
526 Float_t yCoor = r/TMath::Cos(philoc)*TMath::Sin(phi/kRaddeg);
529 // Pad reference frame -> FSTR reference frame
531 Float_t posLocal[3] = {0., 0., 0.};
532 Float_t step[3] = {-(ipadx+0.5)*fgkXPad, 0., -(ipadz+0.5)*fgkZPad};
533 Translation(posLocal,step);
535 step[0] = kNpadX*0.5*fgkXPad;
537 step[2] = kNpadZ*0.5*fgkZPad;
540 Float_t posLocal[3] = {(ipadx+0.5)*fgkXPad, 0., (ipadz+0.5)*fgkZPad};
541 Float_t step[3]= {kNpadX*0.5*fgkXPad, 0., kNpadZ*0.5*fgkZPad};
543 Translation(posLocal,step);
545 // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame
548 if (GetAngles(iplate,istrip) >0.) {
551 angles[2] = 90.+GetAngles(iplate,istrip);
553 angles[4] = GetAngles(iplate,istrip);
556 else if (GetAngles(iplate,istrip)==0.) {
564 else if (GetAngles(iplate,istrip) <0.) {
567 angles[2] = 90.+GetAngles(iplate,istrip);
569 angles[4] =-GetAngles(iplate,istrip);
573 InverseRotation(posLocal,angles);
576 step[1] = -GetHeights(iplate,istrip);
577 step[2] = GetDistances(iplate,istrip);
578 Translation(posLocal,step);
580 // FTOA = FLTA reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
588 InverseRotation(posLocal,angles);
590 // B071/B074/B075 = BTO1/2/3 reference frame -> ALICE reference frame
593 step[2] = -((fgkRmax+fgkRmin)*0.5);
594 Translation(posLocal,step);
597 angles[1] = 90.+(isector+0.5)*fPhiSec;
601 angles[5] = (isector+0.5)*fPhiSec;
603 InverseRotation(posLocal,angles);
605 Float_t yCoor = posLocal[1];
611 //_____________________________________________________________________________
612 Float_t AliTOFGeometryV5::GetZ(Int_t *det) const
615 // Returns Z coordinate (cm)
618 Int_t isector = det[0];
619 Int_t iplate = det[1];
620 Int_t istrip = det[2];
621 Int_t ipadz = det[3];
622 Int_t ipadx = det[4];
625 Float_t zCoor = GetDistances(iplate,istrip) +
626 (0.5-ipadz) * fgkZPad * TMath::Cos(GetAngles(iplate,istrip)*kDegrad);
629 // Pad reference frame -> FSTR reference frame
631 Float_t posLocal[3] = {0., 0., 0.};
632 Float_t step[3] = {-(ipadx+0.5)*fgkXPad, 0., -(ipadz+0.5)*fgkZPad};
633 Translation(posLocal,step);
635 step[0] = kNpadX*0.5*fgkXPad;
637 step[2] = kNpadZ*0.5*fgkZPad;
640 Float_t posLocal[3] = {(ipadx+0.5)*fgkXPad, 0., (ipadz+0.5)*fgkZPad};
641 Float_t step[3]= {kNpadX*0.5*fgkXPad, 0., kNpadZ*0.5*fgkZPad};
643 Translation(posLocal,step);
645 // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame
647 if (GetAngles(iplate,istrip) >0.) {
650 angles[2] = 90.+GetAngles(iplate,istrip);
652 angles[4] = GetAngles(iplate,istrip);
655 else if (GetAngles(iplate,istrip)==0.) {
663 else if (GetAngles(iplate,istrip) <0.) {
666 angles[2] = 90.+GetAngles(iplate,istrip);
668 angles[4] =-GetAngles(iplate,istrip);
672 InverseRotation(posLocal,angles);
675 step[1] = -GetHeights(iplate,istrip);
676 step[2] = GetDistances(iplate,istrip);
677 Translation(posLocal,step);
679 // FTOA = FLTA reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
687 InverseRotation(posLocal,angles);
689 // B071/B074/B075 = BTO1/2/3 reference frame -> ALICE reference frame
692 step[2] = -((fgkRmax+fgkRmin)*0.5);
693 Translation(posLocal,step);
696 angles[1] = 90.+(isector+0.5)*fPhiSec;
700 angles[5] = (isector+0.5)*fPhiSec;
702 InverseRotation(posLocal,angles);
704 Float_t zCoor = posLocal[2];
710 //_____________________________________________________________________________
711 Int_t AliTOFGeometryV5::GetSector(Float_t *pos) const
714 // Returns the Sector index
717 //const Float_t khAlWall = 0.1;
718 //const Float_t kModuleWallThickness = 0.3;
726 Float_t rho = TMath::Sqrt(x*x + y*y);
728 //if (!((z>=-fgkMaxhZtof && z<=fgkMaxhZtof) &&
729 if (!((z>=-fgkZlenA*0.5 && z<=fgkZlenA*0.5) &&
730 (rho>=(fgkRmin) && rho<=(fgkRmax)))) {
731 //(rho>=(fgkRmin-0.05)+kModuleWallThickness && rho<=(fgkRmax-0.05)-kModuleWallThickness-khAlWall-kModuleWallThickness))) {
732 //AliError("Detector Index could not be determined");
736 Float_t phi = TMath::Pi() + TMath::ATan2(-y,-x);
738 iSect = (Int_t) (phi*kRaddeg/fPhiSec);
743 //_____________________________________________________________________________
745 Int_t AliTOFGeometryV5::GetPlate(Float_t *pos) const
748 // Returns the Plate index
750 const Float_t kInterCentrModBorder1 = 49.5;
751 const Float_t kInterCentrModBorder2 = 57.5;
752 const Float_t kExterInterModBorder1 = 196.0;
753 const Float_t kExterInterModBorder2 = 203.5;
755 const Float_t kLengthExInModBorder = 4.7;
756 const Float_t kLengthInCeModBorder = 7.0;
758 //const Float_t khAlWall = 0.1;
759 const Float_t kModuleWallThickness = 0.3;
760 //const Float_t kHoneycombLayerThickness = 1.5;
765 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
767 Int_t isector = GetSector(posLocal);
769 //AliError("Detector Index could not be determined");
773 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
775 {90., 90.+(isector+0.5)*fPhiSec,
777 90., (isector+0.5)*fPhiSec
779 Rotation(posLocal,angles);
781 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
782 Translation(posLocal,step);
784 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame
792 Rotation(posLocal,angles);
794 Float_t yLocal = posLocal[1];
795 Float_t zLocal = posLocal[2];
797 Float_t deltaRhoLoc = (fgkRmax-fgkRmin)*0.5 - kModuleWallThickness + yLocal;
798 Float_t deltaZetaLoc = TMath::Abs(zLocal);
800 Float_t deltaRHOmax = 0.;
802 if (TMath::Abs(zLocal)>=kExterInterModBorder1 && TMath::Abs(zLocal)<=kExterInterModBorder2)
804 deltaRhoLoc -= kLengthExInModBorder;
805 deltaZetaLoc = kExterInterModBorder2-deltaZetaLoc;
806 deltaRHOmax = (fgkRmax - fgkRmin)*0.5 - kModuleWallThickness - 2.*kLengthExInModBorder; // old 5.35, new 4.8
808 if (deltaRhoLoc > deltaZetaLoc*deltaRHOmax/(kInterCentrModBorder2-kInterCentrModBorder1)) {
809 if (zLocal<0) iPlate = 0;
813 if (zLocal<0) iPlate = 1;
817 else if (TMath::Abs(zLocal)>=kInterCentrModBorder1 && TMath::Abs(zLocal)<=kInterCentrModBorder2)
819 deltaRhoLoc -= kLengthInCeModBorder;
820 deltaZetaLoc = deltaZetaLoc-kInterCentrModBorder1;
821 deltaRHOmax = (fgkRmax - fgkRmin)*0.5 - kModuleWallThickness - 2.*kLengthInCeModBorder; // old 0.39, new 0.2
823 if (deltaRhoLoc>deltaZetaLoc*deltaRHOmax/(kInterCentrModBorder2-kInterCentrModBorder1)) iPlate = 2;
825 if (zLocal<0) iPlate = 1;
830 if (zLocal>-fgkZlenA*0.5/*fgkMaxhZtof*/ && zLocal<-kExterInterModBorder2) iPlate = 0;
831 else if (zLocal>-kExterInterModBorder1 && zLocal<-kInterCentrModBorder2) iPlate = 1;
832 else if (zLocal>-kInterCentrModBorder1 && zLocal< kInterCentrModBorder1) iPlate = 2;
833 else if (zLocal> kInterCentrModBorder2 && zLocal< kExterInterModBorder1) iPlate = 3;
834 else if (zLocal> kExterInterModBorder2 && zLocal< fgkZlenA*0.5/*fgkMaxhZtof*/) iPlate = 4;
840 //_____________________________________________________________________________
841 Int_t AliTOFGeometryV5::GetStrip(Float_t *pos) const
844 // Returns the Strip index
846 const Float_t khhony = 1.0 ; // heigth of HONY Layer
847 const Float_t khpcby = 0.08 ; // heigth of PCB Layer
848 const Float_t khrgly = 0.055 ; // heigth of RED GLASS Layer
849 const Float_t khglfy = 0.285 ; // heigth of GLASS+FISHLINE Layer
850 const Float_t khcpcby = 0.16 ; // heigth of PCB Central Layer
851 const Float_t kwcpcbz = 12.4 ; // z dimension of PCB Central Layer
852 const Float_t khstripy = 2.*khhony+2.*khpcby+4.*khrgly+2.*khglfy+khcpcby;//3.11
853 const Float_t kwstripz = kwcpcbz;
854 const Float_t klstripx = fgkStripLength;
859 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
861 Int_t isector = GetSector(posLocal);
863 //AliError("Detector Index could not be determined");
865 Int_t iplate = GetPlate(posLocal);
867 //AliError("Detector Index could not be determined");
889 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
891 {90., 90.+(isector+0.5)*fPhiSec,
893 90., (isector+0.5)*fPhiSec
895 Rotation(posLocal,angles);
897 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
898 Translation(posLocal,step);
900 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame
908 Rotation(posLocal,angles);
910 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
912 for (Int_t istrip=0; istrip<nstrips; istrip++){
914 Float_t posLoc2[3]={posLocal[0],posLocal[1],posLocal[2]};
917 step[1] = GetHeights(iplate,istrip);
918 step[2] = -GetDistances(iplate,istrip);
919 Translation(posLoc2,step);
921 if (GetAngles(iplate,istrip) >0.) {
924 angles[2] = 90.+GetAngles(iplate,istrip);
926 angles[4] = GetAngles(iplate,istrip);
929 else if (GetAngles(iplate,istrip)==0.) {
937 else if (GetAngles(iplate,istrip) <0.) {
940 angles[2] = 90.+GetAngles(iplate,istrip);
942 angles[4] =-GetAngles(iplate,istrip);
945 Rotation(posLoc2,angles);
947 if ((TMath::Abs(posLoc2[0])<=klstripx*0.5) &&
948 (TMath::Abs(posLoc2[1])<=khstripy*0.5) &&
949 (TMath::Abs(posLoc2[2])<=kwstripz*0.5)) {
952 for (Int_t jj=0; jj<3; jj++) posLocal[jj]=posLoc2[jj];
953 //AliInfo(Form(" posLocal[0] = %f, posLocal[1] = %f, posLocal[2] = %f ", posLocal[0],posLocal[1],posLocal[2]));
955 //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]));
959 if (totStrip>1) AliInfo(Form("total strip number found %2i",totStrip));
966 //_____________________________________________________________________________
967 Int_t AliTOFGeometryV5::GetPadZ(Float_t *pos) const
970 // Returns the Pad index along Z
972 //const Float_t klsensmx = kNpadX*fgkXPad; // length of Sensitive Layer
973 //const Float_t khsensmy = 0.05;//0.11;//0.16;// heigth of Sensitive Layer
974 //const Float_t kwsensmz = kNpadZ*fgkZPad; // width of Sensitive Layer
979 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
981 Int_t isector = GetSector(posLocal);
983 //AliError("Detector Index could not be determined");
985 Int_t iplate = GetPlate(posLocal);
987 //AliError("Detector Index could not be determined");
989 Int_t istrip = GetStrip(posLocal);
991 //AliError("Detector Index could not be determined");
994 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
996 {90., 90.+(isector+0.5)*fPhiSec,
998 90., (isector+0.5)*fPhiSec
1000 Rotation(posLocal,angles);
1002 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1003 Translation(posLocal,step);
1005 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame
1013 Rotation(posLocal,angles);
1015 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1017 step[1] = GetHeights(iplate,istrip);
1018 step[2] = -GetDistances(iplate,istrip);
1019 Translation(posLocal,step);
1021 if (GetAngles(iplate,istrip) >0.) {
1024 angles[2] = 90.+GetAngles(iplate,istrip);
1026 angles[4] = GetAngles(iplate,istrip);
1029 else if (GetAngles(iplate,istrip)==0.) {
1037 else if (GetAngles(iplate,istrip) <0.) {
1040 angles[2] = 90.+GetAngles(iplate,istrip);
1042 angles[4] =-GetAngles(iplate,istrip);
1045 Rotation(posLocal,angles);
1047 //if (TMath::Abs(posLocal[0])<=klsensmx*0.5 && /*TMath::Abs(posLocal[1])<=khsensmy*0.5+0.005 &&*/ TMath::Abs(posLocal[2])<=kwsensmz*0.5) {
1048 //if (TMath::Abs(posLocal[1])<=khsensmy*0.5) {
1050 step[0] =-0.5*kNpadX*fgkXPad;
1052 step[2] =-0.5*kNpadZ*fgkZPad;
1053 Translation(posLocal,step);
1055 iPadZ = (Int_t)(posLocal[2]/fgkZPad);
1056 if (iPadZ==kNpadZ) iPadZ--;
1057 else if (iPadZ>kNpadZ) iPadZ=-1;
1060 // else AliError("Detector Index could not be determined");
1065 //_____________________________________________________________________________
1066 Int_t AliTOFGeometryV5::GetPadX(Float_t *pos) const
1069 // Returns the Pad index along X
1071 //const Float_t klsensmx = kNpadX*fgkXPad; // length of Sensitive Layer
1072 //const Float_t khsensmy = 0.05;//0.11;//0.16;// heigth of Sensitive Layer
1073 //const Float_t kwsensmz = kNpadZ*fgkZPad; // width of Sensitive Layer
1077 Float_t posLocal[3];
1078 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
1080 Int_t isector = GetSector(posLocal);
1082 //AliError("Detector Index could not be determined");
1084 Int_t iplate = GetPlate(posLocal);
1086 //AliError("Detector Index could not be determined");
1088 Int_t istrip = GetStrip(posLocal);
1090 //AliError("Detector Index could not be determined");
1093 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1094 Double_t angles[6] =
1095 {90., 90.+(isector+0.5)*fPhiSec,
1097 90., (isector+0.5)*fPhiSec
1099 Rotation(posLocal,angles);
1101 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1102 Translation(posLocal,step);
1104 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
1112 Rotation(posLocal,angles);
1114 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1116 step[1] = GetHeights(iplate,istrip);
1117 step[2] = -GetDistances(iplate,istrip);
1118 Translation(posLocal,step);
1120 if (GetAngles(iplate,istrip) >0.) {
1123 angles[2] = 90.+GetAngles(iplate,istrip);
1125 angles[4] = GetAngles(iplate,istrip);
1128 else if (GetAngles(iplate,istrip)==0.) {
1136 else if (GetAngles(iplate,istrip) <0.) {
1139 angles[2] = 90.+GetAngles(iplate,istrip);
1141 angles[4] =-GetAngles(iplate,istrip);
1144 Rotation(posLocal,angles);
1146 //if (TMath::Abs(posLocal[0])<=klsensmx*0.5 && /*TMath::Abs(posLocal[1])<=khsensmy*0.5+0.005 &&*/ TMath::Abs(posLocal[2])<=kwsensmz*0.5) {
1147 //if (TMath::Abs(posLocal[1])<=khsensmy*0.5) {
1149 step[0] =-0.5*kNpadX*fgkXPad;
1151 step[2] =-0.5*kNpadZ*fgkZPad;
1152 Translation(posLocal,step);
1154 iPadX = (Int_t)(posLocal[0]/fgkXPad);
1155 if (iPadX==kNpadX) iPadX--;
1156 else if (iPadX>kNpadX) iPadX=-1;
1159 //else AliError("Detector Index could not be determined");
1164 //_____________________________________________________________________________
1166 Float_t AliTOFGeometryV5::GetPadDx(Float_t *pos)
1169 // Returns the x coordinate in the Pad reference frame
1174 Float_t posLocal[3];
1175 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
1177 Int_t isector = GetSector(posLocal);
1179 //AliError("Detector Index could not be determined");
1181 Int_t iplate = GetPlate(posLocal);
1183 //AliError("Detector Index could not be determined");
1185 Int_t istrip = GetStrip(posLocal);
1187 //AliError("Detector Index could not be determined");
1189 Int_t ipadz = GetPadZ(posLocal);
1191 //AliError("Detector Index could not be determined");
1193 Int_t ipadx = GetPadX(posLocal);
1195 //AliError("Detector Index could not be determined");
1198 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1199 Double_t angles[6] =
1200 {90., 90.+(isector+0.5)*fPhiSec,
1202 90., (isector+0.5)*fPhiSec
1204 Rotation(posLocal,angles);
1206 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1207 Translation(posLocal,step);
1209 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
1217 Rotation(posLocal,angles);
1219 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1221 step[1] = GetHeights(iplate,istrip);
1222 step[2] = -GetDistances(iplate,istrip);
1223 Translation(posLocal,step);
1225 if (GetAngles(iplate,istrip) >0.) {
1228 angles[2] = 90.+GetAngles(iplate,istrip);
1230 angles[4] = GetAngles(iplate,istrip);
1233 else if (GetAngles(iplate,istrip)==0.) {
1241 else if (GetAngles(iplate,istrip) <0.) {
1244 angles[2] = 90.+GetAngles(iplate,istrip);
1246 angles[4] =-GetAngles(iplate,istrip);
1249 Rotation(posLocal,angles);
1251 step[0] =-0.5*kNpadX*fgkXPad;
1253 step[2] =-0.5*kNpadZ*fgkZPad;
1254 Translation(posLocal,step);
1256 step[0] = (ipadx+0.5)*fgkXPad;
1258 step[2] = (ipadz+0.5)*fgkZPad;
1259 Translation(posLocal,step);
1266 //_____________________________________________________________________________
1267 Float_t AliTOFGeometryV5::GetPadDy(Float_t *pos)
1270 // Returns the y coordinate in the Pad reference frame
1275 Float_t posLocal[3];
1276 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
1278 Int_t isector = GetSector(posLocal);
1280 //AliError("Detector Index could not be determined");
1282 Int_t iplate = GetPlate(posLocal);
1284 //AliError("Detector Index could not be determined");
1286 Int_t istrip = GetStrip(posLocal);
1288 //AliError("Detector Index could not be determined");
1290 Int_t ipadz = GetPadZ(posLocal);
1292 //AliError("Detector Index could not be determined");
1294 Int_t ipadx = GetPadX(posLocal);
1296 //AliError("Detector Index could not be determined");
1299 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1300 Double_t angles[6] =
1301 {90., 90.+(isector+0.5)*fPhiSec,
1303 90., (isector+0.5)*fPhiSec
1305 Rotation(posLocal,angles);
1307 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1308 Translation(posLocal,step);
1310 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
1318 Rotation(posLocal,angles);
1320 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1322 step[1] = GetHeights(iplate,istrip);
1323 step[2] = -GetDistances(iplate,istrip);
1324 Translation(posLocal,step);
1326 if (GetAngles(iplate,istrip) >0.) {
1329 angles[2] = 90.+GetAngles(iplate,istrip);
1331 angles[4] = GetAngles(iplate,istrip);
1334 else if (GetAngles(iplate,istrip)==0.) {
1342 else if (GetAngles(iplate,istrip) <0.) {
1345 angles[2] = 90.+GetAngles(iplate,istrip);
1347 angles[4] =-GetAngles(iplate,istrip);
1350 Rotation(posLocal,angles);
1352 step[0] =-0.5*kNpadX*fgkXPad;
1354 step[2] =-0.5*kNpadZ*fgkZPad;
1355 Translation(posLocal,step);
1357 step[0] = (ipadx+0.5)*fgkXPad;
1359 step[2] = (ipadz+0.5)*fgkZPad;
1360 Translation(posLocal,step);
1367 //_____________________________________________________________________________
1368 Float_t AliTOFGeometryV5::GetPadDz(Float_t *pos)
1371 // Returns the z coordinate in the Pad reference frame
1376 Float_t posLocal[3];
1377 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
1379 Int_t isector = GetSector(posLocal);
1381 //AliError("Detector Index could not be determined");
1383 Int_t iplate = GetPlate(posLocal);
1385 //AliError("Detector Index could not be determined");
1387 Int_t istrip = GetStrip(posLocal);
1389 //AliError("Detector Index could not be determined");
1391 Int_t ipadz = GetPadZ(posLocal);
1393 //AliError("Detector Index could not be determined");
1395 Int_t ipadx = GetPadX(posLocal);
1397 //AliError("Detector Index could not be determined");
1400 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1401 Double_t angles[6] =
1402 {90., 90.+(isector+0.5)*fPhiSec,
1404 90., (isector+0.5)*fPhiSec
1406 Rotation(posLocal,angles);
1408 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1409 Translation(posLocal,step);
1411 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
1419 Rotation(posLocal,angles);
1421 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1423 step[1] = GetHeights(iplate,istrip);
1424 step[2] = -GetDistances(iplate,istrip);
1425 Translation(posLocal,step);
1427 if (GetAngles(iplate,istrip) >0.) {
1430 angles[2] = 90.+GetAngles(iplate,istrip);
1432 angles[4] = GetAngles(iplate,istrip);
1435 else if (GetAngles(iplate,istrip)==0.) {
1443 else if (GetAngles(iplate,istrip) <0.) {
1446 angles[2] = 90.+GetAngles(iplate,istrip);
1448 angles[4] =-GetAngles(iplate,istrip);
1451 Rotation(posLocal,angles);
1453 step[0] =-0.5*kNpadX*fgkXPad;
1455 step[2] =-0.5*kNpadZ*fgkZPad;
1456 Translation(posLocal,step);
1458 step[0] = (ipadx+0.5)*fgkXPad;
1460 step[2] = (ipadz+0.5)*fgkZPad;
1461 Translation(posLocal,step);
1468 //_____________________________________________________________________________
1470 void AliTOFGeometryV5::Translation(Float_t *xyz, Float_t translationVector[3]) const
1473 // Return the vector xyz translated by translationVector vector
1478 for (ii=0; ii<3; ii++)
1479 xyz[ii] -= translationVector[ii];
1484 //_____________________________________________________________________________
1486 void AliTOFGeometryV5::Rotation(Float_t *xyz, Double_t rotationAngles[6]) const
1489 // Return the vector xyz rotated according to the rotationAngles angles
1494 TRotMatrix *matrix = new TRotMatrix("matrix","matrix", angles[0], angles[1],
1495 angles[2], angles[3],
1496 angles[4], angles[5]);
1499 for (ii=0; ii<6; ii++) rotationAngles[ii]*=kDegrad;
1501 Float_t xyzDummy[3] = {0., 0., 0.};
1503 for (ii=0; ii<3; ii++) {
1505 xyz[0]*TMath::Sin(rotationAngles[2*ii])*TMath::Cos(rotationAngles[2*ii+1]) +
1506 xyz[1]*TMath::Sin(rotationAngles[2*ii])*TMath::Sin(rotationAngles[2*ii+1]) +
1507 xyz[2]*TMath::Cos(rotationAngles[2*ii]);
1510 for (ii=0; ii<3; ii++) xyz[ii]=xyzDummy[ii];
1515 //_____________________________________________________________________________
1516 void AliTOFGeometryV5::InverseRotation(Float_t *xyz, Double_t rotationAngles[6]) const
1524 for (ii=0; ii<6; ii++) rotationAngles[ii]*=kDegrad;
1526 Float_t xyzDummy[3] = {0., 0., 0.};
1529 xyz[0]*TMath::Sin(rotationAngles[0])*TMath::Cos(rotationAngles[1]) +
1530 xyz[1]*TMath::Sin(rotationAngles[2])*TMath::Cos(rotationAngles[3]) +
1531 xyz[2]*TMath::Sin(rotationAngles[4])*TMath::Cos(rotationAngles[5]);
1534 xyz[0]*TMath::Sin(rotationAngles[0])*TMath::Sin(rotationAngles[1]) +
1535 xyz[1]*TMath::Sin(rotationAngles[2])*TMath::Sin(rotationAngles[3]) +
1536 xyz[2]*TMath::Sin(rotationAngles[4])*TMath::Sin(rotationAngles[5]);
1539 xyz[0]*TMath::Cos(rotationAngles[0]) +
1540 xyz[1]*TMath::Cos(rotationAngles[2]) +
1541 xyz[2]*TMath::Cos(rotationAngles[4]);
1543 for (ii=0; ii<3; ii++) xyz[ii]=xyzDummy[ii];
1548 //_____________________________________________________________________________
1549 void AliTOFGeometryV5::GetVolumePath(Int_t *ind, Char_t *path ) {
1550 //--------------------------------------------------------------------
1551 // This function returns the colume path of a given pad
1552 //--------------------------------------------------------------------
1553 Int_t sector = ind[0];
1554 Char_t string1[100];
1555 Char_t string2[100];
1556 Char_t string3[100];
1560 // Old 6h convention
1563 // else{ icopy=sector-13;}
1564 sprintf(string1,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1/FTOA_0/FLTA_0",icopy,icopy);
1566 Int_t iplate=ind[1];
1567 Int_t istrip=ind[2];
1568 if( iplate==0) icopy=istrip;
1569 if( iplate==1) icopy=istrip+NStripC();
1570 if( iplate==2) icopy=istrip+NStripC()+NStripB();
1571 if( iplate==3) icopy=istrip+NStripC()+NStripB()+NStripA();
1572 if( iplate==4) icopy=istrip+NStripC()+2*NStripB()+NStripA();
1574 sprintf(string2,"FSTR_%i",icopy);
1575 if(fHoles && (sector==11 || sector==12)){
1576 if(iplate<2) sprintf(string2,"FTOB_0/FLTB_0/FSTR_%i",icopy);
1577 if(iplate>2) sprintf(string2,"FTOC_0/FLTC_0/FSTR_%i",icopy);
1581 Int_t padz = ind[3]+1;
1582 Int_t padx = ind[4]+1;
1583 sprintf(string3,"FPCB_1/FSEN_1/FSEZ_%i/FPAD_%i",padz,padx);
1584 sprintf(path,"%s/%s/%s",string1,string2,string3);
1587 //_____________________________________________________________________________
1588 void AliTOFGeometryV5::GetVolumePath(Int_t sector, Char_t *path ){
1589 //--------------------------------------------------------------------
1590 // This function returns the colume path of a given sector
1591 //--------------------------------------------------------------------
1595 Int_t icopy = sector;
1596 // Old 6h convention
1599 // else{ icopy=sector-13;}
1601 sprintf(string,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1",icopy,icopy);
1602 sprintf(path,"%s",string);
1605 //_____________________________________________________________________________
1606 void AliTOFGeometryV5::GetVolumePath(Int_t sector, Int_t plate, Int_t strip, Char_t *path ) {
1607 //--------------------------------------------------------------------
1608 // This function returns the colume path of a given strip
1609 //--------------------------------------------------------------------
1611 Char_t string1[100];
1612 Char_t string2[100];
1613 Char_t string3[100];
1615 Int_t icopy = sector;
1616 // Old 6h convention
1619 // else{ icopy=sector-13;}
1620 sprintf(string1,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1/FTOA_0/FLTA_0",icopy,icopy);
1622 if(plate==0) icopy=strip;
1623 if(plate==1) icopy=strip+NStripC();
1624 if(plate==2) icopy=strip+NStripC()+NStripB();
1625 if(plate==3) icopy=strip+NStripC()+NStripB()+NStripA();
1626 if(plate==4) icopy=strip+NStripC()+2*NStripB()+NStripA();
1628 sprintf(string2,"FSTR_%i",icopy);
1629 if(fHoles && (sector==11 || sector==12)) {
1630 if(plate<2) sprintf(string2,"FTOB_0/FLTB_0/FSTR_%i",icopy);
1631 if(plate>2) sprintf(string2,"FTOC_0/FLTC_0/FSTR_%i",icopy);
1634 sprintf(string3,"FPCB_1/FSEN_1");
1635 sprintf(path,"%s/%s/%s",string1,string2,string3);
1638 //_____________________________________________________________________________
1639 void AliTOFGeometryV5::GetPos(Int_t *det, Float_t *pos)
1642 // Returns space point coor (x,y,z) (cm) for Detector
1643 // Indices (iSect,iPlate,iStrip,iPadX,iPadZ)
1646 GetVolumePath(det,path );
1648 printf("ERROR: no TGeo\n");
1650 gGeoManager->cd(path);
1652 global = *gGeoManager->GetCurrentMatrix();
1653 const Double_t *tr = global.GetTranslation();
1659 //_____________________________________________________________________________
1661 void AliTOFGeometryV5::DetToSectorRF(Int_t vol[5], Double_t **coord)
1664 // Returns the local coordinates (x, y, z) in sector reference frame
1665 // for the 4 corners of each sector pad (vol[1], vol[2], vol[3], vol[4])
1668 if (!gGeoManager) printf("ERROR: no TGeo\n");
1670 // ALICE -> TOF Sector
1671 Char_t path1[100]="";
1672 GetVolumePath(vol[0],path1);
1673 gGeoManager->cd(path1);
1674 TGeoHMatrix aliceToSector;
1675 aliceToSector = *gGeoManager->GetCurrentMatrix();
1677 // TOF Sector -> ALICE
1678 //TGeoHMatrix sectorToALICE = aliceToSector.Inverse();
1681 Char_t path2[100]="";
1682 GetVolumePath(vol,path2);
1683 gGeoManager->cd(path2);
1684 TGeoHMatrix aliceToPad;
1685 aliceToPad = *gGeoManager->GetCurrentMatrix();
1688 TGeoHMatrix padToALICE = aliceToPad.Inverse();
1690 // TOF Pad -> TOF Sector
1691 TGeoHMatrix padToSector = padToALICE*aliceToSector;
1693 // TOF Sector -> TOF Pad
1694 //TGeoHMatrix sectorToPad = sectorToALICE*aliceToPad;
1696 // coordinates of the pad bottom corner
1697 Double_t **cornerPad = new Double_t*[4];
1698 for (Int_t ii=0; ii<4; ii++) cornerPad[ii] = new Double_t[3];
1700 cornerPad[0][0] = -fgkXPad/2.;
1701 cornerPad[0][1] = 0.;
1702 cornerPad[0][2] = -fgkZPad/2.;
1704 cornerPad[1][0] = fgkXPad/2.;
1705 cornerPad[1][1] = 0.;
1706 cornerPad[1][2] = -fgkZPad/2.;
1708 cornerPad[2][0] = fgkXPad/2.;
1709 cornerPad[2][1] = 0.;
1710 cornerPad[2][2] = fgkZPad/2.;
1712 cornerPad[3][0] = -fgkXPad/2.;
1713 cornerPad[3][1] = 0.;
1714 cornerPad[3][2] = fgkZPad/2.;
1716 for(Int_t aa=0; aa<4; aa++) for(Int_t bb=0; bb<3; bb++) coord[aa][bb]=0.;
1718 for (Int_t jj=0; jj<4; jj++) padToSector.MasterToLocal(&cornerPad[jj][0], &coord[jj][0]);
1722 //sectorToPad.LocalToMaster(cornerPad, coord);