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