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