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.5 2006/04/20 22:30:50 hristov
19 Coding conventions (Annalisa)
21 Revision 1.4 2006/04/16 22:29:05 hristov
22 Coding conventions (Annalisa)
24 Revision 1.3 2006/03/12 14:38:13 arcelli
25 Changes for TOF Reconstruction using TGeo
27 Revision 1.2 2006/02/28 10:38:00 decaro
28 AliTOFGeometry::fAngles, AliTOFGeometry::fHeights, AliTOFGeometry::fDistances arrays: dimension definition in the right location
30 Revision 1.1 2005/12/15 08:55:33 decaro
31 New TOF geometry description (V5) -G. Cara Romeo and A. De Caro
33 Revision 0.1 2005/07/19 A. De Caro
34 Modify Global methods IsInsideThePad & DistanceToPad
35 according to the PPR TOF geometry
36 Implement Global methods GetPadDx & GetPadDy & GetPadDz
37 Modify Global methods GetDetID & GetPlate & GetSector &
38 GetStrip & GetPadX & GetPadZ
39 according to the PPR TOF geometry
40 Modify Global methods GetPos & GetX & GetY & GetZ
41 according to the PPR TOF geometry
44 ///////////////////////////////////////////////////////////////////////////////
46 // TOF Geometry class (PPR version) //
48 ///////////////////////////////////////////////////////////////////////////////
50 #include "TGeoManager.h"
55 #include "AliTOFGeometryV4.h"
57 extern TGeoManager *gGeoManager;
59 ClassImp(AliTOFGeometryV4)
62 const Float_t AliTOFGeometryV4::fgkZlenA = 106.0; // length (cm) of the A module
63 const Float_t AliTOFGeometryV4::fgkZlenB = 141.0; // length (cm) of the B module
64 const Float_t AliTOFGeometryV4::fgkZlenC = 177.5; // length (cm) of the C module
65 const Float_t AliTOFGeometryV4::fgkMaxhZtof = 371.5; // Max half z-size of TOF (cm)
67 const Float_t AliTOFGeometryV4::fgkDeadBndX = 1.0; // Dead Boundaries of a Strip along X direction (length) (cm)
68 const Float_t AliTOFGeometryV4::fgkDeadBndZ = 1.5; // Dead Boundaries of a Strip along Z direction (width) (cm)
69 const Float_t AliTOFGeometryV4::fgkOverSpc = 15.3; // Space available for sensitive layers in radial direction (cm)
71 const Float_t AliTOFGeometryV4::fgkDprecMin = 0.0000075;//num.prec.tolerance on Thmin
72 const Float_t AliTOFGeometryV4::fgkDprecMax = 0.0000100;//num.prec.tolerance on Thma
73 const Float_t AliTOFGeometryV4::fgkDprecCen = 0.0000005;//num.prec.tolerance on <Theta>
75 const Float_t AliTOFGeometryV4::fgkxTOF = 371.; // Inner radius of the TOF for Reconstruction (cm)
76 const Float_t AliTOFGeometryV4::fgkRmin = 370.; // Inner radius of the TOF (cm)
77 const Float_t AliTOFGeometryV4::fgkRmax = 399.; // Outer radius of the TOF (cm)
79 //_____________________________________________________________________________
80 AliTOFGeometryV4::AliTOFGeometryV4()
84 // AliTOFGeometryV4 default constructor
87 AliTOFGeometry::fNStripC = kNStripC; // number of strips in C type module
89 AliTOFGeometry::fZlenA = fgkZlenA; // length (cm) of the A module
90 AliTOFGeometry::fZlenB = fgkZlenB; // length (cm) of the B module
91 AliTOFGeometry::fZlenC = fgkZlenC; // length (cm) of the C module
92 AliTOFGeometry::fMaxhZtof = fgkMaxhZtof; // Max half z-size of TOF (cm)
94 AliTOFGeometry::fxTOF = fgkxTOF; // Inner radius of the TOF for Reconstruction (cm)
95 AliTOFGeometry::fRmin = fgkRmin; // Inner radius of the TOF (cm)
96 AliTOFGeometry::fRmax = fgkRmax; // Outer radius of the TOF (cm)
102 //_____________________________________________________________________________
103 AliTOFGeometryV4::~AliTOFGeometryV4()
106 // AliTOFGeometryV4 destructor
110 //_____________________________________________________________________________
111 void AliTOFGeometryV4::ImportGeometry(){
112 TGeoManager::Import("geometry.root");
114 //_____________________________________________________________________________
115 void AliTOFGeometryV4::Init()
118 // Initialize strip Tilt Angles and Heights
120 // Strips Tilt Angles
122 fPhiSec = 360./kNSectors;
124 Float_t const kangles[kNPlates][kMaxNstrip] ={
126 {44.494, 43.725, 42.946, 42.156, 41.357, 40.548, 39.729, 38.899,
127 38.060, 37.211, 36.353, 35.484, 34.606, 33.719, 32.822, 31.916,
128 31.001, 30.077, 29.144, 28.202 },
130 {26.884, 25.922, 24.952, 23.975, 22.989, 22.320, 21.016, 20.309,
131 19.015, 18.270, 16.989, 16.205, 14.941, 14.117, 12.871, 12.008,
132 10.784, 9.8807, 8.681, 0.0 },
134 { 7.5835, 6.4124, 5.4058, 4.2809, 3.2448, 2.1424, 1.078, -0., -1.078,
135 -2.1424, -3.2448, -4.2809, -5.4058, -6.4124, -7.5835, 0.0, 0.0, 0.0,
138 {-8.681, -9.8807, -10.784, -12.008, -12.871, -14.117, -14.941, -16.205,
139 -16.989, -18.27, -19.015, -20.309, -21.016, -22.32, -22.989,
140 -23.975, -24.952, -25.922, -26.884, 0. },
142 {-28.202, -29.144, -30.077, -31.001, -31.916, -32.822, -33.719, -34.606,
143 -35.484, -36.353, -37.211, -38.06, -38.899, -39.729, -40.548,
144 -41.357, -42.156, -42.946, -43.725, -44.494 }};
149 Float_t const kheights[kNPlates][kMaxNstrip]= {
151 {-5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5,
152 -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5 },
154 {-6.3, -7.1, -7.9, -8.7, -9.5, -3, -9.5, -3, -9.5, -3,
155 -9.5, -3.0, -9.5, -3.0, -9.5, -3, -9.5, -3, -9 , 0.},
157 { -3, -9, -4.5, -9, -4.5, -9, -4.5, -9, -4.5, -9,
158 -4.5, -9, -4.5, -9, -3, 0.0, 0.0, 0.0, 0.0, 0.0 },
160 { -9, -3, -9.5, -3, -9.5, -3, -9.5, -3, -9.5, -3, -9.5,
161 -3, -9.5, -3, -9.5, -8.7, -7.9, -7.1, -6.3, 0. },
163 {-5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5,
164 -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5 }};
166 // Deposit in fAngles, fHeights
168 for (Int_t iplate = 0; iplate < kNPlates; iplate++) {
169 for (Int_t istrip = 0; istrip < kMaxNstrip; istrip++) {
170 AliTOFGeometry::fAngles[iplate][istrip] = kangles[iplate][istrip];
171 AliTOFGeometry::fHeights[iplate][istrip] = kheights[iplate][istrip];
177 //_____________________________________________________________________________
178 Float_t AliTOFGeometryV4::DistanceToPadPar(Int_t *det, Float_t *pos, Float_t *dist3d) const
181 // Returns distance of space point with coor pos (x,y,z) (cm) wrt
182 // pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ)
185 //Transform pos into Sector Frame
191 Float_t radius = TMath::Sqrt(x*x+y*y);
192 Float_t phi=TMath::ATan2(y,x);
193 if(phi<0) phi=2.*TMath::Pi()+phi;
194 // Get the local angle in the sector philoc
195 Float_t angle = phi*kRaddeg-( Int_t (kRaddeg*phi/fPhiSec) + 0.5)*fPhiSec;
196 Float_t xs = radius*TMath::Cos(angle/kRaddeg);
197 Float_t ys = radius*TMath::Sin(angle/kRaddeg);
200 // Do the same for the selected pad
205 Float_t padRadius = TMath::Sqrt(g[0]*g[0]+g[1]*g[1]);
206 Float_t padPhi=TMath::ATan2(g[1],g[0]);
207 if(padPhi<0) padPhi=2.*TMath::Pi()+padPhi;
208 // Get the local angle in the sector philoc
209 Float_t padAngle = padPhi*kRaddeg-( Int_t (padPhi*kRaddeg/fPhiSec)+ 0.5) * fPhiSec;
210 Float_t padxs = padRadius*TMath::Cos(padAngle/kRaddeg);
211 Float_t padys = padRadius*TMath::Sin(padAngle/kRaddeg);
212 Float_t padzs = g[2];
214 //Now move to local pad coordinate frame. Translate:
216 Float_t xt = xs-padxs;
217 Float_t yt = ys-padys;
218 Float_t zt = zs-padzs;
221 Float_t alpha = GetAngles(det[1],det[2]);
222 Float_t xr = xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg);
224 Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg);
226 Float_t dist = TMath::Sqrt(xr*xr+yr*yr+zr*zr);
237 //_____________________________________________________________________________
238 Bool_t AliTOFGeometryV4::IsInsideThePadPar(Int_t *det, Float_t *pos) const
241 // Returns true if space point with coor pos (x,y,z) (cm) falls
242 // inside pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ)
245 Bool_t isInside=false;
247 //Transform pos into Sector Frame
253 Float_t radius = TMath::Sqrt(x*x+y*y);
254 Float_t phi=TMath::ATan2(y,x);
255 if(phi<0) phi=2.*TMath::Pi()+phi;
256 // Get the local angle in the sector philoc
257 Float_t angle = phi*kRaddeg-( Int_t (kRaddeg*phi/fPhiSec) + 0.5) *fPhiSec;
258 Float_t xs = radius*TMath::Cos(angle/kRaddeg);
259 Float_t ys = radius*TMath::Sin(angle/kRaddeg);
262 // Do the same for the selected pad
267 Float_t padRadius = TMath::Sqrt(g[0]*g[0]+g[1]*g[1]);
268 Float_t padPhi=TMath::ATan2(g[1],g[0]);
269 if(padPhi<0) padPhi=2.*TMath::Pi()+padPhi;
270 // Get the local angle in the sector philoc
271 Float_t padAngle = padPhi*kRaddeg-( Int_t (padPhi*kRaddeg/fPhiSec)+ 0.5) * fPhiSec;
272 Float_t padxs = padRadius*TMath::Cos(padAngle/kRaddeg);
273 Float_t padys = padRadius*TMath::Sin(padAngle/kRaddeg);
274 Float_t padzs = g[2];
276 //Now move to local pad coordinate frame. Translate:
278 Float_t xt = xs-padxs;
279 Float_t yt = ys-padys;
280 Float_t zt = zs-padzs;
284 Float_t alpha = GetAngles(det[1],det[2]);
285 Float_t xr = xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg);
287 Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg);
289 if(TMath::Abs(xr)<=0.75 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5))
296 //_____________________________________________________________________________
297 Float_t AliTOFGeometryV4::DistanceToPad(Int_t *det, TGeoHMatrix mat, Float_t *pos, Float_t *dist3d) const
300 // Returns distance of space point with coor pos (x,y,z) (cm) wrt
301 // pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ)
304 printf("ERROR: no TGeo\n");
311 Double_t veclr[3]={-1.,-1.,-1.};
312 Double_t vecl[3]={-1.,-1.,-1.};
313 mat.MasterToLocal(vecg,veclr);
317 //Take into account reflections
323 Float_t dist = TMath::Sqrt(vecl[0]*vecl[0]+vecl[1]*vecl[1]+vecl[2]*vecl[2]);
337 //_____________________________________________________________________________
338 Bool_t AliTOFGeometryV4::IsInsideThePad( Int_t *det, TGeoHMatrix mat, Float_t *pos) const
341 // Returns true if space point with coor pos (x,y,z) (cm) falls
342 // inside pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ)
345 const Float_t khsensmy = 0.5; // heigth of Sensitive Layer
351 Double_t veclr[3]={-1.,-1.,-1.};
352 Double_t vecl[3]={-1.,-1.,-1.};
353 mat.MasterToLocal(vecg,veclr);
357 //Take into account reflections
363 Float_t xr = vecl[0];
364 Float_t yr = vecl[1];
365 Float_t zr = vecl[2];
367 Bool_t isInside=false;
368 if(TMath::Abs(xr)<= khsensmy*0.5 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5))
373 //_____________________________________________________________________________
374 Float_t AliTOFGeometryV4::GetX(Int_t *det) const
377 // Returns X coordinate (cm)
380 Int_t isector = det[0];
381 Int_t iplate = det[1];
382 Int_t istrip = det[2];
383 Int_t ipadz = det[3];
384 Int_t ipadx = det[4];
386 // Find out distance d on the plane wrt median phi:
387 Float_t d = (ipadx+0.5)*fgkXPad-(kNpadX*fgkXPad)*0.5;
389 // The radius r in xy plane:
390 Float_t r = (fgkRmin+fgkRmax)/2.+fHeights[iplate][istrip]+
391 (ipadz-0.5)*fgkZPad*TMath::Sin(fAngles[iplate][istrip]/kRaddeg)-0.25;
393 // local azimuthal angle in the sector philoc
394 Float_t philoc = TMath:: ATan(d/r);
396 // azimuthal angle in the global frame phi
397 Float_t phi = philoc*kRaddeg+(isector+0.5 )*fPhiSec;
399 Float_t xCoor = r/TMath::Cos(philoc)*TMath::Cos(phi/kRaddeg);
404 //_____________________________________________________________________________
405 Float_t AliTOFGeometryV4::GetY(Int_t *det) const
408 // Returns Y coordinate (cm)
411 Int_t isector = det[0];
412 Int_t iplate = det[1];
413 Int_t istrip = det[2];
414 Int_t ipadz = det[3];
415 Int_t ipadx = det[4];
417 // Find out distance d on the plane wrt median phi:
418 Float_t d = (ipadx+0.5)*fgkXPad-(kNpadX*fgkXPad)*0.5;
420 // The radius r in xy plane:
421 Float_t r = (fgkRmin+fgkRmax)/2.+fHeights[iplate][istrip]+
422 (ipadz-0.5)*fgkZPad*TMath::Sin(fAngles[iplate][istrip]/kRaddeg)-0.25;
424 // local azimuthal angle in the sector philoc
425 Float_t philoc = TMath:: ATan(d/r);
427 // azimuthal angle in the global frame phi
428 Float_t phi = philoc*kRaddeg+(isector+0.5 )*fPhiSec;
430 Float_t yCoor = r/TMath::Cos(philoc)*TMath::Sin(phi/kRaddeg);
436 //_____________________________________________________________________________
437 Float_t AliTOFGeometryV4::GetZ(Int_t *det) const
440 // Returns Z coordinate (cm)
443 Int_t iplate = det[1];
444 Int_t istrip = det[2];
445 Int_t ipadz = det[3];
447 // The radius r in xy plane:
448 Float_t r = (fgkRmin+fgkRmax)/2.+fHeights[iplate][istrip];
450 Float_t zCoor = r*TMath::Tan(0.5*TMath::Pi()-GetStripTheta(iplate,istrip))-
451 (ipadz-0.5)*fgkZPad*TMath::Cos(fAngles[iplate][istrip]/kRaddeg);
456 //_____________________________________________________________________________
457 Int_t AliTOFGeometryV4::GetSector(Float_t *pos) const
460 // Returns the Sector index
468 Float_t phi = TMath::ATan2(y,x);
469 if(phi<0.) phi=2.*TMath::Pi()+phi;
470 iSect = (Int_t) (phi*kRaddeg/fPhiSec);
476 //_____________________________________________________________________________
477 Int_t AliTOFGeometryV4::GetPadX(Float_t *pos) const
480 // Returns the Pad index along X
489 Int_t isector = GetSector(pos);
491 AliError("Detector Index could not be determined");
493 Int_t iplate = GetPlate(pos);
495 AliError("Detector Index could not be determined");
497 Int_t istrip = GetStrip(pos);
499 AliError("Detector Index could not be determined");
503 Float_t rho=TMath::Sqrt(x*x+y*y);
504 Float_t phi = TMath::ATan2(y,x);
505 if(phi<0.) phi=2.*TMath::Pi()+phi;
507 // Get the local angle in the sector philoc
508 Float_t philoc = phi*kRaddeg-(isector+0.5)*fPhiSec;
509 philoc*=TMath::Pi()/180.;
510 // theta projected on the median of the sector
511 Float_t theta = TMath::ATan2(rho*TMath::Cos(philoc),z);
512 // The radius r in xy plane:
513 Float_t r = (fgkRmin+fgkRmax)/2.+fHeights[iplate][istrip]+
514 (theta-GetStripTheta(iplate, istrip))/
515 (GetMaxStripTheta(iplate, istrip)-GetMinStripTheta(iplate, istrip))
516 * 2.*fgkZPad*TMath::Sin(fAngles[iplate][istrip]/kRaddeg)-0.25;
518 // Find out distance projected onto the strip plane
519 Float_t d = (r*TMath::Tan(philoc)+(kNpadX*fgkXPad)*0.5);
521 iPadX = (Int_t) ( d/fgkXPad);
525 //_____________________________________________________________________________
526 Int_t AliTOFGeometryV4::GetPlate(Float_t *pos) const
529 // Returns the Plate index
533 Int_t isector = GetSector(pos);
535 AliError("Detector Index could not be determined");
542 Float_t rho=TMath::Sqrt(x*x+y*y);
543 Float_t phi=TMath::ATan2(y,x);
544 if(phi<0) phi=2.*TMath::Pi()+phi;
545 // Get the local angle in the sector philoc
546 Float_t philoc = phi*kRaddeg-(isector+0.5)*fPhiSec;
547 philoc*=TMath::Pi()/180.;
548 // theta projected on the median of the sector
549 Float_t theta=TMath::ATan2(rho*TMath::Cos(philoc),z);
551 for (Int_t i=0; i<kNPlates; i++){
552 if ( GetMaxPlateTheta(i) >= theta &&
553 GetMinPlateTheta(i) <= theta)iPlate=i;
560 //_____________________________________________________________________________
561 Int_t AliTOFGeometryV4::GetStrip(Float_t *pos) const
564 // Returns the Strip index
570 Int_t isector = GetSector(pos);
572 AliError("Detector Index could not be determined");
574 Int_t iplate = GetPlate(pos);
576 AliError("Detector Index could not be determined");
585 if(iplate==0 || iplate == 4)nstrips=kNStripC;
586 if(iplate==1 || iplate == 3)nstrips=kNStripB;
587 if(iplate==2) nstrips=kNStripA;
589 Float_t rho=TMath::Sqrt(x*x+y*y);
590 Float_t phi=TMath::ATan2(y,x);
591 if(phi<0) phi=2.*TMath::Pi()+phi;
592 // Get the local angle in the sector philoc
593 Float_t philoc = phi*kRaddeg-(isector+0.5)*fPhiSec;
594 philoc*=TMath::Pi()/180.;
595 // theta projected on the median of the sector
596 Float_t theta=TMath::ATan2(rho*TMath::Cos(philoc),z);
598 for (Int_t istrip=0; istrip<nstrips; istrip++){
601 GetMaxStripTheta(iplate,istrip) >= theta
603 GetMinStripTheta(iplate,istrip) <= theta ) iStrip = istrip;
610 //_____________________________________________________________________________
611 Int_t AliTOFGeometryV4::GetPadZ(Float_t *pos) const
614 // Returns the Pad index along Z
618 Int_t isector = GetSector(pos);
620 AliError("Detector Index could not be determined");
622 Int_t iplate = GetPlate(pos);
624 AliError("Detector Index could not be determined");
626 Int_t istrip = GetStrip(pos);
628 AliError("Detector Index could not be determined");
636 Float_t rho=TMath::Sqrt(x*x+y*y);
637 Float_t phi=TMath::ATan2(y,x);
638 if(phi<0) phi=2.*TMath::Pi()+phi;
639 Float_t philoc = phi*kRaddeg-(isector+0.5)*fPhiSec;
640 philoc*=TMath::Pi()/180.;
641 Float_t theta=TMath::ATan2(rho*TMath::Cos(philoc),z);
643 if (theta >= GetStripTheta(iplate, istrip))iPadZ=1;
649 //_____________________________________________________________________________
650 Float_t AliTOFGeometryV4::GetMinPlateTheta(Int_t iPlate) const
653 // Returns the minimum theta angle of a given plate iPlate (rad)
660 if(iPlate==0)delta = -1. ;
661 if(iPlate==1)delta = -0.5;
662 if(iPlate==3)delta = +0.5;
663 if(iPlate==4)delta = +1. ;
665 Float_t z=(fgkRmin+2.)*TMath::Tan(fAngles[iPlate][index]/kRaddeg)+delta;
666 Float_t r=(fgkRmin+fgkRmax)/2.+fHeights[iPlate][index];
667 z =z+fgkZPad*TMath::Cos(fAngles[iPlate][index]/kRaddeg);
668 r =r-fgkZPad*TMath::Sin(fAngles[iPlate][index]/kRaddeg);
670 Float_t thmin = 0.5*TMath::Pi()-TMath::ATan(z/r)-fgkDprecMin;
674 //_____________________________________________________________________________
675 Float_t AliTOFGeometryV4::GetMaxPlateTheta(Int_t iPlate) const
678 // Returns the maximum theta angle of a given plate iPlate (rad)
681 if(iPlate==0 ||iPlate == 4)index=kNStripC-1;
682 if(iPlate==1 ||iPlate == 3)index=kNStripB-1;
683 if(iPlate==2) index=kNStripA-1;
686 if(iPlate==0)delta = -1. ;
687 if(iPlate==1)delta = -0.5;
688 if(iPlate==3)delta = +0.5;
689 if(iPlate==4)delta = +1. ;
691 Float_t z=(fgkRmin+2.)*TMath::Tan(fAngles[iPlate][index]/kRaddeg)+delta;
692 Float_t r=(fgkRmin+fgkRmax)/2.+fHeights[iPlate][index];
693 z =z-fgkZPad*TMath::Cos(fAngles[iPlate][index]/kRaddeg);
694 r= r+fgkZPad*TMath::Sin(fAngles[iPlate][index]/kRaddeg);
696 Float_t thmax = 0.5*TMath::Pi()-TMath::ATan(z/r)+fgkDprecMax;
701 //_____________________________________________________________________________
702 Float_t AliTOFGeometryV4::GetMaxStripTheta(Int_t iPlate, Int_t iStrip) const
705 // Returns the maximum theta angle of a given strip iStrip (rad)
710 if(iPlate==0)delta = -1. ;
711 if(iPlate==1)delta = -0.5;
712 if(iPlate==3)delta = +0.5;
713 if(iPlate==4)delta = +1. ;
715 Float_t r =(fgkRmin+fgkRmax)/2.+fHeights[iPlate][iStrip];
716 Float_t z =(fgkRmin+2.)*TMath::Tan(fAngles[iPlate][iStrip]/kRaddeg)+delta;
717 z = z-fgkZPad*TMath::Cos(fAngles[iPlate][iStrip]/kRaddeg);
718 r = r+fgkZPad*TMath::Sin(fAngles[iPlate][iStrip]/kRaddeg);
719 Float_t thmax =0.5*TMath::Pi()-TMath::ATan(z/r)+fgkDprecMax;
723 //_____________________________________________________________________________
724 Float_t AliTOFGeometryV4::GetMinStripTheta(Int_t iPlate, Int_t iStrip) const
727 // Returns the minimum theta angle of a given Strip iStrip (rad)
732 if(iPlate==0)delta = -1. ;
733 if(iPlate==1)delta = -0.5;
734 if(iPlate==3)delta = +0.5;
735 if(iPlate==4)delta = +1. ;
738 Float_t r =(fgkRmin+fgkRmax)/2.+fHeights[iPlate][iStrip];
739 Float_t z =(fgkRmin+2.)*TMath::Tan(fAngles[iPlate][iStrip]/kRaddeg)+delta;
740 z =z+fgkZPad*TMath::Cos(fAngles[iPlate][iStrip]/kRaddeg);
741 r =r-fgkZPad*TMath::Sin(fAngles[iPlate][iStrip]/kRaddeg);
742 Float_t thmin =0.5*TMath::Pi()-TMath::ATan(z/r)-fgkDprecMin;
747 //_____________________________________________________________________________
748 Float_t AliTOFGeometryV4::GetStripTheta(Int_t iPlate, Int_t iStrip) const
751 // returns the median theta angle of a given strip iStrip (rad)
756 if(iPlate==0)delta = -1. ;
757 if(iPlate==1)delta = -0.5;
758 if(iPlate==3)delta = +0.5;
759 if(iPlate==4)delta = +1. ;
761 Float_t r =(fgkRmin+fgkRmax)/2.+fHeights[iPlate][iStrip];
762 Float_t z =(fgkRmin+2.)*TMath::Tan(fAngles[iPlate][iStrip]/kRaddeg)+delta;
763 Float_t theta =0.5*TMath::Pi()-TMath::ATan(z/r);
765 if(theta > 0.5*TMath::Pi() )theta+=fgkDprecCen;
766 if(theta < 0.5*TMath::Pi() )theta-=fgkDprecCen;
771 //_____________________________________________________________________________
772 void AliTOFGeometryV4::GetVolumePath(Int_t *ind, Char_t *path ) {
773 //--------------------------------------------------------------------
774 // This function returns the colume path of a given pad
775 //--------------------------------------------------------------------
776 Int_t sector = ind[0];
781 Int_t nstrB = NStripB();
782 Int_t nstrC = NStripC();
788 sprintf(string1,"/ALIC_1/B077_1/B075_%i/BTO3_1",icopy);
793 sprintf(string1,"/ALIC_1/B077_1/B071_%i/BTO1_1",icopy);
795 else if(sector==11 || sector==12){
797 sprintf(string1,"/ALIC_1/B077_1/B074_%i/BTO2_1",icopy);
802 sprintf(string1,"/ALIC_1/B077_1/B071_%i/BTO1_1",icopy);
809 sprintf(string2,"FTOC_1/FLTC_0");
810 icopy= nstrC - istrip;
811 sprintf(string3,"FSTR_%i",icopy);
813 else if( modnum ==1){
814 sprintf(string2,"FTOB_1/FLTB_0");
815 icopy= nstrB - istrip;
816 sprintf(string3,"FSTR_%i",icopy);
818 else if( modnum ==2){
819 sprintf(string2,"FTOA_0/FLTA_0");
821 sprintf(string3,"FSTR_%i",icopy);
823 else if( modnum ==3){
824 sprintf(string2,"FTOB_2/FLTB_0");
826 sprintf(string3,"FSTR_%i",icopy);
828 else if( modnum ==4){
829 sprintf(string2,"FTOC_2/FLTC_0");
831 sprintf(string3,"FSTR_%i",icopy);
835 Int_t padz = ind[3]+1;
836 Int_t padx = ind[4]+1;
837 if(modnum==3 || modnum==4){
838 padz = NpadZ() -ind[3];
839 padx = NpadX() -ind[4];
841 sprintf(string4,"FSEN_0/FSEZ_%i/FSEX_%i",padz,padx);
842 sprintf(path,"%s/%s/%s/%s",string1,string2,string3,string4);
846 //_____________________________________________________________________________
847 void AliTOFGeometryV4::GetVolumePath(Int_t sector, Char_t *path ) {
848 //--------------------------------------------------------------------
849 // This function returns the colume path of a given sector
850 //--------------------------------------------------------------------
857 sprintf(string,"/ALIC_1/B077_1/B075_%i/BTO3_1",icopy);
862 sprintf(string,"/ALIC_1/B077_1/B071_%i/BTO1_1",icopy);
864 else if(sector==11 || sector==12){
866 sprintf(string,"/ALIC_1/B077_1/B074_%i/BTO2_1",icopy);
871 sprintf(string,"/ALIC_1/B077_1/B071_%i/BTO1_1",icopy);
874 sprintf(path,"%s",string);
877 //_____________________________________________________________________________
878 void AliTOFGeometryV4::GetVolumePath(Int_t sector, Int_t plate, Int_t strip, Char_t *path ) {
879 //--------------------------------------------------------------------
880 // This function returns the colume path of a given strip
881 //--------------------------------------------------------------------
885 Int_t nstrB = NStripB();
886 Int_t nstrC = NStripC();
892 sprintf(string1,"/ALIC_1/B077_1/B075_%i/BTO3_1",icopy);
897 sprintf(string1,"/ALIC_1/B077_1/B071_%i/BTO1_1",icopy);
899 else if(sector==11 || sector==12){
901 sprintf(string1,"/ALIC_1/B077_1/B074_%i/BTO2_1",icopy);
906 sprintf(string1,"/ALIC_1/B077_1/B071_%i/BTO1_1",icopy);
910 sprintf(string2,"FTOC_1/FLTC_0");
911 icopy = nstrC - strip;
912 sprintf(string3,"FSTR_%i",icopy);
915 sprintf(string2,"FTOB_1/FLTB_0");
916 icopy = nstrB - strip;
917 sprintf(string3,"FSTR_%i",icopy);
920 sprintf(string2,"FTOA_0/FLTA_0");
922 sprintf(string3,"FSTR_%i",icopy);
925 sprintf(string2,"FTOB_2/FLTB_0");
927 sprintf(string3,"FSTR_%i",icopy);
930 sprintf(string2,"FTOC_2/FLTC_0");
932 sprintf(string3,"FSTR_%i",icopy);
935 sprintf(path,"%s/%s/%s/FSEN_0",string1,string2,string3);
939 //_____________________________________________________________________________
940 void AliTOFGeometryV4::GetPos(Int_t *det, Float_t *pos)
943 // Returns space point coor (x,y,z) (cm) for Detector
944 // Indices (iSect,iPlate,iStrip,iPadX,iPadZ)
947 GetVolumePath(det,path );
949 printf("ERROR: no TGeo\n");
951 gGeoManager->cd(path);
953 global = *gGeoManager->GetCurrentMatrix();
954 const Double_t *tr = global.GetTranslation();
960 //_____________________________________________________________________________