]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDgeometry.cxx
Rmove MCM status
[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
afc51ac2 16/* $Id$ */
f7336fa3 17
18///////////////////////////////////////////////////////////////////////////////
19// //
20// TRD geometry class //
21// //
22///////////////////////////////////////////////////////////////////////////////
23
793ff80c 24
b4a9cd27 25#include <TGeoManager.h>
26#include <TGeoPhysicalNode.h>
27#include <TGeoMatrix.h>
28
2745a409 29#include "AliLog.h"
bdbb05bb 30#include "AliRunLoader.h"
b4a9cd27 31#include "AliAlignObj.h"
32#include "AliAlignObjAngles.h"
ecb36af7 33#include "AliRun.h"
030b4415 34
ecb36af7 35#include "AliTRD.h"
3551db50 36#include "AliTRDcalibDB.h"
37#include "AliTRDCommonParam.h"
2745a409 38#include "AliTRDgeometry.h"
39#include "AliTRDpadPlane.h"
ecb36af7 40
f7336fa3 41ClassImp(AliTRDgeometry)
42
793ff80c 43//_____________________________________________________________________________
44
45 //
46 // The geometry constants
47 //
48 const Int_t AliTRDgeometry::fgkNsect = kNsect;
49 const Int_t AliTRDgeometry::fgkNplan = kNplan;
50 const Int_t AliTRDgeometry::fgkNcham = kNcham;
51 const Int_t AliTRDgeometry::fgkNdet = kNdet;
52
53 //
54 // Dimensions of the detector
55 //
0a770ac9 56
0a5f3331 57 // Parameter of the BTRD mother volumes
a797f961 58 const Float_t AliTRDgeometry::fgkSheight = 77.9;
59 const Float_t AliTRDgeometry::fgkSwidth1 = 94.881;
60 const Float_t AliTRDgeometry::fgkSwidth2 = 122.353;
0a5f3331 61 const Float_t AliTRDgeometry::fgkSlength = 751.0;
793ff80c 62
73ae7b59 63 // The super module side plates
287c5d50 64 const Float_t AliTRDgeometry::fgkSMpltT = 0.2;
73ae7b59 65
0a770ac9 66 // Height of different chamber parts
67 // Radiator
68 const Float_t AliTRDgeometry::fgkCraH = 4.8;
69 // Drift region
70 const Float_t AliTRDgeometry::fgkCdrH = 3.0;
71 // Amplification region
72 const Float_t AliTRDgeometry::fgkCamH = 0.7;
73 // Readout
73ae7b59 74 const Float_t AliTRDgeometry::fgkCroH = 2.316;
0a770ac9 75 // Total height
76 const Float_t AliTRDgeometry::fgkCH = AliTRDgeometry::fgkCraH
77 + AliTRDgeometry::fgkCdrH
78 + AliTRDgeometry::fgkCamH
79 + AliTRDgeometry::fgkCroH;
80
81 // Vertical spacing of the chambers
73ae7b59 82 const Float_t AliTRDgeometry::fgkVspace = 1.784;
0a770ac9 83 // Horizontal spacing of the chambers
84 const Float_t AliTRDgeometry::fgkHspace = 2.0;
a797f961 85 // Radial distance of the first ROC to the outer plates of the SM
86 const Float_t AliTRDgeometry::fgkVrocsm = 1.2;
87
0a770ac9 88 // Thicknesses of different parts of the chamber frame
89 // Lower aluminum frame
0a5f3331 90 const Float_t AliTRDgeometry::fgkCalT = 0.4;
91 // Lower Wacosit frame sides
92 const Float_t AliTRDgeometry::fgkCclsT = 0.21;
93 // Lower Wacosit frame front
0a770ac9 94 const Float_t AliTRDgeometry::fgkCclfT = 1.0;
0a5f3331 95 // Thickness of glue around radiator
96 const Float_t AliTRDgeometry::fgkCglT = 0.25;
97 // Upper Wacosit frame
0a770ac9 98 const Float_t AliTRDgeometry::fgkCcuT = 0.9;
0a5f3331 99 // Al frame of back panel
0a770ac9 100 const Float_t AliTRDgeometry::fgkCauT = 1.5;
0a5f3331 101 // Additional Al of the lower chamber frame
102 const Float_t AliTRDgeometry::fgkCalW = 1.11;
0a770ac9 103
104 // Additional width of the readout chamber frames
105 const Float_t AliTRDgeometry::fgkCroW = 0.9;
106
107 // Difference of outer chamber width and pad plane width
73ae7b59 108 const Float_t AliTRDgeometry::fgkCpadW = 0.0;
de6df1b1 109 const Float_t AliTRDgeometry::fgkRpadW = 1.0;
793ff80c 110
111 //
112 // Thickness of the the material layers
113 //
793ff80c 114 const Float_t AliTRDgeometry::fgkMyThick = 0.005;
0a5f3331 115 const Float_t AliTRDgeometry::fgkRaThick = 0.3233;
0a770ac9 116 const Float_t AliTRDgeometry::fgkDrThick = AliTRDgeometry::fgkCdrH;
117 const Float_t AliTRDgeometry::fgkAmThick = AliTRDgeometry::fgkCamH;
118 const Float_t AliTRDgeometry::fgkXeThick = AliTRDgeometry::fgkDrThick
119 + AliTRDgeometry::fgkAmThick;
0a5f3331 120 const Float_t AliTRDgeometry::fgkWrThick = 0.0002;
a797f961 121 const Float_t AliTRDgeometry::fgkCuThick = 0.0072;
0a5f3331 122 const Float_t AliTRDgeometry::fgkGlThick = 0.05;
123 const Float_t AliTRDgeometry::fgkSuThick = 0.0919;
a797f961 124 const Float_t AliTRDgeometry::fgkRcThick = 0.0058;
125 const Float_t AliTRDgeometry::fgkRpThick = 0.0632;
0a5f3331 126 const Float_t AliTRDgeometry::fgkRoThick = 0.0028;
793ff80c 127
128 //
129 // Position of the material layers
130 //
0a5f3331 131 //const Float_t AliTRDgeometry::fgkRaZpos = -1.50;
132 const Float_t AliTRDgeometry::fgkRaZpos = 0.0;
0a770ac9 133 const Float_t AliTRDgeometry::fgkDrZpos = 2.4;
134 const Float_t AliTRDgeometry::fgkAmZpos = 0.0;
0a5f3331 135 const Float_t AliTRDgeometry::fgkWrZpos = 0.0;
0a770ac9 136 const Float_t AliTRDgeometry::fgkCuZpos = -0.9995;
0a5f3331 137 const Float_t AliTRDgeometry::fgkGlZpos = -0.5;
138 const Float_t AliTRDgeometry::fgkSuZpos = 0.0;
a797f961 139 const Float_t AliTRDgeometry::fgkRcZpos = 1.04;
140 const Float_t AliTRDgeometry::fgkRpZpos = 1.0;
0a5f3331 141 const Float_t AliTRDgeometry::fgkRoZpos = 1.05;
142
143 const Double_t AliTRDgeometry::fgkTime0Base = 300.65;
3551db50 144 const Float_t AliTRDgeometry::fgkTime0[6] = { fgkTime0Base + 0 * (Cheight() + Cspace()),
145 fgkTime0Base + 1 * (Cheight() + Cspace()),
146 fgkTime0Base + 2 * (Cheight() + Cspace()),
147 fgkTime0Base + 3 * (Cheight() + Cspace()),
148 fgkTime0Base + 4 * (Cheight() + Cspace()),
149 fgkTime0Base + 5 * (Cheight() + Cspace()) };
793ff80c 150
f7336fa3 151//_____________________________________________________________________________
2745a409 152AliTRDgeometry::AliTRDgeometry()
153 :AliGeometry()
154 ,fMatrixArray(0)
155 ,fMatrixCorrectionArray(0)
156 ,fMatrixGeo(0)
157
f7336fa3 158{
159 //
160 // AliTRDgeometry default constructor
161 //
bd0f8685 162
2745a409 163 Init();
164
165}
166
167//_____________________________________________________________________________
168AliTRDgeometry::AliTRDgeometry(const AliTRDgeometry &g)
169 :AliGeometry(g)
030b4415 170 ,fMatrixArray(g.fMatrixArray)
171 ,fMatrixCorrectionArray(g.fMatrixCorrectionArray)
172 ,fMatrixGeo(g.fMatrixGeo)
2745a409 173{
174 //
175 // AliTRDgeometry copy constructor
176 //
bd0f8685 177
f7336fa3 178 Init();
bd0f8685 179
f7336fa3 180}
181
182//_____________________________________________________________________________
183AliTRDgeometry::~AliTRDgeometry()
184{
8230f242 185 //
186 // AliTRDgeometry destructor
187 //
bd0f8685 188
030b4415 189 if (fMatrixArray) {
190 delete fMatrixArray;
191 fMatrixArray = 0;
192 }
193
194 if (fMatrixCorrectionArray) {
195 delete fMatrixCorrectionArray;
196 fMatrixCorrectionArray = 0;
197 }
bd0f8685 198
f7336fa3 199}
200
2745a409 201//_____________________________________________________________________________
202AliTRDgeometry &AliTRDgeometry::operator=(const AliTRDgeometry &g)
203{
204 //
205 // Assignment operator
206 //
207
0a5f3331 208 if (this != &g) {
209 Init();
210 }
030b4415 211
2745a409 212 return *this;
213
214}
215
f7336fa3 216//_____________________________________________________________________________
217void AliTRDgeometry::Init()
218{
219 //
220 // Initializes the geometry parameter
221 //
f7336fa3 222
0a770ac9 223 Int_t icham;
224 Int_t iplan;
225 Int_t isect;
226
227 // The outer width of the chambers
287c5d50 228 fCwidth[0] = 90.4;
e0d47c25 229 fCwidth[1] = 94.8;
230 fCwidth[2] = 99.3;
231 fCwidth[3] = 103.7;
232 fCwidth[4] = 108.1;
233 fCwidth[5] = 112.6;
0a770ac9 234
235 // The outer lengths of the chambers
73ae7b59 236 // Includes the spacings between the chambers!
8737e16f 237 Float_t length[kNplan][kNcham] = { { 124.0, 124.0, 110.0, 124.0, 124.0 }
e0d47c25 238 , { 124.0, 124.0, 110.0, 124.0, 124.0 }
8737e16f 239 , { 131.0, 131.0, 110.0, 131.0, 131.0 }
240 , { 138.0, 138.0, 110.0, 138.0, 138.0 }
241 , { 145.0, 145.0, 110.0, 145.0, 145.0 }
e0d47c25 242 , { 147.0, 147.0, 110.0, 147.0, 147.0 } };
0a770ac9 243
244 for (icham = 0; icham < kNcham; icham++) {
245 for (iplan = 0; iplan < kNplan; iplan++) {
030b4415 246 fClength[iplan][icham] = length[iplan][icham];
0a770ac9 247 }
248 }
249
793ff80c 250 // The rotation matrix elements
030b4415 251 Float_t phi = 0.0;
793ff80c 252 for (isect = 0; isect < fgkNsect; isect++) {
5443e65e 253 phi = -2.0 * TMath::Pi() / (Float_t) fgkNsect * ((Float_t) isect + 0.5);
793ff80c 254 fRotA11[isect] = TMath::Cos(phi);
255 fRotA12[isect] = TMath::Sin(phi);
256 fRotA21[isect] = TMath::Sin(phi);
257 fRotA22[isect] = TMath::Cos(phi);
258 phi = -1.0 * phi;
259 fRotB11[isect] = TMath::Cos(phi);
260 fRotB12[isect] = TMath::Sin(phi);
261 fRotB21[isect] = TMath::Sin(phi);
262 fRotB22[isect] = TMath::Cos(phi);
263 }
bd0f8685 264
265 for (isect = 0; isect < fgkNsect; isect++) {
266 SetSMstatus(isect,1);
267 }
793ff80c 268
269}
270
f7336fa3 271//_____________________________________________________________________________
bd0f8685 272void AliTRDgeometry::CreateGeometry(Int_t *idtmed)
273{
274 //
275 // Create the TRD geometry without hole
276 //
277 //
278 // Names of the TRD volumina (xx = detector number):
279 //
280 // Volume (Air) wrapping the readout chamber components
281 // UTxx includes: UAxx, UDxx, UFxx, UUxx
0a5f3331 282 //
283 // Volume (Air) wrapping the services (fee + cooling)
bd0f8685 284 // UUxx the services volume has been reduced by 7.42 mm
285 // in order to allow shifts in radial direction
286 //
0a5f3331 287 // Lower part of the readout chambers (drift volume + radiator)
bd0f8685 288 //
0a5f3331 289 // UAxx Aluminum frames (Al)
290 // UBxx Wacosit frames (C)
291 // UXxx Glue around radiator (Epoxy)
292 // UCxx Inner volumes (Air)
293 // UZxx Additional aluminum ledges (Al)
bd0f8685 294 //
295 // Upper part of the readout chambers (readout plane + fee)
296 //
0a5f3331 297 // UDxx Wacosit frames of amp. region (C)
298 // UExx Inner volumes of the frame (Air)
299 // UFxx Aluminum frame of back panel (Al)
300 // UGxx Inner volumes of the back panel (Air)
bd0f8685 301 //
302 // Inner material layers
303 //
0a5f3331 304 // UHxx Radiator (Rohacell)
305 // UJxx Drift volume (Xe/CO2)
306 // UKxx Amplification volume (Xe/CO2)
307 // UWxx Wire plane (Cu)
308 // ULxx Pad plane (Cu)
309 // UYxx Glue layer (Epoxy)
310 // UMxx Support structure (Rohacell)
311 // UNxx ROB base material (C)
312 // UOxx ROB copper (Cu)
313 // UVxx ROB other materials (Cu)
bd0f8685 314 //
315
316 const Int_t kNparTrd = 4;
317 const Int_t kNparCha = 3;
318
030b4415 319 Float_t xpos;
320 Float_t ypos;
321 Float_t zpos;
bd0f8685 322
323 Float_t parTrd[kNparTrd];
324 Float_t parCha[kNparCha];
325
326 Char_t cTagV[6];
327 Char_t cTagM[5];
328
329 // The TRD mother volume for one sector (Air), full length in z-direction
330 // Provides material for side plates of super module
030b4415 331 parTrd[0] = fgkSwidth1/2.0;
332 parTrd[1] = fgkSwidth2/2.0;
0a5f3331 333 parTrd[2] = fgkSlength/2.0;
030b4415 334 parTrd[3] = fgkSheight/2.0;
bd0f8685 335 gMC->Gsvolu("UTR1","TRD1",idtmed[1302-1],parTrd,kNparTrd);
336
a797f961 337 // The outer aluminum plates of the super module (Al)
030b4415 338 parTrd[0] = fgkSwidth1/2.0;
339 parTrd[1] = fgkSwidth2/2.0;
0a5f3331 340 parTrd[2] = fgkSlength/2.0;
030b4415 341 parTrd[3] = fgkSheight/2.0;
bd0f8685 342 gMC->Gsvolu("UTS1","TRD1",idtmed[1301-1],parTrd,kNparTrd);
343
344 // The inner part of the TRD mother volume for one sector (Air),
345 // full length in z-direction
030b4415 346 parTrd[0] = fgkSwidth1/2.0 - fgkSMpltT;
347 parTrd[1] = fgkSwidth2/2.0 - fgkSMpltT;
0a5f3331 348 parTrd[2] = fgkSlength/2.0;
030b4415 349 parTrd[3] = fgkSheight/2.0 - fgkSMpltT;
bd0f8685 350 gMC->Gsvolu("UTI1","TRD1",idtmed[1302-1],parTrd,kNparTrd);
351
352 for (Int_t icham = 0; icham < kNcham; icham++) {
353 for (Int_t iplan = 0; iplan < kNplan; iplan++) {
354
355 Int_t iDet = GetDetectorSec(iplan,icham);
356
0a5f3331 357 // The lower part of the readout chambers (drift volume + radiator)
bd0f8685 358 // The aluminum frames
359 sprintf(cTagV,"UA%02d",iDet);
030b4415 360 parCha[0] = fCwidth[iplan]/2.0;
361 parCha[1] = fClength[iplan][icham]/2.0 - fgkHspace/2.0;
362 parCha[2] = fgkCraH/2.0 + fgkCdrH/2.0;
bd0f8685 363 fChamberUAboxd[iDet][0] = parCha[0];
364 fChamberUAboxd[iDet][1] = parCha[1];
365 fChamberUAboxd[iDet][2] = parCha[2];
366 gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parCha,kNparCha);
0a5f3331 367 // The additional aluminum on the frames
368 // This part has not the correct postion but is just supposed to
369 // represent the missing material. The correct from of the L-shaped
370 // profile would not fit into the alignable volume.
371 sprintf(cTagV,"UZ%02d",iDet);
372 parCha[0] = fgkCroW/2.0;
373 parCha[1] = fClength[iplan][icham]/2.0 - fgkHspace/2.0;
374 parCha[2] = fgkCalW/2.0;
375 fChamberUAboxd[iDet][0] = fChamberUAboxd[iDet][0] + fgkCroW;
376 gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parCha,kNparCha);
377 // The Wacosit frames
bd0f8685 378 sprintf(cTagV,"UB%02d",iDet);
030b4415 379 parCha[0] = fCwidth[iplan]/2.0 - fgkCalT;
380 parCha[1] = -1.0;
381 parCha[2] = -1.0;
bd0f8685 382 gMC->Gsvolu(cTagV,"BOX ",idtmed[1307-1],parCha,kNparCha);
0a5f3331 383 // The glue around the radiator
384 sprintf(cTagV,"UX%02d",iDet);
030b4415 385 parCha[0] = fCwidth[iplan]/2.0 - fgkCalT - fgkCclsT;
0a5f3331 386 parCha[1] = fClength[iplan][icham]/2.0 - fgkHspace/2.0 - fgkCclfT;
387 parCha[2] = fgkCraH/2.0;
388 gMC->Gsvolu(cTagV,"BOX ",idtmed[1311-1],parCha,kNparCha);
389 // The inner part of radiator (air)
390 sprintf(cTagV,"UC%02d",iDet);
391 parCha[0] = fCwidth[iplan]/2.0 - fgkCalT - fgkCclsT - fgkCglT;
392 parCha[1] = fClength[iplan][icham]/2.0 - fgkHspace/2.0 - fgkCclfT - fgkCglT;
030b4415 393 parCha[2] = -1.0;
bd0f8685 394 gMC->Gsvolu(cTagV,"BOX ",idtmed[1302-1],parCha,kNparCha);
395
0a5f3331 396 // The upper part of the readout chambers (amplification volume)
397 // The Wacosit frames
bd0f8685 398 sprintf(cTagV,"UD%02d",iDet);
030b4415 399 parCha[0] = fCwidth[iplan]/2.0 + fgkCroW;
400 parCha[1] = fClength[iplan][icham]/2.0 - fgkHspace/2.0;
401 parCha[2] = fgkCamH/2.0;
bd0f8685 402 fChamberUDboxd[iDet][0] = parCha[0];
403 fChamberUDboxd[iDet][1] = parCha[1];
404 fChamberUDboxd[iDet][2] = parCha[2];
405 gMC->Gsvolu(cTagV,"BOX ",idtmed[1307-1],parCha,kNparCha);
0a5f3331 406 // The inner part of the Wacosit frame (air)
bd0f8685 407 sprintf(cTagV,"UE%02d",iDet);
030b4415 408 parCha[0] = fCwidth[iplan]/2.0 + fgkCroW - fgkCcuT;
0a5f3331 409 parCha[1] = fClength[iplan][icham]/2.0 - fgkHspace/2.0 - fgkCcuT;
bd0f8685 410 parCha[2] = -1.;
411 gMC->Gsvolu(cTagV,"BOX ",idtmed[1302-1],parCha,kNparCha);
0a5f3331 412
413 // The support structure (pad plane, back panel, readout boards)
bd0f8685 414 // The aluminum frames
415 sprintf(cTagV,"UF%02d",iDet);
030b4415 416 parCha[0] = fCwidth[iplan]/2.0 + fgkCroW;
417 parCha[1] = fClength[iplan][icham]/2.0 - fgkHspace/2.0;
418 parCha[2] = fgkCroH/2.0;
bd0f8685 419 fChamberUFboxd[iDet][0] = parCha[0];
420 fChamberUFboxd[iDet][1] = parCha[1];
421 fChamberUFboxd[iDet][2] = parCha[2];
422 gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parCha,kNparCha);
423 // The inner part of the aluminum frames
424 sprintf(cTagV,"UG%02d",iDet);
030b4415 425 parCha[0] = fCwidth[iplan]/2.0 + fgkCroW - fgkCauT;
0a5f3331 426 parCha[1] = fClength[iplan][icham]/2.0 - fgkHspace/2.0 - fgkCauT;
030b4415 427 parCha[2] = -1.0;
bd0f8685 428 gMC->Gsvolu(cTagV,"BOX ",idtmed[1302-1],parCha,kNparCha);
429
430 // The material layers inside the chambers
0a5f3331 431 // Rohacell layer (radiator)
030b4415 432 parCha[0] = -1.0;
433 parCha[1] = -1.0;
030b4415 434 parCha[2] = fgkRaThick/2.0;
bd0f8685 435 sprintf(cTagV,"UH%02d",iDet);
436 gMC->Gsvolu(cTagV,"BOX ",idtmed[1315-1],parCha,kNparCha);
bd0f8685 437 // Xe/Isobutane layer (drift volume)
0a5f3331 438 parCha[0] = fCwidth[iplan]/2.0 - fgkCalT - fgkCclsT;
439 parCha[1] = fClength[iplan][icham]/2.0 - fgkHspace/2.0 - fgkCclfT;
030b4415 440 parCha[2] = fgkDrThick/2.0;
bd0f8685 441 sprintf(cTagV,"UJ%02d",iDet);
442 gMC->Gsvolu(cTagV,"BOX ",idtmed[1309-1],parCha,kNparCha);
443 // Xe/Isobutane layer (amplification volume)
0a5f3331 444 parCha[0] = -1.0;
445 parCha[1] = -1.0;
030b4415 446 parCha[2] = fgkAmThick/2.0;
bd0f8685 447 sprintf(cTagV,"UK%02d",iDet);
448 gMC->Gsvolu(cTagV,"BOX ",idtmed[1309-1],parCha,kNparCha);
0a5f3331 449 // Cu layer (wire plane)
450 parCha[0] = -1.0;
451 parCha[1] = -1.0;
452 parCha[2] = fgkWrThick/2.0;
453 sprintf(cTagV,"UW%02d",iDet);
454 gMC->Gsvolu(cTagV,"BOX ",idtmed[1303-1],parCha,kNparCha);
bd0f8685 455 // Cu layer (pad plane)
0a5f3331 456 parCha[0] = -1.0;
457 parCha[1] = -1.0;
030b4415 458 parCha[2] = fgkCuThick/2.0;
bd0f8685 459 sprintf(cTagV,"UL%02d",iDet);
460 gMC->Gsvolu(cTagV,"BOX ",idtmed[1305-1],parCha,kNparCha);
0a5f3331 461 // Epoxy layer (glue)
462 parCha[0] = -1.0;
463 parCha[1] = -1.0;
464 parCha[2] = fgkGlThick/2.0;
465 sprintf(cTagV,"UY%02d",iDet);
466 gMC->Gsvolu(cTagV,"BOX ",idtmed[1311-1],parCha,kNparCha);
bd0f8685 467 // G10 layer (support structure / honeycomb)
0a5f3331 468 parCha[0] = -1.0;
469 parCha[1] = -1.0;
030b4415 470 parCha[2] = fgkSuThick/2.0;
bd0f8685 471 sprintf(cTagV,"UM%02d",iDet);
0a5f3331 472 gMC->Gsvolu(cTagV,"BOX ",idtmed[1310-1],parCha,kNparCha);
473 // G10 layer (PCB readout board)
474 parCha[0] = -1.0;
475 parCha[1] = -1.0;
a797f961 476 parCha[2] = fgkRpThick/2;
477 sprintf(cTagV,"UN%02d",iDet);
478 gMC->Gsvolu(cTagV,"BOX ",idtmed[1313-1],parCha,kNparCha);
0a5f3331 479 // Cu layer (traces in readout board)
480 parCha[0] = -1.0;
481 parCha[1] = -1.0;
030b4415 482 parCha[2] = fgkRcThick/2.0;
a797f961 483 sprintf(cTagV,"UO%02d",iDet);
484 gMC->Gsvolu(cTagV,"BOX ",idtmed[1306-1],parCha,kNparCha);
0a5f3331 485 // Cu layer (other material on in readout board)
486 parCha[0] = -1.0;
487 parCha[1] = -1.0;
488 parCha[2] = fgkRoThick/2.0;
489 sprintf(cTagV,"UV%02d",iDet);
490 gMC->Gsvolu(cTagV,"BOX ",idtmed[1304-1],parCha,kNparCha);
bd0f8685 491
492 // Position the layers in the chambers
030b4415 493 xpos = 0.0;
494 ypos = 0.0;
bd0f8685 495 // Lower part
496 // Rohacell layer (radiator)
497 zpos = fgkRaZpos;
498 sprintf(cTagV,"UH%02d",iDet);
499 sprintf(cTagM,"UC%02d",iDet);
500 gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
bd0f8685 501 // Xe/Isobutane layer (drift volume)
502 zpos = fgkDrZpos;
503 sprintf(cTagV,"UJ%02d",iDet);
0a5f3331 504 sprintf(cTagM,"UB%02d",iDet);
bd0f8685 505 gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
506 // Upper part
507 // Xe/Isobutane layer (amplification volume)
508 zpos = fgkAmZpos;
509 sprintf(cTagV,"UK%02d",iDet);
510 sprintf(cTagM,"UE%02d",iDet);
511 gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
0a5f3331 512 // Cu layer (wire plane inside amplification volume)
513 zpos = fgkWrZpos;
514 sprintf(cTagV,"UW%02d",iDet);
515 sprintf(cTagM,"UK%02d",iDet);
516 gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
517 // Readout part + support plane
bd0f8685 518 // Cu layer (pad plane)
519 zpos = fgkCuZpos;
520 sprintf(cTagV,"UL%02d",iDet);
521 sprintf(cTagM,"UG%02d",iDet);
522 gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
0a5f3331 523 // Epoxy layer (glue)
524 zpos = fgkGlZpos;
525 sprintf(cTagV,"UY%02d",iDet);
526 sprintf(cTagM,"UG%02d",iDet);
527 gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
bd0f8685 528 // G10 layer (support structure)
529 zpos = fgkSuZpos;
530 sprintf(cTagV,"UM%02d",iDet);
531 sprintf(cTagM,"UG%02d",iDet);
532 gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
0a5f3331 533 // G10 layer (PCB readout board)
a797f961 534 zpos = fgkRpZpos;
535 sprintf(cTagV,"UN%02d",iDet);
536 sprintf(cTagM,"UG%02d",iDet);
537 gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
0a5f3331 538 // Cu layer (traces in readout board)
a797f961 539 zpos = fgkRcZpos;
540 sprintf(cTagV,"UO%02d",iDet);
541 sprintf(cTagM,"UG%02d",iDet);
542 gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
0a5f3331 543 // Cu layer (other materials on readout board)
544 zpos = fgkRoZpos;
545 sprintf(cTagV,"UV%02d",iDet);
546 sprintf(cTagM,"UG%02d",iDet);
547 gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
bd0f8685 548
549 // Position the inner volumes of the chambers in the frames
030b4415 550 xpos = 0.0;
551 ypos = 0.0;
0a5f3331 552 // The inner part of the radiator
030b4415 553 zpos = 0.0;
bd0f8685 554 sprintf(cTagV,"UC%02d",iDet);
0a5f3331 555 sprintf(cTagM,"UX%02d",iDet);
556 gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
557 // The glue around the radiator
558 zpos = fgkCraH/2.0 - fgkCdrH/2.0 - fgkCraH/2.0;
559 sprintf(cTagV,"UX%02d",iDet);
bd0f8685 560 sprintf(cTagM,"UB%02d",iDet);
561 gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
0a5f3331 562 // The lower Wacosit frame inside the aluminum frame
563 zpos = 0.0;
bd0f8685 564 sprintf(cTagV,"UB%02d",iDet);
565 sprintf(cTagM,"UA%02d",iDet);
566 gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
0a5f3331 567 // The inside of the upper Wacosit frame
568 zpos = 0.0;
bd0f8685 569 sprintf(cTagV,"UE%02d",iDet);
570 sprintf(cTagM,"UD%02d",iDet);
571 gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
572 // The inside of the upper aluminum frame
0a5f3331 573 zpos = 0.0;
bd0f8685 574 sprintf(cTagV,"UG%02d",iDet);
575 sprintf(cTagM,"UF%02d",iDet);
576 gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
577
578 // Position the frames of the chambers in the TRD mother volume
030b4415 579 xpos = 0.0;
580 ypos = - fClength[iplan][0] - fClength[iplan][1] - fClength[iplan][2]/2.0;
bd0f8685 581 for (Int_t ic = 0; ic < icham; ic++) {
582 ypos += fClength[iplan][ic];
583 }
030b4415 584 ypos += fClength[iplan][icham]/2.0;
0a5f3331 585 zpos = fgkVrocsm + fgkSMpltT + fgkCraH/2.0 + fgkCdrH/2.0 - fgkSheight/2.0
a797f961 586 + iplan * (fgkCH + fgkVspace);
bd0f8685 587 // The lower aluminum frame, radiator + drift region
588 sprintf(cTagV,"UA%02d",iDet);
589 fChamberUAorig[iDet][0] = xpos;
590 fChamberUAorig[iDet][1] = ypos;
591 fChamberUAorig[iDet][2] = zpos;
592 // The upper G10 frame, amplification region
593 sprintf(cTagV,"UD%02d",iDet);
030b4415 594 zpos += fgkCamH/2.0 + fgkCraH/2.0 + fgkCdrH/2.0;
bd0f8685 595 fChamberUDorig[iDet][0] = xpos;
596 fChamberUDorig[iDet][1] = ypos;
597 fChamberUDorig[iDet][2] = zpos;
598 // The upper aluminum frame
599 sprintf(cTagV,"UF%02d",iDet);
030b4415 600 zpos += fgkCroH/2.0 + fgkCamH/2.0;
bd0f8685 601 fChamberUForig[iDet][0] = xpos;
602 fChamberUForig[iDet][1] = ypos;
603 fChamberUForig[iDet][2] = zpos;
604
605 }
606 }
607
608 // Create the volumes of the super module frame
609 CreateFrame(idtmed);
610
611 // Create the volumes of the services
612 CreateServices(idtmed);
613
614 for (Int_t icham = 0; icham < kNcham; icham++) {
615 for (Int_t iplan = 0; iplan < kNplan; iplan++) {
616 GroupChamber(iplan,icham,idtmed);
617 }
618 }
619
030b4415 620 xpos = 0.0;
621 ypos = 0.0;
622 zpos = 0.0;
bd0f8685 623 gMC->Gspos("UTI1",1,"UTS1",xpos,ypos,zpos,0,"ONLY");
624
030b4415 625 xpos = 0.0;
626 ypos = 0.0;
627 zpos = 0.0;
bd0f8685 628 gMC->Gspos("UTS1",1,"UTR1",xpos,ypos,zpos,0,"ONLY");
629
630 // Put the TRD volumes into the space frame mother volumes
631 // if enabled via status flag
030b4415 632 xpos = 0.0;
633 ypos = 0.0;
634 zpos = 0.0;
bd0f8685 635 for (Int_t isect = 0; isect < kNsect; isect++) {
636 if (fSMstatus[isect]) {
637 sprintf(cTagV,"BTRD%d",isect);
f9017ffb 638 gMC->Gspos("UTR1",1,cTagV,xpos,ypos,zpos,0,"ONLY");
bd0f8685 639 }
640 }
641
642}
643
644//_____________________________________________________________________________
645void AliTRDgeometry::CreateFrame(Int_t *idtmed)
646{
647 //
648 // Create the geometry of the frame of the supermodule
649 //
650 // Names of the TRD services volumina
651 //
652 // USRL Support rails for the chambers (Al)
653 // USxx Support cross bars between the chambers (Al)
0a5f3331 654 // USHx Horizontal connection between the cross bars (Al)
655 // USLx Long corner ledges (Al)
bd0f8685 656 //
657
658 Int_t iplan = 0;
659
660 Float_t xpos = 0.0;
661 Float_t ypos = 0.0;
662 Float_t zpos = 0.0;
663
664 Char_t cTagV[5];
0a5f3331 665 Char_t cTagM[5];
666
667 // The rotation matrices
668 const Int_t kNmatrix = 4;
669 Int_t matrix[kNmatrix];
670 gMC->Matrix(matrix[0], 100.0, 0.0, 90.0, 90.0, 10.0, 0.0);
671 gMC->Matrix(matrix[1], 80.0, 0.0, 90.0, 90.0, 10.0, 180.0);
672 gMC->Matrix(matrix[2], 90.0, 0.0, 0.0, 0.0, 90.0, 90.0);
673 gMC->Matrix(matrix[3], 90.0, 180.0, 0.0, 180.0, 90.0, 90.0);
bd0f8685 674
675 //
676 // The chamber support rails
677 //
678
030b4415 679 const Float_t kSRLwid = 2.00;
bd0f8685 680 const Float_t kSRLhgt = 2.3;
0a5f3331 681 const Float_t kSRLdst = 1.0;
bd0f8685 682 const Int_t kNparSRL = 3;
683 Float_t parSRL[kNparSRL];
0a5f3331 684 parSRL[0] = kSRLwid /2.0;
685 parSRL[1] = fgkSlength/2.0;
686 parSRL[2] = kSRLhgt /2.0;
bd0f8685 687 gMC->Gsvolu("USRL","BOX ",idtmed[1301-1],parSRL,kNparSRL);
688
689 xpos = 0.0;
690 ypos = 0.0;
691 zpos = 0.0;
692 for (iplan = 0; iplan < kNplan; iplan++) {
0a5f3331 693 xpos = fCwidth[iplan]/2.0 + kSRLwid/2.0 + kSRLdst;
bd0f8685 694 ypos = 0.0;
0a5f3331 695 zpos = fgkVrocsm + fgkSMpltT + fgkCraH + fgkCdrH + fgkCamH
696 - fgkSheight/2.0
bd0f8685 697 + iplan * (fgkCH + fgkVspace);
698 gMC->Gspos("USRL",iplan+1 ,"UTI1", xpos,ypos,zpos,0,"ONLY");
699 gMC->Gspos("USRL",iplan+1+ kNplan,"UTI1",-xpos,ypos,zpos,0,"ONLY");
bd0f8685 700 }
701
702 //
703 // The cross bars between the chambers
704 //
705
706 const Float_t kSCBwid = 1.0;
0a5f3331 707 const Float_t kSCBthk = 2.0;
708 const Float_t kSCHhgt = 0.3;
709
bd0f8685 710 const Int_t kNparSCB = 3;
711 Float_t parSCB[kNparSCB];
030b4415 712 parSCB[1] = kSCBwid/2.0;
0a5f3331 713 parSCB[2] = fgkCH /2.0 + fgkVspace/2.0 - kSCHhgt;
714
715 const Int_t kNparSCI = 3;
716 Float_t parSCI[kNparSCI];
717 parSCI[1] = -1;
bd0f8685 718
719 xpos = 0.0;
720 ypos = 0.0;
721 zpos = 0.0;
722 for (iplan = 0; iplan < kNplan; iplan++) {
723
0a5f3331 724 // The aluminum of the cross bars
030b4415 725 parSCB[0] = fCwidth[iplan]/2.0 + kSRLdst/2.0;
0a5f3331 726 sprintf(cTagV,"USF%01d",iplan);
bd0f8685 727 gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parSCB,kNparSCB);
bd0f8685 728
0a5f3331 729 // The empty regions in the cross bars
730 Float_t thkSCB = kSCBthk;
731 if (iplan < 2) {
732 thkSCB *= 1.5;
733 }
734 parSCI[2] = parSCB[2] - thkSCB;
735 parSCI[0] = parSCB[0]/4.0 - kSCBthk;
736 sprintf(cTagV,"USI%01d",iplan);
737 gMC->Gsvolu(cTagV,"BOX ",idtmed[1302-1],parSCI,kNparSCI);
bd0f8685 738
0a5f3331 739 sprintf(cTagV,"USI%01d",iplan);
740 sprintf(cTagM,"USF%01d",iplan);
741 ypos = 0.0;
742 zpos = 0.0;
743 xpos = parSCI[0] + thkSCB/2.0;
744 gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
745 xpos = - parSCI[0] - thkSCB/2.0;
746 gMC->Gspos(cTagV,2,cTagM,xpos,ypos,zpos,0,"ONLY");
747 xpos = 3.0 * parSCI[0] + 1.5 * thkSCB;
748 gMC->Gspos(cTagV,3,cTagM,xpos,ypos,zpos,0,"ONLY");
749 xpos = - 3.0 * parSCI[0] - 1.5 * thkSCB;
750 gMC->Gspos(cTagV,4,cTagM,xpos,ypos,zpos,0,"ONLY");
751
752 sprintf(cTagV,"USF%01d",iplan);
bd0f8685 753 xpos = 0.0;
0a5f3331 754 zpos = fgkVrocsm + fgkSMpltT + parSCB[2] - fgkSheight/2.0
755 + iplan * (fgkCH + fgkVspace);
756
757 ypos = fgkSlength/2.0 - kSCBwid/2.0;
bd0f8685 758 gMC->Gspos(cTagV,1,"UTI1", xpos,ypos,zpos,0,"ONLY");
759
0a5f3331 760 ypos = fClength[iplan][2]/2.0 + fClength[iplan][1];
761 gMC->Gspos(cTagV,2,"UTI1", xpos,ypos,zpos,0,"ONLY");
762
763 ypos = fClength[iplan][2]/2.0;
764 gMC->Gspos(cTagV,3,"UTI1", xpos,ypos,zpos,0,"ONLY");
765
030b4415 766 ypos = - fClength[iplan][2]/2.0;
0a5f3331 767 gMC->Gspos(cTagV,4,"UTI1", xpos,ypos,zpos,0,"ONLY");
bd0f8685 768
030b4415 769 ypos = - fClength[iplan][2]/2.0 - fClength[iplan][1];
0a5f3331 770 gMC->Gspos(cTagV,5,"UTI1", xpos,ypos,zpos,0,"ONLY");
bd0f8685 771
0a5f3331 772 ypos = - fgkSlength/2.0 + kSCBwid/2.0;
773 gMC->Gspos(cTagV,6,"UTI1", xpos,ypos,zpos,0,"ONLY");
774
775 }
776
777 //
778 // The horizontal connections between the cross bars
779 //
780
781 const Int_t kNparSCH = 3;
782 Float_t parSCH[kNparSCH];
783
784 for (iplan = 1; iplan < kNplan-1; iplan++) {
785
786 parSCH[0] = fCwidth[iplan]/2.0;
787 parSCH[1] = (fClength[iplan+1][2]/2.0 + fClength[iplan+1][1]
788 - fClength[iplan ][2]/2.0 - fClength[iplan ][1])/2.0;
789 parSCH[2] = kSCHhgt/2.0;
790
791 sprintf(cTagV,"USH%01d",iplan);
792 gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parSCH,kNparSCH);
bd0f8685 793 xpos = 0.0;
0a5f3331 794 ypos = fClength[iplan][2]/2.0 + fClength[iplan][1] + parSCH[1];
795 zpos = fgkVrocsm + fgkSMpltT - kSCHhgt/2.0 - fgkSheight/2.0
796 + (iplan+1) * (fgkCH + fgkVspace);
bd0f8685 797 gMC->Gspos(cTagV,1,"UTI1", xpos,ypos,zpos,0,"ONLY");
0a5f3331 798 ypos = -ypos;
799 gMC->Gspos(cTagV,2,"UTI1", xpos,ypos,zpos,0,"ONLY");
bd0f8685 800
801 }
802
0a5f3331 803 //
804 // The long corner ledges
805 //
806
807 const Int_t kNparSCL = 3;
808 Float_t parSCL[kNparSCL];
809 const Int_t kNparSCLb = 11;
810 Float_t parSCLb[kNparSCLb];
811
812 // Upper ledges
813 // Thickness of the corner ledges
814 const Float_t kSCLthkUa = 0.6;
815 const Float_t kSCLthkUb = 0.6;
816 // Width of the corner ledges
817 const Float_t kSCLwidUa = 3.2;
818 const Float_t kSCLwidUb = 4.8;
819 // Position of the corner ledges
820 const Float_t kSCLposxUa = 0.7;
821 const Float_t kSCLposxUb = 3.3;
822 const Float_t kSCLposzUa = 1.6;
823 const Float_t kSCLposzUb = 0.3;
824 // Vertical
825 parSCL[0] = kSCLthkUa /2.0;
826 parSCL[1] = fgkSlength/2.0;
827 parSCL[2] = kSCLwidUa /2.0;
828 gMC->Gsvolu("USL1","BOX ",idtmed[1301-1],parSCL,kNparSCL);
829 xpos = fgkSwidth2/2.0 - fgkSMpltT - kSCLposxUa;
830 ypos = 0.0;
831 zpos = fgkSheight/2.0 - fgkSMpltT - kSCLposzUa;
832 gMC->Gspos("USL1",1,"UTI1", xpos,ypos,zpos,matrix[0],"ONLY");
833 xpos = -xpos;
834 gMC->Gspos("USL1",2,"UTI1", xpos,ypos,zpos,matrix[1],"ONLY");
835 // Horizontal
836 parSCL[0] = kSCLwidUb /2.0;
837 parSCL[1] = fgkSlength/2.0;
838 parSCL[2] = kSCLthkUb /2.0;
839 gMC->Gsvolu("USL2","BOX ",idtmed[1301-1],parSCL,kNparSCL);
840 xpos = fgkSwidth2/2.0 - fgkSMpltT - kSCLposxUb;
841 ypos = 0.0;
842 zpos = fgkSheight/2.0 - fgkSMpltT - kSCLposzUb;
843 gMC->Gspos("USL2",1,"UTI1", xpos,ypos,zpos, 0,"ONLY");
844 xpos = -xpos;
845 gMC->Gspos("USL2",2,"UTI1", xpos,ypos,zpos, 0,"ONLY");
846
847 // Lower ledges
848 // Thickness of the corner ledges
849 const Float_t kSCLthkLa = 2.464;
850 const Float_t kSCLthkLb = 1.0;
851 // Width of the corner ledges
852 const Float_t kSCLwidLa = 8.5;
853 const Float_t kSCLwidLb = 3.3;
854 // Position of the corner ledges
855 const Float_t kSCLposxLa = 0.0;
856 const Float_t kSCLposxLb = 2.6;
857 const Float_t kSCLposzLa = -4.25;
858 const Float_t kSCLposzLb = -0.5;
859 // Vertical
860 // Trapezoidal shape
861 parSCLb[ 0] = fgkSlength/2.0;
862 parSCLb[ 1] = 0.0;
863 parSCLb[ 2] = 0.0;
864 parSCLb[ 3] = kSCLwidLa /2.0;
865 parSCLb[ 4] = kSCLthkLb /2.0;
866 parSCLb[ 5] = kSCLthkLa /2.0;
867 parSCLb[ 6] = 5.0;
868 parSCLb[ 7] = kSCLwidLa /2.0;
869 parSCLb[ 8] = kSCLthkLb /2.0;
870 parSCLb[ 9] = kSCLthkLa /2.0;
871 parSCLb[10] = 5.0;
872 gMC->Gsvolu("USL3","TRAP",idtmed[1301-1],parSCLb,kNparSCLb);
873 xpos = fgkSwidth1/2.0 - fgkSMpltT - kSCLposxLa;
874 ypos = 0.0;
875 zpos = - fgkSheight/2.0 + fgkSMpltT - kSCLposzLa;
876 gMC->Gspos("USL3",1,"UTI1", xpos,ypos,zpos,matrix[2],"ONLY");
877 xpos = -xpos;
878 gMC->Gspos("USL3",2,"UTI1", xpos,ypos,zpos,matrix[3],"ONLY");
879 // Horizontal
880 parSCL[0] = kSCLwidLb /2.0;
881 parSCL[1] = fgkSlength/2.0;
882 parSCL[2] = kSCLthkLb /2.0;
883 gMC->Gsvolu("USL4","BOX ",idtmed[1301-1],parSCL,kNparSCL);
884 xpos = fgkSwidth1/2.0 - fgkSMpltT - kSCLposxLb;
885 ypos = 0.0;
886 zpos = - fgkSheight/2.0 + fgkSMpltT - kSCLposzLb;
887 gMC->Gspos("USL4",1,"UTI1", xpos,ypos,zpos, 0,"ONLY");
888 xpos = -xpos;
889 gMC->Gspos("USL4",2,"UTI1", xpos,ypos,zpos, 0,"ONLY");
890
bd0f8685 891}
892
893//_____________________________________________________________________________
894void AliTRDgeometry::CreateServices(Int_t *idtmed)
895{
896 //
897 // Create the geometry of the services
898 //
899 // Names of the TRD services volumina
900 //
901 // UTCL Cooling arterias (Al)
902 // UTCW Cooling arterias (Water)
903 // UUxx Volumes for the services at the chambers (Air)
904 // UTPW Power bars (Cu)
0a5f3331 905 // UTCP Cooling pipes (Fe)
bd0f8685 906 // UTCH Cooling pipes (Water)
907 // UTPL Power lines (Cu)
908 // UMCM Readout MCMs (G10/Cu/Si)
909 //
910
911 Int_t iplan = 0;
912 Int_t icham = 0;
913
914 Float_t xpos = 0.0;
915 Float_t ypos = 0.0;
916 Float_t zpos = 0.0;
917
918 Char_t cTagV[5];
919
920 // The rotation matrices
99ed5146 921 const Int_t kNmatrix = 4;
bd0f8685 922 Int_t matrix[kNmatrix];
030b4415 923 gMC->Matrix(matrix[0], 100.0, 0.0, 90.0, 90.0, 10.0, 0.0);
924 gMC->Matrix(matrix[1], 80.0, 0.0, 90.0, 90.0, 10.0, 180.0);
925 gMC->Matrix(matrix[2], 0.0, 0.0, 90.0, 90.0, 90.0, 0.0);
99ed5146 926 gMC->Matrix(matrix[3], 180.0, 0.0, 90.0, 90.0, 90.0, 180.0);
bd0f8685 927
030b4415 928 AliTRDCommonParam *commonParam = AliTRDCommonParam::Instance();
2745a409 929 if (!commonParam) {
930 AliError("Could not get common parameters\n");
bd0f8685 931 return;
932 }
933
934 //
935 // The cooling arterias
936 //
937
938 // Width of the cooling arterias
0a5f3331 939 const Float_t kCOLwid = 0.8;
bd0f8685 940 // Height of the cooling arterias
0a5f3331 941 const Float_t kCOLhgt = 6.5;
bd0f8685 942 // Positioning of the cooling
0a5f3331 943 const Float_t kCOLposx = 1.8;
944 const Float_t kCOLposz = -0.1;
bd0f8685 945 // Thickness of the walls of the cooling arterias
946 const Float_t kCOLthk = 0.1;
030b4415 947 const Int_t kNparCOL = 3;
bd0f8685 948 Float_t parCOL[kNparCOL];
0a5f3331 949 parCOL[0] = kCOLwid /2.0;
950 parCOL[1] = fgkSlength/2.0;
951 parCOL[2] = kCOLhgt /2.0;
952 gMC->Gsvolu("UTCL","BOX ",idtmed[1308-1],parCOL,kNparCOL);
bd0f8685 953 parCOL[0] -= kCOLthk;
0a5f3331 954 parCOL[1] = fgkSlength/2.0;
bd0f8685 955 parCOL[2] -= kCOLthk;
956 gMC->Gsvolu("UTCW","BOX ",idtmed[1314-1],parCOL,kNparCOL);
957
958 xpos = 0.0;
959 ypos = 0.0;
960 zpos = 0.0;
961 gMC->Gspos("UTCW",1,"UTCL", xpos,ypos,zpos,0,"ONLY");
962
99ed5146 963 for (iplan = 1; iplan < kNplan; iplan++) {
964
030b4415 965 xpos = fCwidth[iplan]/2.0 + kCOLwid/2.0 + kCOLposx;
bd0f8685 966 ypos = 0.0;
0a5f3331 967 zpos = fgkVrocsm + fgkSMpltT + kCOLhgt/2.0 - fgkSheight/2.0 + kCOLposz
a797f961 968 + iplan * (fgkCH + fgkVspace);
99ed5146 969 gMC->Gspos("UTCL",iplan ,"UTI1", xpos,ypos,zpos,matrix[0],"ONLY");
970 gMC->Gspos("UTCL",iplan+kNplan,"UTI1",-xpos,ypos,zpos,matrix[1],"ONLY");
971
bd0f8685 972 }
973
99ed5146 974 // The upper most layer (reaching into TOF acceptance)
0a5f3331 975 xpos = fCwidth[5]/2.0 - kCOLhgt/2.0 - 1.3;
99ed5146 976 ypos = 0.0;
0a5f3331 977 zpos = fgkSheight/2.0 - fgkSMpltT - 0.4 - kCOLwid/2.0;
99ed5146 978 gMC->Gspos("UTCL",6 ,"UTI1", xpos,ypos,zpos,matrix[3],"ONLY");
979 gMC->Gspos("UTCL",6+kNplan,"UTI1",-xpos,ypos,zpos,matrix[3],"ONLY");
980
bd0f8685 981 //
982 // The power bars
983 //
984
985 const Float_t kPWRwid = 0.6;
0a5f3331 986 const Float_t kPWRhgt = 5.0;
987 const Float_t kPWRposx = 1.4;
988 const Float_t kPWRposz = 1.9;
030b4415 989 const Int_t kNparPWR = 3;
bd0f8685 990 Float_t parPWR[kNparPWR];
0a5f3331 991 parPWR[0] = kPWRwid /2.0;
992 parPWR[1] = fgkSlength/2.0;
993 parPWR[2] = kPWRhgt /2.0;
bd0f8685 994 gMC->Gsvolu("UTPW","BOX ",idtmed[1325-1],parPWR,kNparPWR);
995
99ed5146 996 for (iplan = 1; iplan < kNplan; iplan++) {
bd0f8685 997
030b4415 998 xpos = fCwidth[iplan]/2.0 + kPWRwid/2.0 + kPWRposx;
bd0f8685 999 ypos = 0.0;
0a5f3331 1000 zpos = fgkVrocsm + fgkSMpltT + kPWRhgt/2.0 - fgkSheight/2.0 + kPWRposz
a797f961 1001 + iplan * (fgkCH + fgkVspace);
99ed5146 1002 gMC->Gspos("UTPW",iplan ,"UTI1", xpos,ypos,zpos,matrix[0],"ONLY");
1003 gMC->Gspos("UTPW",iplan+kNplan,"UTI1",-xpos,ypos,zpos,matrix[1],"ONLY");
bd0f8685 1004
1005 }
1006
99ed5146 1007 // The upper most layer (reaching into TOF acceptance)
0a5f3331 1008 xpos = fCwidth[5]/2.0 + kPWRhgt/2.0 - 1.3;
99ed5146 1009 ypos = 0.0;
0a5f3331 1010 zpos = fgkSheight/2.0 - fgkSMpltT - 0.6 - kPWRwid/2.0;
99ed5146 1011 gMC->Gspos("UTPW",6 ,"UTI1", xpos,ypos,zpos,matrix[3],"ONLY");
1012 gMC->Gspos("UTPW",6+kNplan,"UTI1",-xpos,ypos,zpos,matrix[3],"ONLY");
1013
bd0f8685 1014 //
1015 // The volumes for the services at the chambers
1016 //
1017
1018 const Int_t kNparServ = 3;
1019 Float_t parServ[kNparServ];
1020
1021 for (icham = 0; icham < kNcham; icham++) {
1022 for (iplan = 0; iplan < kNplan; iplan++) {
bd0f8685 1023
1024 Int_t iDet = GetDetectorSec(iplan,icham);
1025
1026 sprintf(cTagV,"UU%02d",iDet);
0a5f3331 1027 parServ[0] = fCwidth[iplan] /2.0;
030b4415 1028 parServ[1] = fClength[iplan][icham]/2.0 - fgkHspace/2.0;
0a5f3331 1029 parServ[2] = fgkVspace /2.0 - 0.742/2.0;
bd0f8685 1030 fChamberUUboxd[iDet][0] = parServ[0];
1031 fChamberUUboxd[iDet][1] = parServ[1];
1032 fChamberUUboxd[iDet][2] = parServ[2];
bd0f8685 1033 gMC->Gsvolu(cTagV,"BOX",idtmed[1302-1],parServ,kNparServ);
a797f961 1034
0a5f3331 1035 xpos = 0.0;
030b4415 1036 ypos = - fClength[iplan][0] - fClength[iplan][1] - fClength[iplan][2]/2.0;
bd0f8685 1037 for (Int_t ic = 0; ic < icham; ic++) {
1038 ypos += fClength[iplan][ic];
1039 }
030b4415 1040 ypos += fClength[iplan][icham]/2.0;
0a5f3331 1041 zpos = fgkVrocsm + fgkSMpltT + fgkCH + fgkVspace/2.0 - fgkSheight/2.0
a797f961 1042 + iplan * (fgkCH + fgkVspace);
030b4415 1043 zpos -= 0.742/2.0;
bd0f8685 1044 fChamberUUorig[iDet][0] = xpos;
1045 fChamberUUorig[iDet][1] = ypos;
1046 fChamberUUorig[iDet][2] = zpos;
1047
1048 }
1049 }
1050
1051 //
1052 // The cooling pipes inside the service volumes
1053 //
1054
1055 const Int_t kNparTube = 3;
1056 Float_t parTube[kNparTube];
0a5f3331 1057 // The cooling pipes
bd0f8685 1058 parTube[0] = 0.0;
1059 parTube[1] = 0.0;
1060 parTube[2] = 0.0;
1061 gMC->Gsvolu("UTCP","TUBE",idtmed[1324-1],parTube,0);
1062 // The cooling water
1063 parTube[0] = 0.0;
030b4415 1064 parTube[1] = 0.2/2.0;
bd0f8685 1065 parTube[2] = -1.;
1066 gMC->Gsvolu("UTCH","TUBE",idtmed[1314-1],parTube,kNparTube);
1067 // Water inside the cooling pipe
1068 xpos = 0.0;
1069 ypos = 0.0;
1070 zpos = 0.0;
1071 gMC->Gspos("UTCH",1,"UTCP",xpos,ypos,zpos,0,"ONLY");
1072
1073 // Position the cooling pipes in the mother volume
1074 const Int_t kNpar = 3;
1075 Float_t par[kNpar];
1076 for (icham = 0; icham < kNcham; icham++) {
1077 for (iplan = 0; iplan < kNplan; iplan++) {
bd0f8685 1078 Int_t iDet = GetDetectorSec(iplan,icham);
1079 Int_t iCopy = GetDetector(iplan,icham,0) * 100;
1080 Int_t nMCMrow = commonParam->GetRowMax(iplan,icham,0);
030b4415 1081 Float_t ySize = (GetChamberLength(iplan,icham) - 2.0*fgkRpadW)
bd0f8685 1082 / ((Float_t) nMCMrow);
1083 sprintf(cTagV,"UU%02d",iDet);
1084 for (Int_t iMCMrow = 0; iMCMrow < nMCMrow; iMCMrow++) {
1085 xpos = 0.0;
1086 ypos = (0.5 + iMCMrow) * ySize - 1.9
030b4415 1087 - fClength[iplan][icham]/2.0 + fgkHspace/2.0;
1088 zpos = 0.0 + 0.742/2.0;
bd0f8685 1089 par[0] = 0.0;
030b4415 1090 par[1] = 0.3/2.0; // Thickness of the cooling pipes
1091 par[2] = fCwidth[iplan]/2.0;
bd0f8685 1092 gMC->Gsposp("UTCP",iCopy+iMCMrow,cTagV,xpos,ypos,zpos
1093 ,matrix[2],"ONLY",par,kNpar);
1094 }
1095 }
1096 }
1097
1098 //
1099 // The power lines
1100 //
1101
1102 // The copper power lines
1103 parTube[0] = 0.0;
1104 parTube[1] = 0.0;
1105 parTube[2] = 0.0;
1106 gMC->Gsvolu("UTPL","TUBE",idtmed[1305-1],parTube,0);
1107
1108 // Position the power lines in the mother volume
1109 for (icham = 0; icham < kNcham; icham++) {
1110 for (iplan = 0; iplan < kNplan; iplan++) {
bd0f8685 1111 Int_t iDet = GetDetectorSec(iplan,icham);
1112 Int_t iCopy = GetDetector(iplan,icham,0) * 100;
1113 Int_t nMCMrow = commonParam->GetRowMax(iplan,icham,0);
030b4415 1114 Float_t ySize = (GetChamberLength(iplan,icham) - 2.0*fgkRpadW)
bd0f8685 1115 / ((Float_t) nMCMrow);
1116 sprintf(cTagV,"UU%02d",iDet);
1117 for (Int_t iMCMrow = 0; iMCMrow < nMCMrow; iMCMrow++) {
1118 xpos = 0.0;
1119 ypos = (0.5 + iMCMrow) * ySize - 1.0
030b4415 1120 - fClength[iplan][icham]/2.0 + fgkHspace/2.0;
1121 zpos = -0.4 + 0.742/2.0;
bd0f8685 1122 par[0] = 0.0;
030b4415 1123 par[1] = 0.2/2.0; // Thickness of the power lines
1124 par[2] = fCwidth[iplan]/2.0;
bd0f8685 1125 gMC->Gsposp("UTPL",iCopy+iMCMrow,cTagV,xpos,ypos,zpos
1126 ,matrix[2],"ONLY",par,kNpar);
1127 }
1128 }
1129 }
1130
1131 //
1132 // The MCMs
1133 //
1134
0a5f3331 1135 const Float_t kMCMx = 3.0;
1136 const Float_t kMCMy = 3.0;
1137 const Float_t kMCMz = 0.3;
1138
1139 const Float_t kMCMpcTh = 0.1;
1140 const Float_t kMCMcuTh = 0.0215;
1141 const Float_t kMCMsiTh = 0.003;
1142 const Float_t kMCMcoTh = 0.1549;
1143
bd0f8685 1144 // The mother volume for the MCMs (air)
1145 const Int_t kNparMCM = 3;
1146 Float_t parMCM[kNparMCM];
0a5f3331 1147 parMCM[0] = kMCMx /2.0;
1148 parMCM[1] = kMCMy /2.0;
1149 parMCM[2] = kMCMz /2.0;
bd0f8685 1150 gMC->Gsvolu("UMCM","BOX",idtmed[1302-1],parMCM,kNparMCM);
1151
1152 // The MCM carrier G10 layer
0a5f3331 1153 parMCM[0] = kMCMx /2.0;
1154 parMCM[1] = kMCMy /2.0;
1155 parMCM[2] = kMCMpcTh/2.0;
bd0f8685 1156 gMC->Gsvolu("UMC1","BOX",idtmed[1319-1],parMCM,kNparMCM);
1157 // The MCM carrier Cu layer
0a5f3331 1158 parMCM[0] = kMCMx /2.0;
1159 parMCM[1] = kMCMy /2.0;
1160 parMCM[2] = kMCMcuTh/2.0;
bd0f8685 1161 gMC->Gsvolu("UMC2","BOX",idtmed[1318-1],parMCM,kNparMCM);
1162 // The silicon of the chips
0a5f3331 1163 parMCM[0] = kMCMx /2.0;
1164 parMCM[1] = kMCMy /2.0;
1165 parMCM[2] = kMCMsiTh/2.0;
bd0f8685 1166 gMC->Gsvolu("UMC3","BOX",idtmed[1320-1],parMCM,kNparMCM);
0a5f3331 1167 // The aluminum of the cooling plates
1168 parMCM[0] = kMCMx /2.0;
1169 parMCM[1] = kMCMy /2.0;
1170 parMCM[2] = kMCMcoTh/2.0;
1171 gMC->Gsvolu("UMC4","BOX",idtmed[1324-1],parMCM,kNparMCM);
bd0f8685 1172
1173 // Put the MCM material inside the MCM mother volume
1174 xpos = 0.0;
1175 ypos = 0.0;
0a5f3331 1176 zpos = -kMCMz /2.0 + kMCMpcTh/2.0;
bd0f8685 1177 gMC->Gspos("UMC1",1,"UMCM",xpos,ypos,zpos,0,"ONLY");
0a5f3331 1178 zpos += kMCMpcTh/2.0 + kMCMcuTh/2.0;
bd0f8685 1179 gMC->Gspos("UMC2",1,"UMCM",xpos,ypos,zpos,0,"ONLY");
0a5f3331 1180 zpos += kMCMcuTh/2.0 + kMCMsiTh/2.0;
bd0f8685 1181 gMC->Gspos("UMC3",1,"UMCM",xpos,ypos,zpos,0,"ONLY");
0a5f3331 1182 zpos += kMCMsiTh/2.0 + kMCMcoTh/2.0;
1183 gMC->Gspos("UMC4",1,"UMCM",xpos,ypos,zpos,0,"ONLY");
bd0f8685 1184
1185 // Position the MCMs in the mother volume
1186 for (icham = 0; icham < kNcham; icham++) {
1187 for (iplan = 0; iplan < kNplan; iplan++) {
bd0f8685 1188 Int_t iDet = GetDetectorSec(iplan,icham);
1189 Int_t iCopy = GetDetector(iplan,icham,0) * 1000;
1190 Int_t nMCMrow = commonParam->GetRowMax(iplan,icham,0);
030b4415 1191 Float_t ySize = (GetChamberLength(iplan,icham) - 2.0*fgkRpadW)
bd0f8685 1192 / ((Float_t) nMCMrow);
1193 Int_t nMCMcol = 8;
0a5f3331 1194 Float_t xSize = (GetChamberWidth(iplan) - 2.0*fgkCpadW)
bd0f8685 1195 / ((Float_t) nMCMcol);
1196 sprintf(cTagV,"UU%02d",iDet);
1197 for (Int_t iMCMrow = 0; iMCMrow < nMCMrow; iMCMrow++) {
1198 for (Int_t iMCMcol = 0; iMCMcol < nMCMcol; iMCMcol++) {
1199 xpos = (0.5 + iMCMcol) * xSize + 1.0
030b4415 1200 - fCwidth[iplan]/2.0;
bd0f8685 1201 ypos = (0.5 + iMCMrow) * ySize + 1.0
030b4415 1202 - fClength[iplan][icham]/2.0 + fgkHspace/2.0;
1203 zpos = -0.4 + 0.742/2.0;
bd0f8685 1204 par[0] = 0.0;
030b4415 1205 par[1] = 0.2/2.0; // Thickness of the power lines
1206 par[2] = fCwidth[iplan]/2.0;
bd0f8685 1207 gMC->Gspos("UMCM",iCopy+iMCMrow*10+iMCMcol,cTagV
1208 ,xpos,ypos,zpos,0,"ONLY");
1209 }
1210 }
1211
1212 }
1213 }
1214
1215}
1216
1217//_____________________________________________________________________________
1218void AliTRDgeometry::GroupChamber(Int_t iplan, Int_t icham, Int_t *idtmed)
f7336fa3 1219{
1220 //
bd0f8685 1221 // Group volumes UA, UD, UF, UU in a single chamber (Air)
1222 // UA, UD, UF, UU are boxes
1223 // UT will be a box
0a770ac9 1224 //
bd0f8685 1225
1226 const Int_t kNparCha = 3;
1227
1228 Int_t iDet = GetDetectorSec(iplan,icham);
1229
1230 Float_t xyzMin[3];
1231 Float_t xyzMax[3];
1232 Float_t xyzOrig[3];
1233 Float_t xyzBoxd[3];
1234
1235 Char_t cTagV[5];
1236 Char_t cTagM[5];
1237
1238 for (Int_t i = 0; i < 3; i++) {
030b4415 1239 xyzMin[i] = +9999.0;
1240 xyzMax[i] = -9999.0;
bd0f8685 1241 }
1242
1243 for (Int_t i = 0; i < 3; i++) {
1244
1245 xyzMin[i] = TMath::Min(xyzMin[i],fChamberUAorig[iDet][i]-fChamberUAboxd[iDet][i]);
1246 xyzMax[i] = TMath::Max(xyzMax[i],fChamberUAorig[iDet][i]+fChamberUAboxd[iDet][i]);
1247
1248 xyzMin[i] = TMath::Min(xyzMin[i],fChamberUDorig[iDet][i]-fChamberUDboxd[iDet][i]);
1249 xyzMax[i] = TMath::Max(xyzMax[i],fChamberUDorig[iDet][i]+fChamberUDboxd[iDet][i]);
1250
1251 xyzMin[i] = TMath::Min(xyzMin[i],fChamberUForig[iDet][i]-fChamberUFboxd[iDet][i]);
1252 xyzMax[i] = TMath::Max(xyzMax[i],fChamberUForig[iDet][i]+fChamberUFboxd[iDet][i]);
1253
a797f961 1254 xyzMin[i] = TMath::Min(xyzMin[i],fChamberUUorig[iDet][i]-fChamberUUboxd[iDet][i]);
1255 xyzMax[i] = TMath::Max(xyzMax[i],fChamberUUorig[iDet][i]+fChamberUUboxd[iDet][i]);
bd0f8685 1256
1257 xyzOrig[i] = 0.5*(xyzMax[i]+xyzMin[i]);
1258 xyzBoxd[i] = 0.5*(xyzMax[i]-xyzMin[i]);
1259
1260 }
1261
1262 sprintf(cTagM,"UT%02d",iDet);
bd0f8685 1263 gMC->Gsvolu(cTagM,"BOX ",idtmed[1302-1],xyzBoxd,kNparCha);
1264
1265 sprintf(cTagV,"UA%02d",iDet);
0a5f3331 1266 gMC->Gspos(cTagV,1,cTagM
1267 ,fChamberUAorig[iDet][0]-xyzOrig[0]
1268 ,fChamberUAorig[iDet][1]-xyzOrig[1]
1269 ,fChamberUAorig[iDet][2]-xyzOrig[2]
1270 ,0,"ONLY");
1271
1272 sprintf(cTagV,"UZ%02d",iDet);
1273 gMC->Gspos(cTagV,1,cTagM
1274 ,fChamberUAorig[iDet][0]-xyzOrig[0] + fChamberUAboxd[iDet][0] - fgkCroW/2.0
1275 ,fChamberUAorig[iDet][1]-xyzOrig[1]
1276 ,fChamberUAorig[iDet][2]-xyzOrig[2] + fgkCraH/2.0 + fgkCdrH/2.0 - fgkCalW/2.0
1277 ,0,"ONLY");
1278 gMC->Gspos(cTagV,2,cTagM
1279 ,fChamberUAorig[iDet][0]-xyzOrig[0] - fChamberUAboxd[iDet][0] + fgkCroW/2.0
1280 ,fChamberUAorig[iDet][1]-xyzOrig[1]
1281 ,fChamberUAorig[iDet][2]-xyzOrig[2] + fgkCraH/2.0 + fgkCdrH/2.0 - fgkCalW/2.0
1282 ,0,"ONLY");
bd0f8685 1283
1284 sprintf(cTagV,"UD%02d",iDet);
0a5f3331 1285 gMC->Gspos(cTagV,1,cTagM
1286 ,fChamberUDorig[iDet][0]-xyzOrig[0]
1287 ,fChamberUDorig[iDet][1]-xyzOrig[1]
1288 ,fChamberUDorig[iDet][2]-xyzOrig[2]
1289 ,0,"ONLY");
bd0f8685 1290
1291 sprintf(cTagV,"UF%02d",iDet);
0a5f3331 1292 gMC->Gspos(cTagV,1,cTagM
1293 ,fChamberUForig[iDet][0]-xyzOrig[0]
1294 ,fChamberUForig[iDet][1]-xyzOrig[1]
1295 ,fChamberUForig[iDet][2]-xyzOrig[2]
1296 ,0,"ONLY");
bd0f8685 1297
a797f961 1298 sprintf(cTagV,"UU%02d",iDet);
0a5f3331 1299 gMC->Gspos(cTagV,1,cTagM
1300 ,fChamberUUorig[iDet][0]-xyzOrig[0]
1301 ,fChamberUUorig[iDet][1]-xyzOrig[1]
1302 ,fChamberUUorig[iDet][2]-xyzOrig[2]
1303 ,0,"ONLY");
bd0f8685 1304
1305 sprintf(cTagV,"UT%02d",iDet);
0a5f3331 1306 gMC->Gspos(cTagV,1,"UTI1"
1307 ,xyzOrig[0]
1308 ,xyzOrig[1]
1309 ,xyzOrig[2]
1310 ,0,"ONLY");
f7336fa3 1311
1312}
1313
f7336fa3 1314//_____________________________________________________________________________
a5cadd36 1315Bool_t AliTRDgeometry::Rotate(Int_t d, Double_t *pos, Double_t *rot) const
f7336fa3 1316{
1317 //
1318 // Rotates all chambers in the position of sector 0 and transforms
1319 // the coordinates in the ALICE restframe <pos> into the
1320 // corresponding local frame <rot>.
1321 //
1322
793ff80c 1323 Int_t sector = GetSector(d);
f7336fa3 1324
793ff80c 1325 rot[0] = pos[0] * fRotA11[sector] + pos[1] * fRotA12[sector];
1326 rot[1] = -pos[0] * fRotA21[sector] + pos[1] * fRotA22[sector];
f7336fa3 1327 rot[2] = pos[2];
1328
1329 return kTRUE;
1330
1331}
1332
1333//_____________________________________________________________________________
a5cadd36 1334Bool_t AliTRDgeometry::RotateBack(Int_t d, Double_t *rot, Double_t *pos) const
f7336fa3 1335{
1336 //
1337 // Rotates a chambers from the position of sector 0 into its
1338 // original position and transforms the corresponding local frame
1339 // coordinates <rot> into the coordinates of the ALICE restframe <pos>.
1340 //
1341
793ff80c 1342 Int_t sector = GetSector(d);
f7336fa3 1343
793ff80c 1344 pos[0] = rot[0] * fRotB11[sector] + rot[1] * fRotB12[sector];
1345 pos[1] = -rot[0] * fRotB21[sector] + rot[1] * fRotB22[sector];
6f1e466d 1346 pos[2] = rot[2];
f7336fa3 1347
1348 return kTRUE;
1349
1350}
1351
1352//_____________________________________________________________________________
3551db50 1353Int_t AliTRDgeometry::GetDetectorSec(Int_t p, Int_t c)
0a770ac9 1354{
1355 //
1356 // Convert plane / chamber into detector number for one single sector
1357 //
1358
1359 return (p + c * fgkNplan);
1360
1361}
1362
1363//_____________________________________________________________________________
3551db50 1364Int_t AliTRDgeometry::GetDetector(Int_t p, Int_t c, Int_t s)
f7336fa3 1365{
1366 //
1367 // Convert plane / chamber / sector into detector number
1368 //
1369
793ff80c 1370 return (p + c * fgkNplan + s * fgkNplan * fgkNcham);
f7336fa3 1371
1372}
1373
1374//_____________________________________________________________________________
afc51ac2 1375Int_t AliTRDgeometry::GetPlane(Int_t d) const
f7336fa3 1376{
1377 //
1378 // Reconstruct the plane number from the detector number
1379 //
1380
793ff80c 1381 return ((Int_t) (d % fgkNplan));
f7336fa3 1382
1383}
1384
1385//_____________________________________________________________________________
afc51ac2 1386Int_t AliTRDgeometry::GetChamber(Int_t d) const
f7336fa3 1387{
1388 //
1389 // Reconstruct the chamber number from the detector number
1390 //
1391
793ff80c 1392 return ((Int_t) (d % (fgkNplan * fgkNcham)) / fgkNplan);
f7336fa3 1393
1394}
1395
1396//_____________________________________________________________________________
afc51ac2 1397Int_t AliTRDgeometry::GetSector(Int_t d) const
f7336fa3 1398{
1399 //
1400 // Reconstruct the sector number from the detector number
1401 //
1402
793ff80c 1403 return ((Int_t) (d / (fgkNplan * fgkNcham)));
f7336fa3 1404
1405}
1406
bdbb05bb 1407//_____________________________________________________________________________
0a5f3331 1408AliTRDgeometry *AliTRDgeometry::GetGeometry(AliRunLoader *runLoader)
bdbb05bb 1409{
1410 //
030b4415 1411 // Load the geometry from the galice file
bdbb05bb 1412 //
1413
c965eab1 1414 if (!runLoader) {
1415 runLoader = AliRunLoader::GetRunLoader();
1416 }
bdbb05bb 1417 if (!runLoader) {
030b4415 1418 AliErrorGeneral("AliTRDgeometry::GetGeometry","No run loader");
bdbb05bb 1419 return NULL;
1420 }
1421
030b4415 1422 TDirectory *saveDir = gDirectory;
bdbb05bb 1423 runLoader->CdGAFile();
1424
ecb36af7 1425 // Try from the galice.root file
030b4415 1426 AliTRDgeometry *geom = (AliTRDgeometry *) gDirectory->Get("TRDgeometry");
ecb36af7 1427
1428 if (!geom) {
c965eab1 1429 // If it is not in the file, try to get it from the run loader
030b4415 1430 AliTRD *trd = (AliTRD *) runLoader->GetAliRun()->GetDetector("TRD");
ecb36af7 1431 geom = trd->GetGeometry();
1432 }
2745a409 1433 if (!geom) {
030b4415 1434 AliErrorGeneral("AliTRDgeometry::GetGeometry","Geometry not found");
2745a409 1435 return NULL;
1436 }
bdbb05bb 1437
1438 saveDir->cd();
1439 return geom;
b4a9cd27 1440
bd0f8685 1441}
b4a9cd27 1442
1443//_____________________________________________________________________________
bd0f8685 1444Bool_t AliTRDgeometry::ReadGeoMatrices()
1445{
b4a9cd27 1446 //
1447 // Read geo matrices from current gGeoManager for each TRD sector
1448 //
1449
030b4415 1450 if (!gGeoManager) {
1451 return kFALSE;
1452 }
0a5f3331 1453
030b4415 1454 fMatrixArray = new TObjArray(kNdet);
b4a9cd27 1455 fMatrixCorrectionArray = new TObjArray(kNdet);
030b4415 1456 fMatrixGeo = new TObjArray(kNdet);
b4a9cd27 1457 AliAlignObjAngles o;
bd0f8685 1458
b4a9cd27 1459 for (Int_t iLayer = AliAlignObj::kTRD1; iLayer <= AliAlignObj::kTRD6; iLayer++) {
1460 for (Int_t iModule = 0; iModule < AliAlignObj::LayerSize(iLayer); iModule++) {
030b4415 1461
0a5f3331 1462 UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iModule);
1463 const char *symname = AliAlignObj::SymName(volid);
1464 TGeoPNEntry *pne = gGeoManager->GetAlignableEntry(symname);
1465 const char *path = symname;
1466 if (pne) {
1467 path = pne->GetTitle();
1468 }
1469 if (!gGeoManager->cd(path)) {
1470 return kFALSE;
1471 }
1472 TGeoHMatrix *m = gGeoManager->GetCurrentMatrix();
1473 Int_t iLayerTRD = iLayer - AliAlignObj::kTRD1;
1474 Int_t isector = Nsect() - 1 - (iModule/Ncham());
1475 Int_t ichamber = Ncham() - 1 - (iModule%Ncham());
1476 Int_t lid = GetDetector(iLayerTRD,ichamber,isector);
bd0f8685 1477
b4a9cd27 1478 //
2745a409 1479 // Local geo system z-x-y to x-y--z
b4a9cd27 1480 //
1481 fMatrixGeo->AddAt(new TGeoHMatrix(*m),lid);
1482
1483 TGeoRotation mchange;
030b4415 1484 mchange.RotateY(90);
1485 mchange.RotateX(90);
bd0f8685 1486
b4a9cd27 1487 TGeoHMatrix gMatrix(mchange.Inverse());
1488 gMatrix.MultiplyLeft(m);
1489 fMatrixArray->AddAt(new TGeoHMatrix(gMatrix),lid);
bd0f8685 1490
b4a9cd27 1491 //
0a5f3331 1492 // Cluster transformation matrix
b4a9cd27 1493 //
1494 TGeoHMatrix rotMatrix(mchange.Inverse());
1495 rotMatrix.MultiplyLeft(m);
030b4415 1496 Double_t sectorAngle = 20.0 * (isector % 18) + 10.0;
b4a9cd27 1497 TGeoHMatrix rotSector;
1498 rotSector.RotateZ(sectorAngle);
1499 rotMatrix.MultiplyLeft(&rotSector);
bd0f8685 1500
b4a9cd27 1501 fMatrixCorrectionArray->AddAt(new TGeoHMatrix(rotMatrix),lid);
bd0f8685 1502
b4a9cd27 1503 }
1504 }
bd0f8685 1505
b4a9cd27 1506 return kTRUE;
b4a9cd27 1507
bd0f8685 1508}
b4a9cd27 1509