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