]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TOF/AliTOFGeometry.cxx
Track reconstruction code for TOF: updating
[u/mrichter/AliRoot.git] / TOF / AliTOFGeometry.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
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  **************************************************************************/
15
16 /*
17 $Log$
18 Revision 1.3  2003/12/29 18:40:39  hristov
19 Copy/paste error corrected
20
21 Revision 1.2  2003/12/29 17:26:01  hristov
22 Using enum to initaialize static ints in the header file, the initialization of static floats moved to the implementation file
23
24 Revision 1.1  2003/12/29 15:18:03  decaro
25 TOF geometry updating (addition of AliTOFGeometry)
26
27 Revision 0.01  2003/12/04 S.Arcelli
28 Revision 0.02  2003/12/10 S.Arcelli:
29         Implement Global methods GetPos & GetDetID 
30 Revision 0.03  2003/12/14 S.Arcelli
31         Set Phi range [-180,180]->[0,360] 
32 Revision 0.03  2004/4/05 S.Arcelli
33         Implement Global methods IsInsideThePad 
34                                   DistanceToPad 
35 */
36
37 #include <stdlib.h>
38 #include <Riostream.h>
39 ///////////////////////////////////////////////////////////////////////////////
40 //                                                                           //
41 //  TOF Geometry class                                                       //
42 //                                                                           //
43 ///////////////////////////////////////////////////////////////////////////////
44
45 #include "AliConst.h"
46 #include "AliTOFGeometry.h"
47
48 ClassImp(AliTOFGeometry)
49
50 const Int_t AliTOFGeometry::fgkTimeDiff   = 25000;// Min signal separation (ps)
51
52 const Float_t AliTOFGeometry::fgkxTOF     = 371.; // Inner radius of the TOF for Reconstruction (cm)
53 const Float_t AliTOFGeometry::fgkRmin     = 370.; // Inner radius of the TOF (cm)
54 const Float_t AliTOFGeometry::fgkRmax     = 399;  // Outer radius of the TOF (cm)
55 const Float_t AliTOFGeometry::fgkZlenA    = 106.0;// length (cm) of the A module
56 const Float_t AliTOFGeometry::fgkZlenB    = 141.0;// length (cm) of the B module
57 const Float_t AliTOFGeometry::fgkZlenC    = 177.5;// length (cm) of the C module
58 const Float_t AliTOFGeometry::fgkXPad     = 2.5;  // Pad size in the x direction (cm)
59 const Float_t AliTOFGeometry::fgkZPad     = 3.5;  // Pad size in the z direction (cm)
60 const Float_t AliTOFGeometry::fgkMaxhZtof = 371.5;// Max half z-size of TOF (cm)
61
62
63 const Float_t AliTOFGeometry::fgkSigmaForTail1= 2.;//Sig1 for simulation of TDC tails 
64 const Float_t AliTOFGeometry::fgkSigmaForTail2= 0.5;//Sig2 for simulation of TDC tails
65 const Float_t AliTOFGeometry::fgkSpeedOfLight = 0.299792458;// c (10^9 m/s)
66 const Float_t AliTOFGeometry::fgkPionMass     = 0.13957;// pion mass (Gev/c^2)
67 const Float_t AliTOFGeometry::fgkKaonMass     = 0.49368;// kaon mass (Gev/c^2)
68 const Float_t AliTOFGeometry::fgkProtonMass   = 0.93827;// proton mass (Gev/c^2)
69 const Float_t AliTOFGeometry::fgkElectronMass = 0.00051;// electron mass (Gev/c^2)
70 const Float_t AliTOFGeometry::fgkMuonMass     = 0.10566;// muon mass (Gev/c^2)
71
72
73 const Float_t AliTOFGeometry::fgkDprecMin = 0.0000075;//num.prec.tolerance on Thmin 
74 const Float_t AliTOFGeometry::fgkDprecMax = 0.0000100;//num.prec.tolerance on Thma 
75 const Float_t AliTOFGeometry::fgkDprecCen = 0.0000005;//num.prec.tolerance on <Theta> 
76
77 //_____________________________________________________________________________
78 AliTOFGeometry::AliTOFGeometry()
79 {
80   //
81   // AliTOFGeometry default constructor
82   //
83   Init();
84
85 }
86
87 //_____________________________________________________________________________
88 AliTOFGeometry::~AliTOFGeometry()
89 {
90   //
91   // AliTOFGeometry destructor
92   //
93
94 }
95 //_____________________________________________________________________________
96 void AliTOFGeometry::Init()
97 {
98   //
99   // Initialize strip Tilt Angles and Heights
100   //
101   // Strips Tilt Angles
102  
103   Float_t const kangles[kNPlates][kMaxNstrip] ={
104
105  {44.494, 43.725, 42.946, 42.156, 41.357, 40.548, 39.729, 38.899, 
106   38.060, 37.211, 36.353, 35.484, 34.606, 33.719, 32.822, 31.916, 
107   31.001, 30.077, 29.144, 28.202 },
108
109  {26.884, 25.922, 24.952, 23.975, 22.989, 22.320, 21.016, 20.309,
110   19.015, 18.270, 16.989, 16.205, 14.941, 14.117, 12.871, 12.008,
111   10.784, 9.8807, 8.681, 0.0 },
112
113  { 7.5835, 6.4124, 5.4058, 4.2809, 3.2448,  2.1424, 1.078, -0., -1.078, 
114   -2.1424, -3.2448, -4.2809, -5.4058, -6.4124, -7.5835, 0.0, 0.0, 0.0,
115   0.0, 0.0 },
116   
117  {-8.681, -9.8807, -10.784, -12.008, -12.871, -14.117, -14.941, -16.205,
118   -16.989, -18.27, -19.015, -20.309, -21.016, -22.32, -22.989,
119    -23.975, -24.952, -25.922, -26.884, 0. },
120   
121  {-28.202, -29.144, -30.077, -31.001, -31.916, -32.822, -33.719, -34.606,
122   -35.484, -36.353, -37.211, -38.06, -38.899, -39.729, -40.548,
123    -41.357, -42.156, -42.946, -43.725, -44.494 }};
124
125
126   //Strips Heights
127
128    Float_t const kheights[kNPlates][kMaxNstrip]= {
129
130   {-5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5,
131    -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5 },
132   
133   {-6.3, -7.1, -7.9, -8.7, -9.5, -3, -9.5,   -3, -9.5,   -3, 
134    -9.5, -3.0, -9.5, -3.0, -9.5, -3, -9.5,   -3,   -9 , 0.},
135   
136   {  -3,   -9, -4.5,   -9, -4.5,     -9, -4.5,   -9, -4.5,   -9, 
137      -4.5,   -9, -4.5,   -9,   -3,   0.0, 0.0, 0.0, 0.0, 0.0 },
138   
139   {  -9,   -3, -9.5,   -3, -9.5, -3, -9.5,   -3, -9.5,   -3, -9.5,
140      -3, -9.5,   -3, -9.5,  -8.7, -7.9, -7.1, -6.3, 0. },
141   
142   {-5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5,
143    -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5 }};
144
145
146    // Deposit in fAngles, fHeights
147
148   for (Int_t iplate = 0; iplate < kNPlates; iplate++) {
149     for (Int_t istrip = 0; istrip < kMaxNstrip; istrip++) {
150       fAngles[iplate][istrip]   = kangles[iplate][istrip];
151       fHeights[iplate][istrip]  = kheights[iplate][istrip];
152     }
153   }
154
155   fPhiSec   = 360./kNSectors;
156 }
157
158 //_____________________________________________________________________________
159 Float_t AliTOFGeometry::DistanceToPad(Int_t *det, Float_t *pos) 
160 {
161 //
162 // Returns distance of  space point with coor pos (x,y,z) (cm) wrt 
163 // pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ) 
164 //
165     
166   //Transform pos into Sector Frame
167
168   Float_t x = pos[0];
169   Float_t y = pos[1];
170   Float_t z = pos[2];
171
172   Float_t radius = TMath::Sqrt(x*x+y*y);
173   Float_t phi=TMath::ATan2(y,x);        
174   if(phi<0) phi=2.*TMath::Pi()+phi;
175   //  Get the local angle in the sector philoc
176   Float_t angle   = phi*kRaddeg-( Int_t (kRaddeg*phi/20.) + 0.5)*fPhiSec;
177   Float_t xs = radius*TMath::Cos(angle/kRaddeg);
178   Float_t ys = radius*TMath::Sin(angle/kRaddeg);
179   Float_t zs = z;
180
181   // Do the same for the selected pad
182
183   Float_t g[3];
184   GetPos(det,g);
185
186   Float_t padRadius = TMath::Sqrt(g[0]*g[0]+g[1]*g[1]);
187   Float_t padPhi=TMath::ATan2(g[1],g[0]);       
188   if(padPhi<0) padPhi=2.*TMath::Pi()+padPhi;
189   //  Get the local angle in the sector philoc
190   Float_t padAngle   = padPhi*kRaddeg-( Int_t (padPhi*kRaddeg/20.)+ 0.5) * fPhiSec; 
191   Float_t padxs = padRadius*TMath::Cos(padAngle/kRaddeg);
192   Float_t padys = padRadius*TMath::Sin(padAngle/kRaddeg);
193   Float_t padzs = g[2];
194   
195   //Now move to local pad coordinate frame. Translate:
196   
197   Float_t xt = xs-padxs;
198   Float_t yt = ys-padys;
199   Float_t zt = zs-padzs;
200   //Now Rotate:
201   
202   Float_t alpha = GetAngles(det[1],det[2]);
203   Float_t xr = xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg);
204   Float_t yr = yt;
205   Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg);
206
207   Float_t dist = TMath::Sqrt(xr*xr+yr*yr+zr*zr);
208   return dist;
209
210 }
211
212
213 //_____________________________________________________________________________
214 Bool_t AliTOFGeometry::IsInsideThePad(Int_t *det, Float_t *pos) 
215 {
216 //
217 // Returns true if space point with coor pos (x,y,z) (cm) falls 
218 // inside pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ) 
219 //
220
221   Bool_t isInside=false; 
222
223     
224   //Transform pos into Sector Frame
225
226   Float_t x = pos[0];
227   Float_t y = pos[1];
228   Float_t z = pos[2];
229
230   Float_t radius = TMath::Sqrt(x*x+y*y);
231   Float_t phi=TMath::ATan2(y,x);        
232   if(phi<0) phi=2.*TMath::Pi()+phi;
233   //  Get the local angle in the sector philoc
234   Float_t angle   = phi*kRaddeg-( Int_t (kRaddeg*phi/20.) + 0.5) *fPhiSec;
235   Float_t xs = radius*TMath::Cos(angle/kRaddeg);
236   Float_t ys = radius*TMath::Sin(angle/kRaddeg);
237   Float_t zs = z;
238
239   // Do the same for the selected pad
240
241   Float_t g[3];
242   GetPos(det,g);
243
244   Float_t padRadius = TMath::Sqrt(g[0]*g[0]+g[1]*g[1]);
245   Float_t padPhi=TMath::ATan2(g[1],g[0]);       
246   if(padPhi<0) padPhi=2.*TMath::Pi()+padPhi;
247   //  Get the local angle in the sector philoc
248   Float_t padAngle   = padPhi*kRaddeg-( Int_t (padPhi*kRaddeg/20.)+ 0.5) * fPhiSec; 
249   Float_t padxs = padRadius*TMath::Cos(padAngle/kRaddeg);
250   Float_t padys = padRadius*TMath::Sin(padAngle/kRaddeg);
251   Float_t padzs = g[2];
252   
253   //Now move to local pad coordinate frame. Translate:
254   
255   Float_t xt = xs-padxs;
256   Float_t yt = ys-padys;
257   Float_t zt = zs-padzs;
258   //Now Rotate:
259   
260   Float_t alpha = GetAngles(det[1],det[2]);
261   Float_t xr = xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg);
262   Float_t yr = yt;
263   Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg);
264
265   if(fabs(xr)<=0.75 && fabs(yr)<= (fgkXPad*0.5) && fabs(zr)<= (fgkZPad*0.5))
266     isInside=true; 
267   return isInside;
268
269 }
270
271 //_____________________________________________________________________________
272 void AliTOFGeometry::GetPos(Int_t *det, Float_t *pos) 
273 {
274 //
275 // Returns space point coor (x,y,z) (cm)  for Detector 
276 // Indices  (iSect,iPlate,iStrip,iPadX,iPadZ) 
277 //
278
279   pos[0]=GetX(det);  
280   pos[1]=GetY(det);  
281   pos[2]=GetZ(det);
282   
283 }
284 //_____________________________________________________________________________
285 void AliTOFGeometry::GetDetID( Float_t *pos, Int_t *det) 
286 {
287  //
288  // Returns Detector Indices (iSect,iPlate,iStrip,iPadX,iPadZ) 
289  // space point coor (x,y,z) (cm)  
290
291
292   det[0]=GetSector(pos);  
293   det[1]=GetPlate(pos);  
294   det[2]=GetStrip(pos);
295   det[3]=GetPadZ(pos);
296   det[4]=GetPadX(pos);
297   
298 }
299 //_____________________________________________________________________________
300 Float_t AliTOFGeometry::GetX(Int_t *det) 
301 {
302   //
303   // Returns X coordinate (cm)
304   //
305
306   Int_t isector = det[0];
307   Int_t iplate  = det[1];
308   Int_t istrip  = det[2];
309   Int_t ipadz   = det[3];
310   Int_t ipadx   = det[4];
311
312   // Find out distance d on the plane wrt median phi:
313   Float_t d = (ipadx+0.5)*fgkXPad-(kNpadX*fgkXPad)*0.5;
314
315   // The radius r in xy plane:
316   Float_t r = (fgkRmin+fgkRmax)/2.+fHeights[iplate][istrip]+
317     (ipadz-0.5)*fgkZPad*TMath::Sin(fAngles[iplate][istrip]/kRaddeg)-0.25;
318
319   // local azimuthal angle in the sector philoc
320   Float_t philoc   = TMath:: ATan(d/r);
321
322   // azimuthal angle in the global frame  phi
323   Float_t phi      = philoc*kRaddeg+(isector+0.5 )*fPhiSec;                    
324
325   Float_t xCoor    = r/TMath::Cos(philoc)*TMath::Cos(phi/kRaddeg);
326   return xCoor;
327
328 }
329 //_____________________________________________________________________________
330 Float_t AliTOFGeometry::GetY(Int_t *det) 
331 {
332   //
333   // Returns Y coordinate (cm)
334   //
335
336   Int_t isector = det[0];
337   Int_t iplate  = det[1];
338   Int_t istrip  = det[2];
339   Int_t ipadz   = det[3];
340   Int_t ipadx   = det[4];
341
342   // Find out distance d on the plane wrt median phi:
343   Float_t d = (ipadx+0.5)*fgkXPad-(kNpadX*fgkXPad)*0.5;
344
345   // The radius r in xy plane:
346   Float_t r = (fgkRmin+fgkRmax)/2.+fHeights[iplate][istrip]+
347     (ipadz-0.5)*fgkZPad*TMath::Sin(fAngles[iplate][istrip]/kRaddeg)-0.25;
348
349   // local azimuthal angle in the sector philoc
350   Float_t philoc   = TMath:: ATan(d/r);
351
352   // azimuthal angle in the global frame  phi
353   Float_t phi      = philoc*kRaddeg+(isector+0.5 )*fPhiSec;                    
354
355   Float_t yCoor    = r/TMath::Cos(philoc)*TMath::Sin(phi/kRaddeg);
356   return yCoor;
357
358 }
359
360 //_____________________________________________________________________________
361 Float_t AliTOFGeometry::GetZ(Int_t *det) 
362 {
363   //
364   // Returns Z coordinate (cm)
365   //
366   
367   Int_t iplate  = det[1];
368   Int_t istrip  = det[2];
369   Int_t ipadz   = det[3];
370   
371   
372   // The radius r in xy plane:
373   Float_t r = (fgkRmin+fgkRmax)/2.+fHeights[iplate][istrip];
374
375   Float_t zCoor = r*TMath::Tan(0.5*TMath::Pi()-GetStripTheta(iplate,istrip))-
376          (ipadz-0.5)*fgkZPad*TMath::Cos(fAngles[iplate][istrip]/kRaddeg);
377   return zCoor;
378
379 }
380 //_____________________________________________________________________________
381 Int_t AliTOFGeometry::GetSector(Float_t *pos) 
382 {
383   //
384   // Returns the Sector index 
385   //
386
387   Int_t   iSect = -1; 
388
389   Float_t x = pos[0];
390   Float_t y = pos[1];
391
392   Float_t phi     =  TMath::ATan2(y,x); 
393   if(phi<0.) phi=2.*TMath::Pi()+phi;
394   iSect  = (Int_t) (phi*kRaddeg/fPhiSec);
395
396   return iSect;
397
398 }
399 //_____________________________________________________________________________
400 Int_t AliTOFGeometry::GetPadX(Float_t *pos) 
401 {
402   //
403   // Returns the Pad index along X 
404   //
405
406   Int_t iPadX  = -1;
407
408   Float_t x = pos[0];
409   Float_t y = pos[1];
410   Float_t z = pos[2];
411
412   Int_t isector = GetSector(pos);
413   if(isector == -1){  
414     cout << "Detector Index could not be determined" << endl;
415     return iPadX;}
416   Int_t iplate =  GetPlate(pos);
417   if(iplate == -1){  
418     cout << "Detector Index could not be determined" << endl;
419     return iPadX;} 
420   Int_t istrip =  GetStrip(pos);
421   if(istrip == -1){  
422     cout << "Detector Index could not be determined" << endl;
423     return iPadX;}
424
425
426   Float_t rho=TMath::Sqrt(x*x+y*y);
427   Float_t phi =  TMath::ATan2(y,x);     
428   if(phi<0.) phi=2.*TMath::Pi()+phi;
429  
430   // Get the local angle in the sector philoc
431   Float_t philoc   = phi*kRaddeg-(isector+0.5)*fPhiSec;
432   philoc*=TMath::Pi()/180.;
433   // theta projected on the median of the sector
434   Float_t theta = TMath::ATan2(rho*TMath::Cos(philoc),z);
435   // The radius r in xy plane:
436   Float_t r   = (fgkRmin+fgkRmax)/2.+fHeights[iplate][istrip]+
437                (theta-GetStripTheta(iplate, istrip))/
438     (GetMaxStripTheta(iplate, istrip)-GetMinStripTheta(iplate, istrip))
439    * 2.*fgkZPad*TMath::Sin(fAngles[iplate][istrip]/kRaddeg)-0.25;
440
441   // Find out distance projected onto the strip plane 
442   Float_t d = (r*TMath::Tan(philoc)+(kNpadX*fgkXPad)*0.5);
443
444   iPadX  =  (Int_t) ( d/fgkXPad);  
445   return iPadX;
446
447 }
448 //_____________________________________________________________________________
449 Int_t AliTOFGeometry::GetPlate(Float_t *pos) 
450 {
451   //
452   // Returns the Plate index 
453   //
454   Int_t iPlate=-1;
455
456   Int_t isector = GetSector(pos);
457   if(isector == -1){  
458     cout << "Detector Index could not be determined" << endl;
459     return iPlate;}
460  
461   Float_t x = pos[0];
462   Float_t y = pos[1];
463   Float_t z = pos[2];
464
465   Float_t rho=TMath::Sqrt(x*x+y*y);
466   Float_t phi=TMath::ATan2(y,x);        
467   if(phi<0) phi=2.*TMath::Pi()+phi;
468   // Get the local angle in the sector philoc
469   Float_t philoc   = phi*kRaddeg-(isector+0.5)*fPhiSec;
470   philoc*=TMath::Pi()/180.;
471   // theta projected on the median of the sector
472   Float_t theta=TMath::ATan2(rho*TMath::Cos(philoc),z);
473
474   for (Int_t i=0; i<kNPlates; i++){
475     if ( GetMaxPlateTheta(i) >= theta && 
476          GetMinPlateTheta(i) <= theta)iPlate=i;
477   }
478   
479   return iPlate;
480
481 }
482 //_____________________________________________________________________________
483 Int_t AliTOFGeometry::GetStrip(Float_t *pos) 
484 {
485   //
486   // Returns the Strip index 
487   //
488
489   Int_t iStrip=-1;
490
491
492   Int_t isector = GetSector(pos);
493   if(isector == -1){  
494     cout << "Detector Index could not be determined" << endl;
495     return iStrip;}
496   Int_t iplate =  GetPlate(pos);
497   if(iplate == -1){  
498     cout << "Detector Index could not be determined" << endl;
499     return iStrip;} 
500
501
502   Float_t x = pos[0];
503   Float_t y = pos[1];
504   Float_t z = pos[2];
505
506   Int_t nstrips=0;
507   if(iplate==0 || iplate == 4)nstrips=kNStripC;
508   if(iplate==1 || iplate == 3)nstrips=kNStripB;
509   if(iplate==2)               nstrips=kNStripA;
510
511   Float_t rho=TMath::Sqrt(x*x+y*y);
512   Float_t phi=TMath::ATan2(y,x);        
513   if(phi<0) phi=2.*TMath::Pi()+phi;
514   // Get the local angle in the sector philoc
515   Float_t philoc   = phi*kRaddeg-(isector+0.5)*fPhiSec;
516   philoc*=TMath::Pi()/180.;
517   // theta projected on the median of the sector
518   Float_t theta=TMath::ATan2(rho*TMath::Cos(philoc),z);
519
520   for (Int_t istrip=0; istrip<nstrips; istrip++){
521
522     if( 
523        GetMaxStripTheta(iplate,istrip) >= theta 
524        &&  
525        GetMinStripTheta(iplate,istrip) <= theta ) iStrip = istrip;
526    
527   }
528
529   return iStrip;
530 }
531 //_____________________________________________________________________________
532 Int_t AliTOFGeometry::GetPadZ(Float_t *pos) 
533 {
534   //
535   // Returns the Pad index along Z 
536   //
537   Int_t iPadZ = -1;
538
539   Int_t isector = GetSector(pos);
540   if(isector == -1){  
541     cout << "Detector Index could not be determined" << endl;
542     return iPadZ;}
543   Int_t iplate =  GetPlate(pos);
544   if(iplate == -1){  
545     cout << "Detector Index could not be determined" << endl;
546     return iPadZ;} 
547   Int_t istrip =  GetStrip(pos);
548   if(istrip == -1){  
549     cout << "Detector Index could not be determined" << endl;
550     return iPadZ;}
551
552
553   Float_t x = pos[0];
554   Float_t y = pos[1];
555   Float_t z = pos[2];
556
557   Float_t rho=TMath::Sqrt(x*x+y*y);
558   Float_t phi=TMath::ATan2(y,x);        
559   if(phi<0) phi=2.*TMath::Pi()+phi;
560   Float_t philoc   = phi*kRaddeg-(isector+0.5)*fPhiSec;
561   philoc*=TMath::Pi()/180.;
562   Float_t theta=TMath::ATan2(rho*TMath::Cos(philoc),z);
563
564   if (theta >= GetStripTheta(iplate, istrip))iPadZ=1;
565   else iPadZ=0;
566
567   return iPadZ;
568 }
569 //_____________________________________________________________________________
570 Float_t AliTOFGeometry::GetMinPlateTheta(Int_t iPlate) 
571 {
572   //
573   // Returns the minimum theta angle of a given plate iPlate (rad)
574   //
575   
576
577   Int_t index=0;
578
579   Float_t delta =0.;
580   if(iPlate==0)delta = -1. ;
581   if(iPlate==1)delta = -0.5;
582   if(iPlate==3)delta = +0.5;
583   if(iPlate==4)delta = +1. ;
584
585   Float_t z=(fgkRmin+2.)*TMath::Tan(fAngles[iPlate][index]/kRaddeg)+delta;
586   Float_t r=(fgkRmin+fgkRmax)/2.+fHeights[iPlate][index];
587   z =z+fgkZPad*TMath::Cos(fAngles[iPlate][index]/kRaddeg);
588   r =r-fgkZPad*TMath::Sin(fAngles[iPlate][index]/kRaddeg);
589
590   Float_t thmin = 0.5*TMath::Pi()-TMath::ATan(z/r)-fgkDprecMin;
591   return thmin;
592
593 }
594 //_____________________________________________________________________________
595 Float_t AliTOFGeometry::GetMaxPlateTheta(Int_t iPlate) 
596 {
597   //
598   // Returns the maximum theta angle of a given plate iPlate (rad)
599   
600   Int_t index=0;
601   if(iPlate==0 ||iPlate == 4)index=kNStripC-1;
602   if(iPlate==1 ||iPlate == 3)index=kNStripB-1;
603   if(iPlate==2)              index=kNStripA-1;
604
605   Float_t delta =0.;
606   if(iPlate==0)delta = -1. ;
607   if(iPlate==1)delta = -0.5;
608   if(iPlate==3)delta = +0.5;
609   if(iPlate==4)delta = +1. ;
610
611   Float_t z=(fgkRmin+2.)*TMath::Tan(fAngles[iPlate][index]/kRaddeg)+delta;
612   Float_t r=(fgkRmin+fgkRmax)/2.+fHeights[iPlate][index];
613   z =z-fgkZPad*TMath::Cos(fAngles[iPlate][index]/kRaddeg);
614   r= r+fgkZPad*TMath::Sin(fAngles[iPlate][index]/kRaddeg);
615
616   Float_t thmax    = 0.5*TMath::Pi()-TMath::ATan(z/r)+fgkDprecMax;
617   return thmax;
618
619 }
620 //_____________________________________________________________________________
621 Float_t  AliTOFGeometry::GetMaxStripTheta(Int_t iPlate, Int_t iStrip) 
622 {
623   //
624   // Returns the maximum theta angle of a given strip iStrip (rad)
625   //
626   
627
628   Float_t delta =0.;
629   if(iPlate==0)delta = -1. ;
630   if(iPlate==1)delta = -0.5;
631   if(iPlate==3)delta = +0.5;
632   if(iPlate==4)delta = +1. ;
633
634   Float_t r =(fgkRmin+fgkRmax)/2.+fHeights[iPlate][iStrip];
635   Float_t z =(fgkRmin+2.)*TMath::Tan(fAngles[iPlate][iStrip]/kRaddeg)+delta;
636   z = z-fgkZPad*TMath::Cos(fAngles[iPlate][iStrip]/kRaddeg);
637   r = r+fgkZPad*TMath::Sin(fAngles[iPlate][iStrip]/kRaddeg);
638   Float_t thmax =0.5*TMath::Pi()-TMath::ATan(z/r)+fgkDprecMax;
639   return thmax;
640
641 }
642
643 //_____________________________________________________________________________
644 Float_t  AliTOFGeometry::GetMinStripTheta(Int_t iPlate, Int_t iStrip) 
645 {
646   //
647   // Returns the minimum theta angle of a given Strip iStrip (rad)
648   //
649   
650
651   Float_t delta =0.;
652   if(iPlate==0)delta = -1. ;
653   if(iPlate==1)delta = -0.5;
654   if(iPlate==3)delta = +0.5;
655   if(iPlate==4)delta = +1. ;
656
657
658   Float_t r =(fgkRmin+fgkRmax)/2.+fHeights[iPlate][iStrip];
659   Float_t z =(fgkRmin+2.)*TMath::Tan(fAngles[iPlate][iStrip]/kRaddeg)+delta;
660   z =z+fgkZPad*TMath::Cos(fAngles[iPlate][iStrip]/kRaddeg);
661   r =r-fgkZPad*TMath::Sin(fAngles[iPlate][iStrip]/kRaddeg);
662   Float_t thmin =0.5*TMath::Pi()-TMath::ATan(z/r)-fgkDprecMin;
663
664   return thmin;
665
666 }
667
668
669 //_____________________________________________________________________________
670 Float_t  AliTOFGeometry::GetStripTheta(Int_t iPlate, Int_t iStrip) 
671 {
672   //
673   // returns the median theta angle of a given strip iStrip (rad)
674   //
675   
676
677   Float_t delta =0.;
678   if(iPlate==0)delta = -1. ;
679   if(iPlate==1)delta = -0.5;
680   if(iPlate==3)delta = +0.5;
681   if(iPlate==4)delta = +1. ;
682
683   Float_t r =(fgkRmin+fgkRmax)/2.+fHeights[iPlate][iStrip];
684   Float_t z =(fgkRmin+2.)*TMath::Tan(fAngles[iPlate][iStrip]/kRaddeg)+delta;
685   Float_t theta =0.5*TMath::Pi()-TMath::ATan(z/r);
686   if(iPlate != 2){
687   if(theta > 0.5*TMath::Pi() )theta+=fgkDprecCen;
688   if(theta < 0.5*TMath::Pi() )theta-=fgkDprecCen;
689   }
690   return theta;
691 }
692
693
694