1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 0.1 2005/07/19 G. Cara Romeo and A. De Caro
19 Modify Global methods IsInsideThePad & DistanceToPad
20 according to the new TOF geometry
21 Implement Global methods GetPadDx & GetPadDy & GetPadDz
22 Implement Private methods Translation & Rotation & InverseRotation
23 Modify Global methods GetDetID & GetPlate & GetSector &
24 GetStrip & GetPadX & GetPadZ
25 according to the new TOF geometry
26 Modify Global methods GetPos & GetX & GetY & GetZ
27 according to the new TOF geometry
31 #include <Riostream.h>
32 ///////////////////////////////////////////////////////////////////////////////
34 // TOF Geometry class (new version) //
36 ///////////////////////////////////////////////////////////////////////////////
40 #include "AliTOFGeometry.h"
41 #include "AliTOFGeometryV5.h"
43 ClassImp(AliTOFGeometryV5)
45 const Int_t AliTOFGeometryV5::kNStripC = 19; // number of strips in C type module
46 const Int_t AliTOFGeometryV5::kMaxNstrip = 19; // Max. number of strips
48 const Float_t AliTOFGeometryV5::fgkZlenA = 370.6*2.; // length (cm) of the A module
49 const Float_t AliTOFGeometryV5::fgkZlenB = 146.5; // length (cm) of the B module
50 const Float_t AliTOFGeometryV5::fgkZlenC = 170.45; // length (cm) of the C module
51 const Float_t AliTOFGeometryV5::fgkMaxhZtof = 370.6; // Max half z-size of TOF (cm)
52 const Float_t AliTOFGeometryV5::fgkStripLength = 124.; // Strip Length (rho X phi direction) (cm)
54 const Float_t AliTOFGeometryV5::fgkxTOF = 371.-0.01;// Inner radius of the TOF for Reconstruction (cm)
55 const Float_t AliTOFGeometryV5::fgkRmin = 370.-0.01;// Inner radius of the TOF (cm)
56 const Float_t AliTOFGeometryV5::fgkRmax = 399.-0.01;// Outer radius of the TOF (cm)
58 //_____________________________________________________________________________
59 AliTOFGeometryV5::AliTOFGeometryV5()
63 // AliTOFGeometryV5 default constructor
66 AliTOFGeometry::kNStripC = kNStripC; // number of strips in C type module
67 AliTOFGeometry::kMaxNstrip = kMaxNstrip; // Max. number of strips
69 AliTOFGeometry::kZlenA = fgkZlenA; // length of the TOF supermodule (cm)
70 AliTOFGeometry::kZlenB = fgkZlenB; // length of the B module (cm)
71 AliTOFGeometry::kZlenC = fgkZlenC; // length of the C module (cm)
72 AliTOFGeometry::kMaxhZtof = fgkMaxhZtof; // Max half z-size of TOF supermodule (cm)
73 AliTOFGeometry::kStripLength = fgkStripLength; // Strip Length (rho X phi direction) (cm)
75 AliTOFGeometry::fgkxTOF = fgkxTOF; // Inner radius of the TOF for Reconstruction (cm)
76 AliTOFGeometry::fgkRmin = fgkRmin; // Inner radius of the TOF (cm)
77 AliTOFGeometry::fgkRmax = fgkRmax; // Outer radius of the TOF (cm)
83 //_____________________________________________________________________________
84 AliTOFGeometryV5::~AliTOFGeometryV5()
87 // AliTOFGeometryV5 destructor
91 //_____________________________________________________________________________
92 void AliTOFGeometryV5::Init()
95 // Initialize strip Tilt Angles, Heights and Distances
99 // For each strip to be positoned in FLTA/FLTB/FLTC,
100 // define 3 arrays containing:
101 // the angle of the normal with respect to the Y axis of FLTA/FLTB/FLTC
102 // the Y of the center with respect to the FLTA/FLTB/FLTC reference frame
103 // the Z of the center with respect to the BT01/BT02/BT03 reference frame
106 Float_t const kangles[kNPlates][kMaxNstrip] ={
107 { 43.99, 43.20, 42.40, 41.59, 40.77, 39.94, 39.11, 38.25, 37.40, 36.53,
108 35.65, 34.76, 33.87, 32.96, 32.05, 31.13, 30.19, 29.24, 12.33},
110 { 27.26, 26.28, 25.30, 24.31, 23.31, 22.31, 21.30, 20.29, 19.26, 18.24,
111 17.20, 16.16, 15.11, 14.05, 13.00, 11.93, 10.87, 9.80, 8.74},
113 { 0.00, 6.30, 5.31, 4.25, 3.19, 2.12, 1.06, 0.00, -1.06, -2.12,
114 -3.19, -4.25, -5.31, -6.30, 0.00, 0.00, 0.00, 0.00, 0.00},
116 { -8.74, -9.80, -10.87, -11.93, -13.00, -14.05, -15.11, -16.16, -17.20, -18.24,
117 -19.26, -20.29, -21.30, -22.31, -23.31, -24.31, -25.30, -26.28, -27.26},
119 {-12.33, -29.24, -30.19, -31.13, -32.05, -32.96, -33.87, -34.76, -35.65, -36.53,
120 -37.40, -38.25, -39.11, -39.94, -40.77, -41.59, -42.40, -43.20, -43.99}
123 Float_t const kheights[kNPlates][kMaxNstrip]= {
124 {-8.2, -7.5, -8.2, -7.7, -8.1, -7.6, -7.7, -7.7, -7.7, -7.7,
125 -7.5, -7.2, -7.3, -7.5, -7.6, -7.8, -8.3, -9.3, -3.1},
127 {-7.9, -8.1, -8.5, -9.0, -10.1, -3.9, -5.9, -7.7, -10.1, -3.6,
128 -5.8, -8.0, -10.4, -4.4, -7.2, -10.2, -4.6, -7.4, -10.4},
130 {-2.5, -10.4, -5.0, -9.9, -4.8, -9.9, -4.7, -10.2, -4.7, -9.9,
131 -4.8, -9.9, -5.0, -10.4, -2.5, 0.0, 0.0, 0.0, 0.0},
133 {-10.4, -7.4, -4.6, -10.2, -7.2, -4.4, -10.4, -8.0, -5.8, -3.6,
134 -10.1, -7.7, -5.9, -3.9, -10.1, -9.0, -8.5, -8.1, -7.9},
136 { -3.1, -9.3, -8.3, -7.8, -7.6, -7.5, -7.3, -7.2, -7.5, -7.7,
137 -7.7, -7.7, -7.7, -7.6, -8.1, -7.7, -8.2, -7.5, -8.2}
141 Float_t const kdistances[kNPlates][kMaxNstrip]= {
142 { 364.1, 354.9, 344.5, 335.4, 325.5, 316.6, 307.2, 298.0, 288.9, 280.0,
143 271.3, 262.7, 254.0, 244.8, 236.1, 227.7, 219.1, 210.3, 205.7},
145 { 194.2, 186.1, 177.9, 169.8, 161.5, 156.3, 147.8, 139.4, 130.9, 125.6,
146 117.3, 109.2, 101.1, 95.3, 87.1, 79.2, 73.0, 65.1, 57.6},
148 { 49.5, 41.3, 35.3, 27.8, 21.2, 13.9, 7.0, 0.0, -7.0, -13.9,
149 -21.2, -27.8, -35.3, -41.3, -49.5, 0.0, 0.0, 0.0, 0.0},
151 { -57.6, -65.1, -73.0, -79.2, -87.1, -95.3, -101.1, -109.2, -117.3, -125.6,
152 -130.9, -139.4, -147.8, -156.3, -161.5, -169.8, -177.9, -186.1, -194.2},
154 {-205.7, -210.3, -219.1, -227.7, -236.1, -244.8, -254.0, -262.7, -271.3, -280.0,
155 -288.9, -298.0, -307.2, -316.6, -325.5, -335.4, -344.5, -354.9, -364.1}
159 for (Int_t iplate = 0; iplate < kNPlates; iplate++) AliTOFGeometry::fAngles[iplate] = new Float_t[kMaxNstrip];
160 for (Int_t iplate = 0; iplate < kNPlates; iplate++) AliTOFGeometry::fHeights[iplate] = new Float_t[kMaxNstrip];
161 for (Int_t iplate = 0; iplate < kNPlates; iplate++) AliTOFGeometry::fDistances[iplate] = new Float_t[kMaxNstrip];
163 for (Int_t iplate = 0; iplate < kNPlates; iplate++) {
164 for (Int_t istrip = 0; istrip < kMaxNstrip; istrip++) {
165 AliTOFGeometry::fAngles[iplate][istrip] = kangles[iplate][istrip];
166 AliTOFGeometry::fHeights[iplate][istrip] = kheights[iplate][istrip];
167 AliTOFGeometry::fDistances[iplate][istrip]= kdistances[iplate][istrip];
173 //_____________________________________________________________________________
174 Float_t AliTOFGeometryV5::DistanceToPad(Int_t *det, Float_t *pos, Float_t *dist3d)
177 // Returns distance of space point with coor pos (x,y,z) (cm) wrt
178 // pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ)
181 //Transform pos into Sector Frame
187 Float_t radius = TMath::Sqrt(x*x+y*y);
188 //Float_t phi=TMath::ATan(y/x);
189 //if(phi<0) phi = k2PI+phi; //2.*TMath::Pi()+phi;
190 Float_t phi = TMath::Pi()+TMath::ATan2(-y,-x);
191 // Get the local angle in the sector philoc
192 Float_t angle = phi*kRaddeg-( Int_t (kRaddeg*phi/fPhiSec) + 0.5)*fPhiSec;
193 Float_t xs = radius*TMath::Cos(angle/kRaddeg);
194 Float_t ys = radius*TMath::Sin(angle/kRaddeg);
197 // Do the same for the selected pad
202 Float_t padRadius = TMath::Sqrt(g[0]*g[0]+g[1]*g[1]);
203 //Float_t padPhi = TMath::ATan(g[1]/g[0]);
204 //if(padPhi<0) padPhi = k2Pi + padPhi;
205 Float_t padPhi = TMath::Pi()+TMath::ATan2(-g[1],-g[0]);
207 // Get the local angle in the sector philoc
208 Float_t padAngle = padPhi*kRaddeg-( Int_t (padPhi*kRaddeg/fPhiSec)+ 0.5) * fPhiSec;
209 Float_t padxs = padRadius*TMath::Cos(padAngle/kRaddeg);
210 Float_t padys = padRadius*TMath::Sin(padAngle/kRaddeg);
211 Float_t padzs = g[2];
213 //Now move to local pad coordinate frame. Translate:
215 Float_t xt = xs-padxs;
216 Float_t yt = ys-padys;
217 Float_t zt = zs-padzs;
220 Float_t alpha = GetAngles(det[1],det[2]);
221 Float_t xr = xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg);
223 Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg);
225 Float_t dist = TMath::Sqrt(xr*xr+yr*yr+zr*zr);
237 //_____________________________________________________________________________
238 Bool_t AliTOFGeometryV5::IsInsideThePad(Int_t *det, Float_t *pos)
241 // Returns true if space point with coor pos (x,y,z) (cm) falls
242 // inside pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ)
245 Bool_t isInside=false;
248 const Float_t khhony = 1.0 ; // heigth of HONY Layer
249 const Float_t khpcby = 0.08 ; // heigth of PCB Layer
250 const Float_t khrgly = 0.055 ; // heigth of RED GLASS Layer
251 const Float_t khglfy = 0.285 ; // heigth of GLASS+FISHLINE Layer
252 const Float_t khcpcby = 0.16 ; // heigth of PCB Central Layer
253 //const Float_t kwcpcbz = 12.4 ; // z dimension of PCB Central Layer
254 const Float_t khstripy = 2.*khhony+2.*khpcby+4.*khrgly+2.*khglfy+khcpcby;//3.11
255 //const Float_t kwstripz = kwcpcbz;
256 //const Float_t klstripx = fgkStripLength;
259 const Float_t khsensmy = 0.05;//0.05;//0.11;//0.16;// // heigth of Sensitive Layer
261 //Transform pos into Sector Frame
267 Float_t radius = TMath::Sqrt(x*x+y*y);
268 Float_t phi = TMath::Pi()+TMath::ATan2(-y,-x);
270 // Get the local angle in the sector philoc
271 Float_t angle = phi*kRaddeg-( Int_t (kRaddeg*phi/fPhiSec) + 0.5) *fPhiSec;
272 Float_t xs = radius*TMath::Cos(angle/kRaddeg);
273 Float_t ys = radius*TMath::Sin(angle/kRaddeg);
276 // Do the same for the selected pad
281 Float_t padRadius = TMath::Sqrt(g[0]*g[0]+g[1]*g[1]);
282 Float_t padPhi = TMath::Pi()+TMath::ATan2(-g[1],-g[0]);
284 // Get the local angle in the sector philoc
285 Float_t padAngle = padPhi*kRaddeg-( Int_t (padPhi*kRaddeg/fPhiSec)+ 0.5) * fPhiSec;
286 Float_t padxs = padRadius*TMath::Cos(padAngle/kRaddeg);
287 Float_t padys = padRadius*TMath::Sin(padAngle/kRaddeg);
288 Float_t padzs = g[2];
290 //Now move to local pad coordinate frame. Translate:
292 Float_t xt = xs-padxs;
293 Float_t yt = ys-padys;
294 Float_t zt = zs-padzs;
298 Float_t alpha = GetAngles(det[1],det[2]);
299 Float_t xr = xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg);
301 Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg);
303 //if(TMath::Abs(xr)<=1.50*0.5 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5)) ???
304 if(TMath::Abs(xr)<=khsensmy*0.5 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5))
305 //if(TMath::Abs(xr)<=khstripy*0.5 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5))
311 //_____________________________________________________________________________
312 Float_t AliTOFGeometryV5::GetX(Int_t *det)
315 // Returns X coordinate (cm)
318 Int_t isector = det[0];
319 Int_t iplate = det[1];
320 Int_t istrip = det[2];
321 Int_t ipadz = det[3];
322 Int_t ipadx = det[4];
325 // Find out distance d on the plane wrt median phi:
326 Float_t d = (ipadx+0.5-kNpadX*0.5)*fgkXPad;
328 // The radius r in xy plane:
329 //Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
330 // (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg)-0.25; ???
331 Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
332 (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg);
334 // local azimuthal angle in the sector philoc
335 Float_t philoc = TMath::ATan(d/r);
336 //if(philoc<0.) philoc = k2PI + philoc;
338 // azimuthal angle in the global frame phi
339 Float_t phi = philoc*kRaddeg+(isector+0.5)*fPhiSec;
341 Float_t xCoor = r/TMath::Cos(philoc)*TMath::Cos(phi/kRaddeg);
344 // Pad reference frame -> FSTR reference frame
346 Float_t posLocal[3] = {0., 0., 0.};
347 Float_t step[3] = {-(ipadx+0.5)*fgkXPad, 0., -(ipadz+0.5)*fgkZPad};
348 Translation(posLocal,step);
350 step[0] = kNpadX*0.5*fgkXPad;
352 step[2] = kNpadZ*0.5*fgkZPad;
355 Float_t posLocal[3] = {(ipadx+0.5)*fgkXPad, 0., (ipadz+0.5)*fgkZPad};
356 Float_t step[3]= {kNpadX*0.5*fgkXPad, 0., kNpadZ*0.5*fgkZPad};
358 Translation(posLocal,step);
360 // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame
362 if (GetAngles(iplate,istrip) >0.) {
365 angles[2] = 90.+GetAngles(iplate,istrip);
367 angles[4] = GetAngles(iplate,istrip);
370 else if (GetAngles(iplate,istrip)==0.) {
378 else if (GetAngles(iplate,istrip) <0.) {
381 angles[2] = 90.+GetAngles(iplate,istrip);
383 angles[4] =-GetAngles(iplate,istrip);
387 InverseRotation(posLocal,angles);
390 step[1] = -GetHeights(iplate,istrip);
391 step[2] = GetDistances(iplate,istrip);
392 Translation(posLocal,step);
394 // FTOA = FLTA reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
402 InverseRotation(posLocal,angles);
404 // B071/B074/B075 = BTO1/2/3 reference frame -> ALICE reference frame
407 step[2] = -((fgkRmax+fgkRmin)*0.5);
408 Translation(posLocal,step);
411 angles[1] = 90.+(isector+0.5)*fPhiSec;
415 angles[5] = (isector+0.5)*fPhiSec;
417 InverseRotation(posLocal,angles);
419 Float_t xCoor = posLocal[0];
424 //_____________________________________________________________________________
425 Float_t AliTOFGeometryV5::GetY(Int_t *det)
428 // Returns Y coordinate (cm)
431 Int_t isector = det[0];
432 Int_t iplate = det[1];
433 Int_t istrip = det[2];
434 Int_t ipadz = det[3];
435 Int_t ipadx = det[4];
438 // Find out distance d on the plane wrt median phi:
439 Float_t d = (ipadx+0.5-kNpadX*0.5)*fgkXPad;
441 // The radius r in xy plane:
442 //Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
443 // (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg)-0.25; ???
444 Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
445 (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg);
447 // local azimuthal angle in the sector philoc
448 Float_t philoc = TMath::ATan(d/r);
449 //if(philoc<0.) philoc = k2PI + philoc;
451 // azimuthal angle in the global frame phi
452 Float_t phi = philoc*kRaddeg+(isector+0.5)*fPhiSec;
454 Float_t yCoor = r/TMath::Cos(philoc)*TMath::Sin(phi/kRaddeg);
457 // Pad reference frame -> FSTR reference frame
459 Float_t posLocal[3] = {0., 0., 0.};
460 Float_t step[3] = {-(ipadx+0.5)*fgkXPad, 0., -(ipadz+0.5)*fgkZPad};
461 Translation(posLocal,step);
463 step[0] = kNpadX*0.5*fgkXPad;
465 step[2] = kNpadZ*0.5*fgkZPad;
468 Float_t posLocal[3] = {(ipadx+0.5)*fgkXPad, 0., (ipadz+0.5)*fgkZPad};
469 Float_t step[3]= {kNpadX*0.5*fgkXPad, 0., kNpadZ*0.5*fgkZPad};
471 Translation(posLocal,step);
473 // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame
476 if (GetAngles(iplate,istrip) >0.) {
479 angles[2] = 90.+GetAngles(iplate,istrip);
481 angles[4] = GetAngles(iplate,istrip);
484 else if (GetAngles(iplate,istrip)==0.) {
492 else if (GetAngles(iplate,istrip) <0.) {
495 angles[2] = 90.+GetAngles(iplate,istrip);
497 angles[4] =-GetAngles(iplate,istrip);
501 InverseRotation(posLocal,angles);
504 step[1] = -GetHeights(iplate,istrip);
505 step[2] = GetDistances(iplate,istrip);
506 Translation(posLocal,step);
508 // FTOA = FLTA reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
516 InverseRotation(posLocal,angles);
518 // B071/B074/B075 = BTO1/2/3 reference frame -> ALICE reference frame
521 step[2] = -((fgkRmax+fgkRmin)*0.5);
522 Translation(posLocal,step);
525 angles[1] = 90.+(isector+0.5)*fPhiSec;
529 angles[5] = (isector+0.5)*fPhiSec;
531 InverseRotation(posLocal,angles);
533 Float_t yCoor = posLocal[1];
539 //_____________________________________________________________________________
540 Float_t AliTOFGeometryV5::GetZ(Int_t *det)
543 // Returns Z coordinate (cm)
546 Int_t isector = det[0];
547 Int_t iplate = det[1];
548 Int_t istrip = det[2];
549 Int_t ipadz = det[3];
550 Int_t ipadx = det[4];
553 Float_t zCoor = GetDistances(iplate,istrip) +
554 (0.5-ipadz) * fgkZPad * TMath::Cos(GetAngles(iplate,istrip)*kDegrad);
557 // Pad reference frame -> FSTR reference frame
559 Float_t posLocal[3] = {0., 0., 0.};
560 Float_t step[3] = {-(ipadx+0.5)*fgkXPad, 0., -(ipadz+0.5)*fgkZPad};
561 Translation(posLocal,step);
563 step[0] = kNpadX*0.5*fgkXPad;
565 step[2] = kNpadZ*0.5*fgkZPad;
568 Float_t posLocal[3] = {(ipadx+0.5)*fgkXPad, 0., (ipadz+0.5)*fgkZPad};
569 Float_t step[3]= {kNpadX*0.5*fgkXPad, 0., kNpadZ*0.5*fgkZPad};
571 Translation(posLocal,step);
573 // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame
575 if (GetAngles(iplate,istrip) >0.) {
578 angles[2] = 90.+GetAngles(iplate,istrip);
580 angles[4] = GetAngles(iplate,istrip);
583 else if (GetAngles(iplate,istrip)==0.) {
591 else if (GetAngles(iplate,istrip) <0.) {
594 angles[2] = 90.+GetAngles(iplate,istrip);
596 angles[4] =-GetAngles(iplate,istrip);
600 InverseRotation(posLocal,angles);
603 step[1] = -GetHeights(iplate,istrip);
604 step[2] = GetDistances(iplate,istrip);
605 Translation(posLocal,step);
607 // FTOA = FLTA reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
615 InverseRotation(posLocal,angles);
617 // B071/B074/B075 = BTO1/2/3 reference frame -> ALICE reference frame
620 step[2] = -((fgkRmax+fgkRmin)*0.5);
621 Translation(posLocal,step);
624 angles[1] = 90.+(isector+0.5)*fPhiSec;
628 angles[5] = (isector+0.5)*fPhiSec;
630 InverseRotation(posLocal,angles);
632 Float_t zCoor = posLocal[2];
638 //_____________________________________________________________________________
639 Int_t AliTOFGeometryV5::GetSector(Float_t *pos)
642 // Returns the Sector index
645 //const Float_t khAlWall = 0.1;
646 //const Float_t kModuleWallThickness = 0.3;
654 Float_t rho = TMath::Sqrt(x*x + y*y);
656 //if (!((z>=-fgkMaxhZtof && z<=fgkMaxhZtof) &&
657 if (!((z>=-fgkZlenA*0.5 && z<=fgkZlenA*0.5) &&
658 (rho>=(fgkRmin) && rho<=(fgkRmax)))) {
659 //(rho>=(fgkRmin-0.05)+kModuleWallThickness && rho<=(fgkRmax-0.05)-kModuleWallThickness-khAlWall-kModuleWallThickness))) {
660 //AliError("Detector Index could not be determined");
664 Float_t phi = TMath::Pi() + TMath::ATan2(-y,-x);
666 iSect = (Int_t) (phi*kRaddeg/fPhiSec);
671 //_____________________________________________________________________________
673 Int_t AliTOFGeometryV5::GetPlate(Float_t *pos)
676 // Returns the Plate index
678 const Float_t kInterCentrModBorder1 = 49.5;
679 const Float_t kInterCentrModBorder2 = 57.5;
680 const Float_t kExterInterModBorder1 = 196.0;
681 const Float_t kExterInterModBorder2 = 203.5;
683 const Float_t kLengthExInModBorder = 4.7;
684 const Float_t kLengthInCeModBorder = 7.0;
686 //const Float_t khAlWall = 0.1;
687 const Float_t kModuleWallThickness = 0.3;
688 //const Float_t kHoneycombLayerThickness = 1.5;
693 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
695 Int_t isector = GetSector(posLocal);
697 //AliError("Detector Index could not be determined");
701 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
703 {90., 90.+(isector+0.5)*fPhiSec,
705 90., (isector+0.5)*fPhiSec
707 Rotation(posLocal,angles);
709 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
710 Translation(posLocal,step);
712 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame
720 Rotation(posLocal,angles);
722 Float_t yLocal = posLocal[1];
723 Float_t zLocal = posLocal[2];
725 Float_t deltaRhoLoc = (fgkRmax-fgkRmin)*0.5 - kModuleWallThickness + yLocal;
726 Float_t deltaZetaLoc = TMath::Abs(zLocal);
728 Float_t deltaRHOmax = 0.;
730 if (TMath::Abs(zLocal)>=kExterInterModBorder1 && TMath::Abs(zLocal)<=kExterInterModBorder2)
732 deltaRhoLoc -= kLengthExInModBorder;
733 deltaZetaLoc = kExterInterModBorder2-deltaZetaLoc;
734 deltaRHOmax = (fgkRmax - fgkRmin)*0.5 - kModuleWallThickness - 2.*kLengthExInModBorder; // old 5.35, new 4.8
736 if (deltaRhoLoc > deltaZetaLoc*deltaRHOmax/(kInterCentrModBorder2-kInterCentrModBorder1)) {
737 if (zLocal<0) iPlate = 0;
741 if (zLocal<0) iPlate = 1;
745 else if (TMath::Abs(zLocal)>=kInterCentrModBorder1 && TMath::Abs(zLocal)<=kInterCentrModBorder2)
747 deltaRhoLoc -= kLengthInCeModBorder;
748 deltaZetaLoc = deltaZetaLoc-kInterCentrModBorder1;
749 deltaRHOmax = (fgkRmax - fgkRmin)*0.5 - kModuleWallThickness - 2.*kLengthInCeModBorder; // old 0.39, new 0.2
751 if (deltaRhoLoc>deltaZetaLoc*deltaRHOmax/(kInterCentrModBorder2-kInterCentrModBorder1)) iPlate = 2;
753 if (zLocal<0) iPlate = 1;
758 if (zLocal>-fgkZlenA*0.5/*fgkMaxhZtof*/ && zLocal<-kExterInterModBorder2) iPlate = 0;
759 else if (zLocal>-kExterInterModBorder1 && zLocal<-kInterCentrModBorder2) iPlate = 1;
760 else if (zLocal>-kInterCentrModBorder1 && zLocal< kInterCentrModBorder1) iPlate = 2;
761 else if (zLocal> kInterCentrModBorder2 && zLocal< kExterInterModBorder1) iPlate = 3;
762 else if (zLocal> kExterInterModBorder2 && zLocal< fgkZlenA*0.5/*fgkMaxhZtof*/) iPlate = 4;
768 //_____________________________________________________________________________
769 Int_t AliTOFGeometryV5::GetStrip(Float_t *pos)
772 // Returns the Strip index
774 const Float_t khhony = 1.0 ; // heigth of HONY Layer
775 const Float_t khpcby = 0.08 ; // heigth of PCB Layer
776 const Float_t khrgly = 0.055 ; // heigth of RED GLASS Layer
777 const Float_t khglfy = 0.285 ; // heigth of GLASS+FISHLINE Layer
778 const Float_t khcpcby = 0.16 ; // heigth of PCB Central Layer
779 const Float_t kwcpcbz = 12.4 ; // z dimension of PCB Central Layer
780 const Float_t khstripy = 2.*khhony+2.*khpcby+4.*khrgly+2.*khglfy+khcpcby;//3.11
781 const Float_t kwstripz = kwcpcbz;
782 const Float_t klstripx = fgkStripLength;
787 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
789 Int_t isector = GetSector(posLocal);
791 //AliError("Detector Index could not be determined");
793 Int_t iplate = GetPlate(posLocal);
795 //AliError("Detector Index could not be determined");
817 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
819 {90., 90.+(isector+0.5)*fPhiSec,
821 90., (isector+0.5)*fPhiSec
823 Rotation(posLocal,angles);
825 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
826 Translation(posLocal,step);
828 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame
836 Rotation(posLocal,angles);
838 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
840 for (Int_t istrip=0; istrip<nstrips; istrip++){
842 Float_t posLoc2[3]={posLocal[0],posLocal[1],posLocal[2]};
845 step[1] = GetHeights(iplate,istrip);
846 step[2] = -GetDistances(iplate,istrip);
847 Translation(posLoc2,step);
849 if (GetAngles(iplate,istrip) >0.) {
852 angles[2] = 90.+GetAngles(iplate,istrip);
854 angles[4] = GetAngles(iplate,istrip);
857 else if (GetAngles(iplate,istrip)==0.) {
865 else if (GetAngles(iplate,istrip) <0.) {
868 angles[2] = 90.+GetAngles(iplate,istrip);
870 angles[4] =-GetAngles(iplate,istrip);
873 Rotation(posLoc2,angles);
875 if ((TMath::Abs(posLoc2[0])<=klstripx*0.5) &&
876 (TMath::Abs(posLoc2[1])<=khstripy*0.5) &&
877 (TMath::Abs(posLoc2[2])<=kwstripz*0.5)) {
880 for (Int_t jj=0; jj<3; jj++) posLocal[jj]=posLoc2[jj];
881 //AliInfo(Form(" posLocal[0] = %f, posLocal[1] = %f, posLocal[2] = %f ", posLocal[0],posLocal[1],posLocal[2]));
883 //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]));
887 if (totStrip>1) AliInfo(Form("total strip number found %2i",totStrip));
894 //_____________________________________________________________________________
895 Int_t AliTOFGeometryV5::GetPadZ(Float_t *pos)
898 // Returns the Pad index along Z
900 //const Float_t klsensmx = kNpadX*fgkXPad; // length of Sensitive Layer
901 //const Float_t khsensmy = 0.05;//0.11;//0.16;// heigth of Sensitive Layer
902 //const Float_t kwsensmz = kNpadZ*fgkZPad; // width of Sensitive Layer
907 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
909 Int_t isector = GetSector(posLocal);
911 //AliError("Detector Index could not be determined");
913 Int_t iplate = GetPlate(posLocal);
915 //AliError("Detector Index could not be determined");
917 Int_t istrip = GetStrip(posLocal);
919 //AliError("Detector Index could not be determined");
922 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
924 {90., 90.+(isector+0.5)*fPhiSec,
926 90., (isector+0.5)*fPhiSec
928 Rotation(posLocal,angles);
930 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
931 Translation(posLocal,step);
933 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame
941 Rotation(posLocal,angles);
943 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
945 step[1] = GetHeights(iplate,istrip);
946 step[2] = -GetDistances(iplate,istrip);
947 Translation(posLocal,step);
949 if (GetAngles(iplate,istrip) >0.) {
952 angles[2] = 90.+GetAngles(iplate,istrip);
954 angles[4] = GetAngles(iplate,istrip);
957 else if (GetAngles(iplate,istrip)==0.) {
965 else if (GetAngles(iplate,istrip) <0.) {
968 angles[2] = 90.+GetAngles(iplate,istrip);
970 angles[4] =-GetAngles(iplate,istrip);
973 Rotation(posLocal,angles);
975 //if (TMath::Abs(posLocal[0])<=klsensmx*0.5 && /*TMath::Abs(posLocal[1])<=khsensmy*0.5+0.005 &&*/ TMath::Abs(posLocal[2])<=kwsensmz*0.5) {
976 //if (TMath::Abs(posLocal[1])<=khsensmy*0.5) {
978 step[0] =-0.5*kNpadX*fgkXPad;
980 step[2] =-0.5*kNpadZ*fgkZPad;
981 Translation(posLocal,step);
983 iPadZ = (Int_t)(posLocal[2]/fgkZPad);
984 if (iPadZ==kNpadZ) iPadZ--;
985 else if (iPadZ>kNpadZ) iPadZ=-1;
988 // else AliError("Detector Index could not be determined");
993 //_____________________________________________________________________________
994 Int_t AliTOFGeometryV5::GetPadX(Float_t *pos)
997 // Returns the Pad index along X
999 //const Float_t klsensmx = kNpadX*fgkXPad; // length of Sensitive Layer
1000 //const Float_t khsensmy = 0.05;//0.11;//0.16;// heigth of Sensitive Layer
1001 //const Float_t kwsensmz = kNpadZ*fgkZPad; // width of Sensitive Layer
1005 Float_t posLocal[3];
1006 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
1008 Int_t isector = GetSector(posLocal);
1010 //AliError("Detector Index could not be determined");
1012 Int_t iplate = GetPlate(posLocal);
1014 //AliError("Detector Index could not be determined");
1016 Int_t istrip = GetStrip(posLocal);
1018 //AliError("Detector Index could not be determined");
1021 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1022 Double_t angles[6] =
1023 {90., 90.+(isector+0.5)*fPhiSec,
1025 90., (isector+0.5)*fPhiSec
1027 Rotation(posLocal,angles);
1029 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1030 Translation(posLocal,step);
1032 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
1040 Rotation(posLocal,angles);
1042 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1044 step[1] = GetHeights(iplate,istrip);
1045 step[2] = -GetDistances(iplate,istrip);
1046 Translation(posLocal,step);
1048 if (GetAngles(iplate,istrip) >0.) {
1051 angles[2] = 90.+GetAngles(iplate,istrip);
1053 angles[4] = GetAngles(iplate,istrip);
1056 else if (GetAngles(iplate,istrip)==0.) {
1064 else if (GetAngles(iplate,istrip) <0.) {
1067 angles[2] = 90.+GetAngles(iplate,istrip);
1069 angles[4] =-GetAngles(iplate,istrip);
1072 Rotation(posLocal,angles);
1074 //if (TMath::Abs(posLocal[0])<=klsensmx*0.5 && /*TMath::Abs(posLocal[1])<=khsensmy*0.5+0.005 &&*/ TMath::Abs(posLocal[2])<=kwsensmz*0.5) {
1075 //if (TMath::Abs(posLocal[1])<=khsensmy*0.5) {
1077 step[0] =-0.5*kNpadX*fgkXPad;
1079 step[2] =-0.5*kNpadZ*fgkZPad;
1080 Translation(posLocal,step);
1082 iPadX = (Int_t)(posLocal[0]/fgkXPad);
1083 if (iPadX==kNpadX) iPadX--;
1084 else if (iPadX>kNpadX) iPadX=-1;
1087 //else AliError("Detector Index could not be determined");
1092 //_____________________________________________________________________________
1094 Float_t AliTOFGeometryV5::GetPadDx(Float_t *pos)
1097 // Returns the x coordinate in the Pad reference frame
1102 Float_t posLocal[3];
1103 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
1105 Int_t isector = GetSector(posLocal);
1107 //AliError("Detector Index could not be determined");
1109 Int_t iplate = GetPlate(posLocal);
1111 //AliError("Detector Index could not be determined");
1113 Int_t istrip = GetStrip(posLocal);
1115 //AliError("Detector Index could not be determined");
1117 Int_t ipadz = GetPadZ(posLocal);
1119 //AliError("Detector Index could not be determined");
1121 Int_t ipadx = GetPadX(posLocal);
1123 //AliError("Detector Index could not be determined");
1126 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1127 Double_t angles[6] =
1128 {90., 90.+(isector+0.5)*fPhiSec,
1130 90., (isector+0.5)*fPhiSec
1132 Rotation(posLocal,angles);
1134 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1135 Translation(posLocal,step);
1137 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
1145 Rotation(posLocal,angles);
1147 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1149 step[1] = GetHeights(iplate,istrip);
1150 step[2] = -GetDistances(iplate,istrip);
1151 Translation(posLocal,step);
1153 if (GetAngles(iplate,istrip) >0.) {
1156 angles[2] = 90.+GetAngles(iplate,istrip);
1158 angles[4] = GetAngles(iplate,istrip);
1161 else if (GetAngles(iplate,istrip)==0.) {
1169 else if (GetAngles(iplate,istrip) <0.) {
1172 angles[2] = 90.+GetAngles(iplate,istrip);
1174 angles[4] =-GetAngles(iplate,istrip);
1177 Rotation(posLocal,angles);
1179 step[0] =-0.5*kNpadX*fgkXPad;
1181 step[2] =-0.5*kNpadZ*fgkZPad;
1182 Translation(posLocal,step);
1184 step[0] = (ipadx+0.5)*fgkXPad;
1186 step[2] = (ipadz+0.5)*fgkZPad;
1187 Translation(posLocal,step);
1194 //_____________________________________________________________________________
1195 Float_t AliTOFGeometryV5::GetPadDy(Float_t *pos)
1198 // Returns the x coordinate in the Pad reference frame
1203 Float_t posLocal[3];
1204 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
1206 Int_t isector = GetSector(posLocal);
1208 //AliError("Detector Index could not be determined");
1210 Int_t iplate = GetPlate(posLocal);
1212 //AliError("Detector Index could not be determined");
1214 Int_t istrip = GetStrip(posLocal);
1216 //AliError("Detector Index could not be determined");
1218 Int_t ipadz = GetPadZ(posLocal);
1220 //AliError("Detector Index could not be determined");
1222 Int_t ipadx = GetPadX(posLocal);
1224 //AliError("Detector Index could not be determined");
1227 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1228 Double_t angles[6] =
1229 {90., 90.+(isector+0.5)*fPhiSec,
1231 90., (isector+0.5)*fPhiSec
1233 Rotation(posLocal,angles);
1235 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1236 Translation(posLocal,step);
1238 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
1246 Rotation(posLocal,angles);
1248 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1250 step[1] = GetHeights(iplate,istrip);
1251 step[2] = -GetDistances(iplate,istrip);
1252 Translation(posLocal,step);
1254 if (GetAngles(iplate,istrip) >0.) {
1257 angles[2] = 90.+GetAngles(iplate,istrip);
1259 angles[4] = GetAngles(iplate,istrip);
1262 else if (GetAngles(iplate,istrip)==0.) {
1270 else if (GetAngles(iplate,istrip) <0.) {
1273 angles[2] = 90.+GetAngles(iplate,istrip);
1275 angles[4] =-GetAngles(iplate,istrip);
1278 Rotation(posLocal,angles);
1280 step[0] =-0.5*kNpadX*fgkXPad;
1282 step[2] =-0.5*kNpadZ*fgkZPad;
1283 Translation(posLocal,step);
1285 step[0] = (ipadx+0.5)*fgkXPad;
1287 step[2] = (ipadz+0.5)*fgkZPad;
1288 Translation(posLocal,step);
1295 //_____________________________________________________________________________
1296 Float_t AliTOFGeometryV5::GetPadDz(Float_t *pos)
1299 // Returns the x coordinate in the Pad reference frame
1304 Float_t posLocal[3];
1305 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
1307 Int_t isector = GetSector(posLocal);
1309 //AliError("Detector Index could not be determined");
1311 Int_t iplate = GetPlate(posLocal);
1313 //AliError("Detector Index could not be determined");
1315 Int_t istrip = GetStrip(posLocal);
1317 //AliError("Detector Index could not be determined");
1319 Int_t ipadz = GetPadZ(posLocal);
1321 //AliError("Detector Index could not be determined");
1323 Int_t ipadx = GetPadX(posLocal);
1325 //AliError("Detector Index could not be determined");
1328 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1329 Double_t angles[6] =
1330 {90., 90.+(isector+0.5)*fPhiSec,
1332 90., (isector+0.5)*fPhiSec
1334 Rotation(posLocal,angles);
1336 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1337 Translation(posLocal,step);
1339 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
1347 Rotation(posLocal,angles);
1349 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1351 step[1] = GetHeights(iplate,istrip);
1352 step[2] = -GetDistances(iplate,istrip);
1353 Translation(posLocal,step);
1355 if (GetAngles(iplate,istrip) >0.) {
1358 angles[2] = 90.+GetAngles(iplate,istrip);
1360 angles[4] = GetAngles(iplate,istrip);
1363 else if (GetAngles(iplate,istrip)==0.) {
1371 else if (GetAngles(iplate,istrip) <0.) {
1374 angles[2] = 90.+GetAngles(iplate,istrip);
1376 angles[4] =-GetAngles(iplate,istrip);
1379 Rotation(posLocal,angles);
1381 step[0] =-0.5*kNpadX*fgkXPad;
1383 step[2] =-0.5*kNpadZ*fgkZPad;
1384 Translation(posLocal,step);
1386 step[0] = (ipadx+0.5)*fgkXPad;
1388 step[2] = (ipadz+0.5)*fgkZPad;
1389 Translation(posLocal,step);
1396 //_____________________________________________________________________________
1398 void AliTOFGeometryV5::Translation(Float_t *xyz, Float_t translationVector[3])
1403 for (ii=0; ii<3; ii++)
1404 xyz[ii] -= translationVector[ii];
1409 //_____________________________________________________________________________
1411 void AliTOFGeometryV5::Rotation(Float_t *xyz, Double_t rotationAngles[6])
1416 TRotMatrix *matrix = new TRotMatrix("matrix","matrix", angles[0], angles[1],
1417 angles[2], angles[3],
1418 angles[4], angles[5]);
1421 for (ii=0; ii<6; ii++) rotationAngles[ii]*=kDegrad;
1423 Float_t xyzDummy[3] = {0., 0., 0.};
1425 for (ii=0; ii<3; ii++) {
1427 xyz[0]*TMath::Sin(rotationAngles[2*ii])*TMath::Cos(rotationAngles[2*ii+1]) +
1428 xyz[1]*TMath::Sin(rotationAngles[2*ii])*TMath::Sin(rotationAngles[2*ii+1]) +
1429 xyz[2]*TMath::Cos(rotationAngles[2*ii]);
1432 for (ii=0; ii<3; ii++) xyz[ii]=xyzDummy[ii];
1437 //_____________________________________________________________________________
1438 void AliTOFGeometryV5::InverseRotation(Float_t *xyz, Double_t rotationAngles[6])
1443 for (ii=0; ii<6; ii++) rotationAngles[ii]*=kDegrad;
1445 Float_t xyzDummy[3] = {0., 0., 0.};
1448 xyz[0]*TMath::Sin(rotationAngles[0])*TMath::Cos(rotationAngles[1]) +
1449 xyz[1]*TMath::Sin(rotationAngles[2])*TMath::Cos(rotationAngles[3]) +
1450 xyz[2]*TMath::Sin(rotationAngles[4])*TMath::Cos(rotationAngles[5]);
1453 xyz[0]*TMath::Sin(rotationAngles[0])*TMath::Sin(rotationAngles[1]) +
1454 xyz[1]*TMath::Sin(rotationAngles[2])*TMath::Sin(rotationAngles[3]) +
1455 xyz[2]*TMath::Sin(rotationAngles[4])*TMath::Sin(rotationAngles[5]);
1458 xyz[0]*TMath::Cos(rotationAngles[0]) +
1459 xyz[1]*TMath::Cos(rotationAngles[2]) +
1460 xyz[2]*TMath::Cos(rotationAngles[4]);
1462 for (ii=0; ii<3; ii++) xyz[ii]=xyzDummy[ii];
1467 //_____________________________________________________________________________