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