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