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