]>
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$ | |
7aeeaf38 | 18 | Revision 1.3 2006/03/12 14:38:13 arcelli |
19 | Changes for TOF Reconstruction using TGeo | |
20 | ||
a6a9820c | 21 | Revision 1.2 2006/02/28 10:38:00 decaro |
22 | AliTOFGeometry::fAngles, AliTOFGeometry::fHeights, AliTOFGeometry::fDistances arrays: dimension definition in the right location | |
23 | ||
4402e7cb | 24 | Revision 1.1 2005/12/15 08:55:33 decaro |
25 | New TOF geometry description (V5) -G. Cara Romeo and A. De Caro | |
26 | ||
d3c7bfac | 27 | Revision 0.1 2005/07/19 A. De Caro |
28 | Modify Global methods IsInsideThePad & DistanceToPad | |
29 | according to the PPR TOF geometry | |
30 | Implement Global methods GetPadDx & GetPadDy & GetPadDz | |
31 | Modify Global methods GetDetID & GetPlate & GetSector & | |
32 | GetStrip & GetPadX & GetPadZ | |
33 | according to the PPR TOF geometry | |
34 | Modify Global methods GetPos & GetX & GetY & GetZ | |
35 | according to the PPR TOF geometry | |
36 | */ | |
37 | ||
38 | #include <stdlib.h> | |
39 | #include <Riostream.h> | |
40 | /////////////////////////////////////////////////////////////////////////////// | |
41 | // // | |
42 | // TOF Geometry class (PPR version) // | |
43 | // // | |
44 | /////////////////////////////////////////////////////////////////////////////// | |
45 | ||
46 | #include "AliLog.h" | |
47 | #include "AliConst.h" | |
48 | ||
49 | #include "AliTOFGeometry.h" | |
50 | #include "AliTOFGeometryV4.h" | |
51 | ||
52 | ClassImp(AliTOFGeometryV4) | |
53 | ||
d3c7bfac | 54 | |
55 | const Float_t AliTOFGeometryV4::fgkZlenA = 106.0; // length (cm) of the A module | |
56 | const Float_t AliTOFGeometryV4::fgkZlenB = 141.0; // length (cm) of the B module | |
57 | const Float_t AliTOFGeometryV4::fgkZlenC = 177.5; // length (cm) of the C module | |
58 | const Float_t AliTOFGeometryV4::fgkMaxhZtof = 371.5; // Max half z-size of TOF (cm) | |
d3c7bfac | 59 | |
60 | const Float_t AliTOFGeometryV4::fgkDeadBndX = 1.0; // Dead Boundaries of a Strip along X direction (length) (cm) | |
61 | const Float_t AliTOFGeometryV4::fgkDeadBndZ = 1.5; // Dead Boundaries of a Strip along Z direction (width) (cm) | |
62 | const Float_t AliTOFGeometryV4::fgkOverSpc = 15.3; // Space available for sensitive layers in radial direction (cm) | |
63 | ||
64 | const Float_t AliTOFGeometryV4::fgkDprecMin = 0.0000075;//num.prec.tolerance on Thmin | |
65 | const Float_t AliTOFGeometryV4::fgkDprecMax = 0.0000100;//num.prec.tolerance on Thma | |
66 | const Float_t AliTOFGeometryV4::fgkDprecCen = 0.0000005;//num.prec.tolerance on <Theta> | |
67 | ||
68 | const Float_t AliTOFGeometryV4::fgkxTOF = 371.; // Inner radius of the TOF for Reconstruction (cm) | |
69 | const Float_t AliTOFGeometryV4::fgkRmin = 370.; // Inner radius of the TOF (cm) | |
70 | const Float_t AliTOFGeometryV4::fgkRmax = 399.; // Outer radius of the TOF (cm) | |
71 | ||
72 | //_____________________________________________________________________________ | |
73 | AliTOFGeometryV4::AliTOFGeometryV4() | |
74 | :AliTOFGeometry() | |
75 | { | |
76 | // | |
77 | // AliTOFGeometryV4 default constructor | |
78 | // | |
79 | ||
7aeeaf38 | 80 | AliTOFGeometry::fNStripC = kNStripC; // number of strips in C type module |
d3c7bfac | 81 | |
7aeeaf38 | 82 | AliTOFGeometry::fZlenA = fgkZlenA; // length (cm) of the A module |
83 | AliTOFGeometry::fZlenB = fgkZlenB; // length (cm) of the B module | |
84 | AliTOFGeometry::fZlenC = fgkZlenC; // length (cm) of the C module | |
85 | AliTOFGeometry::fMaxhZtof = fgkMaxhZtof; // Max half z-size of TOF (cm) | |
d3c7bfac | 86 | |
7aeeaf38 | 87 | AliTOFGeometry::fxTOF = fgkxTOF; // Inner radius of the TOF for Reconstruction (cm) |
88 | AliTOFGeometry::fRmin = fgkRmin; // Inner radius of the TOF (cm) | |
89 | AliTOFGeometry::fRmax = fgkRmax; // Outer radius of the TOF (cm) | |
d3c7bfac | 90 | |
91 | Init(); | |
92 | ||
93 | } | |
94 | ||
95 | //_____________________________________________________________________________ | |
96 | AliTOFGeometryV4::~AliTOFGeometryV4() | |
97 | { | |
98 | // | |
99 | // AliTOFGeometryV4 destructor | |
100 | // | |
101 | ||
102 | } | |
103 | //_____________________________________________________________________________ | |
a6a9820c | 104 | void AliTOFGeometryV4::ImportGeometry(){ |
105 | TGeoManager::Import("geometry.root"); | |
106 | } | |
107 | //_____________________________________________________________________________ | |
d3c7bfac | 108 | void AliTOFGeometryV4::Init() |
109 | { | |
110 | // | |
111 | // Initialize strip Tilt Angles and Heights | |
112 | // | |
113 | // Strips Tilt Angles | |
114 | ||
7aeeaf38 | 115 | fPhiSec = 360./kNSectors; |
116 | ||
d3c7bfac | 117 | Float_t const kangles[kNPlates][kMaxNstrip] ={ |
118 | ||
119 | {44.494, 43.725, 42.946, 42.156, 41.357, 40.548, 39.729, 38.899, | |
120 | 38.060, 37.211, 36.353, 35.484, 34.606, 33.719, 32.822, 31.916, | |
121 | 31.001, 30.077, 29.144, 28.202 }, | |
122 | ||
123 | {26.884, 25.922, 24.952, 23.975, 22.989, 22.320, 21.016, 20.309, | |
124 | 19.015, 18.270, 16.989, 16.205, 14.941, 14.117, 12.871, 12.008, | |
125 | 10.784, 9.8807, 8.681, 0.0 }, | |
126 | ||
127 | { 7.5835, 6.4124, 5.4058, 4.2809, 3.2448, 2.1424, 1.078, -0., -1.078, | |
128 | -2.1424, -3.2448, -4.2809, -5.4058, -6.4124, -7.5835, 0.0, 0.0, 0.0, | |
129 | 0.0, 0.0 }, | |
130 | ||
131 | {-8.681, -9.8807, -10.784, -12.008, -12.871, -14.117, -14.941, -16.205, | |
132 | -16.989, -18.27, -19.015, -20.309, -21.016, -22.32, -22.989, | |
133 | -23.975, -24.952, -25.922, -26.884, 0. }, | |
134 | ||
135 | {-28.202, -29.144, -30.077, -31.001, -31.916, -32.822, -33.719, -34.606, | |
136 | -35.484, -36.353, -37.211, -38.06, -38.899, -39.729, -40.548, | |
137 | -41.357, -42.156, -42.946, -43.725, -44.494 }}; | |
138 | ||
139 | ||
140 | //Strips Heights | |
141 | ||
142 | Float_t const kheights[kNPlates][kMaxNstrip]= { | |
143 | ||
144 | {-5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, | |
145 | -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5 }, | |
146 | ||
147 | {-6.3, -7.1, -7.9, -8.7, -9.5, -3, -9.5, -3, -9.5, -3, | |
148 | -9.5, -3.0, -9.5, -3.0, -9.5, -3, -9.5, -3, -9 , 0.}, | |
149 | ||
150 | { -3, -9, -4.5, -9, -4.5, -9, -4.5, -9, -4.5, -9, | |
151 | -4.5, -9, -4.5, -9, -3, 0.0, 0.0, 0.0, 0.0, 0.0 }, | |
152 | ||
153 | { -9, -3, -9.5, -3, -9.5, -3, -9.5, -3, -9.5, -3, -9.5, | |
154 | -3, -9.5, -3, -9.5, -8.7, -7.9, -7.1, -6.3, 0. }, | |
155 | ||
156 | {-5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, | |
157 | -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5 }}; | |
158 | ||
159 | // Deposit in fAngles, fHeights | |
160 | ||
d3c7bfac | 161 | for (Int_t iplate = 0; iplate < kNPlates; iplate++) { |
162 | for (Int_t istrip = 0; istrip < kMaxNstrip; istrip++) { | |
163 | AliTOFGeometry::fAngles[iplate][istrip] = kangles[iplate][istrip]; | |
164 | AliTOFGeometry::fHeights[iplate][istrip] = kheights[iplate][istrip]; | |
165 | } | |
166 | } | |
167 | ||
168 | } | |
169 | ||
170 | //_____________________________________________________________________________ | |
7aeeaf38 | 171 | Float_t AliTOFGeometryV4::DistanceToPadPar(Int_t *det, Float_t *pos, Float_t *dist3d) const |
d3c7bfac | 172 | { |
173 | // | |
174 | // Returns distance of space point with coor pos (x,y,z) (cm) wrt | |
175 | // pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ) | |
176 | // | |
177 | ||
178 | //Transform pos into Sector Frame | |
179 | ||
180 | Float_t x = pos[0]; | |
181 | Float_t y = pos[1]; | |
182 | Float_t z = pos[2]; | |
183 | ||
184 | Float_t radius = TMath::Sqrt(x*x+y*y); | |
185 | Float_t phi=TMath::ATan2(y,x); | |
186 | if(phi<0) phi=2.*TMath::Pi()+phi; | |
187 | // Get the local angle in the sector philoc | |
188 | Float_t angle = phi*kRaddeg-( Int_t (kRaddeg*phi/fPhiSec) + 0.5)*fPhiSec; | |
189 | Float_t xs = radius*TMath::Cos(angle/kRaddeg); | |
190 | Float_t ys = radius*TMath::Sin(angle/kRaddeg); | |
191 | Float_t zs = z; | |
192 | ||
193 | // Do the same for the selected pad | |
194 | ||
195 | Float_t g[3]; | |
a6a9820c | 196 | GetPosPar(det,g); |
d3c7bfac | 197 | |
198 | Float_t padRadius = TMath::Sqrt(g[0]*g[0]+g[1]*g[1]); | |
199 | Float_t padPhi=TMath::ATan2(g[1],g[0]); | |
200 | if(padPhi<0) padPhi=2.*TMath::Pi()+padPhi; | |
201 | // Get the local angle in the sector philoc | |
202 | Float_t padAngle = padPhi*kRaddeg-( Int_t (padPhi*kRaddeg/fPhiSec)+ 0.5) * fPhiSec; | |
203 | Float_t padxs = padRadius*TMath::Cos(padAngle/kRaddeg); | |
204 | Float_t padys = padRadius*TMath::Sin(padAngle/kRaddeg); | |
205 | Float_t padzs = g[2]; | |
206 | ||
207 | //Now move to local pad coordinate frame. Translate: | |
208 | ||
209 | Float_t xt = xs-padxs; | |
210 | Float_t yt = ys-padys; | |
211 | Float_t zt = zs-padzs; | |
212 | //Now Rotate: | |
213 | ||
214 | Float_t alpha = GetAngles(det[1],det[2]); | |
215 | Float_t xr = xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg); | |
216 | Float_t yr = yt; | |
217 | Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg); | |
218 | ||
219 | Float_t dist = TMath::Sqrt(xr*xr+yr*yr+zr*zr); | |
d3c7bfac | 220 | if (dist3d){ |
221 | dist3d[0] = xr; | |
222 | dist3d[1] = yr; | |
223 | dist3d[2] = zr; | |
224 | } | |
225 | ||
226 | return dist; | |
227 | ||
228 | } | |
229 | ||
230 | //_____________________________________________________________________________ | |
7aeeaf38 | 231 | Bool_t AliTOFGeometryV4::IsInsideThePadPar(Int_t *det, Float_t *pos) const |
d3c7bfac | 232 | { |
233 | // | |
234 | // Returns true if space point with coor pos (x,y,z) (cm) falls | |
235 | // inside pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ) | |
236 | // | |
237 | ||
238 | Bool_t isInside=false; | |
239 | ||
240 | //Transform pos into Sector Frame | |
241 | ||
242 | Float_t x = pos[0]; | |
243 | Float_t y = pos[1]; | |
244 | Float_t z = pos[2]; | |
245 | ||
246 | Float_t radius = TMath::Sqrt(x*x+y*y); | |
247 | Float_t phi=TMath::ATan2(y,x); | |
248 | if(phi<0) phi=2.*TMath::Pi()+phi; | |
249 | // Get the local angle in the sector philoc | |
250 | Float_t angle = phi*kRaddeg-( Int_t (kRaddeg*phi/fPhiSec) + 0.5) *fPhiSec; | |
251 | Float_t xs = radius*TMath::Cos(angle/kRaddeg); | |
252 | Float_t ys = radius*TMath::Sin(angle/kRaddeg); | |
253 | Float_t zs = z; | |
254 | ||
255 | // Do the same for the selected pad | |
256 | ||
257 | Float_t g[3]; | |
a6a9820c | 258 | GetPosPar(det,g); |
d3c7bfac | 259 | |
260 | Float_t padRadius = TMath::Sqrt(g[0]*g[0]+g[1]*g[1]); | |
261 | Float_t padPhi=TMath::ATan2(g[1],g[0]); | |
262 | if(padPhi<0) padPhi=2.*TMath::Pi()+padPhi; | |
263 | // Get the local angle in the sector philoc | |
264 | Float_t padAngle = padPhi*kRaddeg-( Int_t (padPhi*kRaddeg/fPhiSec)+ 0.5) * fPhiSec; | |
265 | Float_t padxs = padRadius*TMath::Cos(padAngle/kRaddeg); | |
266 | Float_t padys = padRadius*TMath::Sin(padAngle/kRaddeg); | |
267 | Float_t padzs = g[2]; | |
268 | ||
269 | //Now move to local pad coordinate frame. Translate: | |
270 | ||
271 | Float_t xt = xs-padxs; | |
272 | Float_t yt = ys-padys; | |
273 | Float_t zt = zs-padzs; | |
274 | ||
275 | //Now Rotate: | |
276 | ||
277 | Float_t alpha = GetAngles(det[1],det[2]); | |
278 | Float_t xr = xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg); | |
279 | Float_t yr = yt; | |
280 | Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg); | |
281 | ||
282 | if(TMath::Abs(xr)<=0.75 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5)) | |
283 | isInside=true; | |
284 | return isInside; | |
285 | ||
286 | } | |
287 | ||
a6a9820c | 288 | |
289 | //_____________________________________________________________________________ | |
7aeeaf38 | 290 | Float_t AliTOFGeometryV4::DistanceToPad(Int_t *det, TGeoHMatrix mat, Float_t *pos, Float_t *dist3d) const |
a6a9820c | 291 | { |
292 | // | |
293 | // Returns distance of space point with coor pos (x,y,z) (cm) wrt | |
294 | // pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ) | |
295 | // | |
296 | if (!gGeoManager) { | |
297 | printf("ERROR: no TGeo\n"); | |
298 | return 0.; | |
299 | } | |
300 | Double_t vecg[3]; | |
301 | vecg[0]=pos[0]; | |
302 | vecg[1]=pos[1]; | |
303 | vecg[2]=pos[2]; | |
304 | Double_t veclr[3]={-1.,-1.,-1.}; | |
305 | Double_t vecl[3]={-1.,-1.,-1.}; | |
306 | mat.MasterToLocal(vecg,veclr); | |
307 | vecl[0]=veclr[1]; | |
308 | vecl[1]=veclr[0]; | |
309 | vecl[2]=-veclr[2]; | |
310 | //Take into account reflections | |
311 | if(det[1]>2){ | |
312 | vecl[1]=-veclr[0]; | |
313 | vecl[2]= veclr[2]; | |
314 | } | |
315 | ||
316 | Float_t dist = TMath::Sqrt(vecl[0]*vecl[0]+vecl[1]*vecl[1]+vecl[2]*vecl[2]); | |
317 | ||
318 | ||
319 | if (dist3d){ | |
320 | dist3d[0] = vecl[0]; | |
321 | dist3d[1] = vecl[1]; | |
322 | dist3d[2] = vecl[2]; | |
323 | } | |
324 | ||
325 | return dist; | |
326 | ||
327 | } | |
328 | ||
329 | ||
330 | //_____________________________________________________________________________ | |
7aeeaf38 | 331 | Bool_t AliTOFGeometryV4::IsInsideThePad( Int_t *det, TGeoHMatrix mat, Float_t *pos) const |
a6a9820c | 332 | { |
333 | // | |
334 | // Returns true if space point with coor pos (x,y,z) (cm) falls | |
335 | // inside pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ) | |
336 | // | |
337 | ||
338 | const Float_t khsensmy = 0.5; // heigth of Sensitive Layer | |
339 | ||
340 | Double_t vecg[3]; | |
341 | vecg[0]=pos[0]; | |
342 | vecg[1]=pos[1]; | |
343 | vecg[2]=pos[2]; | |
344 | Double_t veclr[3]={-1.,-1.,-1.}; | |
345 | Double_t vecl[3]={-1.,-1.,-1.}; | |
346 | mat.MasterToLocal(vecg,veclr); | |
347 | vecl[0]=veclr[1]; | |
348 | vecl[1]=veclr[0]; | |
349 | vecl[2]=-veclr[2]; | |
350 | //Take into account reflections | |
351 | if(det[1]>2){ | |
352 | vecl[1]=-veclr[0]; | |
353 | vecl[2]= veclr[2]; | |
354 | } | |
355 | ||
356 | Float_t xr = vecl[0]; | |
357 | Float_t yr = vecl[1]; | |
358 | Float_t zr = vecl[2]; | |
359 | ||
360 | Bool_t isInside=false; | |
361 | if(TMath::Abs(xr)<= khsensmy*0.5 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5)) | |
362 | isInside=true; | |
363 | return isInside; | |
364 | ||
365 | } | |
d3c7bfac | 366 | //_____________________________________________________________________________ |
7aeeaf38 | 367 | Float_t AliTOFGeometryV4::GetX(Int_t *det) const |
d3c7bfac | 368 | { |
369 | // | |
370 | // Returns X coordinate (cm) | |
371 | // | |
372 | ||
373 | Int_t isector = det[0]; | |
374 | Int_t iplate = det[1]; | |
375 | Int_t istrip = det[2]; | |
376 | Int_t ipadz = det[3]; | |
377 | Int_t ipadx = det[4]; | |
378 | ||
379 | // Find out distance d on the plane wrt median phi: | |
380 | Float_t d = (ipadx+0.5)*fgkXPad-(kNpadX*fgkXPad)*0.5; | |
381 | ||
382 | // The radius r in xy plane: | |
383 | Float_t r = (fgkRmin+fgkRmax)/2.+fHeights[iplate][istrip]+ | |
384 | (ipadz-0.5)*fgkZPad*TMath::Sin(fAngles[iplate][istrip]/kRaddeg)-0.25; | |
385 | ||
386 | // local azimuthal angle in the sector philoc | |
387 | Float_t philoc = TMath:: ATan(d/r); | |
388 | ||
389 | // azimuthal angle in the global frame phi | |
390 | Float_t phi = philoc*kRaddeg+(isector+0.5 )*fPhiSec; | |
391 | ||
392 | Float_t xCoor = r/TMath::Cos(philoc)*TMath::Cos(phi/kRaddeg); | |
393 | ||
394 | return xCoor; | |
395 | ||
396 | } | |
397 | //_____________________________________________________________________________ | |
7aeeaf38 | 398 | Float_t AliTOFGeometryV4::GetY(Int_t *det) const |
d3c7bfac | 399 | { |
400 | // | |
401 | // Returns Y coordinate (cm) | |
402 | // | |
403 | ||
404 | Int_t isector = det[0]; | |
405 | Int_t iplate = det[1]; | |
406 | Int_t istrip = det[2]; | |
407 | Int_t ipadz = det[3]; | |
408 | Int_t ipadx = det[4]; | |
409 | ||
410 | // Find out distance d on the plane wrt median phi: | |
411 | Float_t d = (ipadx+0.5)*fgkXPad-(kNpadX*fgkXPad)*0.5; | |
412 | ||
413 | // The radius r in xy plane: | |
414 | Float_t r = (fgkRmin+fgkRmax)/2.+fHeights[iplate][istrip]+ | |
415 | (ipadz-0.5)*fgkZPad*TMath::Sin(fAngles[iplate][istrip]/kRaddeg)-0.25; | |
416 | ||
417 | // local azimuthal angle in the sector philoc | |
418 | Float_t philoc = TMath:: ATan(d/r); | |
419 | ||
420 | // azimuthal angle in the global frame phi | |
421 | Float_t phi = philoc*kRaddeg+(isector+0.5 )*fPhiSec; | |
422 | ||
423 | Float_t yCoor = r/TMath::Cos(philoc)*TMath::Sin(phi/kRaddeg); | |
424 | ||
425 | return yCoor; | |
426 | ||
427 | } | |
428 | ||
429 | //_____________________________________________________________________________ | |
7aeeaf38 | 430 | Float_t AliTOFGeometryV4::GetZ(Int_t *det) const |
d3c7bfac | 431 | { |
432 | // | |
433 | // Returns Z coordinate (cm) | |
434 | // | |
435 | ||
436 | Int_t iplate = det[1]; | |
437 | Int_t istrip = det[2]; | |
438 | Int_t ipadz = det[3]; | |
439 | ||
440 | // The radius r in xy plane: | |
441 | Float_t r = (fgkRmin+fgkRmax)/2.+fHeights[iplate][istrip]; | |
442 | ||
443 | Float_t zCoor = r*TMath::Tan(0.5*TMath::Pi()-GetStripTheta(iplate,istrip))- | |
444 | (ipadz-0.5)*fgkZPad*TMath::Cos(fAngles[iplate][istrip]/kRaddeg); | |
445 | return zCoor; | |
446 | ||
447 | } | |
448 | ||
449 | //_____________________________________________________________________________ | |
7aeeaf38 | 450 | Int_t AliTOFGeometryV4::GetSector(Float_t *pos) const |
d3c7bfac | 451 | { |
452 | // | |
453 | // Returns the Sector index | |
454 | // | |
455 | ||
456 | Int_t iSect = -1; | |
457 | ||
458 | Float_t x = pos[0]; | |
459 | Float_t y = pos[1]; | |
460 | ||
461 | Float_t phi = TMath::ATan2(y,x); | |
462 | if(phi<0.) phi=2.*TMath::Pi()+phi; | |
463 | iSect = (Int_t) (phi*kRaddeg/fPhiSec); | |
464 | ||
465 | return iSect; | |
466 | ||
467 | } | |
468 | ||
469 | //_____________________________________________________________________________ | |
7aeeaf38 | 470 | Int_t AliTOFGeometryV4::GetPadX(Float_t *pos) const |
d3c7bfac | 471 | { |
472 | // | |
473 | // Returns the Pad index along X | |
474 | // | |
475 | ||
476 | Int_t iPadX = -1; | |
477 | ||
478 | Float_t x = pos[0]; | |
479 | Float_t y = pos[1]; | |
480 | Float_t z = pos[2]; | |
481 | ||
482 | Int_t isector = GetSector(pos); | |
483 | if(isector == -1){ | |
484 | AliError("Detector Index could not be determined"); | |
485 | return iPadX;} | |
486 | Int_t iplate = GetPlate(pos); | |
487 | if(iplate == -1){ | |
488 | AliError("Detector Index could not be determined"); | |
489 | return iPadX;} | |
490 | Int_t istrip = GetStrip(pos); | |
491 | if(istrip == -1){ | |
492 | AliError("Detector Index could not be determined"); | |
493 | return iPadX;} | |
494 | ||
495 | ||
496 | Float_t rho=TMath::Sqrt(x*x+y*y); | |
497 | Float_t phi = TMath::ATan2(y,x); | |
498 | if(phi<0.) phi=2.*TMath::Pi()+phi; | |
499 | ||
500 | // Get the local angle in the sector philoc | |
501 | Float_t philoc = phi*kRaddeg-(isector+0.5)*fPhiSec; | |
502 | philoc*=TMath::Pi()/180.; | |
503 | // theta projected on the median of the sector | |
504 | Float_t theta = TMath::ATan2(rho*TMath::Cos(philoc),z); | |
505 | // The radius r in xy plane: | |
506 | Float_t r = (fgkRmin+fgkRmax)/2.+fHeights[iplate][istrip]+ | |
507 | (theta-GetStripTheta(iplate, istrip))/ | |
508 | (GetMaxStripTheta(iplate, istrip)-GetMinStripTheta(iplate, istrip)) | |
509 | * 2.*fgkZPad*TMath::Sin(fAngles[iplate][istrip]/kRaddeg)-0.25; | |
510 | ||
511 | // Find out distance projected onto the strip plane | |
512 | Float_t d = (r*TMath::Tan(philoc)+(kNpadX*fgkXPad)*0.5); | |
513 | ||
514 | iPadX = (Int_t) ( d/fgkXPad); | |
515 | return iPadX; | |
516 | ||
517 | } | |
518 | //_____________________________________________________________________________ | |
7aeeaf38 | 519 | Int_t AliTOFGeometryV4::GetPlate(Float_t *pos) const |
d3c7bfac | 520 | { |
521 | // | |
522 | // Returns the Plate index | |
523 | // | |
524 | Int_t iPlate=-1; | |
525 | ||
526 | Int_t isector = GetSector(pos); | |
527 | if(isector == -1){ | |
528 | AliError("Detector Index could not be determined"); | |
529 | return iPlate;} | |
530 | ||
531 | Float_t x = pos[0]; | |
532 | Float_t y = pos[1]; | |
533 | Float_t z = pos[2]; | |
534 | ||
535 | Float_t rho=TMath::Sqrt(x*x+y*y); | |
536 | Float_t phi=TMath::ATan2(y,x); | |
537 | if(phi<0) phi=2.*TMath::Pi()+phi; | |
538 | // Get the local angle in the sector philoc | |
539 | Float_t philoc = phi*kRaddeg-(isector+0.5)*fPhiSec; | |
540 | philoc*=TMath::Pi()/180.; | |
541 | // theta projected on the median of the sector | |
542 | Float_t theta=TMath::ATan2(rho*TMath::Cos(philoc),z); | |
543 | ||
544 | for (Int_t i=0; i<kNPlates; i++){ | |
545 | if ( GetMaxPlateTheta(i) >= theta && | |
546 | GetMinPlateTheta(i) <= theta)iPlate=i; | |
547 | } | |
548 | ||
549 | return iPlate; | |
550 | ||
551 | } | |
552 | ||
553 | //_____________________________________________________________________________ | |
7aeeaf38 | 554 | Int_t AliTOFGeometryV4::GetStrip(Float_t *pos) const |
d3c7bfac | 555 | { |
556 | // | |
557 | // Returns the Strip index | |
558 | // | |
559 | ||
560 | Int_t iStrip=-1; | |
561 | ||
562 | ||
563 | Int_t isector = GetSector(pos); | |
564 | if(isector == -1){ | |
565 | AliError("Detector Index could not be determined"); | |
566 | return iStrip;} | |
567 | Int_t iplate = GetPlate(pos); | |
568 | if(iplate == -1){ | |
569 | AliError("Detector Index could not be determined"); | |
570 | return iStrip;} | |
571 | ||
572 | ||
573 | Float_t x = pos[0]; | |
574 | Float_t y = pos[1]; | |
575 | Float_t z = pos[2]; | |
576 | ||
577 | Int_t nstrips=0; | |
578 | if(iplate==0 || iplate == 4)nstrips=kNStripC; | |
579 | if(iplate==1 || iplate == 3)nstrips=kNStripB; | |
580 | if(iplate==2) nstrips=kNStripA; | |
581 | ||
582 | Float_t rho=TMath::Sqrt(x*x+y*y); | |
583 | Float_t phi=TMath::ATan2(y,x); | |
584 | if(phi<0) phi=2.*TMath::Pi()+phi; | |
585 | // Get the local angle in the sector philoc | |
586 | Float_t philoc = phi*kRaddeg-(isector+0.5)*fPhiSec; | |
587 | philoc*=TMath::Pi()/180.; | |
588 | // theta projected on the median of the sector | |
589 | Float_t theta=TMath::ATan2(rho*TMath::Cos(philoc),z); | |
590 | ||
591 | for (Int_t istrip=0; istrip<nstrips; istrip++){ | |
592 | ||
593 | if( | |
594 | GetMaxStripTheta(iplate,istrip) >= theta | |
595 | && | |
596 | GetMinStripTheta(iplate,istrip) <= theta ) iStrip = istrip; | |
597 | ||
598 | } | |
599 | ||
600 | return iStrip; | |
601 | ||
602 | } | |
603 | //_____________________________________________________________________________ | |
7aeeaf38 | 604 | Int_t AliTOFGeometryV4::GetPadZ(Float_t *pos) const |
d3c7bfac | 605 | { |
606 | // | |
607 | // Returns the Pad index along Z | |
608 | // | |
609 | Int_t iPadZ = -1; | |
610 | ||
611 | Int_t isector = GetSector(pos); | |
612 | if(isector == -1){ | |
613 | AliError("Detector Index could not be determined"); | |
614 | return iPadZ;} | |
615 | Int_t iplate = GetPlate(pos); | |
616 | if(iplate == -1){ | |
617 | AliError("Detector Index could not be determined"); | |
618 | return iPadZ;} | |
619 | Int_t istrip = GetStrip(pos); | |
620 | if(istrip == -1){ | |
621 | AliError("Detector Index could not be determined"); | |
622 | return iPadZ;} | |
623 | ||
624 | ||
625 | Float_t x = pos[0]; | |
626 | Float_t y = pos[1]; | |
627 | Float_t z = pos[2]; | |
628 | ||
629 | Float_t rho=TMath::Sqrt(x*x+y*y); | |
630 | Float_t phi=TMath::ATan2(y,x); | |
631 | if(phi<0) phi=2.*TMath::Pi()+phi; | |
632 | Float_t philoc = phi*kRaddeg-(isector+0.5)*fPhiSec; | |
633 | philoc*=TMath::Pi()/180.; | |
634 | Float_t theta=TMath::ATan2(rho*TMath::Cos(philoc),z); | |
635 | ||
636 | if (theta >= GetStripTheta(iplate, istrip))iPadZ=1; | |
637 | else iPadZ=0; | |
638 | ||
639 | return iPadZ; | |
640 | ||
641 | } | |
642 | //_____________________________________________________________________________ | |
7aeeaf38 | 643 | Float_t AliTOFGeometryV4::GetMinPlateTheta(Int_t iPlate) const |
d3c7bfac | 644 | { |
645 | // | |
646 | // Returns the minimum theta angle of a given plate iPlate (rad) | |
647 | // | |
648 | ||
649 | ||
650 | Int_t index=0; | |
651 | ||
652 | Float_t delta =0.; | |
653 | if(iPlate==0)delta = -1. ; | |
654 | if(iPlate==1)delta = -0.5; | |
655 | if(iPlate==3)delta = +0.5; | |
656 | if(iPlate==4)delta = +1. ; | |
657 | ||
658 | Float_t z=(fgkRmin+2.)*TMath::Tan(fAngles[iPlate][index]/kRaddeg)+delta; | |
659 | Float_t r=(fgkRmin+fgkRmax)/2.+fHeights[iPlate][index]; | |
660 | z =z+fgkZPad*TMath::Cos(fAngles[iPlate][index]/kRaddeg); | |
661 | r =r-fgkZPad*TMath::Sin(fAngles[iPlate][index]/kRaddeg); | |
662 | ||
663 | Float_t thmin = 0.5*TMath::Pi()-TMath::ATan(z/r)-fgkDprecMin; | |
664 | return thmin; | |
665 | ||
666 | } | |
667 | //_____________________________________________________________________________ | |
7aeeaf38 | 668 | Float_t AliTOFGeometryV4::GetMaxPlateTheta(Int_t iPlate) const |
d3c7bfac | 669 | { |
670 | // | |
671 | // Returns the maximum theta angle of a given plate iPlate (rad) | |
672 | ||
673 | Int_t index=0; | |
674 | if(iPlate==0 ||iPlate == 4)index=kNStripC-1; | |
675 | if(iPlate==1 ||iPlate == 3)index=kNStripB-1; | |
676 | if(iPlate==2) index=kNStripA-1; | |
677 | ||
678 | Float_t delta =0.; | |
679 | if(iPlate==0)delta = -1. ; | |
680 | if(iPlate==1)delta = -0.5; | |
681 | if(iPlate==3)delta = +0.5; | |
682 | if(iPlate==4)delta = +1. ; | |
683 | ||
684 | Float_t z=(fgkRmin+2.)*TMath::Tan(fAngles[iPlate][index]/kRaddeg)+delta; | |
685 | Float_t r=(fgkRmin+fgkRmax)/2.+fHeights[iPlate][index]; | |
686 | z =z-fgkZPad*TMath::Cos(fAngles[iPlate][index]/kRaddeg); | |
687 | r= r+fgkZPad*TMath::Sin(fAngles[iPlate][index]/kRaddeg); | |
688 | ||
689 | Float_t thmax = 0.5*TMath::Pi()-TMath::ATan(z/r)+fgkDprecMax; | |
690 | ||
691 | return thmax; | |
692 | ||
693 | } | |
694 | //_____________________________________________________________________________ | |
7aeeaf38 | 695 | Float_t AliTOFGeometryV4::GetMaxStripTheta(Int_t iPlate, Int_t iStrip) const |
d3c7bfac | 696 | { |
697 | // | |
698 | // Returns the maximum theta angle of a given strip iStrip (rad) | |
699 | // | |
700 | ||
701 | ||
702 | Float_t delta =0.; | |
703 | if(iPlate==0)delta = -1. ; | |
704 | if(iPlate==1)delta = -0.5; | |
705 | if(iPlate==3)delta = +0.5; | |
706 | if(iPlate==4)delta = +1. ; | |
707 | ||
708 | Float_t r =(fgkRmin+fgkRmax)/2.+fHeights[iPlate][iStrip]; | |
709 | Float_t z =(fgkRmin+2.)*TMath::Tan(fAngles[iPlate][iStrip]/kRaddeg)+delta; | |
710 | z = z-fgkZPad*TMath::Cos(fAngles[iPlate][iStrip]/kRaddeg); | |
711 | r = r+fgkZPad*TMath::Sin(fAngles[iPlate][iStrip]/kRaddeg); | |
712 | Float_t thmax =0.5*TMath::Pi()-TMath::ATan(z/r)+fgkDprecMax; | |
713 | return thmax; | |
714 | ||
715 | } | |
716 | //_____________________________________________________________________________ | |
7aeeaf38 | 717 | Float_t AliTOFGeometryV4::GetMinStripTheta(Int_t iPlate, Int_t iStrip) const |
d3c7bfac | 718 | { |
719 | // | |
720 | // Returns the minimum theta angle of a given Strip iStrip (rad) | |
721 | // | |
722 | ||
723 | ||
724 | Float_t delta =0.; | |
725 | if(iPlate==0)delta = -1. ; | |
726 | if(iPlate==1)delta = -0.5; | |
727 | if(iPlate==3)delta = +0.5; | |
728 | if(iPlate==4)delta = +1. ; | |
729 | ||
730 | ||
731 | Float_t r =(fgkRmin+fgkRmax)/2.+fHeights[iPlate][iStrip]; | |
732 | Float_t z =(fgkRmin+2.)*TMath::Tan(fAngles[iPlate][iStrip]/kRaddeg)+delta; | |
733 | z =z+fgkZPad*TMath::Cos(fAngles[iPlate][iStrip]/kRaddeg); | |
734 | r =r-fgkZPad*TMath::Sin(fAngles[iPlate][iStrip]/kRaddeg); | |
735 | Float_t thmin =0.5*TMath::Pi()-TMath::ATan(z/r)-fgkDprecMin; | |
736 | ||
737 | return thmin; | |
738 | ||
739 | } | |
740 | //_____________________________________________________________________________ | |
7aeeaf38 | 741 | Float_t AliTOFGeometryV4::GetStripTheta(Int_t iPlate, Int_t iStrip) const |
d3c7bfac | 742 | { |
743 | // | |
744 | // returns the median theta angle of a given strip iStrip (rad) | |
745 | // | |
746 | ||
747 | ||
748 | Float_t delta =0.; | |
749 | if(iPlate==0)delta = -1. ; | |
750 | if(iPlate==1)delta = -0.5; | |
751 | if(iPlate==3)delta = +0.5; | |
752 | if(iPlate==4)delta = +1. ; | |
753 | ||
754 | Float_t r =(fgkRmin+fgkRmax)/2.+fHeights[iPlate][iStrip]; | |
755 | Float_t z =(fgkRmin+2.)*TMath::Tan(fAngles[iPlate][iStrip]/kRaddeg)+delta; | |
756 | Float_t theta =0.5*TMath::Pi()-TMath::ATan(z/r); | |
757 | if(iPlate != 2){ | |
758 | if(theta > 0.5*TMath::Pi() )theta+=fgkDprecCen; | |
759 | if(theta < 0.5*TMath::Pi() )theta-=fgkDprecCen; | |
760 | } | |
761 | return theta; | |
762 | ||
763 | } | |
764 | //_____________________________________________________________________________ | |
a6a9820c | 765 | void AliTOFGeometryV4::GetVolumePath(Int_t *ind, Char_t *path ) { |
766 | //-------------------------------------------------------------------- | |
767 | // This function returns the colume path of a given pad | |
768 | //-------------------------------------------------------------------- | |
769 | Int_t sector = ind[0]; | |
770 | Char_t string1[100]; | |
771 | Char_t string2[100]; | |
772 | Char_t string3[100]; | |
773 | Char_t string4[100]; | |
774 | Int_t nstrB = NStripB(); | |
775 | Int_t nstrC = NStripC(); | |
776 | ||
777 | Int_t icopy=-1; | |
778 | ||
779 | if(sector<3){ | |
780 | icopy=sector+1; | |
781 | sprintf(string1,"/ALIC_1/B077_1/B075_%i/BTO3_1",icopy); | |
782 | } | |
783 | else if(sector<11){ | |
784 | // icopy=sector-2; | |
785 | icopy=sector+3; | |
786 | sprintf(string1,"/ALIC_1/B077_1/B071_%i/BTO1_1",icopy); | |
787 | } | |
788 | else if(sector==11 || sector==12){ | |
789 | icopy=sector-10; | |
790 | sprintf(string1,"/ALIC_1/B077_1/B074_%i/BTO2_1",icopy); | |
791 | } | |
792 | else { | |
793 | // icopy=sector-4; | |
794 | icopy=sector-12; | |
795 | sprintf(string1,"/ALIC_1/B077_1/B071_%i/BTO1_1",icopy); | |
796 | } | |
797 | ||
798 | Int_t modnum=ind[1]; | |
799 | Int_t istrip=ind[2]; | |
800 | ||
801 | if( modnum ==0){ | |
802 | sprintf(string2,"FTOC_1/FLTC_0"); | |
803 | icopy= nstrC - istrip; | |
804 | sprintf(string3,"FSTR_%i",icopy); | |
805 | } | |
806 | else if( modnum ==1){ | |
807 | sprintf(string2,"FTOB_1/FLTB_0"); | |
808 | icopy= nstrB - istrip; | |
809 | sprintf(string3,"FSTR_%i",icopy); | |
810 | } | |
811 | else if( modnum ==2){ | |
812 | sprintf(string2,"FTOA_0/FLTA_0"); | |
813 | icopy= istrip+1; | |
814 | sprintf(string3,"FSTR_%i",icopy); | |
815 | } | |
816 | else if( modnum ==3){ | |
817 | sprintf(string2,"FTOB_2/FLTB_0"); | |
818 | icopy= istrip+1; | |
819 | sprintf(string3,"FSTR_%i",icopy); | |
820 | } | |
821 | else if( modnum ==4){ | |
822 | sprintf(string2,"FTOC_2/FLTC_0"); | |
823 | icopy= istrip+1; | |
824 | sprintf(string3,"FSTR_%i",icopy); | |
825 | } | |
826 | ||
827 | ||
828 | Int_t padz = ind[3]+1; | |
829 | Int_t padx = ind[4]+1; | |
830 | if(modnum==3 || modnum==4){ | |
831 | padz = NpadZ() -ind[3]; | |
832 | padx = NpadX() -ind[4]; | |
833 | } | |
834 | sprintf(string4,"FSEN_0/FSEZ_%i/FSEX_%i",padz,padx); | |
835 | sprintf(path,"%s/%s/%s/%s",string1,string2,string3,string4); | |
836 | ||
837 | } | |
838 | ||
839 | //_____________________________________________________________________________ | |
840 | void AliTOFGeometryV4::GetPos(Int_t *det, Float_t *pos) | |
841 | { | |
842 | // | |
843 | // Returns space point coor (x,y,z) (cm) for Detector | |
844 | // Indices (iSect,iPlate,iStrip,iPadX,iPadZ) | |
845 | // | |
846 | Char_t path[100]; | |
847 | GetVolumePath(det,path ); | |
848 | if (!gGeoManager) { | |
849 | printf("ERROR: no TGeo\n"); | |
850 | } | |
851 | gGeoManager->cd(path); | |
852 | TGeoHMatrix global; | |
853 | global = *gGeoManager->GetCurrentMatrix(); | |
854 | const Double_t *tr = global.GetTranslation(); | |
855 | ||
856 | pos[0]=tr[0]; | |
857 | pos[1]=tr[1]; | |
858 | pos[2]=tr[2]; | |
859 | } | |
860 | //_____________________________________________________________________________ |