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