]>
Commit | Line | Data |
---|---|---|
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 | ||
afc51ac2 | 16 | /* $Id$ */ |
f7336fa3 | 17 | |
18 | /////////////////////////////////////////////////////////////////////////////// | |
19 | // // | |
20 | // TRD geometry class // | |
21 | // // | |
22 | /////////////////////////////////////////////////////////////////////////////// | |
23 | ||
793ff80c | 24 | |
bdbb05bb | 25 | #include <TError.h> |
26 | ||
27 | #include "AliRunLoader.h" | |
f7336fa3 | 28 | #include "AliTRDgeometry.h" |
5443e65e | 29 | #include "AliTRDparameter.h" |
a5cadd36 | 30 | #include "AliTRDpadPlane.h" |
f7336fa3 | 31 | |
ecb36af7 | 32 | #include "AliRun.h" |
33 | #include "AliTRD.h" | |
3551db50 | 34 | #include "AliTRDcalibDB.h" |
35 | #include "AliTRDCommonParam.h" | |
ecb36af7 | 36 | |
f7336fa3 | 37 | ClassImp(AliTRDgeometry) |
38 | ||
793ff80c | 39 | //_____________________________________________________________________________ |
40 | ||
41 | // | |
42 | // The geometry constants | |
43 | // | |
44 | const Int_t AliTRDgeometry::fgkNsect = kNsect; | |
45 | const Int_t AliTRDgeometry::fgkNplan = kNplan; | |
46 | const Int_t AliTRDgeometry::fgkNcham = kNcham; | |
47 | const Int_t AliTRDgeometry::fgkNdet = kNdet; | |
48 | ||
49 | // | |
50 | // Dimensions of the detector | |
51 | // | |
0a770ac9 | 52 | |
53 | // Inner and outer radius of the mother volumes | |
793ff80c | 54 | const Float_t AliTRDgeometry::fgkRmin = 294.0; |
55 | const Float_t AliTRDgeometry::fgkRmax = 368.0; | |
56 | ||
0a770ac9 | 57 | // Upper and lower length of the mother volumes |
793ff80c | 58 | const Float_t AliTRDgeometry::fgkZmax1 = 378.35; |
59 | const Float_t AliTRDgeometry::fgkZmax2 = 302.0; | |
60 | ||
0a770ac9 | 61 | // Parameter of the BTR mother volumes |
793ff80c | 62 | const Float_t AliTRDgeometry::fgkSheight = 74.0; |
63 | const Float_t AliTRDgeometry::fgkSwidth1 = 99.613; | |
64 | const Float_t AliTRDgeometry::fgkSwidth2 = 125.707; | |
65 | const Float_t AliTRDgeometry::fgkSlenTR1 = 751.0; | |
66 | const Float_t AliTRDgeometry::fgkSlenTR2 = 313.5; | |
67 | const Float_t AliTRDgeometry::fgkSlenTR3 = 159.5; | |
68 | ||
73ae7b59 | 69 | // The super module side plates |
287c5d50 | 70 | const Float_t AliTRDgeometry::fgkSMpltT = 0.2; |
71 | const Float_t AliTRDgeometry::fgkSMgapT = 0.5; | |
73ae7b59 | 72 | |
0a770ac9 | 73 | // Height of different chamber parts |
74 | // Radiator | |
75 | const Float_t AliTRDgeometry::fgkCraH = 4.8; | |
76 | // Drift region | |
77 | const Float_t AliTRDgeometry::fgkCdrH = 3.0; | |
78 | // Amplification region | |
79 | const Float_t AliTRDgeometry::fgkCamH = 0.7; | |
80 | // Readout | |
73ae7b59 | 81 | const Float_t AliTRDgeometry::fgkCroH = 2.316; |
0a770ac9 | 82 | // Total height |
83 | const Float_t AliTRDgeometry::fgkCH = AliTRDgeometry::fgkCraH | |
84 | + AliTRDgeometry::fgkCdrH | |
85 | + AliTRDgeometry::fgkCamH | |
86 | + AliTRDgeometry::fgkCroH; | |
87 | ||
88 | // Vertical spacing of the chambers | |
73ae7b59 | 89 | const Float_t AliTRDgeometry::fgkVspace = 1.784; |
0a770ac9 | 90 | |
91 | // Horizontal spacing of the chambers | |
92 | const Float_t AliTRDgeometry::fgkHspace = 2.0; | |
93 | ||
94 | // Thicknesses of different parts of the chamber frame | |
95 | // Lower aluminum frame | |
96 | const Float_t AliTRDgeometry::fgkCalT = 0.3; | |
97 | // Lower G10 frame sides | |
98 | const Float_t AliTRDgeometry::fgkCclsT = 0.3; | |
99 | // Lower G10 frame front | |
100 | const Float_t AliTRDgeometry::fgkCclfT = 1.0; | |
101 | // Upper G10 frame | |
102 | const Float_t AliTRDgeometry::fgkCcuT = 0.9; | |
103 | // Upper Al frame | |
104 | const Float_t AliTRDgeometry::fgkCauT = 1.5; | |
105 | ||
106 | // Additional width of the readout chamber frames | |
107 | const Float_t AliTRDgeometry::fgkCroW = 0.9; | |
108 | ||
109 | // Difference of outer chamber width and pad plane width | |
73ae7b59 | 110 | //const Float_t AliTRDgeometry::fgkCpadW = 1.0; |
111 | const Float_t AliTRDgeometry::fgkCpadW = 0.0; | |
de6df1b1 | 112 | const Float_t AliTRDgeometry::fgkRpadW = 1.0; |
793ff80c | 113 | |
114 | // | |
115 | // Thickness of the the material layers | |
116 | // | |
db30bf0f | 117 | const Float_t AliTRDgeometry::fgkRaThick = 0.3646; |
793ff80c | 118 | const Float_t AliTRDgeometry::fgkMyThick = 0.005; |
0a770ac9 | 119 | const Float_t AliTRDgeometry::fgkDrThick = AliTRDgeometry::fgkCdrH; |
120 | const Float_t AliTRDgeometry::fgkAmThick = AliTRDgeometry::fgkCamH; | |
121 | const Float_t AliTRDgeometry::fgkXeThick = AliTRDgeometry::fgkDrThick | |
122 | + AliTRDgeometry::fgkAmThick; | |
793ff80c | 123 | const Float_t AliTRDgeometry::fgkCuThick = 0.001; |
124 | const Float_t AliTRDgeometry::fgkSuThick = 0.06; | |
125 | const Float_t AliTRDgeometry::fgkFeThick = 0.0044; | |
126 | const Float_t AliTRDgeometry::fgkCoThick = 0.02; | |
db30bf0f | 127 | const Float_t AliTRDgeometry::fgkWaThick = 0.02; |
793ff80c | 128 | |
129 | // | |
130 | // Position of the material layers | |
131 | // | |
0a770ac9 | 132 | const Float_t AliTRDgeometry::fgkRaZpos = -1.50; |
133 | const Float_t AliTRDgeometry::fgkMyZpos = 0.895; | |
134 | const Float_t AliTRDgeometry::fgkDrZpos = 2.4; | |
135 | const Float_t AliTRDgeometry::fgkAmZpos = 0.0; | |
136 | const Float_t AliTRDgeometry::fgkCuZpos = -0.9995; | |
793ff80c | 137 | const Float_t AliTRDgeometry::fgkSuZpos = 0.0000; |
0a770ac9 | 138 | const Float_t AliTRDgeometry::fgkFeZpos = 0.0322; |
139 | const Float_t AliTRDgeometry::fgkCoZpos = 0.97; | |
140 | const Float_t AliTRDgeometry::fgkWaZpos = 0.99; | |
3551db50 | 141 | |
142 | const Double_t AliTRDgeometry::fgkTime0Base = Rmin() + CraHght() + CdrHght() + CamHght()/2.; | |
143 | const Float_t AliTRDgeometry::fgkTime0[6] = { fgkTime0Base + 0 * (Cheight() + Cspace()), | |
144 | fgkTime0Base + 1 * (Cheight() + Cspace()), | |
145 | fgkTime0Base + 2 * (Cheight() + Cspace()), | |
146 | fgkTime0Base + 3 * (Cheight() + Cspace()), | |
147 | fgkTime0Base + 4 * (Cheight() + Cspace()), | |
148 | fgkTime0Base + 5 * (Cheight() + Cspace()) }; | |
793ff80c | 149 | |
f7336fa3 | 150 | //_____________________________________________________________________________ |
151 | AliTRDgeometry::AliTRDgeometry():AliGeometry() | |
152 | { | |
153 | // | |
154 | // AliTRDgeometry default constructor | |
155 | // | |
156 | ||
157 | Init(); | |
f7336fa3 | 158 | } |
159 | ||
160 | //_____________________________________________________________________________ | |
161 | AliTRDgeometry::~AliTRDgeometry() | |
162 | { | |
8230f242 | 163 | // |
164 | // AliTRDgeometry destructor | |
165 | // | |
f7336fa3 | 166 | } |
167 | ||
168 | //_____________________________________________________________________________ | |
169 | void AliTRDgeometry::Init() | |
170 | { | |
171 | // | |
172 | // Initializes the geometry parameter | |
173 | // | |
f7336fa3 | 174 | // The maximum number of pads |
175 | // and the position of pad 0,0,0 | |
176 | // | |
177 | // chambers seen from the top: | |
178 | // +----------------------------+ | |
179 | // | | | |
793ff80c | 180 | // | | ^ |
181 | // | | rphi| | |
182 | // | | | | |
183 | // |0 | | | |
184 | // +----------------------------+ +------> | |
f7336fa3 | 185 | // z |
793ff80c | 186 | // chambers seen from the side: ^ |
187 | // +----------------------------+ drift| | |
188 | // |0 | | | |
189 | // | | | | |
190 | // +----------------------------+ +------> | |
f7336fa3 | 191 | // z |
192 | // | |
a2b90f83 | 193 | // IMPORTANT: time bin 0 is now the first one in the drift region |
194 | // closest to the readout !!! | |
793ff80c | 195 | // |
f7336fa3 | 196 | |
0a770ac9 | 197 | Int_t icham; |
198 | Int_t iplan; | |
199 | Int_t isect; | |
200 | ||
201 | // The outer width of the chambers | |
e0d47c25 | 202 | // |
203 | // Changed with the introduction of | |
204 | // the new layer 0. The old layer 6 | |
205 | // is removed. | |
287c5d50 | 206 | fCwidth[0] = 90.4; |
e0d47c25 | 207 | fCwidth[1] = 94.8; |
208 | fCwidth[2] = 99.3; | |
209 | fCwidth[3] = 103.7; | |
210 | fCwidth[4] = 108.1; | |
211 | fCwidth[5] = 112.6; | |
212 | // Old layer 6 | |
213 | // fCwidth[5] = 117.0; | |
0a770ac9 | 214 | |
215 | // The outer lengths of the chambers | |
73ae7b59 | 216 | // Includes the spacings between the chambers! |
e0d47c25 | 217 | // Changed with the introduction of |
218 | // the new layer 0. The old layer 6 | |
219 | // is removed. | |
8737e16f | 220 | Float_t length[kNplan][kNcham] = { { 124.0, 124.0, 110.0, 124.0, 124.0 } |
e0d47c25 | 221 | , { 124.0, 124.0, 110.0, 124.0, 124.0 } |
8737e16f | 222 | , { 131.0, 131.0, 110.0, 131.0, 131.0 } |
223 | , { 138.0, 138.0, 110.0, 138.0, 138.0 } | |
224 | , { 145.0, 145.0, 110.0, 145.0, 145.0 } | |
e0d47c25 | 225 | , { 147.0, 147.0, 110.0, 147.0, 147.0 } }; |
226 | // Old layer 6 | |
227 | // , { 147.0, 147.0, 110.0, 147.0, 147.0 } }; | |
0a770ac9 | 228 | |
229 | for (icham = 0; icham < kNcham; icham++) { | |
230 | for (iplan = 0; iplan < kNplan; iplan++) { | |
231 | fClength[iplan][icham] = length[iplan][icham]; | |
232 | fClengthPH[iplan][icham] = 0.0; | |
233 | fClengthRH[iplan][icham] = 0.0; | |
234 | } | |
235 | } | |
236 | ||
793ff80c | 237 | // The rotation matrix elements |
238 | Float_t phi = 0; | |
239 | for (isect = 0; isect < fgkNsect; isect++) { | |
5443e65e | 240 | phi = -2.0 * TMath::Pi() / (Float_t) fgkNsect * ((Float_t) isect + 0.5); |
793ff80c | 241 | fRotA11[isect] = TMath::Cos(phi); |
242 | fRotA12[isect] = TMath::Sin(phi); | |
243 | fRotA21[isect] = TMath::Sin(phi); | |
244 | fRotA22[isect] = TMath::Cos(phi); | |
245 | phi = -1.0 * phi; | |
246 | fRotB11[isect] = TMath::Cos(phi); | |
247 | fRotB12[isect] = TMath::Sin(phi); | |
248 | fRotB21[isect] = TMath::Sin(phi); | |
249 | fRotB22[isect] = TMath::Cos(phi); | |
250 | } | |
251 | ||
252 | } | |
253 | ||
f7336fa3 | 254 | //_____________________________________________________________________________ |
73ae7b59 | 255 | void AliTRDgeometry::CreateGeometry(Int_t* ) |
f7336fa3 | 256 | { |
257 | // | |
0a770ac9 | 258 | // Create TRD geometry |
259 | // | |
f7336fa3 | 260 | |
261 | } | |
262 | ||
263 | //_____________________________________________________________________________ | |
a5cadd36 | 264 | Bool_t AliTRDgeometry::Local2Global(Int_t idet, Double_t *local |
dde59437 | 265 | , Double_t *global) const |
f7336fa3 | 266 | { |
267 | // | |
268 | // Converts local pad-coordinates (row,col,time) into | |
269 | // global ALICE reference frame coordinates (x,y,z) | |
270 | // | |
271 | ||
793ff80c | 272 | Int_t icham = GetChamber(idet); // Chamber info (0-4) |
273 | Int_t isect = GetSector(idet); // Sector info (0-17) | |
274 | Int_t iplan = GetPlane(idet); // Plane info (0-5) | |
f7336fa3 | 275 | |
dde59437 | 276 | return Local2Global(iplan,icham,isect,local,global); |
f7336fa3 | 277 | |
278 | } | |
279 | ||
280 | //_____________________________________________________________________________ | |
281 | Bool_t AliTRDgeometry::Local2Global(Int_t iplan, Int_t icham, Int_t isect | |
dde59437 | 282 | , Double_t *local, Double_t *global) const |
f7336fa3 | 283 | { |
284 | // | |
285 | // Converts local pad-coordinates (row,col,time) into | |
286 | // global ALICE reference frame coordinates (x,y,z) | |
287 | // | |
288 | ||
3551db50 | 289 | AliTRDCommonParam* commonParam = AliTRDCommonParam::Instance(); |
290 | if (!commonParam) | |
291 | return kFALSE; | |
5443e65e | 292 | |
3551db50 | 293 | AliTRDcalibDB* calibration = AliTRDcalibDB::Instance(); |
294 | if (!calibration) | |
295 | return kFALSE; | |
296 | ||
297 | AliTRDpadPlane *padPlane = commonParam->GetPadPlane(iplan,icham); | |
f7336fa3 | 298 | |
a5cadd36 | 299 | // calculate (x,y,z) position in rotated chamber |
300 | Int_t row = ((Int_t) local[0]); | |
301 | Int_t col = ((Int_t) local[1]); | |
302 | Float_t timeSlice = local[2] + 0.5; | |
3551db50 | 303 | Float_t time0 = GetTime0(iplan); |
f7336fa3 | 304 | |
a5cadd36 | 305 | Double_t rot[3]; |
dde59437 | 306 | rot[0] = time0 - (timeSlice - calibration->GetT0(iplan, icham, isect, col, row)) |
3551db50 | 307 | * calibration->GetVdrift(iplan, icham, isect, col, row)/calibration->GetSamplingFrequency(); |
a5cadd36 | 308 | rot[1] = padPlane->GetColPos(col) - 0.5 * padPlane->GetColSize(col); |
309 | rot[2] = padPlane->GetRowPos(row) - 0.5 * padPlane->GetRowSize(row); | |
f7336fa3 | 310 | |
311 | // Rotate back to original position | |
a5cadd36 | 312 | Int_t idet = GetDetector(iplan,icham,isect); |
f7336fa3 | 313 | return RotateBack(idet,rot,global); |
314 | ||
315 | } | |
316 | ||
3d7b6a24 | 317 | //_____________________________________________________________________________ |
a5cadd36 | 318 | Bool_t AliTRDgeometry::Global2Local(Int_t mode, Double_t *local, Double_t *global |
319 | , Int_t* index, AliTRDparameter *par) const | |
3d7b6a24 | 320 | { |
321 | // | |
322 | // Converts local pad-coordinates (row,col,time) into | |
323 | // global ALICE reference frame coordinates (x,y,z) | |
324 | // | |
e0d47c25 | 325 | // index[0] = plane number |
326 | // index[1] = chamber number | |
327 | // index[2] = sector number | |
3d7b6a24 | 328 | // |
329 | // mode=0 - local coordinate in y, z, x - rotated global | |
330 | // mode=2 - local coordinate in pad, and pad row, x - rotated global | |
331 | // | |
e0d47c25 | 332 | |
3d7b6a24 | 333 | if (!par) { |
3551db50 | 334 | Error("Global2Local","No parameter defined\n"); |
3d7b6a24 | 335 | return kFALSE; |
336 | } | |
337 | ||
338 | //Int_t idet = GetDetector(iplan,icham,isect); // Detector number | |
339 | Int_t idet = GetDetector(index[0],index[1],index[2]); // Detector number | |
340 | Rotate(idet,global,local); | |
341 | if (mode==0) return kTRUE; | |
342 | // | |
343 | // Float_t row0 = par->GetRow0(iplan,icham,isect); | |
344 | //Float_t col0 = par->GetCol0(iplan); | |
3551db50 | 345 | //Float_t time0 = GetTime0(iplan); |
3d7b6a24 | 346 | // |
347 | // mode 1 to be implemented later | |
348 | // calculate (x,y,z) position in time bin pad row pad | |
349 | // | |
350 | //rot[0] = time0 - (timeSlice - par->GetTimeBefore()) | |
ccb4315c | 351 | // * par->GetDriftVelocity()/par->GetSamplingFrequency(); |
3d7b6a24 | 352 | //rot[1] = col0 + padCol |
353 | // * par->GetColPadSize(iplan); | |
354 | //rot[2] = row0 + padRow | |
355 | // * par->GetRowPadSize(iplan,icham,isect); | |
356 | ||
357 | return kTRUE; | |
358 | ||
359 | } | |
360 | ||
a5cadd36 | 361 | //_____________________________________________________________________________ |
3551db50 | 362 | Bool_t AliTRDgeometry::Global2Detector(Double_t global[3], Int_t index[3]) |
3d7b6a24 | 363 | { |
364 | // | |
e0d47c25 | 365 | // input = global position |
366 | // output = index | |
367 | // index[0] = plane number | |
368 | // index[1] = chamber number | |
369 | // index[2] = sector number | |
3d7b6a24 | 370 | // |
e0d47c25 | 371 | |
3d7b6a24 | 372 | Float_t fi; |
373 | // | |
374 | fi = TMath::ATan2(global[1],global[0]); | |
375 | if (fi<0) fi += 2*TMath::Pi(); | |
376 | index[2] = Int_t(TMath::Nint((fi - GetAlpha()/2.)/GetAlpha())); | |
377 | // | |
378 | // | |
379 | Float_t locx = global[0] * fRotA11[index[2]] + global[1] * fRotA12[index[2]]; | |
380 | index[0] = 0; | |
3551db50 | 381 | Float_t max = locx - GetTime0(0); |
3d7b6a24 | 382 | for (Int_t iplane=1; iplane<fgkNplan;iplane++){ |
3551db50 | 383 | Float_t dist = TMath::Abs(locx - GetTime0(iplane)); |
3d7b6a24 | 384 | if (dist < max){ |
385 | index[0] = iplane; | |
386 | max = dist; | |
387 | } | |
388 | } | |
389 | Float_t theta = TMath::ATan2(global[2],locx); | |
390 | index[1] = TMath::Nint(float(fgkNcham)*theta/(0.25*TMath::Pi())); | |
391 | return kTRUE; | |
392 | ||
393 | } | |
394 | ||
395 | ||
f7336fa3 | 396 | //_____________________________________________________________________________ |
a5cadd36 | 397 | Bool_t AliTRDgeometry::Rotate(Int_t d, Double_t *pos, Double_t *rot) const |
f7336fa3 | 398 | { |
399 | // | |
400 | // Rotates all chambers in the position of sector 0 and transforms | |
401 | // the coordinates in the ALICE restframe <pos> into the | |
402 | // corresponding local frame <rot>. | |
403 | // | |
404 | ||
793ff80c | 405 | Int_t sector = GetSector(d); |
f7336fa3 | 406 | |
793ff80c | 407 | rot[0] = pos[0] * fRotA11[sector] + pos[1] * fRotA12[sector]; |
408 | rot[1] = -pos[0] * fRotA21[sector] + pos[1] * fRotA22[sector]; | |
f7336fa3 | 409 | rot[2] = pos[2]; |
410 | ||
411 | return kTRUE; | |
412 | ||
413 | } | |
414 | ||
415 | //_____________________________________________________________________________ | |
a5cadd36 | 416 | Bool_t AliTRDgeometry::RotateBack(Int_t d, Double_t *rot, Double_t *pos) const |
f7336fa3 | 417 | { |
418 | // | |
419 | // Rotates a chambers from the position of sector 0 into its | |
420 | // original position and transforms the corresponding local frame | |
421 | // coordinates <rot> into the coordinates of the ALICE restframe <pos>. | |
422 | // | |
423 | ||
793ff80c | 424 | Int_t sector = GetSector(d); |
f7336fa3 | 425 | |
793ff80c | 426 | pos[0] = rot[0] * fRotB11[sector] + rot[1] * fRotB12[sector]; |
427 | pos[1] = -rot[0] * fRotB21[sector] + rot[1] * fRotB22[sector]; | |
6f1e466d | 428 | pos[2] = rot[2]; |
f7336fa3 | 429 | |
430 | return kTRUE; | |
431 | ||
432 | } | |
433 | ||
434 | //_____________________________________________________________________________ | |
3551db50 | 435 | Int_t AliTRDgeometry::GetDetectorSec(Int_t p, Int_t c) |
0a770ac9 | 436 | { |
437 | // | |
438 | // Convert plane / chamber into detector number for one single sector | |
439 | // | |
440 | ||
441 | return (p + c * fgkNplan); | |
442 | ||
443 | } | |
444 | ||
445 | //_____________________________________________________________________________ | |
3551db50 | 446 | Int_t AliTRDgeometry::GetDetector(Int_t p, Int_t c, Int_t s) |
f7336fa3 | 447 | { |
448 | // | |
449 | // Convert plane / chamber / sector into detector number | |
450 | // | |
451 | ||
793ff80c | 452 | return (p + c * fgkNplan + s * fgkNplan * fgkNcham); |
f7336fa3 | 453 | |
454 | } | |
455 | ||
456 | //_____________________________________________________________________________ | |
afc51ac2 | 457 | Int_t AliTRDgeometry::GetPlane(Int_t d) const |
f7336fa3 | 458 | { |
459 | // | |
460 | // Reconstruct the plane number from the detector number | |
461 | // | |
462 | ||
793ff80c | 463 | return ((Int_t) (d % fgkNplan)); |
f7336fa3 | 464 | |
465 | } | |
466 | ||
467 | //_____________________________________________________________________________ | |
afc51ac2 | 468 | Int_t AliTRDgeometry::GetChamber(Int_t d) const |
f7336fa3 | 469 | { |
470 | // | |
471 | // Reconstruct the chamber number from the detector number | |
472 | // | |
473 | ||
793ff80c | 474 | return ((Int_t) (d % (fgkNplan * fgkNcham)) / fgkNplan); |
f7336fa3 | 475 | |
476 | } | |
477 | ||
478 | //_____________________________________________________________________________ | |
afc51ac2 | 479 | Int_t AliTRDgeometry::GetSector(Int_t d) const |
f7336fa3 | 480 | { |
481 | // | |
482 | // Reconstruct the sector number from the detector number | |
483 | // | |
484 | ||
793ff80c | 485 | return ((Int_t) (d / (fgkNplan * fgkNcham))); |
f7336fa3 | 486 | |
487 | } | |
488 | ||
bdbb05bb | 489 | //_____________________________________________________________________________ |
490 | AliTRDgeometry* AliTRDgeometry::GetGeometry(AliRunLoader* runLoader) | |
491 | { | |
492 | // | |
493 | // load the geometry from the galice file | |
494 | // | |
495 | ||
496 | if (!runLoader) runLoader = AliRunLoader::GetRunLoader(); | |
497 | if (!runLoader) { | |
498 | ::Error("AliTRDgeometry::GetGeometry", "No run loader"); | |
499 | return NULL; | |
500 | } | |
501 | ||
502 | TDirectory* saveDir = gDirectory; | |
503 | runLoader->CdGAFile(); | |
504 | ||
ecb36af7 | 505 | // Try from the galice.root file |
bdbb05bb | 506 | AliTRDgeometry* geom = (AliTRDgeometry*) gDirectory->Get("TRDgeometry"); |
ecb36af7 | 507 | |
508 | if (!geom) { | |
509 | // It is not in the file, try to get it from gAlice, | |
510 | // which corresponds to the run loader | |
511 | AliTRD * trd = (AliTRD*)runLoader->GetAliRun()->GetDetector("TRD"); | |
512 | geom = trd->GetGeometry(); | |
513 | } | |
bdbb05bb | 514 | if (!geom) ::Error("AliTRDgeometry::GetGeometry", "Geometry not found"); |
515 | ||
516 | saveDir->cd(); | |
517 | return geom; | |
518 | } |