]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDgeometryFull.cxx
- Volume name attribute replaced with volume path
[u/mrichter/AliRoot.git] / TRD / AliTRDgeometryFull.cxx
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
16 /*
17 $Log$
18 Revision 1.15  2005/04/20 13:03:36  cblume
19 Fix of geometry and pad plane parameter
20
21 Revision 1.14  2004/05/07 06:52:50  cblume
22 Bug fix to allow for fPHOShole and not fRICHhole
23
24 Revision 1.13  2004/02/27 15:40:18  cblume
25 Fix definition of rotation matrices
26
27 Revision 1.12  2003/09/18 09:06:07  cblume
28 Geometry update, Removal of compiler warnings
29
30 Revision 1.10  2002/11/21 22:38:47  alibrary
31 Removing AliMC and AliMCProcess
32
33 Revision 1.9  2002/10/31 17:45:35  cblume
34 New chamber geometry
35
36 Revision 1.8  2002/02/11 14:21:16  cblume
37 Update of the geometry. Get rid of MANY
38
39 Revision 1.7  2001/05/11 07:56:12  hristov
40 Consistent declarations needed on Alpha
41
42 Revision 1.6  2001/02/14 18:22:26  cblume
43 Change in the geometry of the padplane
44
45 Revision 1.5  2000/11/01 14:53:21  cblume
46 Merge with TRD-develop
47
48 Revision 1.1.4.6  2000/10/15 23:40:01  cblume
49 Remove AliTRDconst
50
51 Revision 1.1.4.5  2000/10/06 16:49:46  cblume
52 Made Getters const
53
54 Revision 1.1.4.4  2000/10/04 16:34:58  cblume
55 Replace include files by forward declarations
56
57 Revision 1.1.4.3  2000/09/22 14:43:41  cblume
58 Allow the pad/timebin-dimensions to be changed after initialization
59
60 Revision 1.4  2000/10/02 21:28:19  fca
61 Removal of useless dependecies via forward declarations
62
63 Revision 1.3  2000/06/08 18:32:58  cblume
64 Make code compliant to coding conventions
65
66 Revision 1.2  2000/05/08 16:17:27  cblume
67 Merge TRD-develop
68
69 Revision 1.1.4.2  2000/05/08 14:46:44  cblume
70 Include options SetPHOShole() and SetRICHhole()
71
72 Revision 1.1.4.1  2000/04/27 12:46:04  cblume
73 Corrected bug in full geometry
74
75 Revision 1.1  2000/02/28 19:01:15  cblume
76 Add new TRD classes
77
78 */
79
80 ///////////////////////////////////////////////////////////////////////////////
81 //                                                                           //
82 //  TRD geometry for the spaceframe without holes                            //
83 //                                                                           //
84 ///////////////////////////////////////////////////////////////////////////////
85
86 #include "TVirtualMC.h"
87
88 #include "AliTRDgeometryFull.h"
89 #include "AliTRDCommonParam.h"
90
91 ClassImp(AliTRDgeometryFull)
92
93 //_____________________________________________________________________________
94 AliTRDgeometryFull::AliTRDgeometryFull():AliTRDgeometry()
95 {
96   //
97   // AliTRDgeometryFull default constructor
98   //
99
100   Init();
101
102 }
103
104 //_____________________________________________________________________________
105 AliTRDgeometryFull::~AliTRDgeometryFull()
106 {
107   //
108   // AliTRDgeometryFull destructor
109   //
110
111 }
112
113 //_____________________________________________________________________________
114 void AliTRDgeometryFull::Init()
115 {
116   //
117   // Initializes the geometry parameter
118   //
119
120   Int_t icham;
121   Int_t iplan;
122
123   fPHOShole = kFALSE;
124   fRICHhole = kFALSE;
125
126   // The outer lengths of the chambers for the sectors with holes for the PHOS
127   Float_t lengthPH[kNplan][kNcham] = { { 124.0, 117.0,   0.0, 117.0, 124.0 }
128                                      , { 124.0, 117.0,   0.0, 117.0, 124.0 }
129                                      , { 131.0, 124.0,   0.0, 124.0, 131.0 }
130                                      , { 138.0, 131.0,   0.0, 131.0, 138.0 }
131                                      , { 145.0, 138.0,   0.0, 138.0, 145.0 }
132                                      , { 147.0, 140.0,   0.0, 140.0, 147.0 } };
133   // Old layer 6                                     
134   //                                 , { 147.0, 140.0,   0.0, 140.0, 147.0 } };
135
136   // The outer lengths of the chambers for the sectors with holes for the RICH
137   Float_t lengthRH[kNplan][kNcham] = { {  87.5,   0.0,   0.0,   0.0,  87.5 }
138                                      , {  87.5,   0.0,   0.0,   0.0,  87.5 }
139                                      , { 101.5,   0.0,   0.0,   0.0, 101.5 }
140                                      , { 115.5,   0.0,   0.0,   0.0, 115.5 }
141                                      , { 129.5,   0.0,   0.0,   0.0, 129.5 }
142                                      , { 133.5,   0.0,   0.0,   0.0, 133.5 } };
143   // Old layer 6
144   //                                 , { 133.5,   0.0,   0.0,   0.0, 133.5 } };
145
146   for (icham = 0; icham < kNcham; icham++) {
147     for (iplan = 0; iplan < kNplan; iplan++) {
148       fClengthPH[iplan][icham] = lengthPH[iplan][icham];
149       fClengthRH[iplan][icham] = lengthRH[iplan][icham];
150     }
151   }
152
153 }
154
155 //_____________________________________________________________________________
156 void AliTRDgeometryFull::CreateGeometry(Int_t *idtmed)
157 {
158   //
159   // Create the TRD geometry without hole
160   //
161   //
162   // Names of the TRD volumina (xx = detector number):
163   //
164   //      Lower part of the readout chambers (gas volume + radiator)
165   //
166   //        UAxx    Aluminum frames             (Al)
167   //        UBxx    G10 frames                  (C)
168   //        UCxx    Inner volumes               (Air)
169   //
170   //      Upper part of the readout chambers (readout plane + fee)
171   //
172   //        UDxx    G10 frames                  (C)
173   //        UExx    Inner volumes of the G10    (Air)
174   //        UFxx    Aluminum frames             (Al)
175   //        UGxx    Inner volumes of the Al     (Air)
176   //
177   //      Inner material layers
178   //
179   //        UHxx    Radiator                    (Rohacell)
180   //        UIxx    Entrance window             (Mylar)
181   //        UJxx    Drift volume                (Xe/CO2)
182   //        UKxx    Amplification volume        (Xe/CO2)
183   //        ULxx    Pad plane                   (Cu)
184   //        UMxx    Support structure           (Rohacell)
185   //
186
187   const Int_t kNdet    = kNplan * kNcham;
188
189   const Int_t kNparTrd = 4;
190   const Int_t kNparCha = 3;
191
192   Float_t xpos, ypos, zpos;
193
194   Float_t parTrd[kNparTrd];
195   Float_t parCha[kNparCha];
196
197   Char_t  cTagV[5];
198   Char_t  cTagM[5];
199
200   AliTRDgeometry::CreateGeometry(idtmed);
201
202   // The TRD mother volume for one sector (Air), full length in z-direction
203   // Provides material for side plates of super module
204   parTrd[0] = fgkSwidth1/2.;
205   parTrd[1] = fgkSwidth2/2.;
206   parTrd[2] = fgkSlenTR1/2.;
207   parTrd[3] = fgkSheight/2.;
208   gMC->Gsvolu("UTR1","TRD1",idtmed[1302-1],parTrd,kNparTrd);
209   // The TRD mother volume for one sector (Al), leaving hole for PHOS
210   if (fPHOShole) {
211     gMC->Gsvolu("UTR2","TRD1",idtmed[1302-1],parTrd,kNparTrd);
212   }
213   // The TRD mother volume for one sector (Al), leaving hole for RICH
214   if (fRICHhole) {
215     gMC->Gsvolu("UTR3","TRD1",idtmed[1302-1],parTrd,kNparTrd);
216   }  
217
218   // 
219   // The side plates of the super module (Al)
220   parTrd[0] = fgkSwidth1/2. - fgkSMgapT;
221   parTrd[1] = fgkSwidth2/2. - fgkSMgapT;
222   parTrd[2] = fgkSlenTR1/2.;
223   parTrd[3] = fgkSheight/2.;
224   gMC->Gsvolu("UTS1","TRD1",idtmed[1301-1],parTrd,kNparTrd);
225   // The TRD mother volume for one sector (Al), leaving hole for PHOS
226   if (fPHOShole) {
227     gMC->Gsvolu("UTS2","TRD1",idtmed[1301-1],parTrd,kNparTrd);
228   }
229   // The TRD mother volume for one sector (Al), leaving hole for RICH
230   if (fRICHhole) {
231     gMC->Gsvolu("UTS3","TRD1",idtmed[1301-1],parTrd,kNparTrd);
232   }  
233
234   // The inner part of the TRD mother volume for one sector (Air), 
235   // full length in z-direction
236   parTrd[0] = fgkSwidth1/2. - fgkSMgapT - fgkSMpltT;
237   parTrd[1] = fgkSwidth2/2. - fgkSMgapT - fgkSMpltT;
238   parTrd[2] = fgkSlenTR1/2.;
239   parTrd[3] = fgkSheight/2.;
240   gMC->Gsvolu("UTI1","TRD1",idtmed[1302-1],parTrd,kNparTrd);
241   // The TRD mother volume for one sector (Air), leaving hole for PHOS
242   if (fPHOShole) {
243     gMC->Gsvolu("UTI2","TRD1",idtmed[1302-1],parTrd,kNparTrd);
244   }
245   // The TRD mother volume for one sector (Air), leaving hole for RICH
246   if (fRICHhole) {
247     gMC->Gsvolu("UTI3","TRD1",idtmed[1302-1],parTrd,kNparTrd);
248   }  
249
250   for (Int_t icham = 0; icham < kNcham; icham++) {
251     for (Int_t iplan = 0; iplan < kNplan; iplan++) {  
252
253       Int_t iDet = GetDetectorSec(iplan,icham);
254
255       // The lower part of the readout chambers (gas volume + radiator) 
256       // The aluminum frames 
257       sprintf(cTagV,"UA%02d",iDet);
258       parCha[0] = fCwidth[iplan]/2.;
259       parCha[1] = fClength[iplan][icham]/2. - fgkHspace/2.;
260       parCha[2] = fgkCraH/2. + fgkCdrH/2.;
261       gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parCha,kNparCha);
262       // The G10 frames 
263       sprintf(cTagV,"UB%02d",iDet);
264       parCha[0] = fCwidth[iplan]/2. - fgkCalT; 
265       parCha[1] = -1.;
266       parCha[2] = -1.;
267       gMC->Gsvolu(cTagV,"BOX ",idtmed[1307-1],parCha,kNparCha);
268       // The inner part (air)
269       sprintf(cTagV,"UC%02d",iDet);
270       parCha[0] = fCwidth[iplan]/2. - fgkCalT - fgkCclsT; 
271       parCha[1] = fClength[iplan][icham]/2. - fgkHspace/2.- fgkCclfT;
272       parCha[2] = -1.;
273       gMC->Gsvolu(cTagV,"BOX ",idtmed[1302-1],parCha,kNparCha);
274       if (fPHOShole) {
275         if (fClengthPH[iplan][icham] > 0.0) {
276           // The aluminum frames 
277           sprintf(cTagV,"UA%02d",iDet+kNdet);
278           parCha[0] = fCwidth[iplan]/2.;
279           parCha[1] = fClengthPH[iplan][icham]/2. - fgkHspace/2.;
280           parCha[2] = fgkCraH/2. + fgkCdrH/2.;
281           gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parCha,kNparCha);
282           // The G10 frames 
283           sprintf(cTagV,"UB%02d",iDet+kNdet);
284           parCha[0] = fCwidth[iplan]/2. - fgkCalT; 
285           parCha[1] = -1.;
286           parCha[2] = -1.;
287           gMC->Gsvolu(cTagV,"BOX ",idtmed[1307-1],parCha,kNparCha);
288           // The inner part (air)
289           sprintf(cTagV,"UC%02d",iDet+kNdet);
290           parCha[0] = fCwidth[iplan]/2. - fgkCalT - fgkCclsT; 
291           parCha[1] = fClengthPH[iplan][icham]/2. - fgkHspace/2.- fgkCclfT;
292           parCha[2] = -1.;
293           gMC->Gsvolu(cTagV,"BOX ",idtmed[1302-1],parCha,kNparCha);
294         }
295       }
296       if (fRICHhole) {
297         if (fClengthRH[iplan][icham] > 0.0) {
298           // The aluminum frames 
299           sprintf(cTagV,"UA%02d",iDet+2*kNdet);
300           parCha[0] = fCwidth[iplan]/2.;
301           parCha[1] = fClengthRH[iplan][icham]/2. - fgkHspace/2.;
302           parCha[2] = fgkCraH/2. + fgkCdrH/2.;
303           gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parCha,kNparCha);
304           // The G10 frames 
305           sprintf(cTagV,"UB%02d",iDet+2*kNdet);
306           parCha[0] = fCwidth[iplan]/2. - fgkCalT; 
307           parCha[1] = -1.;
308           parCha[2] = -1.;
309           gMC->Gsvolu(cTagV,"BOX ",idtmed[1307-1],parCha,kNparCha);
310           // The inner part (air)
311           sprintf(cTagV,"UC%02d",iDet+2*kNdet);
312           parCha[0] = fCwidth[iplan]/2. - fgkCalT - fgkCclsT; 
313           parCha[1] = fClengthRH[iplan][icham]/2. - fgkHspace/2.- fgkCclfT;
314           parCha[2] = -1.;
315           gMC->Gsvolu(cTagV,"BOX ",idtmed[1302-1],parCha,kNparCha);
316         }
317       }
318
319       // The upper part of the readout chambers (readout plane)
320       // The G10 frames
321       sprintf(cTagV,"UD%02d",iDet);
322       parCha[0] = fCwidth[iplan]/2. + fgkCroW;
323       parCha[1] = fClength[iplan][icham]/2. - fgkHspace/2.;
324       parCha[2] = fgkCamH/2.;
325       gMC->Gsvolu(cTagV,"BOX ",idtmed[1307-1],parCha,kNparCha);
326       // The inner part of the G10 frame (air)
327       sprintf(cTagV,"UE%02d",iDet);
328       parCha[0] = fCwidth[iplan]/2. + fgkCroW - fgkCcuT; 
329       parCha[1] = fClength[iplan][icham]/2. - fgkHspace/2.- fgkCcuT;
330       parCha[2] = -1.;
331       gMC->Gsvolu(cTagV,"BOX ",idtmed[1302-1],parCha,kNparCha);
332       // The aluminum frames
333       sprintf(cTagV,"UF%02d",iDet);
334       parCha[0] = fCwidth[iplan]/2. + fgkCroW;
335       parCha[1] = fClength[iplan][icham]/2. - fgkHspace/2.;
336       parCha[2] = fgkCroH/2.;
337       gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parCha,kNparCha);
338       // The inner part of the aluminum frames
339       sprintf(cTagV,"UG%02d",iDet);
340       parCha[0] = fCwidth[iplan]/2. + fgkCroW - fgkCauT; 
341       parCha[1] = fClength[iplan][icham]/2. - fgkHspace/2.- fgkCauT;
342       parCha[2] = -1.;
343       gMC->Gsvolu(cTagV,"BOX ",idtmed[1302-1],parCha,kNparCha);
344       if (fPHOShole) {
345         if (fClengthPH[iplan][icham] > 0.0) {
346           sprintf(cTagV,"UD%02d",iDet+kNdet);
347           parCha[0] = fCwidth[iplan]/2. + fgkCroW;
348           parCha[1] = fClengthPH[iplan][icham]/2. - fgkHspace/2.;
349           parCha[2] = fgkCamH/2.;
350           gMC->Gsvolu(cTagV,"BOX ",idtmed[1307-1],parCha,kNparCha);
351           // The inner part of the G10 frame (air)
352           sprintf(cTagV,"UE%02d",iDet+kNdet);
353           parCha[0] = fCwidth[iplan]/2. + fgkCroW - fgkCcuT; 
354           parCha[1] = fClengthPH[iplan][icham]/2. - fgkHspace/2.- fgkCcuT;
355           parCha[2] = -1.;
356           gMC->Gsvolu(cTagV,"BOX ",idtmed[1302-1],parCha,kNparCha);
357           // The aluminum frames
358           sprintf(cTagV,"UF%02d",iDet+kNdet);
359           parCha[0] = fCwidth[iplan]/2. + fgkCroW;
360           parCha[1] = fClengthPH[iplan][icham]/2. - fgkHspace/2.;
361           parCha[2] = fgkCroH/2.;
362           gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parCha,kNparCha);
363           // The inner part of the aluminum frames
364           sprintf(cTagV,"UG%02d",iDet+kNdet);
365           parCha[0] = fCwidth[iplan]/2. + fgkCroW - fgkCauT; 
366           parCha[1] = fClengthPH[iplan][icham]/2. - fgkHspace/2.- fgkCauT;
367           parCha[2] = -1.;
368           gMC->Gsvolu(cTagV,"BOX ",idtmed[1302-1],parCha,kNparCha);
369         }
370       }
371       if (fRICHhole) {
372         if (fClengthRH[iplan][icham] > 0.0) {
373           sprintf(cTagV,"UD%02d",iDet+2*kNdet);
374           parCha[0] = fCwidth[iplan]/2. + fgkCroW;
375           parCha[1] = fClengthRH[iplan][icham]/2. - fgkHspace/2.;
376           parCha[2] = fgkCamH/2.;
377           gMC->Gsvolu(cTagV,"BOX ",idtmed[1307-1],parCha,kNparCha);
378           // The inner part of the G10 frame (air)
379           sprintf(cTagV,"UE%02d",iDet+2*kNdet);
380           parCha[0] = fCwidth[iplan]/2. + fgkCroW - fgkCcuT; 
381           parCha[1] = fClengthRH[iplan][icham]/2. - fgkHspace/2.- fgkCcuT;
382           parCha[2] = -1.;
383           gMC->Gsvolu(cTagV,"BOX ",idtmed[1302-1],parCha,kNparCha);
384           // The aluminum frames
385           sprintf(cTagV,"UF%02d",iDet+2*kNdet);
386           parCha[0] = fCwidth[iplan]/2. + fgkCroW;
387           parCha[1] = fClengthRH[iplan][icham]/2. - fgkHspace/2.;
388           parCha[2] = fgkCroH/2.;
389           gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parCha,kNparCha);
390           // The inner part of the aluminum frames
391           sprintf(cTagV,"UG%02d",iDet+2*kNdet);
392           parCha[0] = fCwidth[iplan]/2. + fgkCroW - fgkCauT; 
393           parCha[1] = fClengthRH[iplan][icham]/2. - fgkHspace/2.- fgkCauT;
394           parCha[2] = -1.;
395           gMC->Gsvolu(cTagV,"BOX ",idtmed[1302-1],parCha,kNparCha);
396         }
397       }
398
399       // The material layers inside the chambers
400       parCha[0] = -1.;
401       parCha[1] = -1.;
402       // Rohacell layer (radiator)
403       parCha[2] = fgkRaThick/2;
404       sprintf(cTagV,"UH%02d",iDet);
405       gMC->Gsvolu(cTagV,"BOX ",idtmed[1315-1],parCha,kNparCha);
406       // Mylar layer (entrance window + HV cathode) 
407       parCha[2] = fgkMyThick/2;
408       sprintf(cTagV,"UI%02d",iDet);
409       gMC->Gsvolu(cTagV,"BOX ",idtmed[1308-1],parCha,kNparCha);
410       // Xe/Isobutane layer (drift volume) 
411       parCha[2] = fgkDrThick/2.;
412       sprintf(cTagV,"UJ%02d",iDet);
413       gMC->Gsvolu(cTagV,"BOX ",idtmed[1309-1],parCha,kNparCha);
414       // Xe/Isobutane layer (amplification volume)
415       parCha[2] = fgkAmThick/2.;
416       sprintf(cTagV,"UK%02d",iDet);
417       gMC->Gsvolu(cTagV,"BOX ",idtmed[1309-1],parCha,kNparCha);  
418       // Cu layer (pad plane)
419       parCha[2] = fgkCuThick/2;
420       sprintf(cTagV,"UL%02d",iDet);
421       gMC->Gsvolu(cTagV,"BOX ",idtmed[1305-1],parCha,kNparCha);
422       // G10 layer (support structure / honeycomb)
423       parCha[2] = fgkSuThick/2;
424       sprintf(cTagV,"UM%02d",iDet);
425       gMC->Gsvolu(cTagV,"BOX ",idtmed[1313-1],parCha,kNparCha);
426       if (fPHOShole) {
427         if (fClengthPH[iplan][icham] > 0.0) {
428           // Rohacell layer (radiator)
429           parCha[2] = fgkRaThick/2;
430           sprintf(cTagV,"UH%02d",iDet+kNdet);
431           gMC->Gsvolu(cTagV,"BOX ",idtmed[1315-1],parCha,kNparCha);
432           // Mylar layer (entrance window + HV cathode) 
433           parCha[2] = fgkMyThick/2;
434           sprintf(cTagV,"UI%02d",iDet+kNdet);
435           gMC->Gsvolu(cTagV,"BOX ",idtmed[1308-1],parCha,kNparCha);
436           // Xe/Isobutane layer (drift volume) 
437           parCha[2] = fgkDrThick/2.;
438           sprintf(cTagV,"UJ%02d",iDet+kNdet);
439           gMC->Gsvolu(cTagV,"BOX ",idtmed[1309-1],parCha,kNparCha);
440           // Xe/Isobutane layer (amplification volume)
441           parCha[2] = fgkAmThick/2.;
442           sprintf(cTagV,"UK%02d",iDet+kNdet);
443           gMC->Gsvolu(cTagV,"BOX ",idtmed[1309-1],parCha,kNparCha);  
444           // Cu layer (pad plane)
445           parCha[2] = fgkCuThick/2;
446           sprintf(cTagV,"UL%02d",iDet+kNdet);
447           gMC->Gsvolu(cTagV,"BOX ",idtmed[1305-1],parCha,kNparCha);
448           // G10 layer (support structure / honeycomb)
449           parCha[2] = fgkSuThick/2;
450           sprintf(cTagV,"UM%02d",iDet+kNdet);
451           gMC->Gsvolu(cTagV,"BOX ",idtmed[1313-1],parCha,kNparCha);
452         }
453       }
454       if (fRICHhole) {
455         if (fClengthRH[iplan][icham] > 0.0) {
456           // Rohacell layer (radiator)
457           parCha[2] = fgkRaThick/2;
458           sprintf(cTagV,"UH%02d",iDet+2*kNdet);
459           gMC->Gsvolu(cTagV,"BOX ",idtmed[1315-1],parCha,kNparCha);
460           // Mylar layer (entrance window + HV cathode) 
461           parCha[2] = fgkMyThick/2;
462           sprintf(cTagV,"UI%02d",iDet+2*kNdet);
463           gMC->Gsvolu(cTagV,"BOX ",idtmed[1308-1],parCha,kNparCha);
464           // Xe/Isobutane layer (drift volume) 
465           parCha[2] = fgkDrThick/2.;
466           sprintf(cTagV,"UJ%02d",iDet+2*kNdet);
467           gMC->Gsvolu(cTagV,"BOX ",idtmed[1309-1],parCha,kNparCha);
468           // Xe/Isobutane layer (amplification volume)
469           parCha[2] = fgkAmThick/2.;
470           sprintf(cTagV,"UK%02d",iDet+2*kNdet);
471           gMC->Gsvolu(cTagV,"BOX ",idtmed[1309-1],parCha,kNparCha);  
472           // Cu layer (pad plane)
473           parCha[2] = fgkCuThick/2;
474           sprintf(cTagV,"UL%02d",iDet+2*kNdet);
475           gMC->Gsvolu(cTagV,"BOX ",idtmed[1305-1],parCha,kNparCha);
476           // G10 layer (support structure / honeycomb)
477           parCha[2] = fgkSuThick/2;
478           sprintf(cTagV,"UM%02d",iDet+2*kNdet);
479           gMC->Gsvolu(cTagV,"BOX ",idtmed[1313-1],parCha,kNparCha);
480         }
481       }
482
483       // Position the layers in the chambers
484       xpos = 0;
485       ypos = 0;
486       // Lower part
487       // Rohacell layer (radiator)
488       zpos = fgkRaZpos;
489       sprintf(cTagV,"UH%02d",iDet);
490       sprintf(cTagM,"UC%02d",iDet);
491       gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
492       // Mylar layer (entrance window + HV cathode)   
493       zpos = fgkMyZpos;
494       sprintf(cTagV,"UI%02d",iDet);
495       sprintf(cTagM,"UC%02d",iDet);
496       gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
497       // Xe/Isobutane layer (drift volume) 
498       zpos = fgkDrZpos;
499       sprintf(cTagV,"UJ%02d",iDet);
500       sprintf(cTagM,"UC%02d",iDet);
501       gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
502       // Upper part
503       // Xe/Isobutane layer (amplification volume)
504       zpos = fgkAmZpos;
505       sprintf(cTagV,"UK%02d",iDet);
506       sprintf(cTagM,"UE%02d",iDet);
507       gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
508       // Readout part
509       // Cu layer (pad plane)
510       zpos = fgkCuZpos; 
511       sprintf(cTagV,"UL%02d",iDet);
512       sprintf(cTagM,"UG%02d",iDet);
513       gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
514       // G10 layer (support structure)
515       zpos = fgkSuZpos;
516       sprintf(cTagV,"UM%02d",iDet);
517       sprintf(cTagM,"UG%02d",iDet);
518       gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
519       if (fPHOShole) {
520         if (fClengthPH[iplan][icham] > 0.0) {
521           // Lower part
522           // Rohacell layer (radiator)
523           zpos = fgkRaZpos;
524           sprintf(cTagV,"UH%02d",iDet+kNdet);
525           sprintf(cTagM,"UC%02d",iDet+kNdet);
526           gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
527           // Mylar layer (entrance window + HV cathode)   
528           zpos = fgkMyZpos;
529           sprintf(cTagV,"UI%02d",iDet+kNdet);
530           sprintf(cTagM,"UC%02d",iDet+kNdet);
531           gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
532           // Xe/Isobutane layer (drift volume) 
533           zpos = fgkDrZpos;
534           sprintf(cTagV,"UJ%02d",iDet+kNdet);
535           sprintf(cTagM,"UC%02d",iDet+kNdet);
536           gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
537           // Upper part
538           // Xe/Isobutane layer (amplification volume)
539           zpos = fgkAmZpos;
540           sprintf(cTagV,"UK%02d",iDet+kNdet);
541           sprintf(cTagM,"UE%02d",iDet+kNdet);
542           gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
543           // Readout part
544           // Cu layer (pad plane)
545           zpos = fgkCuZpos; 
546           sprintf(cTagV,"UL%02d",iDet+kNdet);
547           sprintf(cTagM,"UG%02d",iDet+kNdet);
548           gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
549           // G10 layer (support structure)
550           zpos = fgkSuZpos;
551           sprintf(cTagV,"UM%02d",iDet+kNdet);
552           sprintf(cTagM,"UG%02d",iDet+kNdet);
553           gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
554         }
555       }
556       if (fRICHhole) {
557         if (fClengthRH[iplan][icham] > 0.0) {
558           // Lower part
559           // Rohacell layer (radiator)
560           zpos = fgkRaZpos;
561           sprintf(cTagV,"UH%02d",iDet+2*kNdet);
562           sprintf(cTagM,"UC%02d",iDet+2*kNdet);
563           gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
564           // Mylar layer (entrance window + HV cathode)   
565           zpos = fgkMyZpos;
566           sprintf(cTagV,"UI%02d",iDet+2*kNdet);
567           sprintf(cTagM,"UC%02d",iDet+2*kNdet);
568           gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
569           // Xe/Isobutane layer (drift volume) 
570           zpos = fgkDrZpos;
571           sprintf(cTagV,"UJ%02d",iDet+2*kNdet);
572           sprintf(cTagM,"UC%02d",iDet+2*kNdet);
573           gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
574           // Upper part
575           // Xe/Isobutane layer (amplification volume)
576           zpos = fgkAmZpos;
577           sprintf(cTagV,"UK%02d",iDet+2*kNdet);
578           sprintf(cTagM,"UE%02d",iDet+2*kNdet);
579           gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
580           // Readout part
581           // Cu layer (pad plane)
582           zpos = fgkCuZpos; 
583           sprintf(cTagV,"UL%02d",iDet+2*kNdet);
584           sprintf(cTagM,"UG%02d",iDet+2*kNdet);
585           gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
586           // G10 layer (support structure)
587           zpos = fgkSuZpos;
588           sprintf(cTagV,"UM%02d",iDet+2*kNdet);
589           sprintf(cTagM,"UG%02d",iDet+2*kNdet);
590           gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
591         }
592       }
593
594       // Position the inner volumes of the chambers in the frames
595       xpos      = 0.0;
596       ypos      = 0.0;
597       zpos      = 0.0;
598       // The inside of the lower G10 frame
599       sprintf(cTagV,"UC%02d",iDet);
600       sprintf(cTagM,"UB%02d",iDet);
601       gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
602       // The lower G10 frame inside the aluminum frame
603       sprintf(cTagV,"UB%02d",iDet);
604       sprintf(cTagM,"UA%02d",iDet);
605       gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
606       // The inside of the upper G10 frame
607       sprintf(cTagV,"UE%02d",iDet);
608       sprintf(cTagM,"UD%02d",iDet);
609       gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
610       // The inside of the upper aluminum frame
611       sprintf(cTagV,"UG%02d",iDet);
612       sprintf(cTagM,"UF%02d",iDet);
613       gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");      
614       if (fPHOShole) {
615         if (fClengthPH[iplan][icham] > 0.0) {
616           // The inside of the lower G10 frame
617           sprintf(cTagV,"UC%02d",iDet+kNdet);
618           sprintf(cTagM,"UB%02d",iDet+kNdet);
619           gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
620           // The lower G10 frame inside the aluminum frame
621           sprintf(cTagV,"UB%02d",iDet+kNdet);
622           sprintf(cTagM,"UA%02d",iDet+kNdet);
623           gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
624           // The inside of the upper G10 frame
625           sprintf(cTagV,"UE%02d",iDet+kNdet);
626           sprintf(cTagM,"UD%02d",iDet+kNdet);
627           gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
628           // The inside of the upper aluminum frame
629           sprintf(cTagV,"UG%02d",iDet+kNdet);
630           sprintf(cTagM,"UF%02d",iDet+kNdet);
631           gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");      
632         }
633       }
634       if (fRICHhole) {
635         if (fClengthRH[iplan][icham] > 0.0) {
636           // The inside of the lower G10 frame
637           sprintf(cTagV,"UC%02d",iDet+2*kNdet);
638           sprintf(cTagM,"UB%02d",iDet+2*kNdet);
639           gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
640           // The lower G10 frame inside the aluminum frame
641           sprintf(cTagV,"UB%02d",iDet+2*kNdet);
642           sprintf(cTagM,"UA%02d",iDet+2*kNdet);
643           gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
644           // The inside of the upper G10 frame
645           sprintf(cTagV,"UE%02d",iDet+2*kNdet);
646           sprintf(cTagM,"UD%02d",iDet+2*kNdet);
647           gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
648           // The inside of the upper aluminum frame
649           sprintf(cTagV,"UG%02d",iDet+2*kNdet);
650           sprintf(cTagM,"UF%02d",iDet+2*kNdet);
651           gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");      
652         }
653       }
654
655       // Position the frames of the chambers in the TRD mother volume
656       xpos  = 0.;
657       ypos  = - fClength[iplan][0] - fClength[iplan][1] - fClength[iplan][2]/2.;
658       for (Int_t ic = 0; ic < icham; ic++) {
659         ypos += fClength[iplan][ic];        
660       }
661       ypos += fClength[iplan][icham]/2.;
662       zpos  = fgkCraH/2. + fgkCdrH/2. - fgkSheight/2. + iplan * (fgkCH + fgkVspace);
663       // The lower aluminum frame, radiator + drift region
664       sprintf(cTagV,"UA%02d",iDet);
665       gMC->Gspos(cTagV,1,"UTI1",xpos,ypos,zpos,0,"ONLY");
666       // The upper G10 frame, amplification region
667       sprintf(cTagV,"UD%02d",iDet);
668       zpos += fgkCamH/2. + fgkCraH/2. + fgkCdrH/2.;
669       gMC->Gspos(cTagV,1,"UTI1",xpos,ypos,zpos,0,"ONLY");
670       // The upper aluminum frame
671       sprintf(cTagV,"UF%02d",iDet);
672       zpos += fgkCroH/2. + fgkCamH/2.;
673       gMC->Gspos(cTagV,1,"UTI1",xpos,ypos,zpos,0,"ONLY");
674       if (fPHOShole) {
675         if (fClengthPH[iplan][icham] > 0.0) {
676           xpos  = 0.;
677           ypos  = - fClength[iplan][0] - fClength[iplan][1] - fClength[iplan][2]/2.;
678           for (Int_t ic = 0; ic < icham; ic++) {
679             ypos += fClength[iplan][ic];        
680           }
681           if (icham > 2) {
682             ypos += fClength[iplan][icham];
683             ypos -= fClengthPH[iplan][icham]/2.;
684           }
685           else {
686             ypos += fClengthPH[iplan][icham]/2.;
687           }
688           zpos  = fgkCraH/2. + fgkCdrH/2. - fgkSheight/2. + iplan * (fgkCH + fgkVspace);
689           // The lower aluminum frame, radiator + drift region
690           sprintf(cTagV,"UA%02d",iDet+kNdet);
691           gMC->Gspos(cTagV,1,"UTI2",xpos,ypos,zpos,0,"ONLY");
692           // The upper G10 frame, amplification region
693           sprintf(cTagV,"UD%02d",iDet+kNdet);
694           zpos += fgkCamH/2. + fgkCraH/2. + fgkCdrH/2.;
695           gMC->Gspos(cTagV,1,"UTI2",xpos,ypos,zpos,0,"ONLY");
696           // The upper aluminum frame
697           sprintf(cTagV,"UF%02d",iDet+kNdet);
698           zpos += fgkCroH/2. + fgkCamH/2.;
699           gMC->Gspos(cTagV,1,"UTI2",xpos,ypos,zpos,0,"ONLY");
700         }
701       }
702       if (fRICHhole) {
703         if (fClengthRH[iplan][icham] > 0.0) {
704           xpos  = 0.;
705           ypos  = - fClength[iplan][0] - fClength[iplan][1] - fClength[iplan][2]/2.;
706           for (Int_t ic = 0; ic < icham; ic++) {
707             ypos += fClength[iplan][ic];        
708           }
709           if (icham > 2) {
710             ypos += fClength[iplan][icham];
711             ypos -= fClengthRH[iplan][icham]/2.;
712           }
713           else {
714             ypos += fClengthRH[iplan][icham]/2.;
715           }
716           zpos  = fgkCraH/2. + fgkCdrH/2. - fgkSheight/2. + iplan * (fgkCH + fgkVspace);
717           // The lower aluminum frame, radiator + drift region
718           sprintf(cTagV,"UA%02d",iDet+2*kNdet);
719           gMC->Gspos(cTagV,1,"UTI3",xpos,ypos,zpos,0,"ONLY");
720           // The upper G10 frame, amplification region
721           sprintf(cTagV,"UD%02d",iDet+2*kNdet);
722           zpos += fgkCamH/2. + fgkCraH/2. + fgkCdrH/2.;
723           gMC->Gspos(cTagV,1,"UTI3",xpos,ypos,zpos,0,"ONLY");
724           // The upper aluminum frame
725           sprintf(cTagV,"UF%02d",iDet+2*kNdet);
726           zpos += fgkCroH/2. + fgkCamH/2.;
727           gMC->Gspos(cTagV,1,"UTI3",xpos,ypos,zpos,0,"ONLY");
728         }
729       }
730
731     }
732   }
733
734   xpos = 0.;
735   ypos = 0.;
736   zpos = 0.;
737   gMC->Gspos("UTI1",1,"UTS1",xpos,ypos,zpos,0,"ONLY");
738   if (fPHOShole) {
739     gMC->Gspos("UTI2",2,"UTS2",xpos,ypos,zpos,0,"ONLY");
740   }
741   if (fRICHhole) {
742     gMC->Gspos("UTI3",3,"UTS3",xpos,ypos,zpos,0,"ONLY");
743   }
744
745   xpos = 0.;
746   ypos = 0.;
747   zpos = 0.;
748   gMC->Gspos("UTS1",1,"UTR1",xpos,ypos,zpos,0,"ONLY");
749   if (fPHOShole) {
750     gMC->Gspos("UTS2",2,"UTR2",xpos,ypos,zpos,0,"ONLY");
751   }
752   if (fRICHhole) {
753     gMC->Gspos("UTS3",3,"UTR3",xpos,ypos,zpos,0,"ONLY");
754   }
755
756   xpos = 0.;
757   ypos = 0.;
758   zpos = 0.;
759   gMC->Gspos("UTR1",1,"BTR1",xpos,ypos,zpos,0,"ONLY");
760   if (fPHOShole) {
761     gMC->Gspos("UTR2",2,"BTR2",xpos,ypos,zpos,0,"ONLY");
762   }
763   else {
764     gMC->Gspos("UTR1",2,"BTR2",xpos,ypos,zpos,0,"ONLY");
765   }
766   if (fRICHhole) {
767     gMC->Gspos("UTR3",3,"BTR3",xpos,ypos,zpos,0,"ONLY");
768   }
769   else {
770     gMC->Gspos("UTR1",3,"BTR3",xpos,ypos,zpos,0,"ONLY");
771   }
772
773   // Create the volumes of the super module frame
774   CreateFrame(idtmed);
775
776   // Create the volumes of the services
777   CreateServices(idtmed);
778
779 }
780
781 //_____________________________________________________________________________
782 void AliTRDgeometryFull::CreateFrame(Int_t *idtmed)
783 {
784   //
785   // Create the geometry of the frame of the supermodule
786   //
787   // Names of the TRD services volumina
788   //
789   //        USRL    Support rails for the chambers (Al)
790   //        USxx    Support cross bars between the chambers (Al)
791   //
792
793   Int_t   iplan = 0;
794
795   Float_t xpos  = 0.0;
796   Float_t ypos  = 0.0;
797   Float_t zpos  = 0.0;
798
799   Char_t  cTagV[5];
800
801   //
802   // The chamber support rails
803   //
804
805   const Float_t kSRLwid  = 2.0;
806   const Float_t kSRLhgt  = 2.3;
807   const Float_t kSRLdst  = 0.6;
808   const Int_t   kNparSRL = 3;
809   Float_t parSRL[kNparSRL];
810   parSRL[0] = kSRLwid/2.;
811   parSRL[1] = fgkSlenTR1/2.;
812   parSRL[2] = kSRLhgt/2.;
813   gMC->Gsvolu("USRL","BOX ",idtmed[1301-1],parSRL,kNparSRL);
814
815   xpos  = 0.0;
816   ypos  = 0.0;
817   zpos  = 0.0;
818   for (iplan = 0; iplan < kNplan; iplan++) {
819     
820     xpos  = fCwidth[iplan]/2. + kSRLwid/2. + kSRLdst;
821     ypos  = 0.0;
822     zpos  = fgkCraH + fgkCdrH - fgkSheight/2. - kSRLhgt/2. 
823           + iplan * (fgkCH + fgkVspace);
824     gMC->Gspos("USRL",iplan+1         ,"UTI1", xpos,ypos,zpos,0,"ONLY");
825     gMC->Gspos("USRL",iplan+1+  kNplan,"UTI1",-xpos,ypos,zpos,0,"ONLY");
826     if (fPHOShole) {
827       gMC->Gspos("USRL",iplan+1+2*kNplan,"UTI2", xpos,ypos,zpos,0,"ONLY");
828       gMC->Gspos("USRL",iplan+1+3*kNplan,"UTI2",-xpos,ypos,zpos,0,"ONLY");
829     }
830     if (fRICHhole) {
831       gMC->Gspos("USRL",iplan+1+4*kNplan,"UTI3", xpos,ypos,zpos,0,"ONLY");
832       gMC->Gspos("USRL",iplan+1+5*kNplan,"UTI3",-xpos,ypos,zpos,0,"ONLY");
833     }
834
835   }
836
837   //
838   // The cross bars between the chambers
839   //
840
841   const Float_t kSCBwid  = 1.0;
842   const Int_t   kNparSCB = 3;
843   Float_t parSCB[kNparSCB];
844   parSCB[1] = kSCBwid/2.;
845   parSCB[2] = fgkCH/2.;
846
847   xpos  = 0.0;
848   ypos  = 0.0;
849   zpos  = 0.0;
850   for (iplan = 0; iplan < kNplan; iplan++) {
851
852     parSCB[0] = fCwidth[iplan]/2. + kSRLdst/2.;
853
854     sprintf(cTagV,"US0%01d",iplan);
855     gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parSCB,kNparSCB);
856     xpos  = 0.0;
857     ypos  =   fgkSlenTR1/2. - kSCBwid/2.;
858     zpos  = fgkCH/2. - fgkSheight/2. + iplan * (fgkCH + fgkVspace);
859     gMC->Gspos(cTagV,1,"UTI1", xpos,ypos,zpos,0,"ONLY");
860     if (fPHOShole) {
861       gMC->Gspos(cTagV,2,"UTI2", xpos,ypos,zpos,0,"ONLY");
862     }
863     if (fRICHhole) {
864       gMC->Gspos(cTagV,3,"UTI3", xpos,ypos,zpos,0,"ONLY");
865     }
866
867     sprintf(cTagV,"US1%01d",iplan);
868     gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parSCB,kNparSCB);
869     xpos  = 0.0;
870     ypos  = fClength[iplan][2]/2. + fClength[iplan][1];
871     zpos  = fgkCH/2. - fgkSheight/2. + iplan * (fgkCH + fgkVspace);
872     gMC->Gspos(cTagV,1,"UTI1", xpos,ypos,zpos,0,"ONLY");
873     if (fPHOShole) {
874       gMC->Gspos(cTagV,2,"UTI2", xpos,ypos,zpos,0,"ONLY");
875     }
876     if (fRICHhole) {
877       ypos += fClength[iplan][0] - fClengthRH[iplan][0];
878       gMC->Gspos(cTagV,3,"UTI3", xpos,ypos,zpos,0,"ONLY");
879     }
880
881     sprintf(cTagV,"US2%01d",iplan);
882     gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parSCB,kNparSCB);
883     xpos  = 0.0;
884     ypos  = fClength[iplan][2]/2.;
885     zpos  = fgkCH/2. - fgkSheight/2. + iplan * (fgkCH + fgkVspace);
886     gMC->Gspos(cTagV,1,"UTI1", xpos,ypos,zpos,0,"ONLY");
887     if (fPHOShole) {
888       ypos += fClength[iplan][1] - fClengthPH[iplan][1];
889       gMC->Gspos(cTagV,2,"UTI2", xpos,ypos,zpos,0,"ONLY");
890     }
891
892     sprintf(cTagV,"US3%01d",iplan);
893     gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parSCB,kNparSCB);
894     xpos  = 0.0;
895     ypos  = - fClength[iplan][2]/2.;
896     zpos  = fgkCH/2. - fgkSheight/2. + iplan * (fgkCH + fgkVspace);
897     gMC->Gspos(cTagV,1,"UTI1", xpos,ypos,zpos,0,"ONLY");
898     if (fPHOShole) {
899       ypos -= fClength[iplan][3] - fClengthPH[iplan][3];
900       gMC->Gspos(cTagV,2,"UTI2", xpos,ypos,zpos,0,"ONLY");
901     }
902
903     sprintf(cTagV,"US4%01d",iplan);
904     gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parSCB,kNparSCB);
905     xpos  = 0.0;
906     ypos  = - fClength[iplan][2]/2. - fClength[iplan][1];
907     zpos  = fgkCH/2. - fgkSheight/2. + iplan * (fgkCH + fgkVspace);
908     gMC->Gspos(cTagV,1,"UTI1", xpos,ypos,zpos,0,"ONLY");
909     if (fPHOShole) {
910       gMC->Gspos(cTagV,2,"UTI2", xpos,ypos,zpos,0,"ONLY");
911     }
912     if (fRICHhole) {
913       ypos -= fClength[iplan][4] - fClengthRH[iplan][4];
914       gMC->Gspos(cTagV,3,"UTI3", xpos,ypos,zpos,0,"ONLY");
915     }
916
917     sprintf(cTagV,"US5%01d",iplan);
918     gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parSCB,kNparSCB);
919     xpos  = 0.0;
920     ypos  = - fgkSlenTR1/2. + kSCBwid/2.;
921     zpos  = fgkCH/2. - fgkSheight/2. + iplan * (fgkCH + fgkVspace);
922     gMC->Gspos(cTagV,1,"UTI1", xpos,ypos,zpos,0,"ONLY");
923     if (fPHOShole) {
924       gMC->Gspos(cTagV,2,"UTI2", xpos,ypos,zpos,0,"ONLY");
925     }
926     if (fRICHhole) {
927       gMC->Gspos(cTagV,3,"UTI3", xpos,ypos,zpos,0,"ONLY");
928     }
929
930   }
931
932 }
933
934 //_____________________________________________________________________________
935 void AliTRDgeometryFull::CreateServices(Int_t *idtmed)
936 {
937   //
938   // Create the geometry of the services
939   //
940   // Names of the TRD services volumina
941   //
942   //        UTCL    Cooling arterias (Al)
943   //        UTCW    Cooling arterias (Water)
944   //        UUxx    Volumes for the services at the chambers (Air)
945   //        UTPW    Power bars       (Cu)
946   //        UTCP    Cooling pipes    (Al)
947   //        UTCH    Cooling pipes    (Water)
948   //        UTPL    Power lines      (Cu)
949   //        UMCM    Readout MCMs     (G10/Cu/Si)
950   //
951
952   const Int_t kNdet = kNplan * kNcham;
953
954   Int_t   iplan = 0;
955   Int_t   icham = 0;
956
957   Float_t xpos  = 0.0;
958   Float_t ypos  = 0.0;
959   Float_t zpos  = 0.0;
960
961   Char_t  cTagV[5];
962
963   // The rotation matrices
964   const Int_t kNmatrix = 3;
965   Int_t   matrix[kNmatrix];
966   gMC->Matrix(matrix[0],100.0,  0.0, 90.0, 90.0, 10.0,  0.0);
967   gMC->Matrix(matrix[1], 80.0,  0.0, 90.0, 90.0, 10.0,180.0);
968   gMC->Matrix(matrix[2],  0.0,  0.0, 90.0, 90.0, 90.0,  0.0);
969
970   AliTRDCommonParam* commonParam = AliTRDCommonParam::Instance();
971   if (!commonParam)
972   {
973     printf("<AliTRDgeometryFull::CreateServices> ");
974     printf("Could not get common params\n");
975     return;
976   }
977     
978   //
979   // The cooling arterias
980   //
981
982   // Width of the cooling arterias
983   const Float_t kCOLwid  =  0.5; 
984   // Height of the cooling arterias
985   const Float_t kCOLhgt  =  5.5;
986   // Positioning of the cooling 
987   const Float_t kCOLposx =  1.6;
988   const Float_t kCOLposz = -0.2;
989   // Thickness of the walls of the cooling arterias
990   const Float_t kCOLthk  =  0.1;
991   const Int_t   kNparCOL = 3;
992   Float_t parCOL[kNparCOL];
993   parCOL[0]  = kCOLwid/2.;
994   parCOL[1]  = fgkSlenTR1/2.;
995   parCOL[2]  = kCOLhgt/2.;
996   gMC->Gsvolu("UTCL","BOX ",idtmed[1324-1],parCOL,kNparCOL);
997   parCOL[0] -= kCOLthk;
998   parCOL[1]  = fgkSlenTR1/2.;
999   parCOL[2] -= kCOLthk;
1000   gMC->Gsvolu("UTCW","BOX ",idtmed[1314-1],parCOL,kNparCOL);
1001
1002   xpos  = 0.0;
1003   ypos  = 0.0;
1004   zpos  = 0.0;
1005   gMC->Gspos("UTCW",1,"UTCL", xpos,ypos,zpos,0,"ONLY");
1006
1007   for (iplan = 1; iplan < kNplan; iplan++) {
1008     
1009     xpos  = fCwidth[iplan]/2. + kCOLwid/2. + kCOLposx;
1010     ypos  = 0.0;
1011     zpos  = kCOLhgt/2. - fgkSheight/2. + kCOLposz + iplan * (fgkCH + fgkVspace);
1012     gMC->Gspos("UTCL",iplan+1         ,"UTI1", xpos,ypos,zpos,matrix[0],"ONLY");
1013     gMC->Gspos("UTCL",iplan+1+  kNplan,"UTI1",-xpos,ypos,zpos,matrix[1],"ONLY");
1014     if (fPHOShole) {
1015       gMC->Gspos("UTCL",iplan+1+2*kNplan,"UTI2", xpos,ypos,zpos,matrix[0],"ONLY");
1016       gMC->Gspos("UTCL",iplan+1+3*kNplan,"UTI2",-xpos,ypos,zpos,matrix[1],"ONLY");
1017     }
1018     if (fRICHhole) {
1019       gMC->Gspos("UTCL",iplan+1+4*kNplan,"UTI3", xpos,ypos,zpos,matrix[0],"ONLY");
1020       gMC->Gspos("UTCL",iplan+1+5*kNplan,"UTI3",-xpos,ypos,zpos,matrix[1],"ONLY");
1021     }
1022
1023   }
1024
1025   //
1026   // The power bars
1027   //
1028
1029   const Float_t kPWRwid  =  0.6;
1030   const Float_t kPWRhgt  =  4.5;
1031   const Float_t kPWRposx =  1.05;
1032   const Float_t kPWRposz =  0.9;
1033   const Int_t   kNparPWR = 3;
1034   Float_t parPWR[kNparPWR];
1035   parPWR[0] = kPWRwid/2.;
1036   parPWR[1] = fgkSlenTR1/2.;
1037   parPWR[2] = kPWRhgt/2.;
1038   gMC->Gsvolu("UTPW","BOX ",idtmed[1325-1],parPWR,kNparPWR);
1039
1040   for (iplan = 1; iplan < kNplan; iplan++) {
1041     
1042     xpos  = fCwidth[iplan]/2. + kPWRwid/2. + kPWRposx;
1043     ypos  = 0.0;
1044     zpos  = kPWRhgt/2. - fgkSheight/2. + kPWRposz + iplan * (fgkCH + fgkVspace);
1045     gMC->Gspos("UTPW",iplan+1         ,"UTI1", xpos,ypos,zpos,matrix[0],"ONLY");
1046     gMC->Gspos("UTPW",iplan+1+  kNplan,"UTI1",-xpos,ypos,zpos,matrix[1],"ONLY");
1047     if (fPHOShole) {
1048       gMC->Gspos("UTPW",iplan+1+2*kNplan,"UTI2", xpos,ypos,zpos,matrix[0],"ONLY");
1049       gMC->Gspos("UTPW",iplan+1+3*kNplan,"UTI2",-xpos,ypos,zpos,matrix[1],"ONLY");
1050     }
1051     if (fRICHhole) {
1052       gMC->Gspos("UTPW",iplan+1+4*kNplan,"UTI3", xpos,ypos,zpos,matrix[0],"ONLY");
1053       gMC->Gspos("UTPW",iplan+1+5*kNplan,"UTI3",-xpos,ypos,zpos,matrix[1],"ONLY");
1054     }
1055
1056   }
1057
1058   //
1059   // The volumes for the services at the chambers
1060   //
1061
1062   const Int_t kNparServ = 3;
1063   Float_t parServ[kNparServ];
1064
1065   for (icham = 0; icham < kNcham; icham++) {
1066     //for (iplan = 0; iplan < kNplan; iplan++) {
1067     // Take out upper plane until TRD mothervolume is adjusted
1068     for (iplan = 0; iplan < kNplan-1; iplan++) {
1069
1070       Int_t iDet = GetDetectorSec(iplan,icham);
1071
1072       sprintf(cTagV,"UU%02d",iDet);
1073       parServ[0] = fCwidth[iplan]/2.;
1074       parServ[1] = fClength[iplan][icham]/2. - fgkHspace/2.;
1075       parServ[2] = fgkVspace/2.;
1076       gMC->Gsvolu(cTagV,"BOX",idtmed[1302-1],parServ,kNparServ);
1077       xpos  = 0.;
1078       ypos  = - fClength[iplan][0] - fClength[iplan][1] - fClength[iplan][2]/2.;
1079       for (Int_t ic = 0; ic < icham; ic++) {
1080         ypos += fClength[iplan][ic];        
1081       }
1082       ypos += fClength[iplan][icham]/2.;
1083       zpos  = fgkCH + fgkVspace/2. - fgkSheight/2. + iplan * (fgkCH + fgkVspace);
1084       gMC->Gspos(cTagV,1,"UTI1",xpos,ypos,zpos,0,"ONLY");
1085
1086       if (fPHOShole) {
1087         if (fClengthPH[iplan][icham] > 0.0) {
1088           sprintf(cTagV,"UU%02d",iDet+kNdet);
1089           parServ[0] = fCwidth[iplan]/2.;
1090           parServ[1] = fClengthPH[iplan][icham]/2. - fgkHspace/2.;
1091           parServ[2] = fgkVspace/2.;
1092           gMC->Gsvolu(cTagV,"BOX",idtmed[1302-1],parServ,kNparServ);
1093           xpos  = 0.;
1094           ypos  = - fClength[iplan][0] - fClength[iplan][1] - fClength[iplan][2]/2.;
1095           for (Int_t ic = 0; ic < icham; ic++) {
1096             ypos += fClength[iplan][ic];        
1097           }
1098           if (icham > 2) {
1099             ypos += fClength[iplan][icham];
1100             ypos -= fClengthPH[iplan][icham]/2.;
1101           }
1102           else {
1103             ypos += fClengthPH[iplan][icham]/2.;
1104           }
1105           zpos  = fgkCH + fgkVspace/2. - fgkSheight/2. + iplan * (fgkCH + fgkVspace);
1106           gMC->Gspos(cTagV,1,"UTI2",xpos,ypos,zpos,0,"ONLY");
1107         }
1108       }
1109
1110       if (fRICHhole) {
1111         if (fClengthRH[iplan][icham] > 0.0) {
1112           sprintf(cTagV,"UU%02d",iDet+2*kNdet);
1113           parServ[0] = fCwidth[iplan]/2.;
1114           parServ[1] = fClengthRH[iplan][icham]/2. - fgkHspace/2.;
1115           parServ[2] = fgkVspace/2.;
1116           gMC->Gsvolu(cTagV,"BOX",idtmed[1302-1],parServ,kNparServ);
1117           xpos  = 0.;
1118           ypos  = - fClength[iplan][0] - fClength[iplan][1] - fClength[iplan][2]/2.;
1119           for (Int_t ic = 0; ic < icham; ic++) {
1120             ypos += fClength[iplan][ic];        
1121           }
1122           if (icham > 2) {
1123             ypos += fClength[iplan][icham];
1124             ypos -= fClengthRH[iplan][icham]/2.;
1125           }
1126           else {
1127             ypos += fClengthRH[iplan][icham]/2.;
1128           }
1129           zpos  = fgkCH + fgkVspace/2. - fgkSheight/2. + iplan * (fgkCH + fgkVspace);
1130           gMC->Gspos(cTagV,1,"UTI3",xpos,ypos,zpos,0,"ONLY");
1131         }
1132       }
1133
1134     }
1135   }
1136
1137   //
1138   // The cooling pipes inside the service volumes
1139   //
1140
1141   const Int_t kNparTube = 3;
1142   Float_t parTube[kNparTube];
1143   // The aluminum pipe for the cooling
1144   parTube[0] = 0.0;
1145   parTube[1] = 0.0;
1146   parTube[2] = 0.0;
1147   gMC->Gsvolu("UTCP","TUBE",idtmed[1324-1],parTube,0);
1148   // The cooling water
1149   parTube[0] =  0.0;
1150   parTube[1] =  0.2/2.;
1151   parTube[2] = -1.;
1152   gMC->Gsvolu("UTCH","TUBE",idtmed[1314-1],parTube,kNparTube);
1153   // Water inside the cooling pipe
1154   xpos = 0.0;
1155   ypos = 0.0;
1156   zpos = 0.0;
1157   gMC->Gspos("UTCH",1,"UTCP",xpos,ypos,zpos,0,"ONLY");
1158
1159   // Position the cooling pipes in the mother volume
1160   const Int_t kNpar = 3;
1161   Float_t par[kNpar];
1162   for (icham = 0; icham < kNcham;   icham++) {
1163     //for (iplan = 0; iplan < kNplan; iplan++) {
1164     // Take out upper plane until TRD mothervolume is adjusted
1165     for (iplan = 0; iplan < kNplan-1; iplan++) { 
1166       Int_t   iDet    = GetDetectorSec(iplan,icham);
1167       Int_t   iCopy   = GetDetector(iplan,icham,0) * 100;
1168       Int_t   nMCMrow = commonParam->GetRowMax(iplan,icham,0);
1169       Float_t ySize   = (GetChamberLength(iplan,icham) - 2.*fgkRpadW) 
1170                       / ((Float_t) nMCMrow);
1171       sprintf(cTagV,"UU%02d",iDet);
1172       for (Int_t iMCMrow = 0; iMCMrow < nMCMrow; iMCMrow++) {
1173         xpos   = 0.0;
1174         ypos   = (0.5 + iMCMrow) * ySize - 1.9 
1175                - fClength[iplan][icham]/2. + fgkHspace/2.;
1176         zpos   = 0.0;                 
1177         par[0] = 0.0;
1178         par[1] = 0.3/2.; // Thickness of the cooling pipes
1179         par[2] = fCwidth[iplan]/2.;
1180         gMC->Gsposp("UTCP",iCopy+iMCMrow,cTagV,xpos,ypos,zpos
1181                           ,matrix[2],"ONLY",par,kNpar);
1182       }
1183       if (fPHOShole) {
1184         sprintf(cTagV,"UU%02d",iDet+kNdet);
1185         for (Int_t iMCMrow = 0; iMCMrow < nMCMrow; iMCMrow++) {
1186           xpos   = 0.0;
1187           ypos   = (0.5 + iMCMrow) * ySize - 1.9 
1188                  - fClengthPH[iplan][icham]/2. + fgkHspace/2.;
1189           zpos   = 0.0;                 
1190           if (ypos < (fClengthPH[iplan][icham]/2. - fgkHspace/2.)) {
1191             par[0] = 0.0;
1192             par[1] = 0.3/2.; // Thickness of the cooling pipes
1193             par[2] = fCwidth[iplan]/2.;
1194             gMC->Gsposp("UTCP",iCopy+iMCMrow+nMCMrow,cTagV,xpos,ypos,zpos
1195                               ,matrix[2],"ONLY",par,kNpar);
1196           }
1197         }
1198       }
1199       if (fRICHhole) {
1200         sprintf(cTagV,"UU%02d",iDet+2*kNdet);
1201         for (Int_t iMCMrow = 0; iMCMrow < nMCMrow; iMCMrow++) {
1202           xpos   = 0.0;
1203           ypos   = (0.5 + iMCMrow) * ySize - 1.9 
1204                  - fClengthRH[iplan][icham]/2. + fgkHspace/2.;
1205           zpos   = 0.0;                 
1206           if (ypos < (fClengthRH[iplan][icham]/2. - fgkHspace/2.)) {
1207             par[0] = 0.0;
1208             par[1] = 0.3/2.; // Thickness of the cooling pipes
1209             par[2] = fCwidth[iplan]/2.;
1210             gMC->Gsposp("UTCP",iCopy+iMCMrow+2*nMCMrow,cTagV,xpos,ypos,zpos
1211                               ,matrix[2],"ONLY",par,kNpar);
1212           }
1213         }
1214       }
1215     }
1216   }
1217
1218   //
1219   // The power lines
1220   //
1221
1222   // The copper power lines
1223   parTube[0] = 0.0;
1224   parTube[1] = 0.0;
1225   parTube[2] = 0.0;
1226   gMC->Gsvolu("UTPL","TUBE",idtmed[1305-1],parTube,0);
1227
1228   // Position the power lines in the mother volume
1229   for (icham = 0; icham < kNcham;   icham++) {
1230     //for (iplan = 0; iplan < kNplan; iplan++) {
1231     // Take out upper plane until TRD mothervolume is adjusted
1232     for (iplan = 0; iplan < kNplan-1; iplan++) { 
1233       Int_t   iDet    = GetDetectorSec(iplan,icham);
1234       Int_t   iCopy   = GetDetector(iplan,icham,0) * 100;
1235       Int_t   nMCMrow = commonParam->GetRowMax(iplan,icham,0);
1236       Float_t ySize   = (GetChamberLength(iplan,icham) - 2.*fgkRpadW) 
1237                       / ((Float_t) nMCMrow);
1238       sprintf(cTagV,"UU%02d",iDet);
1239       for (Int_t iMCMrow = 0; iMCMrow < nMCMrow; iMCMrow++) {
1240         xpos   = 0.0;
1241         ypos   = (0.5 + iMCMrow) * ySize - 1.0 
1242                - fClength[iplan][icham]/2. + fgkHspace/2.;
1243         zpos   = -0.4;
1244         par[0] = 0.0;
1245         par[1] = 0.2/2.; // Thickness of the power lines
1246         par[2] = fCwidth[iplan]/2.;
1247         gMC->Gsposp("UTPL",iCopy+iMCMrow,cTagV,xpos,ypos,zpos
1248                           ,matrix[2],"ONLY",par,kNpar);
1249       }
1250       if (fPHOShole) {
1251         sprintf(cTagV,"UU%02d",iDet+kNdet);
1252         for (Int_t iMCMrow = 0; iMCMrow < nMCMrow; iMCMrow++) {
1253           xpos   = 0.0;
1254           ypos   = (0.5 + iMCMrow) * ySize - 1.0 
1255                  - fClengthPH[iplan][icham]/2. + fgkHspace/2.;
1256           zpos   = -0.4;                 
1257           if (ypos < (fClengthPH[iplan][icham]/2. - fgkHspace/2.)) {
1258             par[0] = 0.0;
1259             par[1] = 0.2/2.; // Thickness of the power lines
1260             par[2] = fCwidth[iplan]/2.;
1261             gMC->Gsposp("UTPL",iCopy+iMCMrow+nMCMrow,cTagV,xpos,ypos,zpos
1262                               ,matrix[2],"ONLY",par,kNpar);
1263           }
1264         }
1265       }
1266       if (fRICHhole) {
1267         sprintf(cTagV,"UU%02d",iDet+2*kNdet);
1268         for (Int_t iMCMrow = 0; iMCMrow < nMCMrow; iMCMrow++) {
1269           xpos   = 0.0;
1270           ypos   = (0.5 + iMCMrow) * ySize - 1.0 
1271                  - fClengthRH[iplan][icham]/2. + fgkHspace/2.;
1272           zpos   = -0.4;                 
1273           if (ypos < (fClengthRH[iplan][icham]/2. - fgkHspace/2.)) {
1274             par[0] = 0.0;
1275             par[1] = 0.2/2.; // Thickness of the power lines
1276             par[2] = fCwidth[iplan]/2.;
1277             gMC->Gsposp("UTPL",iCopy+iMCMrow+2*nMCMrow,cTagV,xpos,ypos,zpos
1278                               ,matrix[2],"ONLY",par,kNpar);
1279           }
1280         }
1281       }
1282     }
1283   }
1284
1285   //
1286   // The MCMs
1287   //
1288
1289   // The mother volume for the MCMs (air)
1290   const Int_t kNparMCM = 3;
1291   Float_t parMCM[kNparMCM];
1292   parMCM[0] = 3.0/2.;
1293   parMCM[1] = 3.0/2.;
1294   parMCM[2] = 0.14/2.;
1295   gMC->Gsvolu("UMCM","BOX",idtmed[1302-1],parMCM,kNparMCM);
1296
1297   // The MCM carrier G10 layer
1298   parMCM[0] = 3.0/2.;
1299   parMCM[1] = 3.0/2.;
1300   parMCM[2] = 0.1/2.;
1301   gMC->Gsvolu("UMC1","BOX",idtmed[1319-1],parMCM,kNparMCM);
1302   // The MCM carrier Cu layer
1303   parMCM[0] = 3.0/2.;
1304   parMCM[1] = 3.0/2.;
1305   parMCM[2] = 0.0162/2.;
1306   gMC->Gsvolu("UMC2","BOX",idtmed[1318-1],parMCM,kNparMCM);
1307   // The silicon of the chips
1308   parMCM[0] = 3.0/2.;
1309   parMCM[1] = 3.0/2.;
1310   parMCM[2] = 0.003/2.;
1311   gMC->Gsvolu("UMC3","BOX",idtmed[1320-1],parMCM,kNparMCM);
1312
1313   // Put the MCM material inside the MCM mother volume
1314   xpos  =  0.0;
1315   ypos  =  0.0;
1316   zpos  = -0.07      + 0.1/2.;
1317   gMC->Gspos("UMC1",1,"UMCM",xpos,ypos,zpos,0,"ONLY");
1318   zpos +=  0.1/2.    + 0.0162/2.;
1319   gMC->Gspos("UMC2",1,"UMCM",xpos,ypos,zpos,0,"ONLY");
1320   zpos +=  0.00162/2 + 0.003/2.;
1321   gMC->Gspos("UMC3",1,"UMCM",xpos,ypos,zpos,0,"ONLY");
1322
1323   // Position the MCMs in the mother volume
1324   for (icham = 0; icham < kNcham;   icham++) {
1325     //for (iplan = 0; iplan < kNplan; iplan++) {
1326     // Take out upper plane until TRD mothervolume is adjusted
1327     for (iplan = 0; iplan < kNplan-1; iplan++) { 
1328       Int_t   iDet    = GetDetectorSec(iplan,icham);
1329       Int_t   iCopy   = GetDetector(iplan,icham,0) * 1000;
1330       Int_t   nMCMrow = commonParam->GetRowMax(iplan,icham,0);
1331       Float_t ySize   = (GetChamberLength(iplan,icham) - 2.*fgkRpadW) 
1332                       / ((Float_t) nMCMrow);
1333       Int_t   nMCMcol = 8;
1334       Float_t xSize   = (GetChamberWidth(iplan) - 2.* fgkCpadW)
1335                       / ((Float_t) nMCMcol);
1336       sprintf(cTagV,"UU%02d",iDet);
1337       for (Int_t iMCMrow = 0; iMCMrow < nMCMrow; iMCMrow++) {
1338         for (Int_t iMCMcol = 0; iMCMcol < nMCMcol; iMCMcol++) {
1339           xpos   = (0.5 + iMCMcol) * xSize + 1.0 
1340                  - fCwidth[iplan]/2.;
1341           ypos   = (0.5 + iMCMrow) * ySize + 1.0 
1342                  - fClength[iplan][icham]/2. + fgkHspace/2.;
1343           zpos   = -0.4;
1344           par[0] = 0.0;
1345           par[1] = 0.2/2.; // Thickness of the power lines
1346           par[2] = fCwidth[iplan]/2.;
1347           gMC->Gspos("UMCM",iCopy+iMCMrow*10+iMCMcol,cTagV
1348                            ,xpos,ypos,zpos,0,"ONLY");
1349         }
1350       }
1351       if (fPHOShole) {
1352         sprintf(cTagV,"UU%02d",iDet+kNdet);
1353         for (Int_t iMCMrow = 0; iMCMrow < nMCMrow; iMCMrow++) {
1354           for (Int_t iMCMcol = 0; iMCMcol < nMCMcol; iMCMcol++) {
1355             xpos   = (0.5 + iMCMcol) * xSize + 1.0 
1356                    - fCwidth[iplan]/2.;
1357             ypos   = (0.5 + iMCMrow) * ySize + 1.0 
1358                    - fClengthPH[iplan][icham]/2. + fgkHspace/2.;
1359             zpos   = -0.4;
1360             if (ypos < (fClengthPH[iplan][icham]/2. - fgkHspace/2.)) {
1361               par[0] = 0.0;
1362               par[1] = 0.2/2.; // Thickness of the power lines
1363               par[2] = fCwidth[iplan]/2.;
1364               gMC->Gspos("UMCM",iCopy+iMCMrow*10+iMCMcol+10*nMCMrow,cTagV
1365                                ,xpos,ypos,zpos,0,"ONLY");
1366             }
1367           }
1368         }
1369       }
1370       if (fRICHhole) {
1371         sprintf(cTagV,"UU%02d",iDet+2*kNdet);
1372         for (Int_t iMCMrow = 0; iMCMrow < nMCMrow; iMCMrow++) {
1373           for (Int_t iMCMcol = 0; iMCMcol < nMCMcol; iMCMcol++) {
1374             xpos   = (0.5 + iMCMcol) * xSize + 1.0 
1375                    - fCwidth[iplan]/2.;
1376             ypos   = (0.5 + iMCMrow) * ySize + 1.0 
1377                    - fClengthRH[iplan][icham]/2. + fgkHspace/2.;
1378             zpos   = -0.4;
1379             if (ypos < (fClengthRH[iplan][icham]/2. - fgkHspace/2.)) {
1380               par[0] = 0.0;
1381               par[1] = 0.2/2.; // Thickness of the power lines
1382               par[2] = fCwidth[iplan]/2.;
1383               gMC->Gspos("UMCM",iCopy+iMCMrow*10+iMCMcol+20*nMCMrow,cTagV
1384                                ,xpos,ypos,zpos,0,"ONLY");
1385             }
1386           }
1387         }
1388       }
1389
1390     }
1391   }
1392 }