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