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