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