]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONSt1GeometryBuilder.cxx
Further development on Mapping and Segmentation. Waiting for a critical review
[u/mrichter/AliRoot.git] / MUON / AliMUONSt1GeometryBuilder.cxx
1 // $Id$
2 //
3 // Class AliMUONSt1GeometryBuilder
4 // -------------------------------
5 // MUON Station1 coarse geometry construction class.
6 // Extracted from AliMUONv1
7 // by Ivana Hrivnacova, IPN Orsay
8 // Included in AliRoot 2004/01/23
9
10 #include <TVirtualMC.h>
11 #include <TGeoMatrix.h>
12
13 #include "AliMUONSt1GeometryBuilder.h"
14 #include "AliMUON.h"
15 #include "AliMUONChamber.h"
16 #include "AliMUONChamberGeometry.h"
17
18 ClassImp(AliMUONSt1GeometryBuilder)
19
20 //______________________________________________________________________________
21 AliMUONSt1GeometryBuilder::AliMUONSt1GeometryBuilder(AliMUON* muon)
22  : AliMUONVGeometryBuilder(&muon->Chamber(0), &muon->Chamber(1)),
23    fMUON(muon)
24 {
25 // Standard constructor
26
27 }
28
29 //______________________________________________________________________________
30 AliMUONSt1GeometryBuilder::AliMUONSt1GeometryBuilder()
31  : AliMUONVGeometryBuilder(),
32    fMUON(0)
33 {
34 // Default constructor
35 }
36
37
38 //______________________________________________________________________________
39 AliMUONSt1GeometryBuilder::AliMUONSt1GeometryBuilder(const AliMUONSt1GeometryBuilder& rhs)
40   : AliMUONVGeometryBuilder(rhs)
41 {
42 // Protected copy constructor
43
44   Fatal("Copy constructor", 
45         "Copy constructor is not implemented.");
46 }
47
48 //______________________________________________________________________________
49 AliMUONSt1GeometryBuilder::~AliMUONSt1GeometryBuilder() {
50 //
51 }
52
53 //______________________________________________________________________________
54 AliMUONSt1GeometryBuilder& 
55 AliMUONSt1GeometryBuilder::operator = (const AliMUONSt1GeometryBuilder& rhs) 
56 {
57 // Protected assignement operator
58
59   // check assignement to self
60   if (this == &rhs) return *this;
61
62   Fatal("operator=", 
63         "Assignment operator is not implemented.");
64     
65   return *this;  
66 }
67
68 //
69 // public methods
70 //
71
72 //______________________________________________________________________________
73 void AliMUONSt1GeometryBuilder::CreateGeometry()
74 {
75 // From AliMUONv1::CreateGeometry()
76 // ---
77
78 //********************************************************************
79 //                            Station 1                             **
80 //********************************************************************
81 //  CONCENTRIC
82      // indices 1 and 2 for first and second chambers in the station
83      // iChamber (first chamber) kept for other quanties than Z,
84      // assumed to be the same in both chambers
85
86      // Get tracking medias Ids     
87      Int_t *idtmed = fMUON->GetIdtmed()->GetArray()-1099;
88      Int_t idAir= idtmed[1100]; // medium 1
89      Int_t idAlu1=idtmed[1103]; // medium 4
90      Int_t idAlu2=idtmed[1104]; // medium 5
91      Int_t idGas=idtmed[1108];  // medium 9 = Ar-CO2 gas (80%+20%)
92      Bool_t frameCrosses=kTRUE;     
93
94      // Rotation matrices in the x-y plane  
95      // phi=   0 deg
96      Int_t irot1;
97      fMUON->AliMatrix(irot1,  90.,   0., 90.,  90., 0., 0.);
98      // phi=  90 deg
99      Int_t irot2;
100      fMUON->AliMatrix(irot2,  90.,  90., 90., 180., 0., 0.);
101
102      AliMUONChamber* iChamber1 = GetChamber(0);
103      AliMUONChamber* iChamber2 = GetChamber(1);
104      AliMUONChamber* iChamber = iChamber1;
105
106      // DGas decreased from standard one (0.5)
107      iChamber->SetDGas(0.4); 
108      iChamber2->SetDGas(0.4);
109
110      // DAlu increased from standard one (3% of X0),
111      // because more electronics with smaller pads
112      iChamber->SetDAlu(3.5 * 8.9 / 100.); 
113      iChamber2->SetDAlu(3.5 * 8.9 / 100.);
114
115      // Half of the total thickness of frame crosses (including DAlu)
116      // for each chamber in stations 1 and 2:
117      // 3% of X0 of composite material,
118      // but taken as Aluminium here, with same thickness in number of X0
119      Float_t dframez = 3. * 8.9 / 100;
120      Float_t zfpos=-(iChamber->DGas()+dframez+iChamber->DAlu())/2;
121              // The same parameters are defined in builder for station 2 
122
123      // Mother volume
124      // Outer excess and inner recess for mother volume radius
125      // with respect to ROuter and RInner
126      Float_t dframep=.001; // Value for station 3 should be 6 ...
127      // Width (RdPhi) of the frame crosses for stations 1 and 2 (cm)
128      // Float_t dframep1=.001;
129      Float_t dframep1 = 11.0;
130      Float_t phi=2*TMath::Pi()/12/2;
131              // The same parameters are defined in builder for station 2 
132
133      Float_t tpar[3];
134      Float_t dstation = (-iChamber2->Z()) - (-iChamber1->Z());
135      tpar[0] = iChamber->RInner()-dframep; 
136      tpar[1] = (iChamber->ROuter()+dframep)/TMath::Cos(phi);
137      tpar[2] = dstation/5;
138
139      gMC->Gsvolu("S01M", "TUBE", idAir, tpar, 3);
140      gMC->Gsvolu("S02M", "TUBE", idAir, tpar, 3);
141
142      // CHANGED
143      //gMC->Gspos("S01M", 1, "ALIC", 0., 0., zpos1 , 0, "ONLY");
144      //gMC->Gspos("S02M", 1, "ALIC", 0., 0., zpos2 , 0, "ONLY");     
145      GetChamber(0)->GetGeometry()->AddEnvelope("S01M", false);
146      GetChamber(1)->GetGeometry()->AddEnvelope("S02M", false);
147
148 // // Aluminium frames
149 // // Outer frames
150 //      pgpar[0] = 360/12/2;
151 //      pgpar[1] = 360.;
152 //      pgpar[2] = 12.;
153 //      pgpar[3] =   2;
154 //      pgpar[4] = -dframez/2;
155 //      pgpar[5] = iChamber->ROuter();
156 //      pgpar[6] = pgpar[5]+dframep1;
157 //      pgpar[7] = +dframez/2;
158 //      pgpar[8] = pgpar[5];
159 //      pgpar[9] = pgpar[6];
160 //      gMC->Gsvolu("S01O", "PGON", idAlu1, pgpar, 10);
161 //      gMC->Gsvolu("S02O", "PGON", idAlu1, pgpar, 10);
162 //      gMC->Gspos("S01O",1,"S01M", 0.,0.,-zfpos,  0,"ONLY");
163 //      gMC->Gspos("S01O",2,"S01M", 0.,0.,+zfpos,  0,"ONLY");
164 //      gMC->Gspos("S02O",1,"S02M", 0.,0.,-zfpos,  0,"ONLY");
165 //      gMC->Gspos("S02O",2,"S02M", 0.,0.,+zfpos,  0,"ONLY");
166 // //
167 // // Inner frame
168 //      tpar[0]= iChamber->RInner()-dframep1;
169 //      tpar[1]= iChamber->RInner();
170 //      tpar[2]= dframez/2;
171 //      gMC->Gsvolu("S01I", "TUBE", idAlu1, tpar, 3);
172 //      gMC->Gsvolu("S02I", "TUBE", idAlu1, tpar, 3);
173
174 //      gMC->Gspos("S01I",1,"S01M", 0.,0.,-zfpos,  0,"ONLY");
175 //      gMC->Gspos("S01I",2,"S01M", 0.,0.,+zfpos,  0,"ONLY");
176 //      gMC->Gspos("S02I",1,"S02M", 0.,0.,-zfpos,  0,"ONLY");
177 //      gMC->Gspos("S02I",2,"S02M", 0.,0.,+zfpos,  0,"ONLY");
178 //
179 // Frame Crosses
180      if (frameCrosses) {
181          // outside gas
182          // security for inside mother volume
183          Float_t bpar[3];
184          bpar[0] = (iChamber->ROuter() - iChamber->RInner())
185            * TMath::Cos(TMath::ASin(dframep1 /
186                                    (iChamber->ROuter() - iChamber->RInner())))
187            / 2.0;
188          bpar[1] = dframep1/2;
189          // total thickness will be (4 * bpar[2]) for each chamber,
190          // which has to be equal to (2 * dframez) - DAlu
191          bpar[2] = (2.0 * dframez - iChamber->DAlu()) / 4.0;
192          gMC->Gsvolu("S01B", "BOX", idAlu1, bpar, 3);
193          gMC->Gsvolu("S02B", "BOX", idAlu1, bpar, 3);
194          
195          gMC->Gspos("S01B",1,"S01M", +iChamber->RInner()+bpar[0] , 0,-zfpos, 
196                     irot1,"ONLY");
197          gMC->Gspos("S01B",2,"S01M", -iChamber->RInner()-bpar[0] , 0,-zfpos, 
198                     irot1,"ONLY");
199          gMC->Gspos("S01B",3,"S01M", 0, +iChamber->RInner()+bpar[0] ,-zfpos, 
200                     irot2,"ONLY");
201          gMC->Gspos("S01B",4,"S01M", 0, -iChamber->RInner()-bpar[0] ,-zfpos, 
202                     irot2,"ONLY");
203          gMC->Gspos("S01B",5,"S01M", +iChamber->RInner()+bpar[0] , 0,+zfpos, 
204                     irot1,"ONLY");
205          gMC->Gspos("S01B",6,"S01M", -iChamber->RInner()-bpar[0] , 0,+zfpos, 
206                     irot1,"ONLY");
207          gMC->Gspos("S01B",7,"S01M", 0, +iChamber->RInner()+bpar[0] ,+zfpos, 
208                     irot2,"ONLY");
209          gMC->Gspos("S01B",8,"S01M", 0, -iChamber->RInner()-bpar[0] ,+zfpos, 
210                     irot2,"ONLY");
211          
212          gMC->Gspos("S02B",1,"S02M", +iChamber->RInner()+bpar[0] , 0,-zfpos, 
213                     irot1,"ONLY");
214          gMC->Gspos("S02B",2,"S02M", -iChamber->RInner()-bpar[0] , 0,-zfpos, 
215                     irot1,"ONLY");
216          gMC->Gspos("S02B",3,"S02M", 0, +iChamber->RInner()+bpar[0] ,-zfpos, 
217                     irot2,"ONLY");
218          gMC->Gspos("S02B",4,"S02M", 0, -iChamber->RInner()-bpar[0] ,-zfpos, 
219                     irot2,"ONLY");
220          gMC->Gspos("S02B",5,"S02M", +iChamber->RInner()+bpar[0] , 0,+zfpos, 
221                     irot1,"ONLY");
222          gMC->Gspos("S02B",6,"S02M", -iChamber->RInner()-bpar[0] , 0,+zfpos, 
223                     irot1,"ONLY");
224          gMC->Gspos("S02B",7,"S02M", 0, +iChamber->RInner()+bpar[0] ,+zfpos, 
225                     irot2,"ONLY");
226          gMC->Gspos("S02B",8,"S02M", 0, -iChamber->RInner()-bpar[0] ,+zfpos, 
227                     irot2,"ONLY");
228      }
229 //
230 //   Chamber Material represented by Alu sheet
231      tpar[0]= iChamber->RInner();
232      tpar[1]= iChamber->ROuter();
233      tpar[2] = (iChamber->DGas()+iChamber->DAlu())/2;
234      gMC->Gsvolu("S01A", "TUBE",  idAlu2, tpar, 3);
235      gMC->Gsvolu("S02A", "TUBE",idAlu2, tpar, 3);
236      gMC->Gspos("S01A", 1, "S01M", 0., 0., 0.,  0, "ONLY");
237      gMC->Gspos("S02A", 1, "S02M", 0., 0., 0.,  0, "ONLY");
238 //     
239 //   Sensitive volumes
240      // tpar[2] = iChamber->DGas();
241      tpar[2] = iChamber->DGas()/2;
242      gMC->Gsvolu("S01G", "TUBE", idGas, tpar, 3);
243      gMC->Gsvolu("S02G", "TUBE", idGas, tpar, 3);
244      gMC->Gspos("S01G", 1, "S01A", 0., 0., 0.,  0, "ONLY");
245      gMC->Gspos("S02G", 1, "S02A", 0., 0., 0.,  0, "ONLY");
246 //
247 // Frame Crosses to be placed inside gas
248      // NONE: chambers are sensitive everywhere
249 //      if (frameCrosses) {
250
251 //       dr = (iChamber->ROuter() - iChamber->RInner());
252 //       bpar[0] = TMath::Sqrt(dr*dr-dframep1*dframep1/4)/2;
253 //       bpar[1] = dframep1/2;
254 //       bpar[2] = iChamber->DGas()/2;
255 //       gMC->Gsvolu("S01F", "BOX", idAlu1, bpar, 3);
256 //       gMC->Gsvolu("S02F", "BOX", idAlu1, bpar, 3);
257          
258 //       gMC->Gspos("S01F",1,"S01G", +iChamber->RInner()+bpar[0] , 0, 0, 
259 //                  irot1,"ONLY");
260 //       gMC->Gspos("S01F",2,"S01G", -iChamber->RInner()-bpar[0] , 0, 0, 
261 //                  irot1,"ONLY");
262 //       gMC->Gspos("S01F",3,"S01G", 0, +iChamber->RInner()+bpar[0] , 0, 
263 //                  irot2,"ONLY");
264 //       gMC->Gspos("S01F",4,"S01G", 0, -iChamber->RInner()-bpar[0] , 0, 
265 //                  irot2,"ONLY");
266          
267 //       gMC->Gspos("S02F",1,"S02G", +iChamber->RInner()+bpar[0] , 0, 0, 
268 //                  irot1,"ONLY");
269 //       gMC->Gspos("S02F",2,"S02G", -iChamber->RInner()-bpar[0] , 0, 0, 
270 //                  irot1,"ONLY");
271 //       gMC->Gspos("S02F",3,"S02G", 0, +iChamber->RInner()+bpar[0] , 0, 
272 //                  irot2,"ONLY");
273 //       gMC->Gspos("S02F",4,"S02G", 0, -iChamber->RInner()-bpar[0] , 0, 
274 //                  irot2,"ONLY");
275 //      }
276 }
277
278 //______________________________________________________________________________
279 void AliMUONSt1GeometryBuilder::SetTransformations()
280 {
281 // Defines the transformations for the station2 chambers.
282 // ---
283
284   AliMUONChamber* iChamber1 = GetChamber(0);
285   Double_t zpos1= - iChamber1->Z(); 
286   iChamber1->GetGeometry()
287     ->SetTranslation(TGeoTranslation(0., 0., zpos1));
288
289   AliMUONChamber* iChamber2 = GetChamber(1);
290   Double_t zpos2 = - iChamber2->Z(); 
291   iChamber2->GetGeometry()
292     ->SetTranslation(TGeoTranslation(0., 0., zpos2));
293 }
294
295 //______________________________________________________________________________
296 void AliMUONSt1GeometryBuilder::SetSensitiveVolumes()
297 {
298 // Defines the sensitive volumes for station1 chambers.
299 // ---
300
301   GetChamber(0)->GetGeometry()->SetSensitiveVolume("S01G");
302   GetChamber(1)->GetGeometry()->SetSensitiveVolume("S02G");
303 }