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