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