1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.1.4.7 2000/10/16 01:16:53 cblume
19 Changed timebin 0 to be the one closest to the readout
21 Revision 1.1.4.6 2000/10/15 23:35:57 cblume
22 Include geometry constants as static member
24 Revision 1.1.4.5 2000/10/06 16:49:46 cblume
27 Revision 1.1.4.4 2000/10/04 16:34:58 cblume
28 Replace include files by forward declarations
30 Revision 1.1.4.3 2000/09/22 14:43:40 cblume
31 Allow the pad/timebin-dimensions to be changed after initialization
33 Revision 1.1.4.2 2000/09/18 13:37:01 cblume
34 Minor coding corrections
36 Revision 1.5 2000/10/02 21:28:19 fca
37 Removal of useless dependecies via forward declarations
39 Revision 1.4 2000/06/08 18:32:58 cblume
40 Make code compliant to coding conventions
42 Revision 1.3 2000/06/07 16:25:37 cblume
43 Try to remove compiler warnings on Sun and HP
45 Revision 1.2 2000/05/08 16:17:27 cblume
48 Revision 1.1.4.1 2000/05/08 14:45:55 cblume
49 Bug fix in RotateBack(). Geometry update
51 Revision 1.4 2000/06/08 18:32:58 cblume
52 Make code compliant to coding conventions
54 Revision 1.3 2000/06/07 16:25:37 cblume
55 Try to remove compiler warnings on Sun and HP
57 Revision 1.2 2000/05/08 16:17:27 cblume
60 Revision 1.1.4.1 2000/05/08 14:45:55 cblume
61 Bug fix in RotateBack(). Geometry update
63 Revision 1.1 2000/02/28 19:00:44 cblume
68 ///////////////////////////////////////////////////////////////////////////////
70 // TRD geometry class //
72 ///////////////////////////////////////////////////////////////////////////////
76 #include "AliTRDgeometry.h"
77 #include "AliTRDrecPoint.h"
80 ClassImp(AliTRDgeometry)
82 //_____________________________________________________________________________
85 // The geometry constants
87 const Int_t AliTRDgeometry::fgkNsect = kNsect;
88 const Int_t AliTRDgeometry::fgkNplan = kNplan;
89 const Int_t AliTRDgeometry::fgkNcham = kNcham;
90 const Int_t AliTRDgeometry::fgkNdet = kNdet;
93 // Dimensions of the detector
95 const Float_t AliTRDgeometry::fgkRmin = 294.0;
96 const Float_t AliTRDgeometry::fgkRmax = 368.0;
98 const Float_t AliTRDgeometry::fgkZmax1 = 378.35;
99 const Float_t AliTRDgeometry::fgkZmax2 = 302.0;
101 const Float_t AliTRDgeometry::fgkSheight = 74.0;
102 const Float_t AliTRDgeometry::fgkSwidth1 = 99.613;
103 const Float_t AliTRDgeometry::fgkSwidth2 = 125.707;
104 const Float_t AliTRDgeometry::fgkSlenTR1 = 751.0;
105 const Float_t AliTRDgeometry::fgkSlenTR2 = 313.5;
106 const Float_t AliTRDgeometry::fgkSlenTR3 = 159.5;
108 const Float_t AliTRDgeometry::fgkCheight = 11.0;
109 const Float_t AliTRDgeometry::fgkCspace = 1.6;
110 const Float_t AliTRDgeometry::fgkCathick = 1.0;
111 const Float_t AliTRDgeometry::fgkCcthick = 1.0;
112 const Float_t AliTRDgeometry::fgkCaframe = 2.675;
113 const Float_t AliTRDgeometry::fgkCcframe = AliTRDgeometry::fgkCheight
114 - AliTRDgeometry::fgkCaframe;
117 // Thickness of the the material layers
119 const Float_t AliTRDgeometry::fgkSeThick = 0.02;
120 const Float_t AliTRDgeometry::fgkRaThick = 4.8;
121 const Float_t AliTRDgeometry::fgkPeThick = 0.20;
122 const Float_t AliTRDgeometry::fgkMyThick = 0.005;
123 const Float_t AliTRDgeometry::fgkXeThick = 3.5;
124 const Float_t AliTRDgeometry::fgkDrThick = 3.0;
125 const Float_t AliTRDgeometry::fgkAmThick = AliTRDgeometry::fgkXeThick
126 - AliTRDgeometry::fgkDrThick;
127 const Float_t AliTRDgeometry::fgkCuThick = 0.001;
128 const Float_t AliTRDgeometry::fgkSuThick = 0.06;
129 const Float_t AliTRDgeometry::fgkFeThick = 0.0044;
130 const Float_t AliTRDgeometry::fgkCoThick = 0.02;
131 const Float_t AliTRDgeometry::fgkWaThick = 0.01;
134 // Position of the material layers
136 const Float_t AliTRDgeometry::fgkSeZpos = -4.1525;
137 const Float_t AliTRDgeometry::fgkRaZpos = -1.7425;
138 const Float_t AliTRDgeometry::fgkPeZpos = 0.0000;
139 const Float_t AliTRDgeometry::fgkMyZpos = 0.6600;
140 const Float_t AliTRDgeometry::fgkDrZpos = 2.1625;
141 const Float_t AliTRDgeometry::fgkAmZpos = 4.1125;
142 const Float_t AliTRDgeometry::fgkCuZpos = -1.3370;
143 const Float_t AliTRDgeometry::fgkSuZpos = 0.0000;
144 const Float_t AliTRDgeometry::fgkFeZpos = 1.3053;
145 const Float_t AliTRDgeometry::fgkCoZpos = 1.3175;
146 const Float_t AliTRDgeometry::fgkWaZpos = 1.3325;
148 //_____________________________________________________________________________
149 AliTRDgeometry::AliTRDgeometry():AliGeometry()
152 // AliTRDgeometry default constructor
159 //_____________________________________________________________________________
160 AliTRDgeometry::~AliTRDgeometry()
163 // AliTRDgeometry destructor
168 //_____________________________________________________________________________
169 void AliTRDgeometry::Init()
172 // Initializes the geometry parameter
177 // The width of the chambers
185 // The maximum number of pads
186 // and the position of pad 0,0,0
188 // chambers seen from the top:
189 // +----------------------------+
195 // +----------------------------+ +------>
197 // chambers seen from the side: ^
198 // +----------------------------+ drift|
201 // +----------------------------+ +------>
204 // IMPORTANT: time bin 0 is now the one closest to the readout !!!
207 // The pad column (rphi-direction)
213 // The rotation matrix elements
215 for (isect = 0; isect < fgkNsect; isect++) {
216 phi = -2.0 * kPI / (Float_t) fgkNsect * ((Float_t) isect + 0.5);
217 fRotA11[isect] = TMath::Cos(phi);
218 fRotA12[isect] = TMath::Sin(phi);
219 fRotA21[isect] = TMath::Sin(phi);
220 fRotA22[isect] = TMath::Cos(phi);
222 fRotB11[isect] = TMath::Cos(phi);
223 fRotB12[isect] = TMath::Sin(phi);
224 fRotB21[isect] = TMath::Sin(phi);
225 fRotB22[isect] = TMath::Cos(phi);
230 //_____________________________________________________________________________
231 void AliTRDgeometry::SetColPadSize(Float_t size)
234 // Redefines the pad size in column direction
238 for (Int_t iplan = 0; iplan < fgkNplan; iplan++) {
239 fColMax[iplan] = 1 + TMath::Nint((fCwidth[iplan] - 2. * fgkCcthick)
240 / fColPadSize - 0.5);
241 fCol0[iplan] = -fCwidth[iplan]/2. + fgkCcthick;
246 //_____________________________________________________________________________
247 void AliTRDgeometry::SetTimeBinSize(Float_t size)
250 // Redefines the time bin size
254 fTimeMax = 1 + TMath::Nint(fgkDrThick / fTimeBinSize - 0.5);
255 for (Int_t iplan = 0; iplan < fgkNplan; iplan++) {
256 fTime0[iplan] = fgkRmin + fgkCcframe/2. + fgkDrZpos + 0.5 * fgkDrThick
257 + iplan * (fgkCheight + fgkCspace);
262 //_____________________________________________________________________________
263 void AliTRDgeometry::CreateGeometry(Int_t *idtmed)
266 // Create the TRD geometry
268 // Author: Christoph Blume (C.Blume@gsi.de) 20/07/99
271 // TRD1-3 (Air) --- The TRD mother volumes for one sector.
272 // To be placed into the spaceframe.
274 // UAFI(/M/O) (Al) --- The aluminum frame of the inner(/middle/outer) chambers (readout)
275 // UCFI(/M/O) (C) --- The carbon frame of the inner(/middle/outer) chambers
276 // (driftchamber + radiator)
277 // UAII(/M/O) (Air) --- The inner part of the readout of the inner(/middle/outer) chambers
278 // UFII(/M/O) (Air) --- The inner part of the chamner and radiator of the
279 // inner(/middle/outer) chambers
281 // The material layers in one chamber:
282 // UL01 (G10) --- The gas seal of the radiator
283 // UL02 (CO2) --- The gas in the radiator
284 // UL03 (PE) --- The foil stack
285 // UL04 (Mylar) --- Entrance window to the driftvolume and HV-cathode
286 // UL05 (Xe) --- The driftvolume
287 // UL06 (Xe) --- The amplification region
289 // UL07 (Cu) --- The pad plane
290 // UL08 (G10) --- The Nomex honeycomb support structure
291 // UL09 (Cu) --- FEE and signal lines
292 // UL10 (PE) --- The cooling devices
293 // UL11 (Water) --- The cooling water
295 const Int_t kNparCha = 3;
298 Float_t parCha[kNparCha];
300 Float_t xpos, ypos, zpos;
302 // The aluminum frames - readout + electronics (Al)
303 // The inner chambers
304 gMC->Gsvolu("UAFI","BOX ",idtmed[1301-1],parDum,0);
305 // The middle chambers
306 gMC->Gsvolu("UAFM","BOX ",idtmed[1301-1],parDum,0);
307 // The outer chambers
308 gMC->Gsvolu("UAFO","BOX ",idtmed[1301-1],parDum,0);
310 // The inner part of the aluminum frames (Air)
311 // The inner chambers
312 gMC->Gsvolu("UAII","BOX ",idtmed[1302-1],parDum,0);
313 // The middle chambers
314 gMC->Gsvolu("UAIM","BOX ",idtmed[1302-1],parDum,0);
315 // The outer chambers
316 gMC->Gsvolu("UAIO","BOX ",idtmed[1302-1],parDum,0);
318 // The carbon frames - radiator + driftchamber (C)
319 // The inner chambers
320 gMC->Gsvolu("UCFI","BOX ",idtmed[1307-1],parDum,0);
321 // The middle chambers
322 gMC->Gsvolu("UCFM","BOX ",idtmed[1307-1],parDum,0);
323 // The outer chambers
324 gMC->Gsvolu("UCFO","BOX ",idtmed[1307-1],parDum,0);
326 // The inner part of the carbon frames (Air)
327 // The inner chambers
328 gMC->Gsvolu("UCII","BOX ",idtmed[1302-1],parDum,0);
329 // The middle chambers
330 gMC->Gsvolu("UCIM","BOX ",idtmed[1302-1],parDum,0);
331 // The outer chambers
332 gMC->Gsvolu("UCIO","BOX ",idtmed[1302-1],parDum,0);
334 // The material layers inside the chambers
337 // G10 layer (radiator seal)
338 parCha[2] = fgkSeThick/2;
339 gMC->Gsvolu("UL01","BOX ",idtmed[1313-1],parCha,kNparCha);
340 // CO2 layer (radiator)
341 parCha[2] = fgkRaThick/2;
342 gMC->Gsvolu("UL02","BOX ",idtmed[1312-1],parCha,kNparCha);
343 // PE layer (radiator)
344 parCha[2] = fgkPeThick/2;
345 gMC->Gsvolu("UL03","BOX ",idtmed[1303-1],parCha,kNparCha);
346 // Mylar layer (entrance window + HV cathode)
347 parCha[2] = fgkMyThick/2;
348 gMC->Gsvolu("UL04","BOX ",idtmed[1308-1],parCha,kNparCha);
349 // Xe/Isobutane layer (drift volume, sensitive)
350 parCha[2] = fgkDrThick/2.;
351 gMC->Gsvolu("UL05","BOX ",idtmed[1309-1],parCha,kNparCha);
352 // Xe/Isobutane layer (amplification volume, not sensitive)
353 parCha[2] = fgkAmThick/2.;
354 gMC->Gsvolu("UL06","BOX ",idtmed[1309-1],parCha,kNparCha);
356 // Cu layer (pad plane)
357 parCha[2] = fgkCuThick/2;
358 gMC->Gsvolu("UL07","BOX ",idtmed[1305-1],parCha,kNparCha);
359 // G10 layer (support structure)
360 parCha[2] = fgkSuThick/2;
361 gMC->Gsvolu("UL08","BOX ",idtmed[1313-1],parCha,kNparCha);
362 // Cu layer (FEE + signal lines)
363 parCha[2] = fgkFeThick/2;
364 gMC->Gsvolu("UL09","BOX ",idtmed[1305-1],parCha,kNparCha);
365 // PE layer (cooling devices)
366 parCha[2] = fgkCoThick/2;
367 gMC->Gsvolu("UL10","BOX ",idtmed[1303-1],parCha,kNparCha);
368 // Water layer (cooling)
369 parCha[2] = fgkWaThick/2;
370 gMC->Gsvolu("UL11","BOX ",idtmed[1314-1],parCha,kNparCha);
372 // Position the layers in the chambers
376 // G10 layer (radiator seal)
378 gMC->Gspos("UL01",1,"UCII",xpos,ypos,zpos,0,"ONLY");
379 gMC->Gspos("UL01",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
380 gMC->Gspos("UL01",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
381 // CO2 layer (radiator)
383 gMC->Gspos("UL02",1,"UCII",xpos,ypos,zpos,0,"ONLY");
384 gMC->Gspos("UL02",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
385 gMC->Gspos("UL02",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
386 // PE layer (radiator)
388 gMC->Gspos("UL03",1,"UL02",xpos,ypos,zpos,0,"ONLY");
389 // Mylar layer (entrance window + HV cathode)
391 gMC->Gspos("UL04",1,"UCII",xpos,ypos,zpos,0,"ONLY");
392 gMC->Gspos("UL04",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
393 gMC->Gspos("UL04",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
394 // Xe/Isobutane layer (drift volume)
396 gMC->Gspos("UL05",1,"UCII",xpos,ypos,zpos,0,"ONLY");
397 gMC->Gspos("UL05",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
398 gMC->Gspos("UL05",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
399 // Xe/Isobutane layer (amplification volume)
401 gMC->Gspos("UL06",1,"UCII",xpos,ypos,zpos,0,"ONLY");
402 gMC->Gspos("UL06",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
403 gMC->Gspos("UL06",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
405 // Cu layer (pad plane)
407 gMC->Gspos("UL07",1,"UAII",xpos,ypos,zpos,0,"ONLY");
408 gMC->Gspos("UL07",2,"UAIM",xpos,ypos,zpos,0,"ONLY");
409 gMC->Gspos("UL07",3,"UAIO",xpos,ypos,zpos,0,"ONLY");
410 // G10 layer (support structure)
412 gMC->Gspos("UL08",1,"UAII",xpos,ypos,zpos,0,"ONLY");
413 gMC->Gspos("UL08",2,"UAIM",xpos,ypos,zpos,0,"ONLY");
414 gMC->Gspos("UL08",3,"UAIO",xpos,ypos,zpos,0,"ONLY");
415 // Cu layer (FEE + signal lines)
417 gMC->Gspos("UL09",1,"UAII",xpos,ypos,zpos,0,"ONLY");
418 gMC->Gspos("UL09",2,"UAIM",xpos,ypos,zpos,0,"ONLY");
419 gMC->Gspos("UL09",3,"UAIO",xpos,ypos,zpos,0,"ONLY");
420 // PE layer (cooling devices)
422 gMC->Gspos("UL10",1,"UAII",xpos,ypos,zpos,0,"ONLY");
423 gMC->Gspos("UL10",2,"UAIM",xpos,ypos,zpos,0,"ONLY");
424 gMC->Gspos("UL10",3,"UAIO",xpos,ypos,zpos,0,"ONLY");
425 // Water layer (cooling)
427 gMC->Gspos("UL11",1,"UAII",xpos,ypos,zpos,0,"ONLY");
428 gMC->Gspos("UL11",1,"UAIM",xpos,ypos,zpos,0,"ONLY");
429 gMC->Gspos("UL11",1,"UAIO",xpos,ypos,zpos,0,"ONLY");
433 //_____________________________________________________________________________
434 Bool_t AliTRDgeometry::Local2Global(Int_t idet, Float_t *local, Float_t *global) const
437 // Converts local pad-coordinates (row,col,time) into
438 // global ALICE reference frame coordinates (x,y,z)
441 Int_t icham = GetChamber(idet); // Chamber info (0-4)
442 Int_t isect = GetSector(idet); // Sector info (0-17)
443 Int_t iplan = GetPlane(idet); // Plane info (0-5)
445 return Local2Global(iplan,icham,isect,local,global);
449 //_____________________________________________________________________________
450 Bool_t AliTRDgeometry::Local2Global(Int_t iplan, Int_t icham, Int_t isect
451 , Float_t *local, Float_t *global) const
454 // Converts local pad-coordinates (row,col,time) into
455 // global ALICE reference frame coordinates (x,y,z)
458 Int_t idet = GetDetector(iplan,icham,isect); // Detector number
460 Float_t padRow = local[0]; // Pad Row position
461 Float_t padCol = local[1]; // Pad Column position
462 Float_t timeSlice = local[2]; // Time "position"
464 Float_t row0 = GetRow0(iplan,icham,isect);
465 Float_t col0 = GetCol0(iplan);
466 Float_t time0 = GetTime0(iplan);
470 // calculate (x,y,z) position in rotated chamber
471 rot[0] = time0 + timeSlice * fTimeBinSize;
472 rot[1] = col0 + padCol * fColPadSize;
473 rot[2] = row0 + padRow * fRowPadSize;
475 // Rotate back to original position
476 return RotateBack(idet,rot,global);
480 //_____________________________________________________________________________
481 Bool_t AliTRDgeometry::Rotate(Int_t d, Float_t *pos, Float_t *rot) const
484 // Rotates all chambers in the position of sector 0 and transforms
485 // the coordinates in the ALICE restframe <pos> into the
486 // corresponding local frame <rot>.
489 Int_t sector = GetSector(d);
491 rot[0] = pos[0] * fRotA11[sector] + pos[1] * fRotA12[sector];
492 rot[1] = -pos[0] * fRotA21[sector] + pos[1] * fRotA22[sector];
499 //_____________________________________________________________________________
500 Bool_t AliTRDgeometry::RotateBack(Int_t d, Float_t *rot, Float_t *pos) const
503 // Rotates a chambers from the position of sector 0 into its
504 // original position and transforms the corresponding local frame
505 // coordinates <rot> into the coordinates of the ALICE restframe <pos>.
508 Int_t sector = GetSector(d);
510 pos[0] = rot[0] * fRotB11[sector] + rot[1] * fRotB12[sector];
511 pos[1] = -rot[0] * fRotB21[sector] + rot[1] * fRotB22[sector];
518 //_____________________________________________________________________________
519 Int_t AliTRDgeometry::GetDetector(Int_t p, Int_t c, Int_t s) const
522 // Convert plane / chamber / sector into detector number
525 return (p + c * fgkNplan + s * fgkNplan * fgkNcham);
529 //_____________________________________________________________________________
530 Int_t AliTRDgeometry::GetPlane(Int_t d) const
533 // Reconstruct the plane number from the detector number
536 return ((Int_t) (d % fgkNplan));
540 //_____________________________________________________________________________
541 Int_t AliTRDgeometry::GetChamber(Int_t d) const
544 // Reconstruct the chamber number from the detector number
547 return ((Int_t) (d % (fgkNplan * fgkNcham)) / fgkNplan);
551 //_____________________________________________________________________________
552 Int_t AliTRDgeometry::GetSector(Int_t d) const
555 // Reconstruct the sector number from the detector number
558 return ((Int_t) (d / (fgkNplan * fgkNcham)));
562 //_____________________________________________________________________________
563 void AliTRDgeometry::GetGlobal(const AliRecPoint *p, TVector3 &pos
564 , TMatrix &mat) const
567 // Returns the global coordinate and error matrix of a AliTRDrecPoint
575 //_____________________________________________________________________________
576 void AliTRDgeometry::GetGlobal(const AliRecPoint *p, TVector3 &pos) const
579 // Returns the global coordinate and error matrix of a AliTRDrecPoint
582 Int_t detector = ((AliTRDrecPoint *) p)->GetDetector();
586 local[0] = ((AliTRDrecPoint *) p)->GetLocalRow();
587 local[1] = ((AliTRDrecPoint *) p)->GetLocalCol();
588 local[2] = ((AliTRDrecPoint *) p)->GetLocalTime();
590 if (Local2Global(detector,local,global)) {