New chamber geometry
[u/mrichter/AliRoot.git] / TRD / AliTRDgeometry.cxx
CommitLineData
f7336fa3 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$
8737e16f 18Revision 1.19 2002/10/14 14:57:43 hristov
19Merging the VirtualMC branch to the main development branch (HEAD)
20
b9d0a01d 21Revision 1.15.6.2 2002/07/24 10:09:30 alibrary
22Updating VirtualMC
23
24Revision 1.15.6.1 2002/06/10 15:28:58 hristov
25Merged with v3-08-02
26
27Revision 1.17 2002/04/05 13:20:12 cblume
28Remove const for CreateGeometry
29
30Revision 1.16 2002/03/28 14:59:07 cblume
31Coding conventions
32
33Revision 1.18 2002/06/12 09:54:35 cblume
34Update of tracking code provided by Sergei
35
5443e65e 36Revision 1.17 2002/04/05 13:20:12 cblume
37Remove const for CreateGeometry
38
cbba4394 39Revision 1.16 2002/03/28 14:59:07 cblume
40Coding conventions
41
0a29d0f1 42Revision 1.15 2002/02/11 14:21:16 cblume
43Update of the geometry. Get rid of MANY
44
0a770ac9 45Revision 1.14 2001/11/06 17:19:41 cblume
46Add detailed geometry and simple simulator
47
16bf9884 48Revision 1.13 2001/08/02 08:30:45 cblume
49Fix positions of cooling material
50
52052b58 51Revision 1.12 2001/05/21 16:45:47 hristov
52Last minute changes (C.Blume)
53
db30bf0f 54Revision 1.11 2001/05/11 07:56:12 hristov
55Consistent declarations needed on Alpha
56
ff821236 57Revision 1.10 2001/05/07 08:08:05 cblume
58Update of TRD code
59
a2b90f83 60Revision 1.9 2001/03/27 12:48:33 cblume
61Correct for volume overlaps
62
b42a9f88 63Revision 1.8 2001/03/13 09:30:35 cblume
64Update of digitization. Moved digit branch definition to AliTRD
65
6244debe 66Revision 1.7 2001/02/14 18:22:26 cblume
67Change in the geometry of the padplane
68
71d9fa7b 69Revision 1.6 2000/11/01 14:53:20 cblume
70Merge with TRD-develop
71
793ff80c 72Revision 1.1.4.7 2000/10/16 01:16:53 cblume
73Changed timebin 0 to be the one closest to the readout
74
75Revision 1.1.4.6 2000/10/15 23:35:57 cblume
76Include geometry constants as static member
77
78Revision 1.1.4.5 2000/10/06 16:49:46 cblume
79Made Getters const
80
81Revision 1.1.4.4 2000/10/04 16:34:58 cblume
82Replace include files by forward declarations
83
84Revision 1.1.4.3 2000/09/22 14:43:40 cblume
85Allow the pad/timebin-dimensions to be changed after initialization
86
87Revision 1.1.4.2 2000/09/18 13:37:01 cblume
88Minor coding corrections
89
90Revision 1.5 2000/10/02 21:28:19 fca
91Removal of useless dependecies via forward declarations
92
93Revision 1.4 2000/06/08 18:32:58 cblume
94Make code compliant to coding conventions
95
96Revision 1.3 2000/06/07 16:25:37 cblume
97Try to remove compiler warnings on Sun and HP
98
99Revision 1.2 2000/05/08 16:17:27 cblume
100Merge TRD-develop
101
102Revision 1.1.4.1 2000/05/08 14:45:55 cblume
103Bug fix in RotateBack(). Geometry update
104
94de3818 105Revision 1.4 2000/06/08 18:32:58 cblume
106Make code compliant to coding conventions
107
8230f242 108Revision 1.3 2000/06/07 16:25:37 cblume
109Try to remove compiler warnings on Sun and HP
110
9d0b222b 111Revision 1.2 2000/05/08 16:17:27 cblume
112Merge TRD-develop
113
6f1e466d 114Revision 1.1.4.1 2000/05/08 14:45:55 cblume
115Bug fix in RotateBack(). Geometry update
116
117Revision 1.1 2000/02/28 19:00:44 cblume
118Add new TRD classes
119
f7336fa3 120*/
121
122///////////////////////////////////////////////////////////////////////////////
123// //
124// TRD geometry class //
125// //
126///////////////////////////////////////////////////////////////////////////////
127
793ff80c 128#include "AliMC.h"
129
f7336fa3 130#include "AliTRDgeometry.h"
5443e65e 131#include "AliTRDparameter.h"
94de3818 132#include "AliMC.h"
f7336fa3 133
134ClassImp(AliTRDgeometry)
135
793ff80c 136//_____________________________________________________________________________
137
138 //
139 // The geometry constants
140 //
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;
145
146 //
147 // Dimensions of the detector
148 //
0a770ac9 149
150 // Inner and outer radius of the mother volumes
793ff80c 151 const Float_t AliTRDgeometry::fgkRmin = 294.0;
152 const Float_t AliTRDgeometry::fgkRmax = 368.0;
153
0a770ac9 154 // Upper and lower length of the mother volumes
793ff80c 155 const Float_t AliTRDgeometry::fgkZmax1 = 378.35;
156 const Float_t AliTRDgeometry::fgkZmax2 = 302.0;
157
0a770ac9 158 // Parameter of the BTR mother volumes
793ff80c 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;
165
0a770ac9 166 // Height of different chamber parts
167 // Radiator
168 const Float_t AliTRDgeometry::fgkCraH = 4.8;
169 // Drift region
170 const Float_t AliTRDgeometry::fgkCdrH = 3.0;
171 // Amplification region
172 const Float_t AliTRDgeometry::fgkCamH = 0.7;
173 // Readout
174 const Float_t AliTRDgeometry::fgkCroH = 2.0;
175 // Total height
176 const Float_t AliTRDgeometry::fgkCH = AliTRDgeometry::fgkCraH
177 + AliTRDgeometry::fgkCdrH
178 + AliTRDgeometry::fgkCamH
179 + AliTRDgeometry::fgkCroH;
180
181 // Vertical spacing of the chambers
182 const Float_t AliTRDgeometry::fgkVspace = 2.1;
183
184 // Horizontal spacing of the chambers
185 const Float_t AliTRDgeometry::fgkHspace = 2.0;
186
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;
194 // Upper G10 frame
195 const Float_t AliTRDgeometry::fgkCcuT = 0.9;
196 // Upper Al frame
197 const Float_t AliTRDgeometry::fgkCauT = 1.5;
198
199 // Additional width of the readout chamber frames
200 const Float_t AliTRDgeometry::fgkCroW = 0.9;
201
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;
793ff80c 205
206 //
207 // Thickness of the the material layers
208 //
db30bf0f 209 const Float_t AliTRDgeometry::fgkRaThick = 0.3646;
793ff80c 210 const Float_t AliTRDgeometry::fgkMyThick = 0.005;
0a770ac9 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;
793ff80c 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;
db30bf0f 219 const Float_t AliTRDgeometry::fgkWaThick = 0.02;
793ff80c 220
221 //
222 // Position of the material layers
223 //
0a770ac9 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;
793ff80c 229 const Float_t AliTRDgeometry::fgkSuZpos = 0.0000;
0a770ac9 230 const Float_t AliTRDgeometry::fgkFeZpos = 0.0322;
231 const Float_t AliTRDgeometry::fgkCoZpos = 0.97;
232 const Float_t AliTRDgeometry::fgkWaZpos = 0.99;
793ff80c 233
f7336fa3 234//_____________________________________________________________________________
235AliTRDgeometry::AliTRDgeometry():AliGeometry()
236{
237 //
238 // AliTRDgeometry default constructor
239 //
240
241 Init();
242
243}
244
245//_____________________________________________________________________________
246AliTRDgeometry::~AliTRDgeometry()
247{
8230f242 248 //
249 // AliTRDgeometry destructor
250 //
f7336fa3 251
252}
253
254//_____________________________________________________________________________
255void AliTRDgeometry::Init()
256{
257 //
258 // Initializes the geometry parameter
259 //
f7336fa3 260 // The maximum number of pads
261 // and the position of pad 0,0,0
262 //
263 // chambers seen from the top:
264 // +----------------------------+
265 // | |
793ff80c 266 // | | ^
267 // | | rphi|
268 // | | |
269 // |0 | |
270 // +----------------------------+ +------>
f7336fa3 271 // z
793ff80c 272 // chambers seen from the side: ^
273 // +----------------------------+ drift|
274 // |0 | |
275 // | | |
276 // +----------------------------+ +------>
f7336fa3 277 // z
278 //
a2b90f83 279 // IMPORTANT: time bin 0 is now the first one in the drift region
280 // closest to the readout !!!
793ff80c 281 //
f7336fa3 282
0a770ac9 283 Int_t icham;
284 Int_t iplan;
285 Int_t isect;
286
287 // The outer width of the chambers
288 fCwidth[0] = 95.6;
289 fCwidth[1] = 100.1;
290 fCwidth[2] = 104.5;
291 fCwidth[3] = 108.9;
292 fCwidth[4] = 113.4;
293 fCwidth[5] = 117.8;
294
295 // The outer lengths of the chambers
8737e16f 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 } };
0a770ac9 302
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;
308 }
309 }
310
793ff80c 311 // The rotation matrix elements
312 Float_t phi = 0;
313 for (isect = 0; isect < fgkNsect; isect++) {
5443e65e 314 phi = -2.0 * TMath::Pi() / (Float_t) fgkNsect * ((Float_t) isect + 0.5);
793ff80c 315 fRotA11[isect] = TMath::Cos(phi);
316 fRotA12[isect] = TMath::Sin(phi);
317 fRotA21[isect] = TMath::Sin(phi);
318 fRotA22[isect] = TMath::Cos(phi);
319 phi = -1.0 * 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);
324 }
325
326}
327
f7336fa3 328//_____________________________________________________________________________
cbba4394 329void AliTRDgeometry::CreateGeometry(Int_t *idtmed)
f7336fa3 330{
331 //
0a770ac9 332 // Create TRD geometry
333 //
f7336fa3 334
335}
336
337//_____________________________________________________________________________
5443e65e 338Bool_t AliTRDgeometry::Local2Global(Int_t idet, Float_t *local
339 , Float_t *global
340 , AliTRDparameter *par) const
f7336fa3 341{
342 //
343 // Converts local pad-coordinates (row,col,time) into
344 // global ALICE reference frame coordinates (x,y,z)
345 //
346
793ff80c 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)
f7336fa3 350
5443e65e 351 return Local2Global(iplan,icham,isect,local,global,par);
f7336fa3 352
353}
354
355//_____________________________________________________________________________
356Bool_t AliTRDgeometry::Local2Global(Int_t iplan, Int_t icham, Int_t isect
5443e65e 357 , Float_t *local, Float_t *global
358 , AliTRDparameter *par) const
f7336fa3 359{
360 //
361 // Converts local pad-coordinates (row,col,time) into
362 // global ALICE reference frame coordinates (x,y,z)
363 //
364
5443e65e 365 if (!par) {
366 Error("Local2Global","No parameter defined\n");
367 return kFALSE;
368 }
369
793ff80c 370 Int_t idet = GetDetector(iplan,icham,isect); // Detector number
f7336fa3 371
16bf9884 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"
f7336fa3 375
5443e65e 376 Float_t row0 = par->GetRow0(iplan,icham,isect);
377 Float_t col0 = par->GetCol0(iplan);
378 Float_t time0 = par->GetTime0(iplan);
f7336fa3 379
793ff80c 380 Float_t rot[3];
f7336fa3 381
382 // calculate (x,y,z) position in rotated chamber
5443e65e 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);
f7336fa3 389
390 // Rotate back to original position
391 return RotateBack(idet,rot,global);
392
393}
394
395//_____________________________________________________________________________
793ff80c 396Bool_t AliTRDgeometry::Rotate(Int_t d, Float_t *pos, Float_t *rot) const
f7336fa3 397{
398 //
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>.
402 //
403
793ff80c 404 Int_t sector = GetSector(d);
f7336fa3 405
793ff80c 406 rot[0] = pos[0] * fRotA11[sector] + pos[1] * fRotA12[sector];
407 rot[1] = -pos[0] * fRotA21[sector] + pos[1] * fRotA22[sector];
f7336fa3 408 rot[2] = pos[2];
409
410 return kTRUE;
411
412}
413
414//_____________________________________________________________________________
94de3818 415Bool_t AliTRDgeometry::RotateBack(Int_t d, Float_t *rot, Float_t *pos) const
f7336fa3 416{
417 //
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>.
421 //
422
793ff80c 423 Int_t sector = GetSector(d);
f7336fa3 424
793ff80c 425 pos[0] = rot[0] * fRotB11[sector] + rot[1] * fRotB12[sector];
426 pos[1] = -rot[0] * fRotB21[sector] + rot[1] * fRotB22[sector];
6f1e466d 427 pos[2] = rot[2];
f7336fa3 428
429 return kTRUE;
430
431}
432
433//_____________________________________________________________________________
0a770ac9 434Int_t AliTRDgeometry::GetDetectorSec(const Int_t p, const Int_t c) const
435{
436 //
437 // Convert plane / chamber into detector number for one single sector
438 //
439
440 return (p + c * fgkNplan);
441
442}
443
444//_____________________________________________________________________________
ff821236 445Int_t AliTRDgeometry::GetDetector(const Int_t p, const Int_t c, const Int_t s) const
f7336fa3 446{
447 //
448 // Convert plane / chamber / sector into detector number
449 //
450
793ff80c 451 return (p + c * fgkNplan + s * fgkNplan * fgkNcham);
f7336fa3 452
453}
454
455//_____________________________________________________________________________
ff821236 456Int_t AliTRDgeometry::GetPlane(const Int_t d) const
f7336fa3 457{
458 //
459 // Reconstruct the plane number from the detector number
460 //
461
793ff80c 462 return ((Int_t) (d % fgkNplan));
f7336fa3 463
464}
465
466//_____________________________________________________________________________
ff821236 467Int_t AliTRDgeometry::GetChamber(const Int_t d) const
f7336fa3 468{
469 //
470 // Reconstruct the chamber number from the detector number
471 //
472
793ff80c 473 return ((Int_t) (d % (fgkNplan * fgkNcham)) / fgkNplan);
f7336fa3 474
475}
476
477//_____________________________________________________________________________
ff821236 478Int_t AliTRDgeometry::GetSector(const Int_t d) const
f7336fa3 479{
480 //
481 // Reconstruct the sector number from the detector number
482 //
483
793ff80c 484 return ((Int_t) (d / (fgkNplan * fgkNcham)));
f7336fa3 485
486}
487
8737e16f 488//_____________________________________________________________________________
489void AliTRDgeometry::SetOldGeometry()
490{
491 //
492 // Use the old chamber lengths
493 //
494
495 Int_t icham;
496 Int_t iplan;
497
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 } };
504
505 for (icham = 0; icham < kNcham; icham++) {
506 for (iplan = 0; iplan < kNplan; iplan++) {
507 fClength[iplan][icham] = length[iplan][icham];
508 }
509 }
510
511}