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