]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TOF/AliTOFGeometryV5.cxx
Changes for TOF Reconstruction using TGeo
[u/mrichter/AliRoot.git] / TOF / AliTOFGeometryV5.cxx
CommitLineData
d3c7bfac 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/*
17$Log$
4402e7cb 18Revision 1.1 2005/12/15 08:55:33 decaro
19New TOF geometry description (V5) -G. Cara Romeo and A. De Caro
20
d3c7bfac 21Revision 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
31*/
32
33#include <stdlib.h>
34#include <Riostream.h>
35///////////////////////////////////////////////////////////////////////////////
36// //
37// TOF Geometry class (new version) //
38// //
39///////////////////////////////////////////////////////////////////////////////
40
41#include "AliLog.h"
42#include "AliConst.h"
43#include "AliTOFGeometry.h"
44#include "AliTOFGeometryV5.h"
45
46ClassImp(AliTOFGeometryV5)
47
48const Int_t AliTOFGeometryV5::kNStripC = 19; // number of strips in C type module
d3c7bfac 49
50const Float_t AliTOFGeometryV5::fgkZlenA = 370.6*2.; // length (cm) of the A module
51const Float_t AliTOFGeometryV5::fgkZlenB = 146.5; // length (cm) of the B module
52const Float_t AliTOFGeometryV5::fgkZlenC = 170.45; // length (cm) of the C module
53const Float_t AliTOFGeometryV5::fgkMaxhZtof = 370.6; // Max half z-size of TOF (cm)
d3c7bfac 54
55const Float_t AliTOFGeometryV5::fgkxTOF = 371.-0.01;// Inner radius of the TOF for Reconstruction (cm)
56const Float_t AliTOFGeometryV5::fgkRmin = 370.-0.01;// Inner radius of the TOF (cm)
57const Float_t AliTOFGeometryV5::fgkRmax = 399.-0.01;// Outer radius of the TOF (cm)
58
59//_____________________________________________________________________________
60AliTOFGeometryV5::AliTOFGeometryV5()
61 :AliTOFGeometry()
62{
63 //
64 // AliTOFGeometryV5 default constructor
65 //
66
67 AliTOFGeometry::kNStripC = kNStripC; // number of strips in C type module
d3c7bfac 68
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)
d3c7bfac 73
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)
77
78 Init();
79
80}
81
82//_____________________________________________________________________________
83AliTOFGeometryV5::~AliTOFGeometryV5()
84{
85 //
86 // AliTOFGeometryV5 destructor
87 //
88
89}
90//_____________________________________________________________________________
91void AliTOFGeometryV5::Init()
92{
93 //
94 // Initialize strip Tilt Angles, Heights and Distances
95 //
96 // Strips Tilt Angles
97
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
103
104
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,
4402e7cb 107 35.65, 34.76, 33.87, 32.96, 32.05, 31.13, 30.19, 29.24, 12.33, 0.00},
d3c7bfac 108
109 { 27.26, 26.28, 25.30, 24.31, 23.31, 22.31, 21.30, 20.29, 19.26, 18.24,
4402e7cb 110 17.20, 16.16, 15.11, 14.05, 13.00, 11.93, 10.87, 9.80, 8.74, 0.00},
d3c7bfac 111
112 { 0.00, 6.30, 5.31, 4.25, 3.19, 2.12, 1.06, 0.00, -1.06, -2.12,
4402e7cb 113 -3.19, -4.25, -5.31, -6.30, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00},
d3c7bfac 114
115 { -8.74, -9.80, -10.87, -11.93, -13.00, -14.05, -15.11, -16.16, -17.20, -18.24,
4402e7cb 116 -19.26, -20.29, -21.30, -22.31, -23.31, -24.31, -25.30, -26.28, -27.26, 0.00},
d3c7bfac 117
118 {-12.33, -29.24, -30.19, -31.13, -32.05, -32.96, -33.87, -34.76, -35.65, -36.53,
4402e7cb 119 -37.40, -38.25, -39.11, -39.94, -40.77, -41.59, -42.40, -43.20, -43.99, 0.00}
d3c7bfac 120 };
121
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,
4402e7cb 124 -7.5, -7.2, -7.3, -7.5, -7.6, -7.8, -8.3, -9.3, -3.1, 0.0},
d3c7bfac 125
126 {-7.9, -8.1, -8.5, -9.0, -10.1, -3.9, -5.9, -7.7, -10.1, -3.6,
4402e7cb 127 -5.8, -8.0, -10.4, -4.4, -7.2, -10.2, -4.6, -7.4, -10.4, 0.0},
d3c7bfac 128
129 {-2.5, -10.4, -5.0, -9.9, -4.8, -9.9, -4.7, -10.2, -4.7, -9.9,
4402e7cb 130 -4.8, -9.9, -5.0, -10.4, -2.5, 0.0, 0.0, 0.0, 0.0, 0.0},
d3c7bfac 131
132 {-10.4, -7.4, -4.6, -10.2, -7.2, -4.4, -10.4, -8.0, -5.8, -3.6,
4402e7cb 133 -10.1, -7.7, -5.9, -3.9, -10.1, -9.0, -8.5, -8.1, -7.9, 0.0},
d3c7bfac 134
135 { -3.1, -9.3, -8.3, -7.8, -7.6, -7.5, -7.3, -7.2, -7.5, -7.7,
4402e7cb 136 -7.7, -7.7, -7.7, -7.6, -8.1, -7.7, -8.2, -7.5, -8.2, 0.0}
d3c7bfac 137 };
138
139
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,
4402e7cb 142 271.3, 262.7, 254.0, 244.8, 236.1, 227.7, 219.1, 210.3, 205.7, 0.0},
d3c7bfac 143
144 { 194.2, 186.1, 177.9, 169.8, 161.5, 156.3, 147.8, 139.4, 130.9, 125.6,
4402e7cb 145 117.3, 109.2, 101.1, 95.3, 87.1, 79.2, 73.0, 65.1, 57.6, 0.0},
d3c7bfac 146
147 { 49.5, 41.3, 35.3, 27.8, 21.2, 13.9, 7.0, 0.0, -7.0, -13.9,
4402e7cb 148 -21.2, -27.8, -35.3, -41.3, -49.5, 0.0, 0.0, 0.0, 0.0, 0.0},
d3c7bfac 149
150 { -57.6, -65.1, -73.0, -79.2, -87.1, -95.3, -101.1, -109.2, -117.3, -125.6,
4402e7cb 151 -130.9, -139.4, -147.8, -156.3, -161.5, -169.8, -177.9, -186.1, -194.2, 0.0},
d3c7bfac 152
153 {-205.7, -210.3, -219.1, -227.7, -236.1, -244.8, -254.0, -262.7, -271.3, -280.0,
4402e7cb 154 -288.9, -298.0, -307.2, -316.6, -325.5, -335.4, -344.5, -354.9, -364.1, 0.0}
d3c7bfac 155 };
156
157
d3c7bfac 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];
163 }
164 }
165
166}
167
168//_____________________________________________________________________________
169Float_t AliTOFGeometryV5::DistanceToPad(Int_t *det, Float_t *pos, Float_t *dist3d)
170{
171//
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)
174//
175
176 //Transform pos into Sector Frame
177
178 Float_t x = pos[0];
179 Float_t y = pos[1];
180 Float_t z = pos[2];
181
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);
190 Float_t zs = z;
191
192 // Do the same for the selected pad
193
194 Float_t g[3];
195 GetPos(det,g);
196
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]);
201
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];
207
208 //Now move to local pad coordinate frame. Translate:
209
210 Float_t xt = xs-padxs;
211 Float_t yt = ys-padys;
212 Float_t zt = zs-padzs;
213 //Now Rotate:
214
215 Float_t alpha = GetAngles(det[1],det[2]);
216 Float_t xr = xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg);
217 Float_t yr = yt;
218 Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg);
219
220 Float_t dist = TMath::Sqrt(xr*xr+yr*yr+zr*zr);
221
222 if (dist3d){
223 dist3d[0] = xr;
224 dist3d[1] = yr;
225 dist3d[2] = zr;
226 }
227
228 return dist;
229
230}
231
232//_____________________________________________________________________________
233Bool_t AliTOFGeometryV5::IsInsideThePad(Int_t *det, Float_t *pos)
234{
235//
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)
238//
239
240 Bool_t isInside=false;
241
242 /*
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;
252 */
253
254 const Float_t khsensmy = 0.05;//0.05;//0.11;//0.16;// // heigth of Sensitive Layer
255
256 //Transform pos into Sector Frame
257
258 Float_t x = pos[0];
259 Float_t y = pos[1];
260 Float_t z = pos[2];
261
262 Float_t radius = TMath::Sqrt(x*x+y*y);
263 Float_t phi = TMath::Pi()+TMath::ATan2(-y,-x);
264
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);
269 Float_t zs = z;
270
271 // Do the same for the selected pad
272
273 Float_t g[3];
274 GetPos(det,g);
275
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]);
278
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];
284
285 //Now move to local pad coordinate frame. Translate:
286
287 Float_t xt = xs-padxs;
288 Float_t yt = ys-padys;
289 Float_t zt = zs-padzs;
290
291 //Now Rotate:
292
293 Float_t alpha = GetAngles(det[1],det[2]);
294 Float_t xr = xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg);
295 Float_t yr = yt;
296 Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg);
297
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))
301 isInside=true;
302 return isInside;
303
304}
305
306//_____________________________________________________________________________
307Float_t AliTOFGeometryV5::GetX(Int_t *det)
308{
309 //
310 // Returns X coordinate (cm)
311 //
312
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];
318
319 /*
320 // Find out distance d on the plane wrt median phi:
321 Float_t d = (ipadx+0.5-kNpadX*0.5)*fgkXPad;
322
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);
328
329 // local azimuthal angle in the sector philoc
330 Float_t philoc = TMath::ATan(d/r);
331 //if(philoc<0.) philoc = k2PI + philoc;
332
333 // azimuthal angle in the global frame phi
334 Float_t phi = philoc*kRaddeg+(isector+0.5)*fPhiSec;
335
336 Float_t xCoor = r/TMath::Cos(philoc)*TMath::Cos(phi/kRaddeg);
337 */
338
339 // Pad reference frame -> FSTR reference frame
340 // /*
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);
344
345 step[0] = kNpadX*0.5*fgkXPad;
346 step[1] = 0.;
347 step[2] = kNpadZ*0.5*fgkZPad;
348 // */
349 /*
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};
352 */
353 Translation(posLocal,step);
354
355 // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame
356 Double_t angles[6];
357 if (GetAngles(iplate,istrip) >0.) {
358 angles[0] = 90.;
359 angles[1] = 0.;
360 angles[2] = 90.+GetAngles(iplate,istrip);
361 angles[3] = 90.;
362 angles[4] = GetAngles(iplate,istrip);
363 angles[5] = 90.;
364 }
365 else if (GetAngles(iplate,istrip)==0.) {
366 angles[0] = 90.;
367 angles[1] = 0.;
368 angles[2] = 90.;
369 angles[3] = 90.;
370 angles[4] = 0;
371 angles[5] = 0.;
372 }
373 else if (GetAngles(iplate,istrip) <0.) {
374 angles[0] = 90.;
375 angles[1] = 0.;
376 angles[2] = 90.+GetAngles(iplate,istrip);
377 angles[3] = 90.;
378 angles[4] =-GetAngles(iplate,istrip);
379 angles[5] = 270.;
380 }
381
382 InverseRotation(posLocal,angles);
383
384 step[0] = 0.;
385 step[1] = -GetHeights(iplate,istrip);
386 step[2] = GetDistances(iplate,istrip);
387 Translation(posLocal,step);
388
389 // FTOA = FLTA reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
390 angles[0] = 90.;
391 angles[1] = 0.;
392 angles[2] = 0.;
393 angles[3] = 0.;
394 angles[4] = 90.;
395 angles[5] =270.;
396
397 InverseRotation(posLocal,angles);
398
399 // B071/B074/B075 = BTO1/2/3 reference frame -> ALICE reference frame
400 step[0] = 0.;
401 step[1] = 0.;
402 step[2] = -((fgkRmax+fgkRmin)*0.5);
403 Translation(posLocal,step);
404
405 angles[0] = 90.;
406 angles[1] = 90.+(isector+0.5)*fPhiSec;
407 angles[2] = 0.;
408 angles[3] = 0.;
409 angles[4] = 90.;
410 angles[5] = (isector+0.5)*fPhiSec;
411
412 InverseRotation(posLocal,angles);
413
414 Float_t xCoor = posLocal[0];
415
416 return xCoor;
417
418}
419//_____________________________________________________________________________
420Float_t AliTOFGeometryV5::GetY(Int_t *det)
421{
422 //
423 // Returns Y coordinate (cm)
424 //
425
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];
431
432 /*
433 // Find out distance d on the plane wrt median phi:
434 Float_t d = (ipadx+0.5-kNpadX*0.5)*fgkXPad;
435
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);
441
442 // local azimuthal angle in the sector philoc
443 Float_t philoc = TMath::ATan(d/r);
444 //if(philoc<0.) philoc = k2PI + philoc;
445
446 // azimuthal angle in the global frame phi
447 Float_t phi = philoc*kRaddeg+(isector+0.5)*fPhiSec;
448
449 Float_t yCoor = r/TMath::Cos(philoc)*TMath::Sin(phi/kRaddeg);
450 */
451
452 // Pad reference frame -> FSTR reference frame
453 // /*
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);
457
458 step[0] = kNpadX*0.5*fgkXPad;
459 step[1] = 0.;
460 step[2] = kNpadZ*0.5*fgkZPad;
461 // */
462 /*
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};
465 */
466 Translation(posLocal,step);
467
468 // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame
469
470 Double_t angles[6];
471 if (GetAngles(iplate,istrip) >0.) {
472 angles[0] = 90.;
473 angles[1] = 0.;
474 angles[2] = 90.+GetAngles(iplate,istrip);
475 angles[3] = 90.;
476 angles[4] = GetAngles(iplate,istrip);
477 angles[5] = 90.;
478 }
479 else if (GetAngles(iplate,istrip)==0.) {
480 angles[0] = 90.;
481 angles[1] = 0.;
482 angles[2] = 90.;
483 angles[3] = 90.;
484 angles[4] = 0;
485 angles[5] = 0.;
486 }
487 else if (GetAngles(iplate,istrip) <0.) {
488 angles[0] = 90.;
489 angles[1] = 0.;
490 angles[2] = 90.+GetAngles(iplate,istrip);
491 angles[3] = 90.;
492 angles[4] =-GetAngles(iplate,istrip);
493 angles[5] = 270.;
494 }
495
496 InverseRotation(posLocal,angles);
497
498 step[0] = 0.;
499 step[1] = -GetHeights(iplate,istrip);
500 step[2] = GetDistances(iplate,istrip);
501 Translation(posLocal,step);
502
503 // FTOA = FLTA reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
504 angles[0] = 90.;
505 angles[1] = 0.;
506 angles[2] = 0.;
507 angles[3] = 0.;
508 angles[4] = 90.;
509 angles[5] =270.;
510
511 InverseRotation(posLocal,angles);
512
513 // B071/B074/B075 = BTO1/2/3 reference frame -> ALICE reference frame
514 step[0] = 0.;
515 step[1] = 0.;
516 step[2] = -((fgkRmax+fgkRmin)*0.5);
517 Translation(posLocal,step);
518
519 angles[0] = 90.;
520 angles[1] = 90.+(isector+0.5)*fPhiSec;
521 angles[2] = 0.;
522 angles[3] = 0.;
523 angles[4] = 90.;
524 angles[5] = (isector+0.5)*fPhiSec;
525
526 InverseRotation(posLocal,angles);
527
528 Float_t yCoor = posLocal[1];
529
530 return yCoor;
531
532}
533
534//_____________________________________________________________________________
535Float_t AliTOFGeometryV5::GetZ(Int_t *det)
536{
537 //
538 // Returns Z coordinate (cm)
539 //
540
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];
546
547 /*
548 Float_t zCoor = GetDistances(iplate,istrip) +
549 (0.5-ipadz) * fgkZPad * TMath::Cos(GetAngles(iplate,istrip)*kDegrad);
550 */
551
552 // Pad reference frame -> FSTR reference frame
553 // /*
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);
557
558 step[0] = kNpadX*0.5*fgkXPad;
559 step[1] = 0.;
560 step[2] = kNpadZ*0.5*fgkZPad;
561 // */
562 /*
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};
565 */
566 Translation(posLocal,step);
567
568 // FSTR reference frame -> FTOA/B/C = FLTA/B/C reference frame
569 Double_t angles[6];
570 if (GetAngles(iplate,istrip) >0.) {
571 angles[0] = 90.;
572 angles[1] = 0.;
573 angles[2] = 90.+GetAngles(iplate,istrip);
574 angles[3] = 90.;
575 angles[4] = GetAngles(iplate,istrip);
576 angles[5] = 90.;
577 }
578 else if (GetAngles(iplate,istrip)==0.) {
579 angles[0] = 90.;
580 angles[1] = 0.;
581 angles[2] = 90.;
582 angles[3] = 90.;
583 angles[4] = 0;
584 angles[5] = 0.;
585 }
586 else if (GetAngles(iplate,istrip) <0.) {
587 angles[0] = 90.;
588 angles[1] = 0.;
589 angles[2] = 90.+GetAngles(iplate,istrip);
590 angles[3] = 90.;
591 angles[4] =-GetAngles(iplate,istrip);
592 angles[5] = 270.;
593 }
594
595 InverseRotation(posLocal,angles);
596
597 step[0] = 0.;
598 step[1] = -GetHeights(iplate,istrip);
599 step[2] = GetDistances(iplate,istrip);
600 Translation(posLocal,step);
601
602 // FTOA = FLTA reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
603 angles[0] = 90.;
604 angles[1] = 0.;
605 angles[2] = 0.;
606 angles[3] = 0.;
607 angles[4] = 90.;
608 angles[5] =270.;
609
610 InverseRotation(posLocal,angles);
611
612 // B071/B074/B075 = BTO1/2/3 reference frame -> ALICE reference frame
613 step[0] = 0.;
614 step[1] = 0.;
615 step[2] = -((fgkRmax+fgkRmin)*0.5);
616 Translation(posLocal,step);
617
618 angles[0] = 90.;
619 angles[1] = 90.+(isector+0.5)*fPhiSec;
620 angles[2] = 0.;
621 angles[3] = 0.;
622 angles[4] = 90.;
623 angles[5] = (isector+0.5)*fPhiSec;
624
625 InverseRotation(posLocal,angles);
626
627 Float_t zCoor = posLocal[2];
628
629 return zCoor;
630
631}
632
633//_____________________________________________________________________________
634Int_t AliTOFGeometryV5::GetSector(Float_t *pos)
635{
636 //
637 // Returns the Sector index
638 //
639
640 //const Float_t khAlWall = 0.1;
641 //const Float_t kModuleWallThickness = 0.3;
642
643 Int_t iSect = -1;
644
645 Float_t x = pos[0];
646 Float_t y = pos[1];
647 Float_t z = pos[2];
648
649 Float_t rho = TMath::Sqrt(x*x + y*y);
650
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");
656 return iSect;
657 }
658
659 Float_t phi = TMath::Pi() + TMath::ATan2(-y,-x);
660
661 iSect = (Int_t) (phi*kRaddeg/fPhiSec);
662
663 return iSect;
664
665}
666//_____________________________________________________________________________
667
668Int_t AliTOFGeometryV5::GetPlate(Float_t *pos)
669{
670 //
671 // Returns the Plate index
672 //
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;
677
678 const Float_t kLengthExInModBorder = 4.7;
679 const Float_t kLengthInCeModBorder = 7.0;
680
681 //const Float_t khAlWall = 0.1;
682 const Float_t kModuleWallThickness = 0.3;
683 //const Float_t kHoneycombLayerThickness = 1.5;
684
685 Int_t iPlate=-1;
686
687 Float_t posLocal[3];
688 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
689
690 Int_t isector = GetSector(posLocal);
691 if(isector == -1){
692 //AliError("Detector Index could not be determined");
693 return iPlate;
694 }
695
696 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
697 Double_t angles[6] =
698 {90., 90.+(isector+0.5)*fPhiSec,
699 0., 0.,
700 90., (isector+0.5)*fPhiSec
701 };
702 Rotation(posLocal,angles);
703
704 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
705 Translation(posLocal,step);
706
707 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame
708 angles[0] = 90.;
709 angles[1] = 0.;
710 angles[2] = 0.;
711 angles[3] = 0.;
712 angles[4] = 90.;
713 angles[5] =270.;
714
715 Rotation(posLocal,angles);
716
717 Float_t yLocal = posLocal[1];
718 Float_t zLocal = posLocal[2];
719
720 Float_t deltaRhoLoc = (fgkRmax-fgkRmin)*0.5 - kModuleWallThickness + yLocal;
721 Float_t deltaZetaLoc = TMath::Abs(zLocal);
722
723 Float_t deltaRHOmax = 0.;
724
725 if (TMath::Abs(zLocal)>=kExterInterModBorder1 && TMath::Abs(zLocal)<=kExterInterModBorder2)
726 {
727 deltaRhoLoc -= kLengthExInModBorder;
728 deltaZetaLoc = kExterInterModBorder2-deltaZetaLoc;
729 deltaRHOmax = (fgkRmax - fgkRmin)*0.5 - kModuleWallThickness - 2.*kLengthExInModBorder; // old 5.35, new 4.8
730
731 if (deltaRhoLoc > deltaZetaLoc*deltaRHOmax/(kInterCentrModBorder2-kInterCentrModBorder1)) {
732 if (zLocal<0) iPlate = 0;
733 else iPlate = 4;
734 }
735 else {
736 if (zLocal<0) iPlate = 1;
737 else iPlate = 3;
738 }
739 }
740 else if (TMath::Abs(zLocal)>=kInterCentrModBorder1 && TMath::Abs(zLocal)<=kInterCentrModBorder2)
741 {
742 deltaRhoLoc -= kLengthInCeModBorder;
743 deltaZetaLoc = deltaZetaLoc-kInterCentrModBorder1;
744 deltaRHOmax = (fgkRmax - fgkRmin)*0.5 - kModuleWallThickness - 2.*kLengthInCeModBorder; // old 0.39, new 0.2
745
746 if (deltaRhoLoc>deltaZetaLoc*deltaRHOmax/(kInterCentrModBorder2-kInterCentrModBorder1)) iPlate = 2;
747 else {
748 if (zLocal<0) iPlate = 1;
749 else iPlate = 3;
750 }
751 }
752
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;
758
759 return iPlate;
760
761}
762
763//_____________________________________________________________________________
764Int_t AliTOFGeometryV5::GetStrip(Float_t *pos)
765{
766 //
767 // Returns the Strip index
768 //
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;
778
779 Int_t iStrip=-1;
780
781 Float_t posLocal[3];
782 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
783
784 Int_t isector = GetSector(posLocal);
785 if(isector == -1){
786 //AliError("Detector Index could not be determined");
787 return iStrip;}
788 Int_t iplate = GetPlate(posLocal);
789 if(iplate == -1){
790 //AliError("Detector Index could not be determined");
791 return iStrip;}
792
793 Int_t nstrips=0;
794 switch (iplate) {
795 case 0:
796 nstrips=kNStripC;
797 break;
798 case 4:
799 nstrips=kNStripC;
800 break;
801 case 1:
802 nstrips=kNStripB;
803 break;
804 case 3:
805 nstrips=kNStripB;
806 break;
807 case 2:
808 nstrips=kNStripA;
809 break;
810 }
811
812 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
813 Double_t angles[6] =
814 {90., 90.+(isector+0.5)*fPhiSec,
815 0., 0.,
816 90., (isector+0.5)*fPhiSec
817 };
818 Rotation(posLocal,angles);
819
820 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
821 Translation(posLocal,step);
822
823 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame
824 angles[0] = 90.;
825 angles[1] = 0.;
826 angles[2] = 0.;
827 angles[3] = 0.;
828 angles[4] = 90.;
829 angles[5] =270.;
830
831 Rotation(posLocal,angles);
832
833 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
834 Int_t totStrip=0;
835 for (Int_t istrip=0; istrip<nstrips; istrip++){
836
837 Float_t posLoc2[3]={posLocal[0],posLocal[1],posLocal[2]};
838
839 step[0] = 0.;
840 step[1] = GetHeights(iplate,istrip);
841 step[2] = -GetDistances(iplate,istrip);
842 Translation(posLoc2,step);
843
844 if (GetAngles(iplate,istrip) >0.) {
845 angles[0] = 90.;
846 angles[1] = 0.;
847 angles[2] = 90.+GetAngles(iplate,istrip);
848 angles[3] = 90.;
849 angles[4] = GetAngles(iplate,istrip);
850 angles[5] = 90.;
851 }
852 else if (GetAngles(iplate,istrip)==0.) {
853 angles[0] = 90.;
854 angles[1] = 0.;
855 angles[2] = 90.;
856 angles[3] = 90.;
857 angles[4] = 0;
858 angles[5] = 0.;
859 }
860 else if (GetAngles(iplate,istrip) <0.) {
861 angles[0] = 90.;
862 angles[1] = 0.;
863 angles[2] = 90.+GetAngles(iplate,istrip);
864 angles[3] = 90.;
865 angles[4] =-GetAngles(iplate,istrip);
866 angles[5] = 270.;
867 }
868 Rotation(posLoc2,angles);
869
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)) {
873 iStrip = istrip;
874 totStrip++;
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]));
877
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]));
879 break;
880 }
881
882 if (totStrip>1) AliInfo(Form("total strip number found %2i",totStrip));
883
884 }
885
886 return iStrip;
887
888}
889//_____________________________________________________________________________
890Int_t AliTOFGeometryV5::GetPadZ(Float_t *pos)
891{
892 //
893 // Returns the Pad index along Z
894 //
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
898
899 Int_t iPadZ = -1;
900
901 Float_t posLocal[3];
902 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
903
904 Int_t isector = GetSector(posLocal);
905 if(isector == -1){
906 //AliError("Detector Index could not be determined");
907 return iPadZ;}
908 Int_t iplate = GetPlate(posLocal);
909 if(iplate == -1){
910 //AliError("Detector Index could not be determined");
911 return iPadZ;}
912 Int_t istrip = GetStrip(posLocal);
913 if(istrip == -1){
914 //AliError("Detector Index could not be determined");
915 return iPadZ;}
916
917 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
918 Double_t angles[6] =
919 {90., 90.+(isector+0.5)*fPhiSec,
920 0., 0.,
921 90., (isector+0.5)*fPhiSec
922 };
923 Rotation(posLocal,angles);
924
925 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
926 Translation(posLocal,step);
927
928 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame
929 angles[0] = 90.;
930 angles[1] = 0.;
931 angles[2] = 0.;
932 angles[3] = 0.;
933 angles[4] = 90.;
934 angles[5] =270.;
935
936 Rotation(posLocal,angles);
937
938 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
939 step[0] = 0.;
940 step[1] = GetHeights(iplate,istrip);
941 step[2] = -GetDistances(iplate,istrip);
942 Translation(posLocal,step);
943
944 if (GetAngles(iplate,istrip) >0.) {
945 angles[0] = 90.;
946 angles[1] = 0.;
947 angles[2] = 90.+GetAngles(iplate,istrip);
948 angles[3] = 90.;
949 angles[4] = GetAngles(iplate,istrip);
950 angles[5] = 90.;
951 }
952 else if (GetAngles(iplate,istrip)==0.) {
953 angles[0] = 90.;
954 angles[1] = 0.;
955 angles[2] = 90.;
956 angles[3] = 90.;
957 angles[4] = 0;
958 angles[5] = 0.;
959 }
960 else if (GetAngles(iplate,istrip) <0.) {
961 angles[0] = 90.;
962 angles[1] = 0.;
963 angles[2] = 90.+GetAngles(iplate,istrip);
964 angles[3] = 90.;
965 angles[4] =-GetAngles(iplate,istrip);
966 angles[5] = 270.;
967 }
968 Rotation(posLocal,angles);
969
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) {
972
973 step[0] =-0.5*kNpadX*fgkXPad;
974 step[1] = 0.;
975 step[2] =-0.5*kNpadZ*fgkZPad;
976 Translation(posLocal,step);
977
978 iPadZ = (Int_t)(posLocal[2]/fgkZPad);
979 if (iPadZ==kNpadZ) iPadZ--;
980 else if (iPadZ>kNpadZ) iPadZ=-1;
981
982 //}
983 // else AliError("Detector Index could not be determined");
984
985 return iPadZ;
986
987}
988//_____________________________________________________________________________
989Int_t AliTOFGeometryV5::GetPadX(Float_t *pos)
990{
991 //
992 // Returns the Pad index along X
993 //
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
997
998 Int_t iPadX = -1;
999
1000 Float_t posLocal[3];
1001 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
1002
1003 Int_t isector = GetSector(posLocal);
1004 if(isector == -1){
1005 //AliError("Detector Index could not be determined");
1006 return iPadX;}
1007 Int_t iplate = GetPlate(posLocal);
1008 if(iplate == -1){
1009 //AliError("Detector Index could not be determined");
1010 return iPadX;}
1011 Int_t istrip = GetStrip(posLocal);
1012 if(istrip == -1){
1013 //AliError("Detector Index could not be determined");
1014 return iPadX;}
1015
1016 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1017 Double_t angles[6] =
1018 {90., 90.+(isector+0.5)*fPhiSec,
1019 0., 0.,
1020 90., (isector+0.5)*fPhiSec
1021 };
1022 Rotation(posLocal,angles);
1023
1024 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1025 Translation(posLocal,step);
1026
1027 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
1028 angles[0] = 90.;
1029 angles[1] = 0.;
1030 angles[2] = 0.;
1031 angles[3] = 0.;
1032 angles[4] = 90.;
1033 angles[5] =270.;
1034
1035 Rotation(posLocal,angles);
1036
1037 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1038 step[0] = 0.;
1039 step[1] = GetHeights(iplate,istrip);
1040 step[2] = -GetDistances(iplate,istrip);
1041 Translation(posLocal,step);
1042
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 Rotation(posLocal,angles);
1068
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) {
1071
1072 step[0] =-0.5*kNpadX*fgkXPad;
1073 step[1] = 0.;
1074 step[2] =-0.5*kNpadZ*fgkZPad;
1075 Translation(posLocal,step);
1076
1077 iPadX = (Int_t)(posLocal[0]/fgkXPad);
1078 if (iPadX==kNpadX) iPadX--;
1079 else if (iPadX>kNpadX) iPadX=-1;
1080
1081 //}
1082 //else AliError("Detector Index could not be determined");
1083
1084 return iPadX;
1085
1086}
1087//_____________________________________________________________________________
1088
1089Float_t AliTOFGeometryV5::GetPadDx(Float_t *pos)
1090{
1091 //
1092 // Returns the x coordinate in the Pad reference frame
1093 //
1094
1095 Float_t xpad = -2.;
1096
1097 Float_t posLocal[3];
1098 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
1099
1100 Int_t isector = GetSector(posLocal);
1101 if(isector == -1){
1102 //AliError("Detector Index could not be determined");
1103 return xpad;}
1104 Int_t iplate = GetPlate(posLocal);
1105 if(iplate == -1){
1106 //AliError("Detector Index could not be determined");
1107 return xpad;}
1108 Int_t istrip = GetStrip(posLocal);
1109 if(istrip == -1){
1110 //AliError("Detector Index could not be determined");
1111 return xpad;}
1112 Int_t ipadz = GetPadZ(posLocal);
1113 if(ipadz == -1){
1114 //AliError("Detector Index could not be determined");
1115 return xpad;}
1116 Int_t ipadx = GetPadX(posLocal);
1117 if(ipadx == -1){
1118 //AliError("Detector Index could not be determined");
1119 return xpad;}
1120
1121 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1122 Double_t angles[6] =
1123 {90., 90.+(isector+0.5)*fPhiSec,
1124 0., 0.,
1125 90., (isector+0.5)*fPhiSec
1126 };
1127 Rotation(posLocal,angles);
1128
1129 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1130 Translation(posLocal,step);
1131
1132 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
1133 angles[0] = 90.;
1134 angles[1] = 0.;
1135 angles[2] = 0.;
1136 angles[3] = 0.;
1137 angles[4] = 90.;
1138 angles[5] =270.;
1139
1140 Rotation(posLocal,angles);
1141
1142 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1143 step[0] = 0.;
1144 step[1] = GetHeights(iplate,istrip);
1145 step[2] = -GetDistances(iplate,istrip);
1146 Translation(posLocal,step);
1147
1148 if (GetAngles(iplate,istrip) >0.) {
1149 angles[0] = 90.;
1150 angles[1] = 0.;
1151 angles[2] = 90.+GetAngles(iplate,istrip);
1152 angles[3] = 90.;
1153 angles[4] = GetAngles(iplate,istrip);
1154 angles[5] = 90.;
1155 }
1156 else if (GetAngles(iplate,istrip)==0.) {
1157 angles[0] = 90.;
1158 angles[1] = 0.;
1159 angles[2] = 90.;
1160 angles[3] = 90.;
1161 angles[4] = 0;
1162 angles[5] = 0.;
1163 }
1164 else if (GetAngles(iplate,istrip) <0.) {
1165 angles[0] = 90.;
1166 angles[1] = 0.;
1167 angles[2] = 90.+GetAngles(iplate,istrip);
1168 angles[3] = 90.;
1169 angles[4] =-GetAngles(iplate,istrip);
1170 angles[5] = 270.;
1171 }
1172 Rotation(posLocal,angles);
1173
1174 step[0] =-0.5*kNpadX*fgkXPad;
1175 step[1] = 0.;
1176 step[2] =-0.5*kNpadZ*fgkZPad;
1177 Translation(posLocal,step);
1178
1179 step[0] = (ipadx+0.5)*fgkXPad;
1180 step[1] = 0.;
1181 step[2] = (ipadz+0.5)*fgkZPad;
1182 Translation(posLocal,step);
1183
1184 xpad=posLocal[0];
1185
1186 return xpad;
1187
1188}
1189//_____________________________________________________________________________
1190Float_t AliTOFGeometryV5::GetPadDy(Float_t *pos)
1191{
1192 //
1193 // Returns the x coordinate in the Pad reference frame
1194 //
1195
1196 Float_t ypad = -2.;
1197
1198 Float_t posLocal[3];
1199 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
1200
1201 Int_t isector = GetSector(posLocal);
1202 if(isector == -1){
1203 //AliError("Detector Index could not be determined");
1204 return ypad;}
1205 Int_t iplate = GetPlate(posLocal);
1206 if(iplate == -1){
1207 //AliError("Detector Index could not be determined");
1208 return ypad;}
1209 Int_t istrip = GetStrip(posLocal);
1210 if(istrip == -1){
1211 //AliError("Detector Index could not be determined");
1212 return ypad;}
1213 Int_t ipadz = GetPadZ(posLocal);
1214 if(ipadz == -1){
1215 //AliError("Detector Index could not be determined");
1216 return ypad;}
1217 Int_t ipadx = GetPadX(posLocal);
1218 if(ipadx == -1){
1219 //AliError("Detector Index could not be determined");
1220 return ypad;}
1221
1222 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1223 Double_t angles[6] =
1224 {90., 90.+(isector+0.5)*fPhiSec,
1225 0., 0.,
1226 90., (isector+0.5)*fPhiSec
1227 };
1228 Rotation(posLocal,angles);
1229
1230 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1231 Translation(posLocal,step);
1232
1233 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
1234 angles[0] = 90.;
1235 angles[1] = 0.;
1236 angles[2] = 0.;
1237 angles[3] = 0.;
1238 angles[4] = 90.;
1239 angles[5] =270.;
1240
1241 Rotation(posLocal,angles);
1242
1243 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1244 step[0] = 0.;
1245 step[1] = GetHeights(iplate,istrip);
1246 step[2] = -GetDistances(iplate,istrip);
1247 Translation(posLocal,step);
1248
1249 if (GetAngles(iplate,istrip) >0.) {
1250 angles[0] = 90.;
1251 angles[1] = 0.;
1252 angles[2] = 90.+GetAngles(iplate,istrip);
1253 angles[3] = 90.;
1254 angles[4] = GetAngles(iplate,istrip);
1255 angles[5] = 90.;
1256 }
1257 else if (GetAngles(iplate,istrip)==0.) {
1258 angles[0] = 90.;
1259 angles[1] = 0.;
1260 angles[2] = 90.;
1261 angles[3] = 90.;
1262 angles[4] = 0;
1263 angles[5] = 0.;
1264 }
1265 else if (GetAngles(iplate,istrip) <0.) {
1266 angles[0] = 90.;
1267 angles[1] = 0.;
1268 angles[2] = 90.+GetAngles(iplate,istrip);
1269 angles[3] = 90.;
1270 angles[4] =-GetAngles(iplate,istrip);
1271 angles[5] = 270.;
1272 }
1273 Rotation(posLocal,angles);
1274
1275 step[0] =-0.5*kNpadX*fgkXPad;
1276 step[1] = 0.;
1277 step[2] =-0.5*kNpadZ*fgkZPad;
1278 Translation(posLocal,step);
1279
1280 step[0] = (ipadx+0.5)*fgkXPad;
1281 step[1] = 0.;
1282 step[2] = (ipadz+0.5)*fgkZPad;
1283 Translation(posLocal,step);
1284
1285 ypad=posLocal[1];
1286
1287 return ypad;
1288
1289}
1290//_____________________________________________________________________________
1291Float_t AliTOFGeometryV5::GetPadDz(Float_t *pos)
1292{
1293 //
1294 // Returns the x coordinate in the Pad reference frame
1295 //
1296
1297 Float_t zpad = -2.;
1298
1299 Float_t posLocal[3];
1300 for (Int_t ii=0; ii<3; ii++) posLocal[ii] = pos[ii];
1301
1302 Int_t isector = GetSector(posLocal);
1303 if(isector == -1){
1304 //AliError("Detector Index could not be determined");
1305 return zpad;}
1306 Int_t iplate = GetPlate(posLocal);
1307 if(iplate == -1){
1308 //AliError("Detector Index could not be determined");
1309 return zpad;}
1310 Int_t istrip = GetStrip(posLocal);
1311 if(istrip == -1){
1312 //AliError("Detector Index could not be determined");
1313 return zpad;}
1314 Int_t ipadz = GetPadZ(posLocal);
1315 if(ipadz == -1){
1316 //AliError("Detector Index could not be determined");
1317 return zpad;}
1318 Int_t ipadx = GetPadX(posLocal);
1319 if(ipadx == -1){
1320 //AliError("Detector Index could not be determined");
1321 return zpad;}
1322
1323 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
1324 Double_t angles[6] =
1325 {90., 90.+(isector+0.5)*fPhiSec,
1326 0., 0.,
1327 90., (isector+0.5)*fPhiSec
1328 };
1329 Rotation(posLocal,angles);
1330
1331 Float_t step[3] = {0., 0., (fgkRmax+fgkRmin)*0.5};
1332 Translation(posLocal,step);
1333
1334 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA/B/C = FLTA/B/C reference frame
1335 angles[0] = 90.;
1336 angles[1] = 0.;
1337 angles[2] = 0.;
1338 angles[3] = 0.;
1339 angles[4] = 90.;
1340 angles[5] =270.;
1341
1342 Rotation(posLocal,angles);
1343
1344 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
1345 step[0] = 0.;
1346 step[1] = GetHeights(iplate,istrip);
1347 step[2] = -GetDistances(iplate,istrip);
1348 Translation(posLocal,step);
1349
1350 if (GetAngles(iplate,istrip) >0.) {
1351 angles[0] = 90.;
1352 angles[1] = 0.;
1353 angles[2] = 90.+GetAngles(iplate,istrip);
1354 angles[3] = 90.;
1355 angles[4] = GetAngles(iplate,istrip);
1356 angles[5] = 90.;
1357 }
1358 else if (GetAngles(iplate,istrip)==0.) {
1359 angles[0] = 90.;
1360 angles[1] = 0.;
1361 angles[2] = 90.;
1362 angles[3] = 90.;
1363 angles[4] = 0;
1364 angles[5] = 0.;
1365 }
1366 else if (GetAngles(iplate,istrip) <0.) {
1367 angles[0] = 90.;
1368 angles[1] = 0.;
1369 angles[2] = 90.+GetAngles(iplate,istrip);
1370 angles[3] = 90.;
1371 angles[4] =-GetAngles(iplate,istrip);
1372 angles[5] = 270.;
1373 }
1374 Rotation(posLocal,angles);
1375
1376 step[0] =-0.5*kNpadX*fgkXPad;
1377 step[1] = 0.;
1378 step[2] =-0.5*kNpadZ*fgkZPad;
1379 Translation(posLocal,step);
1380
1381 step[0] = (ipadx+0.5)*fgkXPad;
1382 step[1] = 0.;
1383 step[2] = (ipadz+0.5)*fgkZPad;
1384 Translation(posLocal,step);
1385
1386 zpad=posLocal[2];
1387
1388 return zpad;
1389
1390}
1391//_____________________________________________________________________________
1392
1393void AliTOFGeometryV5::Translation(Float_t *xyz, Float_t translationVector[3])
1394{
1395
1396 Int_t ii=0;
1397
1398 for (ii=0; ii<3; ii++)
1399 xyz[ii] -= translationVector[ii];
1400
1401 return;
1402
1403}
1404//_____________________________________________________________________________
1405
1406void AliTOFGeometryV5::Rotation(Float_t *xyz, Double_t rotationAngles[6])
1407{
1408
1409 Int_t ii=0;
1410 /*
1411 TRotMatrix *matrix = new TRotMatrix("matrix","matrix", angles[0], angles[1],
1412 angles[2], angles[3],
1413 angles[4], angles[5]);
1414 */
1415
1416 for (ii=0; ii<6; ii++) rotationAngles[ii]*=kDegrad;
1417
1418 Float_t xyzDummy[3] = {0., 0., 0.};
1419
1420 for (ii=0; ii<3; ii++) {
1421 xyzDummy[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]);
1425 }
1426
1427 for (ii=0; ii<3; ii++) xyz[ii]=xyzDummy[ii];
1428
1429 return;
1430
1431}
1432//_____________________________________________________________________________
1433void AliTOFGeometryV5::InverseRotation(Float_t *xyz, Double_t rotationAngles[6])
1434{
1435
1436 Int_t ii=0;
1437
1438 for (ii=0; ii<6; ii++) rotationAngles[ii]*=kDegrad;
1439
1440 Float_t xyzDummy[3] = {0., 0., 0.};
1441
1442 xyzDummy[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]);
1446
1447 xyzDummy[1] =
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]);
1451
1452 xyzDummy[2] =
1453 xyz[0]*TMath::Cos(rotationAngles[0]) +
1454 xyz[1]*TMath::Cos(rotationAngles[2]) +
1455 xyz[2]*TMath::Cos(rotationAngles[4]);
1456
1457 for (ii=0; ii<3; ii++) xyz[ii]=xyzDummy[ii];
1458
1459 return;
1460
1461}
1462//_____________________________________________________________________________