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