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