Add new TRD classes
[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 */
19
20 ///////////////////////////////////////////////////////////////////////////////
21 //                                                                           //
22 //  TRD geometry without holes                                               //
23 //                                                                           //
24 ///////////////////////////////////////////////////////////////////////////////
25
26 #include "AliTRDgeometryFull.h"
27
28 ClassImp(AliTRDgeometryFull)
29
30 //_____________________________________________________________________________
31 AliTRDgeometryFull::AliTRDgeometryFull():AliTRDgeometry()
32 {
33   //
34   // AliTRDgeometryFull default constructor
35   //
36
37   Init();
38
39 }
40
41 //_____________________________________________________________________________
42 AliTRDgeometryFull::~AliTRDgeometryFull()
43 {
44
45 }
46
47 //_____________________________________________________________________________
48 void AliTRDgeometryFull::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   fClengthM[0] = 123.5;
62   fClengthM[1] = 131.0;
63   fClengthM[2] = 138.5;
64   fClengthM[3] = 146.0;
65   fClengthM[4] = 153.0;
66   fClengthM[5] = 160.5;
67
68   // The length of the outer chambers
69   fClengthO[0] = 123.5;
70   fClengthO[1] = 131.0;
71   fClengthO[2] = 134.5;
72   fClengthO[3] = 142.0;
73   fClengthO[4] = 142.0;
74   fClengthO[5] = 134.5;
75
76   // The maximum number of pads
77   // and the position of pad 0,0,0 
78   // 
79   // chambers seen from the top:
80   //     +----------------------------+
81   //     |                            |
82   //     |                            |     ^
83   //     |                            | rphi|
84   //     |                            |     |
85   //     |0                           |     | 
86   //     +----------------------------+     +------>
87   //                                             z 
88   // chambers seen from the side:           ^
89   //     +----------------------------+ time|
90   //     |                            |     |
91   //     |0                           |     |
92   //     +----------------------------+     +------>
93   //                                             z
94   //                                             
95
96   // The pad row (z-direction)
97   for (iplan = 0; iplan < kNplan; iplan++) {
98
99     for (Int_t isect = 0; isect < kNsect; isect++) {
100       Float_t clengthI = fClengthI[iplan];
101       Float_t clengthM = fClengthM[iplan];
102       Float_t clengthO = fClengthO[iplan];
103       fRowMax[iplan][0][isect] = 1 + TMath::Nint((clengthO - 2. * kCcthick) 
104                                                            / fRowPadSize - 0.5);
105       fRowMax[iplan][1][isect] = 1 + TMath::Nint((clengthM - 2. * kCcthick) 
106                                                            / fRowPadSize - 0.5);
107       fRowMax[iplan][2][isect] = 1 + TMath::Nint((clengthI - 2. * kCcthick) 
108                                                            / fRowPadSize - 0.5);
109       fRowMax[iplan][3][isect] = 1 + TMath::Nint((clengthM - 2. * kCcthick) 
110                                                            / fRowPadSize - 0.5);
111       fRowMax[iplan][4][isect] = 1 + TMath::Nint((clengthO - 2. * kCcthick) 
112                                                            / fRowPadSize - 0.5);
113       fRow0[iplan][0][isect]   = -clengthI/2. - clengthM - clengthO + kCcthick; 
114       fRow0[iplan][1][isect]   = -clengthI/2. - clengthM            + kCcthick;
115       fRow0[iplan][2][isect]   = -clengthI/2.                       + kCcthick;
116       fRow0[iplan][3][isect]   =  clengthI/2.                       + kCcthick; 
117       fRow0[iplan][4][isect]   =  clengthI/2. + clengthM            + kCcthick; 
118     }
119
120   }
121
122 }
123
124 //_____________________________________________________________________________
125 void AliTRDgeometryFull::CreateGeometry(Int_t *idtmed)
126 {
127   //
128   // Create the TRD geometry without hole
129   //
130
131   Int_t iplan;
132
133   const Int_t npar_trd = 4;
134   const Int_t npar_cha = 3;
135
136   Float_t par_trd[npar_trd];
137   Float_t par_cha[npar_cha];
138
139   Float_t xpos, ypos, zpos;
140
141   AliTRDgeometry::CreateGeometry(idtmed);
142
143   // The TRD mother volume for one sector (Air) (dimensions identical to BTR1)
144   par_trd[0] = kSwidth1/2.;
145   par_trd[1] = kSwidth2/2.;
146   par_trd[2] = kSlenTR1/2.;
147   par_trd[3] = kSheight/2.;
148   gMC->Gsvolu("TRD1","TRD1",idtmed[1302-1],par_trd,npar_trd);
149   
150   // Position the chambers in the TRD mother volume
151   for (iplan = 1; iplan <= kNplan; iplan++) {
152
153     // The inner chambers ---------------------------------------------------------------
154
155     // the aluminum frame
156     par_cha[0] = fCwidth[iplan-1]/2.;
157     par_cha[1] = fClengthI[iplan-1]/2.;
158     par_cha[2] = kCaframe/2.;
159     xpos       = 0.;
160     ypos       = 0.;
161     zpos       = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
162     gMC->Gsposp("UAFI",iplan       ,"TRD1",xpos,ypos,zpos,0,"MANY",par_cha,npar_cha);
163
164     // the inner part of the aluminum frame
165     par_cha[0] = fCwidth[iplan-1]/2.   - kCathick;
166     par_cha[1] = fClengthI[iplan-1]/2. - kCathick;
167     par_cha[2] = kCaframe/2.;
168     xpos       = 0.;
169     ypos       = 0.;
170     zpos       = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
171     gMC->Gsposp("UAII",iplan       ,"TRD1",xpos,ypos,zpos,0,"ONLY",par_cha,npar_cha);
172
173     // the carbon frame
174     par_cha[0] = fCwidth[iplan-1]/2.;
175     par_cha[1] = fClengthI[iplan-1]/2.;
176     par_cha[2] = kCcframe/2.;
177     xpos       = 0.;
178     ypos       = 0.;
179     zpos       = kCcframe/2.            - kSheight/2. + (iplan-1) * (kCheight + kCspace);
180     gMC->Gsposp("UCFI",iplan       ,"TRD1",xpos,ypos,zpos,0,"MANY",par_cha,npar_cha);
181
182     // the inner part of the carbon frame
183     par_cha[0] = fCwidth[iplan-1]/2.   - kCcthick;
184     par_cha[1] = fClengthI[iplan-1]/2. - kCcthick;
185     par_cha[2] = kCcframe/2.;
186     xpos       = 0.;
187     ypos       = 0.;
188     zpos       = kCcframe/2.            - kSheight/2. + (iplan-1) * (kCheight + kCspace);
189     gMC->Gsposp("UCII",iplan       ,"TRD1",xpos,ypos,zpos,0,"ONLY",par_cha,npar_cha);
190
191     // The middle chambers --------------------------------------------------------------
192
193     // the aluminum frame
194     par_cha[0] = fCwidth[iplan-1]/2.;
195     par_cha[1] = fClengthM[iplan-1]/2.;
196     par_cha[2] = kCaframe/2.;
197     xpos       = 0.;
198     ypos       = fClengthI[iplan-1]/2.  + fClengthM[iplan-1]/2.;
199     zpos       = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
200     gMC->Gsposp("UAFM",iplan         ,"TRD1",xpos, ypos,zpos,0,"MANY",par_cha,npar_cha);
201     gMC->Gsposp("UAFM",iplan+  kNplan,"TRD1",xpos,-ypos,zpos,0,"MANY",par_cha,npar_cha);
202
203     // the inner part of the aluminum frame
204     par_cha[0] = fCwidth[iplan-1]/2.    - kCathick;
205     par_cha[1] = fClengthM[iplan-1]/2. - kCathick;
206     par_cha[2] = kCaframe/2.;
207     xpos       = 0.;
208     ypos       = fClengthI[iplan-1]/2.  + fClengthM[iplan-1]/2.;
209     zpos       = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
210     gMC->Gsposp("UAIM",iplan         ,"TRD1",xpos, ypos,zpos,0,"ONLY",par_cha,npar_cha);
211     gMC->Gsposp("UAIM",iplan+  kNplan,"TRD1",xpos,-ypos,zpos,0,"ONLY",par_cha,npar_cha);
212
213     // the carbon frame
214     par_cha[0] = fCwidth[iplan-1]/2.;
215     par_cha[1] = fClengthM[iplan-1]/2.;
216     par_cha[2] = kCcframe/2.;
217     xpos       = 0.;
218     ypos       = fClengthI[iplan-1]/2. + fClengthM[iplan-1]/2.;
219     zpos       = kCcframe/2.           - kSheight/2. + (iplan-1) * (kCheight + kCspace);
220     gMC->Gsposp("UCFM",iplan         ,"TRD1",xpos, ypos,zpos,0,"MANY",par_cha,npar_cha);
221     gMC->Gsposp("UCFM",iplan+  kNplan,"TRD1",xpos,-ypos,zpos,0,"MANY",par_cha,npar_cha);
222
223     // the inner part of the carbon frame
224     par_cha[0] = fCwidth[iplan-1]/2.    - kCcthick;
225     par_cha[1] = fClengthM[iplan-1]/2. - kCcthick;
226     par_cha[2] = kCcframe/2.;
227     xpos       = 0.;
228     ypos       = fClengthI[iplan-1]/2. + fClengthM[iplan-1]/2.;
229     zpos       = kCcframe/2.           - kSheight/2. + (iplan-1) * (kCheight + kCspace);
230     gMC->Gsposp("UCIM",iplan         ,"TRD1",xpos, ypos,zpos,0,"ONLY",par_cha,npar_cha);
231     gMC->Gsposp("UCIM",iplan+  kNplan,"TRD1",xpos,-ypos,zpos,0,"ONLY",par_cha,npar_cha);
232
233     // The outer chambers ---------------------------------------------------------------
234
235     // the aluminum frame
236     par_cha[0] = fCwidth[iplan-1]/2.;
237     par_cha[1] = fClengthO[iplan-1]/2.;
238     par_cha[2] = kCaframe/2.;
239     xpos       = 0.;
240     ypos       = fClengthI[iplan-1]/2. + fClengthM[iplan-1]    + fClengthO[iplan-1]/2.;
241     zpos       = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
242     gMC->Gsposp("UAFO",iplan         ,"TRD1",xpos, ypos,zpos,0,"MANY",par_cha,npar_cha);
243     gMC->Gsposp("UAFO",iplan+  kNplan,"TRD1",xpos,-ypos,zpos,0,"MANY",par_cha,npar_cha);
244
245     // the inner part of the aluminum frame
246     par_cha[0] = fCwidth[iplan-1]/2.    - kCathick;
247     par_cha[1] = fClengthO[iplan-1]/2. - kCathick;
248     par_cha[2] = kCaframe/2.;
249     xpos       = 0.;
250     ypos       = fClengthI[iplan-1]/2. + fClengthM[iplan-1]    + fClengthO[iplan-1]/2.;
251     zpos       = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
252     gMC->Gsposp("UAIO",iplan         ,"TRD1",xpos, ypos,zpos,0,"ONLY",par_cha,npar_cha);
253     gMC->Gsposp("UAIO",iplan+  kNplan,"TRD1",xpos,-ypos,zpos,0,"ONLY",par_cha,npar_cha);
254
255     // the carbon frame
256     par_cha[0] = fCwidth[iplan-1]/2.;
257     par_cha[1] = fClengthO[iplan-1]/2.;
258     par_cha[2] = kCcframe/2.;
259     xpos       = 0.;
260     ypos       = fClengthI[iplan-1]/2. + fClengthM[iplan-1]    + fClengthO[iplan-1]/2.;
261     zpos       = kCcframe/2.           - kSheight/2. + (iplan-1) * (kCheight + kCspace);
262     gMC->Gsposp("UCFO",iplan,         "TRD1",xpos, ypos,zpos,0,"MANY",par_cha,npar_cha);
263     gMC->Gsposp("UCFO",iplan+  kNplan,"TRD1",xpos,-ypos,zpos,0,"MANY",par_cha,npar_cha);
264
265     // the inner part of the carbon frame
266     par_cha[0] = fCwidth[iplan-1]/2.    - kCcthick;
267     par_cha[1] = fClengthO[iplan-1]/2. - kCcthick;
268     par_cha[2] = kCcframe/2.;
269     xpos       = 0.;
270     ypos       = fClengthI[iplan-1]/2. + fClengthM[iplan-1]    + fClengthO[iplan-1]/2.;
271     zpos       = kCcframe/2.           - kSheight/2. + (iplan-1) * (kCheight + kCspace);
272     gMC->Gsposp("UCIO",iplan         ,"TRD1",xpos, ypos,zpos,0,"ONLY",par_cha,npar_cha);
273     gMC->Gsposp("UCIO",iplan+  kNplan,"TRD1",xpos,-ypos,zpos,0,"ONLY",par_cha,npar_cha);
274
275   }
276
277   xpos     = 0.;
278   ypos     = 0.;
279   zpos     = 0.;
280   gMC->Gspos("TRD1",1,"BTR1",xpos,ypos,zpos,0,"ONLY");
281   gMC->Gspos("TRD1",2,"BTR2",xpos,ypos,zpos,0,"ONLY");
282   gMC->Gspos("TRD1",3,"BTR3",xpos,ypos,zpos,0,"ONLY");
283
284 }