]>
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$ | |
0ef21f59 | 18 | Revision 1.18 2007/02/19 18:55:26 decaro |
19 | Added getter methods for volume path (for Event Display) | |
20 | ||
48e6af28 | 21 | Revision 1.17.1 2006/12/15 |
22 | Added method DetToStripRF(...) to get | |
23 | a pad corner coordinates in its strip reference frame | |
24 | (A.De Caro, M.Di Stefano) | |
25 | Revision 1.17 2006/08/22 13:30:02 arcelli | |
26 | removal of effective c++ warnings (C.Zampolli) | |
27 | ||
655e379f | 28 | Revision 1.16 2006/04/20 22:30:50 hristov |
29 | Coding conventions (Annalisa) | |
30 | ||
0e46b9ae | 31 | Revision 1.15 2006/04/16 22:29:05 hristov |
32 | Coding conventions (Annalisa) | |
33 | ||
7aeeaf38 | 34 | Revision 1.14 2006/04/05 08:35:38 hristov |
35 | Coding conventions (S.Arcelli, C.Zampolli) | |
36 | ||
340693af | 37 | Revision 1.13 2006/03/12 14:37:54 arcelli |
38 | Changes for TOF Reconstruction using TGeo | |
39 | ||
c0545837 | 40 | Revision 1.12 2006/02/28 10:38:00 decaro |
41 | AliTOFGeometry::fAngles, AliTOFGeometry::fHeights, AliTOFGeometry::fDistances arrays: dimension definition in the right location | |
42 | ||
4402e7cb | 43 | Revision 1.11 2005/12/15 14:17:29 decaro |
44 | Correction of some parameter values | |
45 | ||
6fbc8979 | 46 | Revision 1.10 2005/12/15 08:55:32 decaro |
47 | New TOF geometry description (V5) -G. Cara Romeo and A. De Caro | |
48 | ||
d3c7bfac | 49 | Revision 1.9.1 2005/07/19 A. De Caro |
50 | Created daughter-classes AliTOFGeometryV4 and AliTOFGeometryV5 | |
51 | => moved global methods IsInsideThePad, DistanceToPad, | |
52 | GetPlate, GetSector, GetStrip, GetPadX, GetPadZ, | |
53 | GetX, GetY, GetZ, GetPadDx, GetPadDy and GetPadDz | |
54 | in daughter-classes | |
55 | ||
56 | Revision 1.9 2005/10/20 12:41:35 hristov | |
57 | Implementation of parallel tracking. It is not the default version, one can use it passing option MI from AliReconstruction to TOF (M.Ivanov) | |
58 | ||
d88fbf15 | 59 | Revision 1.8 2004/11/29 08:28:01 decaro |
60 | Introduction of a new TOF constant (i.e. TDC bin width) | |
61 | ||
43f77f2d | 62 | Revision 1.7 2004/11/05 07:20:08 decaro |
63 | TOF library splitting and conversion of some printout messages in AliLog schema (T.Kuhr) | |
64 | ||
d076c8d5 | 65 | Revision 1.6 2004/06/15 15:27:59 decaro |
66 | TOF raw data: preliminary implementation and style changes | |
67 | ||
7e6dce66 | 68 | Revision 1.5 2004/04/20 14:37:22 hristov |
69 | Using TMath::Abs instead of fabs, arrays of variable size created/deleted correctly (HP,Sun) | |
70 | ||
9b49e4c9 | 71 | Revision 1.4 2004/04/13 09:42:51 decaro |
72 | Track reconstruction code for TOF: updating | |
73 | ||
74ea065c | 74 | Revision 1.3 2003/12/29 18:40:39 hristov |
75 | Copy/paste error corrected | |
76 | ||
fb9747d4 | 77 | Revision 1.2 2003/12/29 17:26:01 hristov |
78 | Using enum to initaialize static ints in the header file, the initialization of static floats moved to the implementation file | |
79 | ||
58eb5b61 | 80 | Revision 1.1 2003/12/29 15:18:03 decaro |
81 | TOF geometry updating (addition of AliTOFGeometry) | |
82 | ||
7e6dce66 | 83 | Revision 0.05 2004/6/11 A.De Caro |
84 | Implement Global method NpadXStrip | |
85 | Insert four float constants (originally in AliTOF class) | |
86 | Revision 0.04 2004/4/05 S.Arcelli | |
74ea065c | 87 | Implement Global methods IsInsideThePad |
88 | DistanceToPad | |
7e6dce66 | 89 | Revision 0.03 2003/12/14 S.Arcelli |
90 | Set Phi range [-180,180]->[0,360] | |
91 | Revision 0.02 2003/12/10 S.Arcelli: | |
92 | Implement Global methods GetPos & GetDetID | |
93 | Revision 0.01 2003/12/04 S.Arcelli | |
0f4a7374 | 94 | */ |
95 | ||
0f4a7374 | 96 | /////////////////////////////////////////////////////////////////////////////// |
97 | // // | |
98 | // TOF Geometry class // | |
99 | // // | |
100 | /////////////////////////////////////////////////////////////////////////////// | |
101 | ||
0ef21f59 | 102 | #include "TGeoManager.h" |
0f4a7374 | 103 | #include "AliTOFGeometry.h" |
0ef21f59 | 104 | #include "AliLog.h" |
105 | #include "AliConst.h" | |
106 | ||
107 | extern TGeoManager *gGeoManager; | |
0f4a7374 | 108 | |
109 | ClassImp(AliTOFGeometry) | |
110 | ||
0ef21f59 | 111 | const Float_t AliTOFGeometry::fgkZlenA = 370.6*2.; // length (cm) of the A module |
112 | const Float_t AliTOFGeometry::fgkZlenB = 146.5; // length (cm) of the B module | |
113 | const Float_t AliTOFGeometry::fgkZlenC = 170.45; // length (cm) of the C module | |
114 | const Float_t AliTOFGeometry::fgkMaxhZtof = 370.6; // Max half z-size of TOF (cm) | |
115 | ||
116 | const Float_t AliTOFGeometry::fgkxTOF = 371.-0.01;// Inner radius of the TOF for Reconstruction (cm) | |
117 | const Float_t AliTOFGeometry::fgkRmin = 370.-0.01;// Inner radius of the TOF (cm) | |
118 | const Float_t AliTOFGeometry::fgkRmax = 399.-0.01;// Outer radius of the TOF (cm) | |
58eb5b61 | 119 | |
0ef21f59 | 120 | const Int_t AliTOFGeometry::fgkTimeDiff = 25000; // Min signal separation (ps) |
7e6dce66 | 121 | const Float_t AliTOFGeometry::fgkXPad = 2.5; // Pad size in the x direction (cm) |
122 | const Float_t AliTOFGeometry::fgkZPad = 3.5; // Pad size in the z direction (cm) | |
58eb5b61 | 123 | |
4402e7cb | 124 | const Float_t AliTOFGeometry::fgkStripLength = 122.;// Strip Length (rho X phi direction) (cm) |
125 | ||
d3c7bfac | 126 | const Float_t AliTOFGeometry::fgkSigmaForTail1= 2.; //Sig1 for simulation of TDC tails |
fb9747d4 | 127 | const Float_t AliTOFGeometry::fgkSigmaForTail2= 0.5;//Sig2 for simulation of TDC tails |
58eb5b61 | 128 | |
0ef21f59 | 129 | const Float_t AliTOFGeometry::fgkPhiSec= 20;//sector Phi width (deg) |
130 | ||
48e6af28 | 131 | const Float_t AliTOFGeometry::fgkTdcBin = 24.4; // time-of-flight bin width [ps] |
132 | const Float_t AliTOFGeometry::fgkToTBin = 48.8; // time-over-threshold bin width [ps] | |
43f77f2d | 133 | |
0ef21f59 | 134 | const Float_t AliTOFGeometry::fgkAngles[kNPlates][kMaxNstrip] ={ |
135 | { 43.99, 43.20, 42.40, 41.59, 40.77, 39.94, 39.11, 38.25, 37.40, 36.53, | |
136 | 35.65, 34.76, 33.87, 32.96, 32.05, 31.13, 30.19, 29.24, 12.33, 0.00}, | |
137 | ||
138 | { 27.26, 26.28, 25.30, 24.31, 23.31, 22.31, 21.30, 20.29, 19.26, 18.24, | |
139 | 17.20, 16.16, 15.11, 14.05, 13.00, 11.93, 10.87, 9.80, 8.74, 0.00}, | |
140 | ||
141 | { 0.00, 6.30, 5.31, 4.25, 3.19, 2.12, 1.06, 0.00, -1.06, -2.12, | |
142 | -3.19, -4.25, -5.31, -6.30, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00}, | |
143 | ||
144 | { -8.74, -9.80, -10.87, -11.93, -13.00, -14.05, -15.11, -16.16, -17.20, -18.24, | |
145 | -19.26, -20.29, -21.30, -22.31, -23.31, -24.31, -25.30, -26.28, -27.26, 0.00}, | |
146 | ||
147 | {-12.33, -29.24, -30.19, -31.13, -32.05, -32.96, -33.87, -34.76, -35.65, -36.53, | |
148 | -37.40, -38.25, -39.11, -39.94, -40.77, -41.59, -42.40, -43.20, -43.99, 0.00} | |
149 | }; | |
150 | const Float_t AliTOFGeometry::fgkHeights[kNPlates][kMaxNstrip]= { | |
151 | {-8.2, -7.5, -8.2, -7.7, -8.1, -7.6, -7.7, -7.7, -7.7, -7.7, | |
152 | -7.5, -7.2, -7.3, -7.5, -7.6, -7.8, -8.3, -9.3, -3.1, 0.0}, | |
153 | ||
154 | {-7.9, -8.1, -8.5, -9.0, -10.1, -3.9, -5.9, -7.7, -10.1, -3.6, | |
155 | -5.8, -8.0, -10.4, -4.4, -7.2, -10.2, -4.6, -7.4, -10.4, 0.0}, | |
156 | ||
157 | {-2.5, -10.4, -5.0, -9.9, -4.8, -9.9, -4.7, -10.2, -4.7, -9.9, | |
158 | -4.8, -9.9, -5.0, -10.4, -2.5, 0.0, 0.0, 0.0, 0.0, 0.0}, | |
159 | ||
160 | {-10.4, -7.4, -4.6, -10.2, -7.2, -4.4, -10.4, -8.0, -5.8, -3.6, | |
161 | -10.1, -7.7, -5.9, -3.9, -10.1, -9.0, -8.5, -8.1, -7.9, 0.0}, | |
162 | ||
163 | { -3.1, -9.3, -8.3, -7.8, -7.6, -7.5, -7.3, -7.2, -7.5, -7.7, | |
164 | -7.7, -7.7, -7.7, -7.6, -8.1, -7.7, -8.2, -7.5, -8.2, 0.0} | |
165 | }; | |
166 | ||
167 | ||
168 | const Float_t AliTOFGeometry::fgkDistances[kNPlates][kMaxNstrip]= { | |
169 | { 364.1, 354.9, 344.5, 335.4, 325.5, 316.6, 307.2, 298.0, 288.9, 280.0, | |
170 | 271.3, 262.7, 254.0, 244.8, 236.1, 227.7, 219.1, 210.3, 205.7, 0.0}, | |
171 | ||
172 | { 194.2, 186.1, 177.9, 169.8, 161.5, 156.3, 147.8, 139.4, 130.9, 125.6, | |
173 | 117.3, 109.2, 101.1, 95.3, 87.1, 79.2, 73.0, 65.1, 57.6, 0.0}, | |
174 | ||
175 | { 49.5, 41.3, 35.3, 27.8, 21.2, 13.9, 7.0, 0.0, -7.0, -13.9, | |
176 | -21.2, -27.8, -35.3, -41.3, -49.5, 0.0, 0.0, 0.0, 0.0, 0.0}, | |
177 | ||
178 | { -57.6, -65.1, -73.0, -79.2, -87.1, -95.3, -101.1, -109.2, -117.3, -125.6, | |
179 | -130.9, -139.4, -147.8, -156.3, -161.5, -169.8, -177.9, -186.1, -194.2, 0.0}, | |
180 | ||
181 | {-205.7, -210.3, -219.1, -227.7, -236.1, -244.8, -254.0, -262.7, -271.3, -280.0, | |
182 | -288.9, -298.0, -307.2, -316.6, -325.5, -335.4, -344.5, -354.9, -364.1, 0.0} | |
183 | }; | |
0f4a7374 | 184 | //_____________________________________________________________________________ |
655e379f | 185 | AliTOFGeometry::AliTOFGeometry(): |
0ef21f59 | 186 | fHoles(0) |
0f4a7374 | 187 | { |
188 | // | |
189 | // AliTOFGeometry default constructor | |
190 | // | |
0f4a7374 | 191 | |
192 | } | |
193 | ||
194 | //_____________________________________________________________________________ | |
195 | AliTOFGeometry::~AliTOFGeometry() | |
196 | { | |
197 | // | |
198 | // AliTOFGeometry destructor | |
199 | // | |
0f4a7374 | 200 | } |
201 | //_____________________________________________________________________________ | |
0ef21f59 | 202 | void AliTOFGeometry::ImportGeometry(){ |
203 | TGeoManager::Import("geometry.root"); | |
0f4a7374 | 204 | } |
0f4a7374 | 205 | //_____________________________________________________________________________ |
7aeeaf38 | 206 | void AliTOFGeometry::GetPosPar(Int_t *det, Float_t *pos) const |
0f4a7374 | 207 | { |
208 | // | |
209 | // Returns space point coor (x,y,z) (cm) for Detector | |
210 | // Indices (iSect,iPlate,iStrip,iPadX,iPadZ) | |
211 | // | |
212 | ||
213 | pos[0]=GetX(det); | |
214 | pos[1]=GetY(det); | |
215 | pos[2]=GetZ(det); | |
216 | ||
217 | } | |
218 | //_____________________________________________________________________________ | |
7aeeaf38 | 219 | void AliTOFGeometry::GetDetID( Float_t *pos, Int_t *det) const |
0f4a7374 | 220 | { |
221 | // | |
222 | // Returns Detector Indices (iSect,iPlate,iStrip,iPadX,iPadZ) | |
223 | // space point coor (x,y,z) (cm) | |
224 | ||
225 | ||
226 | det[0]=GetSector(pos); | |
227 | det[1]=GetPlate(pos); | |
228 | det[2]=GetStrip(pos); | |
229 | det[3]=GetPadZ(pos); | |
230 | det[4]=GetPadX(pos); | |
231 | ||
232 | } | |
233 | //_____________________________________________________________________________ | |
48e6af28 | 234 | |
235 | void AliTOFGeometry::DetToStripRF(Int_t nPadX, Int_t nPadZ, Float_t &x, Float_t &z) const | |
236 | { | |
237 | // | |
238 | // Returns the local coordinates (x, z) in strip reference frame | |
239 | // for the bottom corner of the pad number (nPadX, nPadZ) | |
240 | // | |
241 | /* | |
242 | const Float_t xCenterStrip = kNpadX * fgkXPad / 2.; | |
243 | const Float_t zCenterStrip = kNpadZ * fgkZPad / 2.; | |
244 | ||
245 | const Float_t xCenterPad = nPadX*fgkXPad + fgkXPad / 2.; | |
246 | const Float_t zCenterPad = nPadZ*fgkZPad + fgkZPad / 2.; | |
247 | ||
248 | x = xCenterPad - xCenterStrip; | |
249 | z = zCenterPad - zCenterStrip; | |
250 | */ | |
251 | ||
252 | ||
253 | x = (nPadX - kNpadX*0.5) * fgkXPad; | |
254 | z = (nPadZ - kNpadZ*0.5) * fgkZPad; | |
255 | ||
256 | ||
257 | } | |
258 | //_____________________________________________________________________________ | |
0ef21f59 | 259 | Float_t AliTOFGeometry::DistanceToPadPar(Int_t *det, Float_t *pos, Float_t *dist3d) const |
260 | { | |
261 | // | |
262 | // Returns distance of space point with coor pos (x,y,z) (cm) wrt | |
263 | // pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ) | |
264 | // | |
265 | ||
266 | //Transform pos into Sector Frame | |
267 | ||
268 | Float_t x = pos[0]; | |
269 | Float_t y = pos[1]; | |
270 | Float_t z = pos[2]; | |
271 | ||
272 | Float_t radius = TMath::Sqrt(x*x+y*y); | |
273 | //Float_t phi=TMath::ATan(y/x); | |
274 | //if(phi<0) phi = k2PI+phi; //2.*TMath::Pi()+phi; | |
275 | Float_t phi = TMath::Pi()+TMath::ATan2(-y,-x); | |
276 | // Get the local angle in the sector philoc | |
277 | Float_t angle = phi*kRaddeg-( Int_t (kRaddeg*phi/fgkPhiSec) + 0.5)*fgkPhiSec; | |
278 | Float_t xs = radius*TMath::Cos(angle/kRaddeg); | |
279 | Float_t ys = radius*TMath::Sin(angle/kRaddeg); | |
280 | Float_t zs = z; | |
281 | ||
282 | // Do the same for the selected pad | |
283 | ||
284 | Float_t g[3]; | |
285 | GetPosPar(det,g); | |
286 | ||
287 | Float_t padRadius = TMath::Sqrt(g[0]*g[0]+g[1]*g[1]); | |
288 | //Float_t padPhi = TMath::ATan(g[1]/g[0]); | |
289 | //if(padPhi<0) padPhi = k2Pi + padPhi; | |
290 | Float_t padPhi = TMath::Pi()+TMath::ATan2(-g[1],-g[0]); | |
291 | ||
292 | // Get the local angle in the sector philoc | |
293 | Float_t padAngle = padPhi*kRaddeg-( Int_t (padPhi*kRaddeg/fgkPhiSec)+ 0.5) * fgkPhiSec; | |
294 | Float_t padxs = padRadius*TMath::Cos(padAngle/kRaddeg); | |
295 | Float_t padys = padRadius*TMath::Sin(padAngle/kRaddeg); | |
296 | Float_t padzs = g[2]; | |
297 | ||
298 | //Now move to local pad coordinate frame. Translate: | |
299 | ||
300 | Float_t xt = xs-padxs; | |
301 | Float_t yt = ys-padys; | |
302 | Float_t zt = zs-padzs; | |
303 | //Now Rotate: | |
304 | ||
305 | Float_t alpha = GetAngles(det[1],det[2]); | |
306 | Float_t xr = xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg); | |
307 | Float_t yr = yt; | |
308 | Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg); | |
309 | ||
310 | Float_t dist = TMath::Sqrt(xr*xr+yr*yr+zr*zr); | |
311 | ||
312 | if (dist3d){ | |
313 | dist3d[0] = xr; | |
314 | dist3d[1] = yr; | |
315 | dist3d[2] = zr; | |
316 | } | |
317 | ||
318 | return dist; | |
319 | ||
320 | } | |
321 | //_____________________________________________________________________________ | |
322 | Bool_t AliTOFGeometry::IsInsideThePadPar(Int_t *det, Float_t *pos) const | |
323 | { | |
324 | // | |
325 | // Returns true if space point with coor pos (x,y,z) (cm) falls | |
326 | // inside pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ) | |
327 | // | |
328 | ||
329 | Bool_t isInside=false; | |
330 | ||
331 | /* | |
332 | const Float_t khhony = 1.0 ; // heigth of HONY Layer | |
333 | const Float_t khpcby = 0.08 ; // heigth of PCB Layer | |
334 | const Float_t khrgly = 0.055 ; // heigth of RED GLASS Layer | |
335 | const Float_t khglfy = 0.285 ; // heigth of GLASS+FISHLINE Layer | |
336 | const Float_t khcpcby = 0.16 ; // heigth of PCB Central Layer | |
337 | //const Float_t kwcpcbz = 12.4 ; // z dimension of PCB Central Layer | |
338 | const Float_t khstripy = 2.*khhony+2.*khpcby+4.*khrgly+2.*khglfy+khcpcby;//3.11 | |
339 | //const Float_t kwstripz = kwcpcbz; | |
340 | //const Float_t klstripx = fgkStripLength; | |
341 | */ | |
342 | ||
343 | const Float_t kPadDepth = 0.5;//0.05;//0.11;//0.16;// // heigth of Sensitive Layer | |
344 | ||
345 | //Transform pos into Sector Frame | |
346 | ||
347 | Float_t x = pos[0]; | |
348 | Float_t y = pos[1]; | |
349 | Float_t z = pos[2]; | |
350 | ||
351 | Float_t radius = TMath::Sqrt(x*x+y*y); | |
352 | Float_t phi = TMath::Pi()+TMath::ATan2(-y,-x); | |
353 | ||
354 | // Get the local angle in the sector philoc | |
355 | Float_t angle = phi*kRaddeg-( Int_t (kRaddeg*phi/fgkPhiSec) + 0.5) *fgkPhiSec; | |
356 | Float_t xs = radius*TMath::Cos(angle/kRaddeg); | |
357 | Float_t ys = radius*TMath::Sin(angle/kRaddeg); | |
358 | Float_t zs = z; | |
359 | ||
360 | // Do the same for the selected pad | |
361 | ||
362 | Float_t g[3]; | |
363 | GetPosPar(det,g); | |
364 | ||
365 | Float_t padRadius = TMath::Sqrt(g[0]*g[0]+g[1]*g[1]); | |
366 | Float_t padPhi = TMath::Pi()+TMath::ATan2(-g[1],-g[0]); | |
367 | ||
368 | // Get the local angle in the sector philoc | |
369 | Float_t padAngle = padPhi*kRaddeg-( Int_t (padPhi*kRaddeg/fgkPhiSec)+ 0.5) * fgkPhiSec; | |
370 | Float_t padxs = padRadius*TMath::Cos(padAngle/kRaddeg); | |
371 | Float_t padys = padRadius*TMath::Sin(padAngle/kRaddeg); | |
372 | Float_t padzs = g[2]; | |
373 | ||
374 | //Now move to local pad coordinate frame. Translate: | |
375 | ||
376 | Float_t xt = xs-padxs; | |
377 | Float_t yt = ys-padys; | |
378 | Float_t zt = zs-padzs; | |
379 | ||
380 | //Now Rotate: | |
381 | ||
382 | Float_t alpha = GetAngles(det[1],det[2]); | |
383 | Float_t xr = xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg); | |
384 | Float_t yr = yt; | |
385 | Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg); | |
386 | ||
387 | if(TMath::Abs(xr)<=kPadDepth*0.5 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5)) | |
388 | isInside=true; | |
389 | return isInside; | |
390 | ||
391 | } | |
392 | //_____________________________________________________________________________ | |
393 | Bool_t AliTOFGeometry::IsInsideThePad(TGeoHMatrix mat, Float_t *pos, Float_t *dist3d) const | |
394 | { | |
395 | // | |
396 | // Returns true if space point with coor pos (x,y,z) (cm) falls | |
397 | // inside pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ) | |
398 | // | |
399 | ||
400 | const Float_t kPadDepth = 0.5; // heigth of Sensitive Layer | |
401 | Double_t vecg[3]; | |
402 | vecg[0]=pos[0]; | |
403 | vecg[1]=pos[1]; | |
404 | vecg[2]=pos[2]; | |
405 | Double_t veclr[3]={-1.,-1.,-1.}; | |
406 | Double_t vecl[3]={-1.,-1.,-1.}; | |
407 | mat.MasterToLocal(vecg,veclr); | |
408 | vecl[0]=veclr[1]; | |
409 | vecl[1]=veclr[0]; | |
410 | //take into account reflections | |
411 | vecl[2]=-veclr[2]; | |
412 | ||
413 | Float_t xr = vecl[0]; | |
414 | Float_t yr = vecl[1]; | |
415 | Float_t zr = vecl[2]; | |
416 | ||
417 | if (dist3d){ | |
418 | dist3d[0] = vecl[0]; | |
419 | dist3d[1] = vecl[1]; | |
420 | dist3d[2] = vecl[2]; | |
421 | } | |
422 | ||
423 | Bool_t isInside=false; | |
424 | if(TMath::Abs(xr)<= kPadDepth*0.5 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5)) | |
425 | isInside=true; | |
426 | return isInside; | |
427 | ||
428 | } | |
429 | //_____________________________________________________________________________ | |
430 | void AliTOFGeometry::GetVolumePath(Int_t *ind, Char_t *path ) { | |
431 | //-------------------------------------------------------------------- | |
432 | // This function returns the colume path of a given pad | |
433 | //-------------------------------------------------------------------- | |
434 | Int_t sector = ind[0]; | |
435 | Char_t string1[100]; | |
436 | Char_t string2[100]; | |
437 | Char_t string3[100]; | |
438 | ||
439 | Int_t icopy=-1; | |
440 | icopy=sector; | |
441 | ||
442 | sprintf(string1,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1",icopy,icopy); | |
443 | ||
444 | Int_t iplate=ind[1]; | |
445 | Int_t istrip=ind[2]; | |
446 | if( iplate==0) icopy=istrip; | |
447 | if( iplate==1) icopy=istrip+NStripC(); | |
448 | if( iplate==2) icopy=istrip+NStripC()+NStripB(); | |
449 | if( iplate==3) icopy=istrip+NStripC()+NStripB()+NStripA(); | |
450 | if( iplate==4) icopy=istrip+NStripC()+2*NStripB()+NStripA(); | |
451 | icopy++; | |
452 | sprintf(string2,"FTOA_0/FLTA_0/FSTR_%i",icopy); | |
453 | if(fHoles && (sector==11 || sector==12)){ | |
454 | if(iplate<2) sprintf(string2,"FTOB_0/FLTB_0/FSTR_%i",icopy); | |
455 | if(iplate>2) sprintf(string2,"FTOC_0/FLTC_0/FSTR_%i",icopy); | |
456 | } | |
457 | ||
458 | Int_t padz = ind[3]+1; | |
459 | Int_t padx = ind[4]+1; | |
460 | sprintf(string3,"FPCB_1/FSEN_1/FSEZ_%i/FPAD_%i",padz,padx); | |
461 | sprintf(path,"%s/%s/%s",string1,string2,string3); | |
462 | ||
463 | } | |
464 | //_____________________________________________________________________________ | |
465 | void AliTOFGeometry::GetVolumePath(Int_t sector, Char_t *path ){ | |
466 | //-------------------------------------------------------------------- | |
467 | // This function returns the colume path of a given sector | |
468 | //-------------------------------------------------------------------- | |
469 | ||
470 | Char_t string[100]; | |
471 | ||
472 | Int_t icopy = sector; | |
473 | ||
474 | sprintf(string,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1",icopy,icopy); | |
475 | sprintf(path,"%s",string); | |
476 | ||
477 | } | |
478 | //_____________________________________________________________________________ | |
479 | void AliTOFGeometry::GetVolumePath(Int_t sector, Int_t plate, Int_t strip, Char_t *path ) { | |
480 | //-------------------------------------------------------------------- | |
481 | // This function returns the colume path of a given strip | |
482 | //-------------------------------------------------------------------- | |
483 | ||
484 | Char_t string1[100]; | |
485 | Char_t string2[100]; | |
486 | Char_t string3[100]; | |
487 | ||
488 | Int_t icopy = sector; | |
489 | ||
490 | sprintf(string1,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1",icopy,icopy); | |
491 | ||
492 | if(plate==0) icopy=strip; | |
493 | if(plate==1) icopy=strip+NStripC(); | |
494 | if(plate==2) icopy=strip+NStripC()+NStripB(); | |
495 | if(plate==3) icopy=strip+NStripC()+NStripB()+NStripA(); | |
496 | if(plate==4) icopy=strip+NStripC()+2*NStripB()+NStripA(); | |
497 | icopy++; | |
498 | sprintf(string2,"FTOA_0/FLTA_0/FSTR_%i",icopy); | |
499 | if(fHoles && (sector==11 || sector==12)) { | |
500 | if(plate<2) sprintf(string2,"FTOB_0/FLTB_0/FSTR_%i",icopy); | |
501 | if(plate>2) sprintf(string2,"FTOC_0/FLTC_0/FSTR_%i",icopy); | |
502 | } | |
503 | ||
504 | sprintf(string3,"FPCB_1/FSEN_1"); | |
505 | sprintf(path,"%s/%s/%s",string1,string2,string3); | |
506 | ||
507 | } | |
508 | //_____________________________________________________________________________ | |
509 | void AliTOFGeometry::GetPos(Int_t *det, Float_t *pos) | |
510 | { | |
511 | // | |
512 | // Returns space point coor (x,y,z) (cm) for Detector | |
513 | // Indices (iSect,iPlate,iStrip,iPadX,iPadZ) | |
514 | // | |
515 | Char_t path[100]; | |
516 | GetVolumePath(det,path ); | |
517 | if (!gGeoManager) { | |
518 | printf("ERROR: no TGeo\n"); | |
519 | } | |
520 | gGeoManager->cd(path); | |
521 | TGeoHMatrix global; | |
522 | global = *gGeoManager->GetCurrentMatrix(); | |
523 | const Double_t *tr = global.GetTranslation(); | |
524 | ||
525 | pos[0]=tr[0]; | |
526 | pos[1]=tr[1]; | |
527 | pos[2]=tr[2]; | |
528 | } | |
529 | //_____________________________________________________________________________ | |
530 | Int_t AliTOFGeometry::GetPlate(Float_t *pos) const | |
531 | { | |
532 | // | |
533 | // Returns the Plate index | |
534 | // | |
535 | const Float_t kInterCentrModBorder1 = 49.5; | |
536 | const Float_t kInterCentrModBorder2 = 57.5; | |
537 | const Float_t kExterInterModBorder1 = 196.0; | |
538 | const Float_t kExterInterModBorder2 = 203.5; | |
539 | ||
540 | const Float_t kLengthExInModBorder = 4.7; | |
541 | const Float_t kLengthInCeModBorder = 7.0; | |
542 | ||
543 | //const Float_t khAlWall = 0.1; | |
544 | const Float_t kModuleWallThickness = 0.3; | |
545 | //const Float_t kHoneycombLayerThickness = 1.5; | |
546 | ||
547 | Int_t iPlate=-1; | |
548 | ||
549 | Float_t posLocal[3]; | |
550 | for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii]; | |
551 | ||
552 | Int_t isector = GetSector(posLocal); | |
553 | if(isector == -1){ | |
554 | //AliError("Detector Index could not be determined"); | |
555 | return iPlate; | |
556 | } | |
557 | ||
558 | // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame | |
559 | Double_t angles[6] = | |
560 | {90., 90.+(isector+0.5)*fgkPhiSec, | |
561 | 0., 0., | |
562 | 90., (isector+0.5)*fgkPhiSec | |
563 | }; | |
564 | Rotation(posLocal,angles); | |
565 | ||
566 | Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5}; | |
567 | Translation(posLocal,step); | |
568 | ||
569 | // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame | |
570 | angles[0] = 90.; | |
571 | angles[1] = 0.; | |
572 | angles[2] = 0.; | |
573 | angles[3] = 0.; | |
574 | angles[4] = 90.; | |
575 | angles[5] =270.; | |
576 | ||
577 | Rotation(posLocal,angles); | |
578 | ||
579 | Float_t yLocal = posLocal[1]; | |
580 | Float_t zLocal = posLocal[2]; | |
581 | ||
582 | Float_t deltaRhoLoc = (fgkRmax-fgkRmin)*0.5 - kModuleWallThickness + yLocal; | |
583 | Float_t deltaZetaLoc = TMath::Abs(zLocal); | |
584 | ||
585 | Float_t deltaRHOmax = 0.; | |
586 | ||
587 | if (TMath::Abs(zLocal)>=kExterInterModBorder1 && TMath::Abs(zLocal)<=kExterInterModBorder2) | |
588 | { | |
589 | deltaRhoLoc -= kLengthExInModBorder; | |
590 | deltaZetaLoc = kExterInterModBorder2-deltaZetaLoc; | |
591 | deltaRHOmax = (fgkRmax - fgkRmin)*0.5 - kModuleWallThickness - 2.*kLengthExInModBorder; // old 5.35, new 4.8 | |
592 | ||
593 | if (deltaRhoLoc > deltaZetaLoc*deltaRHOmax/(kInterCentrModBorder2-kInterCentrModBorder1)) { | |
594 | if (zLocal<0) iPlate = 0; | |
595 | else iPlate = 4; | |
596 | } | |
597 | else { | |
598 | if (zLocal<0) iPlate = 1; | |
599 | else iPlate = 3; | |
600 | } | |
601 | } | |
602 | else if (TMath::Abs(zLocal)>=kInterCentrModBorder1 && TMath::Abs(zLocal)<=kInterCentrModBorder2) | |
603 | { | |
604 | deltaRhoLoc -= kLengthInCeModBorder; | |
605 | deltaZetaLoc = deltaZetaLoc-kInterCentrModBorder1; | |
606 | deltaRHOmax = (fgkRmax - fgkRmin)*0.5 - kModuleWallThickness - 2.*kLengthInCeModBorder; // old 0.39, new 0.2 | |
607 | ||
608 | if (deltaRhoLoc>deltaZetaLoc*deltaRHOmax/(kInterCentrModBorder2-kInterCentrModBorder1)) iPlate = 2; | |
609 | else { | |
610 | if (zLocal<0) iPlate = 1; | |
611 | else iPlate = 3; | |
612 | } | |
613 | } | |
614 | ||
615 | if (zLocal>-fgkZlenA*0.5/*fgkMaxhZtof*/ && zLocal<-kExterInterModBorder2) iPlate = 0; | |
616 | else if (zLocal>-kExterInterModBorder1 && zLocal<-kInterCentrModBorder2) iPlate = 1; | |
617 | else if (zLocal>-kInterCentrModBorder1 && zLocal< kInterCentrModBorder1) iPlate = 2; | |
618 | else if (zLocal> kInterCentrModBorder2 && zLocal< kExterInterModBorder1) iPlate = 3; | |
619 | else if (zLocal> kExterInterModBorder2 && zLocal< fgkZlenA*0.5/*fgkMaxhZtof*/) iPlate = 4; | |
620 | ||
621 | return iPlate; | |
622 | ||
623 | } | |
624 | ||
625 | //_____________________________________________________________________________ | |
626 | Int_t AliTOFGeometry::GetSector(Float_t *pos) const | |
627 | { | |
628 | // | |
629 | // Returns the Sector index | |
630 | // | |
631 | ||
632 | //const Float_t khAlWall = 0.1; | |
633 | //const Float_t kModuleWallThickness = 0.3; | |
634 | ||
635 | Int_t iSect = -1; | |
636 | ||
637 | Float_t x = pos[0]; | |
638 | Float_t y = pos[1]; | |
639 | Float_t z = pos[2]; | |
640 | ||
641 | Float_t rho = TMath::Sqrt(x*x + y*y); | |
642 | ||
643 | //if (!((z>=-fgkMaxhZtof && z<=fgkMaxhZtof) && | |
644 | if (!((z>=-fgkZlenA*0.5 && z<=fgkZlenA*0.5) && | |
645 | (rho>=(fgkRmin) && rho<=(fgkRmax)))) { | |
646 | //(rho>=(fgkRmin-0.05)+kModuleWallThickness && rho<=(fgkRmax-0.05)-kModuleWallThickness-khAlWall-kModuleWallThickness))) { | |
647 | //AliError("Detector Index could not be determined"); | |
648 | return iSect; | |
649 | } | |
650 | ||
651 | Float_t phi = TMath::Pi() + TMath::ATan2(-y,-x); | |
652 | ||
653 | iSect = (Int_t) (phi*kRaddeg/fgkPhiSec); | |
654 | ||
655 | return iSect; | |
656 | ||
657 | } | |
658 | //_____________________________________________________________________________ | |
659 | Int_t AliTOFGeometry::GetStrip(Float_t *pos) const | |
660 | { | |
661 | // | |
662 | // Returns the Strip index | |
663 | // | |
664 | const Float_t khhony = 1.0 ; // heigth of HONY Layer | |
665 | const Float_t khpcby = 0.08 ; // heigth of PCB Layer | |
666 | const Float_t khrgly = 0.055 ; // heigth of RED GLASS Layer | |
667 | const Float_t khglfy = 0.285 ; // heigth of GLASS+FISHLINE Layer | |
668 | const Float_t khcpcby = 0.16 ; // heigth of PCB Central Layer | |
669 | const Float_t kwcpcbz = 12.4 ; // z dimension of PCB Central Layer | |
670 | const Float_t khstripy = 2.*khhony+2.*khpcby+4.*khrgly+2.*khglfy+khcpcby;//3.11 | |
671 | const Float_t kwstripz = kwcpcbz; | |
672 | const Float_t klstripx = fgkStripLength; | |
673 | ||
674 | Int_t iStrip=-1; | |
675 | ||
676 | Float_t posLocal[3]; | |
677 | for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii]; | |
678 | ||
679 | Int_t isector = GetSector(posLocal); | |
680 | if(isector == -1){ | |
681 | //AliError("Detector Index could not be determined"); | |
682 | return iStrip;} | |
683 | Int_t iplate = GetPlate(posLocal); | |
684 | if(iplate == -1){ | |
685 | //AliError("Detector Index could not be determined"); | |
686 | return iStrip;} | |
687 | ||
688 | Int_t nstrips=0; | |
689 | switch (iplate) { | |
690 | case 0: | |
691 | nstrips=kNStripC; | |
692 | break; | |
693 | case 4: | |
694 | nstrips=kNStripC; | |
695 | break; | |
696 | case 1: | |
697 | nstrips=kNStripB; | |
698 | break; | |
699 | case 3: | |
700 | nstrips=kNStripB; | |
701 | break; | |
702 | case 2: | |
703 | nstrips=kNStripA; | |
704 | break; | |
705 | } | |
706 | ||
707 | // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame | |
708 | Double_t angles[6] = | |
709 | {90., 90.+(isector+0.5)*fgkPhiSec, | |
710 | 0., 0., | |
711 | 90., (isector+0.5)*fgkPhiSec | |
712 | }; | |
713 | Rotation(posLocal,angles); | |
714 | ||
715 | Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5}; | |
716 | Translation(posLocal,step); | |
717 | ||
718 | // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame | |
719 | angles[0] = 90.; | |
720 | angles[1] = 0.; | |
721 | angles[2] = 0.; | |
722 | angles[3] = 0.; | |
723 | angles[4] = 90.; | |
724 | angles[5] =270.; | |
725 | ||
726 | Rotation(posLocal,angles); | |
727 | ||
728 | // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame | |
729 | Int_t totStrip=0; | |
730 | for (Int_t istrip=0; istrip<nstrips; istrip++){ | |
731 | ||
732 | Float_t posLoc2[3]={posLocal[0],posLocal[1],posLocal[2]}; | |
733 | ||
734 | step[0] = 0.; | |
735 | step[1] = GetHeights(iplate,istrip); | |
736 | step[2] = -GetDistances(iplate,istrip); | |
737 | Translation(posLoc2,step); | |
738 | ||
739 | if (GetAngles(iplate,istrip) >0.) { | |
740 | angles[0] = 90.; | |
741 | angles[1] = 0.; | |
742 | angles[2] = 90.+GetAngles(iplate,istrip); | |
743 | angles[3] = 90.; | |
744 | angles[4] = GetAngles(iplate,istrip); | |
745 | angles[5] = 90.; | |
746 | } | |
747 | else if (GetAngles(iplate,istrip)==0.) { | |
748 | angles[0] = 90.; | |
749 | angles[1] = 0.; | |
750 | angles[2] = 90.; | |
751 | angles[3] = 90.; | |
752 | angles[4] = 0; | |
753 | angles[5] = 0.; | |
754 | } | |
755 | else if (GetAngles(iplate,istrip) <0.) { | |
756 | angles[0] = 90.; | |
757 | angles[1] = 0.; | |
758 | angles[2] = 90.+GetAngles(iplate,istrip); | |
759 | angles[3] = 90.; | |
760 | angles[4] =-GetAngles(iplate,istrip); | |
761 | angles[5] = 270.; | |
762 | } | |
763 | Rotation(posLoc2,angles); | |
764 | ||
765 | if ((TMath::Abs(posLoc2[0])<=klstripx*0.5) && | |
766 | (TMath::Abs(posLoc2[1])<=khstripy*0.5) && | |
767 | (TMath::Abs(posLoc2[2])<=kwstripz*0.5)) { | |
768 | iStrip = istrip; | |
769 | totStrip++; | |
770 | for (Int_t jj=0; jj<3; jj++) posLocal[jj]=posLoc2[jj]; | |
771 | //AliInfo(Form(" posLocal[0] = %f, posLocal[1] = %f, posLocal[2] = %f ", posLocal[0],posLocal[1],posLocal[2])); | |
772 | ||
773 | //AliInfo(Form(" GetAngles(%1i,%2i) = %f, pos[0] = %f, pos[1] = %f, pos[2] = %f", iplate, istrip, GetAngles(iplate,istrip), pos[0], pos[1], pos[2])); | |
774 | break; | |
775 | } | |
776 | ||
777 | if (totStrip>1) AliInfo(Form("total strip number found %2i",totStrip)); | |
778 | ||
779 | } | |
780 | ||
781 | return iStrip; | |
782 | ||
783 | } | |
784 | //_____________________________________________________________________________ | |
785 | Int_t AliTOFGeometry::GetPadZ(Float_t *pos) const | |
786 | { | |
787 | // | |
788 | // Returns the Pad index along Z | |
789 | // | |
790 | //const Float_t klsensmx = kNpadX*fgkXPad; // length of Sensitive Layer | |
791 | //const Float_t khsensmy = 0.05;//0.11;//0.16;// heigth of Sensitive Layer | |
792 | //const Float_t kwsensmz = kNpadZ*fgkZPad; // width of Sensitive Layer | |
793 | ||
794 | Int_t iPadZ = -1; | |
795 | ||
796 | Float_t posLocal[3]; | |
797 | for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii]; | |
798 | ||
799 | Int_t isector = GetSector(posLocal); | |
800 | if(isector == -1){ | |
801 | //AliError("Detector Index could not be determined"); | |
802 | return iPadZ;} | |
803 | Int_t iplate = GetPlate(posLocal); | |
804 | if(iplate == -1){ | |
805 | //AliError("Detector Index could not be determined"); | |
806 | return iPadZ;} | |
807 | Int_t istrip = GetStrip(posLocal); | |
808 | if(istrip == -1){ | |
809 | //AliError("Detector Index could not be determined"); | |
810 | return iPadZ;} | |
811 | ||
812 | // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame | |
813 | Double_t angles[6] = | |
814 | {90., 90.+(isector+0.5)*fgkPhiSec, | |
815 | 0., 0., | |
816 | 90., (isector+0.5)*fgkPhiSec | |
817 | }; | |
818 | Rotation(posLocal,angles); | |
819 | ||
820 | Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5}; | |
821 | Translation(posLocal,step); | |
822 | ||
823 | // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame | |
824 | angles[0] = 90.; | |
825 | angles[1] = 0.; | |
826 | angles[2] = 0.; | |
827 | angles[3] = 0.; | |
828 | angles[4] = 90.; | |
829 | angles[5] =270.; | |
830 | ||
831 | Rotation(posLocal,angles); | |
832 | ||
833 | // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame | |
834 | step[0] = 0.; | |
835 | step[1] = GetHeights(iplate,istrip); | |
836 | step[2] = -GetDistances(iplate,istrip); | |
837 | Translation(posLocal,step); | |
838 | ||
839 | if (GetAngles(iplate,istrip) >0.) { | |
840 | angles[0] = 90.; | |
841 | angles[1] = 0.; | |
842 | angles[2] = 90.+GetAngles(iplate,istrip); | |
843 | angles[3] = 90.; | |
844 | angles[4] = GetAngles(iplate,istrip); | |
845 | angles[5] = 90.; | |
846 | } | |
847 | else if (GetAngles(iplate,istrip)==0.) { | |
848 | angles[0] = 90.; | |
849 | angles[1] = 0.; | |
850 | angles[2] = 90.; | |
851 | angles[3] = 90.; | |
852 | angles[4] = 0; | |
853 | angles[5] = 0.; | |
854 | } | |
855 | else if (GetAngles(iplate,istrip) <0.) { | |
856 | angles[0] = 90.; | |
857 | angles[1] = 0.; | |
858 | angles[2] = 90.+GetAngles(iplate,istrip); | |
859 | angles[3] = 90.; | |
860 | angles[4] =-GetAngles(iplate,istrip); | |
861 | angles[5] = 270.; | |
862 | } | |
863 | Rotation(posLocal,angles); | |
864 | ||
865 | //if (TMath::Abs(posLocal[0])<=klsensmx*0.5 && /*TMath::Abs(posLocal[1])<=khsensmy*0.5+0.005 &&*/ TMath::Abs(posLocal[2])<=kwsensmz*0.5) { | |
866 | //if (TMath::Abs(posLocal[1])<=khsensmy*0.5) { | |
867 | ||
868 | step[0] =-0.5*kNpadX*fgkXPad; | |
869 | step[1] = 0.; | |
870 | step[2] =-0.5*kNpadZ*fgkZPad; | |
871 | Translation(posLocal,step); | |
872 | ||
873 | iPadZ = (Int_t)(posLocal[2]/fgkZPad); | |
874 | if (iPadZ==kNpadZ) iPadZ--; | |
875 | else if (iPadZ>kNpadZ) iPadZ=-1; | |
876 | ||
877 | //} | |
878 | // else AliError("Detector Index could not be determined"); | |
879 | ||
880 | return iPadZ; | |
881 | ||
882 | } | |
883 | //_____________________________________________________________________________ | |
884 | Int_t AliTOFGeometry::GetPadX(Float_t *pos) const | |
885 | { | |
886 | // | |
887 | // Returns the Pad index along X | |
888 | // | |
889 | //const Float_t klsensmx = kNpadX*fgkXPad; // length of Sensitive Layer | |
890 | //const Float_t khsensmy = 0.05;//0.11;//0.16;// heigth of Sensitive Layer | |
891 | //const Float_t kwsensmz = kNpadZ*fgkZPad; // width of Sensitive Layer | |
892 | ||
893 | Int_t iPadX = -1; | |
894 | ||
895 | Float_t posLocal[3]; | |
896 | for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii]; | |
897 | ||
898 | Int_t isector = GetSector(posLocal); | |
899 | if(isector == -1){ | |
900 | //AliError("Detector Index could not be determined"); | |
901 | return iPadX;} | |
902 | Int_t iplate = GetPlate(posLocal); | |
903 | if(iplate == -1){ | |
904 | //AliError("Detector Index could not be determined"); | |
905 | return iPadX;} | |
906 | Int_t istrip = GetStrip(posLocal); | |
907 | if(istrip == -1){ | |
908 | //AliError("Detector Index could not be determined"); | |
909 | return iPadX;} | |
910 | ||
911 | // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame | |
912 | Double_t angles[6] = | |
913 | {90., 90.+(isector+0.5)*fgkPhiSec, | |
914 | 0., 0., | |
915 | 90., (isector+0.5)*fgkPhiSec | |
916 | }; | |
917 | Rotation(posLocal,angles); | |
918 | ||
919 | Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5}; | |
920 | Translation(posLocal,step); | |
921 | ||
922 | // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame | |
923 | angles[0] = 90.; | |
924 | angles[1] = 0.; | |
925 | angles[2] = 0.; | |
926 | angles[3] = 0.; | |
927 | angles[4] = 90.; | |
928 | angles[5] =270.; | |
929 | ||
930 | Rotation(posLocal,angles); | |
931 | ||
932 | // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame | |
933 | step[0] = 0.; | |
934 | step[1] = GetHeights(iplate,istrip); | |
935 | step[2] = -GetDistances(iplate,istrip); | |
936 | Translation(posLocal,step); | |
937 | ||
938 | if (GetAngles(iplate,istrip) >0.) { | |
939 | angles[0] = 90.; | |
940 | angles[1] = 0.; | |
941 | angles[2] = 90.+GetAngles(iplate,istrip); | |
942 | angles[3] = 90.; | |
943 | angles[4] = GetAngles(iplate,istrip); | |
944 | angles[5] = 90.; | |
945 | } | |
946 | else if (GetAngles(iplate,istrip)==0.) { | |
947 | angles[0] = 90.; | |
948 | angles[1] = 0.; | |
949 | angles[2] = 90.; | |
950 | angles[3] = 90.; | |
951 | angles[4] = 0; | |
952 | angles[5] = 0.; | |
953 | } | |
954 | else if (GetAngles(iplate,istrip) <0.) { | |
955 | angles[0] = 90.; | |
956 | angles[1] = 0.; | |
957 | angles[2] = 90.+GetAngles(iplate,istrip); | |
958 | angles[3] = 90.; | |
959 | angles[4] =-GetAngles(iplate,istrip); | |
960 | angles[5] = 270.; | |
961 | } | |
962 | Rotation(posLocal,angles); | |
963 | ||
964 | //if (TMath::Abs(posLocal[0])<=klsensmx*0.5 && /*TMath::Abs(posLocal[1])<=khsensmy*0.5+0.005 &&*/ TMath::Abs(posLocal[2])<=kwsensmz*0.5) { | |
965 | //if (TMath::Abs(posLocal[1])<=khsensmy*0.5) { | |
966 | ||
967 | step[0] =-0.5*kNpadX*fgkXPad; | |
968 | step[1] = 0.; | |
969 | step[2] =-0.5*kNpadZ*fgkZPad; | |
970 | Translation(posLocal,step); | |
971 | ||
972 | iPadX = (Int_t)(posLocal[0]/fgkXPad); | |
973 | if (iPadX==kNpadX) iPadX--; | |
974 | else if (iPadX>kNpadX) iPadX=-1; | |
975 | ||
976 | //} | |
977 | //else AliError("Detector Index could not be determined"); | |
978 | ||
979 | return iPadX; | |
980 | ||
981 | } | |
982 | //_____________________________________________________________________________ | |
983 | Float_t AliTOFGeometry::GetX(Int_t *det) const | |
984 | { | |
985 | // | |
986 | // Returns X coordinate (cm) | |
987 | // | |
988 | ||
989 | Int_t isector = det[0]; | |
990 | Int_t iplate = det[1]; | |
991 | Int_t istrip = det[2]; | |
992 | Int_t ipadz = det[3]; | |
993 | Int_t ipadx = det[4]; | |
994 | ||
995 | /* | |
996 | // Find out distance d on the plane wrt median phi: | |
997 | Float_t d = (ipadx+0.5-kNpadX*0.5)*fgkXPad; | |
998 | ||
999 | // The radius r in xy plane: | |
1000 | //Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+ | |
1001 | // (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg)-0.25; ??? | |
1002 | Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+ | |
1003 | (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg); | |
1004 | ||
1005 | // local azimuthal angle in the sector philoc | |
1006 | Float_t philoc = TMath::ATan(d/r); | |
1007 | //if(philoc<0.) philoc = k2PI + philoc; | |
1008 | ||
1009 | // azimuthal angle in the global frame phi | |
1010 | Float_t phi = philoc*kRaddeg+(isector+0.5)*fgkPhiSec; | |
1011 | ||
1012 | Float_t xCoor = r/TMath::Cos(philoc)*TMath::Cos(phi/kRaddeg); | |
1013 | */ | |
1014 | ||
1015 | // Pad reference frame -> FSTR reference frame | |
1016 | // /* | |
1017 | Float_t posLocal[3] = {0., 0., 0.}; | |
1018 | Float_t step[3] = {-(ipadx+0.5)*fgkXPad, 0., -(ipadz+0.5)*fgkZPad}; | |
1019 | Translation(posLocal,step); | |
1020 | ||
1021 | step[0] = kNpadX*0.5*fgkXPad; | |
1022 | step[1] = 0.; | |
1023 | step[2] = kNpadZ*0.5*fgkZPad; | |
1024 | // */ | |
1025 | /* | |
1026 | Float_t posLocal[3] = {(ipadx+0.5)*fgkXPad, 0., (ipadz+0.5)*fgkZPad}; | |
1027 | Float_t step[3]= {kNpadX*0.5*fgkXPad, 0., kNpadZ*0.5*fgkZPad}; | |
1028 | */ | |
1029 | Translation(posLocal,step); | |
1030 | ||
1031 | // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame | |
1032 | Double_t angles[6]; | |
1033 | if (GetAngles(iplate,istrip) >0.) { | |
1034 | angles[0] = 90.; | |
1035 | angles[1] = 0.; | |
1036 | angles[2] = 90.+GetAngles(iplate,istrip); | |
1037 | angles[3] = 90.; | |
1038 | angles[4] = GetAngles(iplate,istrip); | |
1039 | angles[5] = 90.; | |
1040 | } | |
1041 | else if (GetAngles(iplate,istrip)==0.) { | |
1042 | angles[0] = 90.; | |
1043 | angles[1] = 0.; | |
1044 | angles[2] = 90.; | |
1045 | angles[3] = 90.; | |
1046 | angles[4] = 0; | |
1047 | angles[5] = 0.; | |
1048 | } | |
1049 | else if (GetAngles(iplate,istrip) <0.) { | |
1050 | angles[0] = 90.; | |
1051 | angles[1] = 0.; | |
1052 | angles[2] = 90.+GetAngles(iplate,istrip); | |
1053 | angles[3] = 90.; | |
1054 | angles[4] =-GetAngles(iplate,istrip); | |
1055 | angles[5] = 270.; | |
1056 | } | |
1057 | ||
1058 | InverseRotation(posLocal,angles); | |
1059 | ||
1060 | step[0] = 0.; | |
1061 | step[1] = -GetHeights(iplate,istrip); | |
1062 | step[2] = GetDistances(iplate,istrip); | |
1063 | Translation(posLocal,step); | |
1064 | ||
1065 | // FTOA = FLTA reference frame -> B071/B074/B075 = BTO1/2/3 reference frame | |
1066 | angles[0] = 90.; | |
1067 | angles[1] = 0.; | |
1068 | angles[2] = 0.; | |
1069 | angles[3] = 0.; | |
1070 | angles[4] = 90.; | |
1071 | angles[5] =270.; | |
1072 | ||
1073 | InverseRotation(posLocal,angles); | |
1074 | ||
1075 | // B071/B074/B075 = BTO1/2/3 reference frame -> ALICE reference frame | |
1076 | step[0] = 0.; | |
1077 | step[1] = 0.; | |
1078 | step[2] = -((fgkRmax+fgkRmin)*0.5); | |
1079 | Translation(posLocal,step); | |
1080 | ||
1081 | angles[0] = 90.; | |
1082 | angles[1] = 90.+(isector+0.5)*fgkPhiSec; | |
1083 | angles[2] = 0.; | |
1084 | angles[3] = 0.; | |
1085 | angles[4] = 90.; | |
1086 | angles[5] = (isector+0.5)*fgkPhiSec; | |
1087 | ||
1088 | InverseRotation(posLocal,angles); | |
1089 | ||
1090 | Float_t xCoor = posLocal[0]; | |
1091 | ||
1092 | return xCoor; | |
1093 | ||
1094 | } | |
1095 | //_____________________________________________________________________________ | |
1096 | Float_t AliTOFGeometry::GetY(Int_t *det) const | |
1097 | { | |
1098 | // | |
1099 | // Returns Y coordinate (cm) | |
1100 | // | |
1101 | ||
1102 | Int_t isector = det[0]; | |
1103 | Int_t iplate = det[1]; | |
1104 | Int_t istrip = det[2]; | |
1105 | Int_t ipadz = det[3]; | |
1106 | Int_t ipadx = det[4]; | |
1107 | ||
1108 | /* | |
1109 | // Find out distance d on the plane wrt median phi: | |
1110 | Float_t d = (ipadx+0.5-kNpadX*0.5)*fgkXPad; | |
1111 | ||
1112 | // The radius r in xy plane: | |
1113 | //Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+ | |
1114 | // (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg)-0.25; ??? | |
1115 | Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+ | |
1116 | (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg); | |
1117 | ||
1118 | // local azimuthal angle in the sector philoc | |
1119 | Float_t philoc = TMath::ATan(d/r); | |
1120 | //if(philoc<0.) philoc = k2PI + philoc; | |
1121 | ||
1122 | // azimuthal angle in the global frame phi | |
1123 | Float_t phi = philoc*kRaddeg+(isector+0.5)*fgkPhiSec; | |
1124 | ||
1125 | Float_t yCoor = r/TMath::Cos(philoc)*TMath::Sin(phi/kRaddeg); | |
1126 | */ | |
1127 | ||
1128 | // Pad reference frame -> FSTR reference frame | |
1129 | // /* | |
1130 | Float_t posLocal[3] = {0., 0., 0.}; | |
1131 | Float_t step[3] = {-(ipadx+0.5)*fgkXPad, 0., -(ipadz+0.5)*fgkZPad}; | |
1132 | Translation(posLocal,step); | |
1133 | ||
1134 | step[0] = kNpadX*0.5*fgkXPad; | |
1135 | step[1] = 0.; | |
1136 | step[2] = kNpadZ*0.5*fgkZPad; | |
1137 | // */ | |
1138 | /* | |
1139 | Float_t posLocal[3] = {(ipadx+0.5)*fgkXPad, 0., (ipadz+0.5)*fgkZPad}; | |
1140 | Float_t step[3]= {kNpadX*0.5*fgkXPad, 0., kNpadZ*0.5*fgkZPad}; | |
1141 | */ | |
1142 | Translation(posLocal,step); | |
1143 | ||
1144 | // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame | |
1145 | ||
1146 | Double_t angles[6]; | |
1147 | if (GetAngles(iplate,istrip) >0.) { | |
1148 | angles[0] = 90.; | |
1149 | angles[1] = 0.; | |
1150 | angles[2] = 90.+GetAngles(iplate,istrip); | |
1151 | angles[3] = 90.; | |
1152 | angles[4] = GetAngles(iplate,istrip); | |
1153 | angles[5] = 90.; | |
1154 | } | |
1155 | else if (GetAngles(iplate,istrip)==0.) { | |
1156 | angles[0] = 90.; | |
1157 | angles[1] = 0.; | |
1158 | angles[2] = 90.; | |
1159 | angles[3] = 90.; | |
1160 | angles[4] = 0; | |
1161 | angles[5] = 0.; | |
1162 | } | |
1163 | else if (GetAngles(iplate,istrip) <0.) { | |
1164 | angles[0] = 90.; | |
1165 | angles[1] = 0.; | |
1166 | angles[2] = 90.+GetAngles(iplate,istrip); | |
1167 | angles[3] = 90.; | |
1168 | angles[4] =-GetAngles(iplate,istrip); | |
1169 | angles[5] = 270.; | |
1170 | } | |
1171 | ||
1172 | InverseRotation(posLocal,angles); | |
1173 | ||
1174 | step[0] = 0.; | |
1175 | step[1] = -GetHeights(iplate,istrip); | |
1176 | step[2] = GetDistances(iplate,istrip); | |
1177 | Translation(posLocal,step); | |
1178 | ||
1179 | // FTOA = FLTA reference frame -> B071/B074/B075 = BTO1/2/3 reference frame | |
1180 | angles[0] = 90.; | |
1181 | angles[1] = 0.; | |
1182 | angles[2] = 0.; | |
1183 | angles[3] = 0.; | |
1184 | angles[4] = 90.; | |
1185 | angles[5] =270.; | |
1186 | ||
1187 | InverseRotation(posLocal,angles); | |
1188 | ||
1189 | // B071/B074/B075 = BTO1/2/3 reference frame -> ALICE reference frame | |
1190 | step[0] = 0.; | |
1191 | step[1] = 0.; | |
1192 | step[2] = -((fgkRmax+fgkRmin)*0.5); | |
1193 | Translation(posLocal,step); | |
1194 | ||
1195 | angles[0] = 90.; | |
1196 | angles[1] = 90.+(isector+0.5)*fgkPhiSec; | |
1197 | angles[2] = 0.; | |
1198 | angles[3] = 0.; | |
1199 | angles[4] = 90.; | |
1200 | angles[5] = (isector+0.5)*fgkPhiSec; | |
1201 | ||
1202 | InverseRotation(posLocal,angles); | |
1203 | ||
1204 | Float_t yCoor = posLocal[1]; | |
1205 | ||
1206 | return yCoor; | |
1207 | ||
1208 | } | |
1209 | ||
1210 | //_____________________________________________________________________________ | |
1211 | Float_t AliTOFGeometry::GetZ(Int_t *det) const | |
1212 | { | |
1213 | // | |
1214 | // Returns Z coordinate (cm) | |
1215 | // | |
1216 | ||
1217 | Int_t isector = det[0]; | |
1218 | Int_t iplate = det[1]; | |
1219 | Int_t istrip = det[2]; | |
1220 | Int_t ipadz = det[3]; | |
1221 | Int_t ipadx = det[4]; | |
1222 | ||
1223 | /* | |
1224 | Float_t zCoor = GetDistances(iplate,istrip) + | |
1225 | (0.5-ipadz) * fgkZPad * TMath::Cos(GetAngles(iplate,istrip)*kDegrad); | |
1226 | */ | |
1227 | ||
1228 | // Pad reference frame -> FSTR reference frame | |
1229 | // /* | |
1230 | Float_t posLocal[3] = {0., 0., 0.}; | |
1231 | Float_t step[3] = {-(ipadx+0.5)*fgkXPad, 0., -(ipadz+0.5)*fgkZPad}; | |
1232 | Translation(posLocal,step); | |
1233 | ||
1234 | step[0] = kNpadX*0.5*fgkXPad; | |
1235 | step[1] = 0.; | |
1236 | step[2] = kNpadZ*0.5*fgkZPad; | |
1237 | // */ | |
1238 | /* | |
1239 | Float_t posLocal[3] = {(ipadx+0.5)*fgkXPad, 0., (ipadz+0.5)*fgkZPad}; | |
1240 | Float_t step[3]= {kNpadX*0.5*fgkXPad, 0., kNpadZ*0.5*fgkZPad}; | |
1241 | */ | |
1242 | Translation(posLocal,step); | |
1243 | ||
1244 | // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame | |
1245 | Double_t angles[6]; | |
1246 | if (GetAngles(iplate,istrip) >0.) { | |
1247 | angles[0] = 90.; | |
1248 | angles[1] = 0.; | |
1249 | angles[2] = 90.+GetAngles(iplate,istrip); | |
1250 | angles[3] = 90.; | |
1251 | angles[4] = GetAngles(iplate,istrip); | |
1252 | angles[5] = 90.; | |
1253 | } | |
1254 | else if (GetAngles(iplate,istrip)==0.) { | |
1255 | angles[0] = 90.; | |
1256 | angles[1] = 0.; | |
1257 | angles[2] = 90.; | |
1258 | angles[3] = 90.; | |
1259 | angles[4] = 0; | |
1260 | angles[5] = 0.; | |
1261 | } | |
1262 | else if (GetAngles(iplate,istrip) <0.) { | |
1263 | angles[0] = 90.; | |
1264 | angles[1] = 0.; | |
1265 | angles[2] = 90.+GetAngles(iplate,istrip); | |
1266 | angles[3] = 90.; | |
1267 | angles[4] =-GetAngles(iplate,istrip); | |
1268 | angles[5] = 270.; | |
1269 | } | |
1270 | ||
1271 | InverseRotation(posLocal,angles); | |
1272 | ||
1273 | step[0] = 0.; | |
1274 | step[1] = -GetHeights(iplate,istrip); | |
1275 | step[2] = GetDistances(iplate,istrip); | |
1276 | Translation(posLocal,step); | |
1277 | ||
1278 | // FTOA = FLTA reference frame -> B071/B074/B075 = BTO1/2/3 reference frame | |
1279 | angles[0] = 90.; | |
1280 | angles[1] = 0.; | |
1281 | angles[2] = 0.; | |
1282 | angles[3] = 0.; | |
1283 | angles[4] = 90.; | |
1284 | angles[5] =270.; | |
1285 | ||
1286 | InverseRotation(posLocal,angles); | |
1287 | ||
1288 | // B071/B074/B075 = BTO1/2/3 reference frame -> ALICE reference frame | |
1289 | step[0] = 0.; | |
1290 | step[1] = 0.; | |
1291 | step[2] = -((fgkRmax+fgkRmin)*0.5); | |
1292 | Translation(posLocal,step); | |
1293 | ||
1294 | angles[0] = 90.; | |
1295 | angles[1] = 90.+(isector+0.5)*fgkPhiSec; | |
1296 | angles[2] = 0.; | |
1297 | angles[3] = 0.; | |
1298 | angles[4] = 90.; | |
1299 | angles[5] = (isector+0.5)*fgkPhiSec; | |
1300 | ||
1301 | InverseRotation(posLocal,angles); | |
1302 | ||
1303 | Float_t zCoor = posLocal[2]; | |
1304 | ||
1305 | return zCoor; | |
1306 | ||
1307 | } | |
1308 | //_____________________________________________________________________________ | |
1309 | ||
1310 | void AliTOFGeometry::DetToSectorRF(Int_t vol[5], Double_t **coord) | |
1311 | { | |
1312 | // | |
1313 | // Returns the local coordinates (x, y, z) in sector reference frame | |
1314 | // for the 4 corners of each sector pad (vol[1], vol[2], vol[3], vol[4]) | |
1315 | // | |
1316 | ||
1317 | if (!gGeoManager) printf("ERROR: no TGeo\n"); | |
1318 | ||
1319 | // ALICE -> TOF Sector | |
1320 | Char_t path1[100]=""; | |
1321 | GetVolumePath(vol[0],path1); | |
1322 | gGeoManager->cd(path1); | |
1323 | TGeoHMatrix aliceToSector; | |
1324 | aliceToSector = *gGeoManager->GetCurrentMatrix(); | |
1325 | ||
1326 | // TOF Sector -> ALICE | |
1327 | //TGeoHMatrix sectorToALICE = aliceToSector.Inverse(); | |
1328 | ||
1329 | // ALICE -> TOF Pad | |
1330 | Char_t path2[100]=""; | |
1331 | GetVolumePath(vol,path2); | |
1332 | gGeoManager->cd(path2); | |
1333 | TGeoHMatrix aliceToPad; | |
1334 | aliceToPad = *gGeoManager->GetCurrentMatrix(); | |
1335 | ||
1336 | // TOF Pad -> ALICE | |
1337 | TGeoHMatrix padToALICE = aliceToPad.Inverse(); | |
1338 | ||
1339 | // TOF Pad -> TOF Sector | |
1340 | TGeoHMatrix padToSector = padToALICE*aliceToSector; | |
1341 | ||
1342 | // TOF Sector -> TOF Pad | |
1343 | //TGeoHMatrix sectorToPad = sectorToALICE*aliceToPad; | |
1344 | ||
1345 | // coordinates of the pad bottom corner | |
1346 | Double_t **cornerPad = new Double_t*[4]; | |
1347 | for (Int_t ii=0; ii<4; ii++) cornerPad[ii] = new Double_t[3]; | |
1348 | ||
1349 | cornerPad[0][0] = -fgkXPad/2.; | |
1350 | cornerPad[0][1] = 0.; | |
1351 | cornerPad[0][2] = -fgkZPad/2.; | |
1352 | ||
1353 | cornerPad[1][0] = fgkXPad/2.; | |
1354 | cornerPad[1][1] = 0.; | |
1355 | cornerPad[1][2] = -fgkZPad/2.; | |
1356 | ||
1357 | cornerPad[2][0] = fgkXPad/2.; | |
1358 | cornerPad[2][1] = 0.; | |
1359 | cornerPad[2][2] = fgkZPad/2.; | |
1360 | ||
1361 | cornerPad[3][0] = -fgkXPad/2.; | |
1362 | cornerPad[3][1] = 0.; | |
1363 | cornerPad[3][2] = fgkZPad/2.; | |
1364 | ||
1365 | for(Int_t aa=0; aa<4; aa++) for(Int_t bb=0; bb<3; bb++) coord[aa][bb]=0.; | |
1366 | ||
1367 | for (Int_t jj=0; jj<4; jj++) padToSector.MasterToLocal(&cornerPad[jj][0], &coord[jj][0]); | |
1368 | ||
1369 | delete cornerPad; | |
1370 | ||
1371 | //sectorToPad.LocalToMaster(cornerPad, coord); | |
1372 | ||
1373 | } | |
1374 | //_____________________________________________________________________________ | |
1375 | Float_t AliTOFGeometry::GetPadDx(Float_t *pos) | |
1376 | { | |
1377 | // | |
1378 | // Returns the x coordinate in the Pad reference frame | |
1379 | // | |
1380 | ||
1381 | Float_t xpad = -2.; | |
1382 | ||
1383 | Float_t posLocal[3]; | |
1384 | for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii]; | |
1385 | ||
1386 | Int_t isector = GetSector(posLocal); | |
1387 | if(isector == -1){ | |
1388 | //AliError("Detector Index could not be determined"); | |
1389 | return xpad;} | |
1390 | Int_t iplate = GetPlate(posLocal); | |
1391 | if(iplate == -1){ | |
1392 | //AliError("Detector Index could not be determined"); | |
1393 | return xpad;} | |
1394 | Int_t istrip = GetStrip(posLocal); | |
1395 | if(istrip == -1){ | |
1396 | //AliError("Detector Index could not be determined"); | |
1397 | return xpad;} | |
1398 | Int_t ipadz = GetPadZ(posLocal); | |
1399 | if(ipadz == -1){ | |
1400 | //AliError("Detector Index could not be determined"); | |
1401 | return xpad;} | |
1402 | Int_t ipadx = GetPadX(posLocal); | |
1403 | if(ipadx == -1){ | |
1404 | //AliError("Detector Index could not be determined"); | |
1405 | return xpad;} | |
1406 | ||
1407 | // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame | |
1408 | Double_t angles[6] = | |
1409 | {90., 90.+(isector+0.5)*fgkPhiSec, | |
1410 | 0., 0., | |
1411 | 90., (isector+0.5)*fgkPhiSec | |
1412 | }; | |
1413 | Rotation(posLocal,angles); | |
1414 | ||
1415 | Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5}; | |
1416 | Translation(posLocal,step); | |
1417 | ||
1418 | // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame | |
1419 | angles[0] = 90.; | |
1420 | angles[1] = 0.; | |
1421 | angles[2] = 0.; | |
1422 | angles[3] = 0.; | |
1423 | angles[4] = 90.; | |
1424 | angles[5] =270.; | |
1425 | ||
1426 | Rotation(posLocal,angles); | |
1427 | ||
1428 | // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame | |
1429 | step[0] = 0.; | |
1430 | step[1] = GetHeights(iplate,istrip); | |
1431 | step[2] = -GetDistances(iplate,istrip); | |
1432 | Translation(posLocal,step); | |
1433 | ||
1434 | if (GetAngles(iplate,istrip) >0.) { | |
1435 | angles[0] = 90.; | |
1436 | angles[1] = 0.; | |
1437 | angles[2] = 90.+GetAngles(iplate,istrip); | |
1438 | angles[3] = 90.; | |
1439 | angles[4] = GetAngles(iplate,istrip); | |
1440 | angles[5] = 90.; | |
1441 | } | |
1442 | else if (GetAngles(iplate,istrip)==0.) { | |
1443 | angles[0] = 90.; | |
1444 | angles[1] = 0.; | |
1445 | angles[2] = 90.; | |
1446 | angles[3] = 90.; | |
1447 | angles[4] = 0; | |
1448 | angles[5] = 0.; | |
1449 | } | |
1450 | else if (GetAngles(iplate,istrip) <0.) { | |
1451 | angles[0] = 90.; | |
1452 | angles[1] = 0.; | |
1453 | angles[2] = 90.+GetAngles(iplate,istrip); | |
1454 | angles[3] = 90.; | |
1455 | angles[4] =-GetAngles(iplate,istrip); | |
1456 | angles[5] = 270.; | |
1457 | } | |
1458 | Rotation(posLocal,angles); | |
1459 | ||
1460 | step[0] =-0.5*kNpadX*fgkXPad; | |
1461 | step[1] = 0.; | |
1462 | step[2] =-0.5*kNpadZ*fgkZPad; | |
1463 | Translation(posLocal,step); | |
1464 | ||
1465 | step[0] = (ipadx+0.5)*fgkXPad; | |
1466 | step[1] = 0.; | |
1467 | step[2] = (ipadz+0.5)*fgkZPad; | |
1468 | Translation(posLocal,step); | |
1469 | ||
1470 | xpad=posLocal[0]; | |
1471 | ||
1472 | return xpad; | |
1473 | ||
1474 | } | |
1475 | //_____________________________________________________________________________ | |
1476 | Float_t AliTOFGeometry::GetPadDy(Float_t *pos) | |
1477 | { | |
1478 | // | |
1479 | // Returns the y coordinate in the Pad reference frame | |
1480 | // | |
1481 | ||
1482 | Float_t ypad = -2.; | |
1483 | ||
1484 | Float_t posLocal[3]; | |
1485 | for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii]; | |
1486 | ||
1487 | Int_t isector = GetSector(posLocal); | |
1488 | if(isector == -1){ | |
1489 | //AliError("Detector Index could not be determined"); | |
1490 | return ypad;} | |
1491 | Int_t iplate = GetPlate(posLocal); | |
1492 | if(iplate == -1){ | |
1493 | //AliError("Detector Index could not be determined"); | |
1494 | return ypad;} | |
1495 | Int_t istrip = GetStrip(posLocal); | |
1496 | if(istrip == -1){ | |
1497 | //AliError("Detector Index could not be determined"); | |
1498 | return ypad;} | |
1499 | Int_t ipadz = GetPadZ(posLocal); | |
1500 | if(ipadz == -1){ | |
1501 | //AliError("Detector Index could not be determined"); | |
1502 | return ypad;} | |
1503 | Int_t ipadx = GetPadX(posLocal); | |
1504 | if(ipadx == -1){ | |
1505 | //AliError("Detector Index could not be determined"); | |
1506 | return ypad;} | |
1507 | ||
1508 | // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame | |
1509 | Double_t angles[6] = | |
1510 | {90., 90.+(isector+0.5)*fgkPhiSec, | |
1511 | 0., 0., | |
1512 | 90., (isector+0.5)*fgkPhiSec | |
1513 | }; | |
1514 | Rotation(posLocal,angles); | |
1515 | ||
1516 | Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5}; | |
1517 | Translation(posLocal,step); | |
1518 | ||
1519 | // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame | |
1520 | angles[0] = 90.; | |
1521 | angles[1] = 0.; | |
1522 | angles[2] = 0.; | |
1523 | angles[3] = 0.; | |
1524 | angles[4] = 90.; | |
1525 | angles[5] =270.; | |
1526 | ||
1527 | Rotation(posLocal,angles); | |
1528 | ||
1529 | // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame | |
1530 | step[0] = 0.; | |
1531 | step[1] = GetHeights(iplate,istrip); | |
1532 | step[2] = -GetDistances(iplate,istrip); | |
1533 | Translation(posLocal,step); | |
1534 | ||
1535 | if (GetAngles(iplate,istrip) >0.) { | |
1536 | angles[0] = 90.; | |
1537 | angles[1] = 0.; | |
1538 | angles[2] = 90.+GetAngles(iplate,istrip); | |
1539 | angles[3] = 90.; | |
1540 | angles[4] = GetAngles(iplate,istrip); | |
1541 | angles[5] = 90.; | |
1542 | } | |
1543 | else if (GetAngles(iplate,istrip)==0.) { | |
1544 | angles[0] = 90.; | |
1545 | angles[1] = 0.; | |
1546 | angles[2] = 90.; | |
1547 | angles[3] = 90.; | |
1548 | angles[4] = 0; | |
1549 | angles[5] = 0.; | |
1550 | } | |
1551 | else if (GetAngles(iplate,istrip) <0.) { | |
1552 | angles[0] = 90.; | |
1553 | angles[1] = 0.; | |
1554 | angles[2] = 90.+GetAngles(iplate,istrip); | |
1555 | angles[3] = 90.; | |
1556 | angles[4] =-GetAngles(iplate,istrip); | |
1557 | angles[5] = 270.; | |
1558 | } | |
1559 | Rotation(posLocal,angles); | |
1560 | ||
1561 | step[0] =-0.5*kNpadX*fgkXPad; | |
1562 | step[1] = 0.; | |
1563 | step[2] =-0.5*kNpadZ*fgkZPad; | |
1564 | Translation(posLocal,step); | |
1565 | ||
1566 | step[0] = (ipadx+0.5)*fgkXPad; | |
1567 | step[1] = 0.; | |
1568 | step[2] = (ipadz+0.5)*fgkZPad; | |
1569 | Translation(posLocal,step); | |
1570 | ||
1571 | ypad=posLocal[1]; | |
1572 | ||
1573 | return ypad; | |
1574 | ||
1575 | } | |
1576 | //_____________________________________________________________________________ | |
1577 | Float_t AliTOFGeometry::GetPadDz(Float_t *pos) | |
1578 | { | |
1579 | // | |
1580 | // Returns the z coordinate in the Pad reference frame | |
1581 | // | |
1582 | ||
1583 | Float_t zpad = -2.; | |
1584 | ||
1585 | Float_t posLocal[3]; | |
1586 | for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii]; | |
1587 | ||
1588 | Int_t isector = GetSector(posLocal); | |
1589 | if(isector == -1){ | |
1590 | //AliError("Detector Index could not be determined"); | |
1591 | return zpad;} | |
1592 | Int_t iplate = GetPlate(posLocal); | |
1593 | if(iplate == -1){ | |
1594 | //AliError("Detector Index could not be determined"); | |
1595 | return zpad;} | |
1596 | Int_t istrip = GetStrip(posLocal); | |
1597 | if(istrip == -1){ | |
1598 | //AliError("Detector Index could not be determined"); | |
1599 | return zpad;} | |
1600 | Int_t ipadz = GetPadZ(posLocal); | |
1601 | if(ipadz == -1){ | |
1602 | //AliError("Detector Index could not be determined"); | |
1603 | return zpad;} | |
1604 | Int_t ipadx = GetPadX(posLocal); | |
1605 | if(ipadx == -1){ | |
1606 | //AliError("Detector Index could not be determined"); | |
1607 | return zpad;} | |
1608 | ||
1609 | // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame | |
1610 | Double_t angles[6] = | |
1611 | {90., 90.+(isector+0.5)*fgkPhiSec, | |
1612 | 0., 0., | |
1613 | 90., (isector+0.5)*fgkPhiSec | |
1614 | }; | |
1615 | Rotation(posLocal,angles); | |
1616 | ||
1617 | Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5}; | |
1618 | Translation(posLocal,step); | |
1619 | ||
1620 | // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame | |
1621 | angles[0] = 90.; | |
1622 | angles[1] = 0.; | |
1623 | angles[2] = 0.; | |
1624 | angles[3] = 0.; | |
1625 | angles[4] = 90.; | |
1626 | angles[5] =270.; | |
1627 | ||
1628 | Rotation(posLocal,angles); | |
1629 | ||
1630 | // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame | |
1631 | step[0] = 0.; | |
1632 | step[1] = GetHeights(iplate,istrip); | |
1633 | step[2] = -GetDistances(iplate,istrip); | |
1634 | Translation(posLocal,step); | |
1635 | ||
1636 | if (GetAngles(iplate,istrip) >0.) { | |
1637 | angles[0] = 90.; | |
1638 | angles[1] = 0.; | |
1639 | angles[2] = 90.+GetAngles(iplate,istrip); | |
1640 | angles[3] = 90.; | |
1641 | angles[4] = GetAngles(iplate,istrip); | |
1642 | angles[5] = 90.; | |
1643 | } | |
1644 | else if (GetAngles(iplate,istrip)==0.) { | |
1645 | angles[0] = 90.; | |
1646 | angles[1] = 0.; | |
1647 | angles[2] = 90.; | |
1648 | angles[3] = 90.; | |
1649 | angles[4] = 0; | |
1650 | angles[5] = 0.; | |
1651 | } | |
1652 | else if (GetAngles(iplate,istrip) <0.) { | |
1653 | angles[0] = 90.; | |
1654 | angles[1] = 0.; | |
1655 | angles[2] = 90.+GetAngles(iplate,istrip); | |
1656 | angles[3] = 90.; | |
1657 | angles[4] =-GetAngles(iplate,istrip); | |
1658 | angles[5] = 270.; | |
1659 | } | |
1660 | Rotation(posLocal,angles); | |
1661 | ||
1662 | step[0] =-0.5*kNpadX*fgkXPad; | |
1663 | step[1] = 0.; | |
1664 | step[2] =-0.5*kNpadZ*fgkZPad; | |
1665 | Translation(posLocal,step); | |
1666 | ||
1667 | step[0] = (ipadx+0.5)*fgkXPad; | |
1668 | step[1] = 0.; | |
1669 | step[2] = (ipadz+0.5)*fgkZPad; | |
1670 | Translation(posLocal,step); | |
1671 | ||
1672 | zpad=posLocal[2]; | |
1673 | ||
1674 | return zpad; | |
1675 | ||
1676 | } | |
1677 | //_____________________________________________________________________________ | |
1678 | ||
1679 | void AliTOFGeometry::Translation(Float_t *xyz, Float_t translationVector[3]) const | |
1680 | { | |
1681 | // | |
1682 | // Return the vector xyz translated by translationVector vector | |
1683 | // | |
1684 | ||
1685 | Int_t ii=0; | |
1686 | ||
1687 | for (ii=0; ii<3; ii++) | |
1688 | xyz[ii] -= translationVector[ii]; | |
1689 | ||
1690 | return; | |
1691 | ||
1692 | } | |
1693 | //_____________________________________________________________________________ | |
1694 | ||
1695 | void AliTOFGeometry::Rotation(Float_t *xyz, Double_t rotationAngles[6]) const | |
1696 | { | |
1697 | // | |
1698 | // Return the vector xyz rotated according to the rotationAngles angles | |
1699 | // | |
1700 | ||
1701 | Int_t ii=0; | |
1702 | /* | |
1703 | TRotMatrix *matrix = new TRotMatrix("matrix","matrix", angles[0], angles[1], | |
1704 | angles[2], angles[3], | |
1705 | angles[4], angles[5]); | |
1706 | */ | |
1707 | ||
1708 | for (ii=0; ii<6; ii++) rotationAngles[ii]*=kDegrad; | |
1709 | ||
1710 | Float_t xyzDummy[3] = {0., 0., 0.}; | |
1711 | ||
1712 | for (ii=0; ii<3; ii++) { | |
1713 | xyzDummy[ii] = | |
1714 | xyz[0]*TMath::Sin(rotationAngles[2*ii])*TMath::Cos(rotationAngles[2*ii+1]) + | |
1715 | xyz[1]*TMath::Sin(rotationAngles[2*ii])*TMath::Sin(rotationAngles[2*ii+1]) + | |
1716 | xyz[2]*TMath::Cos(rotationAngles[2*ii]); | |
1717 | } | |
1718 | ||
1719 | for (ii=0; ii<3; ii++) xyz[ii]=xyzDummy[ii]; | |
1720 | ||
1721 | return; | |
1722 | ||
1723 | } | |
1724 | //_____________________________________________________________________________ | |
1725 | void AliTOFGeometry::InverseRotation(Float_t *xyz, Double_t rotationAngles[6]) const | |
1726 | { | |
1727 | // | |
1728 | // | |
1729 | // | |
1730 | ||
1731 | Int_t ii=0; | |
1732 | ||
1733 | for (ii=0; ii<6; ii++) rotationAngles[ii]*=kDegrad; | |
1734 | ||
1735 | Float_t xyzDummy[3] = {0., 0., 0.}; | |
1736 | ||
1737 | xyzDummy[0] = | |
1738 | xyz[0]*TMath::Sin(rotationAngles[0])*TMath::Cos(rotationAngles[1]) + | |
1739 | xyz[1]*TMath::Sin(rotationAngles[2])*TMath::Cos(rotationAngles[3]) + | |
1740 | xyz[2]*TMath::Sin(rotationAngles[4])*TMath::Cos(rotationAngles[5]); | |
1741 | ||
1742 | xyzDummy[1] = | |
1743 | xyz[0]*TMath::Sin(rotationAngles[0])*TMath::Sin(rotationAngles[1]) + | |
1744 | xyz[1]*TMath::Sin(rotationAngles[2])*TMath::Sin(rotationAngles[3]) + | |
1745 | xyz[2]*TMath::Sin(rotationAngles[4])*TMath::Sin(rotationAngles[5]); | |
1746 | ||
1747 | xyzDummy[2] = | |
1748 | xyz[0]*TMath::Cos(rotationAngles[0]) + | |
1749 | xyz[1]*TMath::Cos(rotationAngles[2]) + | |
1750 | xyz[2]*TMath::Cos(rotationAngles[4]); | |
1751 | ||
1752 | for (ii=0; ii<3; ii++) xyz[ii]=xyzDummy[ii]; | |
1753 | ||
1754 | return; | |
1755 | ||
1756 | } | |
1757 | //_____________________________________________________________________________ | |
1758 | ||
1759 | Int_t AliTOFGeometry::GetIndex(Int_t *detId) | |
1760 | { | |
1761 | //Retrieve calibration channel index | |
1762 | Int_t isector = detId[0]; | |
1763 | if (isector >= kNSectors){ | |
1764 | printf("Wrong sector number in TOF (%d) !",isector); | |
1765 | return -1; | |
1766 | } | |
1767 | Int_t iplate = detId[1]; | |
1768 | if (iplate >= kNPlates){ | |
1769 | printf("Wrong plate number in TOF (%d) !",iplate); | |
1770 | return -1; | |
1771 | } | |
1772 | Int_t istrip = detId[2]; | |
1773 | Int_t ipadz = detId[3]; | |
1774 | Int_t ipadx = detId[4]; | |
1775 | Int_t stripOffset = 0; | |
1776 | switch (iplate) { | |
1777 | case 0: | |
1778 | stripOffset = 0; | |
1779 | break; | |
1780 | case 1: | |
1781 | stripOffset = kNStripC; | |
1782 | break; | |
1783 | case 2: | |
1784 | stripOffset = kNStripC+kNStripB; | |
1785 | break; | |
1786 | case 3: | |
1787 | stripOffset = kNStripC+kNStripB+kNStripA; | |
1788 | break; | |
1789 | case 4: | |
1790 | stripOffset = kNStripC+kNStripB+kNStripA+kNStripB; | |
1791 | break; | |
1792 | default: | |
1793 | printf("Wrong plate number in TOF (%d) !",iplate); | |
1794 | return -1; | |
1795 | }; | |
1796 | ||
1797 | Int_t idet = ((2*(kNStripC+kNStripB)+kNStripA) | |
1798 | *kNpadZ*kNpadX)*isector + | |
1799 | (stripOffset*kNpadZ*kNpadX)+ | |
1800 | (kNpadZ*kNpadX)*istrip+ | |
1801 | (kNpadX)*ipadz+ | |
1802 | ipadx; | |
1803 | return idet; | |
1804 | } | |
1805 | ||
1806 | ||
1807 |