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