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