Correct for volume overlaps
[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$
b42a9f88 18Revision 1.8 2001/03/13 09:30:35 cblume
19Update of digitization. Moved digit branch definition to AliTRD
20
6244debe 21Revision 1.7 2001/02/14 18:22:26 cblume
22Change in the geometry of the padplane
23
71d9fa7b 24Revision 1.6 2000/11/01 14:53:20 cblume
25Merge with TRD-develop
26
793ff80c 27Revision 1.1.4.7 2000/10/16 01:16:53 cblume
28Changed timebin 0 to be the one closest to the readout
29
30Revision 1.1.4.6 2000/10/15 23:35:57 cblume
31Include geometry constants as static member
32
33Revision 1.1.4.5 2000/10/06 16:49:46 cblume
34Made Getters const
35
36Revision 1.1.4.4 2000/10/04 16:34:58 cblume
37Replace include files by forward declarations
38
39Revision 1.1.4.3 2000/09/22 14:43:40 cblume
40Allow the pad/timebin-dimensions to be changed after initialization
41
42Revision 1.1.4.2 2000/09/18 13:37:01 cblume
43Minor coding corrections
44
45Revision 1.5 2000/10/02 21:28:19 fca
46Removal of useless dependecies via forward declarations
47
48Revision 1.4 2000/06/08 18:32:58 cblume
49Make code compliant to coding conventions
50
51Revision 1.3 2000/06/07 16:25:37 cblume
52Try to remove compiler warnings on Sun and HP
53
54Revision 1.2 2000/05/08 16:17:27 cblume
55Merge TRD-develop
56
57Revision 1.1.4.1 2000/05/08 14:45:55 cblume
58Bug fix in RotateBack(). Geometry update
59
94de3818 60Revision 1.4 2000/06/08 18:32:58 cblume
61Make code compliant to coding conventions
62
8230f242 63Revision 1.3 2000/06/07 16:25:37 cblume
64Try to remove compiler warnings on Sun and HP
65
9d0b222b 66Revision 1.2 2000/05/08 16:17:27 cblume
67Merge TRD-develop
68
6f1e466d 69Revision 1.1.4.1 2000/05/08 14:45:55 cblume
70Bug fix in RotateBack(). Geometry update
71
72Revision 1.1 2000/02/28 19:00:44 cblume
73Add new TRD classes
74
f7336fa3 75*/
76
77///////////////////////////////////////////////////////////////////////////////
78// //
79// TRD geometry class //
80// //
81///////////////////////////////////////////////////////////////////////////////
82
793ff80c 83#include "AliMC.h"
84
f7336fa3 85#include "AliTRDgeometry.h"
86#include "AliTRDrecPoint.h"
94de3818 87#include "AliMC.h"
f7336fa3 88
89ClassImp(AliTRDgeometry)
90
793ff80c 91//_____________________________________________________________________________
92
93 //
94 // The geometry constants
95 //
96 const Int_t AliTRDgeometry::fgkNsect = kNsect;
97 const Int_t AliTRDgeometry::fgkNplan = kNplan;
98 const Int_t AliTRDgeometry::fgkNcham = kNcham;
99 const Int_t AliTRDgeometry::fgkNdet = kNdet;
100
101 //
102 // Dimensions of the detector
103 //
104 const Float_t AliTRDgeometry::fgkRmin = 294.0;
105 const Float_t AliTRDgeometry::fgkRmax = 368.0;
106
107 const Float_t AliTRDgeometry::fgkZmax1 = 378.35;
108 const Float_t AliTRDgeometry::fgkZmax2 = 302.0;
109
110 const Float_t AliTRDgeometry::fgkSheight = 74.0;
111 const Float_t AliTRDgeometry::fgkSwidth1 = 99.613;
112 const Float_t AliTRDgeometry::fgkSwidth2 = 125.707;
113 const Float_t AliTRDgeometry::fgkSlenTR1 = 751.0;
114 const Float_t AliTRDgeometry::fgkSlenTR2 = 313.5;
115 const Float_t AliTRDgeometry::fgkSlenTR3 = 159.5;
116
117 const Float_t AliTRDgeometry::fgkCheight = 11.0;
118 const Float_t AliTRDgeometry::fgkCspace = 1.6;
119 const Float_t AliTRDgeometry::fgkCathick = 1.0;
120 const Float_t AliTRDgeometry::fgkCcthick = 1.0;
121 const Float_t AliTRDgeometry::fgkCaframe = 2.675;
122 const Float_t AliTRDgeometry::fgkCcframe = AliTRDgeometry::fgkCheight
123 - AliTRDgeometry::fgkCaframe;
124
125 //
126 // Thickness of the the material layers
127 //
128 const Float_t AliTRDgeometry::fgkSeThick = 0.02;
b42a9f88 129 const Float_t AliTRDgeometry::fgkRaThick = 4.78;
793ff80c 130 const Float_t AliTRDgeometry::fgkPeThick = 0.20;
131 const Float_t AliTRDgeometry::fgkMyThick = 0.005;
132 const Float_t AliTRDgeometry::fgkXeThick = 3.5;
133 const Float_t AliTRDgeometry::fgkDrThick = 3.0;
134 const Float_t AliTRDgeometry::fgkAmThick = AliTRDgeometry::fgkXeThick
135 - AliTRDgeometry::fgkDrThick;
136 const Float_t AliTRDgeometry::fgkCuThick = 0.001;
137 const Float_t AliTRDgeometry::fgkSuThick = 0.06;
138 const Float_t AliTRDgeometry::fgkFeThick = 0.0044;
139 const Float_t AliTRDgeometry::fgkCoThick = 0.02;
140 const Float_t AliTRDgeometry::fgkWaThick = 0.01;
141
142 //
143 // Position of the material layers
144 //
b42a9f88 145 const Float_t AliTRDgeometry::fgkSeZpos = -4.14;
146 const Float_t AliTRDgeometry::fgkRaZpos = -1.74;
793ff80c 147 const Float_t AliTRDgeometry::fgkPeZpos = 0.0000;
b42a9f88 148 const Float_t AliTRDgeometry::fgkMyZpos = 0.6550;
149 const Float_t AliTRDgeometry::fgkDrZpos = 2.1600;
150 const Float_t AliTRDgeometry::fgkAmZpos = 3.9100;
793ff80c 151 const Float_t AliTRDgeometry::fgkCuZpos = -1.3370;
152 const Float_t AliTRDgeometry::fgkSuZpos = 0.0000;
153 const Float_t AliTRDgeometry::fgkFeZpos = 1.3053;
154 const Float_t AliTRDgeometry::fgkCoZpos = 1.3175;
155 const Float_t AliTRDgeometry::fgkWaZpos = 1.3325;
156
f7336fa3 157//_____________________________________________________________________________
158AliTRDgeometry::AliTRDgeometry():AliGeometry()
159{
160 //
161 // AliTRDgeometry default constructor
162 //
163
164 Init();
165
166}
167
168//_____________________________________________________________________________
169AliTRDgeometry::~AliTRDgeometry()
170{
8230f242 171 //
172 // AliTRDgeometry destructor
173 //
f7336fa3 174
175}
176
177//_____________________________________________________________________________
178void AliTRDgeometry::Init()
179{
180 //
181 // Initializes the geometry parameter
182 //
183
793ff80c 184 Int_t isect;
f7336fa3 185
186 // The width of the chambers
793ff80c 187 fCwidth[0] = 99.6;
188 fCwidth[1] = 104.1;
189 fCwidth[2] = 108.5;
190 fCwidth[3] = 112.9;
191 fCwidth[4] = 117.4;
192 fCwidth[5] = 121.8;
f7336fa3 193
194 // The maximum number of pads
195 // and the position of pad 0,0,0
196 //
197 // chambers seen from the top:
198 // +----------------------------+
199 // | |
793ff80c 200 // | | ^
201 // | | rphi|
202 // | | |
203 // |0 | |
204 // +----------------------------+ +------>
f7336fa3 205 // z
793ff80c 206 // chambers seen from the side: ^
207 // +----------------------------+ drift|
208 // |0 | |
209 // | | |
210 // +----------------------------+ +------>
f7336fa3 211 // z
212 //
793ff80c 213 // IMPORTANT: time bin 0 is now the one closest to the readout !!!
214 //
f7336fa3 215
216 // The pad column (rphi-direction)
71d9fa7b 217 SetNColPad(96);
793ff80c 218
6244debe 219 // The time bucket. Default is 100 ns timbin size
220 SetNTimeBin(15);
793ff80c 221
222 // The rotation matrix elements
223 Float_t phi = 0;
224 for (isect = 0; isect < fgkNsect; isect++) {
225 phi = -2.0 * kPI / (Float_t) fgkNsect * ((Float_t) isect + 0.5);
226 fRotA11[isect] = TMath::Cos(phi);
227 fRotA12[isect] = TMath::Sin(phi);
228 fRotA21[isect] = TMath::Sin(phi);
229 fRotA22[isect] = TMath::Cos(phi);
230 phi = -1.0 * phi;
231 fRotB11[isect] = TMath::Cos(phi);
232 fRotB12[isect] = TMath::Sin(phi);
233 fRotB21[isect] = TMath::Sin(phi);
234 fRotB22[isect] = TMath::Cos(phi);
235 }
236
237}
238
239//_____________________________________________________________________________
71d9fa7b 240void AliTRDgeometry::SetNColPad(Int_t npad)
793ff80c 241{
242 //
71d9fa7b 243 // Redefines the number of pads in column direction
793ff80c 244 //
245
793ff80c 246 for (Int_t iplan = 0; iplan < fgkNplan; iplan++) {
71d9fa7b 247 fColMax[iplan] = npad;
248 fColPadSize[iplan] = (fCwidth[iplan] - 2. * fgkCcthick) / fColMax[iplan];
249 fCol0[iplan] = -fCwidth[iplan]/2. + fgkCcthick;
f7336fa3 250 }
251
793ff80c 252}
253
254//_____________________________________________________________________________
71d9fa7b 255void AliTRDgeometry::SetNTimeBin(Int_t nbin)
793ff80c 256{
257 //
71d9fa7b 258 // Redefines the number of time bins
793ff80c 259 //
260
71d9fa7b 261 fTimeMax = nbin;
262 fTimeBinSize = fgkDrThick / ((Float_t) fTimeMax);
793ff80c 263 for (Int_t iplan = 0; iplan < fgkNplan; iplan++) {
264 fTime0[iplan] = fgkRmin + fgkCcframe/2. + fgkDrZpos + 0.5 * fgkDrThick
265 + iplan * (fgkCheight + fgkCspace);
266 }
f7336fa3 267
268}
269
270//_____________________________________________________________________________
271void AliTRDgeometry::CreateGeometry(Int_t *idtmed)
272{
273 //
274 // Create the TRD geometry
275 //
276 // Author: Christoph Blume (C.Blume@gsi.de) 20/07/99
277 //
278 // The volumes:
279 // TRD1-3 (Air) --- The TRD mother volumes for one sector.
280 // To be placed into the spaceframe.
281 //
282 // UAFI(/M/O) (Al) --- The aluminum frame of the inner(/middle/outer) chambers (readout)
283 // UCFI(/M/O) (C) --- The carbon frame of the inner(/middle/outer) chambers
284 // (driftchamber + radiator)
285 // UAII(/M/O) (Air) --- The inner part of the readout of the inner(/middle/outer) chambers
286 // UFII(/M/O) (Air) --- The inner part of the chamner and radiator of the
287 // inner(/middle/outer) chambers
288 //
289 // The material layers in one chamber:
290 // UL01 (G10) --- The gas seal of the radiator
291 // UL02 (CO2) --- The gas in the radiator
292 // UL03 (PE) --- The foil stack
293 // UL04 (Mylar) --- Entrance window to the driftvolume and HV-cathode
294 // UL05 (Xe) --- The driftvolume
295 // UL06 (Xe) --- The amplification region
296 //
297 // UL07 (Cu) --- The pad plane
298 // UL08 (G10) --- The Nomex honeycomb support structure
299 // UL09 (Cu) --- FEE and signal lines
300 // UL10 (PE) --- The cooling devices
301 // UL11 (Water) --- The cooling water
302
8230f242 303 const Int_t kNparCha = 3;
f7336fa3 304
8230f242 305 Float_t parDum[3];
306 Float_t parCha[kNparCha];
f7336fa3 307
308 Float_t xpos, ypos, zpos;
309
310 // The aluminum frames - readout + electronics (Al)
311 // The inner chambers
8230f242 312 gMC->Gsvolu("UAFI","BOX ",idtmed[1301-1],parDum,0);
f7336fa3 313 // The middle chambers
8230f242 314 gMC->Gsvolu("UAFM","BOX ",idtmed[1301-1],parDum,0);
f7336fa3 315 // The outer chambers
8230f242 316 gMC->Gsvolu("UAFO","BOX ",idtmed[1301-1],parDum,0);
f7336fa3 317
318 // The inner part of the aluminum frames (Air)
319 // The inner chambers
8230f242 320 gMC->Gsvolu("UAII","BOX ",idtmed[1302-1],parDum,0);
f7336fa3 321 // The middle chambers
8230f242 322 gMC->Gsvolu("UAIM","BOX ",idtmed[1302-1],parDum,0);
f7336fa3 323 // The outer chambers
8230f242 324 gMC->Gsvolu("UAIO","BOX ",idtmed[1302-1],parDum,0);
f7336fa3 325
326 // The carbon frames - radiator + driftchamber (C)
327 // The inner chambers
8230f242 328 gMC->Gsvolu("UCFI","BOX ",idtmed[1307-1],parDum,0);
f7336fa3 329 // The middle chambers
8230f242 330 gMC->Gsvolu("UCFM","BOX ",idtmed[1307-1],parDum,0);
f7336fa3 331 // The outer chambers
8230f242 332 gMC->Gsvolu("UCFO","BOX ",idtmed[1307-1],parDum,0);
f7336fa3 333
334 // The inner part of the carbon frames (Air)
335 // The inner chambers
8230f242 336 gMC->Gsvolu("UCII","BOX ",idtmed[1302-1],parDum,0);
f7336fa3 337 // The middle chambers
8230f242 338 gMC->Gsvolu("UCIM","BOX ",idtmed[1302-1],parDum,0);
f7336fa3 339 // The outer chambers
8230f242 340 gMC->Gsvolu("UCIO","BOX ",idtmed[1302-1],parDum,0);
f7336fa3 341
342 // The material layers inside the chambers
8230f242 343 parCha[0] = -1.;
344 parCha[1] = -1.;
f7336fa3 345 // G10 layer (radiator seal)
793ff80c 346 parCha[2] = fgkSeThick/2;
8230f242 347 gMC->Gsvolu("UL01","BOX ",idtmed[1313-1],parCha,kNparCha);
f7336fa3 348 // CO2 layer (radiator)
793ff80c 349 parCha[2] = fgkRaThick/2;
8230f242 350 gMC->Gsvolu("UL02","BOX ",idtmed[1312-1],parCha,kNparCha);
f7336fa3 351 // PE layer (radiator)
793ff80c 352 parCha[2] = fgkPeThick/2;
8230f242 353 gMC->Gsvolu("UL03","BOX ",idtmed[1303-1],parCha,kNparCha);
f7336fa3 354 // Mylar layer (entrance window + HV cathode)
793ff80c 355 parCha[2] = fgkMyThick/2;
8230f242 356 gMC->Gsvolu("UL04","BOX ",idtmed[1308-1],parCha,kNparCha);
f7336fa3 357 // Xe/Isobutane layer (drift volume, sensitive)
793ff80c 358 parCha[2] = fgkDrThick/2.;
8230f242 359 gMC->Gsvolu("UL05","BOX ",idtmed[1309-1],parCha,kNparCha);
f7336fa3 360 // Xe/Isobutane layer (amplification volume, not sensitive)
793ff80c 361 parCha[2] = fgkAmThick/2.;
8230f242 362 gMC->Gsvolu("UL06","BOX ",idtmed[1309-1],parCha,kNparCha);
f7336fa3 363
364 // Cu layer (pad plane)
793ff80c 365 parCha[2] = fgkCuThick/2;
8230f242 366 gMC->Gsvolu("UL07","BOX ",idtmed[1305-1],parCha,kNparCha);
f7336fa3 367 // G10 layer (support structure)
793ff80c 368 parCha[2] = fgkSuThick/2;
8230f242 369 gMC->Gsvolu("UL08","BOX ",idtmed[1313-1],parCha,kNparCha);
f7336fa3 370 // Cu layer (FEE + signal lines)
793ff80c 371 parCha[2] = fgkFeThick/2;
8230f242 372 gMC->Gsvolu("UL09","BOX ",idtmed[1305-1],parCha,kNparCha);
f7336fa3 373 // PE layer (cooling devices)
793ff80c 374 parCha[2] = fgkCoThick/2;
8230f242 375 gMC->Gsvolu("UL10","BOX ",idtmed[1303-1],parCha,kNparCha);
f7336fa3 376 // Water layer (cooling)
793ff80c 377 parCha[2] = fgkWaThick/2;
8230f242 378 gMC->Gsvolu("UL11","BOX ",idtmed[1314-1],parCha,kNparCha);
f7336fa3 379
380 // Position the layers in the chambers
381 xpos = 0;
382 ypos = 0;
383
384 // G10 layer (radiator seal)
793ff80c 385 zpos = fgkSeZpos;
f7336fa3 386 gMC->Gspos("UL01",1,"UCII",xpos,ypos,zpos,0,"ONLY");
387 gMC->Gspos("UL01",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
388 gMC->Gspos("UL01",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
389 // CO2 layer (radiator)
793ff80c 390 zpos = fgkRaZpos;
f7336fa3 391 gMC->Gspos("UL02",1,"UCII",xpos,ypos,zpos,0,"ONLY");
392 gMC->Gspos("UL02",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
393 gMC->Gspos("UL02",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
394 // PE layer (radiator)
395 zpos = 0;
396 gMC->Gspos("UL03",1,"UL02",xpos,ypos,zpos,0,"ONLY");
397 // Mylar layer (entrance window + HV cathode)
793ff80c 398 zpos = fgkMyZpos;
f7336fa3 399 gMC->Gspos("UL04",1,"UCII",xpos,ypos,zpos,0,"ONLY");
400 gMC->Gspos("UL04",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
401 gMC->Gspos("UL04",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
402 // Xe/Isobutane layer (drift volume)
793ff80c 403 zpos = fgkDrZpos;
f7336fa3 404 gMC->Gspos("UL05",1,"UCII",xpos,ypos,zpos,0,"ONLY");
405 gMC->Gspos("UL05",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
406 gMC->Gspos("UL05",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
407 // Xe/Isobutane layer (amplification volume)
793ff80c 408 zpos = fgkAmZpos;
f7336fa3 409 gMC->Gspos("UL06",1,"UCII",xpos,ypos,zpos,0,"ONLY");
410 gMC->Gspos("UL06",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
411 gMC->Gspos("UL06",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
412
413 // Cu layer (pad plane)
793ff80c 414 zpos = fgkCuZpos;
f7336fa3 415 gMC->Gspos("UL07",1,"UAII",xpos,ypos,zpos,0,"ONLY");
416 gMC->Gspos("UL07",2,"UAIM",xpos,ypos,zpos,0,"ONLY");
417 gMC->Gspos("UL07",3,"UAIO",xpos,ypos,zpos,0,"ONLY");
418 // G10 layer (support structure)
793ff80c 419 zpos = fgkSuZpos;
f7336fa3 420 gMC->Gspos("UL08",1,"UAII",xpos,ypos,zpos,0,"ONLY");
421 gMC->Gspos("UL08",2,"UAIM",xpos,ypos,zpos,0,"ONLY");
422 gMC->Gspos("UL08",3,"UAIO",xpos,ypos,zpos,0,"ONLY");
423 // Cu layer (FEE + signal lines)
793ff80c 424 zpos = fgkFeZpos;
f7336fa3 425 gMC->Gspos("UL09",1,"UAII",xpos,ypos,zpos,0,"ONLY");
426 gMC->Gspos("UL09",2,"UAIM",xpos,ypos,zpos,0,"ONLY");
427 gMC->Gspos("UL09",3,"UAIO",xpos,ypos,zpos,0,"ONLY");
428 // PE layer (cooling devices)
793ff80c 429 zpos = fgkCoZpos;
f7336fa3 430 gMC->Gspos("UL10",1,"UAII",xpos,ypos,zpos,0,"ONLY");
431 gMC->Gspos("UL10",2,"UAIM",xpos,ypos,zpos,0,"ONLY");
432 gMC->Gspos("UL10",3,"UAIO",xpos,ypos,zpos,0,"ONLY");
433 // Water layer (cooling)
793ff80c 434 zpos = fgkWaZpos;
f7336fa3 435 gMC->Gspos("UL11",1,"UAII",xpos,ypos,zpos,0,"ONLY");
436 gMC->Gspos("UL11",1,"UAIM",xpos,ypos,zpos,0,"ONLY");
437 gMC->Gspos("UL11",1,"UAIO",xpos,ypos,zpos,0,"ONLY");
438
439}
440
441//_____________________________________________________________________________
94de3818 442Bool_t AliTRDgeometry::Local2Global(Int_t idet, Float_t *local, Float_t *global) const
f7336fa3 443{
444 //
445 // Converts local pad-coordinates (row,col,time) into
446 // global ALICE reference frame coordinates (x,y,z)
447 //
448
793ff80c 449 Int_t icham = GetChamber(idet); // Chamber info (0-4)
450 Int_t isect = GetSector(idet); // Sector info (0-17)
451 Int_t iplan = GetPlane(idet); // Plane info (0-5)
f7336fa3 452
6f1e466d 453 return Local2Global(iplan,icham,isect,local,global);
f7336fa3 454
455}
456
457//_____________________________________________________________________________
458Bool_t AliTRDgeometry::Local2Global(Int_t iplan, Int_t icham, Int_t isect
94de3818 459 , Float_t *local, Float_t *global) const
f7336fa3 460{
461 //
462 // Converts local pad-coordinates (row,col,time) into
463 // global ALICE reference frame coordinates (x,y,z)
464 //
465
793ff80c 466 Int_t idet = GetDetector(iplan,icham,isect); // Detector number
f7336fa3 467
793ff80c 468 Float_t padRow = local[0]; // Pad Row position
469 Float_t padCol = local[1]; // Pad Column position
470 Float_t timeSlice = local[2]; // Time "position"
f7336fa3 471
793ff80c 472 Float_t row0 = GetRow0(iplan,icham,isect);
473 Float_t col0 = GetCol0(iplan);
474 Float_t time0 = GetTime0(iplan);
f7336fa3 475
793ff80c 476 Float_t rot[3];
f7336fa3 477
478 // calculate (x,y,z) position in rotated chamber
71d9fa7b 479 rot[0] = time0 - timeSlice * fTimeBinSize;
480 rot[1] = col0 + padCol * fColPadSize[iplan];
481 rot[2] = row0 + padRow * fRowPadSize[iplan][icham][isect];
f7336fa3 482
483 // Rotate back to original position
484 return RotateBack(idet,rot,global);
485
486}
487
488//_____________________________________________________________________________
793ff80c 489Bool_t AliTRDgeometry::Rotate(Int_t d, Float_t *pos, Float_t *rot) const
f7336fa3 490{
491 //
492 // Rotates all chambers in the position of sector 0 and transforms
493 // the coordinates in the ALICE restframe <pos> into the
494 // corresponding local frame <rot>.
495 //
496
793ff80c 497 Int_t sector = GetSector(d);
f7336fa3 498
793ff80c 499 rot[0] = pos[0] * fRotA11[sector] + pos[1] * fRotA12[sector];
500 rot[1] = -pos[0] * fRotA21[sector] + pos[1] * fRotA22[sector];
f7336fa3 501 rot[2] = pos[2];
502
503 return kTRUE;
504
505}
506
507//_____________________________________________________________________________
94de3818 508Bool_t AliTRDgeometry::RotateBack(Int_t d, Float_t *rot, Float_t *pos) const
f7336fa3 509{
510 //
511 // Rotates a chambers from the position of sector 0 into its
512 // original position and transforms the corresponding local frame
513 // coordinates <rot> into the coordinates of the ALICE restframe <pos>.
514 //
515
793ff80c 516 Int_t sector = GetSector(d);
f7336fa3 517
793ff80c 518 pos[0] = rot[0] * fRotB11[sector] + rot[1] * fRotB12[sector];
519 pos[1] = -rot[0] * fRotB21[sector] + rot[1] * fRotB22[sector];
6f1e466d 520 pos[2] = rot[2];
f7336fa3 521
522 return kTRUE;
523
524}
525
526//_____________________________________________________________________________
94de3818 527Int_t AliTRDgeometry::GetDetector(Int_t p, Int_t c, Int_t s) const
f7336fa3 528{
529 //
530 // Convert plane / chamber / sector into detector number
531 //
532
793ff80c 533 return (p + c * fgkNplan + s * fgkNplan * fgkNcham);
f7336fa3 534
535}
536
537//_____________________________________________________________________________
94de3818 538Int_t AliTRDgeometry::GetPlane(Int_t d) const
f7336fa3 539{
540 //
541 // Reconstruct the plane number from the detector number
542 //
543
793ff80c 544 return ((Int_t) (d % fgkNplan));
f7336fa3 545
546}
547
548//_____________________________________________________________________________
94de3818 549Int_t AliTRDgeometry::GetChamber(Int_t d) const
f7336fa3 550{
551 //
552 // Reconstruct the chamber number from the detector number
553 //
554
793ff80c 555 return ((Int_t) (d % (fgkNplan * fgkNcham)) / fgkNplan);
f7336fa3 556
557}
558
559//_____________________________________________________________________________
94de3818 560Int_t AliTRDgeometry::GetSector(Int_t d) const
f7336fa3 561{
562 //
563 // Reconstruct the sector number from the detector number
564 //
565
793ff80c 566 return ((Int_t) (d / (fgkNplan * fgkNcham)));
f7336fa3 567
568}
569
570//_____________________________________________________________________________
793ff80c 571void AliTRDgeometry::GetGlobal(const AliRecPoint *p, TVector3 &pos
572 , TMatrix &mat) const
f7336fa3 573{
574 //
575 // Returns the global coordinate and error matrix of a AliTRDrecPoint
576 //
577
578 GetGlobal(p,pos);
9d0b222b 579 mat.Zero();
f7336fa3 580
581}
582
583//_____________________________________________________________________________
94de3818 584void AliTRDgeometry::GetGlobal(const AliRecPoint *p, TVector3 &pos) const
f7336fa3 585{
586 //
587 // Returns the global coordinate and error matrix of a AliTRDrecPoint
588 //
589
590 Int_t detector = ((AliTRDrecPoint *) p)->GetDetector();
591
592 Float_t global[3];
593 Float_t local[3];
6f1e466d 594 local[0] = ((AliTRDrecPoint *) p)->GetLocalRow();
595 local[1] = ((AliTRDrecPoint *) p)->GetLocalCol();
596 local[2] = ((AliTRDrecPoint *) p)->GetLocalTime();
f7336fa3 597
598 if (Local2Global(detector,local,global)) {
599 pos.SetX(global[0]);
600 pos.SetY(global[1]);
601 pos.SetZ(global[2]);
602 }
603 else {
604 pos.SetX(0.0);
605 pos.SetY(0.0);
606 pos.SetZ(0.0);
607 }
608
609}