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