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.2 2006/02/28 10:38:00 decaro
19 AliTOFGeometry::fAngles, AliTOFGeometry::fHeights, AliTOFGeometry::fDistances arrays: dimension definition in the right location
21 Revision 1.1 2005/12/15 08:55:33 decaro
22 New TOF geometry description (V5) -G. Cara Romeo and A. De Caro
24 Revision 0.1 2005/07/19 A. De Caro
25 Modify Global methods IsInsideThePad & DistanceToPad
26 according to the PPR TOF geometry
27 Implement Global methods GetPadDx & GetPadDy & GetPadDz
28 Modify Global methods GetDetID & GetPlate & GetSector &
29 GetStrip & GetPadX & GetPadZ
30 according to the PPR TOF geometry
31 Modify Global methods GetPos & GetX & GetY & GetZ
32 according to the PPR TOF geometry
36 #include <Riostream.h>
37 ///////////////////////////////////////////////////////////////////////////////
39 // TOF Geometry class (PPR version) //
41 ///////////////////////////////////////////////////////////////////////////////
46 #include "AliTOFGeometry.h"
47 #include "AliTOFGeometryV4.h"
49 ClassImp(AliTOFGeometryV4)
51 const Int_t AliTOFGeometryV4::kNStripC = 20; // number of strips in C type module
53 const Float_t AliTOFGeometryV4::fgkZlenA = 106.0; // length (cm) of the A module
54 const Float_t AliTOFGeometryV4::fgkZlenB = 141.0; // length (cm) of the B module
55 const Float_t AliTOFGeometryV4::fgkZlenC = 177.5; // length (cm) of the C module
56 const Float_t AliTOFGeometryV4::fgkMaxhZtof = 371.5; // Max half z-size of TOF (cm)
58 const Float_t AliTOFGeometryV4::fgkDeadBndX = 1.0; // Dead Boundaries of a Strip along X direction (length) (cm)
59 const Float_t AliTOFGeometryV4::fgkDeadBndZ = 1.5; // Dead Boundaries of a Strip along Z direction (width) (cm)
60 const Float_t AliTOFGeometryV4::fgkOverSpc = 15.3; // Space available for sensitive layers in radial direction (cm)
62 const Float_t AliTOFGeometryV4::fgkDprecMin = 0.0000075;//num.prec.tolerance on Thmin
63 const Float_t AliTOFGeometryV4::fgkDprecMax = 0.0000100;//num.prec.tolerance on Thma
64 const Float_t AliTOFGeometryV4::fgkDprecCen = 0.0000005;//num.prec.tolerance on <Theta>
66 const Float_t AliTOFGeometryV4::fgkxTOF = 371.; // Inner radius of the TOF for Reconstruction (cm)
67 const Float_t AliTOFGeometryV4::fgkRmin = 370.; // Inner radius of the TOF (cm)
68 const Float_t AliTOFGeometryV4::fgkRmax = 399.; // Outer radius of the TOF (cm)
70 //_____________________________________________________________________________
71 AliTOFGeometryV4::AliTOFGeometryV4()
75 // AliTOFGeometryV4 default constructor
78 AliTOFGeometry::kNStripC = kNStripC; // number of strips in C type module
80 AliTOFGeometry::kZlenA = fgkZlenA; // length (cm) of the A module
81 AliTOFGeometry::kZlenB = fgkZlenB; // length (cm) of the B module
82 AliTOFGeometry::kZlenC = fgkZlenC; // length (cm) of the C module
83 AliTOFGeometry::kMaxhZtof = fgkMaxhZtof; // Max half z-size of TOF (cm)
85 AliTOFGeometry::fgkxTOF = fgkxTOF; // Inner radius of the TOF for Reconstruction (cm)
86 AliTOFGeometry::fgkRmin = fgkRmin; // Inner radius of the TOF (cm)
87 AliTOFGeometry::fgkRmax = fgkRmax; // Outer radius of the TOF (cm)
93 //_____________________________________________________________________________
94 AliTOFGeometryV4::~AliTOFGeometryV4()
97 // AliTOFGeometryV4 destructor
101 //_____________________________________________________________________________
102 void AliTOFGeometryV4::ImportGeometry(){
103 TGeoManager::Import("geometry.root");
105 //_____________________________________________________________________________
106 void AliTOFGeometryV4::Init()
109 // Initialize strip Tilt Angles and Heights
111 // Strips Tilt Angles
113 Float_t const kangles[kNPlates][kMaxNstrip] ={
115 {44.494, 43.725, 42.946, 42.156, 41.357, 40.548, 39.729, 38.899,
116 38.060, 37.211, 36.353, 35.484, 34.606, 33.719, 32.822, 31.916,
117 31.001, 30.077, 29.144, 28.202 },
119 {26.884, 25.922, 24.952, 23.975, 22.989, 22.320, 21.016, 20.309,
120 19.015, 18.270, 16.989, 16.205, 14.941, 14.117, 12.871, 12.008,
121 10.784, 9.8807, 8.681, 0.0 },
123 { 7.5835, 6.4124, 5.4058, 4.2809, 3.2448, 2.1424, 1.078, -0., -1.078,
124 -2.1424, -3.2448, -4.2809, -5.4058, -6.4124, -7.5835, 0.0, 0.0, 0.0,
127 {-8.681, -9.8807, -10.784, -12.008, -12.871, -14.117, -14.941, -16.205,
128 -16.989, -18.27, -19.015, -20.309, -21.016, -22.32, -22.989,
129 -23.975, -24.952, -25.922, -26.884, 0. },
131 {-28.202, -29.144, -30.077, -31.001, -31.916, -32.822, -33.719, -34.606,
132 -35.484, -36.353, -37.211, -38.06, -38.899, -39.729, -40.548,
133 -41.357, -42.156, -42.946, -43.725, -44.494 }};
138 Float_t const kheights[kNPlates][kMaxNstrip]= {
140 {-5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5,
141 -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5 },
143 {-6.3, -7.1, -7.9, -8.7, -9.5, -3, -9.5, -3, -9.5, -3,
144 -9.5, -3.0, -9.5, -3.0, -9.5, -3, -9.5, -3, -9 , 0.},
146 { -3, -9, -4.5, -9, -4.5, -9, -4.5, -9, -4.5, -9,
147 -4.5, -9, -4.5, -9, -3, 0.0, 0.0, 0.0, 0.0, 0.0 },
149 { -9, -3, -9.5, -3, -9.5, -3, -9.5, -3, -9.5, -3, -9.5,
150 -3, -9.5, -3, -9.5, -8.7, -7.9, -7.1, -6.3, 0. },
152 {-5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5,
153 -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5 }};
155 // Deposit in fAngles, fHeights
157 for (Int_t iplate = 0; iplate < kNPlates; iplate++) {
158 for (Int_t istrip = 0; istrip < kMaxNstrip; istrip++) {
159 AliTOFGeometry::fAngles[iplate][istrip] = kangles[iplate][istrip];
160 AliTOFGeometry::fHeights[iplate][istrip] = kheights[iplate][istrip];
166 //_____________________________________________________________________________
167 Float_t AliTOFGeometryV4::DistanceToPadPar(Int_t *det, Float_t *pos, Float_t *dist3d)
170 // Returns distance of space point with coor pos (x,y,z) (cm) wrt
171 // pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ)
174 //Transform pos into Sector Frame
180 Float_t radius = TMath::Sqrt(x*x+y*y);
181 Float_t phi=TMath::ATan2(y,x);
182 if(phi<0) phi=2.*TMath::Pi()+phi;
183 // Get the local angle in the sector philoc
184 Float_t angle = phi*kRaddeg-( Int_t (kRaddeg*phi/fPhiSec) + 0.5)*fPhiSec;
185 Float_t xs = radius*TMath::Cos(angle/kRaddeg);
186 Float_t ys = radius*TMath::Sin(angle/kRaddeg);
189 // Do the same for the selected pad
194 Float_t padRadius = TMath::Sqrt(g[0]*g[0]+g[1]*g[1]);
195 Float_t padPhi=TMath::ATan2(g[1],g[0]);
196 if(padPhi<0) padPhi=2.*TMath::Pi()+padPhi;
197 // Get the local angle in the sector philoc
198 Float_t padAngle = padPhi*kRaddeg-( Int_t (padPhi*kRaddeg/fPhiSec)+ 0.5) * fPhiSec;
199 Float_t padxs = padRadius*TMath::Cos(padAngle/kRaddeg);
200 Float_t padys = padRadius*TMath::Sin(padAngle/kRaddeg);
201 Float_t padzs = g[2];
203 //Now move to local pad coordinate frame. Translate:
205 Float_t xt = xs-padxs;
206 Float_t yt = ys-padys;
207 Float_t zt = zs-padzs;
210 Float_t alpha = GetAngles(det[1],det[2]);
211 Float_t xr = xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg);
213 Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg);
215 Float_t dist = TMath::Sqrt(xr*xr+yr*yr+zr*zr);
226 //_____________________________________________________________________________
227 Bool_t AliTOFGeometryV4::IsInsideThePadPar(Int_t *det, Float_t *pos)
230 // Returns true if space point with coor pos (x,y,z) (cm) falls
231 // inside pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ)
234 Bool_t isInside=false;
236 //Transform pos into Sector Frame
242 Float_t radius = TMath::Sqrt(x*x+y*y);
243 Float_t phi=TMath::ATan2(y,x);
244 if(phi<0) phi=2.*TMath::Pi()+phi;
245 // Get the local angle in the sector philoc
246 Float_t angle = phi*kRaddeg-( Int_t (kRaddeg*phi/fPhiSec) + 0.5) *fPhiSec;
247 Float_t xs = radius*TMath::Cos(angle/kRaddeg);
248 Float_t ys = radius*TMath::Sin(angle/kRaddeg);
251 // Do the same for the selected pad
256 Float_t padRadius = TMath::Sqrt(g[0]*g[0]+g[1]*g[1]);
257 Float_t padPhi=TMath::ATan2(g[1],g[0]);
258 if(padPhi<0) padPhi=2.*TMath::Pi()+padPhi;
259 // Get the local angle in the sector philoc
260 Float_t padAngle = padPhi*kRaddeg-( Int_t (padPhi*kRaddeg/fPhiSec)+ 0.5) * fPhiSec;
261 Float_t padxs = padRadius*TMath::Cos(padAngle/kRaddeg);
262 Float_t padys = padRadius*TMath::Sin(padAngle/kRaddeg);
263 Float_t padzs = g[2];
265 //Now move to local pad coordinate frame. Translate:
267 Float_t xt = xs-padxs;
268 Float_t yt = ys-padys;
269 Float_t zt = zs-padzs;
273 Float_t alpha = GetAngles(det[1],det[2]);
274 Float_t xr = xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg);
276 Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg);
278 if(TMath::Abs(xr)<=0.75 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5))
285 //_____________________________________________________________________________
286 Float_t AliTOFGeometryV4::DistanceToPad(Int_t *det, TGeoHMatrix mat, Float_t *pos, Float_t *dist3d)
289 // Returns distance of space point with coor pos (x,y,z) (cm) wrt
290 // pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ)
293 printf("ERROR: no TGeo\n");
300 Double_t veclr[3]={-1.,-1.,-1.};
301 Double_t vecl[3]={-1.,-1.,-1.};
302 mat.MasterToLocal(vecg,veclr);
306 //Take into account reflections
312 Float_t dist = TMath::Sqrt(vecl[0]*vecl[0]+vecl[1]*vecl[1]+vecl[2]*vecl[2]);
326 //_____________________________________________________________________________
327 Bool_t AliTOFGeometryV4::IsInsideThePad( Int_t *det, TGeoHMatrix mat, Float_t *pos)
330 // Returns true if space point with coor pos (x,y,z) (cm) falls
331 // inside pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ)
334 const Float_t khsensmy = 0.5; // heigth of Sensitive Layer
340 Double_t veclr[3]={-1.,-1.,-1.};
341 Double_t vecl[3]={-1.,-1.,-1.};
342 mat.MasterToLocal(vecg,veclr);
346 //Take into account reflections
352 Float_t xr = vecl[0];
353 Float_t yr = vecl[1];
354 Float_t zr = vecl[2];
356 Bool_t isInside=false;
357 if(TMath::Abs(xr)<= khsensmy*0.5 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5))
362 //_____________________________________________________________________________
363 Float_t AliTOFGeometryV4::GetX(Int_t *det)
366 // Returns X coordinate (cm)
369 Int_t isector = det[0];
370 Int_t iplate = det[1];
371 Int_t istrip = det[2];
372 Int_t ipadz = det[3];
373 Int_t ipadx = det[4];
375 // Find out distance d on the plane wrt median phi:
376 Float_t d = (ipadx+0.5)*fgkXPad-(kNpadX*fgkXPad)*0.5;
378 // The radius r in xy plane:
379 Float_t r = (fgkRmin+fgkRmax)/2.+fHeights[iplate][istrip]+
380 (ipadz-0.5)*fgkZPad*TMath::Sin(fAngles[iplate][istrip]/kRaddeg)-0.25;
382 // local azimuthal angle in the sector philoc
383 Float_t philoc = TMath:: ATan(d/r);
385 // azimuthal angle in the global frame phi
386 Float_t phi = philoc*kRaddeg+(isector+0.5 )*fPhiSec;
388 Float_t xCoor = r/TMath::Cos(philoc)*TMath::Cos(phi/kRaddeg);
393 //_____________________________________________________________________________
394 Float_t AliTOFGeometryV4::GetY(Int_t *det)
397 // Returns Y coordinate (cm)
400 Int_t isector = det[0];
401 Int_t iplate = det[1];
402 Int_t istrip = det[2];
403 Int_t ipadz = det[3];
404 Int_t ipadx = det[4];
406 // Find out distance d on the plane wrt median phi:
407 Float_t d = (ipadx+0.5)*fgkXPad-(kNpadX*fgkXPad)*0.5;
409 // The radius r in xy plane:
410 Float_t r = (fgkRmin+fgkRmax)/2.+fHeights[iplate][istrip]+
411 (ipadz-0.5)*fgkZPad*TMath::Sin(fAngles[iplate][istrip]/kRaddeg)-0.25;
413 // local azimuthal angle in the sector philoc
414 Float_t philoc = TMath:: ATan(d/r);
416 // azimuthal angle in the global frame phi
417 Float_t phi = philoc*kRaddeg+(isector+0.5 )*fPhiSec;
419 Float_t yCoor = r/TMath::Cos(philoc)*TMath::Sin(phi/kRaddeg);
425 //_____________________________________________________________________________
426 Float_t AliTOFGeometryV4::GetZ(Int_t *det)
429 // Returns Z coordinate (cm)
432 Int_t iplate = det[1];
433 Int_t istrip = det[2];
434 Int_t ipadz = det[3];
436 // The radius r in xy plane:
437 Float_t r = (fgkRmin+fgkRmax)/2.+fHeights[iplate][istrip];
439 Float_t zCoor = r*TMath::Tan(0.5*TMath::Pi()-GetStripTheta(iplate,istrip))-
440 (ipadz-0.5)*fgkZPad*TMath::Cos(fAngles[iplate][istrip]/kRaddeg);
445 //_____________________________________________________________________________
446 Int_t AliTOFGeometryV4::GetSector(Float_t *pos)
449 // Returns the Sector index
457 Float_t phi = TMath::ATan2(y,x);
458 if(phi<0.) phi=2.*TMath::Pi()+phi;
459 iSect = (Int_t) (phi*kRaddeg/fPhiSec);
465 //_____________________________________________________________________________
466 Int_t AliTOFGeometryV4::GetPadX(Float_t *pos)
469 // Returns the Pad index along X
478 Int_t isector = GetSector(pos);
480 AliError("Detector Index could not be determined");
482 Int_t iplate = GetPlate(pos);
484 AliError("Detector Index could not be determined");
486 Int_t istrip = GetStrip(pos);
488 AliError("Detector Index could not be determined");
492 Float_t rho=TMath::Sqrt(x*x+y*y);
493 Float_t phi = TMath::ATan2(y,x);
494 if(phi<0.) phi=2.*TMath::Pi()+phi;
496 // Get the local angle in the sector philoc
497 Float_t philoc = phi*kRaddeg-(isector+0.5)*fPhiSec;
498 philoc*=TMath::Pi()/180.;
499 // theta projected on the median of the sector
500 Float_t theta = TMath::ATan2(rho*TMath::Cos(philoc),z);
501 // The radius r in xy plane:
502 Float_t r = (fgkRmin+fgkRmax)/2.+fHeights[iplate][istrip]+
503 (theta-GetStripTheta(iplate, istrip))/
504 (GetMaxStripTheta(iplate, istrip)-GetMinStripTheta(iplate, istrip))
505 * 2.*fgkZPad*TMath::Sin(fAngles[iplate][istrip]/kRaddeg)-0.25;
507 // Find out distance projected onto the strip plane
508 Float_t d = (r*TMath::Tan(philoc)+(kNpadX*fgkXPad)*0.5);
510 iPadX = (Int_t) ( d/fgkXPad);
514 //_____________________________________________________________________________
515 Int_t AliTOFGeometryV4::GetPlate(Float_t *pos)
518 // Returns the Plate index
522 Int_t isector = GetSector(pos);
524 AliError("Detector Index could not be determined");
531 Float_t rho=TMath::Sqrt(x*x+y*y);
532 Float_t phi=TMath::ATan2(y,x);
533 if(phi<0) phi=2.*TMath::Pi()+phi;
534 // Get the local angle in the sector philoc
535 Float_t philoc = phi*kRaddeg-(isector+0.5)*fPhiSec;
536 philoc*=TMath::Pi()/180.;
537 // theta projected on the median of the sector
538 Float_t theta=TMath::ATan2(rho*TMath::Cos(philoc),z);
540 for (Int_t i=0; i<kNPlates; i++){
541 if ( GetMaxPlateTheta(i) >= theta &&
542 GetMinPlateTheta(i) <= theta)iPlate=i;
549 //_____________________________________________________________________________
550 Int_t AliTOFGeometryV4::GetStrip(Float_t *pos)
553 // Returns the Strip index
559 Int_t isector = GetSector(pos);
561 AliError("Detector Index could not be determined");
563 Int_t iplate = GetPlate(pos);
565 AliError("Detector Index could not be determined");
574 if(iplate==0 || iplate == 4)nstrips=kNStripC;
575 if(iplate==1 || iplate == 3)nstrips=kNStripB;
576 if(iplate==2) nstrips=kNStripA;
578 Float_t rho=TMath::Sqrt(x*x+y*y);
579 Float_t phi=TMath::ATan2(y,x);
580 if(phi<0) phi=2.*TMath::Pi()+phi;
581 // Get the local angle in the sector philoc
582 Float_t philoc = phi*kRaddeg-(isector+0.5)*fPhiSec;
583 philoc*=TMath::Pi()/180.;
584 // theta projected on the median of the sector
585 Float_t theta=TMath::ATan2(rho*TMath::Cos(philoc),z);
587 for (Int_t istrip=0; istrip<nstrips; istrip++){
590 GetMaxStripTheta(iplate,istrip) >= theta
592 GetMinStripTheta(iplate,istrip) <= theta ) iStrip = istrip;
599 //_____________________________________________________________________________
600 Int_t AliTOFGeometryV4::GetPadZ(Float_t *pos)
603 // Returns the Pad index along Z
607 Int_t isector = GetSector(pos);
609 AliError("Detector Index could not be determined");
611 Int_t iplate = GetPlate(pos);
613 AliError("Detector Index could not be determined");
615 Int_t istrip = GetStrip(pos);
617 AliError("Detector Index could not be determined");
625 Float_t rho=TMath::Sqrt(x*x+y*y);
626 Float_t phi=TMath::ATan2(y,x);
627 if(phi<0) phi=2.*TMath::Pi()+phi;
628 Float_t philoc = phi*kRaddeg-(isector+0.5)*fPhiSec;
629 philoc*=TMath::Pi()/180.;
630 Float_t theta=TMath::ATan2(rho*TMath::Cos(philoc),z);
632 if (theta >= GetStripTheta(iplate, istrip))iPadZ=1;
638 //_____________________________________________________________________________
639 Float_t AliTOFGeometryV4::GetMinPlateTheta(Int_t iPlate)
642 // Returns the minimum theta angle of a given plate iPlate (rad)
649 if(iPlate==0)delta = -1. ;
650 if(iPlate==1)delta = -0.5;
651 if(iPlate==3)delta = +0.5;
652 if(iPlate==4)delta = +1. ;
654 Float_t z=(fgkRmin+2.)*TMath::Tan(fAngles[iPlate][index]/kRaddeg)+delta;
655 Float_t r=(fgkRmin+fgkRmax)/2.+fHeights[iPlate][index];
656 z =z+fgkZPad*TMath::Cos(fAngles[iPlate][index]/kRaddeg);
657 r =r-fgkZPad*TMath::Sin(fAngles[iPlate][index]/kRaddeg);
659 Float_t thmin = 0.5*TMath::Pi()-TMath::ATan(z/r)-fgkDprecMin;
663 //_____________________________________________________________________________
664 Float_t AliTOFGeometryV4::GetMaxPlateTheta(Int_t iPlate)
667 // Returns the maximum theta angle of a given plate iPlate (rad)
670 if(iPlate==0 ||iPlate == 4)index=kNStripC-1;
671 if(iPlate==1 ||iPlate == 3)index=kNStripB-1;
672 if(iPlate==2) index=kNStripA-1;
675 if(iPlate==0)delta = -1. ;
676 if(iPlate==1)delta = -0.5;
677 if(iPlate==3)delta = +0.5;
678 if(iPlate==4)delta = +1. ;
680 Float_t z=(fgkRmin+2.)*TMath::Tan(fAngles[iPlate][index]/kRaddeg)+delta;
681 Float_t r=(fgkRmin+fgkRmax)/2.+fHeights[iPlate][index];
682 z =z-fgkZPad*TMath::Cos(fAngles[iPlate][index]/kRaddeg);
683 r= r+fgkZPad*TMath::Sin(fAngles[iPlate][index]/kRaddeg);
685 Float_t thmax = 0.5*TMath::Pi()-TMath::ATan(z/r)+fgkDprecMax;
690 //_____________________________________________________________________________
691 Float_t AliTOFGeometryV4::GetMaxStripTheta(Int_t iPlate, Int_t iStrip)
694 // Returns the maximum theta angle of a given strip iStrip (rad)
699 if(iPlate==0)delta = -1. ;
700 if(iPlate==1)delta = -0.5;
701 if(iPlate==3)delta = +0.5;
702 if(iPlate==4)delta = +1. ;
704 Float_t r =(fgkRmin+fgkRmax)/2.+fHeights[iPlate][iStrip];
705 Float_t z =(fgkRmin+2.)*TMath::Tan(fAngles[iPlate][iStrip]/kRaddeg)+delta;
706 z = z-fgkZPad*TMath::Cos(fAngles[iPlate][iStrip]/kRaddeg);
707 r = r+fgkZPad*TMath::Sin(fAngles[iPlate][iStrip]/kRaddeg);
708 Float_t thmax =0.5*TMath::Pi()-TMath::ATan(z/r)+fgkDprecMax;
712 //_____________________________________________________________________________
713 Float_t AliTOFGeometryV4::GetMinStripTheta(Int_t iPlate, Int_t iStrip)
716 // Returns the minimum theta angle of a given Strip iStrip (rad)
721 if(iPlate==0)delta = -1. ;
722 if(iPlate==1)delta = -0.5;
723 if(iPlate==3)delta = +0.5;
724 if(iPlate==4)delta = +1. ;
727 Float_t r =(fgkRmin+fgkRmax)/2.+fHeights[iPlate][iStrip];
728 Float_t z =(fgkRmin+2.)*TMath::Tan(fAngles[iPlate][iStrip]/kRaddeg)+delta;
729 z =z+fgkZPad*TMath::Cos(fAngles[iPlate][iStrip]/kRaddeg);
730 r =r-fgkZPad*TMath::Sin(fAngles[iPlate][iStrip]/kRaddeg);
731 Float_t thmin =0.5*TMath::Pi()-TMath::ATan(z/r)-fgkDprecMin;
736 //_____________________________________________________________________________
737 Float_t AliTOFGeometryV4::GetStripTheta(Int_t iPlate, Int_t iStrip)
740 // returns the median theta angle of a given strip iStrip (rad)
745 if(iPlate==0)delta = -1. ;
746 if(iPlate==1)delta = -0.5;
747 if(iPlate==3)delta = +0.5;
748 if(iPlate==4)delta = +1. ;
750 Float_t r =(fgkRmin+fgkRmax)/2.+fHeights[iPlate][iStrip];
751 Float_t z =(fgkRmin+2.)*TMath::Tan(fAngles[iPlate][iStrip]/kRaddeg)+delta;
752 Float_t theta =0.5*TMath::Pi()-TMath::ATan(z/r);
754 if(theta > 0.5*TMath::Pi() )theta+=fgkDprecCen;
755 if(theta < 0.5*TMath::Pi() )theta-=fgkDprecCen;
760 //_____________________________________________________________________________
761 void AliTOFGeometryV4::GetVolumePath(Int_t *ind, Char_t *path ) {
762 //--------------------------------------------------------------------
763 // This function returns the colume path of a given pad
764 //--------------------------------------------------------------------
765 Int_t sector = ind[0];
770 Int_t nstrB = NStripB();
771 Int_t nstrC = NStripC();
777 sprintf(string1,"/ALIC_1/B077_1/B075_%i/BTO3_1",icopy);
782 sprintf(string1,"/ALIC_1/B077_1/B071_%i/BTO1_1",icopy);
784 else if(sector==11 || sector==12){
786 sprintf(string1,"/ALIC_1/B077_1/B074_%i/BTO2_1",icopy);
791 sprintf(string1,"/ALIC_1/B077_1/B071_%i/BTO1_1",icopy);
798 sprintf(string2,"FTOC_1/FLTC_0");
799 icopy= nstrC - istrip;
800 sprintf(string3,"FSTR_%i",icopy);
802 else if( modnum ==1){
803 sprintf(string2,"FTOB_1/FLTB_0");
804 icopy= nstrB - istrip;
805 sprintf(string3,"FSTR_%i",icopy);
807 else if( modnum ==2){
808 sprintf(string2,"FTOA_0/FLTA_0");
810 sprintf(string3,"FSTR_%i",icopy);
812 else if( modnum ==3){
813 sprintf(string2,"FTOB_2/FLTB_0");
815 sprintf(string3,"FSTR_%i",icopy);
817 else if( modnum ==4){
818 sprintf(string2,"FTOC_2/FLTC_0");
820 sprintf(string3,"FSTR_%i",icopy);
824 Int_t padz = ind[3]+1;
825 Int_t padx = ind[4]+1;
826 if(modnum==3 || modnum==4){
827 padz = NpadZ() -ind[3];
828 padx = NpadX() -ind[4];
830 sprintf(string4,"FSEN_0/FSEZ_%i/FSEX_%i",padz,padx);
831 sprintf(path,"%s/%s/%s/%s",string1,string2,string3,string4);
835 //_____________________________________________________________________________
836 void AliTOFGeometryV4::GetPos(Int_t *det, Float_t *pos)
839 // Returns space point coor (x,y,z) (cm) for Detector
840 // Indices (iSect,iPlate,iStrip,iPadX,iPadZ)
843 GetVolumePath(det,path );
845 printf("ERROR: no TGeo\n");
847 gGeoManager->cd(path);
849 global = *gGeoManager->GetCurrentMatrix();
850 const Double_t *tr = global.GetTranslation();
856 //_____________________________________________________________________________