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