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