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.6 2000/11/01 14:53:20 cblume
19 Merge with TRD-develop
21 Revision 1.1.4.7 2000/10/16 01:16:53 cblume
22 Changed timebin 0 to be the one closest to the readout
24 Revision 1.1.4.6 2000/10/15 23:35:57 cblume
25 Include geometry constants as static member
27 Revision 1.1.4.5 2000/10/06 16:49:46 cblume
30 Revision 1.1.4.4 2000/10/04 16:34:58 cblume
31 Replace include files by forward declarations
33 Revision 1.1.4.3 2000/09/22 14:43:40 cblume
34 Allow the pad/timebin-dimensions to be changed after initialization
36 Revision 1.1.4.2 2000/09/18 13:37:01 cblume
37 Minor coding corrections
39 Revision 1.5 2000/10/02 21:28:19 fca
40 Removal of useless dependecies via forward declarations
42 Revision 1.4 2000/06/08 18:32:58 cblume
43 Make code compliant to coding conventions
45 Revision 1.3 2000/06/07 16:25:37 cblume
46 Try to remove compiler warnings on Sun and HP
48 Revision 1.2 2000/05/08 16:17:27 cblume
51 Revision 1.1.4.1 2000/05/08 14:45:55 cblume
52 Bug fix in RotateBack(). Geometry update
54 Revision 1.4 2000/06/08 18:32:58 cblume
55 Make code compliant to coding conventions
57 Revision 1.3 2000/06/07 16:25:37 cblume
58 Try to remove compiler warnings on Sun and HP
60 Revision 1.2 2000/05/08 16:17:27 cblume
63 Revision 1.1.4.1 2000/05/08 14:45:55 cblume
64 Bug fix in RotateBack(). Geometry update
66 Revision 1.1 2000/02/28 19:00:44 cblume
71 ///////////////////////////////////////////////////////////////////////////////
73 // TRD geometry class //
75 ///////////////////////////////////////////////////////////////////////////////
79 #include "AliTRDgeometry.h"
80 #include "AliTRDrecPoint.h"
83 ClassImp(AliTRDgeometry)
85 //_____________________________________________________________________________
88 // The geometry constants
90 const Int_t AliTRDgeometry::fgkNsect = kNsect;
91 const Int_t AliTRDgeometry::fgkNplan = kNplan;
92 const Int_t AliTRDgeometry::fgkNcham = kNcham;
93 const Int_t AliTRDgeometry::fgkNdet = kNdet;
96 // Dimensions of the detector
98 const Float_t AliTRDgeometry::fgkRmin = 294.0;
99 const Float_t AliTRDgeometry::fgkRmax = 368.0;
101 const Float_t AliTRDgeometry::fgkZmax1 = 378.35;
102 const Float_t AliTRDgeometry::fgkZmax2 = 302.0;
104 const Float_t AliTRDgeometry::fgkSheight = 74.0;
105 const Float_t AliTRDgeometry::fgkSwidth1 = 99.613;
106 const Float_t AliTRDgeometry::fgkSwidth2 = 125.707;
107 const Float_t AliTRDgeometry::fgkSlenTR1 = 751.0;
108 const Float_t AliTRDgeometry::fgkSlenTR2 = 313.5;
109 const Float_t AliTRDgeometry::fgkSlenTR3 = 159.5;
111 const Float_t AliTRDgeometry::fgkCheight = 11.0;
112 const Float_t AliTRDgeometry::fgkCspace = 1.6;
113 const Float_t AliTRDgeometry::fgkCathick = 1.0;
114 const Float_t AliTRDgeometry::fgkCcthick = 1.0;
115 const Float_t AliTRDgeometry::fgkCaframe = 2.675;
116 const Float_t AliTRDgeometry::fgkCcframe = AliTRDgeometry::fgkCheight
117 - AliTRDgeometry::fgkCaframe;
120 // Thickness of the the material layers
122 const Float_t AliTRDgeometry::fgkSeThick = 0.02;
123 const Float_t AliTRDgeometry::fgkRaThick = 4.8;
124 const Float_t AliTRDgeometry::fgkPeThick = 0.20;
125 const Float_t AliTRDgeometry::fgkMyThick = 0.005;
126 const Float_t AliTRDgeometry::fgkXeThick = 3.5;
127 const Float_t AliTRDgeometry::fgkDrThick = 3.0;
128 const Float_t AliTRDgeometry::fgkAmThick = AliTRDgeometry::fgkXeThick
129 - AliTRDgeometry::fgkDrThick;
130 const Float_t AliTRDgeometry::fgkCuThick = 0.001;
131 const Float_t AliTRDgeometry::fgkSuThick = 0.06;
132 const Float_t AliTRDgeometry::fgkFeThick = 0.0044;
133 const Float_t AliTRDgeometry::fgkCoThick = 0.02;
134 const Float_t AliTRDgeometry::fgkWaThick = 0.01;
137 // Position of the material layers
139 const Float_t AliTRDgeometry::fgkSeZpos = -4.1525;
140 const Float_t AliTRDgeometry::fgkRaZpos = -1.7425;
141 const Float_t AliTRDgeometry::fgkPeZpos = 0.0000;
142 //const Float_t AliTRDgeometry::fgkMyZpos = 0.6600;
143 //const Float_t AliTRDgeometry::fgkDrZpos = 2.1625;
144 const Float_t AliTRDgeometry::fgkMyZpos = 0.8500;
145 const Float_t AliTRDgeometry::fgkDrZpos = 2.3625;
146 const Float_t AliTRDgeometry::fgkAmZpos = 4.1125;
147 const Float_t AliTRDgeometry::fgkCuZpos = -1.3370;
148 const Float_t AliTRDgeometry::fgkSuZpos = 0.0000;
149 const Float_t AliTRDgeometry::fgkFeZpos = 1.3053;
150 const Float_t AliTRDgeometry::fgkCoZpos = 1.3175;
151 const Float_t AliTRDgeometry::fgkWaZpos = 1.3325;
153 //_____________________________________________________________________________
154 AliTRDgeometry::AliTRDgeometry():AliGeometry()
157 // AliTRDgeometry default constructor
164 //_____________________________________________________________________________
165 AliTRDgeometry::~AliTRDgeometry()
168 // AliTRDgeometry destructor
173 //_____________________________________________________________________________
174 void AliTRDgeometry::Init()
177 // Initializes the geometry parameter
182 // The width of the chambers
190 // The maximum number of pads
191 // and the position of pad 0,0,0
193 // chambers seen from the top:
194 // +----------------------------+
200 // +----------------------------+ +------>
202 // chambers seen from the side: ^
203 // +----------------------------+ drift|
206 // +----------------------------+ +------>
209 // IMPORTANT: time bin 0 is now the one closest to the readout !!!
212 // The pad column (rphi-direction)
218 // The rotation matrix elements
220 for (isect = 0; isect < fgkNsect; isect++) {
221 phi = -2.0 * kPI / (Float_t) fgkNsect * ((Float_t) isect + 0.5);
222 fRotA11[isect] = TMath::Cos(phi);
223 fRotA12[isect] = TMath::Sin(phi);
224 fRotA21[isect] = TMath::Sin(phi);
225 fRotA22[isect] = TMath::Cos(phi);
227 fRotB11[isect] = TMath::Cos(phi);
228 fRotB12[isect] = TMath::Sin(phi);
229 fRotB21[isect] = TMath::Sin(phi);
230 fRotB22[isect] = TMath::Cos(phi);
235 //_____________________________________________________________________________
236 void AliTRDgeometry::SetNColPad(Int_t npad)
239 // Redefines the number of pads in column direction
242 for (Int_t iplan = 0; iplan < fgkNplan; iplan++) {
243 fColMax[iplan] = npad;
244 fColPadSize[iplan] = (fCwidth[iplan] - 2. * fgkCcthick) / fColMax[iplan];
245 fCol0[iplan] = -fCwidth[iplan]/2. + fgkCcthick;
250 //_____________________________________________________________________________
251 void AliTRDgeometry::SetNTimeBin(Int_t nbin)
254 // Redefines the number of time bins
258 fTimeBinSize = fgkDrThick / ((Float_t) fTimeMax);
259 for (Int_t iplan = 0; iplan < fgkNplan; iplan++) {
260 fTime0[iplan] = fgkRmin + fgkCcframe/2. + fgkDrZpos + 0.5 * fgkDrThick
261 + iplan * (fgkCheight + fgkCspace);
266 //_____________________________________________________________________________
267 void AliTRDgeometry::CreateGeometry(Int_t *idtmed)
270 // Create the TRD geometry
272 // Author: Christoph Blume (C.Blume@gsi.de) 20/07/99
275 // TRD1-3 (Air) --- The TRD mother volumes for one sector.
276 // To be placed into the spaceframe.
278 // UAFI(/M/O) (Al) --- The aluminum frame of the inner(/middle/outer) chambers (readout)
279 // UCFI(/M/O) (C) --- The carbon frame of the inner(/middle/outer) chambers
280 // (driftchamber + radiator)
281 // UAII(/M/O) (Air) --- The inner part of the readout of the inner(/middle/outer) chambers
282 // UFII(/M/O) (Air) --- The inner part of the chamner and radiator of the
283 // inner(/middle/outer) chambers
285 // The material layers in one chamber:
286 // UL01 (G10) --- The gas seal of the radiator
287 // UL02 (CO2) --- The gas in the radiator
288 // UL03 (PE) --- The foil stack
289 // UL04 (Mylar) --- Entrance window to the driftvolume and HV-cathode
290 // UL05 (Xe) --- The driftvolume
291 // UL06 (Xe) --- The amplification region
293 // UL07 (Cu) --- The pad plane
294 // UL08 (G10) --- The Nomex honeycomb support structure
295 // UL09 (Cu) --- FEE and signal lines
296 // UL10 (PE) --- The cooling devices
297 // UL11 (Water) --- The cooling water
299 const Int_t kNparCha = 3;
302 Float_t parCha[kNparCha];
304 Float_t xpos, ypos, zpos;
306 // The aluminum frames - readout + electronics (Al)
307 // The inner chambers
308 gMC->Gsvolu("UAFI","BOX ",idtmed[1301-1],parDum,0);
309 // The middle chambers
310 gMC->Gsvolu("UAFM","BOX ",idtmed[1301-1],parDum,0);
311 // The outer chambers
312 gMC->Gsvolu("UAFO","BOX ",idtmed[1301-1],parDum,0);
314 // The inner part of the aluminum frames (Air)
315 // The inner chambers
316 gMC->Gsvolu("UAII","BOX ",idtmed[1302-1],parDum,0);
317 // The middle chambers
318 gMC->Gsvolu("UAIM","BOX ",idtmed[1302-1],parDum,0);
319 // The outer chambers
320 gMC->Gsvolu("UAIO","BOX ",idtmed[1302-1],parDum,0);
322 // The carbon frames - radiator + driftchamber (C)
323 // The inner chambers
324 gMC->Gsvolu("UCFI","BOX ",idtmed[1307-1],parDum,0);
325 // The middle chambers
326 gMC->Gsvolu("UCFM","BOX ",idtmed[1307-1],parDum,0);
327 // The outer chambers
328 gMC->Gsvolu("UCFO","BOX ",idtmed[1307-1],parDum,0);
330 // The inner part of the carbon frames (Air)
331 // The inner chambers
332 gMC->Gsvolu("UCII","BOX ",idtmed[1302-1],parDum,0);
333 // The middle chambers
334 gMC->Gsvolu("UCIM","BOX ",idtmed[1302-1],parDum,0);
335 // The outer chambers
336 gMC->Gsvolu("UCIO","BOX ",idtmed[1302-1],parDum,0);
338 // The material layers inside the chambers
341 // G10 layer (radiator seal)
342 parCha[2] = fgkSeThick/2;
343 gMC->Gsvolu("UL01","BOX ",idtmed[1313-1],parCha,kNparCha);
344 // CO2 layer (radiator)
345 parCha[2] = fgkRaThick/2;
346 gMC->Gsvolu("UL02","BOX ",idtmed[1312-1],parCha,kNparCha);
347 // PE layer (radiator)
348 parCha[2] = fgkPeThick/2;
349 gMC->Gsvolu("UL03","BOX ",idtmed[1303-1],parCha,kNparCha);
350 // Mylar layer (entrance window + HV cathode)
351 parCha[2] = fgkMyThick/2;
352 gMC->Gsvolu("UL04","BOX ",idtmed[1308-1],parCha,kNparCha);
353 // Xe/Isobutane layer (drift volume, sensitive)
354 parCha[2] = fgkDrThick/2.;
355 gMC->Gsvolu("UL05","BOX ",idtmed[1309-1],parCha,kNparCha);
356 // Xe/Isobutane layer (amplification volume, not sensitive)
357 parCha[2] = fgkAmThick/2.;
358 gMC->Gsvolu("UL06","BOX ",idtmed[1309-1],parCha,kNparCha);
360 // Cu layer (pad plane)
361 parCha[2] = fgkCuThick/2;
362 gMC->Gsvolu("UL07","BOX ",idtmed[1305-1],parCha,kNparCha);
363 // G10 layer (support structure)
364 parCha[2] = fgkSuThick/2;
365 gMC->Gsvolu("UL08","BOX ",idtmed[1313-1],parCha,kNparCha);
366 // Cu layer (FEE + signal lines)
367 parCha[2] = fgkFeThick/2;
368 gMC->Gsvolu("UL09","BOX ",idtmed[1305-1],parCha,kNparCha);
369 // PE layer (cooling devices)
370 parCha[2] = fgkCoThick/2;
371 gMC->Gsvolu("UL10","BOX ",idtmed[1303-1],parCha,kNparCha);
372 // Water layer (cooling)
373 parCha[2] = fgkWaThick/2;
374 gMC->Gsvolu("UL11","BOX ",idtmed[1314-1],parCha,kNparCha);
376 // Position the layers in the chambers
380 // G10 layer (radiator seal)
382 gMC->Gspos("UL01",1,"UCII",xpos,ypos,zpos,0,"ONLY");
383 gMC->Gspos("UL01",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
384 gMC->Gspos("UL01",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
385 // CO2 layer (radiator)
387 gMC->Gspos("UL02",1,"UCII",xpos,ypos,zpos,0,"ONLY");
388 gMC->Gspos("UL02",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
389 gMC->Gspos("UL02",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
390 // PE layer (radiator)
392 gMC->Gspos("UL03",1,"UL02",xpos,ypos,zpos,0,"ONLY");
393 // Mylar layer (entrance window + HV cathode)
395 gMC->Gspos("UL04",1,"UCII",xpos,ypos,zpos,0,"ONLY");
396 gMC->Gspos("UL04",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
397 gMC->Gspos("UL04",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
398 // Xe/Isobutane layer (drift volume)
400 gMC->Gspos("UL05",1,"UCII",xpos,ypos,zpos,0,"ONLY");
401 gMC->Gspos("UL05",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
402 gMC->Gspos("UL05",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
403 // Xe/Isobutane layer (amplification volume)
405 gMC->Gspos("UL06",1,"UCII",xpos,ypos,zpos,0,"ONLY");
406 gMC->Gspos("UL06",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
407 gMC->Gspos("UL06",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
409 // Cu layer (pad plane)
411 gMC->Gspos("UL07",1,"UAII",xpos,ypos,zpos,0,"ONLY");
412 gMC->Gspos("UL07",2,"UAIM",xpos,ypos,zpos,0,"ONLY");
413 gMC->Gspos("UL07",3,"UAIO",xpos,ypos,zpos,0,"ONLY");
414 // G10 layer (support structure)
416 gMC->Gspos("UL08",1,"UAII",xpos,ypos,zpos,0,"ONLY");
417 gMC->Gspos("UL08",2,"UAIM",xpos,ypos,zpos,0,"ONLY");
418 gMC->Gspos("UL08",3,"UAIO",xpos,ypos,zpos,0,"ONLY");
419 // Cu layer (FEE + signal lines)
421 gMC->Gspos("UL09",1,"UAII",xpos,ypos,zpos,0,"ONLY");
422 gMC->Gspos("UL09",2,"UAIM",xpos,ypos,zpos,0,"ONLY");
423 gMC->Gspos("UL09",3,"UAIO",xpos,ypos,zpos,0,"ONLY");
424 // PE layer (cooling devices)
426 gMC->Gspos("UL10",1,"UAII",xpos,ypos,zpos,0,"ONLY");
427 gMC->Gspos("UL10",2,"UAIM",xpos,ypos,zpos,0,"ONLY");
428 gMC->Gspos("UL10",3,"UAIO",xpos,ypos,zpos,0,"ONLY");
429 // Water layer (cooling)
431 gMC->Gspos("UL11",1,"UAII",xpos,ypos,zpos,0,"ONLY");
432 gMC->Gspos("UL11",1,"UAIM",xpos,ypos,zpos,0,"ONLY");
433 gMC->Gspos("UL11",1,"UAIO",xpos,ypos,zpos,0,"ONLY");
437 //_____________________________________________________________________________
438 Bool_t AliTRDgeometry::Local2Global(Int_t idet, Float_t *local, Float_t *global) const
441 // Converts local pad-coordinates (row,col,time) into
442 // global ALICE reference frame coordinates (x,y,z)
445 Int_t icham = GetChamber(idet); // Chamber info (0-4)
446 Int_t isect = GetSector(idet); // Sector info (0-17)
447 Int_t iplan = GetPlane(idet); // Plane info (0-5)
449 return Local2Global(iplan,icham,isect,local,global);
453 //_____________________________________________________________________________
454 Bool_t AliTRDgeometry::Local2Global(Int_t iplan, Int_t icham, Int_t isect
455 , Float_t *local, Float_t *global) const
458 // Converts local pad-coordinates (row,col,time) into
459 // global ALICE reference frame coordinates (x,y,z)
462 Int_t idet = GetDetector(iplan,icham,isect); // Detector number
464 Float_t padRow = local[0]; // Pad Row position
465 Float_t padCol = local[1]; // Pad Column position
466 Float_t timeSlice = local[2]; // Time "position"
468 Float_t row0 = GetRow0(iplan,icham,isect);
469 Float_t col0 = GetCol0(iplan);
470 Float_t time0 = GetTime0(iplan);
474 // calculate (x,y,z) position in rotated chamber
475 rot[0] = time0 - timeSlice * fTimeBinSize;
476 rot[1] = col0 + padCol * fColPadSize[iplan];
477 rot[2] = row0 + padRow * fRowPadSize[iplan][icham][isect];
479 // Rotate back to original position
480 return RotateBack(idet,rot,global);
484 //_____________________________________________________________________________
485 Bool_t AliTRDgeometry::Rotate(Int_t d, Float_t *pos, Float_t *rot) const
488 // Rotates all chambers in the position of sector 0 and transforms
489 // the coordinates in the ALICE restframe <pos> into the
490 // corresponding local frame <rot>.
493 Int_t sector = GetSector(d);
495 rot[0] = pos[0] * fRotA11[sector] + pos[1] * fRotA12[sector];
496 rot[1] = -pos[0] * fRotA21[sector] + pos[1] * fRotA22[sector];
503 //_____________________________________________________________________________
504 Bool_t AliTRDgeometry::RotateBack(Int_t d, Float_t *rot, Float_t *pos) const
507 // Rotates a chambers from the position of sector 0 into its
508 // original position and transforms the corresponding local frame
509 // coordinates <rot> into the coordinates of the ALICE restframe <pos>.
512 Int_t sector = GetSector(d);
514 pos[0] = rot[0] * fRotB11[sector] + rot[1] * fRotB12[sector];
515 pos[1] = -rot[0] * fRotB21[sector] + rot[1] * fRotB22[sector];
522 //_____________________________________________________________________________
523 Int_t AliTRDgeometry::GetDetector(Int_t p, Int_t c, Int_t s) const
526 // Convert plane / chamber / sector into detector number
529 return (p + c * fgkNplan + s * fgkNplan * fgkNcham);
533 //_____________________________________________________________________________
534 Int_t AliTRDgeometry::GetPlane(Int_t d) const
537 // Reconstruct the plane number from the detector number
540 return ((Int_t) (d % fgkNplan));
544 //_____________________________________________________________________________
545 Int_t AliTRDgeometry::GetChamber(Int_t d) const
548 // Reconstruct the chamber number from the detector number
551 return ((Int_t) (d % (fgkNplan * fgkNcham)) / fgkNplan);
555 //_____________________________________________________________________________
556 Int_t AliTRDgeometry::GetSector(Int_t d) const
559 // Reconstruct the sector number from the detector number
562 return ((Int_t) (d / (fgkNplan * fgkNcham)));
566 //_____________________________________________________________________________
567 void AliTRDgeometry::GetGlobal(const AliRecPoint *p, TVector3 &pos
568 , TMatrix &mat) const
571 // Returns the global coordinate and error matrix of a AliTRDrecPoint
579 //_____________________________________________________________________________
580 void AliTRDgeometry::GetGlobal(const AliRecPoint *p, TVector3 &pos) const
583 // Returns the global coordinate and error matrix of a AliTRDrecPoint
586 Int_t detector = ((AliTRDrecPoint *) p)->GetDetector();
590 local[0] = ((AliTRDrecPoint *) p)->GetLocalRow();
591 local[1] = ((AliTRDrecPoint *) p)->GetLocalCol();
592 local[2] = ((AliTRDrecPoint *) p)->GetLocalTime();
594 if (Local2Global(detector,local,global)) {