Transition to NewIO
[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
88cb7938 16/* $Id$ */
f7336fa3 17
18///////////////////////////////////////////////////////////////////////////////
19// //
20// TRD geometry class //
21// //
22///////////////////////////////////////////////////////////////////////////////
23
793ff80c 24
f7336fa3 25#include "AliTRDgeometry.h"
5443e65e 26#include "AliTRDparameter.h"
f7336fa3 27
28ClassImp(AliTRDgeometry)
29
30//_____________________________________________________________________________
793ff80c 31
32 //
33 // The geometry constants
34 //
35 const Int_t AliTRDgeometry::fgkNsect = kNsect;
36 const Int_t AliTRDgeometry::fgkNplan = kNplan;
37 const Int_t AliTRDgeometry::fgkNcham = kNcham;
38 const Int_t AliTRDgeometry::fgkNdet = kNdet;
39
40 //
41 // Dimensions of the detector
42 //
0a770ac9 43
44 // Inner and outer radius of the mother volumes
793ff80c 45 const Float_t AliTRDgeometry::fgkRmin = 294.0;
46 const Float_t AliTRDgeometry::fgkRmax = 368.0;
47
0a770ac9 48 // Upper and lower length of the mother volumes
793ff80c 49 const Float_t AliTRDgeometry::fgkZmax1 = 378.35;
50 const Float_t AliTRDgeometry::fgkZmax2 = 302.0;
51
0a770ac9 52 // Parameter of the BTR mother volumes
793ff80c 53 const Float_t AliTRDgeometry::fgkSheight = 74.0;
54 const Float_t AliTRDgeometry::fgkSwidth1 = 99.613;
55 const Float_t AliTRDgeometry::fgkSwidth2 = 125.707;
56 const Float_t AliTRDgeometry::fgkSlenTR1 = 751.0;
57 const Float_t AliTRDgeometry::fgkSlenTR2 = 313.5;
58 const Float_t AliTRDgeometry::fgkSlenTR3 = 159.5;
59
0a770ac9 60 // Height of different chamber parts
61 // Radiator
62 const Float_t AliTRDgeometry::fgkCraH = 4.8;
63 // Drift region
64 const Float_t AliTRDgeometry::fgkCdrH = 3.0;
65 // Amplification region
66 const Float_t AliTRDgeometry::fgkCamH = 0.7;
67 // Readout
68 const Float_t AliTRDgeometry::fgkCroH = 2.0;
69 // Total height
70 const Float_t AliTRDgeometry::fgkCH = AliTRDgeometry::fgkCraH
71 + AliTRDgeometry::fgkCdrH
72 + AliTRDgeometry::fgkCamH
73 + AliTRDgeometry::fgkCroH;
74
75 // Vertical spacing of the chambers
76 const Float_t AliTRDgeometry::fgkVspace = 2.1;
77
78 // Horizontal spacing of the chambers
79 const Float_t AliTRDgeometry::fgkHspace = 2.0;
80
81 // Thicknesses of different parts of the chamber frame
82 // Lower aluminum frame
83 const Float_t AliTRDgeometry::fgkCalT = 0.3;
84 // Lower G10 frame sides
85 const Float_t AliTRDgeometry::fgkCclsT = 0.3;
86 // Lower G10 frame front
87 const Float_t AliTRDgeometry::fgkCclfT = 1.0;
88 // Upper G10 frame
89 const Float_t AliTRDgeometry::fgkCcuT = 0.9;
90 // Upper Al frame
91 const Float_t AliTRDgeometry::fgkCauT = 1.5;
92
93 // Additional width of the readout chamber frames
94 const Float_t AliTRDgeometry::fgkCroW = 0.9;
95
96 // Difference of outer chamber width and pad plane width
97 const Float_t AliTRDgeometry::fgkCpadW = 1.0;
de6df1b1 98 const Float_t AliTRDgeometry::fgkRpadW = 1.0;
793ff80c 99
100 //
101 // Thickness of the the material layers
102 //
db30bf0f 103 const Float_t AliTRDgeometry::fgkRaThick = 0.3646;
793ff80c 104 const Float_t AliTRDgeometry::fgkMyThick = 0.005;
0a770ac9 105 const Float_t AliTRDgeometry::fgkDrThick = AliTRDgeometry::fgkCdrH;
106 const Float_t AliTRDgeometry::fgkAmThick = AliTRDgeometry::fgkCamH;
107 const Float_t AliTRDgeometry::fgkXeThick = AliTRDgeometry::fgkDrThick
108 + AliTRDgeometry::fgkAmThick;
793ff80c 109 const Float_t AliTRDgeometry::fgkCuThick = 0.001;
110 const Float_t AliTRDgeometry::fgkSuThick = 0.06;
111 const Float_t AliTRDgeometry::fgkFeThick = 0.0044;
112 const Float_t AliTRDgeometry::fgkCoThick = 0.02;
db30bf0f 113 const Float_t AliTRDgeometry::fgkWaThick = 0.02;
793ff80c 114
115 //
116 // Position of the material layers
117 //
0a770ac9 118 const Float_t AliTRDgeometry::fgkRaZpos = -1.50;
119 const Float_t AliTRDgeometry::fgkMyZpos = 0.895;
120 const Float_t AliTRDgeometry::fgkDrZpos = 2.4;
121 const Float_t AliTRDgeometry::fgkAmZpos = 0.0;
122 const Float_t AliTRDgeometry::fgkCuZpos = -0.9995;
793ff80c 123 const Float_t AliTRDgeometry::fgkSuZpos = 0.0000;
0a770ac9 124 const Float_t AliTRDgeometry::fgkFeZpos = 0.0322;
125 const Float_t AliTRDgeometry::fgkCoZpos = 0.97;
126 const Float_t AliTRDgeometry::fgkWaZpos = 0.99;
793ff80c 127
128//_____________________________________________________________________________
f7336fa3 129AliTRDgeometry::AliTRDgeometry():AliGeometry()
130{
131 //
132 // AliTRDgeometry default constructor
133 //
134
135 Init();
136
137}
138
139//_____________________________________________________________________________
140AliTRDgeometry::~AliTRDgeometry()
141{
8230f242 142 //
143 // AliTRDgeometry destructor
144 //
f7336fa3 145
146}
147
148//_____________________________________________________________________________
149void AliTRDgeometry::Init()
150{
151 //
152 // Initializes the geometry parameter
153 //
f7336fa3 154 // The maximum number of pads
155 // and the position of pad 0,0,0
156 //
157 // chambers seen from the top:
158 // +----------------------------+
159 // | |
793ff80c 160 // | | ^
161 // | | rphi|
162 // | | |
163 // |0 | |
164 // +----------------------------+ +------>
f7336fa3 165 // z
793ff80c 166 // chambers seen from the side: ^
167 // +----------------------------+ drift|
168 // |0 | |
169 // | | |
170 // +----------------------------+ +------>
f7336fa3 171 // z
172 //
a2b90f83 173 // IMPORTANT: time bin 0 is now the first one in the drift region
174 // closest to the readout !!!
793ff80c 175 //
f7336fa3 176
0a770ac9 177 Int_t icham;
178 Int_t iplan;
179 Int_t isect;
180
181 // The outer width of the chambers
182 fCwidth[0] = 95.6;
183 fCwidth[1] = 100.1;
184 fCwidth[2] = 104.5;
185 fCwidth[3] = 108.9;
186 fCwidth[4] = 113.4;
187 fCwidth[5] = 117.8;
188
189 // The outer lengths of the chambers
8737e16f 190 Float_t length[kNplan][kNcham] = { { 124.0, 124.0, 110.0, 124.0, 124.0 }
191 , { 131.0, 131.0, 110.0, 131.0, 131.0 }
192 , { 138.0, 138.0, 110.0, 138.0, 138.0 }
193 , { 145.0, 145.0, 110.0, 145.0, 145.0 }
194 , { 147.0, 147.0, 110.0, 147.0, 147.0 }
195 , { 147.0, 147.0, 110.0, 147.0, 147.0 } };
0a770ac9 196
197 for (icham = 0; icham < kNcham; icham++) {
198 for (iplan = 0; iplan < kNplan; iplan++) {
199 fClength[iplan][icham] = length[iplan][icham];
200 fClengthPH[iplan][icham] = 0.0;
201 fClengthRH[iplan][icham] = 0.0;
202 }
203 }
204
793ff80c 205 // The rotation matrix elements
206 Float_t phi = 0;
207 for (isect = 0; isect < fgkNsect; isect++) {
5443e65e 208 phi = -2.0 * TMath::Pi() / (Float_t) fgkNsect * ((Float_t) isect + 0.5);
793ff80c 209 fRotA11[isect] = TMath::Cos(phi);
210 fRotA12[isect] = TMath::Sin(phi);
211 fRotA21[isect] = TMath::Sin(phi);
212 fRotA22[isect] = TMath::Cos(phi);
213 phi = -1.0 * phi;
214 fRotB11[isect] = TMath::Cos(phi);
215 fRotB12[isect] = TMath::Sin(phi);
216 fRotB21[isect] = TMath::Sin(phi);
217 fRotB22[isect] = TMath::Cos(phi);
218 }
219
220}
221
222//_____________________________________________________________________________
cbba4394 223void AliTRDgeometry::CreateGeometry(Int_t *idtmed)
f7336fa3 224{
225 //
0a770ac9 226 // Create TRD geometry
227 //
f7336fa3 228
229}
230
231//_____________________________________________________________________________
5443e65e 232Bool_t AliTRDgeometry::Local2Global(Int_t idet, Float_t *local
233 , Float_t *global
234 , AliTRDparameter *par) const
f7336fa3 235{
236 //
237 // Converts local pad-coordinates (row,col,time) into
238 // global ALICE reference frame coordinates (x,y,z)
239 //
240
793ff80c 241 Int_t icham = GetChamber(idet); // Chamber info (0-4)
242 Int_t isect = GetSector(idet); // Sector info (0-17)
243 Int_t iplan = GetPlane(idet); // Plane info (0-5)
f7336fa3 244
5443e65e 245 return Local2Global(iplan,icham,isect,local,global,par);
f7336fa3 246
247}
248
249//_____________________________________________________________________________
250Bool_t AliTRDgeometry::Local2Global(Int_t iplan, Int_t icham, Int_t isect
5443e65e 251 , Float_t *local, Float_t *global
252 , AliTRDparameter *par) const
f7336fa3 253{
254 //
255 // Converts local pad-coordinates (row,col,time) into
256 // global ALICE reference frame coordinates (x,y,z)
257 //
258
5443e65e 259 if (!par) {
260 Error("Local2Global","No parameter defined\n");
261 return kFALSE;
262 }
263
793ff80c 264 Int_t idet = GetDetector(iplan,icham,isect); // Detector number
f7336fa3 265
16bf9884 266 Float_t padRow = local[0]+0.5; // Pad Row position
267 Float_t padCol = local[1]+0.5; // Pad Column position
268 Float_t timeSlice = local[2]+0.5; // Time "position"
f7336fa3 269
5443e65e 270 Float_t row0 = par->GetRow0(iplan,icham,isect);
271 Float_t col0 = par->GetCol0(iplan);
272 Float_t time0 = par->GetTime0(iplan);
f7336fa3 273
793ff80c 274 Float_t rot[3];
f7336fa3 275
276 // calculate (x,y,z) position in rotated chamber
5443e65e 277 rot[0] = time0 - (timeSlice - par->GetTimeBefore())
278 * par->GetTimeBinSize();
279 rot[1] = col0 + padCol
280 * par->GetColPadSize(iplan);
281 rot[2] = row0 + padRow
282 * par->GetRowPadSize(iplan,icham,isect);
f7336fa3 283
284 // Rotate back to original position
285 return RotateBack(idet,rot,global);
286
287}
288
289//_____________________________________________________________________________
793ff80c 290Bool_t AliTRDgeometry::Rotate(Int_t d, Float_t *pos, Float_t *rot) const
f7336fa3 291{
292 //
293 // Rotates all chambers in the position of sector 0 and transforms
294 // the coordinates in the ALICE restframe <pos> into the
295 // corresponding local frame <rot>.
296 //
297
793ff80c 298 Int_t sector = GetSector(d);
f7336fa3 299
793ff80c 300 rot[0] = pos[0] * fRotA11[sector] + pos[1] * fRotA12[sector];
301 rot[1] = -pos[0] * fRotA21[sector] + pos[1] * fRotA22[sector];
f7336fa3 302 rot[2] = pos[2];
303
304 return kTRUE;
305
306}
307
308//_____________________________________________________________________________
94de3818 309Bool_t AliTRDgeometry::RotateBack(Int_t d, Float_t *rot, Float_t *pos) const
f7336fa3 310{
311 //
312 // Rotates a chambers from the position of sector 0 into its
313 // original position and transforms the corresponding local frame
314 // coordinates <rot> into the coordinates of the ALICE restframe <pos>.
315 //
316
793ff80c 317 Int_t sector = GetSector(d);
f7336fa3 318
793ff80c 319 pos[0] = rot[0] * fRotB11[sector] + rot[1] * fRotB12[sector];
320 pos[1] = -rot[0] * fRotB21[sector] + rot[1] * fRotB22[sector];
6f1e466d 321 pos[2] = rot[2];
f7336fa3 322
323 return kTRUE;
324
325}
326
327//_____________________________________________________________________________
0a770ac9 328Int_t AliTRDgeometry::GetDetectorSec(const Int_t p, const Int_t c) const
329{
330 //
331 // Convert plane / chamber into detector number for one single sector
332 //
333
334 return (p + c * fgkNplan);
335
336}
337
338//_____________________________________________________________________________
ff821236 339Int_t AliTRDgeometry::GetDetector(const Int_t p, const Int_t c, const Int_t s) const
f7336fa3 340{
341 //
342 // Convert plane / chamber / sector into detector number
343 //
344
793ff80c 345 return (p + c * fgkNplan + s * fgkNplan * fgkNcham);
f7336fa3 346
347}
348
349//_____________________________________________________________________________
ff821236 350Int_t AliTRDgeometry::GetPlane(const Int_t d) const
f7336fa3 351{
352 //
353 // Reconstruct the plane number from the detector number
354 //
355
793ff80c 356 return ((Int_t) (d % fgkNplan));
f7336fa3 357
358}
359
360//_____________________________________________________________________________
ff821236 361Int_t AliTRDgeometry::GetChamber(const Int_t d) const
f7336fa3 362{
363 //
364 // Reconstruct the chamber number from the detector number
365 //
366
793ff80c 367 return ((Int_t) (d % (fgkNplan * fgkNcham)) / fgkNplan);
f7336fa3 368
369}
370
371//_____________________________________________________________________________
ff821236 372Int_t AliTRDgeometry::GetSector(const Int_t d) const
f7336fa3 373{
374 //
375 // Reconstruct the sector number from the detector number
376 //
377
793ff80c 378 return ((Int_t) (d / (fgkNplan * fgkNcham)));
f7336fa3 379
380}
381
8737e16f 382//_____________________________________________________________________________
383void AliTRDgeometry::SetOldGeometry()
384{
385 //
386 // Use the old chamber lengths
387 //
388
389 Int_t icham;
390 Int_t iplan;
391
392 Float_t length[kNplan][kNcham] = { { 123.5, 123.5, 110.0, 123.5, 123.5 }
393 , { 131.0, 131.0, 110.0, 131.0, 131.0 }
394 , { 134.5, 138.5, 110.0, 138.5, 134.5 }
395 , { 142.0, 146.0, 110.0, 146.0, 142.0 }
396 , { 142.0, 153.0, 110.0, 153.0, 142.0 }
397 , { 134.0, 160.5, 110.0, 160.5, 134.0 } };
398
399 for (icham = 0; icham < kNcham; icham++) {
400 for (iplan = 0; iplan < kNplan; iplan++) {
401 fClength[iplan][icham] = length[iplan][icham];
402 }
403 }
404
405}