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