Consistent declarations needed on Alpha
[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.6  2001/02/14 18:22:26  cblume
19 Change in the geometry of the padplane
20
21 Revision 1.5  2000/11/01 14:53:21  cblume
22 Merge with TRD-develop
23
24 Revision 1.1.4.6  2000/10/15 23:40:01  cblume
25 Remove AliTRDconst
26
27 Revision 1.1.4.5  2000/10/06 16:49:46  cblume
28 Made Getters const
29
30 Revision 1.1.4.4  2000/10/04 16:34:58  cblume
31 Replace include files by forward declarations
32
33 Revision 1.1.4.3  2000/09/22 14:43:41  cblume
34 Allow the pad/timebin-dimensions to be changed after initialization
35
36 Revision 1.4  2000/10/02 21:28:19  fca
37 Removal of useless dependecies via forward declarations
38
39 Revision 1.3  2000/06/08 18:32:58  cblume
40 Make code compliant to coding conventions
41
42 Revision 1.2  2000/05/08 16:17:27  cblume
43 Merge TRD-develop
44
45 Revision 1.1.4.2  2000/05/08 14:46:44  cblume
46 Include options SetPHOShole() and SetRICHhole()
47
48 Revision 1.1.4.1  2000/04/27 12:46:04  cblume
49 Corrected bug in full geometry
50
51 Revision 1.1  2000/02/28 19:01:15  cblume
52 Add new TRD classes
53
54 */
55
56 ///////////////////////////////////////////////////////////////////////////////
57 //                                                                           //
58 //  TRD geometry for the spaceframe without holes                            //
59 //                                                                           //
60 ///////////////////////////////////////////////////////////////////////////////
61
62 #include "AliMC.h"
63
64 #include "AliTRDgeometryFull.h"
65
66 ClassImp(AliTRDgeometryFull)
67
68 //_____________________________________________________________________________
69 AliTRDgeometryFull::AliTRDgeometryFull():AliTRDgeometry()
70 {
71   //
72   // AliTRDgeometryFull default constructor
73   //
74
75   Init();
76
77 }
78
79 //_____________________________________________________________________________
80 AliTRDgeometryFull::~AliTRDgeometryFull()
81 {
82   //
83   // AliTRDgeometryFull destructor
84   //
85
86 }
87
88 //_____________________________________________________________________________
89 void AliTRDgeometryFull::Init()
90 {
91   //
92   // Initializes the geometry parameter
93   //
94
95   Int_t iplan;
96
97   fPHOShole = kFALSE;
98   fRICHhole = kFALSE;
99
100   // The length of the inner chambers
101   for (iplan = 0; iplan < fgkNplan; iplan++) 
102     fClengthI[iplan] = 110.0;
103
104   // The length of the middle chambers
105   fClengthM1[0] = 123.5;
106   fClengthM1[1] = 131.0;
107   fClengthM1[2] = 138.5;
108   fClengthM1[3] = 146.0;
109   fClengthM1[4] = 153.0;
110   fClengthM1[5] = 160.5;
111
112   fClengthM2[0] = 123.5 - 7.0;
113   fClengthM2[1] = 131.0 - 7.0;
114   fClengthM2[2] = 138.5 - 7.0;
115   fClengthM2[3] = 146.0 - 7.0;
116   fClengthM2[4] = 153.0 - 7.0;
117   fClengthM2[5] = 160.4 - 7.0;
118
119   // The length of the outer chambers
120   fClengthO1[0] = 123.5;
121   fClengthO1[1] = 131.0;
122   fClengthO1[2] = 134.5;
123   fClengthO1[3] = 142.0;
124   fClengthO1[4] = 142.0;
125   fClengthO1[5] = 134.5;
126
127   fClengthO2[0] = 123.5;
128   fClengthO2[1] = 131.0;
129   fClengthO2[2] = 134.5;
130   fClengthO2[3] = 142.0;
131   fClengthO2[4] = 142.0;
132   fClengthO2[5] = 134.5;
133
134   fClengthO3[0] =  86.5;
135   fClengthO3[1] = 101.5;
136   fClengthO3[2] = 112.5;
137   fClengthO3[3] = 127.5;
138   fClengthO3[4] = 134.5;
139   fClengthO3[5] = 134.5;
140
141   // The maximum number of pads
142   // and the position of pad 0,0,0 
143   // 
144   // chambers seen from the top:
145   //     +----------------------------+
146   //     |                            |
147   //     |                            |     ^
148   //     |                            | rphi|
149   //     |                            |     |
150   //     |0                           |     | 
151   //     +----------------------------+     +------>
152   //                                             z 
153   // chambers seen from the side:           ^
154   //     +----------------------------+ time|
155   //     |                            |     |
156   //     |0                           |     |
157   //     +----------------------------+     +------>
158   //                                             z
159   //                                             
160
161   // The pad row (z-direction)
162   SetNRowPad();
163
164 }
165
166 //_____________________________________________________________________________
167 void AliTRDgeometryFull::SetNRowPad(const Int_t p, const Int_t c, const Int_t npad)
168 {
169   //
170   // Redefines the number of pads in raw direction for
171   // a given plane and chamber number
172   //
173
174   Float_t clengthI = fClengthI[p];
175   Float_t clengthM = fClengthM1[p];
176   Float_t clengthO = fClengthO1[p];
177   
178   for (Int_t iSect = 0; iSect < fgkNsect; iSect++) {
179
180     fRowMax[p][c][iSect] = npad;
181     if (c == 2) {
182       fRowPadSize[p][c][iSect] = (clengthI - 2. * fgkCcthick)
183                                / fRowMax[p][c][iSect];
184     }
185     if ((c == 1) || (c == 3)) {
186       fRowPadSize[p][c][iSect] = (clengthM - 2. * fgkCcthick)
187                                / fRowMax[p][c][iSect];
188     }
189     if ((c == 0) || (c == 4)) {
190       fRowPadSize[p][c][iSect] = (clengthO - 2. * fgkCcthick)
191                                / fRowMax[p][c][iSect];
192     }
193
194   }
195
196 }
197
198 //_____________________________________________________________________________
199 void AliTRDgeometryFull::SetNRowPad()
200 {
201   //
202   // Defines the number of pads in row direction
203   //
204
205   for (Int_t iPlan = 0; iPlan < fgkNplan; iPlan++) {
206
207     Float_t clengthI = fClengthI[iPlan];
208     Float_t clengthM = fClengthM1[iPlan];
209     Float_t clengthO = fClengthO1[iPlan];
210
211     for (Int_t iSect = 0; iSect < fgkNsect; iSect++) {
212
213       fRow0[iPlan][0][iSect]   = -clengthI/2. - clengthM - clengthO + fgkCcthick; 
214       fRow0[iPlan][1][iSect]   = -clengthI/2. - clengthM            + fgkCcthick;
215       fRow0[iPlan][2][iSect]   = -clengthI/2.                       + fgkCcthick;
216       fRow0[iPlan][3][iSect]   =  clengthI/2.                       + fgkCcthick; 
217       fRow0[iPlan][4][iSect]   =  clengthI/2. + clengthM            + fgkCcthick; 
218
219       for (Int_t iCham = 0; iCham < fgkNcham; iCham++) {
220
221         if (iCham == 2) {
222           fRowMax[iPlan][iCham][iSect]     = 18;
223           fRowPadSize[iPlan][iCham][iSect] = (clengthI - 2. * fgkCcthick)
224                                            / fRowMax[iPlan][iCham][iSect];
225         }
226         if ((iCham == 1) || (iCham == 3)) {
227           fRowMax[iPlan][iCham][iSect]     = 24;
228           fRowPadSize[iPlan][iCham][iSect] = (clengthM - 2. * fgkCcthick)
229                                            / fRowMax[iPlan][iCham][iSect];
230         }
231         if ((iCham == 0) || (iCham == 4)) {
232           if (iPlan <  4) {
233             fRowMax[iPlan][iCham][iSect] = 24;
234           }
235           if (iPlan == 4) {
236             fRowMax[iPlan][iCham][iSect] = 22;
237           }
238           if (iPlan == 5) {
239             fRowMax[iPlan][iCham][iSect] = 20;
240           }
241           fRowPadSize[iPlan][iCham][iSect] = (clengthO - 2. * fgkCcthick)
242                                            / fRowMax[iPlan][iCham][iSect];
243         }
244
245       }
246     }
247   }
248
249 }
250
251 //_____________________________________________________________________________
252 void AliTRDgeometryFull::CreateGeometry(Int_t *idtmed)
253 {
254   //
255   // Create the TRD geometry without hole
256   //
257
258   Int_t iplan;
259
260   const Int_t kNparTrd = 4;
261   const Int_t kNparCha = 3;
262   const Int_t kNplan   = fgkNplan;
263
264   Float_t parTrd[kNparTrd];
265   Float_t parCha[kNparCha];
266
267   Float_t xpos, ypos, zpos;
268
269   AliTRDgeometry::CreateGeometry(idtmed);
270
271   // The TRD mother volume for one sector (Air), full length in z-direction
272   parTrd[0] = fgkSwidth1/2.;
273   parTrd[1] = fgkSwidth2/2.;
274   parTrd[2] = fgkSlenTR1/2.;
275   parTrd[3] = fgkSheight/2.;
276   gMC->Gsvolu("TRD1","TRD1",idtmed[1302-1],parTrd,kNparTrd);
277
278   // The TRD mother volume for one sector (Air), leaving hole for PHOS
279   if (fPHOShole) {
280     gMC->Gsvolu("TRD2","TRD1",idtmed[1302-1],parTrd,kNparTrd);
281   }
282
283   // The TRD mother volume for one sector (Air), leaving hole for RICH
284   if (fRICHhole) {
285     gMC->Gsvolu("TRD3","TRD1",idtmed[1302-1],parTrd,kNparTrd);
286   }  
287
288   // Position the chambers in the TRD mother volume
289   for (iplan = 1; iplan <= kNplan; iplan++) {
290
291     Float_t y1 = fClengthM1[iplan-1] - fClengthM2[iplan-1];
292     Float_t y2 = fClengthO1[iplan-1] - fClengthO3[iplan-1];
293
294     // The inner chambers ---------------------------------------------------------------
295
296     // the aluminum frame
297     parCha[0] = fCwidth[iplan-1]/2.;
298     parCha[1] = fClengthI[iplan-1]/2.;
299     parCha[2] = fgkCaframe/2.;
300     xpos       = 0.;
301     ypos       = 0.;
302     zpos       = fgkCheight - fgkCaframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace);
303     gMC->Gsposp("UAFI",iplan       ,"TRD1",xpos,ypos,zpos,0,"MANY",parCha,kNparCha);
304
305     // the inner part of the aluminum frame
306     parCha[0] = fCwidth[iplan-1]/2.   - fgkCathick;
307     parCha[1] = fClengthI[iplan-1]/2. - fgkCathick;
308     parCha[2] = fgkCaframe/2.;
309     xpos       = 0.;
310     ypos       = 0.;
311     zpos       = fgkCheight - fgkCaframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace);
312     gMC->Gsposp("UAII",iplan       ,"TRD1",xpos,ypos,zpos,0,"ONLY",parCha,kNparCha);
313
314     // the carbon frame
315     parCha[0] = fCwidth[iplan-1]/2.;
316     parCha[1] = fClengthI[iplan-1]/2.;
317     parCha[2] = fgkCcframe/2.;
318     xpos       = 0.;
319     ypos       = 0.;
320     zpos       = fgkCcframe/2.              - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace);
321     gMC->Gsposp("UCFI",iplan       ,"TRD1",xpos,ypos,zpos,0,"MANY",parCha,kNparCha);
322
323     // the inner part of the carbon frame
324     parCha[0] = fCwidth[iplan-1]/2.   - fgkCcthick;
325     parCha[1] = fClengthI[iplan-1]/2. - fgkCcthick;
326     parCha[2] = fgkCcframe/2.;
327     xpos       = 0.;
328     ypos       = 0.;
329     zpos       = fgkCcframe/2.              - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace);
330     gMC->Gsposp("UCII",iplan       ,"TRD1",xpos,ypos,zpos,0,"ONLY",parCha,kNparCha);
331
332     // The middle chambers --------------------------------------------------------------
333
334     // the aluminum frame
335     parCha[0] = fCwidth[iplan-1]/2.;
336     parCha[1] = fClengthM1[iplan-1]/2.;
337     parCha[2] = fgkCaframe/2.;
338     xpos       = 0.;
339     ypos       = fClengthI[iplan-1]/2. + fClengthM1[iplan-1]/2.;
340     zpos       = fgkCheight - fgkCaframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace);
341     gMC->Gsposp("UAFM",iplan         ,"TRD1",xpos, ypos,zpos,0,"MANY",parCha,kNparCha);
342     gMC->Gsposp("UAFM",iplan+  fgkNplan,"TRD1",xpos,-ypos,zpos,0,"MANY",parCha,kNparCha);
343     if (fPHOShole) {
344       parCha[0] = fCwidth[iplan-1]/2.;
345       parCha[1] = fClengthM2[iplan-1]/2.;
346       parCha[2] = fgkCaframe/2.;
347       xpos       = 0.;
348       ypos       = fClengthI[iplan-1]/2. + fClengthM2[iplan-1]/2. + y1;
349       zpos       = fgkCheight - fgkCaframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace);
350       gMC->Gsposp("UAFM",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"MANY",parCha,kNparCha);
351       gMC->Gsposp("UAFM",iplan+3*kNplan,"TRD2",xpos,-ypos,zpos,0,"MANY",parCha,kNparCha);
352     }
353
354     // the inner part of the aluminum frame
355     parCha[0] = fCwidth[iplan-1]/2.      - fgkCathick;
356     parCha[1] = fClengthM1[iplan-1]/2.   - fgkCathick;
357     parCha[2] = fgkCaframe/2.;
358     xpos       = 0.;
359     ypos       = fClengthI[iplan-1]/2. + fClengthM1[iplan-1]/2.;
360     zpos       = fgkCheight - fgkCaframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace);
361     gMC->Gsposp("UAIM",iplan         ,"TRD1",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha);
362     gMC->Gsposp("UAIM",iplan+  fgkNplan,"TRD1",xpos,-ypos,zpos,0,"ONLY",parCha,kNparCha);
363     if (fPHOShole) {
364       parCha[0] = fCwidth[iplan-1]/2.    - fgkCathick;
365       parCha[1] = fClengthM2[iplan-1]/2. - fgkCathick;
366       parCha[2] = fgkCaframe/2.;
367       xpos       = 0.;
368       ypos       = fClengthI[iplan-1]/2. + fClengthM2[iplan-1]/2. + y1;
369       zpos       = fgkCheight - fgkCaframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace);
370       gMC->Gsposp("UAIM",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha);
371       gMC->Gsposp("UAIM",iplan+3*kNplan,"TRD2",xpos,-ypos,zpos,0,"ONLY",parCha,kNparCha);
372     }
373
374     // the carbon frame
375     parCha[0] = fCwidth[iplan-1]/2.;
376     parCha[1] = fClengthM1[iplan-1]/2.;
377     parCha[2] = fgkCcframe/2.;
378     xpos       = 0.;
379     ypos       = fClengthI[iplan-1]/2. + fClengthM1[iplan-1]/2.;
380     zpos       = fgkCcframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace);
381     gMC->Gsposp("UCFM",iplan         ,"TRD1",xpos, ypos,zpos,0,"MANY",parCha,kNparCha);
382     gMC->Gsposp("UCFM",iplan+  kNplan,"TRD1",xpos,-ypos,zpos,0,"MANY",parCha,kNparCha);
383     if (fPHOShole) {
384       parCha[0] = fCwidth[iplan-1]/2.;
385       parCha[1] = fClengthM2[iplan-1]/2.;
386       parCha[2] = fgkCcframe/2.;
387       xpos       = 0.;
388       ypos       = fClengthI[iplan-1]/2. + fClengthM2[iplan-1]/2. + y1;
389       zpos       = fgkCcframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace);
390       gMC->Gsposp("UCFM",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"MANY",parCha,kNparCha);
391       gMC->Gsposp("UCFM",iplan+3*kNplan,"TRD2",xpos,-ypos,zpos,0,"MANY",parCha,kNparCha);
392     }
393
394     // the inner part of the carbon frame
395     parCha[0] = fCwidth[iplan-1]/2.      - fgkCcthick;
396     parCha[1] = fClengthM1[iplan-1]/2.   - fgkCcthick;
397     parCha[2] = fgkCcframe/2.;
398     xpos       = 0.;
399     ypos       = fClengthI[iplan-1]/2. + fClengthM1[iplan-1]/2.;
400     zpos       = fgkCcframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace);
401     gMC->Gsposp("UCIM",iplan         ,"TRD1",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha);
402     gMC->Gsposp("UCIM",iplan+  kNplan,"TRD1",xpos,-ypos,zpos,0,"ONLY",parCha,kNparCha);
403     if (fPHOShole) {
404       parCha[0] = fCwidth[iplan-1]/2.    - fgkCcthick;
405       parCha[1] = fClengthM2[iplan-1]/2. - fgkCcthick;
406       parCha[2] = fgkCcframe/2.;
407       xpos       = 0.;
408       ypos       = fClengthI[iplan-1]/2. + fClengthM2[iplan-1]/2. + y1;
409       zpos       = fgkCcframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace);
410       gMC->Gsposp("UCIM",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha);
411       gMC->Gsposp("UCIM",iplan+3*kNplan,"TRD2",xpos,-ypos,zpos,0,"ONLY",parCha,kNparCha);
412     }
413
414     // The outer chambers ---------------------------------------------------------------
415
416     // the aluminum frame
417     parCha[0] = fCwidth[iplan-1]/2.;
418     parCha[1] = fClengthO1[iplan-1]/2.;
419     parCha[2] = fgkCaframe/2.;
420     xpos       = 0.;
421     ypos       = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO1[iplan-1]/2.;
422     zpos       = fgkCheight - fgkCaframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace);
423     gMC->Gsposp("UAFO",iplan         ,"TRD1",xpos, ypos,zpos,0,"MANY",parCha,kNparCha);
424     gMC->Gsposp("UAFO",iplan+  kNplan,"TRD1",xpos,-ypos,zpos,0,"MANY",parCha,kNparCha);
425     if (fPHOShole) {
426       parCha[0] = fCwidth[iplan-1]/2.;
427       parCha[1] = fClengthO2[iplan-1]/2.;
428       parCha[2] = fgkCaframe/2.;
429       xpos       = 0.;
430       ypos       = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO2[iplan-1]/2.;
431       zpos       = fgkCheight - fgkCaframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace);
432       gMC->Gsposp("UAFO",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"MANY",parCha,kNparCha);
433       gMC->Gsposp("UAFO",iplan+3*kNplan,"TRD2",xpos,-ypos,zpos,0,"MANY",parCha,kNparCha);
434     }
435     if (fRICHhole) {
436       parCha[0] = fCwidth[iplan-1]/2.;
437       parCha[1] = fClengthO3[iplan-1]/2.;
438       parCha[2] = fgkCaframe/2.;
439       xpos       = 0.;
440       ypos       = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO3[iplan-1]/2. + y2;
441       zpos       = fgkCheight - fgkCaframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace);
442       gMC->Gsposp("UAFO",iplan+4*kNplan,"TRD3",xpos, ypos,zpos,0,"MANY",parCha,kNparCha);
443       gMC->Gsposp("UAFO",iplan+5*kNplan,"TRD3",xpos,-ypos,zpos,0,"MANY",parCha,kNparCha);
444     }
445
446     // the inner part of the aluminum frame
447     parCha[0] = fCwidth[iplan-1]/2.      - fgkCathick;
448     parCha[1] = fClengthO1[iplan-1]/2.   - fgkCathick;
449     parCha[2] = fgkCaframe/2.;
450     xpos       = 0.;
451     ypos       = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO1[iplan-1]/2.;
452     zpos       = fgkCheight - fgkCaframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace);
453     gMC->Gsposp("UAIO",iplan         ,"TRD1",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha);
454     gMC->Gsposp("UAIO",iplan+  kNplan,"TRD1",xpos,-ypos,zpos,0,"ONLY",parCha,kNparCha);
455     if (fPHOShole) {
456       parCha[0] = fCwidth[iplan-1]/2.    - fgkCathick;
457       parCha[1] = fClengthO2[iplan-1]/2. - fgkCathick;
458       parCha[2] = fgkCaframe/2.;
459       xpos       = 0.;
460       ypos       = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO2[iplan-1]/2.;
461       zpos       = fgkCheight - fgkCaframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace);
462       gMC->Gsposp("UAIO",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha);
463       gMC->Gsposp("UAIO",iplan+3*kNplan,"TRD2",xpos,-ypos,zpos,0,"ONLY",parCha,kNparCha);
464     }
465     if (fRICHhole) {
466       parCha[0] = fCwidth[iplan-1]/2.    - fgkCathick;
467       parCha[1] = fClengthO3[iplan-1]/2. - fgkCathick;
468       parCha[2] = fgkCaframe/2.;
469       xpos       = 0.;
470       ypos       = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO3[iplan-1]/2. + y2;
471       zpos       = fgkCheight - fgkCaframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace);
472       gMC->Gsposp("UAIO",iplan+4*kNplan,"TRD3",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha);
473       gMC->Gsposp("UAIO",iplan+5*kNplan,"TRD3",xpos,-ypos,zpos,0,"ONLY",parCha,kNparCha);
474     }
475
476     // the carbon frame
477     parCha[0] = fCwidth[iplan-1]/2.;
478     parCha[1] = fClengthO1[iplan-1]/2.;
479     parCha[2] = fgkCcframe/2.;
480     xpos       = 0.;
481     ypos       = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO1[iplan-1]/2.;
482     zpos       = fgkCcframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace);
483     gMC->Gsposp("UCFO",iplan,         "TRD1",xpos, ypos,zpos,0,"MANY",parCha,kNparCha);
484     gMC->Gsposp("UCFO",iplan+  kNplan,"TRD1",xpos,-ypos,zpos,0,"MANY",parCha,kNparCha);
485     if (fPHOShole) {
486       parCha[0] = fCwidth[iplan-1]/2.;
487       parCha[1] = fClengthO2[iplan-1]/2.;
488       parCha[2] = fgkCcframe/2.;
489       xpos       = 0.;
490       ypos       = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO2[iplan-1]/2.;
491       zpos       = fgkCcframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace);
492       gMC->Gsposp("UCFO",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"MANY",parCha,kNparCha);
493       gMC->Gsposp("UCFO",iplan+3*kNplan,"TRD2",xpos,-ypos,zpos,0,"MANY",parCha,kNparCha);
494     }
495     if (fRICHhole) {
496       parCha[0] = fCwidth[iplan-1]/2.;
497       parCha[1] = fClengthO3[iplan-1]/2.;
498       parCha[2] = fgkCcframe/2.;
499       xpos       = 0.;
500       ypos       = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO3[iplan-1]/2. + y2;
501       zpos       = fgkCcframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace);
502       gMC->Gsposp("UCFO",iplan+4*kNplan,"TRD3",xpos, ypos,zpos,0,"MANY",parCha,kNparCha);
503       gMC->Gsposp("UCFO",iplan+5*kNplan,"TRD3",xpos,-ypos,zpos,0,"MANY",parCha,kNparCha);
504     }
505
506     // the inner part of the carbon frame
507     parCha[0] = fCwidth[iplan-1]/2.      - fgkCcthick;
508     parCha[1] = fClengthO1[iplan-1]/2.   - fgkCcthick;
509     parCha[2] = fgkCcframe/2.;
510     xpos       = 0.;
511     ypos       = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO1[iplan-1]/2.;
512     zpos       = fgkCcframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace);
513     gMC->Gsposp("UCIO",iplan         ,"TRD1",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha);
514     gMC->Gsposp("UCIO",iplan+  kNplan,"TRD1",xpos,-ypos,zpos,0,"ONLY",parCha,kNparCha);
515     if (fPHOShole) {
516       parCha[0] = fCwidth[iplan-1]/2.    - fgkCcthick;
517       parCha[1] = fClengthO2[iplan-1]/2. - fgkCcthick;
518       parCha[2] = fgkCcframe/2.;
519       xpos       = 0.;
520       ypos       = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO2[iplan-1]/2.;
521       zpos       = fgkCcframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace);
522       gMC->Gsposp("UCIO",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha);
523       gMC->Gsposp("UCIO",iplan+3*kNplan,"TRD2",xpos,-ypos,zpos,0,"ONLY",parCha,kNparCha);
524     }
525     if (fRICHhole) {
526       parCha[0] = fCwidth[iplan-1]/2.    - fgkCcthick;
527       parCha[1] = fClengthO3[iplan-1]/2. - fgkCcthick;
528       parCha[2] = fgkCcframe/2.;
529       xpos       = 0.;
530       ypos       = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO3[iplan-1]/2. + y2;
531       zpos       = fgkCcframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace);
532       gMC->Gsposp("UCIO",iplan+4*kNplan,"TRD3",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha);
533       gMC->Gsposp("UCIO",iplan+5*kNplan,"TRD3",xpos,-ypos,zpos,0,"ONLY",parCha,kNparCha);
534     }
535
536   }
537
538   xpos = 0.;
539   ypos = 0.;
540   zpos = 0.;
541   gMC->Gspos("TRD1",1,"BTR1",xpos,ypos,zpos,0,"ONLY");
542   if (fPHOShole) 
543     gMC->Gspos("TRD2",2,"BTR2",xpos,ypos,zpos,0,"ONLY");
544   else
545     gMC->Gspos("TRD1",2,"BTR2",xpos,ypos,zpos,0,"ONLY");
546   if (fRICHhole)
547     gMC->Gspos("TRD3",3,"BTR3",xpos,ypos,zpos,0,"ONLY");
548   else
549     gMC->Gspos("TRD1",3,"BTR3",xpos,ypos,zpos,0,"ONLY");
550
551 }