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.19 2002/10/14 14:57:43 hristov
19 Merging the VirtualMC branch to the main development branch (HEAD)
21 Revision 1.15.6.2 2002/07/24 10:09:30 alibrary
24 Revision 1.15.6.1 2002/06/10 15:28:58 hristov
27 Revision 1.17 2002/04/05 13:20:12 cblume
28 Remove const for CreateGeometry
30 Revision 1.16 2002/03/28 14:59:07 cblume
33 Revision 1.18 2002/06/12 09:54:35 cblume
34 Update of tracking code provided by Sergei
36 Revision 1.17 2002/04/05 13:20:12 cblume
37 Remove const for CreateGeometry
39 Revision 1.16 2002/03/28 14:59:07 cblume
42 Revision 1.15 2002/02/11 14:21:16 cblume
43 Update of the geometry. Get rid of MANY
45 Revision 1.14 2001/11/06 17:19:41 cblume
46 Add detailed geometry and simple simulator
48 Revision 1.13 2001/08/02 08:30:45 cblume
49 Fix positions of cooling material
51 Revision 1.12 2001/05/21 16:45:47 hristov
52 Last minute changes (C.Blume)
54 Revision 1.11 2001/05/11 07:56:12 hristov
55 Consistent declarations needed on Alpha
57 Revision 1.10 2001/05/07 08:08:05 cblume
60 Revision 1.9 2001/03/27 12:48:33 cblume
61 Correct for volume overlaps
63 Revision 1.8 2001/03/13 09:30:35 cblume
64 Update of digitization. Moved digit branch definition to AliTRD
66 Revision 1.7 2001/02/14 18:22:26 cblume
67 Change in the geometry of the padplane
69 Revision 1.6 2000/11/01 14:53:20 cblume
70 Merge with TRD-develop
72 Revision 1.1.4.7 2000/10/16 01:16:53 cblume
73 Changed timebin 0 to be the one closest to the readout
75 Revision 1.1.4.6 2000/10/15 23:35:57 cblume
76 Include geometry constants as static member
78 Revision 1.1.4.5 2000/10/06 16:49:46 cblume
81 Revision 1.1.4.4 2000/10/04 16:34:58 cblume
82 Replace include files by forward declarations
84 Revision 1.1.4.3 2000/09/22 14:43:40 cblume
85 Allow the pad/timebin-dimensions to be changed after initialization
87 Revision 1.1.4.2 2000/09/18 13:37:01 cblume
88 Minor coding corrections
90 Revision 1.5 2000/10/02 21:28:19 fca
91 Removal of useless dependecies via forward declarations
93 Revision 1.4 2000/06/08 18:32:58 cblume
94 Make code compliant to coding conventions
96 Revision 1.3 2000/06/07 16:25:37 cblume
97 Try to remove compiler warnings on Sun and HP
99 Revision 1.2 2000/05/08 16:17:27 cblume
102 Revision 1.1.4.1 2000/05/08 14:45:55 cblume
103 Bug fix in RotateBack(). Geometry update
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.1 2000/02/28 19:00:44 cblume
122 ///////////////////////////////////////////////////////////////////////////////
124 // TRD geometry class //
126 ///////////////////////////////////////////////////////////////////////////////
130 #include "AliTRDgeometry.h"
131 #include "AliTRDparameter.h"
134 ClassImp(AliTRDgeometry)
136 //_____________________________________________________________________________
139 // The geometry constants
141 const Int_t AliTRDgeometry::fgkNsect = kNsect;
142 const Int_t AliTRDgeometry::fgkNplan = kNplan;
143 const Int_t AliTRDgeometry::fgkNcham = kNcham;
144 const Int_t AliTRDgeometry::fgkNdet = kNdet;
147 // Dimensions of the detector
150 // Inner and outer radius of the mother volumes
151 const Float_t AliTRDgeometry::fgkRmin = 294.0;
152 const Float_t AliTRDgeometry::fgkRmax = 368.0;
154 // Upper and lower length of the mother volumes
155 const Float_t AliTRDgeometry::fgkZmax1 = 378.35;
156 const Float_t AliTRDgeometry::fgkZmax2 = 302.0;
158 // Parameter of the BTR mother volumes
159 const Float_t AliTRDgeometry::fgkSheight = 74.0;
160 const Float_t AliTRDgeometry::fgkSwidth1 = 99.613;
161 const Float_t AliTRDgeometry::fgkSwidth2 = 125.707;
162 const Float_t AliTRDgeometry::fgkSlenTR1 = 751.0;
163 const Float_t AliTRDgeometry::fgkSlenTR2 = 313.5;
164 const Float_t AliTRDgeometry::fgkSlenTR3 = 159.5;
166 // Height of different chamber parts
168 const Float_t AliTRDgeometry::fgkCraH = 4.8;
170 const Float_t AliTRDgeometry::fgkCdrH = 3.0;
171 // Amplification region
172 const Float_t AliTRDgeometry::fgkCamH = 0.7;
174 const Float_t AliTRDgeometry::fgkCroH = 2.0;
176 const Float_t AliTRDgeometry::fgkCH = AliTRDgeometry::fgkCraH
177 + AliTRDgeometry::fgkCdrH
178 + AliTRDgeometry::fgkCamH
179 + AliTRDgeometry::fgkCroH;
181 // Vertical spacing of the chambers
182 const Float_t AliTRDgeometry::fgkVspace = 2.1;
184 // Horizontal spacing of the chambers
185 const Float_t AliTRDgeometry::fgkHspace = 2.0;
187 // Thicknesses of different parts of the chamber frame
188 // Lower aluminum frame
189 const Float_t AliTRDgeometry::fgkCalT = 0.3;
190 // Lower G10 frame sides
191 const Float_t AliTRDgeometry::fgkCclsT = 0.3;
192 // Lower G10 frame front
193 const Float_t AliTRDgeometry::fgkCclfT = 1.0;
195 const Float_t AliTRDgeometry::fgkCcuT = 0.9;
197 const Float_t AliTRDgeometry::fgkCauT = 1.5;
199 // Additional width of the readout chamber frames
200 const Float_t AliTRDgeometry::fgkCroW = 0.9;
202 // Difference of outer chamber width and pad plane width
203 const Float_t AliTRDgeometry::fgkCpadW = 1.0;
204 const Float_t AliTRDgeometry::fgkRpadW = 1.5;
207 // Thickness of the the material layers
209 const Float_t AliTRDgeometry::fgkRaThick = 0.3646;
210 const Float_t AliTRDgeometry::fgkMyThick = 0.005;
211 const Float_t AliTRDgeometry::fgkDrThick = AliTRDgeometry::fgkCdrH;
212 const Float_t AliTRDgeometry::fgkAmThick = AliTRDgeometry::fgkCamH;
213 const Float_t AliTRDgeometry::fgkXeThick = AliTRDgeometry::fgkDrThick
214 + AliTRDgeometry::fgkAmThick;
215 const Float_t AliTRDgeometry::fgkCuThick = 0.001;
216 const Float_t AliTRDgeometry::fgkSuThick = 0.06;
217 const Float_t AliTRDgeometry::fgkFeThick = 0.0044;
218 const Float_t AliTRDgeometry::fgkCoThick = 0.02;
219 const Float_t AliTRDgeometry::fgkWaThick = 0.02;
222 // Position of the material layers
224 const Float_t AliTRDgeometry::fgkRaZpos = -1.50;
225 const Float_t AliTRDgeometry::fgkMyZpos = 0.895;
226 const Float_t AliTRDgeometry::fgkDrZpos = 2.4;
227 const Float_t AliTRDgeometry::fgkAmZpos = 0.0;
228 const Float_t AliTRDgeometry::fgkCuZpos = -0.9995;
229 const Float_t AliTRDgeometry::fgkSuZpos = 0.0000;
230 const Float_t AliTRDgeometry::fgkFeZpos = 0.0322;
231 const Float_t AliTRDgeometry::fgkCoZpos = 0.97;
232 const Float_t AliTRDgeometry::fgkWaZpos = 0.99;
234 //_____________________________________________________________________________
235 AliTRDgeometry::AliTRDgeometry():AliGeometry()
238 // AliTRDgeometry default constructor
245 //_____________________________________________________________________________
246 AliTRDgeometry::~AliTRDgeometry()
249 // AliTRDgeometry destructor
254 //_____________________________________________________________________________
255 void AliTRDgeometry::Init()
258 // Initializes the geometry parameter
260 // The maximum number of pads
261 // and the position of pad 0,0,0
263 // chambers seen from the top:
264 // +----------------------------+
270 // +----------------------------+ +------>
272 // chambers seen from the side: ^
273 // +----------------------------+ drift|
276 // +----------------------------+ +------>
279 // IMPORTANT: time bin 0 is now the first one in the drift region
280 // closest to the readout !!!
287 // The outer width of the chambers
295 // The outer lengths of the chambers
296 Float_t length[kNplan][kNcham] = { { 124.0, 124.0, 110.0, 124.0, 124.0 }
297 , { 131.0, 131.0, 110.0, 131.0, 131.0 }
298 , { 138.0, 138.0, 110.0, 138.0, 138.0 }
299 , { 145.0, 145.0, 110.0, 145.0, 145.0 }
300 , { 147.0, 147.0, 110.0, 147.0, 147.0 }
301 , { 147.0, 147.0, 110.0, 147.0, 147.0 } };
303 for (icham = 0; icham < kNcham; icham++) {
304 for (iplan = 0; iplan < kNplan; iplan++) {
305 fClength[iplan][icham] = length[iplan][icham];
306 fClengthPH[iplan][icham] = 0.0;
307 fClengthRH[iplan][icham] = 0.0;
311 // The rotation matrix elements
313 for (isect = 0; isect < fgkNsect; isect++) {
314 phi = -2.0 * TMath::Pi() / (Float_t) fgkNsect * ((Float_t) isect + 0.5);
315 fRotA11[isect] = TMath::Cos(phi);
316 fRotA12[isect] = TMath::Sin(phi);
317 fRotA21[isect] = TMath::Sin(phi);
318 fRotA22[isect] = TMath::Cos(phi);
320 fRotB11[isect] = TMath::Cos(phi);
321 fRotB12[isect] = TMath::Sin(phi);
322 fRotB21[isect] = TMath::Sin(phi);
323 fRotB22[isect] = TMath::Cos(phi);
328 //_____________________________________________________________________________
329 void AliTRDgeometry::CreateGeometry(Int_t *idtmed)
332 // Create TRD geometry
337 //_____________________________________________________________________________
338 Bool_t AliTRDgeometry::Local2Global(Int_t idet, Float_t *local
340 , AliTRDparameter *par) const
343 // Converts local pad-coordinates (row,col,time) into
344 // global ALICE reference frame coordinates (x,y,z)
347 Int_t icham = GetChamber(idet); // Chamber info (0-4)
348 Int_t isect = GetSector(idet); // Sector info (0-17)
349 Int_t iplan = GetPlane(idet); // Plane info (0-5)
351 return Local2Global(iplan,icham,isect,local,global,par);
355 //_____________________________________________________________________________
356 Bool_t AliTRDgeometry::Local2Global(Int_t iplan, Int_t icham, Int_t isect
357 , Float_t *local, Float_t *global
358 , AliTRDparameter *par) const
361 // Converts local pad-coordinates (row,col,time) into
362 // global ALICE reference frame coordinates (x,y,z)
366 Error("Local2Global","No parameter defined\n");
370 Int_t idet = GetDetector(iplan,icham,isect); // Detector number
372 Float_t padRow = local[0]+0.5; // Pad Row position
373 Float_t padCol = local[1]+0.5; // Pad Column position
374 Float_t timeSlice = local[2]+0.5; // Time "position"
376 Float_t row0 = par->GetRow0(iplan,icham,isect);
377 Float_t col0 = par->GetCol0(iplan);
378 Float_t time0 = par->GetTime0(iplan);
382 // calculate (x,y,z) position in rotated chamber
383 rot[0] = time0 - (timeSlice - par->GetTimeBefore())
384 * par->GetTimeBinSize();
385 rot[1] = col0 + padCol
386 * par->GetColPadSize(iplan);
387 rot[2] = row0 + padRow
388 * par->GetRowPadSize(iplan,icham,isect);
390 // Rotate back to original position
391 return RotateBack(idet,rot,global);
395 //_____________________________________________________________________________
396 Bool_t AliTRDgeometry::Rotate(Int_t d, Float_t *pos, Float_t *rot) const
399 // Rotates all chambers in the position of sector 0 and transforms
400 // the coordinates in the ALICE restframe <pos> into the
401 // corresponding local frame <rot>.
404 Int_t sector = GetSector(d);
406 rot[0] = pos[0] * fRotA11[sector] + pos[1] * fRotA12[sector];
407 rot[1] = -pos[0] * fRotA21[sector] + pos[1] * fRotA22[sector];
414 //_____________________________________________________________________________
415 Bool_t AliTRDgeometry::RotateBack(Int_t d, Float_t *rot, Float_t *pos) const
418 // Rotates a chambers from the position of sector 0 into its
419 // original position and transforms the corresponding local frame
420 // coordinates <rot> into the coordinates of the ALICE restframe <pos>.
423 Int_t sector = GetSector(d);
425 pos[0] = rot[0] * fRotB11[sector] + rot[1] * fRotB12[sector];
426 pos[1] = -rot[0] * fRotB21[sector] + rot[1] * fRotB22[sector];
433 //_____________________________________________________________________________
434 Int_t AliTRDgeometry::GetDetectorSec(const Int_t p, const Int_t c) const
437 // Convert plane / chamber into detector number for one single sector
440 return (p + c * fgkNplan);
444 //_____________________________________________________________________________
445 Int_t AliTRDgeometry::GetDetector(const Int_t p, const Int_t c, const Int_t s) const
448 // Convert plane / chamber / sector into detector number
451 return (p + c * fgkNplan + s * fgkNplan * fgkNcham);
455 //_____________________________________________________________________________
456 Int_t AliTRDgeometry::GetPlane(const Int_t d) const
459 // Reconstruct the plane number from the detector number
462 return ((Int_t) (d % fgkNplan));
466 //_____________________________________________________________________________
467 Int_t AliTRDgeometry::GetChamber(const Int_t d) const
470 // Reconstruct the chamber number from the detector number
473 return ((Int_t) (d % (fgkNplan * fgkNcham)) / fgkNplan);
477 //_____________________________________________________________________________
478 Int_t AliTRDgeometry::GetSector(const Int_t d) const
481 // Reconstruct the sector number from the detector number
484 return ((Int_t) (d / (fgkNplan * fgkNcham)));
488 //_____________________________________________________________________________
489 void AliTRDgeometry::SetOldGeometry()
492 // Use the old chamber lengths
498 Float_t length[kNplan][kNcham] = { { 123.5, 123.5, 110.0, 123.5, 123.5 }
499 , { 131.0, 131.0, 110.0, 131.0, 131.0 }
500 , { 134.5, 138.5, 110.0, 138.5, 134.5 }
501 , { 142.0, 146.0, 110.0, 146.0, 142.0 }
502 , { 142.0, 153.0, 110.0, 153.0, 142.0 }
503 , { 134.0, 160.5, 110.0, 160.5, 134.0 } };
505 for (icham = 0; icham < kNcham; icham++) {
506 for (iplan = 0; iplan < kNplan; iplan++) {
507 fClength[iplan][icham] = length[iplan][icham];