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