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 1.1 2005/12/15 08:55:33 decaro
19 New TOF geometry description (V5) -G. Cara Romeo and A. De Caro
21 Revision 0.1 2005/07/19 G. Cara Romeo and A. De Caro
22 Modify Global methods IsInsideThePad & DistanceToPad
23 according to the new TOF geometry
24 Implement Global methods GetPadDx & GetPadDy & GetPadDz
25 Implement Private methods Translation & Rotation & InverseRotation
26 Modify Global methods GetDetID & GetPlate & GetSector &
27 GetStrip & GetPadX & GetPadZ
28 according to the new TOF geometry
29 Modify Global methods GetPos & GetX & GetY & GetZ
30 according to the new TOF geometry
34 #include <Riostream.h>
35 ///////////////////////////////////////////////////////////////////////////////
37 // TOF Geometry class (new version) //
39 ///////////////////////////////////////////////////////////////////////////////
43 #include "AliTOFGeometry.h"
44 #include "AliTOFGeometryV5.h"
46 ClassImp(AliTOFGeometryV5)
48 const Int_t AliTOFGeometryV5::kNStripC = 19; // number of strips in C type module
50 const Float_t AliTOFGeometryV5::fgkZlenA = 370.6*2.; // length (cm) of the A module
51 const Float_t AliTOFGeometryV5::fgkZlenB = 146.5; // length (cm) of the B module
52 const Float_t AliTOFGeometryV5::fgkZlenC = 170.45; // length (cm) of the C module
53 const Float_t AliTOFGeometryV5::fgkMaxhZtof = 370.6; // Max half z-size of TOF (cm)
55 const Float_t AliTOFGeometryV5::fgkxTOF = 371.-0.01;// Inner radius of the TOF for Reconstruction (cm)
56 const Float_t AliTOFGeometryV5::fgkRmin = 370.-0.01;// Inner radius of the TOF (cm)
57 const Float_t AliTOFGeometryV5::fgkRmax = 399.-0.01;// Outer radius of the TOF (cm)
59 //_____________________________________________________________________________
60 AliTOFGeometryV5::AliTOFGeometryV5()
64 // AliTOFGeometryV5 default constructor
67 AliTOFGeometry::kNStripC = kNStripC; // number of strips in C type module
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)
74 AliTOFGeometry::fgkxTOF = fgkxTOF; // Inner radius of the TOF for Reconstruction (cm)
75 AliTOFGeometry::fgkRmin = fgkRmin; // Inner radius of the TOF (cm)
76 AliTOFGeometry::fgkRmax = fgkRmax; // Outer radius of the TOF (cm)
82 //_____________________________________________________________________________
83 AliTOFGeometryV5::~AliTOFGeometryV5()
86 // AliTOFGeometryV5 destructor
90 //_____________________________________________________________________________
91 void AliTOFGeometryV5::Init()
94 // Initialize strip Tilt Angles, Heights and Distances
98 // For each strip to be positoned in FLTA/FLTB/FLTC,
99 // define 3 arrays containing:
100 // the angle of the normal with respect to the Y axis of FLTA/FLTB/FLTC
101 // the Y of the center with respect to the FLTA/FLTB/FLTC reference frame
102 // the Z of the center with respect to the BT01/BT02/BT03 reference frame
105 Float_t const kangles[kNPlates][kMaxNstrip] ={
106 { 43.99, 43.20, 42.40, 41.59, 40.77, 39.94, 39.11, 38.25, 37.40, 36.53,
107 35.65, 34.76, 33.87, 32.96, 32.05, 31.13, 30.19, 29.24, 12.33, 0.00},
109 { 27.26, 26.28, 25.30, 24.31, 23.31, 22.31, 21.30, 20.29, 19.26, 18.24,
110 17.20, 16.16, 15.11, 14.05, 13.00, 11.93, 10.87, 9.80, 8.74, 0.00},
112 { 0.00, 6.30, 5.31, 4.25, 3.19, 2.12, 1.06, 0.00, -1.06, -2.12,
113 -3.19, -4.25, -5.31, -6.30, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00},
115 { -8.74, -9.80, -10.87, -11.93, -13.00, -14.05, -15.11, -16.16, -17.20, -18.24,
116 -19.26, -20.29, -21.30, -22.31, -23.31, -24.31, -25.30, -26.28, -27.26, 0.00},
118 {-12.33, -29.24, -30.19, -31.13, -32.05, -32.96, -33.87, -34.76, -35.65, -36.53,
119 -37.40, -38.25, -39.11, -39.94, -40.77, -41.59, -42.40, -43.20, -43.99, 0.00}
122 Float_t const kheights[kNPlates][kMaxNstrip]= {
123 {-8.2, -7.5, -8.2, -7.7, -8.1, -7.6, -7.7, -7.7, -7.7, -7.7,
124 -7.5, -7.2, -7.3, -7.5, -7.6, -7.8, -8.3, -9.3, -3.1, 0.0},
126 {-7.9, -8.1, -8.5, -9.0, -10.1, -3.9, -5.9, -7.7, -10.1, -3.6,
127 -5.8, -8.0, -10.4, -4.4, -7.2, -10.2, -4.6, -7.4, -10.4, 0.0},
129 {-2.5, -10.4, -5.0, -9.9, -4.8, -9.9, -4.7, -10.2, -4.7, -9.9,
130 -4.8, -9.9, -5.0, -10.4, -2.5, 0.0, 0.0, 0.0, 0.0, 0.0},
132 {-10.4, -7.4, -4.6, -10.2, -7.2, -4.4, -10.4, -8.0, -5.8, -3.6,
133 -10.1, -7.7, -5.9, -3.9, -10.1, -9.0, -8.5, -8.1, -7.9, 0.0},
135 { -3.1, -9.3, -8.3, -7.8, -7.6, -7.5, -7.3, -7.2, -7.5, -7.7,
136 -7.7, -7.7, -7.7, -7.6, -8.1, -7.7, -8.2, -7.5, -8.2, 0.0}
140 Float_t const kdistances[kNPlates][kMaxNstrip]= {
141 { 364.1, 354.9, 344.5, 335.4, 325.5, 316.6, 307.2, 298.0, 288.9, 280.0,
142 271.3, 262.7, 254.0, 244.8, 236.1, 227.7, 219.1, 210.3, 205.7, 0.0},
144 { 194.2, 186.1, 177.9, 169.8, 161.5, 156.3, 147.8, 139.4, 130.9, 125.6,
145 117.3, 109.2, 101.1, 95.3, 87.1, 79.2, 73.0, 65.1, 57.6, 0.0},
147 { 49.5, 41.3, 35.3, 27.8, 21.2, 13.9, 7.0, 0.0, -7.0, -13.9,
148 -21.2, -27.8, -35.3, -41.3, -49.5, 0.0, 0.0, 0.0, 0.0, 0.0},
150 { -57.6, -65.1, -73.0, -79.2, -87.1, -95.3, -101.1, -109.2, -117.3, -125.6,
151 -130.9, -139.4, -147.8, -156.3, -161.5, -169.8, -177.9, -186.1, -194.2, 0.0},
153 {-205.7, -210.3, -219.1, -227.7, -236.1, -244.8, -254.0, -262.7, -271.3, -280.0,
154 -288.9, -298.0, -307.2, -316.6, -325.5, -335.4, -344.5, -354.9, -364.1, 0.0}
158 for (Int_t iplate = 0; iplate < kNPlates; iplate++) {
159 for (Int_t istrip = 0; istrip < kMaxNstrip; istrip++) {
160 AliTOFGeometry::fAngles[iplate][istrip] = kangles[iplate][istrip];
161 AliTOFGeometry::fHeights[iplate][istrip] = kheights[iplate][istrip];
162 AliTOFGeometry::fDistances[iplate][istrip]= kdistances[iplate][istrip];
168 //_____________________________________________________________________________
169 Float_t AliTOFGeometryV5::DistanceToPad(Int_t *det, Float_t *pos, Float_t *dist3d)
172 // Returns distance of space point with coor pos (x,y,z) (cm) wrt
173 // pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ)
176 //Transform pos into Sector Frame
182 Float_t radius = TMath::Sqrt(x*x+y*y);
183 //Float_t phi=TMath::ATan(y/x);
184 //if(phi<0) phi = k2PI+phi; //2.*TMath::Pi()+phi;
185 Float_t phi = TMath::Pi()+TMath::ATan2(-y,-x);
186 // Get the local angle in the sector philoc
187 Float_t angle = phi*kRaddeg-( Int_t (kRaddeg*phi/fPhiSec) + 0.5)*fPhiSec;
188 Float_t xs = radius*TMath::Cos(angle/kRaddeg);
189 Float_t ys = radius*TMath::Sin(angle/kRaddeg);
192 // Do the same for the selected pad
197 Float_t padRadius = TMath::Sqrt(g[0]*g[0]+g[1]*g[1]);
198 //Float_t padPhi = TMath::ATan(g[1]/g[0]);
199 //if(padPhi<0) padPhi = k2Pi + padPhi;
200 Float_t padPhi = TMath::Pi()+TMath::ATan2(-g[1],-g[0]);
202 // Get the local angle in the sector philoc
203 Float_t padAngle = padPhi*kRaddeg-( Int_t (padPhi*kRaddeg/fPhiSec)+ 0.5) * fPhiSec;
204 Float_t padxs = padRadius*TMath::Cos(padAngle/kRaddeg);
205 Float_t padys = padRadius*TMath::Sin(padAngle/kRaddeg);
206 Float_t padzs = g[2];
208 //Now move to local pad coordinate frame. Translate:
210 Float_t xt = xs-padxs;
211 Float_t yt = ys-padys;
212 Float_t zt = zs-padzs;
215 Float_t alpha = GetAngles(det[1],det[2]);
216 Float_t xr = xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg);
218 Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg);
220 Float_t dist = TMath::Sqrt(xr*xr+yr*yr+zr*zr);
232 //_____________________________________________________________________________
233 Bool_t AliTOFGeometryV5::IsInsideThePad(Int_t *det, Float_t *pos)
236 // Returns true if space point with coor pos (x,y,z) (cm) falls
237 // inside pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ)
240 Bool_t isInside=false;
243 const Float_t khhony = 1.0 ; // heigth of HONY Layer
244 const Float_t khpcby = 0.08 ; // heigth of PCB Layer
245 const Float_t khrgly = 0.055 ; // heigth of RED GLASS Layer
246 const Float_t khglfy = 0.285 ; // heigth of GLASS+FISHLINE Layer
247 const Float_t khcpcby = 0.16 ; // heigth of PCB Central Layer
248 //const Float_t kwcpcbz = 12.4 ; // z dimension of PCB Central Layer
249 const Float_t khstripy = 2.*khhony+2.*khpcby+4.*khrgly+2.*khglfy+khcpcby;//3.11
250 //const Float_t kwstripz = kwcpcbz;
251 //const Float_t klstripx = fgkStripLength;
254 const Float_t khsensmy = 0.05;//0.05;//0.11;//0.16;// // heigth of Sensitive Layer
256 //Transform pos into Sector Frame
262 Float_t radius = TMath::Sqrt(x*x+y*y);
263 Float_t phi = TMath::Pi()+TMath::ATan2(-y,-x);
265 // Get the local angle in the sector philoc
266 Float_t angle = phi*kRaddeg-( Int_t (kRaddeg*phi/fPhiSec) + 0.5) *fPhiSec;
267 Float_t xs = radius*TMath::Cos(angle/kRaddeg);
268 Float_t ys = radius*TMath::Sin(angle/kRaddeg);
271 // Do the same for the selected pad
276 Float_t padRadius = TMath::Sqrt(g[0]*g[0]+g[1]*g[1]);
277 Float_t padPhi = TMath::Pi()+TMath::ATan2(-g[1],-g[0]);
279 // Get the local angle in the sector philoc
280 Float_t padAngle = padPhi*kRaddeg-( Int_t (padPhi*kRaddeg/fPhiSec)+ 0.5) * fPhiSec;
281 Float_t padxs = padRadius*TMath::Cos(padAngle/kRaddeg);
282 Float_t padys = padRadius*TMath::Sin(padAngle/kRaddeg);
283 Float_t padzs = g[2];
285 //Now move to local pad coordinate frame. Translate:
287 Float_t xt = xs-padxs;
288 Float_t yt = ys-padys;
289 Float_t zt = zs-padzs;
293 Float_t alpha = GetAngles(det[1],det[2]);
294 Float_t xr = xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg);
296 Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg);
298 //if(TMath::Abs(xr)<=1.50*0.5 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5)) ???
299 if(TMath::Abs(xr)<=khsensmy*0.5 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5))
300 //if(TMath::Abs(xr)<=khstripy*0.5 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5))
306 //_____________________________________________________________________________
307 Float_t AliTOFGeometryV5::GetX(Int_t *det)
310 // Returns X coordinate (cm)
313 Int_t isector = det[0];
314 Int_t iplate = det[1];
315 Int_t istrip = det[2];
316 Int_t ipadz = det[3];
317 Int_t ipadx = det[4];
320 // Find out distance d on the plane wrt median phi:
321 Float_t d = (ipadx+0.5-kNpadX*0.5)*fgkXPad;
323 // The radius r in xy plane:
324 //Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
325 // (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg)-0.25; ???
326 Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
327 (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg);
329 // local azimuthal angle in the sector philoc
330 Float_t philoc = TMath::ATan(d/r);
331 //if(philoc<0.) philoc = k2PI + philoc;
333 // azimuthal angle in the global frame phi
334 Float_t phi = philoc*kRaddeg+(isector+0.5)*fPhiSec;
336 Float_t xCoor = r/TMath::Cos(philoc)*TMath::Cos(phi/kRaddeg);
339 // Pad reference frame -> FSTR reference frame
341 Float_t posLocal[3] = {0., 0., 0.};
342 Float_t step[3] = {-(ipadx+0.5)*fgkXPad, 0., -(ipadz+0.5)*fgkZPad};
343 Translation(posLocal,step);
345 step[0] = kNpadX*0.5*fgkXPad;
347 step[2] = kNpadZ*0.5*fgkZPad;
350 Float_t posLocal[3] = {(ipadx+0.5)*fgkXPad, 0., (ipadz+0.5)*fgkZPad};
351 Float_t step[3]= {kNpadX*0.5*fgkXPad, 0., kNpadZ*0.5*fgkZPad};
353 Translation(posLocal,step);
355 // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame
357 if (GetAngles(iplate,istrip) >0.) {
360 angles[2] = 90.+GetAngles(iplate,istrip);
362 angles[4] = GetAngles(iplate,istrip);
365 else if (GetAngles(iplate,istrip)==0.) {
373 else if (GetAngles(iplate,istrip) <0.) {
376 angles[2] = 90.+GetAngles(iplate,istrip);
378 angles[4] =-GetAngles(iplate,istrip);
382 InverseRotation(posLocal,angles);
385 step[1] = -GetHeights(iplate,istrip);
386 step[2] = GetDistances(iplate,istrip);
387 Translation(posLocal,step);
389 // FTOA = FLTA reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
397 InverseRotation(posLocal,angles);
399 // B071/B074/B075 = BTO1/2/3 reference frame -> ALICE reference frame
402 step[2] = -((fgkRmax+fgkRmin)*0.5);
403 Translation(posLocal,step);
406 angles[1] = 90.+(isector+0.5)*fPhiSec;
410 angles[5] = (isector+0.5)*fPhiSec;
412 InverseRotation(posLocal,angles);
414 Float_t xCoor = posLocal[0];
419 //_____________________________________________________________________________
420 Float_t AliTOFGeometryV5::GetY(Int_t *det)
423 // Returns Y coordinate (cm)
426 Int_t isector = det[0];
427 Int_t iplate = det[1];
428 Int_t istrip = det[2];
429 Int_t ipadz = det[3];
430 Int_t ipadx = det[4];
433 // Find out distance d on the plane wrt median phi:
434 Float_t d = (ipadx+0.5-kNpadX*0.5)*fgkXPad;
436 // The radius r in xy plane:
437 //Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
438 // (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg)-0.25; ???
439 Float_t r = (fgkRmin+fgkRmax)*0.5-0.01+GetHeights(iplate,istrip)+
440 (ipadz-0.5)*fgkZPad*TMath::Sin(GetAngles(iplate,istrip)/kRaddeg);
442 // local azimuthal angle in the sector philoc
443 Float_t philoc = TMath::ATan(d/r);
444 //if(philoc<0.) philoc = k2PI + philoc;
446 // azimuthal angle in the global frame phi
447 Float_t phi = philoc*kRaddeg+(isector+0.5)*fPhiSec;
449 Float_t yCoor = r/TMath::Cos(philoc)*TMath::Sin(phi/kRaddeg);
452 // Pad reference frame -> FSTR reference frame
454 Float_t posLocal[3] = {0., 0., 0.};
455 Float_t step[3] = {-(ipadx+0.5)*fgkXPad, 0., -(ipadz+0.5)*fgkZPad};
456 Translation(posLocal,step);
458 step[0] = kNpadX*0.5*fgkXPad;
460 step[2] = kNpadZ*0.5*fgkZPad;
463 Float_t posLocal[3] = {(ipadx+0.5)*fgkXPad, 0., (ipadz+0.5)*fgkZPad};
464 Float_t step[3]= {kNpadX*0.5*fgkXPad, 0., kNpadZ*0.5*fgkZPad};
466 Translation(posLocal,step);
468 // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame
471 if (GetAngles(iplate,istrip) >0.) {
474 angles[2] = 90.+GetAngles(iplate,istrip);
476 angles[4] = GetAngles(iplate,istrip);
479 else if (GetAngles(iplate,istrip)==0.) {
487 else if (GetAngles(iplate,istrip) <0.) {
490 angles[2] = 90.+GetAngles(iplate,istrip);
492 angles[4] =-GetAngles(iplate,istrip);
496 InverseRotation(posLocal,angles);
499 step[1] = -GetHeights(iplate,istrip);
500 step[2] = GetDistances(iplate,istrip);
501 Translation(posLocal,step);
503 // FTOA = FLTA reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
511 InverseRotation(posLocal,angles);
513 // B071/B074/B075 = BTO1/2/3 reference frame -> ALICE reference frame
516 step[2] = -((fgkRmax+fgkRmin)*0.5);
517 Translation(posLocal,step);
520 angles[1] = 90.+(isector+0.5)*fPhiSec;
524 angles[5] = (isector+0.5)*fPhiSec;
526 InverseRotation(posLocal,angles);
528 Float_t yCoor = posLocal[1];
534 //_____________________________________________________________________________
535 Float_t AliTOFGeometryV5::GetZ(Int_t *det)
538 // Returns Z coordinate (cm)
541 Int_t isector = det[0];
542 Int_t iplate = det[1];
543 Int_t istrip = det[2];
544 Int_t ipadz = det[3];
545 Int_t ipadx = det[4];
548 Float_t zCoor = GetDistances(iplate,istrip) +
549 (0.5-ipadz) * fgkZPad * TMath::Cos(GetAngles(iplate,istrip)*kDegrad);
552 // Pad reference frame -> FSTR reference frame
554 Float_t posLocal[3] = {0., 0., 0.};
555 Float_t step[3] = {-(ipadx+0.5)*fgkXPad, 0., -(ipadz+0.5)*fgkZPad};
556 Translation(posLocal,step);
558 step[0] = kNpadX*0.5*fgkXPad;
560 step[2] = kNpadZ*0.5*fgkZPad;
563 Float_t posLocal[3] = {(ipadx+0.5)*fgkXPad, 0., (ipadz+0.5)*fgkZPad};
564 Float_t step[3]= {kNpadX*0.5*fgkXPad, 0., kNpadZ*0.5*fgkZPad};
566 Translation(posLocal,step);
568 // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame
570 if (GetAngles(iplate,istrip) >0.) {
573 angles[2] = 90.+GetAngles(iplate,istrip);
575 angles[4] = GetAngles(iplate,istrip);
578 else if (GetAngles(iplate,istrip)==0.) {
586 else if (GetAngles(iplate,istrip) <0.) {
589 angles[2] = 90.+GetAngles(iplate,istrip);
591 angles[4] =-GetAngles(iplate,istrip);
595 InverseRotation(posLocal,angles);
598 step[1] = -GetHeights(iplate,istrip);
599 step[2] = GetDistances(iplate,istrip);
600 Translation(posLocal,step);
602 // FTOA = FLTA reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
610 InverseRotation(posLocal,angles);
612 // B071/B074/B075 = BTO1/2/3 reference frame -> ALICE reference frame
615 step[2] = -((fgkRmax+fgkRmin)*0.5);
616 Translation(posLocal,step);
619 angles[1] = 90.+(isector+0.5)*fPhiSec;
623 angles[5] = (isector+0.5)*fPhiSec;
625 InverseRotation(posLocal,angles);
627 Float_t zCoor = posLocal[2];
633 //_____________________________________________________________________________
634 Int_t AliTOFGeometryV5::GetSector(Float_t *pos)
637 // Returns the Sector index
640 //const Float_t khAlWall = 0.1;
641 //const Float_t kModuleWallThickness = 0.3;
649 Float_t rho = TMath::Sqrt(x*x + y*y);
651 //if (!((z>=-fgkMaxhZtof && z<=fgkMaxhZtof) &&
652 if (!((z>=-fgkZlenA*0.5 && z<=fgkZlenA*0.5) &&
653 (rho>=(fgkRmin) && rho<=(fgkRmax)))) {
654 //(rho>=(fgkRmin-0.05)+kModuleWallThickness && rho<=(fgkRmax-0.05)-kModuleWallThickness-khAlWall-kModuleWallThickness))) {
655 //AliError("Detector Index could not be determined");
659 Float_t phi = TMath::Pi() + TMath::ATan2(-y,-x);
661 iSect = (Int_t) (phi*kRaddeg/fPhiSec);
666 //_____________________________________________________________________________
668 Int_t AliTOFGeometryV5::GetPlate(Float_t *pos)
671 // Returns the Plate index
673 const Float_t kInterCentrModBorder1 = 49.5;
674 const Float_t kInterCentrModBorder2 = 57.5;
675 const Float_t kExterInterModBorder1 = 196.0;
676 const Float_t kExterInterModBorder2 = 203.5;
678 const Float_t kLengthExInModBorder = 4.7;
679 const Float_t kLengthInCeModBorder = 7.0;
681 //const Float_t khAlWall = 0.1;
682 const Float_t kModuleWallThickness = 0.3;
683 //const Float_t kHoneycombLayerThickness = 1.5;
688 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
690 Int_t isector = GetSector(posLocal);
692 //AliError("Detector Index could not be determined");
696 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
698 {90., 90.+(isector+0.5)*fPhiSec,
700 90., (isector+0.5)*fPhiSec
702 Rotation(posLocal,angles);
704 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
705 Translation(posLocal,step);
707 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame
715 Rotation(posLocal,angles);
717 Float_t yLocal = posLocal[1];
718 Float_t zLocal = posLocal[2];
720 Float_t deltaRhoLoc = (fgkRmax-fgkRmin)*0.5 - kModuleWallThickness + yLocal;
721 Float_t deltaZetaLoc = TMath::Abs(zLocal);
723 Float_t deltaRHOmax = 0.;
725 if (TMath::Abs(zLocal)>=kExterInterModBorder1 && TMath::Abs(zLocal)<=kExterInterModBorder2)
727 deltaRhoLoc -= kLengthExInModBorder;
728 deltaZetaLoc = kExterInterModBorder2-deltaZetaLoc;
729 deltaRHOmax = (fgkRmax - fgkRmin)*0.5 - kModuleWallThickness - 2.*kLengthExInModBorder; // old 5.35, new 4.8
731 if (deltaRhoLoc > deltaZetaLoc*deltaRHOmax/(kInterCentrModBorder2-kInterCentrModBorder1)) {
732 if (zLocal<0) iPlate = 0;
736 if (zLocal<0) iPlate = 1;
740 else if (TMath::Abs(zLocal)>=kInterCentrModBorder1 && TMath::Abs(zLocal)<=kInterCentrModBorder2)
742 deltaRhoLoc -= kLengthInCeModBorder;
743 deltaZetaLoc = deltaZetaLoc-kInterCentrModBorder1;
744 deltaRHOmax = (fgkRmax - fgkRmin)*0.5 - kModuleWallThickness - 2.*kLengthInCeModBorder; // old 0.39, new 0.2
746 if (deltaRhoLoc>deltaZetaLoc*deltaRHOmax/(kInterCentrModBorder2-kInterCentrModBorder1)) iPlate = 2;
748 if (zLocal<0) iPlate = 1;
753 if (zLocal>-fgkZlenA*0.5/*fgkMaxhZtof*/ && zLocal<-kExterInterModBorder2) iPlate = 0;
754 else if (zLocal>-kExterInterModBorder1 && zLocal<-kInterCentrModBorder2) iPlate = 1;
755 else if (zLocal>-kInterCentrModBorder1 && zLocal< kInterCentrModBorder1) iPlate = 2;
756 else if (zLocal> kInterCentrModBorder2 && zLocal< kExterInterModBorder1) iPlate = 3;
757 else if (zLocal> kExterInterModBorder2 && zLocal< fgkZlenA*0.5/*fgkMaxhZtof*/) iPlate = 4;
763 //_____________________________________________________________________________
764 Int_t AliTOFGeometryV5::GetStrip(Float_t *pos)
767 // Returns the Strip index
769 const Float_t khhony = 1.0 ; // heigth of HONY Layer
770 const Float_t khpcby = 0.08 ; // heigth of PCB Layer
771 const Float_t khrgly = 0.055 ; // heigth of RED GLASS Layer
772 const Float_t khglfy = 0.285 ; // heigth of GLASS+FISHLINE Layer
773 const Float_t khcpcby = 0.16 ; // heigth of PCB Central Layer
774 const Float_t kwcpcbz = 12.4 ; // z dimension of PCB Central Layer
775 const Float_t khstripy = 2.*khhony+2.*khpcby+4.*khrgly+2.*khglfy+khcpcby;//3.11
776 const Float_t kwstripz = kwcpcbz;
777 const Float_t klstripx = fgkStripLength;
782 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
784 Int_t isector = GetSector(posLocal);
786 //AliError("Detector Index could not be determined");
788 Int_t iplate = GetPlate(posLocal);
790 //AliError("Detector Index could not be determined");
812 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
814 {90., 90.+(isector+0.5)*fPhiSec,
816 90., (isector+0.5)*fPhiSec
818 Rotation(posLocal,angles);
820 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
821 Translation(posLocal,step);
823 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame
831 Rotation(posLocal,angles);
833 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
835 for (Int_t istrip=0; istrip<nstrips; istrip++){
837 Float_t posLoc2[3]={posLocal[0],posLocal[1],posLocal[2]};
840 step[1] = GetHeights(iplate,istrip);
841 step[2] = -GetDistances(iplate,istrip);
842 Translation(posLoc2,step);
844 if (GetAngles(iplate,istrip) >0.) {
847 angles[2] = 90.+GetAngles(iplate,istrip);
849 angles[4] = GetAngles(iplate,istrip);
852 else if (GetAngles(iplate,istrip)==0.) {
860 else if (GetAngles(iplate,istrip) <0.) {
863 angles[2] = 90.+GetAngles(iplate,istrip);
865 angles[4] =-GetAngles(iplate,istrip);
868 Rotation(posLoc2,angles);
870 if ((TMath::Abs(posLoc2[0])<=klstripx*0.5) &&
871 (TMath::Abs(posLoc2[1])<=khstripy*0.5) &&
872 (TMath::Abs(posLoc2[2])<=kwstripz*0.5)) {
875 for (Int_t jj=0; jj<3; jj++) posLocal[jj]=posLoc2[jj];
876 //AliInfo(Form(" posLocal[0] = %f, posLocal[1] = %f, posLocal[2] = %f ", posLocal[0],posLocal[1],posLocal[2]));
878 //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]));
882 if (totStrip>1) AliInfo(Form("total strip number found %2i",totStrip));
889 //_____________________________________________________________________________
890 Int_t AliTOFGeometryV5::GetPadZ(Float_t *pos)
893 // Returns the Pad index along Z
895 //const Float_t klsensmx = kNpadX*fgkXPad; // length of Sensitive Layer
896 //const Float_t khsensmy = 0.05;//0.11;//0.16;// heigth of Sensitive Layer
897 //const Float_t kwsensmz = kNpadZ*fgkZPad; // width of Sensitive Layer
902 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
904 Int_t isector = GetSector(posLocal);
906 //AliError("Detector Index could not be determined");
908 Int_t iplate = GetPlate(posLocal);
910 //AliError("Detector Index could not be determined");
912 Int_t istrip = GetStrip(posLocal);
914 //AliError("Detector Index could not be determined");
917 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
919 {90., 90.+(isector+0.5)*fPhiSec,
921 90., (isector+0.5)*fPhiSec
923 Rotation(posLocal,angles);
925 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
926 Translation(posLocal,step);
928 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame
936 Rotation(posLocal,angles);
938 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
940 step[1] = GetHeights(iplate,istrip);
941 step[2] = -GetDistances(iplate,istrip);
942 Translation(posLocal,step);
944 if (GetAngles(iplate,istrip) >0.) {
947 angles[2] = 90.+GetAngles(iplate,istrip);
949 angles[4] = GetAngles(iplate,istrip);
952 else if (GetAngles(iplate,istrip)==0.) {
960 else if (GetAngles(iplate,istrip) <0.) {
963 angles[2] = 90.+GetAngles(iplate,istrip);
965 angles[4] =-GetAngles(iplate,istrip);
968 Rotation(posLocal,angles);
970 //if (TMath::Abs(posLocal[0])<=klsensmx*0.5 && /*TMath::Abs(posLocal[1])<=khsensmy*0.5+0.005 &&*/ TMath::Abs(posLocal[2])<=kwsensmz*0.5) {
971 //if (TMath::Abs(posLocal[1])<=khsensmy*0.5) {
973 step[0] =-0.5*kNpadX*fgkXPad;
975 step[2] =-0.5*kNpadZ*fgkZPad;
976 Translation(posLocal,step);
978 iPadZ = (Int_t)(posLocal[2]/fgkZPad);
979 if (iPadZ==kNpadZ) iPadZ--;
980 else if (iPadZ>kNpadZ) iPadZ=-1;
983 // else AliError("Detector Index could not be determined");
988 //_____________________________________________________________________________
989 Int_t AliTOFGeometryV5::GetPadX(Float_t *pos)
992 // Returns the Pad index along X
994 //const Float_t klsensmx = kNpadX*fgkXPad; // length of Sensitive Layer
995 //const Float_t khsensmy = 0.05;//0.11;//0.16;// heigth of Sensitive Layer
996 //const Float_t kwsensmz = kNpadZ*fgkZPad; // width of Sensitive Layer
1000 Float_t posLocal[3];
1001 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
1003 Int_t isector = GetSector(posLocal);
1005 //AliError("Detector Index could not be determined");
1007 Int_t iplate = GetPlate(posLocal);
1009 //AliError("Detector Index could not be determined");
1011 Int_t istrip = GetStrip(posLocal);
1013 //AliError("Detector Index could not be determined");
1016 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1017 Double_t angles[6] =
1018 {90., 90.+(isector+0.5)*fPhiSec,
1020 90., (isector+0.5)*fPhiSec
1022 Rotation(posLocal,angles);
1024 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1025 Translation(posLocal,step);
1027 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
1035 Rotation(posLocal,angles);
1037 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1039 step[1] = GetHeights(iplate,istrip);
1040 step[2] = -GetDistances(iplate,istrip);
1041 Translation(posLocal,step);
1043 if (GetAngles(iplate,istrip) >0.) {
1046 angles[2] = 90.+GetAngles(iplate,istrip);
1048 angles[4] = GetAngles(iplate,istrip);
1051 else if (GetAngles(iplate,istrip)==0.) {
1059 else if (GetAngles(iplate,istrip) <0.) {
1062 angles[2] = 90.+GetAngles(iplate,istrip);
1064 angles[4] =-GetAngles(iplate,istrip);
1067 Rotation(posLocal,angles);
1069 //if (TMath::Abs(posLocal[0])<=klsensmx*0.5 && /*TMath::Abs(posLocal[1])<=khsensmy*0.5+0.005 &&*/ TMath::Abs(posLocal[2])<=kwsensmz*0.5) {
1070 //if (TMath::Abs(posLocal[1])<=khsensmy*0.5) {
1072 step[0] =-0.5*kNpadX*fgkXPad;
1074 step[2] =-0.5*kNpadZ*fgkZPad;
1075 Translation(posLocal,step);
1077 iPadX = (Int_t)(posLocal[0]/fgkXPad);
1078 if (iPadX==kNpadX) iPadX--;
1079 else if (iPadX>kNpadX) iPadX=-1;
1082 //else AliError("Detector Index could not be determined");
1087 //_____________________________________________________________________________
1089 Float_t AliTOFGeometryV5::GetPadDx(Float_t *pos)
1092 // Returns the x coordinate in the Pad reference frame
1097 Float_t posLocal[3];
1098 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
1100 Int_t isector = GetSector(posLocal);
1102 //AliError("Detector Index could not be determined");
1104 Int_t iplate = GetPlate(posLocal);
1106 //AliError("Detector Index could not be determined");
1108 Int_t istrip = GetStrip(posLocal);
1110 //AliError("Detector Index could not be determined");
1112 Int_t ipadz = GetPadZ(posLocal);
1114 //AliError("Detector Index could not be determined");
1116 Int_t ipadx = GetPadX(posLocal);
1118 //AliError("Detector Index could not be determined");
1121 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1122 Double_t angles[6] =
1123 {90., 90.+(isector+0.5)*fPhiSec,
1125 90., (isector+0.5)*fPhiSec
1127 Rotation(posLocal,angles);
1129 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1130 Translation(posLocal,step);
1132 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
1140 Rotation(posLocal,angles);
1142 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1144 step[1] = GetHeights(iplate,istrip);
1145 step[2] = -GetDistances(iplate,istrip);
1146 Translation(posLocal,step);
1148 if (GetAngles(iplate,istrip) >0.) {
1151 angles[2] = 90.+GetAngles(iplate,istrip);
1153 angles[4] = GetAngles(iplate,istrip);
1156 else if (GetAngles(iplate,istrip)==0.) {
1164 else if (GetAngles(iplate,istrip) <0.) {
1167 angles[2] = 90.+GetAngles(iplate,istrip);
1169 angles[4] =-GetAngles(iplate,istrip);
1172 Rotation(posLocal,angles);
1174 step[0] =-0.5*kNpadX*fgkXPad;
1176 step[2] =-0.5*kNpadZ*fgkZPad;
1177 Translation(posLocal,step);
1179 step[0] = (ipadx+0.5)*fgkXPad;
1181 step[2] = (ipadz+0.5)*fgkZPad;
1182 Translation(posLocal,step);
1189 //_____________________________________________________________________________
1190 Float_t AliTOFGeometryV5::GetPadDy(Float_t *pos)
1193 // Returns the x coordinate in the Pad reference frame
1198 Float_t posLocal[3];
1199 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
1201 Int_t isector = GetSector(posLocal);
1203 //AliError("Detector Index could not be determined");
1205 Int_t iplate = GetPlate(posLocal);
1207 //AliError("Detector Index could not be determined");
1209 Int_t istrip = GetStrip(posLocal);
1211 //AliError("Detector Index could not be determined");
1213 Int_t ipadz = GetPadZ(posLocal);
1215 //AliError("Detector Index could not be determined");
1217 Int_t ipadx = GetPadX(posLocal);
1219 //AliError("Detector Index could not be determined");
1222 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1223 Double_t angles[6] =
1224 {90., 90.+(isector+0.5)*fPhiSec,
1226 90., (isector+0.5)*fPhiSec
1228 Rotation(posLocal,angles);
1230 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1231 Translation(posLocal,step);
1233 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
1241 Rotation(posLocal,angles);
1243 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1245 step[1] = GetHeights(iplate,istrip);
1246 step[2] = -GetDistances(iplate,istrip);
1247 Translation(posLocal,step);
1249 if (GetAngles(iplate,istrip) >0.) {
1252 angles[2] = 90.+GetAngles(iplate,istrip);
1254 angles[4] = GetAngles(iplate,istrip);
1257 else if (GetAngles(iplate,istrip)==0.) {
1265 else if (GetAngles(iplate,istrip) <0.) {
1268 angles[2] = 90.+GetAngles(iplate,istrip);
1270 angles[4] =-GetAngles(iplate,istrip);
1273 Rotation(posLocal,angles);
1275 step[0] =-0.5*kNpadX*fgkXPad;
1277 step[2] =-0.5*kNpadZ*fgkZPad;
1278 Translation(posLocal,step);
1280 step[0] = (ipadx+0.5)*fgkXPad;
1282 step[2] = (ipadz+0.5)*fgkZPad;
1283 Translation(posLocal,step);
1290 //_____________________________________________________________________________
1291 Float_t AliTOFGeometryV5::GetPadDz(Float_t *pos)
1294 // Returns the x coordinate in the Pad reference frame
1299 Float_t posLocal[3];
1300 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
1302 Int_t isector = GetSector(posLocal);
1304 //AliError("Detector Index could not be determined");
1306 Int_t iplate = GetPlate(posLocal);
1308 //AliError("Detector Index could not be determined");
1310 Int_t istrip = GetStrip(posLocal);
1312 //AliError("Detector Index could not be determined");
1314 Int_t ipadz = GetPadZ(posLocal);
1316 //AliError("Detector Index could not be determined");
1318 Int_t ipadx = GetPadX(posLocal);
1320 //AliError("Detector Index could not be determined");
1323 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1324 Double_t angles[6] =
1325 {90., 90.+(isector+0.5)*fPhiSec,
1327 90., (isector+0.5)*fPhiSec
1329 Rotation(posLocal,angles);
1331 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1332 Translation(posLocal,step);
1334 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
1342 Rotation(posLocal,angles);
1344 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1346 step[1] = GetHeights(iplate,istrip);
1347 step[2] = -GetDistances(iplate,istrip);
1348 Translation(posLocal,step);
1350 if (GetAngles(iplate,istrip) >0.) {
1353 angles[2] = 90.+GetAngles(iplate,istrip);
1355 angles[4] = GetAngles(iplate,istrip);
1358 else if (GetAngles(iplate,istrip)==0.) {
1366 else if (GetAngles(iplate,istrip) <0.) {
1369 angles[2] = 90.+GetAngles(iplate,istrip);
1371 angles[4] =-GetAngles(iplate,istrip);
1374 Rotation(posLocal,angles);
1376 step[0] =-0.5*kNpadX*fgkXPad;
1378 step[2] =-0.5*kNpadZ*fgkZPad;
1379 Translation(posLocal,step);
1381 step[0] = (ipadx+0.5)*fgkXPad;
1383 step[2] = (ipadz+0.5)*fgkZPad;
1384 Translation(posLocal,step);
1391 //_____________________________________________________________________________
1393 void AliTOFGeometryV5::Translation(Float_t *xyz, Float_t translationVector[3])
1398 for (ii=0; ii<3; ii++)
1399 xyz[ii] -= translationVector[ii];
1404 //_____________________________________________________________________________
1406 void AliTOFGeometryV5::Rotation(Float_t *xyz, Double_t rotationAngles[6])
1411 TRotMatrix *matrix = new TRotMatrix("matrix","matrix", angles[0], angles[1],
1412 angles[2], angles[3],
1413 angles[4], angles[5]);
1416 for (ii=0; ii<6; ii++) rotationAngles[ii]*=kDegrad;
1418 Float_t xyzDummy[3] = {0., 0., 0.};
1420 for (ii=0; ii<3; ii++) {
1422 xyz[0]*TMath::Sin(rotationAngles[2*ii])*TMath::Cos(rotationAngles[2*ii+1]) +
1423 xyz[1]*TMath::Sin(rotationAngles[2*ii])*TMath::Sin(rotationAngles[2*ii+1]) +
1424 xyz[2]*TMath::Cos(rotationAngles[2*ii]);
1427 for (ii=0; ii<3; ii++) xyz[ii]=xyzDummy[ii];
1432 //_____________________________________________________________________________
1433 void AliTOFGeometryV5::InverseRotation(Float_t *xyz, Double_t rotationAngles[6])
1438 for (ii=0; ii<6; ii++) rotationAngles[ii]*=kDegrad;
1440 Float_t xyzDummy[3] = {0., 0., 0.};
1443 xyz[0]*TMath::Sin(rotationAngles[0])*TMath::Cos(rotationAngles[1]) +
1444 xyz[1]*TMath::Sin(rotationAngles[2])*TMath::Cos(rotationAngles[3]) +
1445 xyz[2]*TMath::Sin(rotationAngles[4])*TMath::Cos(rotationAngles[5]);
1448 xyz[0]*TMath::Sin(rotationAngles[0])*TMath::Sin(rotationAngles[1]) +
1449 xyz[1]*TMath::Sin(rotationAngles[2])*TMath::Sin(rotationAngles[3]) +
1450 xyz[2]*TMath::Sin(rotationAngles[4])*TMath::Sin(rotationAngles[5]);
1453 xyz[0]*TMath::Cos(rotationAngles[0]) +
1454 xyz[1]*TMath::Cos(rotationAngles[2]) +
1455 xyz[2]*TMath::Cos(rotationAngles[4]);
1457 for (ii=0; ii<3; ii++) xyz[ii]=xyzDummy[ii];
1462 //_____________________________________________________________________________