- In CreateGeometry() - virtual modules and envelopes placed
[u/mrichter/AliRoot.git] / MUON / AliMUONGeometryBuilder.cxx
CommitLineData
d4bb94a1 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. *
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 purpeateose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16// $Id$
17//
18// Class AliMUONGeometryBuilder
19// ----------------------------
e118b27e 20// Manager class for geometry construction via geometry builders.
d4bb94a1 21//
22// Author: Ivana Hrivnacova, IPN Orsay
23
d4bb94a1 24#include "AliMUONGeometryBuilder.h"
d4bb94a1 25#include "AliMUONVGeometryBuilder.h"
6cfb12b4 26#include "AliMUONGeometry.h"
27#include "AliMUONGeometryTransformer.h"
e118b27e 28#include "AliMUONGeometryModule.h"
6cfb12b4 29#include "AliMUONGeometryModuleTransformer.h"
d4bb94a1 30#include "AliMUONGeometryEnvelope.h"
76497dec 31#include "AliMUONGeometryEnvelopeStore.h"
e118b27e 32#include "AliMUONGeometryDetElement.h"
33#include "AliMUONGeometryStore.h"
6cfb12b4 34#include "AliMUONGeometryConstituent.h"
08086cd0 35
e118b27e 36#include "AliModule.h"
8c343c7c 37#include "AliLog.h"
4a9de4af 38#include "AliRun.h"
39
08086cd0 40#include <TObjArray.h>
41#include <TVirtualMC.h>
42#include <TGeoManager.h>
43
d4bb94a1 44
45ClassImp(AliMUONGeometryBuilder)
eea63c73 46
47// static data members
d4bb94a1 48
08086cd0 49const TString AliMUONGeometryBuilder::fgkDefaultVolPathsFileName = "volpath.dat";
eea63c73 50const TString AliMUONGeometryBuilder::fgkDefaultTransformFileName = "transform.dat";
51const TString AliMUONGeometryBuilder::fgkDefaultSVMapFileName = "svmap.dat";
52const TString AliMUONGeometryBuilder::fgkOutFileNameExtension = ".out";
53
067866a3 54// static functions
55
56//______________________________________________________________________________
57TGeoHMatrix AliMUONGeometryBuilder::Multiply(const TGeoMatrix& m1,
58 const TGeoMatrix& m2)
59{
60/// Temporary fix for problem with matrix multiplication in Root 5.02/00
61
62 if (m1.IsIdentity() && m2.IsIdentity()) return TGeoHMatrix();
63
64 if (m1.IsIdentity()) return m2;
65
66 if (m2.IsIdentity()) return m1;
67
68 return m1 * m2;
69}
70
71//______________________________________________________________________________
72TGeoHMatrix AliMUONGeometryBuilder::Multiply(const TGeoMatrix& m1,
73 const TGeoMatrix& m2,
74 const TGeoMatrix& m3)
75{
76/// Temporary fix for problem with matrix multiplication in Root 5.02/00
77
78 if (m1.IsIdentity() && m2.IsIdentity() & m3.IsIdentity())
79 return TGeoHMatrix();
80
81 if (m1.IsIdentity()) return Multiply(m2, m3);
82
83 if (m2.IsIdentity()) return Multiply(m1, m3);
84
85 if (m3.IsIdentity()) return Multiply(m1, m2);
86
87 return m1 * m2 * m3;
88}
89
90//______________________________________________________________________________
91TGeoHMatrix AliMUONGeometryBuilder::Multiply(const TGeoMatrix& m1,
92 const TGeoMatrix& m2,
93 const TGeoMatrix& m3,
94 const TGeoMatrix& m4)
95{
96/// Temporary fix for problem with matrix multiplication in Root 5.02/00
97
98 if (m1.IsIdentity() && m2.IsIdentity() & m3.IsIdentity() & m4.IsIdentity())
99 return TGeoHMatrix();
100
101 if (m1.IsIdentity()) return Multiply(m2, m3, m4);
102
103 if (m2.IsIdentity()) return Multiply(m1, m3, m4);
104
105 if (m3.IsIdentity()) return Multiply(m1, m2, m4);
106
107 if (m4.IsIdentity()) return Multiply(m1, m2, m3);
108
109 return m1 * m2 * m3 * m4;
110}
111
e118b27e 112//______________________________________________________________________________
113AliMUONGeometryBuilder::AliMUONGeometryBuilder(AliModule* module)
d4bb94a1 114 : TObject(),
e118b27e 115 fModule(module),
76497dec 116 fAlign(false),
eea63c73 117 fTransformFileName(fgkDefaultTransformFileName),
118 fSVMapFileName(fgkDefaultSVMapFileName),
e118b27e 119 fGlobalTransformation(),
6cfb12b4 120 fGeometryBuilders(0),
121 fGeometry(0)
d4bb94a1 122{
692de412 123/// Standard constructor
e118b27e 124
6cfb12b4 125 fGeometryBuilders = new TObjArray();
126 fGeometryBuilders->SetOwner(true);
127
128 fGeometry = new AliMUONGeometry(true);
129
130 // Define the global transformation:
131 // Transformation from the old ALICE coordinate system to a new one:
132 // x->-x, z->-z
133 TGeoRotation* rotGlobal
134 = new TGeoRotation("rotGlobal", 90., 180., 90., 90., 180., 0.);
135 fGlobalTransformation = TGeoCombiTrans(0., 0., 0., rotGlobal);
e118b27e 136}
d4bb94a1 137
e118b27e 138//______________________________________________________________________________
139AliMUONGeometryBuilder::AliMUONGeometryBuilder()
d4bb94a1 140 : TObject(),
e118b27e 141 fModule(0),
76497dec 142 fAlign(false),
eea63c73 143 fTransformFileName(),
144 fSVMapFileName(),
e118b27e 145 fGlobalTransformation(),
6cfb12b4 146 fGeometryBuilders(0),
147 fGeometry(0)
d4bb94a1 148{
692de412 149/// Default constructor
e118b27e 150}
d4bb94a1 151
152//______________________________________________________________________________
153AliMUONGeometryBuilder::AliMUONGeometryBuilder(const AliMUONGeometryBuilder& right)
154 : TObject(right)
155{
692de412 156/// Copy constructor (not implemented)
d4bb94a1 157
8c343c7c 158 AliFatal("Copy constructor not provided.");
d4bb94a1 159}
160
161//______________________________________________________________________________
162AliMUONGeometryBuilder::~AliMUONGeometryBuilder()
163{
692de412 164/// Destructor
6cfb12b4 165
166 delete fGeometryBuilders;
167 delete fGeometry;
d4bb94a1 168}
169
170//______________________________________________________________________________
171AliMUONGeometryBuilder&
172AliMUONGeometryBuilder::operator=(const AliMUONGeometryBuilder& right)
173{
692de412 174/// Assignement operator (not implemented)
d4bb94a1 175
176 // check assignement to self
177 if (this == &right) return *this;
178
8c343c7c 179 AliFatal("Assignement operator not provided.");
d4bb94a1 180
181 return *this;
182}
183
184//
185// private functions
186//
187
188//______________________________________________________________________________
189void AliMUONGeometryBuilder::PlaceVolume(const TString& name, const TString& mName,
190 Int_t copyNo, const TGeoHMatrix& matrix,
08086cd0 191 Int_t npar, Double_t* param, const char* only,
192 Bool_t makeAssembly) const
d4bb94a1 193{
692de412 194/// Place the volume specified by name with the given transformation matrix
d4bb94a1 195
08086cd0 196 if (makeAssembly)
197 gGeoManager->MakeVolumeAssembly(name.Data());
198
6cfb12b4 199 TGeoHMatrix transform(matrix);
d4bb94a1 200 // Do not apply global transformation
cfbf2f7d 201 // if mother volume was already placed in
202 // the new system of coordinates (that is MUON in negative Z)
e118b27e 203 // (as it is applied on the mother volume)
cfbf2f7d 204 if (mName == TString("DDIP"))
e118b27e 205 transform = fGlobalTransformation.Inverse() * transform;
d4bb94a1 206
207 // Decompose transformation
208 const Double_t* xyz = transform.GetTranslation();
209 const Double_t* rm = transform.GetRotationMatrix();
210
211 //cout << "Got translation: "
212 // << xyz[0] << " " << xyz[1] << " " << xyz[2] << endl;
213
214 //cout << "Got rotation: "
215 // << rm[0] << " " << rm[1] << " " << rm[2] << endl
216 // << rm[3] << " " << rm[4] << " " << rm[5] << endl
217 // << rm[6] << " " << rm[7] << " " << rm[8] << endl;
218
219 // Check for presence of rotation
220 // (will be nice to be available in TGeo)
221 const Double_t kTolerance = 1e-04;
222 Bool_t isRotation = true;
223 if (TMath::Abs(rm[0] - 1.) < kTolerance &&
224 TMath::Abs(rm[1] - 0.) < kTolerance &&
225 TMath::Abs(rm[2] - 0.) < kTolerance &&
226 TMath::Abs(rm[3] - 0.) < kTolerance &&
227 TMath::Abs(rm[4] - 1.) < kTolerance &&
228 TMath::Abs(rm[5] - 0.) < kTolerance &&
229 TMath::Abs(rm[6] - 0.) < kTolerance &&
230 TMath::Abs(rm[7] - 0.) < kTolerance &&
231 TMath::Abs(rm[8] - 1.) < kTolerance) isRotation = false;
232
233 Int_t krot = 0;
234 if (isRotation) {
235 TGeoRotation rot;
236 rot.SetMatrix(const_cast<Double_t*>(transform.GetRotationMatrix()));
237 Double_t theta1, phi1, theta2, phi2, theta3, phi3;
238 rot.GetAngles(theta1, phi1, theta2, phi2, theta3, phi3);
239
240 //cout << "angles: "
241 // << theta1 << " " << phi1 << " "
242 // << theta2 << " " << phi2 << " "
243 // << theta3 << " " << phi3 << endl;
244
e118b27e 245 fModule->AliMatrix(krot, theta1, phi1, theta2, phi2, theta3, phi3);
d4bb94a1 246 }
247
248 // Place the volume in ALIC
249 if (npar == 0)
250 gMC->Gspos(name, copyNo, mName, xyz[0], xyz[1], xyz[2] , krot, only);
251 else
252 gMC->Gsposp(name, copyNo, mName, xyz[0], xyz[1], xyz[2] , krot, only,
253 param, npar);
d4bb94a1 254}
255
08086cd0 256//______________________________________________________________________________
257void AliMUONGeometryBuilder::CreateGeometryWithTGeo()
8618c022 258{
08086cd0 259/// Construct geometry using geometry builders.
260/// Virtual modules/envelopes are placed as TGeoVolume assembly
8618c022 261
08086cd0 262 if (fAlign) {
263 // Read transformations from ASCII data file
264 fGeometry->GetTransformer()
265 ->ReadGeometryData(fgkDefaultVolPathsFileName, fTransformFileName);
266 }
267
268 for (Int_t i=0; i<fGeometryBuilders->GetEntriesFast(); i++) {
8618c022 269
08086cd0 270 // Get the builder
271 AliMUONVGeometryBuilder* builder
272 = (AliMUONVGeometryBuilder*)fGeometryBuilders->At(i);
273
274 // Create geometry + envelopes
275 //
276 builder->CreateGeometry();
277 if (!fAlign) builder->SetTransformations();
278
279 // Place module volumes and envelopes
280 //
281 for (Int_t j=0; j<builder->NofGeometries(); j++) {
282
283 AliMUONGeometryModule* geometry = builder->Geometry(j);
284 AliMUONGeometryModuleTransformer* transformer= geometry->GetTransformer();
285 const TGeoHMatrix* kModuleTransform = transformer->GetTransformation();
286 TString volName = transformer->GetVolumeName();
287 TString motherVolName = transformer->GetMotherVolumeName();
288
289 // Place the module volume
290 PlaceVolume(volName, motherVolName,
291 1, *kModuleTransform, 0, 0, "ONLY", geometry->IsVirtual());
8618c022 292
08086cd0 293 TGeoCombiTrans appliedGlobalTransform;
294 if (builder->ApplyGlobalTransformation())
295 appliedGlobalTransform = fGlobalTransformation;
8618c022 296
08086cd0 297 // Loop over envelopes
298 const TObjArray* kEnvelopes
299 = geometry->GetEnvelopeStore()->GetEnvelopes();
300 for (Int_t k=0; k<kEnvelopes->GetEntriesFast(); k++) {
d4bb94a1 301
08086cd0 302 // Get envelope
303 AliMUONGeometryEnvelope* env
304 = (AliMUONGeometryEnvelope*)kEnvelopes->At(k);
305
306 const TGeoCombiTrans* kEnvTrans = env->GetTransformation();
307 const char* only = "ONLY";
308 if (env->IsMANY()) only = "MANY";
e118b27e 309
08086cd0 310 if (env->IsVirtual() && env->GetConstituents()->GetEntriesFast() == 0 ) {
311 // virtual envelope + nof constituents = 0
312 // => not allowed;
313 // empty virtual envelope has no sense
314 AliFatal("Virtual envelope must have constituents.");
315 return;
316 }
317
318 if (!env->IsVirtual() && env->GetConstituents()->GetEntriesFast() > 0 ) {
319 // non virtual envelope + nof constituents > 0
320 // => not allowed;
321 // use VMC to place constituents
322 AliFatal("Non virtual envelope cannot have constituents.");
323 return;
324 }
325
326 // Place envelope in geometry module by composed transformation:
327 // [Tglobal] * Tenv
328 TGeoHMatrix total
329 = Multiply( appliedGlobalTransform,
330 (*kEnvTrans) );
331 PlaceVolume(env->GetName(), volName,
332 env->GetCopyNo(), total, 0, 0, only, env->IsVirtual());
333
334 if ( env->IsVirtual() ) {
335 // Place constituents in the envelope
336 for (Int_t l=0; l<env->GetConstituents()->GetEntriesFast(); l++) {
337 AliMUONGeometryConstituent* constituent
338 = (AliMUONGeometryConstituent*)env->GetConstituents()->At(l);
339
340 PlaceVolume(constituent->GetName(), env->GetName(),
341 constituent->GetCopyNo(),
342 *constituent->GetTransformation() ,
343 constituent->GetNpar(), constituent->GetParam(), only);
344 }
345 }
346 } // end of loop over envelopes
347 } // end of loop over builder geometries
348 } // end of loop over builders
e118b27e 349}
350
d4bb94a1 351//______________________________________________________________________________
08086cd0 352void AliMUONGeometryBuilder::CreateGeometryWithoutTGeo()
d4bb94a1 353{
692de412 354/// Construct geometry using geometry builders.
08086cd0 355/// Virtual modules/enevlopes are not placed
d4bb94a1 356
08086cd0 357 if (fAlign) {
358 // Read transformations from ASCII data file
359 fGeometry->GetTransformer()
360 ->ReadGeometryData(fgkDefaultVolPathsFileName, fTransformFileName);
361 }
6cfb12b4 362
d4bb94a1 363 for (Int_t i=0; i<fGeometryBuilders->GetEntriesFast(); i++) {
364
365 // Get the builder
366 AliMUONVGeometryBuilder* builder
367 = (AliMUONVGeometryBuilder*)fGeometryBuilders->At(i);
368
e118b27e 369 // Create geometry + envelopes
370 //
6cfb12b4 371 builder->CreateGeometry();
372 if (!fAlign) builder->SetTransformations();
373
cfbf2f7d 374 // Place module volumes and envelopes
e118b27e 375 //
376 for (Int_t j=0; j<builder->NofGeometries(); j++) {
d4bb94a1 377
e118b27e 378 AliMUONGeometryModule* geometry = builder->Geometry(j);
08086cd0 379 AliMUONGeometryModuleTransformer* transformer= geometry->GetTransformer();
380 const TGeoHMatrix* kModuleTransform = transformer->GetTransformation();
381 TString volName = transformer->GetVolumeName();
382 TString motherVolName = transformer->GetMotherVolumeName();
cfbf2f7d 383
384 // Place the module volume
385 if ( !geometry->IsVirtual() ) {
08086cd0 386 PlaceVolume(volName, motherVolName,
6cfb12b4 387 1, *kModuleTransform, 0, 0, "ONLY");
cfbf2f7d 388 }
e118b27e 389
6cfb12b4 390 TGeoCombiTrans appliedGlobalTransform;
391 if (builder->ApplyGlobalTransformation())
392 appliedGlobalTransform = fGlobalTransformation;
393
e118b27e 394 // Loop over envelopes
6cfb12b4 395 const TObjArray* kEnvelopes
396 = geometry->GetEnvelopeStore()->GetEnvelopes();
e118b27e 397 for (Int_t k=0; k<kEnvelopes->GetEntriesFast(); k++) {
398
399 // Get envelope
6cfb12b4 400 AliMUONGeometryEnvelope* env
401 = (AliMUONGeometryEnvelope*)kEnvelopes->At(k);
402
e118b27e 403 const TGeoCombiTrans* kEnvTrans = env->GetTransformation();
404 const char* only = "ONLY";
405 if (env->IsMANY()) only = "MANY";
406
407 if (env->IsVirtual() && env->GetConstituents()->GetEntriesFast() == 0 ) {
408 // virtual envelope + nof constituents = 0
409 // => not allowed;
410 // empty virtual envelope has no sense
411 AliFatal("Virtual envelope must have constituents.");
412 return;
413 }
d4bb94a1 414
e118b27e 415 if (!env->IsVirtual() && env->GetConstituents()->GetEntriesFast() > 0 ) {
416 // non virtual envelope + nof constituents > 0
417 // => not allowed;
418 // use VMC to place constituents
419 AliFatal("Non virtual envelope cannot have constituents.");
420 return;
421 }
422
423 if (!env->IsVirtual() && env->GetConstituents()->GetEntriesFast() == 0 ) {
424 // non virtual envelope + nof constituents = 0
425 // => place envelope in ALICE by composed transformation:
6cfb12b4 426 // Tch * [Tglobal] * Tenv
e118b27e 427
428 // Compound chamber transformation with the envelope one
cfbf2f7d 429 if (geometry->IsVirtual()) {
430 TGeoHMatrix total
6cfb12b4 431 = Multiply( (*kModuleTransform),
432 appliedGlobalTransform,
067866a3 433 (*kEnvTrans) );
08086cd0 434 PlaceVolume(env->GetName(), motherVolName,
cfbf2f7d 435 env->GetCopyNo(), total, 0, 0, only);
436 }
437 else {
438 TGeoHMatrix total
6cfb12b4 439 = Multiply( appliedGlobalTransform,
440 (*kEnvTrans) );
08086cd0 441 PlaceVolume(env->GetName(), volName,
cfbf2f7d 442 env->GetCopyNo(), total, 0, 0, only);
443 }
e118b27e 444 }
445
446 if (env->IsVirtual() && env->GetConstituents()->GetEntriesFast() > 0 ) {
447 // virtual envelope + nof constituents > 0
448 // => do not place envelope and place constituents
449 // in ALICE by composed transformation:
6cfb12b4 450 // Tch * [Tglobal] * Tenv * Tconst
d4bb94a1 451
e118b27e 452 for (Int_t l=0; l<env->GetConstituents()->GetEntriesFast(); l++) {
453 AliMUONGeometryConstituent* constituent
454 = (AliMUONGeometryConstituent*)env->GetConstituents()->At(l);
455
456 // Compound chamber transformation with the envelope one + the constituent one
cfbf2f7d 457 if (geometry->IsVirtual()) {
458 TGeoHMatrix total
6cfb12b4 459 = Multiply ( (*kModuleTransform),
460 appliedGlobalTransform,
461 (*kEnvTrans),
067866a3 462 (*constituent->GetTransformation()) );
cfbf2f7d 463
08086cd0 464 PlaceVolume(constituent->GetName(), motherVolName,
cfbf2f7d 465 constituent->GetCopyNo(), total,
466 constituent->GetNpar(), constituent->GetParam(), only);
467 }
468 else {
469 TGeoHMatrix total
6cfb12b4 470 = Multiply ( appliedGlobalTransform,
471 (*kEnvTrans),
067866a3 472 (*constituent->GetTransformation()) );
cfbf2f7d 473
08086cd0 474 PlaceVolume(constituent->GetName(), volName,
cfbf2f7d 475 constituent->GetCopyNo(), total,
476 constituent->GetNpar(), constituent->GetParam(), only);
477 }
e118b27e 478 }
d4bb94a1 479 }
e118b27e 480 } // end of loop over envelopes
481 } // end of loop over builder geometries
482 } // end of loop over builders
d4bb94a1 483}
484
485//_____________________________________________________________________________
08086cd0 486void AliMUONGeometryBuilder::SetAlign(AliMUONVGeometryBuilder* builder)
487{
488/// Set align option to all geometry modules associated with the builder
489
490 for (Int_t j=0; j<builder->NofGeometries(); j++) {
491
492 AliMUONGeometryModule* geometry = builder->Geometry(j);
493
494 geometry->SetAlign(fAlign);
495 }
496}
497
498//
499// public functions
500//
501
502//_____________________________________________________________________________
503void AliMUONGeometryBuilder::AddBuilder(AliMUONVGeometryBuilder* geomBuilder)
504{
505/// Add the geometry builder to the list
506
507 fGeometryBuilders->Add(geomBuilder);
508
509 // Pass geometry modules created in the to the geometry parametrisation
510 for (Int_t i=0; i<geomBuilder->NofGeometries(); i++) {
511 fGeometry->AddModule(geomBuilder->Geometry(i));
512 }
513
514 if (geomBuilder->ApplyGlobalTransformation())
515 geomBuilder->SetReferenceFrame(fGlobalTransformation);
516
517 SetAlign(geomBuilder);
518}
519
520//______________________________________________________________________________
521void AliMUONGeometryBuilder::CreateGeometry()
522{
523/// Construct geometry using geometry builders.
524
525 if ( gMC->IsRootGeometrySupported() &&
526 TString(gMC->ClassName()) != "TGeant4" ) {
527
528 CreateGeometryWithTGeo();
529 }
530 else
531 CreateGeometryWithoutTGeo();
532}
533
534//_____________________________________________________________________________
d4bb94a1 535void AliMUONGeometryBuilder::CreateMaterials()
536{
692de412 537/// Construct materials specific to modules via builders
d4bb94a1 538
539 for (Int_t i=0; i<fGeometryBuilders->GetEntriesFast(); i++) {
540
541 // Get the builder
542 AliMUONVGeometryBuilder* builder
543 = (AliMUONVGeometryBuilder*)fGeometryBuilders->At(i);
544
545 // Create materials with each builder
546 if (builder) builder->CreateMaterials();
547 }
548}
549
550//______________________________________________________________________________
6cfb12b4 551void AliMUONGeometryBuilder::InitGeometry(const TString& svmapFileName)
d4bb94a1 552{
692de412 553/// Initialize geometry
d4bb94a1 554
08086cd0 555 // Load alignement data from geometry if geometry is read from Root file
063619ad 556 if ( gAlice->IsRootGeometry() ) {
6cfb12b4 557 fAlign = true;
08086cd0 558
559 fGeometry->GetTransformer()
560 ->ReadGeometryData(fgkDefaultVolPathsFileName, gGeoManager);
561 }
6cfb12b4 562
563 // Read sensitive volume map from a file
564 fGeometry->ReadSVMap(svmapFileName);
565
d4bb94a1 566 // Set the chamber (sensitive region) GEANT identifier
567 //
568 for (Int_t i=0; i<fGeometryBuilders->GetEntriesFast(); i++) {
569
570 // Get the builder
571 AliMUONVGeometryBuilder* builder
572 = (AliMUONVGeometryBuilder*)fGeometryBuilders->At(i);
573
6cfb12b4 574 // Set sensitive volumes with each builder
76497dec 575 builder->SetSensitiveVolumes();
4a9de4af 576
6cfb12b4 577 if (!fAlign) {
08086cd0 578 // Create detection elements from built geometry
579 builder->CreateDetElements();
6cfb12b4 580 }
e118b27e 581 }
76497dec 582}
583
6cfb12b4 584//______________________________________________________________________________
eea63c73 585void AliMUONGeometryBuilder::WriteSVMaps(const TString& fileName,
586 Bool_t rebuild)
d4bb94a1 587{
6cfb12b4 588/// Write sensitive volume maps into files per builder
589
590 // Rebuild sv maps
591 //
592 if (rebuild)
593 for (Int_t i=0; i<fGeometryBuilders->GetEntriesFast(); i++) {
d4bb94a1 594
6cfb12b4 595 AliMUONVGeometryBuilder* builder
596 = (AliMUONVGeometryBuilder*)fGeometryBuilders->At(i);
597
08086cd0 598 Bool_t writeEnvelopes = false;
599 if ( gMC->IsRootGeometrySupported() &&
600 TString(gMC->ClassName()) != "TGeant4") writeEnvelopes = true;
601
602 builder->RebuildSVMaps(writeEnvelopes);
6cfb12b4 603 }
604
605 // Write maps in file
606 fGeometry->WriteSVMap(fileName);
607}
d4bb94a1 608
76497dec 609//_____________________________________________________________________________
610void AliMUONGeometryBuilder::SetAlign(Bool_t align)
611{
067866a3 612/// Set the option for alignement
76497dec 613
614 fAlign = align;
615
e118b27e 616 for (Int_t i=0; i<fGeometryBuilders->GetEntriesFast(); i++) {
617
e118b27e 618 AliMUONVGeometryBuilder* builder
619 = (AliMUONVGeometryBuilder*)fGeometryBuilders->At(i);
8618c022 620
621 SetAlign(builder);
622 }
76497dec 623}
eea63c73 624
625//_____________________________________________________________________________
626void AliMUONGeometryBuilder::SetAlign(const TString& fileName, Bool_t align)
627{
628/// Set the option for alignement
629
630 fTransformFileName = fileName;
631 fAlign = align;
632
633 for (Int_t i=0; i<fGeometryBuilders->GetEntriesFast(); i++) {
634
635 AliMUONVGeometryBuilder* builder
636 = (AliMUONVGeometryBuilder*)fGeometryBuilders->At(i);
637
638 SetAlign(builder);
639 }
640}