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