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.17.1 2006/12/15
20 DetToSectorRF(...) to get pad corners
21 coordinates in its sector reference frame;
22 GetVolumePath(Int_t sector, Char_t *path)
23 to get the volume path for a sector
24 GetVolumePath(Int_t sector, Int_t plate, Int_t strip, Char_t *path)
25 to get the volume path for a strip
26 (A.De Caro, M.Di Stefano)
27 Revision 1.7 2006/07/12 16:03:59 arcelli
28 updates to match the new numbering of the TOF/TRD mother volumes in FRAME (ALICE convention)
30 Revision 1.6 2006/05/04 19:41:42 hristov
31 Possibility for partial TOF geometry (S.Arcelli)
33 Revision 1.5 2006/04/20 22:30:50 hristov
34 Coding conventions (Annalisa)
36 Revision 1.4 2006/04/16 22:29:05 hristov
37 Coding conventions (Annalisa)
39 Revision 1.3 2006/03/12 14:38:05 arcelli
40 Changes for TOF Reconstruction using TGeo
42 Revision 1.2 2006/02/28 10:38:00 decaro
43 AliTOFGeometry::fAngles, AliTOFGeometry::fHeights, AliTOFGeometry::fDistances arrays: dimension definition in the right location
45 Revision 1.1 2005/12/15 08:55:33 decaro
46 New TOF geometry description (V5) -G. Cara Romeo and A. De Caro
48 Revision 0.1 2005/07/19 G. Cara Romeo and A. De Caro
49 Modify Global methods IsInsideThePad & DistanceToPad
50 according to the new TOF geometry
51 Implement Global methods GetPadDx & GetPadDy & GetPadDz
52 Implement Private methods Translation & Rotation & InverseRotation
53 Modify Global methods GetDetID & GetPlate & GetSector &
54 GetStrip & GetPadX & GetPadZ
55 according to the new TOF geometry
56 Modify Global methods GetPos & GetX & GetY & GetZ
57 according to the new TOF geometry
60 ///////////////////////////////////////////////////////////////////////////////
62 // TOF Geometry class (new version) //
64 ///////////////////////////////////////////////////////////////////////////////
66 #include "TGeoManager.h"
71 #include "AliTOFGeometryV5.h"
73 extern TGeoManager *gGeoManager;
75 ClassImp(AliTOFGeometryV5)
78 const Float_t AliTOFGeometryV5::fgkZlenA = 370.6*2.; // length (cm) of the A module
79 const Float_t AliTOFGeometryV5::fgkZlenB = 146.5; // length (cm) of the B module
80 const Float_t AliTOFGeometryV5::fgkZlenC = 170.45; // length (cm) of the C module
81 const Float_t AliTOFGeometryV5::fgkMaxhZtof = 370.6; // Max half z-size of TOF (cm)
83 const Float_t AliTOFGeometryV5::fgkxTOF = 371.-0.01;// Inner radius of the TOF for Reconstruction (cm)
84 const Float_t AliTOFGeometryV5::fgkRmin = 370.-0.01;// Inner radius of the TOF (cm)
85 const Float_t AliTOFGeometryV5::fgkRmax = 399.-0.01;// Outer radius of the TOF (cm)
87 //_____________________________________________________________________________
88 AliTOFGeometryV5::AliTOFGeometryV5()
92 // AliTOFGeometryV5 default constructor
95 AliTOFGeometry::fNStripC = kNStripC; // number of strips in C type module
97 AliTOFGeometry::fZlenA = fgkZlenA; // length of the TOF supermodule (cm)
98 AliTOFGeometry::fZlenB = fgkZlenB; // length of the B module (cm)
99 AliTOFGeometry::fZlenC = fgkZlenC; // length of the C module (cm)
100 AliTOFGeometry::fMaxhZtof = fgkMaxhZtof; // Max half z-size of TOF supermodule (cm)
102 AliTOFGeometry::fxTOF = fgkxTOF; // Inner radius of the TOF for Reconstruction (cm)
103 AliTOFGeometry::fRmin = fgkRmin; // Inner radius of the TOF (cm)
104 AliTOFGeometry::fRmax = fgkRmax; // Outer radius of the TOF (cm)
110 //_____________________________________________________________________________
111 AliTOFGeometryV5::~AliTOFGeometryV5()
114 // AliTOFGeometryV5 destructor
118 //_____________________________________________________________________________
119 void AliTOFGeometryV5::ImportGeometry(){
120 TGeoManager::Import("geometry.root");
122 //_____________________________________________________________________________
123 void AliTOFGeometryV5::Init()
126 // Initialize strip Tilt Angles, Heights and Distances
128 // Strips Tilt Angles
130 // For each strip to be positoned in FLTA/FLTB/FLTC,
131 // define 3 arrays containing:
132 // the angle of the normal with respect to the Y axis of FLTA/FLTB/FLTC
133 // the Y of the center with respect to the FLTA/FLTB/FLTC reference frame
134 // the Z of the center with respect to the BT01/BT02/BT03 reference frame
137 fPhiSec = 360./kNSectors;
139 Float_t const kangles[kNPlates][kMaxNstrip] ={
140 { 43.99, 43.20, 42.40, 41.59, 40.77, 39.94, 39.11, 38.25, 37.40, 36.53,
141 35.65, 34.76, 33.87, 32.96, 32.05, 31.13, 30.19, 29.24, 12.33, 0.00},
143 { 27.26, 26.28, 25.30, 24.31, 23.31, 22.31, 21.30, 20.29, 19.26, 18.24,
144 17.20, 16.16, 15.11, 14.05, 13.00, 11.93, 10.87, 9.80, 8.74, 0.00},
146 { 0.00, 6.30, 5.31, 4.25, 3.19, 2.12, 1.06, 0.00, -1.06, -2.12,
147 -3.19, -4.25, -5.31, -6.30, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00},
149 { -8.74, -9.80, -10.87, -11.93, -13.00, -14.05, -15.11, -16.16, -17.20, -18.24,
150 -19.26, -20.29, -21.30, -22.31, -23.31, -24.31, -25.30, -26.28, -27.26, 0.00},
152 {-12.33, -29.24, -30.19, -31.13, -32.05, -32.96, -33.87, -34.76, -35.65, -36.53,
153 -37.40, -38.25, -39.11, -39.94, -40.77, -41.59, -42.40, -43.20, -43.99, 0.00}
156 Float_t const kheights[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 Float_t const kdistances[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}
192 for (Int_t iplate = 0; iplate < kNPlates; iplate++) {
193 for (Int_t istrip = 0; istrip < kMaxNstrip; istrip++) {
194 AliTOFGeometry::fAngles[iplate][istrip] = kangles[iplate][istrip];
195 AliTOFGeometry::fHeights[iplate][istrip] = kheights[iplate][istrip];
196 AliTOFGeometry::fDistances[iplate][istrip]= kdistances[iplate][istrip];
202 //_____________________________________________________________________________
203 Float_t AliTOFGeometryV5::DistanceToPadPar(Int_t *det, Float_t *pos, Float_t *dist3d) const
206 // Returns distance of space point with coor pos (x,y,z) (cm) wrt
207 // pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ)
210 //Transform pos into Sector Frame
216 Float_t radius = TMath::Sqrt(x*x+y*y);
217 //Float_t phi=TMath::ATan(y/x);
218 //if(phi<0) phi = k2PI+phi; //2.*TMath::Pi()+phi;
219 Float_t phi = TMath::Pi()+TMath::ATan2(-y,-x);
220 // Get the local angle in the sector philoc
221 Float_t angle = phi*kRaddeg-( Int_t (kRaddeg*phi/fPhiSec) + 0.5)*fPhiSec;
222 Float_t xs = radius*TMath::Cos(angle/kRaddeg);
223 Float_t ys = radius*TMath::Sin(angle/kRaddeg);
226 // Do the same for the selected pad
231 Float_t padRadius = TMath::Sqrt(g[0]*g[0]+g[1]*g[1]);
232 //Float_t padPhi = TMath::ATan(g[1]/g[0]);
233 //if(padPhi<0) padPhi = k2Pi + padPhi;
234 Float_t padPhi = TMath::Pi()+TMath::ATan2(-g[1],-g[0]);
236 // Get the local angle in the sector philoc
237 Float_t padAngle = padPhi*kRaddeg-( Int_t (padPhi*kRaddeg/fPhiSec)+ 0.5) * fPhiSec;
238 Float_t padxs = padRadius*TMath::Cos(padAngle/kRaddeg);
239 Float_t padys = padRadius*TMath::Sin(padAngle/kRaddeg);
240 Float_t padzs = g[2];
242 //Now move to local pad coordinate frame. Translate:
244 Float_t xt = xs-padxs;
245 Float_t yt = ys-padys;
246 Float_t zt = zs-padzs;
249 Float_t alpha = GetAngles(det[1],det[2]);
250 Float_t xr = xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg);
252 Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg);
254 Float_t dist = TMath::Sqrt(xr*xr+yr*yr+zr*zr);
266 //_____________________________________________________________________________
267 Bool_t AliTOFGeometryV5::IsInsideThePadPar(Int_t *det, Float_t *pos) const
270 // Returns true if space point with coor pos (x,y,z) (cm) falls
271 // inside pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ)
274 Bool_t isInside=false;
277 const Float_t khhony = 1.0 ; // heigth of HONY Layer
278 const Float_t khpcby = 0.08 ; // heigth of PCB Layer
279 const Float_t khrgly = 0.055 ; // heigth of RED GLASS Layer
280 const Float_t khglfy = 0.285 ; // heigth of GLASS+FISHLINE Layer
281 const Float_t khcpcby = 0.16 ; // heigth of PCB Central Layer
282 //const Float_t kwcpcbz = 12.4 ; // z dimension of PCB Central Layer
283 const Float_t khstripy = 2.*khhony+2.*khpcby+4.*khrgly+2.*khglfy+khcpcby;//3.11
284 //const Float_t kwstripz = kwcpcbz;
285 //const Float_t klstripx = fgkStripLength;
288 const Float_t khsensmy = 0.5;//0.05;//0.11;//0.16;// // heigth of Sensitive Layer
290 //Transform pos into Sector Frame
296 Float_t radius = TMath::Sqrt(x*x+y*y);
297 Float_t phi = TMath::Pi()+TMath::ATan2(-y,-x);
299 // Get the local angle in the sector philoc
300 Float_t angle = phi*kRaddeg-( Int_t (kRaddeg*phi/fPhiSec) + 0.5) *fPhiSec;
301 Float_t xs = radius*TMath::Cos(angle/kRaddeg);
302 Float_t ys = radius*TMath::Sin(angle/kRaddeg);
305 // Do the same for the selected pad
310 Float_t padRadius = TMath::Sqrt(g[0]*g[0]+g[1]*g[1]);
311 Float_t padPhi = TMath::Pi()+TMath::ATan2(-g[1],-g[0]);
313 // Get the local angle in the sector philoc
314 Float_t padAngle = padPhi*kRaddeg-( Int_t (padPhi*kRaddeg/fPhiSec)+ 0.5) * fPhiSec;
315 Float_t padxs = padRadius*TMath::Cos(padAngle/kRaddeg);
316 Float_t padys = padRadius*TMath::Sin(padAngle/kRaddeg);
317 Float_t padzs = g[2];
319 //Now move to local pad coordinate frame. Translate:
321 Float_t xt = xs-padxs;
322 Float_t yt = ys-padys;
323 Float_t zt = zs-padzs;
327 Float_t alpha = GetAngles(det[1],det[2]);
328 Float_t xr = xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg);
330 Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg);
332 if(TMath::Abs(xr)<=khsensmy*0.5 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5))
339 //_____________________________________________________________________________
340 Float_t AliTOFGeometryV5::DistanceToPad(Int_t *det, TGeoHMatrix mat, Float_t *pos, Float_t *dist3d) const
343 // Returns distance of space point with coor pos (x,y,z) (cm) wrt
344 // pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ)
347 printf("ERROR: no TGeo\n");
354 Double_t veclr[3]={-1.,-1.,-1.};
355 Double_t vecl[3]={-1.,-1.,-1.};
356 mat.MasterToLocal(vecg,veclr);
359 //take into account reflections
360 if(det[1]>-1)vecl[2]=-veclr[2];
362 Float_t dist = TMath::Sqrt(vecl[0]*vecl[0]+vecl[1]*vecl[1]+vecl[2]*vecl[2]);
376 //_____________________________________________________________________________
377 Bool_t AliTOFGeometryV5::IsInsideThePad( Int_t *det, TGeoHMatrix mat, Float_t *pos) const
380 // Returns true if space point with coor pos (x,y,z) (cm) falls
381 // inside pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ)
384 const Float_t khsensmy = 0.5; // heigth of Sensitive Layer
389 Double_t veclr[3]={-1.,-1.,-1.};
390 Double_t vecl[3]={-1.,-1.,-1.};
391 mat.MasterToLocal(vecg,vecl);
394 //take into account reflections
395 if(det[1]>-1)vecl[2]=-veclr[2];
397 Float_t xr = vecl[0];
398 Float_t yr = vecl[1];
399 Float_t zr = vecl[2];
401 Bool_t isInside=false;
402 if(TMath::Abs(xr)<= khsensmy*0.5 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5))
407 //_____________________________________________________________________________
408 //_____________________________________________________________________________
409 Float_t AliTOFGeometryV5::GetX(Int_t *det) const
412 // Returns X coordinate (cm)
415 Int_t isector = det[0];
416 Int_t iplate = det[1];
417 Int_t istrip = det[2];
418 Int_t ipadz = det[3];
419 Int_t ipadx = det[4];
422 // Find out distance d on the plane wrt median phi:
423 Float_t d = (ipadx+0.5-kNpadX*0.5)*fgkXPad;
425 // The radius r in xy plane:
426 //Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
427 // (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg)-0.25; ???
428 Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
429 (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg);
431 // local azimuthal angle in the sector philoc
432 Float_t philoc = TMath::ATan(d/r);
433 //if(philoc<0.) philoc = k2PI + philoc;
435 // azimuthal angle in the global frame phi
436 Float_t phi = philoc*kRaddeg+(isector+0.5)*fPhiSec;
438 Float_t xCoor = r/TMath::Cos(philoc)*TMath::Cos(phi/kRaddeg);
441 // Pad reference frame -> FSTR reference frame
443 Float_t posLocal[3] = {0., 0., 0.};
444 Float_t step[3] = {-(ipadx+0.5)*fgkXPad, 0., -(ipadz+0.5)*fgkZPad};
445 Translation(posLocal,step);
447 step[0] = kNpadX*0.5*fgkXPad;
449 step[2] = kNpadZ*0.5*fgkZPad;
452 Float_t posLocal[3] = {(ipadx+0.5)*fgkXPad, 0., (ipadz+0.5)*fgkZPad};
453 Float_t step[3]= {kNpadX*0.5*fgkXPad, 0., kNpadZ*0.5*fgkZPad};
455 Translation(posLocal,step);
457 // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame
459 if (GetAngles(iplate,istrip) >0.) {
462 angles[2] = 90.+GetAngles(iplate,istrip);
464 angles[4] = GetAngles(iplate,istrip);
467 else if (GetAngles(iplate,istrip)==0.) {
475 else if (GetAngles(iplate,istrip) <0.) {
478 angles[2] = 90.+GetAngles(iplate,istrip);
480 angles[4] =-GetAngles(iplate,istrip);
484 InverseRotation(posLocal,angles);
487 step[1] = -GetHeights(iplate,istrip);
488 step[2] = GetDistances(iplate,istrip);
489 Translation(posLocal,step);
491 // FTOA = FLTA reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
499 InverseRotation(posLocal,angles);
501 // B071/B074/B075 = BTO1/2/3 reference frame -> ALICE reference frame
504 step[2] = -((fgkRmax+fgkRmin)*0.5);
505 Translation(posLocal,step);
508 angles[1] = 90.+(isector+0.5)*fPhiSec;
512 angles[5] = (isector+0.5)*fPhiSec;
514 InverseRotation(posLocal,angles);
516 Float_t xCoor = posLocal[0];
521 //_____________________________________________________________________________
522 Float_t AliTOFGeometryV5::GetY(Int_t *det) const
525 // Returns Y coordinate (cm)
528 Int_t isector = det[0];
529 Int_t iplate = det[1];
530 Int_t istrip = det[2];
531 Int_t ipadz = det[3];
532 Int_t ipadx = det[4];
535 // Find out distance d on the plane wrt median phi:
536 Float_t d = (ipadx+0.5-kNpadX*0.5)*fgkXPad;
538 // The radius r in xy plane:
539 //Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
540 // (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg)-0.25; ???
541 Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
542 (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg);
544 // local azimuthal angle in the sector philoc
545 Float_t philoc = TMath::ATan(d/r);
546 //if(philoc<0.) philoc = k2PI + philoc;
548 // azimuthal angle in the global frame phi
549 Float_t phi = philoc*kRaddeg+(isector+0.5)*fPhiSec;
551 Float_t yCoor = r/TMath::Cos(philoc)*TMath::Sin(phi/kRaddeg);
554 // Pad reference frame -> FSTR reference frame
556 Float_t posLocal[3] = {0., 0., 0.};
557 Float_t step[3] = {-(ipadx+0.5)*fgkXPad, 0., -(ipadz+0.5)*fgkZPad};
558 Translation(posLocal,step);
560 step[0] = kNpadX*0.5*fgkXPad;
562 step[2] = kNpadZ*0.5*fgkZPad;
565 Float_t posLocal[3] = {(ipadx+0.5)*fgkXPad, 0., (ipadz+0.5)*fgkZPad};
566 Float_t step[3]= {kNpadX*0.5*fgkXPad, 0., kNpadZ*0.5*fgkZPad};
568 Translation(posLocal,step);
570 // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame
573 if (GetAngles(iplate,istrip) >0.) {
576 angles[2] = 90.+GetAngles(iplate,istrip);
578 angles[4] = GetAngles(iplate,istrip);
581 else if (GetAngles(iplate,istrip)==0.) {
589 else if (GetAngles(iplate,istrip) <0.) {
592 angles[2] = 90.+GetAngles(iplate,istrip);
594 angles[4] =-GetAngles(iplate,istrip);
598 InverseRotation(posLocal,angles);
601 step[1] = -GetHeights(iplate,istrip);
602 step[2] = GetDistances(iplate,istrip);
603 Translation(posLocal,step);
605 // FTOA = FLTA reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
613 InverseRotation(posLocal,angles);
615 // B071/B074/B075 = BTO1/2/3 reference frame -> ALICE reference frame
618 step[2] = -((fgkRmax+fgkRmin)*0.5);
619 Translation(posLocal,step);
622 angles[1] = 90.+(isector+0.5)*fPhiSec;
626 angles[5] = (isector+0.5)*fPhiSec;
628 InverseRotation(posLocal,angles);
630 Float_t yCoor = posLocal[1];
636 //_____________________________________________________________________________
637 Float_t AliTOFGeometryV5::GetZ(Int_t *det) const
640 // Returns Z coordinate (cm)
643 Int_t isector = det[0];
644 Int_t iplate = det[1];
645 Int_t istrip = det[2];
646 Int_t ipadz = det[3];
647 Int_t ipadx = det[4];
650 Float_t zCoor = GetDistances(iplate,istrip) +
651 (0.5-ipadz) * fgkZPad * TMath::Cos(GetAngles(iplate,istrip)*kDegrad);
654 // Pad reference frame -> FSTR reference frame
656 Float_t posLocal[3] = {0., 0., 0.};
657 Float_t step[3] = {-(ipadx+0.5)*fgkXPad, 0., -(ipadz+0.5)*fgkZPad};
658 Translation(posLocal,step);
660 step[0] = kNpadX*0.5*fgkXPad;
662 step[2] = kNpadZ*0.5*fgkZPad;
665 Float_t posLocal[3] = {(ipadx+0.5)*fgkXPad, 0., (ipadz+0.5)*fgkZPad};
666 Float_t step[3]= {kNpadX*0.5*fgkXPad, 0., kNpadZ*0.5*fgkZPad};
668 Translation(posLocal,step);
670 // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame
672 if (GetAngles(iplate,istrip) >0.) {
675 angles[2] = 90.+GetAngles(iplate,istrip);
677 angles[4] = GetAngles(iplate,istrip);
680 else if (GetAngles(iplate,istrip)==0.) {
688 else if (GetAngles(iplate,istrip) <0.) {
691 angles[2] = 90.+GetAngles(iplate,istrip);
693 angles[4] =-GetAngles(iplate,istrip);
697 InverseRotation(posLocal,angles);
700 step[1] = -GetHeights(iplate,istrip);
701 step[2] = GetDistances(iplate,istrip);
702 Translation(posLocal,step);
704 // FTOA = FLTA reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
712 InverseRotation(posLocal,angles);
714 // B071/B074/B075 = BTO1/2/3 reference frame -> ALICE reference frame
717 step[2] = -((fgkRmax+fgkRmin)*0.5);
718 Translation(posLocal,step);
721 angles[1] = 90.+(isector+0.5)*fPhiSec;
725 angles[5] = (isector+0.5)*fPhiSec;
727 InverseRotation(posLocal,angles);
729 Float_t zCoor = posLocal[2];
735 //_____________________________________________________________________________
736 Int_t AliTOFGeometryV5::GetSector(Float_t *pos) const
739 // Returns the Sector index
742 //const Float_t khAlWall = 0.1;
743 //const Float_t kModuleWallThickness = 0.3;
751 Float_t rho = TMath::Sqrt(x*x + y*y);
753 //if (!((z>=-fgkMaxhZtof && z<=fgkMaxhZtof) &&
754 if (!((z>=-fgkZlenA*0.5 && z<=fgkZlenA*0.5) &&
755 (rho>=(fgkRmin) && rho<=(fgkRmax)))) {
756 //(rho>=(fgkRmin-0.05)+kModuleWallThickness && rho<=(fgkRmax-0.05)-kModuleWallThickness-khAlWall-kModuleWallThickness))) {
757 //AliError("Detector Index could not be determined");
761 Float_t phi = TMath::Pi() + TMath::ATan2(-y,-x);
763 iSect = (Int_t) (phi*kRaddeg/fPhiSec);
768 //_____________________________________________________________________________
770 Int_t AliTOFGeometryV5::GetPlate(Float_t *pos) const
773 // Returns the Plate index
775 const Float_t kInterCentrModBorder1 = 49.5;
776 const Float_t kInterCentrModBorder2 = 57.5;
777 const Float_t kExterInterModBorder1 = 196.0;
778 const Float_t kExterInterModBorder2 = 203.5;
780 const Float_t kLengthExInModBorder = 4.7;
781 const Float_t kLengthInCeModBorder = 7.0;
783 //const Float_t khAlWall = 0.1;
784 const Float_t kModuleWallThickness = 0.3;
785 //const Float_t kHoneycombLayerThickness = 1.5;
790 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
792 Int_t isector = GetSector(posLocal);
794 //AliError("Detector Index could not be determined");
798 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
800 {90., 90.+(isector+0.5)*fPhiSec,
802 90., (isector+0.5)*fPhiSec
804 Rotation(posLocal,angles);
806 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
807 Translation(posLocal,step);
809 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame
817 Rotation(posLocal,angles);
819 Float_t yLocal = posLocal[1];
820 Float_t zLocal = posLocal[2];
822 Float_t deltaRhoLoc = (fgkRmax-fgkRmin)*0.5 - kModuleWallThickness + yLocal;
823 Float_t deltaZetaLoc = TMath::Abs(zLocal);
825 Float_t deltaRHOmax = 0.;
827 if (TMath::Abs(zLocal)>=kExterInterModBorder1 && TMath::Abs(zLocal)<=kExterInterModBorder2)
829 deltaRhoLoc -= kLengthExInModBorder;
830 deltaZetaLoc = kExterInterModBorder2-deltaZetaLoc;
831 deltaRHOmax = (fgkRmax - fgkRmin)*0.5 - kModuleWallThickness - 2.*kLengthExInModBorder; // old 5.35, new 4.8
833 if (deltaRhoLoc > deltaZetaLoc*deltaRHOmax/(kInterCentrModBorder2-kInterCentrModBorder1)) {
834 if (zLocal<0) iPlate = 0;
838 if (zLocal<0) iPlate = 1;
842 else if (TMath::Abs(zLocal)>=kInterCentrModBorder1 && TMath::Abs(zLocal)<=kInterCentrModBorder2)
844 deltaRhoLoc -= kLengthInCeModBorder;
845 deltaZetaLoc = deltaZetaLoc-kInterCentrModBorder1;
846 deltaRHOmax = (fgkRmax - fgkRmin)*0.5 - kModuleWallThickness - 2.*kLengthInCeModBorder; // old 0.39, new 0.2
848 if (deltaRhoLoc>deltaZetaLoc*deltaRHOmax/(kInterCentrModBorder2-kInterCentrModBorder1)) iPlate = 2;
850 if (zLocal<0) iPlate = 1;
855 if (zLocal>-fgkZlenA*0.5/*fgkMaxhZtof*/ && zLocal<-kExterInterModBorder2) iPlate = 0;
856 else if (zLocal>-kExterInterModBorder1 && zLocal<-kInterCentrModBorder2) iPlate = 1;
857 else if (zLocal>-kInterCentrModBorder1 && zLocal< kInterCentrModBorder1) iPlate = 2;
858 else if (zLocal> kInterCentrModBorder2 && zLocal< kExterInterModBorder1) iPlate = 3;
859 else if (zLocal> kExterInterModBorder2 && zLocal< fgkZlenA*0.5/*fgkMaxhZtof*/) iPlate = 4;
865 //_____________________________________________________________________________
866 Int_t AliTOFGeometryV5::GetStrip(Float_t *pos) const
869 // Returns the Strip index
871 const Float_t khhony = 1.0 ; // heigth of HONY Layer
872 const Float_t khpcby = 0.08 ; // heigth of PCB Layer
873 const Float_t khrgly = 0.055 ; // heigth of RED GLASS Layer
874 const Float_t khglfy = 0.285 ; // heigth of GLASS+FISHLINE Layer
875 const Float_t khcpcby = 0.16 ; // heigth of PCB Central Layer
876 const Float_t kwcpcbz = 12.4 ; // z dimension of PCB Central Layer
877 const Float_t khstripy = 2.*khhony+2.*khpcby+4.*khrgly+2.*khglfy+khcpcby;//3.11
878 const Float_t kwstripz = kwcpcbz;
879 const Float_t klstripx = fgkStripLength;
884 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
886 Int_t isector = GetSector(posLocal);
888 //AliError("Detector Index could not be determined");
890 Int_t iplate = GetPlate(posLocal);
892 //AliError("Detector Index could not be determined");
914 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
916 {90., 90.+(isector+0.5)*fPhiSec,
918 90., (isector+0.5)*fPhiSec
920 Rotation(posLocal,angles);
922 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
923 Translation(posLocal,step);
925 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame
933 Rotation(posLocal,angles);
935 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
937 for (Int_t istrip=0; istrip<nstrips; istrip++){
939 Float_t posLoc2[3]={posLocal[0],posLocal[1],posLocal[2]};
942 step[1] = GetHeights(iplate,istrip);
943 step[2] = -GetDistances(iplate,istrip);
944 Translation(posLoc2,step);
946 if (GetAngles(iplate,istrip) >0.) {
949 angles[2] = 90.+GetAngles(iplate,istrip);
951 angles[4] = GetAngles(iplate,istrip);
954 else if (GetAngles(iplate,istrip)==0.) {
962 else if (GetAngles(iplate,istrip) <0.) {
965 angles[2] = 90.+GetAngles(iplate,istrip);
967 angles[4] =-GetAngles(iplate,istrip);
970 Rotation(posLoc2,angles);
972 if ((TMath::Abs(posLoc2[0])<=klstripx*0.5) &&
973 (TMath::Abs(posLoc2[1])<=khstripy*0.5) &&
974 (TMath::Abs(posLoc2[2])<=kwstripz*0.5)) {
977 for (Int_t jj=0; jj<3; jj++) posLocal[jj]=posLoc2[jj];
978 //AliInfo(Form(" posLocal[0] = %f, posLocal[1] = %f, posLocal[2] = %f ", posLocal[0],posLocal[1],posLocal[2]));
980 //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]));
984 if (totStrip>1) AliInfo(Form("total strip number found %2i",totStrip));
991 //_____________________________________________________________________________
992 Int_t AliTOFGeometryV5::GetPadZ(Float_t *pos) const
995 // Returns the Pad index along Z
997 //const Float_t klsensmx = kNpadX*fgkXPad; // length of Sensitive Layer
998 //const Float_t khsensmy = 0.05;//0.11;//0.16;// heigth of Sensitive Layer
999 //const Float_t kwsensmz = kNpadZ*fgkZPad; // width of Sensitive Layer
1003 Float_t posLocal[3];
1004 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
1006 Int_t isector = GetSector(posLocal);
1008 //AliError("Detector Index could not be determined");
1010 Int_t iplate = GetPlate(posLocal);
1012 //AliError("Detector Index could not be determined");
1014 Int_t istrip = GetStrip(posLocal);
1016 //AliError("Detector Index could not be determined");
1019 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1020 Double_t angles[6] =
1021 {90., 90.+(isector+0.5)*fPhiSec,
1023 90., (isector+0.5)*fPhiSec
1025 Rotation(posLocal,angles);
1027 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1028 Translation(posLocal,step);
1030 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame
1038 Rotation(posLocal,angles);
1040 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1042 step[1] = GetHeights(iplate,istrip);
1043 step[2] = -GetDistances(iplate,istrip);
1044 Translation(posLocal,step);
1046 if (GetAngles(iplate,istrip) >0.) {
1049 angles[2] = 90.+GetAngles(iplate,istrip);
1051 angles[4] = GetAngles(iplate,istrip);
1054 else if (GetAngles(iplate,istrip)==0.) {
1062 else if (GetAngles(iplate,istrip) <0.) {
1065 angles[2] = 90.+GetAngles(iplate,istrip);
1067 angles[4] =-GetAngles(iplate,istrip);
1070 Rotation(posLocal,angles);
1072 //if (TMath::Abs(posLocal[0])<=klsensmx*0.5 && /*TMath::Abs(posLocal[1])<=khsensmy*0.5+0.005 &&*/ TMath::Abs(posLocal[2])<=kwsensmz*0.5) {
1073 //if (TMath::Abs(posLocal[1])<=khsensmy*0.5) {
1075 step[0] =-0.5*kNpadX*fgkXPad;
1077 step[2] =-0.5*kNpadZ*fgkZPad;
1078 Translation(posLocal,step);
1080 iPadZ = (Int_t)(posLocal[2]/fgkZPad);
1081 if (iPadZ==kNpadZ) iPadZ--;
1082 else if (iPadZ>kNpadZ) iPadZ=-1;
1085 // else AliError("Detector Index could not be determined");
1090 //_____________________________________________________________________________
1091 Int_t AliTOFGeometryV5::GetPadX(Float_t *pos) const
1094 // Returns the Pad index along X
1096 //const Float_t klsensmx = kNpadX*fgkXPad; // length of Sensitive Layer
1097 //const Float_t khsensmy = 0.05;//0.11;//0.16;// heigth of Sensitive Layer
1098 //const Float_t kwsensmz = kNpadZ*fgkZPad; // width of Sensitive Layer
1102 Float_t posLocal[3];
1103 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
1105 Int_t isector = GetSector(posLocal);
1107 //AliError("Detector Index could not be determined");
1109 Int_t iplate = GetPlate(posLocal);
1111 //AliError("Detector Index could not be determined");
1113 Int_t istrip = GetStrip(posLocal);
1115 //AliError("Detector Index could not be determined");
1118 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1119 Double_t angles[6] =
1120 {90., 90.+(isector+0.5)*fPhiSec,
1122 90., (isector+0.5)*fPhiSec
1124 Rotation(posLocal,angles);
1126 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1127 Translation(posLocal,step);
1129 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
1137 Rotation(posLocal,angles);
1139 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1141 step[1] = GetHeights(iplate,istrip);
1142 step[2] = -GetDistances(iplate,istrip);
1143 Translation(posLocal,step);
1145 if (GetAngles(iplate,istrip) >0.) {
1148 angles[2] = 90.+GetAngles(iplate,istrip);
1150 angles[4] = GetAngles(iplate,istrip);
1153 else if (GetAngles(iplate,istrip)==0.) {
1161 else if (GetAngles(iplate,istrip) <0.) {
1164 angles[2] = 90.+GetAngles(iplate,istrip);
1166 angles[4] =-GetAngles(iplate,istrip);
1169 Rotation(posLocal,angles);
1171 //if (TMath::Abs(posLocal[0])<=klsensmx*0.5 && /*TMath::Abs(posLocal[1])<=khsensmy*0.5+0.005 &&*/ TMath::Abs(posLocal[2])<=kwsensmz*0.5) {
1172 //if (TMath::Abs(posLocal[1])<=khsensmy*0.5) {
1174 step[0] =-0.5*kNpadX*fgkXPad;
1176 step[2] =-0.5*kNpadZ*fgkZPad;
1177 Translation(posLocal,step);
1179 iPadX = (Int_t)(posLocal[0]/fgkXPad);
1180 if (iPadX==kNpadX) iPadX--;
1181 else if (iPadX>kNpadX) iPadX=-1;
1184 //else AliError("Detector Index could not be determined");
1189 //_____________________________________________________________________________
1191 Float_t AliTOFGeometryV5::GetPadDx(Float_t *pos)
1194 // Returns the x coordinate in the Pad reference frame
1199 Float_t posLocal[3];
1200 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
1202 Int_t isector = GetSector(posLocal);
1204 //AliError("Detector Index could not be determined");
1206 Int_t iplate = GetPlate(posLocal);
1208 //AliError("Detector Index could not be determined");
1210 Int_t istrip = GetStrip(posLocal);
1212 //AliError("Detector Index could not be determined");
1214 Int_t ipadz = GetPadZ(posLocal);
1216 //AliError("Detector Index could not be determined");
1218 Int_t ipadx = GetPadX(posLocal);
1220 //AliError("Detector Index could not be determined");
1223 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1224 Double_t angles[6] =
1225 {90., 90.+(isector+0.5)*fPhiSec,
1227 90., (isector+0.5)*fPhiSec
1229 Rotation(posLocal,angles);
1231 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1232 Translation(posLocal,step);
1234 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
1242 Rotation(posLocal,angles);
1244 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1246 step[1] = GetHeights(iplate,istrip);
1247 step[2] = -GetDistances(iplate,istrip);
1248 Translation(posLocal,step);
1250 if (GetAngles(iplate,istrip) >0.) {
1253 angles[2] = 90.+GetAngles(iplate,istrip);
1255 angles[4] = GetAngles(iplate,istrip);
1258 else if (GetAngles(iplate,istrip)==0.) {
1266 else if (GetAngles(iplate,istrip) <0.) {
1269 angles[2] = 90.+GetAngles(iplate,istrip);
1271 angles[4] =-GetAngles(iplate,istrip);
1274 Rotation(posLocal,angles);
1276 step[0] =-0.5*kNpadX*fgkXPad;
1278 step[2] =-0.5*kNpadZ*fgkZPad;
1279 Translation(posLocal,step);
1281 step[0] = (ipadx+0.5)*fgkXPad;
1283 step[2] = (ipadz+0.5)*fgkZPad;
1284 Translation(posLocal,step);
1291 //_____________________________________________________________________________
1292 Float_t AliTOFGeometryV5::GetPadDy(Float_t *pos)
1295 // Returns the y coordinate in the Pad reference frame
1300 Float_t posLocal[3];
1301 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
1303 Int_t isector = GetSector(posLocal);
1305 //AliError("Detector Index could not be determined");
1307 Int_t iplate = GetPlate(posLocal);
1309 //AliError("Detector Index could not be determined");
1311 Int_t istrip = GetStrip(posLocal);
1313 //AliError("Detector Index could not be determined");
1315 Int_t ipadz = GetPadZ(posLocal);
1317 //AliError("Detector Index could not be determined");
1319 Int_t ipadx = GetPadX(posLocal);
1321 //AliError("Detector Index could not be determined");
1324 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1325 Double_t angles[6] =
1326 {90., 90.+(isector+0.5)*fPhiSec,
1328 90., (isector+0.5)*fPhiSec
1330 Rotation(posLocal,angles);
1332 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1333 Translation(posLocal,step);
1335 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
1343 Rotation(posLocal,angles);
1345 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1347 step[1] = GetHeights(iplate,istrip);
1348 step[2] = -GetDistances(iplate,istrip);
1349 Translation(posLocal,step);
1351 if (GetAngles(iplate,istrip) >0.) {
1354 angles[2] = 90.+GetAngles(iplate,istrip);
1356 angles[4] = GetAngles(iplate,istrip);
1359 else if (GetAngles(iplate,istrip)==0.) {
1367 else if (GetAngles(iplate,istrip) <0.) {
1370 angles[2] = 90.+GetAngles(iplate,istrip);
1372 angles[4] =-GetAngles(iplate,istrip);
1375 Rotation(posLocal,angles);
1377 step[0] =-0.5*kNpadX*fgkXPad;
1379 step[2] =-0.5*kNpadZ*fgkZPad;
1380 Translation(posLocal,step);
1382 step[0] = (ipadx+0.5)*fgkXPad;
1384 step[2] = (ipadz+0.5)*fgkZPad;
1385 Translation(posLocal,step);
1392 //_____________________________________________________________________________
1393 Float_t AliTOFGeometryV5::GetPadDz(Float_t *pos)
1396 // Returns the z coordinate in the Pad reference frame
1401 Float_t posLocal[3];
1402 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
1404 Int_t isector = GetSector(posLocal);
1406 //AliError("Detector Index could not be determined");
1408 Int_t iplate = GetPlate(posLocal);
1410 //AliError("Detector Index could not be determined");
1412 Int_t istrip = GetStrip(posLocal);
1414 //AliError("Detector Index could not be determined");
1416 Int_t ipadz = GetPadZ(posLocal);
1418 //AliError("Detector Index could not be determined");
1420 Int_t ipadx = GetPadX(posLocal);
1422 //AliError("Detector Index could not be determined");
1425 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1426 Double_t angles[6] =
1427 {90., 90.+(isector+0.5)*fPhiSec,
1429 90., (isector+0.5)*fPhiSec
1431 Rotation(posLocal,angles);
1433 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1434 Translation(posLocal,step);
1436 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
1444 Rotation(posLocal,angles);
1446 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1448 step[1] = GetHeights(iplate,istrip);
1449 step[2] = -GetDistances(iplate,istrip);
1450 Translation(posLocal,step);
1452 if (GetAngles(iplate,istrip) >0.) {
1455 angles[2] = 90.+GetAngles(iplate,istrip);
1457 angles[4] = GetAngles(iplate,istrip);
1460 else if (GetAngles(iplate,istrip)==0.) {
1468 else if (GetAngles(iplate,istrip) <0.) {
1471 angles[2] = 90.+GetAngles(iplate,istrip);
1473 angles[4] =-GetAngles(iplate,istrip);
1476 Rotation(posLocal,angles);
1478 step[0] =-0.5*kNpadX*fgkXPad;
1480 step[2] =-0.5*kNpadZ*fgkZPad;
1481 Translation(posLocal,step);
1483 step[0] = (ipadx+0.5)*fgkXPad;
1485 step[2] = (ipadz+0.5)*fgkZPad;
1486 Translation(posLocal,step);
1493 //_____________________________________________________________________________
1495 void AliTOFGeometryV5::Translation(Float_t *xyz, Float_t translationVector[3]) const
1498 // Return the vector xyz translated by translationVector vector
1503 for (ii=0; ii<3; ii++)
1504 xyz[ii] -= translationVector[ii];
1509 //_____________________________________________________________________________
1511 void AliTOFGeometryV5::Rotation(Float_t *xyz, Double_t rotationAngles[6]) const
1514 // Return the vector xyz rotated according to the rotationAngles angles
1519 TRotMatrix *matrix = new TRotMatrix("matrix","matrix", angles[0], angles[1],
1520 angles[2], angles[3],
1521 angles[4], angles[5]);
1524 for (ii=0; ii<6; ii++) rotationAngles[ii]*=kDegrad;
1526 Float_t xyzDummy[3] = {0., 0., 0.};
1528 for (ii=0; ii<3; ii++) {
1530 xyz[0]*TMath::Sin(rotationAngles[2*ii])*TMath::Cos(rotationAngles[2*ii+1]) +
1531 xyz[1]*TMath::Sin(rotationAngles[2*ii])*TMath::Sin(rotationAngles[2*ii+1]) +
1532 xyz[2]*TMath::Cos(rotationAngles[2*ii]);
1535 for (ii=0; ii<3; ii++) xyz[ii]=xyzDummy[ii];
1540 //_____________________________________________________________________________
1541 void AliTOFGeometryV5::InverseRotation(Float_t *xyz, Double_t rotationAngles[6]) const
1549 for (ii=0; ii<6; ii++) rotationAngles[ii]*=kDegrad;
1551 Float_t xyzDummy[3] = {0., 0., 0.};
1554 xyz[0]*TMath::Sin(rotationAngles[0])*TMath::Cos(rotationAngles[1]) +
1555 xyz[1]*TMath::Sin(rotationAngles[2])*TMath::Cos(rotationAngles[3]) +
1556 xyz[2]*TMath::Sin(rotationAngles[4])*TMath::Cos(rotationAngles[5]);
1559 xyz[0]*TMath::Sin(rotationAngles[0])*TMath::Sin(rotationAngles[1]) +
1560 xyz[1]*TMath::Sin(rotationAngles[2])*TMath::Sin(rotationAngles[3]) +
1561 xyz[2]*TMath::Sin(rotationAngles[4])*TMath::Sin(rotationAngles[5]);
1564 xyz[0]*TMath::Cos(rotationAngles[0]) +
1565 xyz[1]*TMath::Cos(rotationAngles[2]) +
1566 xyz[2]*TMath::Cos(rotationAngles[4]);
1568 for (ii=0; ii<3; ii++) xyz[ii]=xyzDummy[ii];
1573 //_____________________________________________________________________________
1574 void AliTOFGeometryV5::GetVolumePath(Int_t *ind, Char_t *path ) {
1575 //--------------------------------------------------------------------
1576 // This function returns the colume path of a given pad
1577 //--------------------------------------------------------------------
1578 Int_t sector = ind[0];
1579 Char_t string1[100];
1580 Char_t string2[100];
1581 Char_t string3[100];
1585 // Old 6h convention
1588 // else{ icopy=sector-13;}
1589 sprintf(string1,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1/FTOA_0/FLTA_0",icopy,icopy);
1591 Int_t iplate=ind[1];
1592 Int_t istrip=ind[2];
1593 if( iplate==0) icopy=istrip;
1594 if( iplate==1) icopy=istrip+NStripC();
1595 if( iplate==2) icopy=istrip+NStripC()+NStripB();
1596 if( iplate==3) icopy=istrip+NStripC()+NStripB()+NStripA();
1597 if( iplate==4) icopy=istrip+NStripC()+2*NStripB()+NStripA();
1599 sprintf(string2,"FSTR_%i",icopy);
1600 if(fHoles && (sector==11 || sector==12)){
1601 if(iplate<2) sprintf(string2,"FTOB_0/FLTB_0/FSTR_%i",icopy);
1602 if(iplate>2) sprintf(string2,"FTOC_0/FLTC_0/FSTR_%i",icopy);
1606 Int_t padz = ind[3]+1;
1607 Int_t padx = ind[4]+1;
1608 sprintf(string3,"FPCB_1/FSEN_1/FSEZ_%i/FPAD_%i",padz,padx);
1609 sprintf(path,"%s/%s/%s",string1,string2,string3);
1612 //_____________________________________________________________________________
1613 void AliTOFGeometryV5::GetVolumePath(Int_t sector, Char_t *path ){
1614 //--------------------------------------------------------------------
1615 // This function returns the colume path of a given sector
1616 //--------------------------------------------------------------------
1620 Int_t icopy = sector;
1621 // Old 6h convention
1624 // else{ icopy=sector-13;}
1626 sprintf(string,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1",icopy,icopy);
1627 sprintf(path,"%s",string);
1630 //_____________________________________________________________________________
1631 void AliTOFGeometryV5::GetVolumePath(Int_t sector, Int_t plate, Int_t strip, Char_t *path ) {
1632 //--------------------------------------------------------------------
1633 // This function returns the colume path of a given strip
1634 //--------------------------------------------------------------------
1636 Char_t string1[100];
1637 Char_t string2[100];
1638 Char_t string3[100];
1640 Int_t icopy = sector;
1641 // Old 6h convention
1644 // else{ icopy=sector-13;}
1645 sprintf(string1,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1/FTOA_0/FLTA_0",icopy,icopy);
1647 if(plate==0) icopy=strip;
1648 if(plate==1) icopy=strip+NStripC();
1649 if(plate==2) icopy=strip+NStripC()+NStripB();
1650 if(plate==3) icopy=strip+NStripC()+NStripB()+NStripA();
1651 if(plate==4) icopy=strip+NStripC()+2*NStripB()+NStripA();
1653 sprintf(string2,"FSTR_%i",icopy);
1654 if(fHoles && (sector==11 || sector==12)) {
1655 if(plate<2) sprintf(string2,"FTOB_0/FLTB_0/FSTR_%i",icopy);
1656 if(plate>2) sprintf(string2,"FTOC_0/FLTC_0/FSTR_%i",icopy);
1659 sprintf(string3,"FPCB_1/FSEN_1");
1660 sprintf(path,"%s/%s/%s",string1,string2,string3);
1663 //_____________________________________________________________________________
1664 void AliTOFGeometryV5::GetPos(Int_t *det, Float_t *pos)
1667 // Returns space point coor (x,y,z) (cm) for Detector
1668 // Indices (iSect,iPlate,iStrip,iPadX,iPadZ)
1671 GetVolumePath(det,path );
1673 printf("ERROR: no TGeo\n");
1675 gGeoManager->cd(path);
1677 global = *gGeoManager->GetCurrentMatrix();
1678 const Double_t *tr = global.GetTranslation();
1684 //_____________________________________________________________________________
1686 void AliTOFGeometryV5::DetToSectorRF(Int_t vol[5], Double_t **coord)
1689 // Returns the local coordinates (x, y, z) in sector reference frame
1690 // for the 4 corners of each sector pad (vol[1], vol[2], vol[3], vol[4])
1693 if (!gGeoManager) printf("ERROR: no TGeo\n");
1695 // ALICE -> TOF Sector
1696 Char_t path1[100]="";
1697 GetVolumePath(vol[0],path1);
1698 gGeoManager->cd(path1);
1699 TGeoHMatrix aliceToSector;
1700 aliceToSector = *gGeoManager->GetCurrentMatrix();
1702 // TOF Sector -> ALICE
1703 //TGeoHMatrix sectorToALICE = aliceToSector.Inverse();
1706 Char_t path2[100]="";
1707 GetVolumePath(vol,path2);
1708 gGeoManager->cd(path2);
1709 TGeoHMatrix aliceToPad;
1710 aliceToPad = *gGeoManager->GetCurrentMatrix();
1713 TGeoHMatrix padToALICE = aliceToPad.Inverse();
1715 // TOF Pad -> TOF Sector
1716 TGeoHMatrix padToSector = padToALICE*aliceToSector;
1718 // TOF Sector -> TOF Pad
1719 //TGeoHMatrix sectorToPad = sectorToALICE*aliceToPad;
1721 // coordinates of the pad bottom corner
1722 Double_t **cornerPad = new Double_t*[4];
1723 for (Int_t ii=0; ii<4; ii++) cornerPad[ii] = new Double_t[3];
1725 cornerPad[0][0] = -fgkXPad/2.;
1726 cornerPad[0][1] = 0.;
1727 cornerPad[0][2] = -fgkZPad/2.;
1729 cornerPad[1][0] = fgkXPad/2.;
1730 cornerPad[1][1] = 0.;
1731 cornerPad[1][2] = -fgkZPad/2.;
1733 cornerPad[2][0] = fgkXPad/2.;
1734 cornerPad[2][1] = 0.;
1735 cornerPad[2][2] = fgkZPad/2.;
1737 cornerPad[3][0] = -fgkXPad/2.;
1738 cornerPad[3][1] = 0.;
1739 cornerPad[3][2] = fgkZPad/2.;
1741 for(Int_t aa=0; aa<4; aa++) for(Int_t bb=0; bb<3; bb++) coord[aa][bb]=0.;
1743 for (Int_t jj=0; jj<4; jj++) padToSector.MasterToLocal(&cornerPad[jj][0], &coord[jj][0]);
1747 //sectorToPad.LocalToMaster(cornerPad, coord);