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.4 2000/06/08 18:32:58 cblume
19 Make code compliant to coding conventions
21 Revision 1.3 2000/06/07 16:25:37 cblume
22 Try to remove compiler warnings on Sun and HP
24 Revision 1.2 2000/05/08 16:17:27 cblume
27 Revision 1.1.4.1 2000/05/08 14:45:55 cblume
28 Bug fix in RotateBack(). Geometry update
30 Revision 1.1 2000/02/28 19:00:44 cblume
35 ///////////////////////////////////////////////////////////////////////////////
37 // TRD geometry class //
39 ///////////////////////////////////////////////////////////////////////////////
41 #include "AliTRDgeometry.h"
42 #include "AliTRDrecPoint.h"
45 ClassImp(AliTRDgeometry)
47 //_____________________________________________________________________________
48 AliTRDgeometry::AliTRDgeometry():AliGeometry()
51 // AliTRDgeometry default constructor
58 //_____________________________________________________________________________
59 AliTRDgeometry::~AliTRDgeometry()
62 // AliTRDgeometry destructor
67 //_____________________________________________________________________________
68 void AliTRDgeometry::Init()
71 // Initializes the geometry parameter
76 // The width of the chambers
84 // The default pad dimensions
89 // The maximum number of pads
90 // and the position of pad 0,0,0
92 // chambers seen from the top:
93 // +----------------------------+
99 // +----------------------------+ +------>
101 // chambers seen from the side: ^
102 // +----------------------------+ time|
105 // +----------------------------+ +------>
109 // The pad column (rphi-direction)
110 for (iplan = 0; iplan < kNplan; iplan++) {
111 fColMax[iplan] = 1 + TMath::Nint((fCwidth[iplan] - 2. * kCcthick)
112 / fColPadSize - 0.5);
113 fCol0[iplan] = -fCwidth[iplan]/2. + kCcthick;
117 fTimeMax = 1 + TMath::Nint(kDrThick / fTimeBinSize - 0.5);
118 for (iplan = 0; iplan < kNplan; iplan++) {
119 fTime0[iplan] = kRmin + kCcframe/2. + kDrZpos - 0.5 * kDrThick
120 + iplan * (kCheight + kCspace);
125 //_____________________________________________________________________________
126 void AliTRDgeometry::CreateGeometry(Int_t *idtmed)
129 // Create the TRD geometry
131 // Author: Christoph Blume (C.Blume@gsi.de) 20/07/99
134 // TRD1-3 (Air) --- The TRD mother volumes for one sector.
135 // To be placed into the spaceframe.
137 // UAFI(/M/O) (Al) --- The aluminum frame of the inner(/middle/outer) chambers (readout)
138 // UCFI(/M/O) (C) --- The carbon frame of the inner(/middle/outer) chambers
139 // (driftchamber + radiator)
140 // UAII(/M/O) (Air) --- The inner part of the readout of the inner(/middle/outer) chambers
141 // UFII(/M/O) (Air) --- The inner part of the chamner and radiator of the
142 // inner(/middle/outer) chambers
144 // The material layers in one chamber:
145 // UL01 (G10) --- The gas seal of the radiator
146 // UL02 (CO2) --- The gas in the radiator
147 // UL03 (PE) --- The foil stack
148 // UL04 (Mylar) --- Entrance window to the driftvolume and HV-cathode
149 // UL05 (Xe) --- The driftvolume
150 // UL06 (Xe) --- The amplification region
152 // UL07 (Cu) --- The pad plane
153 // UL08 (G10) --- The Nomex honeycomb support structure
154 // UL09 (Cu) --- FEE and signal lines
155 // UL10 (PE) --- The cooling devices
156 // UL11 (Water) --- The cooling water
158 const Int_t kNparCha = 3;
161 Float_t parCha[kNparCha];
163 Float_t xpos, ypos, zpos;
165 // The aluminum frames - readout + electronics (Al)
166 // The inner chambers
167 gMC->Gsvolu("UAFI","BOX ",idtmed[1301-1],parDum,0);
168 // The middle chambers
169 gMC->Gsvolu("UAFM","BOX ",idtmed[1301-1],parDum,0);
170 // The outer chambers
171 gMC->Gsvolu("UAFO","BOX ",idtmed[1301-1],parDum,0);
173 // The inner part of the aluminum frames (Air)
174 // The inner chambers
175 gMC->Gsvolu("UAII","BOX ",idtmed[1302-1],parDum,0);
176 // The middle chambers
177 gMC->Gsvolu("UAIM","BOX ",idtmed[1302-1],parDum,0);
178 // The outer chambers
179 gMC->Gsvolu("UAIO","BOX ",idtmed[1302-1],parDum,0);
181 // The carbon frames - radiator + driftchamber (C)
182 // The inner chambers
183 gMC->Gsvolu("UCFI","BOX ",idtmed[1307-1],parDum,0);
184 // The middle chambers
185 gMC->Gsvolu("UCFM","BOX ",idtmed[1307-1],parDum,0);
186 // The outer chambers
187 gMC->Gsvolu("UCFO","BOX ",idtmed[1307-1],parDum,0);
189 // The inner part of the carbon frames (Air)
190 // The inner chambers
191 gMC->Gsvolu("UCII","BOX ",idtmed[1302-1],parDum,0);
192 // The middle chambers
193 gMC->Gsvolu("UCIM","BOX ",idtmed[1302-1],parDum,0);
194 // The outer chambers
195 gMC->Gsvolu("UCIO","BOX ",idtmed[1302-1],parDum,0);
197 // The material layers inside the chambers
200 // G10 layer (radiator seal)
201 parCha[2] = kSeThick/2;
202 gMC->Gsvolu("UL01","BOX ",idtmed[1313-1],parCha,kNparCha);
203 // CO2 layer (radiator)
204 parCha[2] = kRaThick/2;
205 gMC->Gsvolu("UL02","BOX ",idtmed[1312-1],parCha,kNparCha);
206 // PE layer (radiator)
207 parCha[2] = kPeThick/2;
208 gMC->Gsvolu("UL03","BOX ",idtmed[1303-1],parCha,kNparCha);
209 // Mylar layer (entrance window + HV cathode)
210 parCha[2] = kMyThick/2;
211 gMC->Gsvolu("UL04","BOX ",idtmed[1308-1],parCha,kNparCha);
212 // Xe/Isobutane layer (drift volume, sensitive)
213 parCha[2] = kDrThick/2.;
214 gMC->Gsvolu("UL05","BOX ",idtmed[1309-1],parCha,kNparCha);
215 // Xe/Isobutane layer (amplification volume, not sensitive)
216 parCha[2] = kAmThick/2.;
217 gMC->Gsvolu("UL06","BOX ",idtmed[1309-1],parCha,kNparCha);
219 // Cu layer (pad plane)
220 parCha[2] = kCuThick/2;
221 gMC->Gsvolu("UL07","BOX ",idtmed[1305-1],parCha,kNparCha);
222 // G10 layer (support structure)
223 parCha[2] = kSuThick/2;
224 gMC->Gsvolu("UL08","BOX ",idtmed[1313-1],parCha,kNparCha);
225 // Cu layer (FEE + signal lines)
226 parCha[2] = kFeThick/2;
227 gMC->Gsvolu("UL09","BOX ",idtmed[1305-1],parCha,kNparCha);
228 // PE layer (cooling devices)
229 parCha[2] = kCoThick/2;
230 gMC->Gsvolu("UL10","BOX ",idtmed[1303-1],parCha,kNparCha);
231 // Water layer (cooling)
232 parCha[2] = kWaThick/2;
233 gMC->Gsvolu("UL11","BOX ",idtmed[1314-1],parCha,kNparCha);
235 // Position the layers in the chambers
239 // G10 layer (radiator seal)
241 gMC->Gspos("UL01",1,"UCII",xpos,ypos,zpos,0,"ONLY");
242 gMC->Gspos("UL01",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
243 gMC->Gspos("UL01",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
244 // CO2 layer (radiator)
246 gMC->Gspos("UL02",1,"UCII",xpos,ypos,zpos,0,"ONLY");
247 gMC->Gspos("UL02",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
248 gMC->Gspos("UL02",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
249 // PE layer (radiator)
251 gMC->Gspos("UL03",1,"UL02",xpos,ypos,zpos,0,"ONLY");
252 // Mylar layer (entrance window + HV cathode)
254 gMC->Gspos("UL04",1,"UCII",xpos,ypos,zpos,0,"ONLY");
255 gMC->Gspos("UL04",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
256 gMC->Gspos("UL04",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
257 // Xe/Isobutane layer (drift volume)
259 gMC->Gspos("UL05",1,"UCII",xpos,ypos,zpos,0,"ONLY");
260 gMC->Gspos("UL05",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
261 gMC->Gspos("UL05",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
262 // Xe/Isobutane layer (amplification volume)
264 gMC->Gspos("UL06",1,"UCII",xpos,ypos,zpos,0,"ONLY");
265 gMC->Gspos("UL06",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
266 gMC->Gspos("UL06",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
268 // Cu layer (pad plane)
270 gMC->Gspos("UL07",1,"UAII",xpos,ypos,zpos,0,"ONLY");
271 gMC->Gspos("UL07",2,"UAIM",xpos,ypos,zpos,0,"ONLY");
272 gMC->Gspos("UL07",3,"UAIO",xpos,ypos,zpos,0,"ONLY");
273 // G10 layer (support structure)
275 gMC->Gspos("UL08",1,"UAII",xpos,ypos,zpos,0,"ONLY");
276 gMC->Gspos("UL08",2,"UAIM",xpos,ypos,zpos,0,"ONLY");
277 gMC->Gspos("UL08",3,"UAIO",xpos,ypos,zpos,0,"ONLY");
278 // Cu layer (FEE + signal lines)
280 gMC->Gspos("UL09",1,"UAII",xpos,ypos,zpos,0,"ONLY");
281 gMC->Gspos("UL09",2,"UAIM",xpos,ypos,zpos,0,"ONLY");
282 gMC->Gspos("UL09",3,"UAIO",xpos,ypos,zpos,0,"ONLY");
283 // PE layer (cooling devices)
285 gMC->Gspos("UL10",1,"UAII",xpos,ypos,zpos,0,"ONLY");
286 gMC->Gspos("UL10",2,"UAIM",xpos,ypos,zpos,0,"ONLY");
287 gMC->Gspos("UL10",3,"UAIO",xpos,ypos,zpos,0,"ONLY");
288 // Water layer (cooling)
290 gMC->Gspos("UL11",1,"UAII",xpos,ypos,zpos,0,"ONLY");
291 gMC->Gspos("UL11",1,"UAIM",xpos,ypos,zpos,0,"ONLY");
292 gMC->Gspos("UL11",1,"UAIO",xpos,ypos,zpos,0,"ONLY");
296 //_____________________________________________________________________________
297 Bool_t AliTRDgeometry::Local2Global(Int_t idet, Float_t *local, Float_t *global) const
300 // Converts local pad-coordinates (row,col,time) into
301 // global ALICE reference frame coordinates (x,y,z)
304 Int_t icham = GetChamber(idet); // Chamber info (0-4)
305 Int_t isect = GetSector(idet); // Sector info (0-17)
306 Int_t iplan = GetPlane(idet); // Plane info (0-5)
308 return Local2Global(iplan,icham,isect,local,global);
312 //_____________________________________________________________________________
313 Bool_t AliTRDgeometry::Local2Global(Int_t iplan, Int_t icham, Int_t isect
314 , Float_t *local, Float_t *global) const
317 // Converts local pad-coordinates (row,col,time) into
318 // global ALICE reference frame coordinates (x,y,z)
321 Int_t idet = GetDetector(iplan,icham,isect); // Detector number
323 Float_t padRow = local[0]; // Pad Row position
324 Float_t padCol = local[1]; // Pad Column position
325 Float_t timeSlice = local[2]; // Time "position"
327 Float_t row0 = GetRow0(iplan,icham,isect);
328 Float_t col0 = GetCol0(iplan);
329 Float_t time0 = GetTime0(iplan);
333 // calculate (x,y,z) position in rotated chamber
334 rot[0] = time0 + timeSlice * fTimeBinSize;
335 rot[1] = col0 + padCol * fColPadSize;
336 rot[2] = row0 + padRow * fRowPadSize;
338 // Rotate back to original position
339 return RotateBack(idet,rot,global);
343 //_____________________________________________________________________________
344 Bool_t AliTRDgeometry::Rotate(Int_t d, Float_t *pos, Float_t *rot)
347 // Rotates all chambers in the position of sector 0 and transforms
348 // the coordinates in the ALICE restframe <pos> into the
349 // corresponding local frame <rot>.
352 Int_t sector = GetSector(d);
354 Float_t phi = -2.0 * kPI / (Float_t) kNsect * ((Float_t) sector + 0.5);
356 rot[0] = pos[0] * TMath::Cos(phi) + pos[1] * TMath::Sin(phi);
357 rot[1] = -pos[0] * TMath::Sin(phi) + pos[1] * TMath::Cos(phi);
364 //_____________________________________________________________________________
365 Bool_t AliTRDgeometry::RotateBack(Int_t d, Float_t *rot, Float_t *pos) const
368 // Rotates a chambers from the position of sector 0 into its
369 // original position and transforms the corresponding local frame
370 // coordinates <rot> into the coordinates of the ALICE restframe <pos>.
373 Int_t sector = GetSector(d);
375 Float_t phi = 2.0 * kPI / (Float_t) kNsect * ((Float_t) sector + 0.5);
377 pos[0] = rot[0] * TMath::Cos(phi) + rot[1] * TMath::Sin(phi);
378 pos[1] = -rot[0] * TMath::Sin(phi) + rot[1] * TMath::Cos(phi);
385 //_____________________________________________________________________________
386 Int_t AliTRDgeometry::GetDetector(Int_t p, Int_t c, Int_t s) const
389 // Convert plane / chamber / sector into detector number
392 return (p + c * kNplan + s * kNplan * kNcham);
396 //_____________________________________________________________________________
397 Int_t AliTRDgeometry::GetPlane(Int_t d) const
400 // Reconstruct the plane number from the detector number
403 return ((Int_t) (d % kNplan));
407 //_____________________________________________________________________________
408 Int_t AliTRDgeometry::GetChamber(Int_t d) const
411 // Reconstruct the chamber number from the detector number
414 return ((Int_t) (d % (kNplan * kNcham)) / kNplan);
418 //_____________________________________________________________________________
419 Int_t AliTRDgeometry::GetSector(Int_t d) const
422 // Reconstruct the sector number from the detector number
425 return ((Int_t) (d / (kNplan * kNcham)));
429 //_____________________________________________________________________________
430 void AliTRDgeometry::GetGlobal(const AliRecPoint *p, TVector3 &pos, TMatrix &mat) const
433 // Returns the global coordinate and error matrix of a AliTRDrecPoint
441 //_____________________________________________________________________________
442 void AliTRDgeometry::GetGlobal(const AliRecPoint *p, TVector3 &pos) const
445 // Returns the global coordinate and error matrix of a AliTRDrecPoint
448 Int_t detector = ((AliTRDrecPoint *) p)->GetDetector();
452 local[0] = ((AliTRDrecPoint *) p)->GetLocalRow();
453 local[1] = ((AliTRDrecPoint *) p)->GetLocalCol();
454 local[2] = ((AliTRDrecPoint *) p)->GetLocalTime();
456 if (Local2Global(detector,local,global)) {