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.24 2003/09/18 09:06:07 cblume
19 Geometry update, Removal of compiler warnings
21 Revision 1.22 2002/11/21 22:38:47 alibrary
22 Removing AliMC and AliMCProcess
24 Revision 1.21 2002/11/21 16:09:44 cblume
25 Change fgkRpadW to 1.0 cm for new pad plane
27 Revision 1.20 2002/10/31 17:45:35 cblume
30 Revision 1.19 2002/10/14 14:57:43 hristov
31 Merging the VirtualMC branch to the main development branch (HEAD)
33 Revision 1.15.6.2 2002/07/24 10:09:30 alibrary
36 Revision 1.15.6.1 2002/06/10 15:28:58 hristov
39 Revision 1.17 2002/04/05 13:20:12 cblume
40 Remove const for CreateGeometry
42 Revision 1.16 2002/03/28 14:59:07 cblume
45 Revision 1.18 2002/06/12 09:54:35 cblume
46 Update of tracking code provided by Sergei
48 Revision 1.17 2002/04/05 13:20:12 cblume
49 Remove const for CreateGeometry
51 Revision 1.16 2002/03/28 14:59:07 cblume
54 Revision 1.15 2002/02/11 14:21:16 cblume
55 Update of the geometry. Get rid of MANY
57 Revision 1.14 2001/11/06 17:19:41 cblume
58 Add detailed geometry and simple simulator
60 Revision 1.13 2001/08/02 08:30:45 cblume
61 Fix positions of cooling material
63 Revision 1.12 2001/05/21 16:45:47 hristov
64 Last minute changes (C.Blume)
66 Revision 1.11 2001/05/11 07:56:12 hristov
67 Consistent declarations needed on Alpha
69 Revision 1.10 2001/05/07 08:08:05 cblume
72 Revision 1.9 2001/03/27 12:48:33 cblume
73 Correct for volume overlaps
75 Revision 1.8 2001/03/13 09:30:35 cblume
76 Update of digitization. Moved digit branch definition to AliTRD
78 Revision 1.7 2001/02/14 18:22:26 cblume
79 Change in the geometry of the padplane
81 Revision 1.6 2000/11/01 14:53:20 cblume
82 Merge with TRD-develop
84 Revision 1.1.4.7 2000/10/16 01:16:53 cblume
85 Changed timebin 0 to be the one closest to the readout
87 Revision 1.1.4.6 2000/10/15 23:35:57 cblume
88 Include geometry constants as static member
90 Revision 1.1.4.5 2000/10/06 16:49:46 cblume
93 Revision 1.1.4.4 2000/10/04 16:34:58 cblume
94 Replace include files by forward declarations
96 Revision 1.1.4.3 2000/09/22 14:43:40 cblume
97 Allow the pad/timebin-dimensions to be changed after initialization
99 Revision 1.1.4.2 2000/09/18 13:37:01 cblume
100 Minor coding corrections
102 Revision 1.5 2000/10/02 21:28:19 fca
103 Removal of useless dependecies via forward declarations
105 Revision 1.4 2000/06/08 18:32:58 cblume
106 Make code compliant to coding conventions
108 Revision 1.3 2000/06/07 16:25:37 cblume
109 Try to remove compiler warnings on Sun and HP
111 Revision 1.2 2000/05/08 16:17:27 cblume
114 Revision 1.1.4.1 2000/05/08 14:45:55 cblume
115 Bug fix in RotateBack(). Geometry update
117 Revision 1.4 2000/06/08 18:32:58 cblume
118 Make code compliant to coding conventions
120 Revision 1.3 2000/06/07 16:25:37 cblume
121 Try to remove compiler warnings on Sun and HP
123 Revision 1.2 2000/05/08 16:17:27 cblume
126 Revision 1.1.4.1 2000/05/08 14:45:55 cblume
127 Bug fix in RotateBack(). Geometry update
129 Revision 1.1 2000/02/28 19:00:44 cblume
134 ///////////////////////////////////////////////////////////////////////////////
136 // TRD geometry class //
138 ///////////////////////////////////////////////////////////////////////////////
141 #include "AliTRDgeometry.h"
142 #include "AliTRDparameter.h"
144 ClassImp(AliTRDgeometry)
146 //_____________________________________________________________________________
149 // The geometry constants
151 const Int_t AliTRDgeometry::fgkNsect = kNsect;
152 const Int_t AliTRDgeometry::fgkNplan = kNplan;
153 const Int_t AliTRDgeometry::fgkNcham = kNcham;
154 const Int_t AliTRDgeometry::fgkNdet = kNdet;
157 // Dimensions of the detector
160 // Inner and outer radius of the mother volumes
161 const Float_t AliTRDgeometry::fgkRmin = 294.0;
162 const Float_t AliTRDgeometry::fgkRmax = 368.0;
164 // Upper and lower length of the mother volumes
165 const Float_t AliTRDgeometry::fgkZmax1 = 378.35;
166 const Float_t AliTRDgeometry::fgkZmax2 = 302.0;
168 // Parameter of the BTR mother volumes
169 const Float_t AliTRDgeometry::fgkSheight = 74.0;
170 const Float_t AliTRDgeometry::fgkSwidth1 = 99.613;
171 const Float_t AliTRDgeometry::fgkSwidth2 = 125.707;
172 const Float_t AliTRDgeometry::fgkSlenTR1 = 751.0;
173 const Float_t AliTRDgeometry::fgkSlenTR2 = 313.5;
174 const Float_t AliTRDgeometry::fgkSlenTR3 = 159.5;
176 // The super module side plates
177 const Float_t AliTRDgeometry::fgkSMpltT = 0.2;
178 const Float_t AliTRDgeometry::fgkSMgapT = 0.5;
180 // Height of different chamber parts
182 const Float_t AliTRDgeometry::fgkCraH = 4.8;
184 const Float_t AliTRDgeometry::fgkCdrH = 3.0;
185 // Amplification region
186 const Float_t AliTRDgeometry::fgkCamH = 0.7;
188 const Float_t AliTRDgeometry::fgkCroH = 2.316;
190 const Float_t AliTRDgeometry::fgkCH = AliTRDgeometry::fgkCraH
191 + AliTRDgeometry::fgkCdrH
192 + AliTRDgeometry::fgkCamH
193 + AliTRDgeometry::fgkCroH;
195 // Vertical spacing of the chambers
196 const Float_t AliTRDgeometry::fgkVspace = 1.784;
198 // Horizontal spacing of the chambers
199 const Float_t AliTRDgeometry::fgkHspace = 2.0;
201 // Thicknesses of different parts of the chamber frame
202 // Lower aluminum frame
203 const Float_t AliTRDgeometry::fgkCalT = 0.3;
204 // Lower G10 frame sides
205 const Float_t AliTRDgeometry::fgkCclsT = 0.3;
206 // Lower G10 frame front
207 const Float_t AliTRDgeometry::fgkCclfT = 1.0;
209 const Float_t AliTRDgeometry::fgkCcuT = 0.9;
211 const Float_t AliTRDgeometry::fgkCauT = 1.5;
213 // Additional width of the readout chamber frames
214 const Float_t AliTRDgeometry::fgkCroW = 0.9;
216 // Difference of outer chamber width and pad plane width
217 //const Float_t AliTRDgeometry::fgkCpadW = 1.0;
218 const Float_t AliTRDgeometry::fgkCpadW = 0.0;
219 const Float_t AliTRDgeometry::fgkRpadW = 1.0;
222 // Thickness of the the material layers
224 const Float_t AliTRDgeometry::fgkRaThick = 0.3646;
225 const Float_t AliTRDgeometry::fgkMyThick = 0.005;
226 const Float_t AliTRDgeometry::fgkDrThick = AliTRDgeometry::fgkCdrH;
227 const Float_t AliTRDgeometry::fgkAmThick = AliTRDgeometry::fgkCamH;
228 const Float_t AliTRDgeometry::fgkXeThick = AliTRDgeometry::fgkDrThick
229 + AliTRDgeometry::fgkAmThick;
230 const Float_t AliTRDgeometry::fgkCuThick = 0.001;
231 const Float_t AliTRDgeometry::fgkSuThick = 0.06;
232 const Float_t AliTRDgeometry::fgkFeThick = 0.0044;
233 const Float_t AliTRDgeometry::fgkCoThick = 0.02;
234 const Float_t AliTRDgeometry::fgkWaThick = 0.02;
237 // Position of the material layers
239 const Float_t AliTRDgeometry::fgkRaZpos = -1.50;
240 const Float_t AliTRDgeometry::fgkMyZpos = 0.895;
241 const Float_t AliTRDgeometry::fgkDrZpos = 2.4;
242 const Float_t AliTRDgeometry::fgkAmZpos = 0.0;
243 const Float_t AliTRDgeometry::fgkCuZpos = -0.9995;
244 const Float_t AliTRDgeometry::fgkSuZpos = 0.0000;
245 const Float_t AliTRDgeometry::fgkFeZpos = 0.0322;
246 const Float_t AliTRDgeometry::fgkCoZpos = 0.97;
247 const Float_t AliTRDgeometry::fgkWaZpos = 0.99;
249 //_____________________________________________________________________________
250 AliTRDgeometry::AliTRDgeometry():AliGeometry()
253 // AliTRDgeometry default constructor
260 //_____________________________________________________________________________
261 AliTRDgeometry::~AliTRDgeometry()
264 // AliTRDgeometry destructor
269 //_____________________________________________________________________________
270 void AliTRDgeometry::Init()
273 // Initializes the geometry parameter
275 // The maximum number of pads
276 // and the position of pad 0,0,0
278 // chambers seen from the top:
279 // +----------------------------+
285 // +----------------------------+ +------>
287 // chambers seen from the side: ^
288 // +----------------------------+ drift|
291 // +----------------------------+ +------>
294 // IMPORTANT: time bin 0 is now the first one in the drift region
295 // closest to the readout !!!
302 // The outer width of the chambers
310 // The outer lengths of the chambers
311 // Includes the spacings between the chambers!
312 Float_t length[kNplan][kNcham] = { { 124.0, 124.0, 110.0, 124.0, 124.0 }
313 , { 131.0, 131.0, 110.0, 131.0, 131.0 }
314 , { 138.0, 138.0, 110.0, 138.0, 138.0 }
315 , { 145.0, 145.0, 110.0, 145.0, 145.0 }
316 , { 147.0, 147.0, 110.0, 147.0, 147.0 }
317 , { 147.0, 147.0, 110.0, 147.0, 147.0 } };
319 for (icham = 0; icham < kNcham; icham++) {
320 for (iplan = 0; iplan < kNplan; iplan++) {
321 fClength[iplan][icham] = length[iplan][icham];
322 fClengthPH[iplan][icham] = 0.0;
323 fClengthRH[iplan][icham] = 0.0;
327 // The rotation matrix elements
329 for (isect = 0; isect < fgkNsect; isect++) {
330 phi = -2.0 * TMath::Pi() / (Float_t) fgkNsect * ((Float_t) isect + 0.5);
331 fRotA11[isect] = TMath::Cos(phi);
332 fRotA12[isect] = TMath::Sin(phi);
333 fRotA21[isect] = TMath::Sin(phi);
334 fRotA22[isect] = TMath::Cos(phi);
336 fRotB11[isect] = TMath::Cos(phi);
337 fRotB12[isect] = TMath::Sin(phi);
338 fRotB21[isect] = TMath::Sin(phi);
339 fRotB22[isect] = TMath::Cos(phi);
344 //_____________________________________________________________________________
345 void AliTRDgeometry::CreateGeometry(Int_t* )
348 // Create TRD geometry
353 //_____________________________________________________________________________
354 Bool_t AliTRDgeometry::Local2Global(Int_t idet, Float_t *local
356 , AliTRDparameter *par) const
359 // Converts local pad-coordinates (row,col,time) into
360 // global ALICE reference frame coordinates (x,y,z)
363 Int_t icham = GetChamber(idet); // Chamber info (0-4)
364 Int_t isect = GetSector(idet); // Sector info (0-17)
365 Int_t iplan = GetPlane(idet); // Plane info (0-5)
367 return Local2Global(iplan,icham,isect,local,global,par);
371 //_____________________________________________________________________________
372 Bool_t AliTRDgeometry::Local2Global(Int_t iplan, Int_t icham, Int_t isect
373 , Float_t *local, Float_t *global
374 , AliTRDparameter *par) const
377 // Converts local pad-coordinates (row,col,time) into
378 // global ALICE reference frame coordinates (x,y,z)
382 Error("Local2Global","No parameter defined\n");
386 Int_t idet = GetDetector(iplan,icham,isect); // Detector number
388 Float_t padRow = local[0]+0.5; // Pad Row position
389 Float_t padCol = local[1]+0.5; // Pad Column position
390 Float_t timeSlice = local[2]+0.5; // Time "position"
392 Float_t row0 = par->GetRow0(iplan,icham,isect);
393 Float_t col0 = par->GetCol0(iplan);
394 Float_t time0 = par->GetTime0(iplan);
398 // calculate (x,y,z) position in rotated chamber
399 rot[0] = time0 - (timeSlice - par->GetTimeBefore())
400 * par->GetTimeBinSize();
401 rot[1] = col0 + padCol
402 * par->GetColPadSize(iplan);
403 rot[2] = row0 + padRow
404 * par->GetRowPadSize(iplan,icham,isect);
406 // Rotate back to original position
407 return RotateBack(idet,rot,global);
413 //_____________________________________________________________________________
414 Bool_t AliTRDgeometry::Global2Local(Int_t mode, Float_t *local, Float_t *global, Int_t* index, AliTRDparameter *par) const
417 // Converts local pad-coordinates (row,col,time) into
418 // global ALICE reference frame coordinates (x,y,z)
420 //index[0]=plane number
421 //index[1]=chamber number
422 //index[2]=sector number
424 // mode=0 - local coordinate in y, z, x - rotated global
425 // mode=2 - local coordinate in pad, and pad row, x - rotated global
428 Error("Local2Global","No parameter defined\n");
432 //Int_t idet = GetDetector(iplan,icham,isect); // Detector number
433 Int_t idet = GetDetector(index[0],index[1],index[2]); // Detector number
434 Rotate(idet,global,local);
435 if (mode==0) return kTRUE;
437 // Float_t row0 = par->GetRow0(iplan,icham,isect);
438 //Float_t col0 = par->GetCol0(iplan);
439 //Float_t time0 = par->GetTime0(iplan);
441 // mode 1 to be implemented later
442 // calculate (x,y,z) position in time bin pad row pad
444 //rot[0] = time0 - (timeSlice - par->GetTimeBefore())
445 // * par->GetTimeBinSize();
446 //rot[1] = col0 + padCol
447 // * par->GetColPadSize(iplan);
448 //rot[2] = row0 + padRow
449 // * par->GetRowPadSize(iplan,icham,isect);
455 //___________________________________________________________________
456 Bool_t AliTRDgeometry::Global2Detector(Float_t global[3], Int_t index[3], AliTRDparameter *par)
460 //input = global position
462 //index[0]=plane number
463 //index[1]=chamber number
464 //index[2]=sector number
467 fi = TMath::ATan2(global[1],global[0]);
468 if (fi<0) fi += 2*TMath::Pi();
469 index[2] = Int_t(TMath::Nint((fi - GetAlpha()/2.)/GetAlpha()));
472 Float_t locx = global[0] * fRotA11[index[2]] + global[1] * fRotA12[index[2]];
474 Float_t max = locx-par->GetTime0(0);
475 for (Int_t iplane=1; iplane<fgkNplan;iplane++){
476 Float_t dist = TMath::Abs(locx-par->GetTime0(iplane));
482 Float_t theta = TMath::ATan2(global[2],locx);
483 index[1] = TMath::Nint(float(fgkNcham)*theta/(0.25*TMath::Pi()));
489 //_____________________________________________________________________________
490 Bool_t AliTRDgeometry::Rotate(Int_t d, Float_t *pos, Float_t *rot) const
493 // Rotates all chambers in the position of sector 0 and transforms
494 // the coordinates in the ALICE restframe <pos> into the
495 // corresponding local frame <rot>.
498 Int_t sector = GetSector(d);
500 rot[0] = pos[0] * fRotA11[sector] + pos[1] * fRotA12[sector];
501 rot[1] = -pos[0] * fRotA21[sector] + pos[1] * fRotA22[sector];
508 //_____________________________________________________________________________
509 Bool_t AliTRDgeometry::RotateBack(Int_t d, Float_t *rot, Float_t *pos) const
512 // Rotates a chambers from the position of sector 0 into its
513 // original position and transforms the corresponding local frame
514 // coordinates <rot> into the coordinates of the ALICE restframe <pos>.
517 Int_t sector = GetSector(d);
519 pos[0] = rot[0] * fRotB11[sector] + rot[1] * fRotB12[sector];
520 pos[1] = -rot[0] * fRotB21[sector] + rot[1] * fRotB22[sector];
527 //_____________________________________________________________________________
528 Int_t AliTRDgeometry::GetDetectorSec(const Int_t p, const Int_t c) const
531 // Convert plane / chamber into detector number for one single sector
534 return (p + c * fgkNplan);
538 //_____________________________________________________________________________
539 Int_t AliTRDgeometry::GetDetector(const Int_t p, const Int_t c, const Int_t s) const
542 // Convert plane / chamber / sector into detector number
545 return (p + c * fgkNplan + s * fgkNplan * fgkNcham);
549 //_____________________________________________________________________________
550 Int_t AliTRDgeometry::GetPlane(const Int_t d) const
553 // Reconstruct the plane number from the detector number
556 return ((Int_t) (d % fgkNplan));
560 //_____________________________________________________________________________
561 Int_t AliTRDgeometry::GetChamber(const Int_t d) const
564 // Reconstruct the chamber number from the detector number
567 return ((Int_t) (d % (fgkNplan * fgkNcham)) / fgkNplan);
571 //_____________________________________________________________________________
572 Int_t AliTRDgeometry::GetSector(const Int_t d) const
575 // Reconstruct the sector number from the detector number
578 return ((Int_t) (d / (fgkNplan * fgkNcham)));
582 //_____________________________________________________________________________
583 void AliTRDgeometry::SetOldGeometry()
586 // Use the old chamber lengths
592 Float_t length[kNplan][kNcham] = { { 123.5, 123.5, 110.0, 123.5, 123.5 }
593 , { 131.0, 131.0, 110.0, 131.0, 131.0 }
594 , { 134.5, 138.5, 110.0, 138.5, 134.5 }
595 , { 142.0, 146.0, 110.0, 146.0, 142.0 }
596 , { 142.0, 153.0, 110.0, 153.0, 142.0 }
597 , { 134.0, 160.5, 110.0, 160.5, 134.0 } };
599 for (icham = 0; icham < kNcham; icham++) {
600 for (iplan = 0; iplan < kNplan; iplan++) {
601 fClength[iplan][icham] = length[iplan][icham];