Removal of useless dependecies via forward declarations
[u/mrichter/AliRoot.git] / TRD / AliTRDgeometryHole.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /*
17 $Log$
18 Revision 1.2  2000/06/08 18:32:58  cblume
19 Make code compliant to coding conventions
20
21 Revision 1.1  2000/02/28 19:01:42  cblume
22 Add new TRD classes
23
24 */
25
26 ///////////////////////////////////////////////////////////////////////////////
27 //                                                                           //
28 //  TRD geometry with holes                                                  //
29 //                                                                           //
30 ///////////////////////////////////////////////////////////////////////////////
31
32 #include "AliTRDgeometryHole.h"
33 #include "AliMC.h"
34
35 ClassImp(AliTRDgeometryHole)
36
37 //_____________________________________________________________________________
38 AliTRDgeometryHole::AliTRDgeometryHole():AliTRDgeometry()
39 {
40   //
41   // AliTRDgeometryHole default constructor
42   //
43
44   Init();
45
46 }
47
48 //_____________________________________________________________________________
49 AliTRDgeometryHole::~AliTRDgeometryHole()
50 {
51   //
52   // AliTRDgeometryHole destructor
53   //
54
55 }
56
57 //_____________________________________________________________________________
58 void AliTRDgeometryHole::Init()
59 {
60   //
61   // Initializes the geometry parameter
62   //
63
64   Int_t iplan;
65
66   // The length of the inner chambers
67   for (iplan = 0; iplan < kNplan; iplan++) 
68     fClengthI[iplan] = 110.0;
69
70   // The length of the middle chambers
71   fClengthM1[0] = 123.5;
72   fClengthM1[1] = 131.0;
73   fClengthM1[2] = 138.5;
74   fClengthM1[3] = 146.0;
75   fClengthM1[4] = 153.0;
76   fClengthM1[5] = 160.5;
77
78   fClengthM2[0] = 123.5 - 7.0;
79   fClengthM2[1] = 131.0 - 7.0;
80   fClengthM2[2] = 138.5 - 7.0;
81   fClengthM2[3] = 146.0 - 7.0;
82   fClengthM2[4] = 153.0 - 7.0;
83   fClengthM2[5] = 160.4 - 7.0;
84
85   // The length of the outer chambers
86   fClengthO1[0] = 123.5;
87   fClengthO1[1] = 131.0;
88   fClengthO1[2] = 134.5;
89   fClengthO1[3] = 142.0;
90   fClengthO1[4] = 142.0;
91   fClengthO1[5] = 134.5;
92
93   fClengthO2[0] = 123.5;
94   fClengthO2[1] = 131.0;
95   fClengthO2[2] = 134.5;
96   fClengthO2[3] = 142.0;
97   fClengthO2[4] = 142.0;
98   fClengthO2[5] = 134.5;
99
100   fClengthO3[0] =  86.5;
101   fClengthO3[1] = 101.5;
102   fClengthO3[2] = 112.5;
103   fClengthO3[3] = 127.5;
104   fClengthO3[4] = 134.5;
105   fClengthO3[5] = 134.5;
106
107   // The maximum number of pads
108   // and the position of pad 0,0,0 
109   // 
110   // chambers seen from the top:
111   //     +----------------------------+
112   //     |                            |
113   //     |                            |     ^
114   //     |                            | rphi|
115   //     |                            |     |
116   //     |0                           |     | 
117   //     +----------------------------+     +------>
118   //                                             z 
119   // chambers seen from the side:           ^
120   //     +----------------------------+ time|
121   //     |                            |     |
122   //     |0                           |     |
123   //     +----------------------------+     +------>
124   //                                             z
125   //                                             
126
127   // The pad row (z-direction)
128   for (iplan = 0; iplan < kNplan; iplan++) {
129
130     for (Int_t isect = 0; isect < kNsect; isect++) {
131       Float_t clengthI = fClengthI[iplan];
132       Float_t clengthM = fClengthM1[iplan];
133       Float_t clengthO = fClengthO1[iplan];
134       switch (isect) {
135       case 12:
136       case 13:
137       case 14:
138       case 15:
139       case 16:
140         clengthM = fClengthM2[iplan];
141         clengthO = fClengthO2[iplan];
142         break;
143       case 4:
144       case 5:
145       case 6:
146         clengthO = fClengthO3[iplan];
147         break;
148       };
149       fRowMax[iplan][0][isect] = 1 + TMath::Nint((clengthO - 2. * kCcthick) 
150                                                            / fRowPadSize - 0.5);
151       fRowMax[iplan][1][isect] = 1 + TMath::Nint((clengthM - 2. * kCcthick) 
152                                                            / fRowPadSize - 0.5);
153       fRowMax[iplan][2][isect] = 1 + TMath::Nint((clengthI - 2. * kCcthick) 
154                                                            / fRowPadSize - 0.5);
155       fRowMax[iplan][3][isect] = 1 + TMath::Nint((clengthM - 2. * kCcthick) 
156                                                            / fRowPadSize - 0.5);
157       fRowMax[iplan][4][isect] = 1 + TMath::Nint((clengthO - 2. * kCcthick) 
158                                                            / fRowPadSize - 0.5);
159       fRow0[iplan][0][isect]   = -clengthI/2. - clengthM - clengthO + kCcthick; 
160       fRow0[iplan][1][isect]   = -clengthI/2. - clengthM            + kCcthick;
161       fRow0[iplan][2][isect]   = -clengthI/2.                       + kCcthick;
162       fRow0[iplan][3][isect]   =  clengthI/2.                       + kCcthick; 
163       fRow0[iplan][4][isect]   =  clengthI/2. + clengthM            + kCcthick; 
164     }
165
166   }
167
168 }
169
170 //_____________________________________________________________________________
171 void AliTRDgeometryHole::CreateGeometry(Int_t *idtmed)
172 {
173   //
174   // Create the TRD geometry with hole
175   //
176
177   Int_t iplan;
178
179   const Int_t kNparTrd = 4;
180   const Int_t kNparCha = 3;
181
182   Float_t parTrd[kNparTrd];
183   Float_t parCha[kNparCha];
184
185   Float_t xpos, ypos, zpos;
186
187   AliTRDgeometry::CreateGeometry(idtmed);
188
189   // The TRD mother volume for one sector (Air) (dimensions identical to BTR1)
190   parTrd[0] = kSwidth1/2.;
191   parTrd[1] = kSwidth2/2.;
192   parTrd[2] = kSlenTR1/2.;
193   parTrd[3] = kSheight/2.;
194   gMC->Gsvolu("TRD1","TRD1",idtmed[1302-1],parTrd,kNparTrd);
195   
196   // The TRD mother volume for one sector (Air) (dimensions identical to BTR2)
197   parTrd[0] = kSwidth1/2.;
198   parTrd[1] = kSwidth2/2.;
199   parTrd[2] = kSlenTR2/2.;
200   parTrd[3] = kSheight/2.;
201   gMC->Gsvolu("TRD2","TRD1",idtmed[1302-1],parTrd,kNparTrd);
202
203   // The TRD mother volume for one sector (Air) (dimensions identical to BTR3)
204   parTrd[0] = kSwidth1/2.;
205   parTrd[1] = kSwidth2/2.;
206   parTrd[2] = kSlenTR3/2.;
207   parTrd[3] = kSheight/2.;
208   gMC->Gsvolu("TRD3","TRD1",idtmed[1302-1],parTrd,kNparTrd);
209
210   // Position the chambers in the TRD mother volume
211   for (iplan = 1; iplan <= kNplan; iplan++) {
212
213     // The inner chambers ---------------------------------------------------------------
214
215     // the aluminum frame
216     parCha[0] = fCwidth[iplan-1]/2.;
217     parCha[1] = fClengthI[iplan-1]/2.;
218     parCha[2] = kCaframe/2.;
219     xpos       = 0.;
220     ypos       = 0.;
221     zpos       = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
222     gMC->Gsposp("UAFI",iplan       ,"TRD1",xpos,ypos,zpos,0,"MANY",parCha,kNparCha);
223
224     // the inner part of the aluminum frame
225     parCha[0] = fCwidth[iplan-1]/2.   - kCathick;
226     parCha[1] = fClengthI[iplan-1]/2. - kCathick;
227     parCha[2] = kCaframe/2.;
228     xpos       = 0.;
229     ypos       = 0.;
230     zpos       = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
231     gMC->Gsposp("UAII",iplan       ,"TRD1",xpos,ypos,zpos,0,"ONLY",parCha,kNparCha);
232
233     // the carbon frame
234     parCha[0] = fCwidth[iplan-1]/2.;
235     parCha[1] = fClengthI[iplan-1]/2.;
236     parCha[2] = kCcframe/2.;
237     xpos       = 0.;
238     ypos       = 0.;
239     zpos       = kCcframe/2.            - kSheight/2. + (iplan-1) * (kCheight + kCspace);
240     gMC->Gsposp("UCFI",iplan       ,"TRD1",xpos,ypos,zpos,0,"MANY",parCha,kNparCha);
241
242     // the inner part of the carbon frame
243     parCha[0] = fCwidth[iplan-1]/2.   - kCcthick;
244     parCha[1] = fClengthI[iplan-1]/2. - kCcthick;
245     parCha[2] = kCcframe/2.;
246     xpos       = 0.;
247     ypos       = 0.;
248     zpos       = kCcframe/2.            - kSheight/2. + (iplan-1) * (kCheight + kCspace);
249     gMC->Gsposp("UCII",iplan       ,"TRD1",xpos,ypos,zpos,0,"ONLY",parCha,kNparCha);
250
251     // The middle chambers --------------------------------------------------------------
252
253     // the aluminum frame
254     parCha[0] = fCwidth[iplan-1]/2.;
255     parCha[1] = fClengthM1[iplan-1]/2.;
256     parCha[2] = kCaframe/2.;
257     xpos       = 0.;
258     ypos       = fClengthI[iplan-1]/2.  + fClengthM1[iplan-1]/2.;
259     zpos       = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
260     gMC->Gsposp("UAFM",iplan         ,"TRD1",xpos, ypos,zpos,0,"MANY",parCha,kNparCha);
261     gMC->Gsposp("UAFM",iplan+  kNplan,"TRD1",xpos,-ypos,zpos,0,"MANY",parCha,kNparCha);
262     parCha[0] = fCwidth[iplan-1]/2.;
263     parCha[1] = fClengthM2[iplan-1]/2.;
264     parCha[2] = kCaframe/2.;
265     xpos       = 0.;
266     ypos       = fClengthM2[iplan-1]/2. - kSlenTR2/2.;
267     zpos       = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
268     gMC->Gsposp("UAFM",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"MANY",parCha,kNparCha);
269
270     // the inner part of the aluminum frame
271     parCha[0] = fCwidth[iplan-1]/2.    - kCathick;
272     parCha[1] = fClengthM1[iplan-1]/2. - kCathick;
273     parCha[2] = kCaframe/2.;
274     xpos       = 0.;
275     ypos       = fClengthI[iplan-1]/2.  + fClengthM1[iplan-1]/2.;
276     zpos       = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
277     gMC->Gsposp("UAIM",iplan         ,"TRD1",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha);
278     gMC->Gsposp("UAIM",iplan+  kNplan,"TRD1",xpos,-ypos,zpos,0,"ONLY",parCha,kNparCha);
279     parCha[0] = fCwidth[iplan-1]/2.    - kCathick;
280     parCha[1] = fClengthM2[iplan-1]/2. - kCathick;
281     parCha[2] = kCaframe/2.;
282     xpos       = 0.;
283     ypos       = fClengthM2[iplan-1]/2. - kSlenTR2/2.;
284     zpos       = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
285     gMC->Gsposp("UAIM",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha);
286
287     // the carbon frame
288     parCha[0] = fCwidth[iplan-1]/2.;
289     parCha[1] = fClengthM1[iplan-1]/2.;
290     parCha[2] = kCcframe/2.;
291     xpos       = 0.;
292     ypos       = fClengthI[iplan-1]/2. + fClengthM1[iplan-1]/2.;
293     zpos       = kCcframe/2.           - kSheight/2. + (iplan-1) * (kCheight + kCspace);
294     gMC->Gsposp("UCFM",iplan         ,"TRD1",xpos, ypos,zpos,0,"MANY",parCha,kNparCha);
295     gMC->Gsposp("UCFM",iplan+  kNplan,"TRD1",xpos,-ypos,zpos,0,"MANY",parCha,kNparCha);
296     parCha[0] = fCwidth[iplan-1]/2.;
297     parCha[1] = fClengthM2[iplan-1]/2.;
298     parCha[2] = kCcframe/2.;
299     xpos       = 0.;
300     ypos       = fClengthM2[iplan-1]/2. - kSlenTR2/2.;
301     zpos       = kCcframe/2.            - kSheight/2. + (iplan-1) * (kCheight + kCspace);
302     gMC->Gsposp("UCFM",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"MANY",parCha,kNparCha);
303
304     // the inner part of the carbon frame
305     parCha[0] = fCwidth[iplan-1]/2.    - kCcthick;
306     parCha[1] = fClengthM1[iplan-1]/2. - kCcthick;
307     parCha[2] = kCcframe/2.;
308     xpos       = 0.;
309     ypos       = fClengthI[iplan-1]/2. + fClengthM1[iplan-1]/2.;
310     zpos       = kCcframe/2.           - kSheight/2. + (iplan-1) * (kCheight + kCspace);
311     gMC->Gsposp("UCIM",iplan         ,"TRD1",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha);
312     gMC->Gsposp("UCIM",iplan+  kNplan,"TRD1",xpos,-ypos,zpos,0,"ONLY",parCha,kNparCha);
313     parCha[0] = fCwidth[iplan-1]/2.    - kCcthick;
314     parCha[1] = fClengthM2[iplan-1]/2. - kCcthick;
315     parCha[2] = kCcframe/2.;
316     xpos       = 0.;
317     ypos       = fClengthM2[iplan-1]/2. - kSlenTR2/2.;
318     zpos       = kCcframe/2.            - kSheight/2. + (iplan-1) * (kCheight + kCspace);
319     gMC->Gsposp("UCIM",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha);
320
321     // The outer chambers ---------------------------------------------------------------
322
323     // the aluminum frame
324     parCha[0] = fCwidth[iplan-1]/2.;
325     parCha[1] = fClengthO1[iplan-1]/2.;
326     parCha[2] = kCaframe/2.;
327     xpos       = 0.;
328     ypos       = fClengthI[iplan-1]/2. + fClengthM1[iplan-1]    + fClengthO1[iplan-1]/2.;
329     zpos       = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
330     gMC->Gsposp("UAFO",iplan         ,"TRD1",xpos, ypos,zpos,0,"MANY",parCha,kNparCha);
331     gMC->Gsposp("UAFO",iplan+  kNplan,"TRD1",xpos,-ypos,zpos,0,"MANY",parCha,kNparCha);
332     parCha[0] = fCwidth[iplan-1]/2.;
333     parCha[1] = fClengthO2[iplan-1]/2.;
334     parCha[2] = kCaframe/2.;
335     xpos       = 0.;
336     ypos       = fClengthM2[iplan-1]    + fClengthO2[iplan-1]/2. - kSlenTR2/2.;
337     zpos       = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
338     gMC->Gsposp("UAFO",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"MANY",parCha,kNparCha);
339     parCha[0] = fCwidth[iplan-1]/2.;
340     parCha[1] = fClengthO3[iplan-1]/2.;
341     parCha[2] = kCaframe/2.;
342     xpos       = 0.;
343     ypos       = fClengthO3[iplan-1]/2. - kSlenTR3/2.;
344     zpos       = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
345     gMC->Gsposp("UAFO",iplan+4*kNplan,"TRD3",xpos, ypos,zpos,0,"MANY",parCha,kNparCha);
346
347     // the inner part of the aluminum frame
348     parCha[0] = fCwidth[iplan-1]/2.    - kCathick;
349     parCha[1] = fClengthO1[iplan-1]/2. - kCathick;
350     parCha[2] = kCaframe/2.;
351     xpos       = 0.;
352     ypos       = fClengthI[iplan-1]/2. + fClengthM1[iplan-1]    + fClengthO1[iplan-1]/2.;
353     zpos       = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
354     gMC->Gsposp("UAIO",iplan         ,"TRD1",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha);
355     gMC->Gsposp("UAIO",iplan+  kNplan,"TRD1",xpos,-ypos,zpos,0,"ONLY",parCha,kNparCha);
356     parCha[0] = fCwidth[iplan-1]/2.    - kCathick;
357     parCha[1] = fClengthO2[iplan-1]/2. - kCathick;
358     parCha[2] = kCaframe/2.;
359     xpos       = 0.;
360     ypos       = fClengthM2[iplan-1]    + fClengthO2[iplan-1]/2. - kSlenTR2/2.;
361     zpos       = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
362     gMC->Gsposp("UAIO",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha);
363     parCha[0] = fCwidth[iplan-1]/2.    - kCathick;
364     parCha[1] = fClengthO3[iplan-1]/2. - kCathick;
365     parCha[2] = kCaframe/2.;
366     xpos       = 0.;
367     ypos       = fClengthO3[iplan-1]/2. - kSlenTR3/2.;
368     zpos       = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
369     gMC->Gsposp("UAIO",iplan+4*kNplan,"TRD3",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha);
370
371     // the carbon frame
372     parCha[0] = fCwidth[iplan-1]/2.;
373     parCha[1] = fClengthO1[iplan-1]/2.;
374     parCha[2] = kCcframe/2.;
375     xpos       = 0.;
376     ypos       = fClengthI[iplan-1]/2. + fClengthM1[iplan-1]    + fClengthO1[iplan-1]/2.;
377     zpos       = kCcframe/2.           - kSheight/2. + (iplan-1) * (kCheight + kCspace);
378     gMC->Gsposp("UCFO",iplan,         "TRD1",xpos, ypos,zpos,0,"MANY",parCha,kNparCha);
379     gMC->Gsposp("UCFO",iplan+  kNplan,"TRD1",xpos,-ypos,zpos,0,"MANY",parCha,kNparCha);
380     parCha[0] = fCwidth[iplan-1]/2.;
381     parCha[1] = fClengthO2[iplan-1]/2.;
382     parCha[2] = kCcframe/2.;
383     xpos       = 0.;
384     ypos       = fClengthM2[iplan-1]    + fClengthO2[iplan-1]/2. - kSlenTR2/2.;
385     zpos       = kCcframe/2.            - kSheight/2. + (iplan-1) * (kCheight + kCspace);
386     gMC->Gsposp("UCFO",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"MANY",parCha,kNparCha);
387     parCha[0] = fCwidth[iplan-1]/2.;
388     parCha[1] = fClengthO3[iplan-1]/2.;
389     parCha[2] = kCcframe/2.;
390     xpos       = 0.;
391     ypos       = fClengthO3[iplan-1]/2. - kSlenTR3/2.;
392     zpos       = kCcframe/2.            - kSheight/2. + (iplan-1) * (kCheight + kCspace);
393     gMC->Gsposp("UCFO",iplan+4*kNplan,"TRD3",xpos, ypos,zpos,0,"MANY",parCha,kNparCha);
394
395     // the inner part of the carbon frame
396     parCha[0] = fCwidth[iplan-1]/2.    - kCcthick;
397     parCha[1] = fClengthO1[iplan-1]/2. - kCcthick;
398     parCha[2] = kCcframe/2.;
399     xpos       = 0.;
400     ypos       = fClengthI[iplan-1]/2. + fClengthM1[iplan-1]    + fClengthO1[iplan-1]/2.;
401     zpos       = kCcframe/2.           - kSheight/2. + (iplan-1) * (kCheight + kCspace);
402     gMC->Gsposp("UCIO",iplan         ,"TRD1",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha);
403     gMC->Gsposp("UCIO",iplan+  kNplan,"TRD1",xpos,-ypos,zpos,0,"ONLY",parCha,kNparCha);
404     parCha[0] = fCwidth[iplan-1]/2.    - kCcthick;
405     parCha[1] = fClengthO2[iplan-1]/2. - kCcthick;
406     parCha[2] = kCcframe/2.;
407     xpos       = 0.;
408     ypos       = fClengthM2[iplan-1]    + fClengthO2[iplan-1]/2. - kSlenTR2/2.;
409     zpos       = kCcframe/2.            - kSheight/2. + (iplan-1) * (kCheight + kCspace);
410     gMC->Gsposp("UCIO",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha);
411     parCha[0] = fCwidth[iplan-1]/2.    - kCcthick;
412     parCha[1] = fClengthO3[iplan-1]/2. - kCcthick;
413     parCha[2] = kCcframe/2.;
414     xpos       = 0.;
415     ypos       = fClengthO3[iplan-1]/2. - kSlenTR3/2.;
416     zpos       = kCcframe/2.            - kSheight/2. + (iplan-1) * (kCheight + kCspace);
417     gMC->Gsposp("UCIO",iplan+4*kNplan,"TRD3",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha);
418
419   }
420
421   xpos     = 0.;
422   ypos     = 0.;
423   zpos     = 0.;
424   gMC->Gspos("TRD1",1,"BTR1",xpos,ypos,zpos,0,"ONLY");
425   gMC->Gspos("TRD2",1,"BTR2",xpos,ypos,zpos,0,"ONLY");
426   gMC->Gspos("TRD3",1,"BTR3",xpos,ypos,zpos,0,"ONLY");
427
428 }