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