]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDgeometry.cxx
Only one initializer for a default argument
[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$
9d0b222b 18Revision 1.2 2000/05/08 16:17:27 cblume
19Merge TRD-develop
20
6f1e466d 21Revision 1.1.4.1 2000/05/08 14:45:55 cblume
22Bug fix in RotateBack(). Geometry update
23
24Revision 1.1 2000/02/28 19:00:44 cblume
25Add new TRD classes
26
f7336fa3 27*/
28
29///////////////////////////////////////////////////////////////////////////////
30// //
31// TRD geometry class //
32// //
33///////////////////////////////////////////////////////////////////////////////
34
35#include "AliTRDgeometry.h"
36#include "AliTRDrecPoint.h"
37
38ClassImp(AliTRDgeometry)
39
40//_____________________________________________________________________________
41AliTRDgeometry::AliTRDgeometry():AliGeometry()
42{
43 //
44 // AliTRDgeometry default constructor
45 //
46
47 Init();
48
49}
50
51//_____________________________________________________________________________
52AliTRDgeometry::~AliTRDgeometry()
53{
54
55}
56
57//_____________________________________________________________________________
58void AliTRDgeometry::Init()
59{
60 //
61 // Initializes the geometry parameter
62 //
63
64 Int_t iplan;
65
66 // The width of the chambers
67 fCwidth[0] = 99.6;
68 fCwidth[1] = 104.1;
69 fCwidth[2] = 108.5;
70 fCwidth[3] = 112.9;
71 fCwidth[4] = 117.4;
72 fCwidth[5] = 121.8;
73
74 // The default pad dimensions
75 fRowPadSize = 4.5;
76 fColPadSize = 1.0;
77 fTimeBinSize = 0.1;
78
79 // The maximum number of pads
80 // and the position of pad 0,0,0
81 //
82 // chambers seen from the top:
83 // +----------------------------+
84 // | |
85 // | | ^
86 // | | rphi|
87 // | | |
88 // |0 | |
89 // +----------------------------+ +------>
90 // z
91 // chambers seen from the side: ^
92 // +----------------------------+ time|
93 // | | |
94 // |0 | |
95 // +----------------------------+ +------>
96 // z
97 //
98
99 // The pad column (rphi-direction)
100 for (iplan = 0; iplan < kNplan; iplan++) {
101 fColMax[iplan] = 1 + TMath::Nint((fCwidth[iplan] - 2. * kCcthick)
102 / fColPadSize - 0.5);
103 fCol0[iplan] = -fCwidth[iplan]/2. + kCcthick;
104 }
105
106 // The time bucket
107 fTimeMax = 1 + TMath::Nint(kDrThick / fTimeBinSize - 0.5);
108 for (iplan = 0; iplan < kNplan; iplan++) {
109 fTime0[iplan] = kRmin + kCcframe/2. + kDrZpos - 0.5 * kDrThick
110 + iplan * (kCheight + kCspace);
111 }
112
113}
114
115//_____________________________________________________________________________
116void AliTRDgeometry::CreateGeometry(Int_t *idtmed)
117{
118 //
119 // Create the TRD geometry
120 //
121 // Author: Christoph Blume (C.Blume@gsi.de) 20/07/99
122 //
123 // The volumes:
124 // TRD1-3 (Air) --- The TRD mother volumes for one sector.
125 // To be placed into the spaceframe.
126 //
127 // UAFI(/M/O) (Al) --- The aluminum frame of the inner(/middle/outer) chambers (readout)
128 // UCFI(/M/O) (C) --- The carbon frame of the inner(/middle/outer) chambers
129 // (driftchamber + radiator)
130 // UAII(/M/O) (Air) --- The inner part of the readout of the inner(/middle/outer) chambers
131 // UFII(/M/O) (Air) --- The inner part of the chamner and radiator of the
132 // inner(/middle/outer) chambers
133 //
134 // The material layers in one chamber:
135 // UL01 (G10) --- The gas seal of the radiator
136 // UL02 (CO2) --- The gas in the radiator
137 // UL03 (PE) --- The foil stack
138 // UL04 (Mylar) --- Entrance window to the driftvolume and HV-cathode
139 // UL05 (Xe) --- The driftvolume
140 // UL06 (Xe) --- The amplification region
141 //
142 // UL07 (Cu) --- The pad plane
143 // UL08 (G10) --- The Nomex honeycomb support structure
144 // UL09 (Cu) --- FEE and signal lines
145 // UL10 (PE) --- The cooling devices
146 // UL11 (Water) --- The cooling water
147
148 const Int_t npar_cha = 3;
149
150 Float_t par_dum[3];
151 Float_t par_cha[npar_cha];
152
153 Float_t xpos, ypos, zpos;
154
155 // The aluminum frames - readout + electronics (Al)
156 // The inner chambers
157 gMC->Gsvolu("UAFI","BOX ",idtmed[1301-1],par_dum,0);
158 // The middle chambers
159 gMC->Gsvolu("UAFM","BOX ",idtmed[1301-1],par_dum,0);
160 // The outer chambers
161 gMC->Gsvolu("UAFO","BOX ",idtmed[1301-1],par_dum,0);
162
163 // The inner part of the aluminum frames (Air)
164 // The inner chambers
165 gMC->Gsvolu("UAII","BOX ",idtmed[1302-1],par_dum,0);
166 // The middle chambers
167 gMC->Gsvolu("UAIM","BOX ",idtmed[1302-1],par_dum,0);
168 // The outer chambers
169 gMC->Gsvolu("UAIO","BOX ",idtmed[1302-1],par_dum,0);
170
171 // The carbon frames - radiator + driftchamber (C)
172 // The inner chambers
173 gMC->Gsvolu("UCFI","BOX ",idtmed[1307-1],par_dum,0);
174 // The middle chambers
175 gMC->Gsvolu("UCFM","BOX ",idtmed[1307-1],par_dum,0);
176 // The outer chambers
177 gMC->Gsvolu("UCFO","BOX ",idtmed[1307-1],par_dum,0);
178
179 // The inner part of the carbon frames (Air)
180 // The inner chambers
181 gMC->Gsvolu("UCII","BOX ",idtmed[1302-1],par_dum,0);
182 // The middle chambers
183 gMC->Gsvolu("UCIM","BOX ",idtmed[1302-1],par_dum,0);
184 // The outer chambers
185 gMC->Gsvolu("UCIO","BOX ",idtmed[1302-1],par_dum,0);
186
187 // The material layers inside the chambers
188 par_cha[0] = -1.;
189 par_cha[1] = -1.;
190 // G10 layer (radiator seal)
191 par_cha[2] = kSeThick/2;
192 gMC->Gsvolu("UL01","BOX ",idtmed[1313-1],par_cha,npar_cha);
193 // CO2 layer (radiator)
194 par_cha[2] = kRaThick/2;
195 gMC->Gsvolu("UL02","BOX ",idtmed[1312-1],par_cha,npar_cha);
196 // PE layer (radiator)
197 par_cha[2] = kPeThick/2;
198 gMC->Gsvolu("UL03","BOX ",idtmed[1303-1],par_cha,npar_cha);
199 // Mylar layer (entrance window + HV cathode)
200 par_cha[2] = kMyThick/2;
201 gMC->Gsvolu("UL04","BOX ",idtmed[1308-1],par_cha,npar_cha);
202 // Xe/Isobutane layer (drift volume, sensitive)
203 par_cha[2] = kDrThick/2.;
204 gMC->Gsvolu("UL05","BOX ",idtmed[1309-1],par_cha,npar_cha);
205 // Xe/Isobutane layer (amplification volume, not sensitive)
206 par_cha[2] = kAmThick/2.;
207 gMC->Gsvolu("UL06","BOX ",idtmed[1309-1],par_cha,npar_cha);
208
209 // Cu layer (pad plane)
210 par_cha[2] = kCuThick/2;
211 gMC->Gsvolu("UL07","BOX ",idtmed[1305-1],par_cha,npar_cha);
212 // G10 layer (support structure)
213 par_cha[2] = kSuThick/2;
214 gMC->Gsvolu("UL08","BOX ",idtmed[1313-1],par_cha,npar_cha);
215 // Cu layer (FEE + signal lines)
216 par_cha[2] = kFeThick/2;
217 gMC->Gsvolu("UL09","BOX ",idtmed[1305-1],par_cha,npar_cha);
218 // PE layer (cooling devices)
219 par_cha[2] = kCoThick/2;
220 gMC->Gsvolu("UL10","BOX ",idtmed[1303-1],par_cha,npar_cha);
221 // Water layer (cooling)
222 par_cha[2] = kWaThick/2;
223 gMC->Gsvolu("UL11","BOX ",idtmed[1314-1],par_cha,npar_cha);
224
225 // Position the layers in the chambers
226 xpos = 0;
227 ypos = 0;
228
229 // G10 layer (radiator seal)
230 zpos = kSeZpos;
231 gMC->Gspos("UL01",1,"UCII",xpos,ypos,zpos,0,"ONLY");
232 gMC->Gspos("UL01",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
233 gMC->Gspos("UL01",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
234 // CO2 layer (radiator)
235 zpos = kRaZpos;
236 gMC->Gspos("UL02",1,"UCII",xpos,ypos,zpos,0,"ONLY");
237 gMC->Gspos("UL02",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
238 gMC->Gspos("UL02",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
239 // PE layer (radiator)
240 zpos = 0;
241 gMC->Gspos("UL03",1,"UL02",xpos,ypos,zpos,0,"ONLY");
242 // Mylar layer (entrance window + HV cathode)
243 zpos = kMyZpos;
244 gMC->Gspos("UL04",1,"UCII",xpos,ypos,zpos,0,"ONLY");
245 gMC->Gspos("UL04",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
246 gMC->Gspos("UL04",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
247 // Xe/Isobutane layer (drift volume)
248 zpos = kDrZpos;
249 gMC->Gspos("UL05",1,"UCII",xpos,ypos,zpos,0,"ONLY");
250 gMC->Gspos("UL05",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
251 gMC->Gspos("UL05",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
252 // Xe/Isobutane layer (amplification volume)
253 zpos = kAmZpos;
254 gMC->Gspos("UL06",1,"UCII",xpos,ypos,zpos,0,"ONLY");
255 gMC->Gspos("UL06",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
256 gMC->Gspos("UL06",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
257
258 // Cu layer (pad plane)
259 zpos = kCuZpos;
260 gMC->Gspos("UL07",1,"UAII",xpos,ypos,zpos,0,"ONLY");
261 gMC->Gspos("UL07",2,"UAIM",xpos,ypos,zpos,0,"ONLY");
262 gMC->Gspos("UL07",3,"UAIO",xpos,ypos,zpos,0,"ONLY");
263 // G10 layer (support structure)
264 zpos = kSuZpos;
265 gMC->Gspos("UL08",1,"UAII",xpos,ypos,zpos,0,"ONLY");
266 gMC->Gspos("UL08",2,"UAIM",xpos,ypos,zpos,0,"ONLY");
267 gMC->Gspos("UL08",3,"UAIO",xpos,ypos,zpos,0,"ONLY");
268 // Cu layer (FEE + signal lines)
269 zpos = kFeZpos;
270 gMC->Gspos("UL09",1,"UAII",xpos,ypos,zpos,0,"ONLY");
271 gMC->Gspos("UL09",2,"UAIM",xpos,ypos,zpos,0,"ONLY");
272 gMC->Gspos("UL09",3,"UAIO",xpos,ypos,zpos,0,"ONLY");
273 // PE layer (cooling devices)
274 zpos = kCoZpos;
275 gMC->Gspos("UL10",1,"UAII",xpos,ypos,zpos,0,"ONLY");
276 gMC->Gspos("UL10",2,"UAIM",xpos,ypos,zpos,0,"ONLY");
277 gMC->Gspos("UL10",3,"UAIO",xpos,ypos,zpos,0,"ONLY");
278 // Water layer (cooling)
279 zpos = kWaZpos;
280 gMC->Gspos("UL11",1,"UAII",xpos,ypos,zpos,0,"ONLY");
281 gMC->Gspos("UL11",1,"UAIM",xpos,ypos,zpos,0,"ONLY");
282 gMC->Gspos("UL11",1,"UAIO",xpos,ypos,zpos,0,"ONLY");
283
284}
285
286//_____________________________________________________________________________
287Bool_t AliTRDgeometry::Local2Global(Int_t idet, Float_t *local, Float_t *global)
288{
289 //
290 // Converts local pad-coordinates (row,col,time) into
291 // global ALICE reference frame coordinates (x,y,z)
292 //
293
294 Int_t icham = GetChamber(idet); // Chamber info (0-4)
295 Int_t isect = GetSector(idet); // Sector info (0-17)
296 Int_t iplan = GetPlane(idet); // Plane info (0-5)
297
6f1e466d 298 return Local2Global(iplan,icham,isect,local,global);
f7336fa3 299
300}
301
302//_____________________________________________________________________________
303Bool_t AliTRDgeometry::Local2Global(Int_t iplan, Int_t icham, Int_t isect
304 , Float_t *local, Float_t *global)
305{
306 //
307 // Converts local pad-coordinates (row,col,time) into
308 // global ALICE reference frame coordinates (x,y,z)
309 //
310
311 Int_t idet = GetDetector(iplan,icham,isect); // Detector number
312
313 Float_t padRow = local[0]; // Pad Row position
314 Float_t padCol = local[1]; // Pad Column position
315 Float_t timeSlice = local[2]; // Time "position"
316
317 Float_t row0 = GetRow0(iplan,icham,isect);
318 Float_t col0 = GetCol0(iplan);
319 Float_t time0 = GetTime0(iplan);
320
321 Float_t rot[3];
322
323 // calculate (x,y,z) position in rotated chamber
f7336fa3 324 rot[0] = time0 + timeSlice * fTimeBinSize;
6f1e466d 325 rot[1] = col0 + padCol * fColPadSize;
f7336fa3 326 rot[2] = row0 + padRow * fRowPadSize;
327
328 // Rotate back to original position
329 return RotateBack(idet,rot,global);
330
331}
332
333//_____________________________________________________________________________
334Bool_t AliTRDgeometry::Rotate(Int_t d, Float_t *pos, Float_t *rot)
335{
336 //
337 // Rotates all chambers in the position of sector 0 and transforms
338 // the coordinates in the ALICE restframe <pos> into the
339 // corresponding local frame <rot>.
340 //
341
342 Int_t sector = GetSector(d);
343
344 Float_t phi = -2.0 * kPI / (Float_t) kNsect * ((Float_t) sector + 0.5);
345
346 rot[0] = pos[0] * TMath::Cos(phi) + pos[1] * TMath::Sin(phi);
347 rot[1] = -pos[0] * TMath::Sin(phi) + pos[1] * TMath::Cos(phi);
348 rot[2] = pos[2];
349
350 return kTRUE;
351
352}
353
354//_____________________________________________________________________________
355Bool_t AliTRDgeometry::RotateBack(Int_t d, Float_t *rot, Float_t *pos)
356{
357 //
358 // Rotates a chambers from the position of sector 0 into its
359 // original position and transforms the corresponding local frame
360 // coordinates <rot> into the coordinates of the ALICE restframe <pos>.
361 //
362
363 Int_t sector = GetSector(d);
364
365 Float_t phi = 2.0 * kPI / (Float_t) kNsect * ((Float_t) sector + 0.5);
366
6f1e466d 367 pos[0] = rot[0] * TMath::Cos(phi) + rot[1] * TMath::Sin(phi);
368 pos[1] = -rot[0] * TMath::Sin(phi) + rot[1] * TMath::Cos(phi);
369 pos[2] = rot[2];
f7336fa3 370
371 return kTRUE;
372
373}
374
375//_____________________________________________________________________________
376Int_t AliTRDgeometry::GetDetector(Int_t p, Int_t c, Int_t s)
377{
378 //
379 // Convert plane / chamber / sector into detector number
380 //
381
382 return (p + c * kNplan + s * kNplan * kNcham);
383
384}
385
386//_____________________________________________________________________________
387Int_t AliTRDgeometry::GetPlane(Int_t d)
388{
389 //
390 // Reconstruct the plane number from the detector number
391 //
392
393 return ((Int_t) (d % kNplan));
394
395}
396
397//_____________________________________________________________________________
398Int_t AliTRDgeometry::GetChamber(Int_t d)
399{
400 //
401 // Reconstruct the chamber number from the detector number
402 //
403
404 return ((Int_t) (d % (kNplan * kNcham)) / kNplan);
405
406}
407
408//_____________________________________________________________________________
409Int_t AliTRDgeometry::GetSector(Int_t d)
410{
411 //
412 // Reconstruct the sector number from the detector number
413 //
414
415 return ((Int_t) (d / (kNplan * kNcham)));
416
417}
418
419//_____________________________________________________________________________
420void AliTRDgeometry::GetGlobal(const AliRecPoint *p, TVector3 &pos, TMatrix &mat)
421{
422 //
423 // Returns the global coordinate and error matrix of a AliTRDrecPoint
424 //
425
426 GetGlobal(p,pos);
9d0b222b 427 mat.Zero();
f7336fa3 428
429}
430
431//_____________________________________________________________________________
432void AliTRDgeometry::GetGlobal(const AliRecPoint *p, TVector3 &pos)
433{
434 //
435 // Returns the global coordinate and error matrix of a AliTRDrecPoint
436 //
437
438 Int_t detector = ((AliTRDrecPoint *) p)->GetDetector();
439
440 Float_t global[3];
441 Float_t local[3];
6f1e466d 442 local[0] = ((AliTRDrecPoint *) p)->GetLocalRow();
443 local[1] = ((AliTRDrecPoint *) p)->GetLocalCol();
444 local[2] = ((AliTRDrecPoint *) p)->GetLocalTime();
f7336fa3 445
446 if (Local2Global(detector,local,global)) {
447 pos.SetX(global[0]);
448 pos.SetY(global[1]);
449 pos.SetZ(global[2]);
450 }
451 else {
452 pos.SetX(0.0);
453 pos.SetY(0.0);
454 pos.SetZ(0.0);
455 }
456
457}