1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 // Class AliMUONSt2GeometryBuilder
19 // -------------------------------
20 // MUON Station2 coarse geometry construction class.
21 // Extracted from AliMUONv1
22 // by Ivana Hrivnacova, IPN Orsay
23 // Included in AliRoot 2004/01/23
25 #include <TVirtualMC.h>
26 #include <TGeoMatrix.h>
30 #include "AliMUONSt2GeometryBuilder.h"
32 #include "AliMUONChamber.h"
33 #include "AliMUONGeometryModule.h"
34 #include "AliMUONGeometryEnvelopeStore.h"
36 ClassImp(AliMUONSt2GeometryBuilder)
38 //______________________________________________________________________________
39 AliMUONSt2GeometryBuilder::AliMUONSt2GeometryBuilder(AliMUON* muon)
40 : AliMUONVGeometryBuilder("st2.dat",
41 muon->Chamber(2).GetGeometry(),
42 muon->Chamber(3).GetGeometry()),
45 // Standard constructor
49 //______________________________________________________________________________
50 AliMUONSt2GeometryBuilder::AliMUONSt2GeometryBuilder()
51 : AliMUONVGeometryBuilder(),
54 // Default constructor
58 //______________________________________________________________________________
59 AliMUONSt2GeometryBuilder::AliMUONSt2GeometryBuilder(const AliMUONSt2GeometryBuilder& rhs)
60 : AliMUONVGeometryBuilder(rhs)
62 // Protected copy constructor
64 AliFatal("Copy constructor is not implemented.");
67 //______________________________________________________________________________
68 AliMUONSt2GeometryBuilder::~AliMUONSt2GeometryBuilder() {
72 //______________________________________________________________________________
73 AliMUONSt2GeometryBuilder&
74 AliMUONSt2GeometryBuilder::operator = (const AliMUONSt2GeometryBuilder& rhs)
76 // Protected assignement operator
78 // check assignement to self
79 if (this == &rhs) return *this;
81 AliFatal("Assignment operator is not implemented.");
90 //______________________________________________________________________________
91 void AliMUONSt2GeometryBuilder::CreateGeometry()
93 // From AliMUONv1::CreateGeometry()
96 //********************************************************************
98 //********************************************************************
99 // indices 1 and 2 for first and second chambers in the station
100 // iChamber (first chamber) kept for other quanties than Z,
101 // assumed to be the same in both chambers
103 // Get tracking medias Ids
104 Int_t *idtmed = fMUON->GetIdtmed()->GetArray()-1099;
105 Int_t idAir= idtmed[1100]; // medium 1
106 Int_t idAlu1=idtmed[1103]; // medium 4
107 Int_t idAlu2=idtmed[1104]; // medium 5
108 Int_t idGas=idtmed[1108]; // medium 9 = Ar-CO2 gas (80%+20%)
109 Bool_t frameCrosses=kTRUE;
111 // Rotation matrices in the x-y plane
114 fMUON->AliMatrix(irot1, 90., 0., 90., 90., 0., 0.);
117 fMUON->AliMatrix(irot2, 90., 90., 90., 180., 0., 0.);
119 AliMUONChamber* iChamber = &fMUON->Chamber(2);
120 AliMUONChamber* iChamber1 = iChamber;
121 AliMUONChamber* iChamber2 = &fMUON->Chamber(3);
123 // Half of the total thickness of frame crosses (including DAlu)
124 // for each chamber in stations 1 and 2:
125 // 3% of X0 of composite material,
126 // but taken as Aluminium here, with same thickness in number of X0
127 Float_t dframez = 3. * 8.9 / 100;
128 // DGas and DAlu not changed from standard values
129 Double_t zfpos=-(iChamber->DGas()+dframez+iChamber->DAlu())/2;
130 // The same parameters are defined in builder for station 1
133 // Outer excess and inner recess for mother volume radius
134 // with respect to ROuter and RInner
135 Float_t dframep=.001; // Value for station 3 should be 6 ...
136 // Width (RdPhi) of the frame crosses for stations 1 and 2 (cm)
137 // Float_t dframep1=.001;
138 Float_t phi=2*TMath::Pi()/12/2;
139 // The same parameters are defined in builder for station 1
142 Double_t dstation = (-iChamber2->Z()) - (-iChamber1->Z());
143 tpar[0] = iChamber->RInner()-dframep;
144 tpar[1] = (iChamber->ROuter()+dframep)/TMath::Cos(phi);
145 tpar[2] = dstation/5;
147 gMC->Gsvolu("S03M", "TUBE", idAir, tpar, 3);
148 gMC->Gsvolu("S04M", "TUBE", idAir, tpar, 3);
151 //gMC->Gspos("S03M", 1, "ALIC", 0., 0., zpos1 , 0, "ONLY");
152 //gMC->Gspos("S04M", 1, "ALIC", 0., 0., zpos2 , 0, "ONLY");
154 GetEnvelopes(2)->AddEnvelope("S03M", 300, false);
155 GetEnvelopes(3)->AddEnvelope("S04M", 400, false);
157 gMC->Gsbool("S03M", "L3DO");
158 gMC->Gsbool("S03M", "L3O1");
159 gMC->Gsbool("S03M", "L3O2");
160 gMC->Gsbool("S04M", "L3DO");
161 gMC->Gsbool("S04M", "L3O1");
162 gMC->Gsbool("S04M", "L3O2");
164 // // Aluminium frames
166 // pgpar[0] = 360/12/2;
170 // pgpar[4] = -dframez/2;
171 // pgpar[5] = iChamber->ROuter();
172 // pgpar[6] = pgpar[5]+dframep;
173 // pgpar[7] = +dframez/2;
174 // pgpar[8] = pgpar[5];
175 // pgpar[9] = pgpar[6];
176 // gMC->Gsvolu("S03O", "PGON", idAlu1, pgpar, 10);
177 // gMC->Gsvolu("S04O", "PGON", idAlu1, pgpar, 10);
178 // gMC->Gspos("S03O",1,"S03M", 0.,0.,-zfpos, 0,"ONLY");
179 // gMC->Gspos("S03O",2,"S03M", 0.,0.,+zfpos, 0,"ONLY");
180 // gMC->Gspos("S04O",1,"S04M", 0.,0.,-zfpos, 0,"ONLY");
181 // gMC->Gspos("S04O",2,"S04M", 0.,0.,+zfpos, 0,"ONLY");
184 // tpar[0]= iChamber->RInner()-dframep;
185 // tpar[1]= iChamber->RInner();
186 // tpar[2]= dframez/2;
187 // gMC->Gsvolu("S03I", "TUBE", idAlu1, tpar, 3);
188 // gMC->Gsvolu("S04I", "TUBE", idAlu1, tpar, 3);
190 // gMC->Gspos("S03I",1,"S03M", 0.,0.,-zfpos, 0,"ONLY");
191 // gMC->Gspos("S03I",2,"S03M", 0.,0.,+zfpos, 0,"ONLY");
192 // gMC->Gspos("S04I",1,"S04M", 0.,0.,-zfpos, 0,"ONLY");
193 // gMC->Gspos("S04I",2,"S04M", 0.,0.,+zfpos, 0,"ONLY");
198 // security for inside mother volume
201 Float_t dframep1 = 11.0;
202 Float_t dframez = 3. * 8.9 / 100;
205 bpar[0] = (iChamber->ROuter() - iChamber->RInner())
206 * TMath::Cos(TMath::ASin(dframep1 /
207 (iChamber->ROuter() - iChamber->RInner())))
209 bpar[1] = dframep1/2;
210 // total thickness will be (4 * bpar[2]) for each chamber,
211 // which has to be equal to (2 * dframez) - DAlu
212 bpar[2] = (2.0 * dframez - iChamber->DAlu()) / 4.0;
213 gMC->Gsvolu("S03B", "BOX", idAlu1, bpar, 3);
214 gMC->Gsvolu("S04B", "BOX", idAlu1, bpar, 3);
216 gMC->Gspos("S03B",1,"S03M", +iChamber->RInner()+bpar[0] , 0,-zfpos,
218 gMC->Gspos("S03B",2,"S03M", -iChamber->RInner()-bpar[0] , 0,-zfpos,
220 gMC->Gspos("S03B",3,"S03M", 0, +iChamber->RInner()+bpar[0] ,-zfpos,
222 gMC->Gspos("S03B",4,"S03M", 0, -iChamber->RInner()-bpar[0] ,-zfpos,
224 gMC->Gspos("S03B",5,"S03M", +iChamber->RInner()+bpar[0] , 0,+zfpos,
226 gMC->Gspos("S03B",6,"S03M", -iChamber->RInner()-bpar[0] , 0,+zfpos,
228 gMC->Gspos("S03B",7,"S03M", 0, +iChamber->RInner()+bpar[0] ,+zfpos,
230 gMC->Gspos("S03B",8,"S03M", 0, -iChamber->RInner()-bpar[0] ,+zfpos,
233 gMC->Gspos("S04B",1,"S04M", +iChamber->RInner()+bpar[0] , 0,-zfpos,
235 gMC->Gspos("S04B",2,"S04M", -iChamber->RInner()-bpar[0] , 0,-zfpos,
237 gMC->Gspos("S04B",3,"S04M", 0, +iChamber->RInner()+bpar[0] ,-zfpos,
239 gMC->Gspos("S04B",4,"S04M", 0, -iChamber->RInner()-bpar[0] ,-zfpos,
241 gMC->Gspos("S04B",5,"S04M", +iChamber->RInner()+bpar[0] , 0,+zfpos,
243 gMC->Gspos("S04B",6,"S04M", -iChamber->RInner()-bpar[0] , 0,+zfpos,
245 gMC->Gspos("S04B",7,"S04M", 0, +iChamber->RInner()+bpar[0] ,+zfpos,
247 gMC->Gspos("S04B",8,"S04M", 0, -iChamber->RInner()-bpar[0] ,+zfpos,
251 // Chamber Material represented by Alu sheet
252 tpar[0]= iChamber->RInner();
253 tpar[1]= iChamber->ROuter();
254 tpar[2] = (iChamber->DGas()+iChamber->DAlu())/2;
255 gMC->Gsvolu("S03A", "TUBE", idAlu2, tpar, 3);
256 gMC->Gsvolu("S04A", "TUBE", idAlu2, tpar, 3);
257 gMC->Gspos("S03A", 1, "S03M", 0., 0., 0., 0, "ONLY");
258 gMC->Gspos("S04A", 1, "S04M", 0., 0., 0., 0, "ONLY");
261 // tpar[2] = iChamber->DGas();
262 tpar[2] = iChamber->DGas()/2;
263 gMC->Gsvolu("S03G", "TUBE", idGas, tpar, 3);
264 gMC->Gsvolu("S04G", "TUBE", idGas, tpar, 3);
265 gMC->Gspos("S03G", 1, "S03A", 0., 0., 0., 0, "ONLY");
266 gMC->Gspos("S04G", 1, "S04A", 0., 0., 0., 0, "ONLY");
268 // Frame Crosses to be placed inside gas
269 // NONE: chambers are sensitive everywhere
270 // if (frameCrosses) {
272 // dr = (iChamber->ROuter() - iChamber->RInner());
273 // bpar[0] = TMath::Sqrt(dr*dr-dframep1*dframep1/4)/2;
274 // bpar[1] = dframep1/2;
275 // bpar[2] = iChamber->DGas()/2;
276 // gMC->Gsvolu("S03F", "BOX", idAlu1, bpar, 3);
277 // gMC->Gsvolu("S04F", "BOX", idAlu1, bpar, 3);
279 // gMC->Gspos("S03F",1,"S03G", +iChamber->RInner()+bpar[0] , 0, 0,
281 // gMC->Gspos("S03F",2,"S03G", -iChamber->RInner()-bpar[0] , 0, 0,
283 // gMC->Gspos("S03F",3,"S03G", 0, +iChamber->RInner()+bpar[0] , 0,
285 // gMC->Gspos("S03F",4,"S03G", 0, -iChamber->RInner()-bpar[0] , 0,
288 // gMC->Gspos("S04F",1,"S04G", +iChamber->RInner()+bpar[0] , 0, 0,
290 // gMC->Gspos("S04F",2,"S04G", -iChamber->RInner()-bpar[0] , 0, 0,
292 // gMC->Gspos("S04F",3,"S04G", 0, +iChamber->RInner()+bpar[0] , 0,
294 // gMC->Gspos("S04F",4,"S04G", 0, -iChamber->RInner()-bpar[0] , 0,
298 iChamber1 = iChamber = (AliMUONChamber*) (*fChambers)[2];
299 iChamber2 =(AliMUONChamber*) (*fChambers)[3];
300 zpos1=iChamber1->Z();
301 zpos2=iChamber2->Z();
302 dstation = zpos2 - zpos1;
303 // DGas and DAlu not changed from standard values
304 zfpos=-(iChamber->DGas()+dframez+iChamber->DAlu())/2;
308 tpar[0] = iChamber->RInner()-dframep;
309 tpar[1] = (iChamber->ROuter()+dframep)/TMath::Cos(phi);
310 tpar[2] = dstation/5;
312 gMC->Gsvolu("S03M", "TUBE", idAir, tpar, 3);
313 gMC->Gsvolu("S04M", "TUBE", idAir, tpar, 3);
314 gMC->Gspos("S03M", 1, "ALIC", 0., 0., zpos1 , 0, "ONLY");
315 gMC->Gspos("S04M", 1, "ALIC", 0., 0., zpos2 , 0, "ONLY");
316 gMC->Gsbool("S03M", "L3DO");
317 gMC->Gsbool("S03M", "L3O1");
318 gMC->Gsbool("S03M", "L3O2");
319 gMC->Gsbool("S04M", "L3DO");
320 gMC->Gsbool("S04M", "L3O1");
321 gMC->Gsbool("S04M", "L3O2");
323 // // Aluminium frames
325 // pgpar[0] = 360/12/2;
329 // pgpar[4] = -dframez/2;
330 // pgpar[5] = iChamber->ROuter();
331 // pgpar[6] = pgpar[5]+dframep;
332 // pgpar[7] = +dframez/2;
333 // pgpar[8] = pgpar[5];
334 // pgpar[9] = pgpar[6];
335 // gMC->Gsvolu("S03O", "PGON", idAlu1, pgpar, 10);
336 // gMC->Gsvolu("S04O", "PGON", idAlu1, pgpar, 10);
337 // gMC->Gspos("S03O",1,"S03M", 0.,0.,-zfpos, 0,"ONLY");
338 // gMC->Gspos("S03O",2,"S03M", 0.,0.,+zfpos, 0,"ONLY");
339 // gMC->Gspos("S04O",1,"S04M", 0.,0.,-zfpos, 0,"ONLY");
340 // gMC->Gspos("S04O",2,"S04M", 0.,0.,+zfpos, 0,"ONLY");
343 // tpar[0]= iChamber->RInner()-dframep;
344 // tpar[1]= iChamber->RInner();
345 // tpar[2]= dframez/2;
346 // gMC->Gsvolu("S03I", "TUBE", idAlu1, tpar, 3);
347 // gMC->Gsvolu("S04I", "TUBE", idAlu1, tpar, 3);
349 // gMC->Gspos("S03I",1,"S03M", 0.,0.,-zfpos, 0,"ONLY");
350 // gMC->Gspos("S03I",2,"S03M", 0.,0.,+zfpos, 0,"ONLY");
351 // gMC->Gspos("S04I",1,"S04M", 0.,0.,-zfpos, 0,"ONLY");
352 // gMC->Gspos("S04I",2,"S04M", 0.,0.,+zfpos, 0,"ONLY");
357 // security for inside mother volume
358 bpar[0] = (iChamber->ROuter() - iChamber->RInner())
359 * TMath::Cos(TMath::ASin(dframep1 /
360 (iChamber->ROuter() - iChamber->RInner())))
362 bpar[1] = dframep1/2;
363 // total thickness will be (4 * bpar[2]) for each chamber,
364 // which has to be equal to (2 * dframez) - DAlu
365 bpar[2] = (2.0 * dframez - iChamber->DAlu()) / 4.0;
366 gMC->Gsvolu("S03B", "BOX", idAlu1, bpar, 3);
367 gMC->Gsvolu("S04B", "BOX", idAlu1, bpar, 3);
369 gMC->Gspos("S03B",1,"S03M", +iChamber->RInner()+bpar[0] , 0,-zfpos,
371 gMC->Gspos("S03B",2,"S03M", -iChamber->RInner()-bpar[0] , 0,-zfpos,
373 gMC->Gspos("S03B",3,"S03M", 0, +iChamber->RInner()+bpar[0] ,-zfpos,
375 gMC->Gspos("S03B",4,"S03M", 0, -iChamber->RInner()-bpar[0] ,-zfpos,
377 gMC->Gspos("S03B",5,"S03M", +iChamber->RInner()+bpar[0] , 0,+zfpos,
379 gMC->Gspos("S03B",6,"S03M", -iChamber->RInner()-bpar[0] , 0,+zfpos,
381 gMC->Gspos("S03B",7,"S03M", 0, +iChamber->RInner()+bpar[0] ,+zfpos,
383 gMC->Gspos("S03B",8,"S03M", 0, -iChamber->RInner()-bpar[0] ,+zfpos,
386 gMC->Gspos("S04B",1,"S04M", +iChamber->RInner()+bpar[0] , 0,-zfpos,
388 gMC->Gspos("S04B",2,"S04M", -iChamber->RInner()-bpar[0] , 0,-zfpos,
390 gMC->Gspos("S04B",3,"S04M", 0, +iChamber->RInner()+bpar[0] ,-zfpos,
392 gMC->Gspos("S04B",4,"S04M", 0, -iChamber->RInner()-bpar[0] ,-zfpos,
394 gMC->Gspos("S04B",5,"S04M", +iChamber->RInner()+bpar[0] , 0,+zfpos,
396 gMC->Gspos("S04B",6,"S04M", -iChamber->RInner()-bpar[0] , 0,+zfpos,
398 gMC->Gspos("S04B",7,"S04M", 0, +iChamber->RInner()+bpar[0] ,+zfpos,
400 gMC->Gspos("S04B",8,"S04M", 0, -iChamber->RInner()-bpar[0] ,+zfpos,
404 // Chamber Material represented by Alu sheet
405 tpar[0]= iChamber->RInner();
406 tpar[1]= iChamber->ROuter();
407 tpar[2] = (iChamber->DGas()+iChamber->DAlu())/2;
408 gMC->Gsvolu("S03A", "TUBE", idAlu2, tpar, 3);
409 gMC->Gsvolu("S04A", "TUBE", idAlu2, tpar, 3);
410 gMC->Gspos("S03A", 1, "S03M", 0., 0., 0., 0, "ONLY");
411 gMC->Gspos("S04A", 1, "S04M", 0., 0., 0., 0, "ONLY");
414 // tpar[2] = iChamber->DGas();
415 tpar[2] = iChamber->DGas()/2;
416 gMC->Gsvolu("S03G", "TUBE", idGas, tpar, 3);
417 gMC->Gsvolu("S04G", "TUBE", idGas, tpar, 3);
418 gMC->Gspos("S03G", 1, "S03A", 0., 0., 0., 0, "ONLY");
419 gMC->Gspos("S04G", 1, "S04A", 0., 0., 0., 0, "ONLY");
421 // Frame Crosses to be placed inside gas
422 // NONE: chambers are sensitive everywhere
423 // if (frameCrosses) {
425 // dr = (iChamber->ROuter() - iChamber->RInner());
426 // bpar[0] = TMath::Sqrt(dr*dr-dframep1*dframep1/4)/2;
427 // bpar[1] = dframep1/2;
428 // bpar[2] = iChamber->DGas()/2;
429 // gMC->Gsvolu("S03F", "BOX", idAlu1, bpar, 3);
430 // gMC->Gsvolu("S04F", "BOX", idAlu1, bpar, 3);
432 // gMC->Gspos("S03F",1,"S03G", +iChamber->RInner()+bpar[0] , 0, 0,
434 // gMC->Gspos("S03F",2,"S03G", -iChamber->RInner()-bpar[0] , 0, 0,
436 // gMC->Gspos("S03F",3,"S03G", 0, +iChamber->RInner()+bpar[0] , 0,
438 // gMC->Gspos("S03F",4,"S03G", 0, -iChamber->RInner()-bpar[0] , 0,
441 // gMC->Gspos("S04F",1,"S04G", +iChamber->RInner()+bpar[0] , 0, 0,
443 // gMC->Gspos("S04F",2,"S04G", -iChamber->RInner()-bpar[0] , 0, 0,
445 // gMC->Gspos("S04F",3,"S04G", 0, +iChamber->RInner()+bpar[0] , 0,
447 // gMC->Gspos("S04F",4,"S04G", 0, -iChamber->RInner()-bpar[0] , 0,
454 //______________________________________________________________________________
455 void AliMUONSt2GeometryBuilder::SetTransformations()
457 // Defines the transformations for the station2 chambers.
460 AliMUONChamber* iChamber1 = &fMUON->Chamber(2);
461 Double_t zpos1 = - iChamber1->Z();
462 iChamber1->GetGeometry()
463 ->SetTranslation(TGeoTranslation(0., 0., zpos1));
465 AliMUONChamber* iChamber2 = &fMUON->Chamber(3);
466 Double_t zpos2 = - iChamber2->Z();
467 iChamber2->GetGeometry()
468 ->SetTranslation(TGeoTranslation(0., 0., zpos2));
471 //______________________________________________________________________________
472 void AliMUONSt2GeometryBuilder::SetSensitiveVolumes()
474 // Defines the sensitive volumes for station2 chambers.
477 GetGeometry(2)->SetSensitiveVolume("S03G");
478 GetGeometry(3)->SetSensitiveVolume("S04G");