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