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