]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDgeometryHole.cxx
Field conversion factor added.
[u/mrichter/AliRoot.git] / TRD / AliTRDgeometryHole.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.6  2001/05/11 07:56:12  hristov
19 Consistent declarations needed on Alpha
20
21 Revision 1.5  2001/02/14 18:22:26  cblume
22 Change in the geometry of the padplane
23
24 Revision 1.4  2000/11/01 14:53:21  cblume
25 Merge with TRD-develop
26
27 Revision 1.1.4.4  2000/10/15 23:40:01  cblume
28 Remove AliTRDconst
29
30 Revision 1.1.4.3  2000/10/06 16:49:46  cblume
31 Made Getters const
32
33 Revision 1.1.4.2  2000/10/04 16:34:58  cblume
34 Replace include files by forward declarations
35
36 Revision 1.1.4.1  2000/09/22 14:43:41  cblume
37 Allow the pad/timebin-dimensions to be changed after initialization
38
39 Revision 1.3  2000/10/02 21:28:19  fca
40 Removal of useless dependecies via forward declarations
41
42 Revision 1.2  2000/06/08 18:32:58  cblume
43 Make code compliant to coding conventions
44
45 Revision 1.1  2000/02/28 19:01:42  cblume
46 Add new TRD classes
47
48 */
49
50 ///////////////////////////////////////////////////////////////////////////////
51 //                                                                           //
52 //  TRD geometry with holes                                                  //
53 //                                                                           //
54 ///////////////////////////////////////////////////////////////////////////////
55
56 #include "AliMC.h"
57
58 #include "AliTRDgeometryHole.h"
59
60 ClassImp(AliTRDgeometryHole)
61
62 //_____________________________________________________________________________
63 AliTRDgeometryHole::AliTRDgeometryHole():AliTRDgeometry()
64 {
65   //
66   // AliTRDgeometryHole default constructor
67   //
68
69   Init();
70
71 }
72
73 //_____________________________________________________________________________
74 AliTRDgeometryHole::~AliTRDgeometryHole()
75 {
76   //
77   // AliTRDgeometryHole destructor
78   //
79
80 }
81
82 //_____________________________________________________________________________
83 void AliTRDgeometryHole::Init()
84 {
85   //
86   // Initializes the geometry parameter
87   //
88
89   Int_t iplan;
90   Int_t icham;
91
92   // The outer lengths of the chambers for the sectors with holes for the PHOS
93   Float_t lengthPH[kNplan][kNcham] = { {   0.0,   0.0,   0.0, 116.5, 123.5 }
94                                      , {   0.0,   0.0,   0.0, 124.0, 131.0 }
95                                      , {   0.0,   0.0,   0.0, 131.5, 134.5 }
96                                      , {   0.0,   0.0,   0.0, 139.0, 142.0 }
97                                      , {   0.0,   0.0,   0.0, 146.0, 142.0 }
98                                      , {   0.0,   0.0,   0.0, 153.5, 134.5 } };
99
100   // The outer lengths of the chambers for the sectors with holes for the RICH
101   Float_t lengthRH[kNplan][kNcham] = { {   0.0,   0.0,   0.0,   0.0,  86.5 }
102                                      , {   0.0,   0.0,   0.0,   0.0, 101.5 }
103                                      , {   0.0,   0.0,   0.0,   0.0, 112.5 }
104                                      , {   0.0,   0.0,   0.0,   0.0, 127.5 }
105                                      , {   0.0,   0.0,   0.0,   0.0, 134.5 }
106                                      , {   0.0,   0.0,   0.0,   0.0, 134.5 } };
107
108   for (icham = 0; icham < kNcham; icham++) {
109     for (iplan = 0; iplan < kNplan; iplan++) {
110       fClengthPH[iplan][icham] = lengthPH[iplan][icham];
111       fClengthRH[iplan][icham] = lengthRH[iplan][icham];
112     }
113   }
114
115 }
116
117 //_____________________________________________________________________________
118 void AliTRDgeometryHole::CreateGeometry(Int_t *idtmed)
119 {
120   //
121   // Create the TRD geometry with holes
122   //
123   // Names of the TRD volumina (xx = detector number):
124   //
125   //      Lower part of the readout chambers (gas volume + radiator)
126   //
127   //        UAxx    Aluminum frames             (Al)
128   //        UBxx    G10 frames                  (C)
129   //        UCxx    Inner volumes               (Air)
130   //
131   //      Upper part of the readout chambers (readout plane + fee)
132   //
133   //        UDxx    G10 frames                  (C)
134   //        UExx    Inner volumes of the G10    (Air)
135   //        UFxx    Aluminum frames             (Al)
136   //        UGxx    Inner volumes of the Al     (Air)
137   //
138   //      Inner material layers
139   //
140   //        UHxx    Radiator                    (Rohacell)
141   //        UIxx    Entrance window             (Mylar)
142   //        UJxx    Drift volume                (Xe/CO2)
143   //        UKxx    Amplification volume        (Xe/CO2)
144   //        ULxx    Pad plane                   (Cu)
145   //        UMxx    Support structure           (Rohacell)
146   //        UNxx    FEE + signal lines          (Cu)
147   //        UOxx    Cooling device              (Al)
148   //        UPxx    Cooling device              (Water)
149   //
150
151   const Int_t kNdet    = kNplan * kNcham;
152
153   const Int_t kNparTrd = 4;
154   const Int_t kNparCha = 3;
155
156   Float_t xpos, ypos, zpos;
157
158   Float_t parTrd[kNparTrd];
159   Float_t parCha[kNparCha];
160
161   Char_t  cTagV[5];
162   Char_t  cTagM[5];
163
164   AliTRDgeometry::CreateGeometry(idtmed);
165
166   // The TRD mother volume for one sector (Air), full length in z-direction
167   parTrd[0] = fgkSwidth1/2.;
168   parTrd[1] = fgkSwidth2/2.;
169   parTrd[2] = fgkSlenTR1/2.;
170   parTrd[3] = fgkSheight/2.;
171   gMC->Gsvolu("UTR1","TRD1",idtmed[1302-1],parTrd,kNparTrd);
172
173   // The TRD mother volume for one sector (Air), leaving hole for PHOS
174   parTrd[0] = fgkSwidth1/2.;
175   parTrd[1] = fgkSwidth2/2.;
176   parTrd[2] = fgkSlenTR2/2.;
177   parTrd[3] = fgkSheight/2.;
178   gMC->Gsvolu("UTR2","TRD1",idtmed[1302-1],parTrd,kNparTrd);
179
180   // The TRD mother volume for one sector (Air), leaving hole for RICH
181   parTrd[0] = fgkSwidth1/2.;
182   parTrd[1] = fgkSwidth2/2.;
183   parTrd[2] = fgkSlenTR3/2.;
184   parTrd[3] = fgkSheight/2.;
185   gMC->Gsvolu("UTR3","TRD1",idtmed[1302-1],parTrd,kNparTrd);
186
187   for (Int_t icham = 0; icham < kNcham; icham++) {
188     for (Int_t iplan = 0; iplan < kNplan; iplan++) {  
189
190       Int_t iDet = GetDetectorSec(iplan,icham);
191
192       // The lower part of the readout chambers (gas volume + radiator) 
193       // The aluminum frames 
194       sprintf(cTagV,"UA%02d",iDet);
195       parCha[0] = fCwidth[iplan]/2.;
196       parCha[1] = fClength[iplan][icham]/2. - fgkHspace/2.;
197       parCha[2] = fgkCraH/2. + fgkCdrH/2.;
198       gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parCha,kNparCha);
199       // The G10 frames 
200       sprintf(cTagV,"UB%02d",iDet);
201       parCha[0] = fCwidth[iplan]/2. - fgkCalT; 
202       parCha[1] = -1.;
203       parCha[2] = -1.;
204       gMC->Gsvolu(cTagV,"BOX ",idtmed[1307-1],parCha,kNparCha);
205       // The inner part (air)
206       sprintf(cTagV,"UC%02d",iDet);
207       parCha[0] = fCwidth[iplan]/2. - fgkCalT - fgkCclsT; 
208       parCha[1] = fClength[iplan][icham]/2. - fgkHspace/2.- fgkCclfT;
209       parCha[2] = -1.;
210       gMC->Gsvolu(cTagV,"BOX ",idtmed[1302-1],parCha,kNparCha);
211       if (fClengthPH[iplan][icham] > 0.0) {
212         // The aluminum frames 
213         sprintf(cTagV,"UA%02d",iDet+kNdet);
214         parCha[0] = fCwidth[iplan]/2.;
215         parCha[1] = fClengthPH[iplan][icham]/2. - fgkHspace/2.;
216         parCha[2] = fgkCraH/2. + fgkCdrH/2.;
217         gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parCha,kNparCha);
218         // The G10 frames 
219         sprintf(cTagV,"UB%02d",iDet+kNdet);
220         parCha[0] = fCwidth[iplan]/2. - fgkCalT; 
221         parCha[1] = -1.;
222         parCha[2] = -1.;
223         gMC->Gsvolu(cTagV,"BOX ",idtmed[1307-1],parCha,kNparCha);
224         // The inner part (air)
225         sprintf(cTagV,"UC%02d",iDet+kNdet);
226         parCha[0] = fCwidth[iplan]/2. - fgkCalT - fgkCclsT; 
227         parCha[1] = fClengthPH[iplan][icham]/2. - fgkHspace/2.- fgkCclfT;
228         parCha[2] = -1.;
229         gMC->Gsvolu(cTagV,"BOX ",idtmed[1302-1],parCha,kNparCha);
230       }
231       if (fClengthRH[iplan][icham] > 0.0) {
232         // The aluminum frames 
233         sprintf(cTagV,"UA%02d",iDet+2*kNdet);
234         parCha[0] = fCwidth[iplan]/2.;
235         parCha[1] = fClengthRH[iplan][icham]/2. - fgkHspace/2.;
236         parCha[2] = fgkCraH/2. + fgkCdrH/2.;
237         gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parCha,kNparCha);
238         // The G10 frames 
239         sprintf(cTagV,"UB%02d",iDet+2*kNdet);
240         parCha[0] = fCwidth[iplan]/2. - fgkCalT; 
241         parCha[1] = -1.;
242         parCha[2] = -1.;
243         gMC->Gsvolu(cTagV,"BOX ",idtmed[1307-1],parCha,kNparCha);
244         // The inner part (air)
245         sprintf(cTagV,"UC%02d",iDet+2*kNdet);
246         parCha[0] = fCwidth[iplan]/2. - fgkCalT - fgkCclsT; 
247         parCha[1] = fClengthRH[iplan][icham]/2. - fgkHspace/2.- fgkCclfT;
248         parCha[2] = -1.;
249         gMC->Gsvolu(cTagV,"BOX ",idtmed[1302-1],parCha,kNparCha);
250       }
251
252       // The upper part of the readout chambers (readout plane + fee)
253       // The G10 frames
254       sprintf(cTagV,"UD%02d",iDet);
255       parCha[0] = fCwidth[iplan]/2. + fgkCroW;
256       parCha[1] = fClength[iplan][icham]/2. - fgkHspace/2.;
257       parCha[2] = fgkCamH/2.;
258       gMC->Gsvolu(cTagV,"BOX ",idtmed[1307-1],parCha,kNparCha);
259       // The inner part of the G10 frame (air)
260       sprintf(cTagV,"UE%02d",iDet);
261       parCha[0] = fCwidth[iplan]/2. + fgkCroW - fgkCcuT; 
262       parCha[1] = fClength[iplan][icham]/2. - fgkHspace/2.- fgkCcuT;
263       parCha[2] = -1.;
264       gMC->Gsvolu(cTagV,"BOX ",idtmed[1302-1],parCha,kNparCha);
265       // The aluminum frames
266       sprintf(cTagV,"UF%02d",iDet);
267       parCha[0] = fCwidth[iplan]/2. + fgkCroW;
268       parCha[1] = fClength[iplan][icham]/2. - fgkHspace/2.;
269       parCha[2] = fgkCroH/2.;
270       gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parCha,kNparCha);
271       // The inner part of the aluminum frames
272       sprintf(cTagV,"UG%02d",iDet);
273       parCha[0] = fCwidth[iplan]/2. + fgkCroW - fgkCauT; 
274       parCha[1] = fClength[iplan][icham]/2. - fgkHspace/2.- fgkCauT;
275       parCha[2] = -1.;
276       gMC->Gsvolu(cTagV,"BOX ",idtmed[1302-1],parCha,kNparCha);
277       if (fClengthPH[iplan][icham] > 0.0) {
278         sprintf(cTagV,"UD%02d",iDet+kNdet);
279         parCha[0] = fCwidth[iplan]/2. + fgkCroW;
280         parCha[1] = fClengthPH[iplan][icham]/2. - fgkHspace/2.;
281         parCha[2] = fgkCamH/2.;
282         gMC->Gsvolu(cTagV,"BOX ",idtmed[1307-1],parCha,kNparCha);
283         // The inner part of the G10 frame (air)
284         sprintf(cTagV,"UE%02d",iDet+kNdet);
285         parCha[0] = fCwidth[iplan]/2. + fgkCroW - fgkCcuT; 
286         parCha[1] = fClengthPH[iplan][icham]/2. - fgkHspace/2.- fgkCcuT;
287         parCha[2] = -1.;
288         gMC->Gsvolu(cTagV,"BOX ",idtmed[1302-1],parCha,kNparCha);
289         // The aluminum frames
290         sprintf(cTagV,"UF%02d",iDet+kNdet);
291         parCha[0] = fCwidth[iplan]/2. + fgkCroW;
292         parCha[1] = fClengthPH[iplan][icham]/2. - fgkHspace/2.;
293         parCha[2] = fgkCroH/2.;
294         gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parCha,kNparCha);
295         // The inner part of the aluminum frames
296         sprintf(cTagV,"UG%02d",iDet+kNdet);
297         parCha[0] = fCwidth[iplan]/2. + fgkCroW - fgkCauT; 
298         parCha[1] = fClengthPH[iplan][icham]/2. - fgkHspace/2.- fgkCauT;
299         parCha[2] = -1.;
300         gMC->Gsvolu(cTagV,"BOX ",idtmed[1302-1],parCha,kNparCha);
301       }
302       if (fClengthRH[iplan][icham] > 0.0) {
303         sprintf(cTagV,"UD%02d",iDet+2*kNdet);
304         parCha[0] = fCwidth[iplan]/2. + fgkCroW;
305         parCha[1] = fClengthRH[iplan][icham]/2. - fgkHspace/2.;
306         parCha[2] = fgkCamH/2.;
307         gMC->Gsvolu(cTagV,"BOX ",idtmed[1307-1],parCha,kNparCha);
308         // The inner part of the G10 frame (air)
309         sprintf(cTagV,"UE%02d",iDet+2*kNdet);
310         parCha[0] = fCwidth[iplan]/2. + fgkCroW - fgkCcuT; 
311         parCha[1] = fClengthRH[iplan][icham]/2. - fgkHspace/2.- fgkCcuT;
312         parCha[2] = -1.;
313         gMC->Gsvolu(cTagV,"BOX ",idtmed[1302-1],parCha,kNparCha);
314         // The aluminum frames
315         sprintf(cTagV,"UF%02d",iDet+2*kNdet);
316         parCha[0] = fCwidth[iplan]/2. + fgkCroW;
317         parCha[1] = fClengthRH[iplan][icham]/2. - fgkHspace/2.;
318         parCha[2] = fgkCroH/2.;
319         gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parCha,kNparCha);
320         // The inner part of the aluminum frames
321         sprintf(cTagV,"UG%02d",iDet+2*kNdet);
322         parCha[0] = fCwidth[iplan]/2. + fgkCroW - fgkCauT; 
323         parCha[1] = fClengthRH[iplan][icham]/2. - fgkHspace/2.- fgkCauT;
324         parCha[2] = -1.;
325         gMC->Gsvolu(cTagV,"BOX ",idtmed[1302-1],parCha,kNparCha);
326       }
327
328       // The material layers inside the chambers
329       parCha[0] = -1.;
330       parCha[1] = -1.;
331       // Rohacell layer (radiator)
332       parCha[2] = fgkRaThick/2;
333       sprintf(cTagV,"UH%02d",iDet);
334       gMC->Gsvolu(cTagV,"BOX ",idtmed[1315-1],parCha,kNparCha);
335       // Mylar layer (entrance window + HV cathode) 
336       parCha[2] = fgkMyThick/2;
337       sprintf(cTagV,"UI%02d",iDet);
338       gMC->Gsvolu(cTagV,"BOX ",idtmed[1308-1],parCha,kNparCha);
339       // Xe/Isobutane layer (drift volume) 
340       parCha[2] = fgkDrThick/2.;
341       sprintf(cTagV,"UJ%02d",iDet);
342       gMC->Gsvolu(cTagV,"BOX ",idtmed[1309-1],parCha,kNparCha);
343       // Xe/Isobutane layer (amplification volume)
344       parCha[2] = fgkAmThick/2.;
345       sprintf(cTagV,"UK%02d",iDet);
346       gMC->Gsvolu(cTagV,"BOX ",idtmed[1309-1],parCha,kNparCha);  
347       // Cu layer (pad plane)
348       parCha[2] = fgkCuThick/2;
349       sprintf(cTagV,"UL%02d",iDet);
350       gMC->Gsvolu(cTagV,"BOX ",idtmed[1305-1],parCha,kNparCha);
351       // G10 layer (support structure / honeycomb)
352       parCha[2] = fgkSuThick/2;
353       sprintf(cTagV,"UM%02d",iDet);
354       gMC->Gsvolu(cTagV,"BOX ",idtmed[1313-1],parCha,kNparCha);
355       // Cu layer (FEE + signal lines)
356       parCha[2] = fgkFeThick/2;
357       sprintf(cTagV,"UN%02d",iDet);
358       gMC->Gsvolu(cTagV,"BOX ",idtmed[1305-1],parCha,kNparCha);
359       // Al layer (cooling devices)
360       parCha[2] = fgkCoThick/2;
361       sprintf(cTagV,"UO%02d",iDet);
362       gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parCha,kNparCha);
363       // Water layer (cooling)
364       parCha[2] = fgkWaThick/2;
365       sprintf(cTagV,"UP%02d",iDet);
366       gMC->Gsvolu(cTagV,"BOX ",idtmed[1314-1],parCha,kNparCha);
367       if (fClengthPH[iplan][icham] > 0.0) {
368         // Rohacell layer (radiator)
369         parCha[2] = fgkRaThick/2;
370         sprintf(cTagV,"UH%02d",iDet+kNdet);
371         gMC->Gsvolu(cTagV,"BOX ",idtmed[1315-1],parCha,kNparCha);
372         // Mylar layer (entrance window + HV cathode) 
373         parCha[2] = fgkMyThick/2;
374         sprintf(cTagV,"UI%02d",iDet+kNdet);
375         gMC->Gsvolu(cTagV,"BOX ",idtmed[1308-1],parCha,kNparCha);
376         // Xe/Isobutane layer (drift volume) 
377         parCha[2] = fgkDrThick/2.;
378         sprintf(cTagV,"UJ%02d",iDet+kNdet);
379         gMC->Gsvolu(cTagV,"BOX ",idtmed[1309-1],parCha,kNparCha);
380         // Xe/Isobutane layer (amplification volume)
381         parCha[2] = fgkAmThick/2.;
382         sprintf(cTagV,"UK%02d",iDet+kNdet);
383         gMC->Gsvolu(cTagV,"BOX ",idtmed[1309-1],parCha,kNparCha);  
384         // Cu layer (pad plane)
385         parCha[2] = fgkCuThick/2;
386         sprintf(cTagV,"UL%02d",iDet+kNdet);
387         gMC->Gsvolu(cTagV,"BOX ",idtmed[1305-1],parCha,kNparCha);
388         // G10 layer (support structure / honeycomb)
389         parCha[2] = fgkSuThick/2;
390         sprintf(cTagV,"UM%02d",iDet+kNdet);
391         gMC->Gsvolu(cTagV,"BOX ",idtmed[1313-1],parCha,kNparCha);
392         // Cu layer (FEE + signal lines)
393         parCha[2] = fgkFeThick/2;
394         sprintf(cTagV,"UN%02d",iDet+kNdet);
395         gMC->Gsvolu(cTagV,"BOX ",idtmed[1305-1],parCha,kNparCha);
396         // Al layer (cooling devices)
397         parCha[2] = fgkCoThick/2;
398         sprintf(cTagV,"UO%02d",iDet+kNdet);
399         gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parCha,kNparCha);
400         // Water layer (cooling)
401         parCha[2] = fgkWaThick/2;
402         sprintf(cTagV,"UP%02d",iDet+kNdet);
403         gMC->Gsvolu(cTagV,"BOX ",idtmed[1314-1],parCha,kNparCha);
404       }
405       if (fClengthRH[iplan][icham] > 0.0) {
406         // Rohacell layer (radiator)
407         parCha[2] = fgkRaThick/2;
408         sprintf(cTagV,"UH%02d",iDet+2*kNdet);
409         gMC->Gsvolu(cTagV,"BOX ",idtmed[1315-1],parCha,kNparCha);
410         // Mylar layer (entrance window + HV cathode) 
411         parCha[2] = fgkMyThick/2;
412         sprintf(cTagV,"UI%02d",iDet+2*kNdet);
413         gMC->Gsvolu(cTagV,"BOX ",idtmed[1308-1],parCha,kNparCha);
414         // Xe/Isobutane layer (drift volume) 
415         parCha[2] = fgkDrThick/2.;
416         sprintf(cTagV,"UJ%02d",iDet+2*kNdet);
417         gMC->Gsvolu(cTagV,"BOX ",idtmed[1309-1],parCha,kNparCha);
418         // Xe/Isobutane layer (amplification volume)
419         parCha[2] = fgkAmThick/2.;
420         sprintf(cTagV,"UK%02d",iDet+2*kNdet);
421         gMC->Gsvolu(cTagV,"BOX ",idtmed[1309-1],parCha,kNparCha);  
422         // Cu layer (pad plane)
423         parCha[2] = fgkCuThick/2;
424         sprintf(cTagV,"UL%02d",iDet+2*kNdet);
425         gMC->Gsvolu(cTagV,"BOX ",idtmed[1305-1],parCha,kNparCha);
426         // G10 layer (support structure / honeycomb)
427         parCha[2] = fgkSuThick/2;
428         sprintf(cTagV,"UM%02d",iDet+2*kNdet);
429         gMC->Gsvolu(cTagV,"BOX ",idtmed[1313-1],parCha,kNparCha);
430         // Cu layer (FEE + signal lines)
431         parCha[2] = fgkFeThick/2;
432         sprintf(cTagV,"UN%02d",iDet+2*kNdet);
433         gMC->Gsvolu(cTagV,"BOX ",idtmed[1305-1],parCha,kNparCha);
434         // Al layer (cooling devices)
435         parCha[2] = fgkCoThick/2.;
436         sprintf(cTagV,"UO%02d",iDet+2*kNdet);
437         gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parCha,kNparCha);
438         // Water layer (cooling)
439         parCha[2] = fgkWaThick/2;
440         sprintf(cTagV,"UP%02d",iDet+2*kNdet);
441         gMC->Gsvolu(cTagV,"BOX ",idtmed[1314-1],parCha,kNparCha);
442       }
443
444       // Position the layers in the chambers
445       xpos = 0;
446       ypos = 0;
447       // Lower part
448       // Rohacell layer (radiator)
449       zpos = fgkRaZpos;
450       sprintf(cTagV,"UH%02d",iDet);
451       sprintf(cTagM,"UC%02d",iDet);
452       gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
453       // Mylar layer (entrance window + HV cathode)   
454       zpos = fgkMyZpos;
455       sprintf(cTagV,"UI%02d",iDet);
456       sprintf(cTagM,"UC%02d",iDet);
457       gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
458       // Xe/Isobutane layer (drift volume) 
459       zpos = fgkDrZpos;
460       sprintf(cTagV,"UJ%02d",iDet);
461       sprintf(cTagM,"UC%02d",iDet);
462       gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
463       // Upper part
464       // Xe/Isobutane layer (amplification volume)
465       zpos = fgkAmZpos;
466       sprintf(cTagV,"UK%02d",iDet);
467       sprintf(cTagM,"UE%02d",iDet);
468       gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
469       // Readout part
470       // Cu layer (pad plane)
471       zpos = fgkCuZpos; 
472       sprintf(cTagV,"UL%02d",iDet);
473       sprintf(cTagM,"UG%02d",iDet);
474       gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
475       // G10 layer (support structure)
476       zpos = fgkSuZpos;
477       sprintf(cTagV,"UM%02d",iDet);
478       sprintf(cTagM,"UG%02d",iDet);
479       gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
480       // Cu layer (FEE + signal lines)
481       zpos = fgkFeZpos; 
482       sprintf(cTagV,"UN%02d",iDet);
483       sprintf(cTagM,"UG%02d",iDet);
484       gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
485       // Al layer (cooling devices)
486       zpos = fgkCoZpos;
487       sprintf(cTagV,"UO%02d",iDet);
488       sprintf(cTagM,"UG%02d",iDet);
489       gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
490       // Water layer (cooling)
491       zpos = fgkWaZpos;
492       sprintf(cTagV,"UP%02d",iDet);
493       sprintf(cTagM,"UG%02d",iDet);
494       gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
495       if (fClengthPH[iplan][icham] > 0.0) {
496         // Lower part
497         // Rohacell layer (radiator)
498         zpos = fgkRaZpos;
499         sprintf(cTagV,"UH%02d",iDet+kNdet);
500         sprintf(cTagM,"UC%02d",iDet+kNdet);
501         gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
502         // Mylar layer (entrance window + HV cathode)   
503         zpos = fgkMyZpos;
504         sprintf(cTagV,"UI%02d",iDet+kNdet);
505         sprintf(cTagM,"UC%02d",iDet+kNdet);
506         gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
507         // Xe/Isobutane layer (drift volume) 
508         zpos = fgkDrZpos;
509         sprintf(cTagV,"UJ%02d",iDet+kNdet);
510         sprintf(cTagM,"UC%02d",iDet+kNdet);
511         gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
512         // Upper part
513         // Xe/Isobutane layer (amplification volume)
514         zpos = fgkAmZpos;
515         sprintf(cTagV,"UK%02d",iDet+kNdet);
516         sprintf(cTagM,"UE%02d",iDet+kNdet);
517         gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
518         // Readout part
519         // Cu layer (pad plane)
520         zpos = fgkCuZpos; 
521         sprintf(cTagV,"UL%02d",iDet+kNdet);
522         sprintf(cTagM,"UG%02d",iDet+kNdet);
523         gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
524         // G10 layer (support structure)
525         zpos = fgkSuZpos;
526         sprintf(cTagV,"UM%02d",iDet+kNdet);
527         sprintf(cTagM,"UG%02d",iDet+kNdet);
528         gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
529         // Cu layer (FEE + signal lines)
530         zpos = fgkFeZpos; 
531         sprintf(cTagV,"UN%02d",iDet+kNdet);
532         sprintf(cTagM,"UG%02d",iDet+kNdet);
533         gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
534         // Al layer (cooling devices)
535         zpos = fgkCoZpos;
536         sprintf(cTagV,"UO%02d",iDet+kNdet);
537         sprintf(cTagM,"UG%02d",iDet+kNdet);
538         gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
539         // Water layer (cooling)
540         zpos = fgkWaZpos;
541         sprintf(cTagV,"UP%02d",iDet+kNdet);
542         sprintf(cTagM,"UG%02d",iDet+kNdet);
543         gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
544       }
545       if (fClengthRH[iplan][icham] > 0.0) {
546         // Lower part
547         // Rohacell layer (radiator)
548         zpos = fgkRaZpos;
549         sprintf(cTagV,"UH%02d",iDet+2*kNdet);
550         sprintf(cTagM,"UC%02d",iDet+2*kNdet);
551         gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
552         // Mylar layer (entrance window + HV cathode)   
553         zpos = fgkMyZpos;
554         sprintf(cTagV,"UI%02d",iDet+2*kNdet);
555         sprintf(cTagM,"UC%02d",iDet+2*kNdet);
556         gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
557         // Xe/Isobutane layer (drift volume) 
558         zpos = fgkDrZpos;
559         sprintf(cTagV,"UJ%02d",iDet+2*kNdet);
560         sprintf(cTagM,"UC%02d",iDet+2*kNdet);
561         gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
562         // Upper part
563         // Xe/Isobutane layer (amplification volume)
564         zpos = fgkAmZpos;
565         sprintf(cTagV,"UK%02d",iDet+2*kNdet);
566         sprintf(cTagM,"UE%02d",iDet+2*kNdet);
567         gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
568         // Readout part
569         // Cu layer (pad plane)
570         zpos = fgkCuZpos; 
571         sprintf(cTagV,"UL%02d",iDet+2*kNdet);
572         sprintf(cTagM,"UG%02d",iDet+2*kNdet);
573         gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
574         // G10 layer (support structure)
575         zpos = fgkSuZpos;
576         sprintf(cTagV,"UM%02d",iDet+2*kNdet);
577         sprintf(cTagM,"UG%02d",iDet+2*kNdet);
578         gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
579         // Cu layer (FEE + signal lines)
580         zpos = fgkFeZpos; 
581         sprintf(cTagV,"UN%02d",iDet+2*kNdet);
582         sprintf(cTagM,"UG%02d",iDet+2*kNdet);
583         gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
584         // Al layer (cooling devices)
585         zpos = fgkCoZpos;
586         sprintf(cTagV,"UO%02d",iDet+2*kNdet);
587         sprintf(cTagM,"UG%02d",iDet+2*kNdet);
588         gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
589         // Water layer (cooling)
590         zpos = fgkWaZpos;
591         sprintf(cTagV,"UP%02d",iDet+2*kNdet);
592         sprintf(cTagM,"UG%02d",iDet+2*kNdet);
593         gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
594       }
595
596       // Position the inner volumes of the chambers in the frames
597       xpos      = 0.0;
598       ypos      = 0.0;
599       zpos      = 0.0;
600       // The inside of the lower G10 frame
601       sprintf(cTagV,"UC%02d",iDet);
602       sprintf(cTagM,"UB%02d",iDet);
603       gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
604       // The lower G10 frame inside the aluminum frame
605       sprintf(cTagV,"UB%02d",iDet);
606       sprintf(cTagM,"UA%02d",iDet);
607       gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
608       // The inside of the upper G10 frame
609       sprintf(cTagV,"UE%02d",iDet);
610       sprintf(cTagM,"UD%02d",iDet);
611       gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
612       // The inside of the upper aluminum frame
613       sprintf(cTagV,"UG%02d",iDet);
614       sprintf(cTagM,"UF%02d",iDet);
615       gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");      
616       if (fClengthPH[iplan][icham] > 0.0) {
617         // The inside of the lower G10 frame
618         sprintf(cTagV,"UC%02d",iDet+kNdet);
619         sprintf(cTagM,"UB%02d",iDet+kNdet);
620         gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
621         // The lower G10 frame inside the aluminum frame
622         sprintf(cTagV,"UB%02d",iDet+kNdet);
623         sprintf(cTagM,"UA%02d",iDet+kNdet);
624         gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
625         // The inside of the upper G10 frame
626         sprintf(cTagV,"UE%02d",iDet+kNdet);
627         sprintf(cTagM,"UD%02d",iDet+kNdet);
628         gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
629         // The inside of the upper aluminum frame
630         sprintf(cTagV,"UG%02d",iDet+kNdet);
631         sprintf(cTagM,"UF%02d",iDet+kNdet);
632         gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");      
633       }
634       if (fClengthRH[iplan][icham] > 0.0) {
635         // The inside of the lower G10 frame
636         sprintf(cTagV,"UC%02d",iDet+2*kNdet);
637         sprintf(cTagM,"UB%02d",iDet+2*kNdet);
638         gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
639         // The lower G10 frame inside the aluminum frame
640         sprintf(cTagV,"UB%02d",iDet+2*kNdet);
641         sprintf(cTagM,"UA%02d",iDet+2*kNdet);
642         gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
643         // The inside of the upper G10 frame
644         sprintf(cTagV,"UE%02d",iDet+2*kNdet);
645         sprintf(cTagM,"UD%02d",iDet+2*kNdet);
646         gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
647         // The inside of the upper aluminum frame
648         sprintf(cTagV,"UG%02d",iDet+2*kNdet);
649         sprintf(cTagM,"UF%02d",iDet+2*kNdet);
650         gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");      
651       }
652
653       // Position the frames of the chambers in the TRD mother volume
654       xpos  = 0.;
655       ypos  = - fClength[iplan][0] - fClength[iplan][1] - fClength[iplan][2]/2.;
656       for (Int_t ic = 0; ic < icham; ic++) {
657         ypos += fClength[iplan][ic];        
658       }
659       ypos += fClength[iplan][icham]/2.;
660       zpos  = fgkCraH/2. + fgkCdrH/2. - fgkSheight/2. + iplan * (fgkCH + fgkVspace);
661       // The lower aluminum frame, radiator + drift region
662       sprintf(cTagV,"UA%02d",iDet);
663       gMC->Gspos(cTagV,1,"UTR1",xpos,ypos,zpos,0,"ONLY");
664       // The upper G10 frame, amplification region
665       sprintf(cTagV,"UD%02d",iDet);
666       zpos += fgkCamH/2. + fgkCraH/2. + fgkCdrH/2.;
667       gMC->Gspos(cTagV,1,"UTR1",xpos,ypos,zpos,0,"ONLY");
668       // The upper aluminum frame
669       sprintf(cTagV,"UF%02d",iDet);
670       zpos += fgkCroH/2. + fgkCamH/2.;
671       gMC->Gspos(cTagV,1,"UTR1",xpos,ypos,zpos,0,"ONLY");
672       if (fClengthPH[iplan][icham] > 0.0) {
673         xpos  = 0.;
674         ypos  = - fgkSlenTR2/2.;
675         for (Int_t ic = 0; ic < icham; ic++) {
676           ypos += fClengthPH[iplan][ic];        
677         }
678         ypos += fClengthPH[iplan][icham]/2.;
679         zpos  = fgkCraH/2. + fgkCdrH/2. - fgkSheight/2. + iplan * (fgkCH + fgkVspace);
680         // The lower aluminum frame, radiator + drift region
681         sprintf(cTagV,"UA%02d",iDet+kNdet);
682         gMC->Gspos(cTagV,1,"UTR2",xpos,ypos,zpos,0,"ONLY");
683         // The upper G10 frame, amplification region
684         sprintf(cTagV,"UD%02d",iDet+kNdet);
685         zpos += fgkCamH/2. + fgkCraH/2. + fgkCdrH/2.;
686         gMC->Gspos(cTagV,1,"UTR2",xpos,ypos,zpos,0,"ONLY");
687         // The upper aluminum frame
688         sprintf(cTagV,"UF%02d",iDet+kNdet);
689         zpos += fgkCroH/2. + fgkCamH/2.;
690         gMC->Gspos(cTagV,1,"UTR2",xpos,ypos,zpos,0,"ONLY");
691       }
692       if (fClengthRH[iplan][icham] > 0.0) {
693         xpos  = 0.;
694         ypos  = - fgkSlenTR3/2.;
695         for (Int_t ic = 0; ic < icham; ic++) {
696           ypos += fClengthRH[iplan][ic];        
697         }
698         ypos += fClengthRH[iplan][icham]/2.;
699         zpos  = fgkCraH/2. + fgkCdrH/2. - fgkSheight/2. + iplan * (fgkCH + fgkVspace);
700         // The lower aluminum frame, radiator + drift region
701         sprintf(cTagV,"UA%02d",iDet+2*kNdet);
702         gMC->Gspos(cTagV,1,"UTR3",xpos,ypos,zpos,0,"ONLY");
703         // The upper G10 frame, amplification region
704         sprintf(cTagV,"UD%02d",iDet+2*kNdet);
705         zpos += fgkCamH/2. + fgkCraH/2. + fgkCdrH/2.;
706         gMC->Gspos(cTagV,1,"UTR3",xpos,ypos,zpos,0,"ONLY");
707         // The upper aluminum frame
708         sprintf(cTagV,"UF%02d",iDet+2*kNdet);
709         zpos += fgkCroH/2. + fgkCamH/2.;
710         gMC->Gspos(cTagV,1,"UTR3",xpos,ypos,zpos,0,"ONLY");
711       }
712
713     }
714   }
715
716   xpos = 0.;
717   ypos = 0.;
718   zpos = 0.;
719   gMC->Gspos("UTR1",1,"BTR1",xpos,ypos,zpos,0,"ONLY");
720   gMC->Gspos("UTR2",2,"BTR2",xpos,ypos,zpos,0,"ONLY");
721   gMC->Gspos("UTR3",3,"BTR3",xpos,ypos,zpos,0,"ONLY");
722
723 }