1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * SigmaEffect_thetadegrees *
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 purpeateose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 // Class AliMUONGeometryBuilder
19 // ----------------------------
20 // MUON manager class for geometry construction,
21 // separated form AliMUONv1
23 // Author: Ivana Hrivnacova, IPN Orsay
25 #include <TClonesArray.h>
26 #include <TGeoMatrix.h>
27 #include <TVirtualMC.h>
29 #include "AliMUONGeometryBuilder.h"
31 #include "AliMUONChamber.h"
32 #include "AliMUONConstants.h"
33 #include "AliMUONVGeometryBuilder.h"
34 #include "AliMUONChamberGeometry.h"
35 #include "AliMUONGeometryEnvelope.h"
36 #include "AliMUONGeometryConstituent.h"
40 ClassImp(AliMUONGeometryBuilder)
42 //______________________________________________________________________________//___________________________________________
43 AliMUONGeometryBuilder::AliMUONGeometryBuilder()
46 fGlobalTransformation(0),
49 // Default constructor
52 //______________________________________________________________________________//___________________________________________
53 AliMUONGeometryBuilder::AliMUONGeometryBuilder(AliMUON* muon)
56 fGlobalTransformation(0),
59 // Standars constructor
61 // Define the global transformation:
62 // Transformation from the old ALICE coordinate system to a new one:
64 TGeoRotation* rotGlobal
65 = new TGeoRotation("rotGlobal", 90., 180., 90., 90., 180., 0.);
66 fGlobalTransformation = new TGeoCombiTrans(0., 0., 0., rotGlobal);
68 fGeometryBuilders = new TObjArray(AliMUONConstants::NCh());
71 //______________________________________________________________________________
72 AliMUONGeometryBuilder::AliMUONGeometryBuilder(const AliMUONGeometryBuilder& right)
75 // copy constructor (not implemented)
77 Fatal("AliMUONGeometryBuilder", "Copy constructor not provided.");
80 //______________________________________________________________________________
81 AliMUONGeometryBuilder::~AliMUONGeometryBuilder()
85 delete fGlobalTransformation;
87 if (fGeometryBuilders){
88 fGeometryBuilders->Delete();
89 delete fGeometryBuilders;
93 //______________________________________________________________________________
94 AliMUONGeometryBuilder&
95 AliMUONGeometryBuilder::operator=(const AliMUONGeometryBuilder& right)
97 // assignement operator (not implemented)
99 // check assignement to self
100 if (this == &right) return *this;
102 Fatal("operator =", "Assignement operator not provided.");
111 //______________________________________________________________________________
112 void AliMUONGeometryBuilder::PlaceVolume(const TString& name, const TString& mName,
113 Int_t copyNo, const TGeoHMatrix& matrix,
114 Int_t npar, Double_t* param, const char* only) const
116 // Place the volume specified by name with the given transformation matrix
119 // Do not apply global transformation
120 // if mother volume == DDIP
121 // (as it is applied on this volume)
122 TGeoHMatrix transform(matrix);
123 if (mName == TString("DDIP")) {
124 transform = (*fGlobalTransformation) * transform;
125 // To be changed to (*fGlobalTransformation).inverse()
126 // when available in TGeo
127 // To make this correct also for a general case when
128 // (*fGlobalTransformation) * *fGlobalTransformation) != 1
131 // Decompose transformation
132 const Double_t* xyz = transform.GetTranslation();
133 const Double_t* rm = transform.GetRotationMatrix();
135 //cout << "Got translation: "
136 // << xyz[0] << " " << xyz[1] << " " << xyz[2] << endl;
138 //cout << "Got rotation: "
139 // << rm[0] << " " << rm[1] << " " << rm[2] << endl
140 // << rm[3] << " " << rm[4] << " " << rm[5] << endl
141 // << rm[6] << " " << rm[7] << " " << rm[8] << endl;
143 // Check for presence of rotation
144 // (will be nice to be available in TGeo)
145 const Double_t kTolerance = 1e-04;
146 Bool_t isRotation = true;
147 if (TMath::Abs(rm[0] - 1.) < kTolerance &&
148 TMath::Abs(rm[1] - 0.) < kTolerance &&
149 TMath::Abs(rm[2] - 0.) < kTolerance &&
150 TMath::Abs(rm[3] - 0.) < kTolerance &&
151 TMath::Abs(rm[4] - 1.) < kTolerance &&
152 TMath::Abs(rm[5] - 0.) < kTolerance &&
153 TMath::Abs(rm[6] - 0.) < kTolerance &&
154 TMath::Abs(rm[7] - 0.) < kTolerance &&
155 TMath::Abs(rm[8] - 1.) < kTolerance) isRotation = false;
160 rot.SetMatrix(const_cast<Double_t*>(transform.GetRotationMatrix()));
161 Double_t theta1, phi1, theta2, phi2, theta3, phi3;
162 rot.GetAngles(theta1, phi1, theta2, phi2, theta3, phi3);
165 // << theta1 << " " << phi1 << " "
166 // << theta2 << " " << phi2 << " "
167 // << theta3 << " " << phi3 << endl;
169 fMUON->AliMatrix(krot, theta1, phi1, theta2, phi2, theta3, phi3);
172 // Place the volume in ALIC
174 gMC->Gspos(name, copyNo, mName, xyz[0], xyz[1], xyz[2] , krot, only);
176 gMC->Gsposp(name, copyNo, mName, xyz[0], xyz[1], xyz[2] , krot, only,
185 //______________________________________________________________________________
186 void AliMUONGeometryBuilder::CreateGeometry()
189 // Construct geometry using geometry builders.
192 for (Int_t i=0; i<fGeometryBuilders->GetEntriesFast(); i++) {
195 AliMUONVGeometryBuilder* builder
196 = (AliMUONVGeometryBuilder*)fGeometryBuilders->At(i);
198 // Create geometry with each builder
200 builder->CreateGeometry();
201 builder->SetTransformations();
205 for (Int_t j=0; j<AliMUONConstants::NCh(); j++) {
207 AliMUONChamberGeometry* geometry = fMUON->Chamber(j).GetGeometry();
209 if (!geometry) continue;
210 // Skip chambers with not defined geometry
212 // Loop over envelopes
213 const TObjArray* kEnvelopes = geometry->GetEnvelopes();
214 for (Int_t k=0; k<kEnvelopes->GetEntriesFast(); k++) {
217 AliMUONGeometryEnvelope* env = (AliMUONGeometryEnvelope*)kEnvelopes->At(k);
218 const TGeoCombiTrans* kEnvTrans = env->GetTransformation();
219 const char* only = "ONLY";
220 if (env->IsMANY()) only = "MANY";
222 if (env->IsVirtual() && env->GetConstituents()->GetEntriesFast() == 0 ) {
223 // virtual envelope + nof constituents = 0
225 // empty virtual envelope has no sense
226 Fatal("CreateGeometry", "Virtual envelope must have constituents.");
230 if (!env->IsVirtual() && env->GetConstituents()->GetEntriesFast() > 0 ) {
231 // non virtual envelope + nof constituents > 0
233 // use VMC to place constituents
234 Fatal("CreateGeometry", "Non virtual envelope cannot have constituents.");
238 if (!env->IsVirtual() && env->GetConstituents()->GetEntriesFast() == 0 ) {
239 // non virtual envelope + nof constituents = 0
240 // => place envelope in ALICE by composed transformation:
241 // Tglobal * Tch * Tenv
243 // Compound chamber transformation with the envelope one
245 = (*fGlobalTransformation) *
246 (*geometry->GetTransformation()) *
248 PlaceVolume(env->GetName(), geometry->GetMotherVolume(),
249 env->GetCopyNo(), total, 0, 0, only);
252 if (env->IsVirtual() && env->GetConstituents()->GetEntriesFast() > 0 ) {
253 // virtual envelope + nof constituents > 0
254 // => do not place envelope and place constituents
255 // in ALICE by composed transformation:
256 // Tglobal * Tch * Tenv * Tconst
258 for (Int_t l=0; l<env->GetConstituents()->GetEntriesFast(); l++) {
259 AliMUONGeometryConstituent* constituent
260 = (AliMUONGeometryConstituent*)env->GetConstituents()->At(l);
262 // Compound chamber transformation with the envelope one + the constituent one
264 = (*fGlobalTransformation) *
265 (*geometry->GetTransformation()) *
267 (*constituent->GetTransformation());
269 PlaceVolume(constituent->GetName(), geometry->GetMotherVolume(),
270 constituent->GetCopyNo(), total,
271 constituent->GetNpar(), constituent->GetParam(), only);
278 //_____________________________________________________________________________
279 void AliMUONGeometryBuilder::CreateMaterials()
281 // Definition of common materials
285 // Ar-CO2 gas (80%+20%)
286 Float_t ag1[3] = { 39.95,12.01,16. };
287 Float_t zg1[3] = { 18.,6.,8. };
288 Float_t wg1[3] = { .8,.0667,.13333 };
289 Float_t dg1 = .001821;
291 // Ar-buthane-freon gas -- trigger chambers
292 Float_t atr1[4] = { 39.95,12.01,1.01,19. };
293 Float_t ztr1[4] = { 18.,6.,1.,9. };
294 Float_t wtr1[4] = { .56,.1262857,.2857143,.028 };
295 Float_t dtr1 = .002599;
298 Float_t agas[3] = { 39.95,12.01,16. };
299 Float_t zgas[3] = { 18.,6.,8. };
300 Float_t wgas[3] = { .74,.086684,.173316 };
301 Float_t dgas = .0018327;
303 // Ar-Isobutane gas (80%+20%) -- tracking
304 Float_t ag[3] = { 39.95,12.01,1.01 };
305 Float_t zg[3] = { 18.,6.,1. };
306 Float_t wg[3] = { .8,.057,.143 };
307 Float_t dg = .0019596;
309 // Ar-Isobutane-Forane-SF6 gas (49%+7%+40%+4%) -- trigger
310 Float_t atrig[5] = { 39.95,12.01,1.01,19.,32.066 };
311 Float_t ztrig[5] = { 18.,6.,1.,9.,16. };
312 Float_t wtrig[5] = { .49,1.08,1.5,1.84,0.04 };
313 Float_t dtrig = .0031463;
317 Float_t abak[3] = {12.01 , 1.01 , 16.};
318 Float_t zbak[3] = {6. , 1. , 8.};
319 Float_t wbak[3] = {6. , 6. , 1.};
322 Int_t iSXFLD = gAlice->Field()->Integ();
323 Float_t sXMGMX = gAlice->Field()->Max();
325 // --- Define the various materials for GEANT ---
326 fMUON->AliMaterial(9, "ALUMINIUM$", 26.98, 13., 2.7, 8.9, 37.2);
327 fMUON->AliMaterial(10, "ALUMINIUM$", 26.98, 13., 2.7, 8.9, 37.2);
329 Float_t aAir[4]={12.0107,14.0067,15.9994,39.948};
330 Float_t zAir[4]={6.,7.,8.,18.};
331 Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};
332 Float_t dAir = 1.20479E-3;
333 fMUON->AliMixture(15, "AIR$ ", aAir, zAir, dAir,4, wAir);
334 // fMUON->AliMaterial(15, "AIR$ ", 14.61, 7.3, .001205, 30423.24, 67500);
335 fMUON->AliMixture(19, "Bakelite$", abak, zbak, dbak, -3, wbak);
336 fMUON->AliMixture(20, "ArC4H10 GAS$", ag, zg, dg, 3, wg);
337 fMUON->AliMixture(21, "TRIG GAS$", atrig, ztrig, dtrig, -5, wtrig);
338 fMUON->AliMixture(22, "ArCO2 80%$", ag1, zg1, dg1, 3, wg1);
339 fMUON->AliMixture(23, "Ar-freon $", atr1, ztr1, dtr1, 4, wtr1);
340 fMUON->AliMixture(24, "ArCO2 GAS$", agas, zgas, dgas, 3, wgas);
341 // materials for slat:
342 // Sensitive area: gas (already defined)
344 // insulating material and frame: vetronite
345 // walls: carbon, rohacell, carbon
346 Float_t aglass[5]={12.01, 28.09, 16., 10.8, 23.};
347 Float_t zglass[5]={ 6., 14., 8., 5., 11.};
348 Float_t wglass[5]={ 0.5, 0.105, 0.355, 0.03, 0.01};
351 // rohacell: C9 H13 N1 O2
352 Float_t arohac[4] = {12.01, 1.01, 14.010, 16.};
353 Float_t zrohac[4] = { 6., 1., 7., 8.};
354 Float_t wrohac[4] = { 9., 13., 1., 2.};
355 Float_t drohac = 0.03;
357 fMUON->AliMaterial(31, "COPPER$", 63.54, 29., 8.96, 1.4, 0.);
358 fMUON->AliMixture(32, "Vetronite$",aglass, zglass, dglass, 5, wglass);
359 fMUON->AliMaterial(33, "Carbon$", 12.01, 6., 2.265, 18.8, 49.9);
360 fMUON->AliMixture(34, "Rohacell$", arohac, zrohac, drohac, -4, wrohac);
362 Float_t epsil = .001; // Tracking precision,
363 Float_t stemax = -1.; // Maximum displacement for multiple scat
364 Float_t tmaxfd = -20.; // Maximum angle due to field deflection
365 Float_t deemax = -.3; // Maximum fractional energy loss, DLS
367 Float_t maxDestepAlu = fMUON->GetMaxDestepAlu();
368 Float_t maxDestepGas = fMUON->GetMaxDestepGas();
369 Float_t maxStepAlu = fMUON->GetMaxStepAlu();
370 Float_t maxStepGas = fMUON->GetMaxStepGas();
374 fMUON->AliMedium(1, "AIR_CH_US ", 15, 1, iSXFLD, sXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
378 fMUON->AliMedium(4, "ALU_CH_US ", 9, 0, iSXFLD, sXMGMX, tmaxfd, maxStepAlu,
379 maxDestepAlu, epsil, stmin);
380 fMUON->AliMedium(5, "ALU_CH_US ", 10, 0, iSXFLD, sXMGMX, tmaxfd, maxStepAlu,
381 maxDestepAlu, epsil, stmin);
385 fMUON->AliMedium(6, "AR_CH_US ", 20, 1, iSXFLD, sXMGMX, tmaxfd, maxStepGas,
386 maxDestepGas, epsil, stmin);
388 // Ar-Isobuthane-Forane-SF6 gas
390 fMUON->AliMedium(7, "GAS_CH_TRIGGER ", 21, 1, iSXFLD, sXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
392 fMUON->AliMedium(8, "BAKE_CH_TRIGGER ", 19, 0, iSXFLD, sXMGMX, tmaxfd, maxStepAlu,
393 maxDestepAlu, epsil, stmin);
395 fMUON->AliMedium(9, "ARG_CO2 ", 22, 1, iSXFLD, sXMGMX, tmaxfd, maxStepGas,
396 maxDestepAlu, epsil, stmin);
397 // tracking media for slats: check the parameters!!
398 fMUON->AliMedium(11, "PCB_COPPER ", 31, 0, iSXFLD, sXMGMX, tmaxfd,
399 maxStepAlu, maxDestepAlu, epsil, stmin);
400 fMUON->AliMedium(12, "VETRONITE ", 32, 0, iSXFLD, sXMGMX, tmaxfd,
401 maxStepAlu, maxDestepAlu, epsil, stmin);
402 fMUON->AliMedium(13, "CARBON ", 33, 0, iSXFLD, sXMGMX, tmaxfd,
403 maxStepAlu, maxDestepAlu, epsil, stmin);
404 fMUON->AliMedium(14, "Rohacell ", 34, 0, iSXFLD, sXMGMX, tmaxfd,
405 maxStepAlu, maxDestepAlu, epsil, stmin);
409 //.Materials specific to stations
410 // created via builders
412 for (Int_t i=0; i<fGeometryBuilders->GetEntriesFast(); i++) {
415 AliMUONVGeometryBuilder* builder
416 = (AliMUONVGeometryBuilder*)fGeometryBuilders->At(i);
418 // Create materials with each builder
419 if (builder) builder->CreateMaterials();
423 //______________________________________________________________________________
424 void AliMUONGeometryBuilder::InitGeometry()
426 // Initialize geometry
430 // Set the chamber (sensitive region) GEANT identifier
432 for (Int_t i=0; i<fGeometryBuilders->GetEntriesFast(); i++) {
435 AliMUONVGeometryBuilder* builder
436 = (AliMUONVGeometryBuilder*)fGeometryBuilders->At(i);
438 // Set sesitive volumes with each builder
439 if (builder) builder->SetSensitiveVolumes();
443 //_____________________________________________________________________________
444 void AliMUONGeometryBuilder::AddBuilder(AliMUONVGeometryBuilder* geomBuilder)
446 // Adds the geometry builder to the list
449 fGeometryBuilders->Add(geomBuilder);