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