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