]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONSt2GeometryBuilder.cxx
New definition of the geometry based on builders and usign Ivana's envelop method...
[u/mrichter/AliRoot.git] / MUON / AliMUONSt2GeometryBuilder.cxx
CommitLineData
d1cd2474 1// $Id$
2//
3// Class AliMUONSt2GeometryBuilder
4// -------------------------------
5// Abstract base class for geometry construction per chamber.
6//
7// Author: Ivana Hrivnacova, IPN Orsay
8
9#include <TVirtualMC.h>
10#include <TGeoMatrix.h>
11
12#include "AliMUONSt2GeometryBuilder.h"
13#include "AliMUON.h"
14#include "AliMUONChamber.h"
15#include "AliMUONChamberGeometry.h"
16
17ClassImp(AliMUONSt2GeometryBuilder)
18
19//______________________________________________________________________________
20AliMUONSt2GeometryBuilder::AliMUONSt2GeometryBuilder(AliMUON* muon)
21 : AliMUONVGeometryBuilder(&muon->Chamber(2), &muon->Chamber(3)),
22 fMUON(muon)
23{
24// Standard constructor
25
26}
27
28//______________________________________________________________________________
29AliMUONSt2GeometryBuilder::AliMUONSt2GeometryBuilder()
30 : AliMUONVGeometryBuilder(),
31 fMUON(0)
32{
33// Default constructor
34}
35
36
37//______________________________________________________________________________
38AliMUONSt2GeometryBuilder::AliMUONSt2GeometryBuilder(const AliMUONSt2GeometryBuilder& rhs)
39 : AliMUONVGeometryBuilder(rhs)
40{
41 Fatal("Copy constructor",
42 "Copy constructor is not implemented.");
43}
44
45//______________________________________________________________________________
46AliMUONSt2GeometryBuilder::~AliMUONSt2GeometryBuilder() {
47//
48}
49
50//______________________________________________________________________________
51AliMUONSt2GeometryBuilder&
52AliMUONSt2GeometryBuilder::operator = (const AliMUONSt2GeometryBuilder& rhs)
53{
54 // check assignement to self
55 if (this == &rhs) return *this;
56
57 Fatal("operator=",
58 "Assignment operator is not implemented.");
59
60 return *this;
61}
62
63//
64// public methods
65//
66
67//______________________________________________________________________________
68void AliMUONSt2GeometryBuilder::CreateGeometry()
69{
70// From AliMUONv1::CreateGeometry()
71
72//
73//********************************************************************
74// Station 2 **
75//********************************************************************
76 // indices 1 and 2 for first and second chambers in the station
77 // iChamber (first chamber) kept for other quanties than Z,
78 // assumed to be the same in both chambers
79
80 // Get tracking medias Ids
81 Int_t *idtmed = fMUON->GetIdtmed()->GetArray()-1099;
82 Int_t idAir= idtmed[1100]; // medium 1
83 Int_t idAlu1=idtmed[1103]; // medium 4
84 Int_t idAlu2=idtmed[1104]; // medium 5
85 Int_t idGas=idtmed[1108]; // medium 9 = Ar-CO2 gas (80%+20%)
86 Bool_t frameCrosses=kTRUE;
87
88 // Rotation matrices in the x-y plane
89 // phi= 0 deg
90 Int_t irot1;
91 fMUON->AliMatrix(irot1, 90., 0., 90., 90., 0., 0.);
92 // phi= 90 deg
93 Int_t irot2;
94 fMUON->AliMatrix(irot2, 90., 90., 90., 180., 0., 0.);
95
96 AliMUONChamber* iChamber = GetChamber(2);
97 AliMUONChamber* iChamber1 = iChamber;
98 AliMUONChamber* iChamber2 = GetChamber(3);
99
100 // Half of the total thickness of frame crosses (including DAlu)
101 // for each chamber in stations 1 and 2:
102 // 3% of X0 of composite material,
103 // but taken as Aluminium here, with same thickness in number of X0
104 Float_t dframez = 3. * 8.9 / 100;
105 // DGas and DAlu not changed from standard values
106 Double_t zfpos=-(iChamber->DGas()+dframez+iChamber->DAlu())/2;
107 // The same parameters are defined in builder for station 1
108
109 // Mother volume
110 // Outer excess and inner recess for mother volume radius
111 // with respect to ROuter and RInner
112 Float_t dframep=.001; // Value for station 3 should be 6 ...
113 // Width (RdPhi) of the frame crosses for stations 1 and 2 (cm)
114 // Float_t dframep1=.001;
115 Float_t phi=2*TMath::Pi()/12/2;
116 // The same parameters are defined in builder for station 1
117
118 Float_t tpar[3];
119 Double_t dstation = (-iChamber2->Z()) - (-iChamber1->Z());
120 tpar[0] = iChamber->RInner()-dframep;
121 tpar[1] = (iChamber->ROuter()+dframep)/TMath::Cos(phi);
122 tpar[2] = dstation/5;
123
124 gMC->Gsvolu("S03M", "TUBE", idAir, tpar, 3);
125 gMC->Gsvolu("S04M", "TUBE", idAir, tpar, 3);
126
127 // CHANGED
128 //gMC->Gspos("S03M", 1, "ALIC", 0., 0., zpos1 , 0, "ONLY");
129 //gMC->Gspos("S04M", 1, "ALIC", 0., 0., zpos2 , 0, "ONLY");
130 GetChamber(2)->GetGeometry()->AddEnvelope("S03M", false);
131 GetChamber(3)->GetGeometry()->AddEnvelope("S04M", false);
132
133 gMC->Gsbool("S03M", "L3DO");
134 gMC->Gsbool("S03M", "L3O1");
135 gMC->Gsbool("S03M", "L3O2");
136 gMC->Gsbool("S04M", "L3DO");
137 gMC->Gsbool("S04M", "L3O1");
138 gMC->Gsbool("S04M", "L3O2");
139
140// // Aluminium frames
141// // Outer frames
142// pgpar[0] = 360/12/2;
143// pgpar[1] = 360.;
144// pgpar[2] = 12.;
145// pgpar[3] = 2;
146// pgpar[4] = -dframez/2;
147// pgpar[5] = iChamber->ROuter();
148// pgpar[6] = pgpar[5]+dframep;
149// pgpar[7] = +dframez/2;
150// pgpar[8] = pgpar[5];
151// pgpar[9] = pgpar[6];
152// gMC->Gsvolu("S03O", "PGON", idAlu1, pgpar, 10);
153// gMC->Gsvolu("S04O", "PGON", idAlu1, pgpar, 10);
154// gMC->Gspos("S03O",1,"S03M", 0.,0.,-zfpos, 0,"ONLY");
155// gMC->Gspos("S03O",2,"S03M", 0.,0.,+zfpos, 0,"ONLY");
156// gMC->Gspos("S04O",1,"S04M", 0.,0.,-zfpos, 0,"ONLY");
157// gMC->Gspos("S04O",2,"S04M", 0.,0.,+zfpos, 0,"ONLY");
158// //
159// // Inner frame
160// tpar[0]= iChamber->RInner()-dframep;
161// tpar[1]= iChamber->RInner();
162// tpar[2]= dframez/2;
163// gMC->Gsvolu("S03I", "TUBE", idAlu1, tpar, 3);
164// gMC->Gsvolu("S04I", "TUBE", idAlu1, tpar, 3);
165
166// gMC->Gspos("S03I",1,"S03M", 0.,0.,-zfpos, 0,"ONLY");
167// gMC->Gspos("S03I",2,"S03M", 0.,0.,+zfpos, 0,"ONLY");
168// gMC->Gspos("S04I",1,"S04M", 0.,0.,-zfpos, 0,"ONLY");
169// gMC->Gspos("S04I",2,"S04M", 0.,0.,+zfpos, 0,"ONLY");
170//
171// Frame Crosses
172 if (frameCrosses) {
173 // outside gas
174 // security for inside mother volume
175
176 // ADDED !! Repeated
177 Float_t dframep1 = 11.0;
178 Float_t dframez = 3. * 8.9 / 100;
179
180 Float_t bpar[3];
181 bpar[0] = (iChamber->ROuter() - iChamber->RInner())
182 * TMath::Cos(TMath::ASin(dframep1 /
183 (iChamber->ROuter() - iChamber->RInner())))
184 / 2.0;
185 bpar[1] = dframep1/2;
186 // total thickness will be (4 * bpar[2]) for each chamber,
187 // which has to be equal to (2 * dframez) - DAlu
188 bpar[2] = (2.0 * dframez - iChamber->DAlu()) / 4.0;
189 gMC->Gsvolu("S03B", "BOX", idAlu1, bpar, 3);
190 gMC->Gsvolu("S04B", "BOX", idAlu1, bpar, 3);
191
192 gMC->Gspos("S03B",1,"S03M", +iChamber->RInner()+bpar[0] , 0,-zfpos,
193 irot1,"ONLY");
194 gMC->Gspos("S03B",2,"S03M", -iChamber->RInner()-bpar[0] , 0,-zfpos,
195 irot1,"ONLY");
196 gMC->Gspos("S03B",3,"S03M", 0, +iChamber->RInner()+bpar[0] ,-zfpos,
197 irot2,"ONLY");
198 gMC->Gspos("S03B",4,"S03M", 0, -iChamber->RInner()-bpar[0] ,-zfpos,
199 irot2,"ONLY");
200 gMC->Gspos("S03B",5,"S03M", +iChamber->RInner()+bpar[0] , 0,+zfpos,
201 irot1,"ONLY");
202 gMC->Gspos("S03B",6,"S03M", -iChamber->RInner()-bpar[0] , 0,+zfpos,
203 irot1,"ONLY");
204 gMC->Gspos("S03B",7,"S03M", 0, +iChamber->RInner()+bpar[0] ,+zfpos,
205 irot2,"ONLY");
206 gMC->Gspos("S03B",8,"S03M", 0, -iChamber->RInner()-bpar[0] ,+zfpos,
207 irot2,"ONLY");
208
209 gMC->Gspos("S04B",1,"S04M", +iChamber->RInner()+bpar[0] , 0,-zfpos,
210 irot1,"ONLY");
211 gMC->Gspos("S04B",2,"S04M", -iChamber->RInner()-bpar[0] , 0,-zfpos,
212 irot1,"ONLY");
213 gMC->Gspos("S04B",3,"S04M", 0, +iChamber->RInner()+bpar[0] ,-zfpos,
214 irot2,"ONLY");
215 gMC->Gspos("S04B",4,"S04M", 0, -iChamber->RInner()-bpar[0] ,-zfpos,
216 irot2,"ONLY");
217 gMC->Gspos("S04B",5,"S04M", +iChamber->RInner()+bpar[0] , 0,+zfpos,
218 irot1,"ONLY");
219 gMC->Gspos("S04B",6,"S04M", -iChamber->RInner()-bpar[0] , 0,+zfpos,
220 irot1,"ONLY");
221 gMC->Gspos("S04B",7,"S04M", 0, +iChamber->RInner()+bpar[0] ,+zfpos,
222 irot2,"ONLY");
223 gMC->Gspos("S04B",8,"S04M", 0, -iChamber->RInner()-bpar[0] ,+zfpos,
224 irot2,"ONLY");
225 }
226//
227// Chamber Material represented by Alu sheet
228 tpar[0]= iChamber->RInner();
229 tpar[1]= iChamber->ROuter();
230 tpar[2] = (iChamber->DGas()+iChamber->DAlu())/2;
231 gMC->Gsvolu("S03A", "TUBE", idAlu2, tpar, 3);
232 gMC->Gsvolu("S04A", "TUBE", idAlu2, tpar, 3);
233 gMC->Gspos("S03A", 1, "S03M", 0., 0., 0., 0, "ONLY");
234 gMC->Gspos("S04A", 1, "S04M", 0., 0., 0., 0, "ONLY");
235//
236// Sensitive volumes
237 // tpar[2] = iChamber->DGas();
238 tpar[2] = iChamber->DGas()/2;
239 gMC->Gsvolu("S03G", "TUBE", idGas, tpar, 3);
240 gMC->Gsvolu("S04G", "TUBE", idGas, tpar, 3);
241 gMC->Gspos("S03G", 1, "S03A", 0., 0., 0., 0, "ONLY");
242 gMC->Gspos("S04G", 1, "S04A", 0., 0., 0., 0, "ONLY");
243//
244// Frame Crosses to be placed inside gas
245 // NONE: chambers are sensitive everywhere
246// if (frameCrosses) {
247
248// dr = (iChamber->ROuter() - iChamber->RInner());
249// bpar[0] = TMath::Sqrt(dr*dr-dframep1*dframep1/4)/2;
250// bpar[1] = dframep1/2;
251// bpar[2] = iChamber->DGas()/2;
252// gMC->Gsvolu("S03F", "BOX", idAlu1, bpar, 3);
253// gMC->Gsvolu("S04F", "BOX", idAlu1, bpar, 3);
254
255// gMC->Gspos("S03F",1,"S03G", +iChamber->RInner()+bpar[0] , 0, 0,
256// irot1,"ONLY");
257// gMC->Gspos("S03F",2,"S03G", -iChamber->RInner()-bpar[0] , 0, 0,
258// irot1,"ONLY");
259// gMC->Gspos("S03F",3,"S03G", 0, +iChamber->RInner()+bpar[0] , 0,
260// irot2,"ONLY");
261// gMC->Gspos("S03F",4,"S03G", 0, -iChamber->RInner()-bpar[0] , 0,
262// irot2,"ONLY");
263
264// gMC->Gspos("S04F",1,"S04G", +iChamber->RInner()+bpar[0] , 0, 0,
265// irot1,"ONLY");
266// gMC->Gspos("S04F",2,"S04G", -iChamber->RInner()-bpar[0] , 0, 0,
267// irot1,"ONLY");
268// gMC->Gspos("S04F",3,"S04G", 0, +iChamber->RInner()+bpar[0] , 0,
269// irot2,"ONLY");
270// gMC->Gspos("S04F",4,"S04G", 0, -iChamber->RInner()-bpar[0] , 0,
271// irot2,"ONLY");
272// }
273/*
274 iChamber1 = iChamber = (AliMUONChamber*) (*fChambers)[2];
275 iChamber2 =(AliMUONChamber*) (*fChambers)[3];
276 zpos1=iChamber1->Z();
277 zpos2=iChamber2->Z();
278 dstation = zpos2 - zpos1;
279 // DGas and DAlu not changed from standard values
280 zfpos=-(iChamber->DGas()+dframez+iChamber->DAlu())/2;
281
282//
283// Mother volume
284 tpar[0] = iChamber->RInner()-dframep;
285 tpar[1] = (iChamber->ROuter()+dframep)/TMath::Cos(phi);
286 tpar[2] = dstation/5;
287
288 gMC->Gsvolu("S03M", "TUBE", idAir, tpar, 3);
289 gMC->Gsvolu("S04M", "TUBE", idAir, tpar, 3);
290 gMC->Gspos("S03M", 1, "ALIC", 0., 0., zpos1 , 0, "ONLY");
291 gMC->Gspos("S04M", 1, "ALIC", 0., 0., zpos2 , 0, "ONLY");
292 gMC->Gsbool("S03M", "L3DO");
293 gMC->Gsbool("S03M", "L3O1");
294 gMC->Gsbool("S03M", "L3O2");
295 gMC->Gsbool("S04M", "L3DO");
296 gMC->Gsbool("S04M", "L3O1");
297 gMC->Gsbool("S04M", "L3O2");
298
299// // Aluminium frames
300// // Outer frames
301// pgpar[0] = 360/12/2;
302// pgpar[1] = 360.;
303// pgpar[2] = 12.;
304// pgpar[3] = 2;
305// pgpar[4] = -dframez/2;
306// pgpar[5] = iChamber->ROuter();
307// pgpar[6] = pgpar[5]+dframep;
308// pgpar[7] = +dframez/2;
309// pgpar[8] = pgpar[5];
310// pgpar[9] = pgpar[6];
311// gMC->Gsvolu("S03O", "PGON", idAlu1, pgpar, 10);
312// gMC->Gsvolu("S04O", "PGON", idAlu1, pgpar, 10);
313// gMC->Gspos("S03O",1,"S03M", 0.,0.,-zfpos, 0,"ONLY");
314// gMC->Gspos("S03O",2,"S03M", 0.,0.,+zfpos, 0,"ONLY");
315// gMC->Gspos("S04O",1,"S04M", 0.,0.,-zfpos, 0,"ONLY");
316// gMC->Gspos("S04O",2,"S04M", 0.,0.,+zfpos, 0,"ONLY");
317// //
318// // Inner frame
319// tpar[0]= iChamber->RInner()-dframep;
320// tpar[1]= iChamber->RInner();
321// tpar[2]= dframez/2;
322// gMC->Gsvolu("S03I", "TUBE", idAlu1, tpar, 3);
323// gMC->Gsvolu("S04I", "TUBE", idAlu1, tpar, 3);
324
325// gMC->Gspos("S03I",1,"S03M", 0.,0.,-zfpos, 0,"ONLY");
326// gMC->Gspos("S03I",2,"S03M", 0.,0.,+zfpos, 0,"ONLY");
327// gMC->Gspos("S04I",1,"S04M", 0.,0.,-zfpos, 0,"ONLY");
328// gMC->Gspos("S04I",2,"S04M", 0.,0.,+zfpos, 0,"ONLY");
329//
330// Frame Crosses
331 if (frameCrosses) {
332 // outside gas
333 // security for inside mother volume
334 bpar[0] = (iChamber->ROuter() - iChamber->RInner())
335 * TMath::Cos(TMath::ASin(dframep1 /
336 (iChamber->ROuter() - iChamber->RInner())))
337 / 2.0;
338 bpar[1] = dframep1/2;
339 // total thickness will be (4 * bpar[2]) for each chamber,
340 // which has to be equal to (2 * dframez) - DAlu
341 bpar[2] = (2.0 * dframez - iChamber->DAlu()) / 4.0;
342 gMC->Gsvolu("S03B", "BOX", idAlu1, bpar, 3);
343 gMC->Gsvolu("S04B", "BOX", idAlu1, bpar, 3);
344
345 gMC->Gspos("S03B",1,"S03M", +iChamber->RInner()+bpar[0] , 0,-zfpos,
346 irot1,"ONLY");
347 gMC->Gspos("S03B",2,"S03M", -iChamber->RInner()-bpar[0] , 0,-zfpos,
348 irot1,"ONLY");
349 gMC->Gspos("S03B",3,"S03M", 0, +iChamber->RInner()+bpar[0] ,-zfpos,
350 irot2,"ONLY");
351 gMC->Gspos("S03B",4,"S03M", 0, -iChamber->RInner()-bpar[0] ,-zfpos,
352 irot2,"ONLY");
353 gMC->Gspos("S03B",5,"S03M", +iChamber->RInner()+bpar[0] , 0,+zfpos,
354 irot1,"ONLY");
355 gMC->Gspos("S03B",6,"S03M", -iChamber->RInner()-bpar[0] , 0,+zfpos,
356 irot1,"ONLY");
357 gMC->Gspos("S03B",7,"S03M", 0, +iChamber->RInner()+bpar[0] ,+zfpos,
358 irot2,"ONLY");
359 gMC->Gspos("S03B",8,"S03M", 0, -iChamber->RInner()-bpar[0] ,+zfpos,
360 irot2,"ONLY");
361
362 gMC->Gspos("S04B",1,"S04M", +iChamber->RInner()+bpar[0] , 0,-zfpos,
363 irot1,"ONLY");
364 gMC->Gspos("S04B",2,"S04M", -iChamber->RInner()-bpar[0] , 0,-zfpos,
365 irot1,"ONLY");
366 gMC->Gspos("S04B",3,"S04M", 0, +iChamber->RInner()+bpar[0] ,-zfpos,
367 irot2,"ONLY");
368 gMC->Gspos("S04B",4,"S04M", 0, -iChamber->RInner()-bpar[0] ,-zfpos,
369 irot2,"ONLY");
370 gMC->Gspos("S04B",5,"S04M", +iChamber->RInner()+bpar[0] , 0,+zfpos,
371 irot1,"ONLY");
372 gMC->Gspos("S04B",6,"S04M", -iChamber->RInner()-bpar[0] , 0,+zfpos,
373 irot1,"ONLY");
374 gMC->Gspos("S04B",7,"S04M", 0, +iChamber->RInner()+bpar[0] ,+zfpos,
375 irot2,"ONLY");
376 gMC->Gspos("S04B",8,"S04M", 0, -iChamber->RInner()-bpar[0] ,+zfpos,
377 irot2,"ONLY");
378 }
379//
380// Chamber Material represented by Alu sheet
381 tpar[0]= iChamber->RInner();
382 tpar[1]= iChamber->ROuter();
383 tpar[2] = (iChamber->DGas()+iChamber->DAlu())/2;
384 gMC->Gsvolu("S03A", "TUBE", idAlu2, tpar, 3);
385 gMC->Gsvolu("S04A", "TUBE", idAlu2, tpar, 3);
386 gMC->Gspos("S03A", 1, "S03M", 0., 0., 0., 0, "ONLY");
387 gMC->Gspos("S04A", 1, "S04M", 0., 0., 0., 0, "ONLY");
388//
389// Sensitive volumes
390 // tpar[2] = iChamber->DGas();
391 tpar[2] = iChamber->DGas()/2;
392 gMC->Gsvolu("S03G", "TUBE", idGas, tpar, 3);
393 gMC->Gsvolu("S04G", "TUBE", idGas, tpar, 3);
394 gMC->Gspos("S03G", 1, "S03A", 0., 0., 0., 0, "ONLY");
395 gMC->Gspos("S04G", 1, "S04A", 0., 0., 0., 0, "ONLY");
396//
397// Frame Crosses to be placed inside gas
398 // NONE: chambers are sensitive everywhere
399// if (frameCrosses) {
400
401// dr = (iChamber->ROuter() - iChamber->RInner());
402// bpar[0] = TMath::Sqrt(dr*dr-dframep1*dframep1/4)/2;
403// bpar[1] = dframep1/2;
404// bpar[2] = iChamber->DGas()/2;
405// gMC->Gsvolu("S03F", "BOX", idAlu1, bpar, 3);
406// gMC->Gsvolu("S04F", "BOX", idAlu1, bpar, 3);
407
408// gMC->Gspos("S03F",1,"S03G", +iChamber->RInner()+bpar[0] , 0, 0,
409// irot1,"ONLY");
410// gMC->Gspos("S03F",2,"S03G", -iChamber->RInner()-bpar[0] , 0, 0,
411// irot1,"ONLY");
412// gMC->Gspos("S03F",3,"S03G", 0, +iChamber->RInner()+bpar[0] , 0,
413// irot2,"ONLY");
414// gMC->Gspos("S03F",4,"S03G", 0, -iChamber->RInner()-bpar[0] , 0,
415// irot2,"ONLY");
416
417// gMC->Gspos("S04F",1,"S04G", +iChamber->RInner()+bpar[0] , 0, 0,
418// irot1,"ONLY");
419// gMC->Gspos("S04F",2,"S04G", -iChamber->RInner()-bpar[0] , 0, 0,
420// irot1,"ONLY");
421// gMC->Gspos("S04F",3,"S04G", 0, +iChamber->RInner()+bpar[0] , 0,
422// irot2,"ONLY");
423// gMC->Gspos("S04F",4,"S04G", 0, -iChamber->RInner()-bpar[0] , 0,
424// irot2,"ONLY");
425// }
426 }
427*/
428}
429
430//______________________________________________________________________________
431void AliMUONSt2GeometryBuilder::SetTransformations()
432{
433// Defines the transformations for the station2 chambers.
434// ---
435
436 AliMUONChamber* iChamber1 = GetChamber(2);
437 Double_t zpos1 = - iChamber1->Z();
438 iChamber1->GetGeometry()
439 ->SetTranslation(TGeoTranslation(0., 0., zpos1));
440
441 AliMUONChamber* iChamber2 = GetChamber(3);
442 Double_t zpos2 = - iChamber2->Z();
443 iChamber2->GetGeometry()
444 ->SetTranslation(TGeoTranslation(0., 0., zpos2));
445}
446
447//______________________________________________________________________________
448void AliMUONSt2GeometryBuilder::SetSensitiveVolumes()
449{
450// Defines the sensitive volumes for station2 chambers.
451// ---
452
453 GetChamber(2)->GetGeometry()->SetSensitiveVolume("S03G");
454 GetChamber(3)->GetGeometry()->SetSensitiveVolume("S04G");
455}