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