]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONVGeometryBuilder.cxx
Geometry framework classes were made independent from the rest of MUON and linked...
[u/mrichter/AliRoot.git] / MUON / AliMUONVGeometryBuilder.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
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 purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 // $Id$
17 //
18 // Class AliMUONVGeometryBuilder
19 // -----------------------------
20 // Abstract base class for geometry construction per geometry module(s).
21 // Author: Ivana Hrivnacova, IPN Orsay
22 // 23/01/2004
23
24 #include <Riostream.h>
25 #include <TObjArray.h>
26 #include <TSystem.h>
27 #include <TGeoMatrix.h>
28 #include <TVirtualMC.h>
29
30 #include "AliMUONVGeometryBuilder.h"
31 #include "AliMUONGeometryModule.h"
32 #include "AliMUONGeometryDetElement.h"
33 #include "AliMUONGeometryStore.h"
34 #include "AliMUONGeometrySVMap.h"
35 #include "AliMUONGeometryEnvelopeStore.h"
36 #include "AliMUONGeometryEnvelope.h"
37 #include "AliMUONGeometryConstituent.h"
38 #include "AliMUONVGeometryDEIndexing.h"
39 #include "AliLog.h"
40
41 ClassImp(AliMUONVGeometryBuilder)
42
43 const TString AliMUONVGeometryBuilder::fgkTransformFileNamePrefix = "transform_";
44 const TString AliMUONVGeometryBuilder::fgkSVMapFileNamePrefix = "svmap_";
45 const TString AliMUONVGeometryBuilder::fgkOutFileNameSuffix = ".out";
46
47 //______________________________________________________________________________
48 AliMUONVGeometryBuilder::AliMUONVGeometryBuilder(const TString& fileName,
49                             AliMUONGeometryModule* mg1, AliMUONGeometryModule* mg2,
50                             AliMUONGeometryModule* mg3, AliMUONGeometryModule* mg4,
51                             AliMUONGeometryModule* mg5, AliMUONGeometryModule* mg6)
52  : TObject(),
53    fTransformFileName(fgkTransformFileNamePrefix+fileName),
54    fSVMapFileName(fgkSVMapFileNamePrefix+fileName),
55    fModuleGeometries(0)
56  {
57 // Standard constructor
58
59   // Create the module geometries array
60   fModuleGeometries = new TObjArray();
61   
62   if (mg1) fModuleGeometries->Add(mg1);
63   if (mg2) fModuleGeometries->Add(mg2);
64   if (mg3) fModuleGeometries->Add(mg3);
65   if (mg4) fModuleGeometries->Add(mg4);
66   if (mg5) fModuleGeometries->Add(mg5);
67   if (mg6) fModuleGeometries->Add(mg6);
68 }
69
70
71 //______________________________________________________________________________
72 AliMUONVGeometryBuilder::AliMUONVGeometryBuilder()
73  : TObject(),
74    fTransformFileName(),
75    fSVMapFileName(),
76    fModuleGeometries(0)
77 {
78 // Default constructor
79 }
80
81
82 //______________________________________________________________________________
83 AliMUONVGeometryBuilder::AliMUONVGeometryBuilder(const AliMUONVGeometryBuilder& rhs)
84   : TObject(rhs)
85 {
86 // Protected copy constructor
87
88   AliFatal("Copy constructor is not implemented.");
89 }
90
91 //______________________________________________________________________________
92 AliMUONVGeometryBuilder::~AliMUONVGeometryBuilder() {
93 //
94   if (fModuleGeometries) {
95     fModuleGeometries->Clear(); // Sets pointers to 0 since it is not the owner
96     delete fModuleGeometries;
97   }
98 }
99
100 //______________________________________________________________________________
101 AliMUONVGeometryBuilder& 
102 AliMUONVGeometryBuilder::operator = (const AliMUONVGeometryBuilder& rhs) 
103 {
104 // Protected assignement operator
105
106   // check assignement to self
107   if (this == &rhs) return *this;
108
109   AliFatal("Assignment operator is not implemented.");
110     
111   return *this;  
112 }
113
114 //
115 // private methods
116 //
117
118 //______________________________________________________________________________
119  TString  AliMUONVGeometryBuilder::ComposePath(const TString& volName, 
120                                                Int_t copyNo) const
121 {
122 // Compose path from given volName and copyNo
123 // ---
124
125   TString path(volName);
126   path += ".";
127   path += copyNo;
128   
129   return path;
130 }  
131
132 /*
133 //______________________________________________________________________________
134 void AliMUONVGeometryBuilder::MapSV(const TString& path0, 
135                                     const TString& volName, Int_t detElemId) const
136 {
137 // Update the path with all daughters volumes recursively
138 // and map it to the detection element Id if it is a sensitive volume
139 // ---
140
141   Int_t nofDaughters = gMC->NofVolDaughters(volName);
142   if (nofDaughters == 0) {
143
144     // Get the name of the last volume in the path
145     Ssiz_t npos1 = path0.Last('/')+1; 
146     Ssiz_t npos2 = path0.Last('.');
147     TString volName(path0(npos1, npos2-npos1));  
148     
149     // Check if it is sensitive volume
150     Int_t moduleId = AliMUONVGeometryDEIndexing::Instance()
151                      ->GetModuleId(detElemId);
152     AliMUONGeometryModule* geometry = GetGeometry(moduleId);
153     if (geometry->IsSensitiveVolume(volName)) {
154       //cout << ".. adding to the map  " 
155       //     <<  path0 << "  "  << detElemId << endl;
156       FillData(path0, detElemId); 
157     }  
158     return; 
159   }  
160
161   for (Int_t i=0; i<nofDaughters; i++) {
162     Int_t copyNo = gMC->VolDaughterCopyNo(volName, i);
163     TString newName =  gMC->VolDaughterName(volName, i);
164             
165     TString path = path0;
166     path += "/";
167     path += ComposePath(newName, copyNo);
168
169     MapSV(path, newName, detElemId);
170   }
171 }     
172 */
173
174 //______________________________________________________________________________
175 void AliMUONVGeometryBuilder::MapSV(const TString& /*path0*/, 
176                                     const TString& /*volName*/, 
177                                     Int_t /*detElemId*/) const
178 {
179 // Update the path with all daughters volumes recursively
180 // and map it to the detection element Id if it is a sensitive volume
181 // ---
182
183   AliWarning("Not yet available");
184 }     
185
186
187 //______________________________________________________________________________
188 void AliMUONVGeometryBuilder::FillData(Int_t moduleId, Int_t nofDetElements,
189                   Double_t x, Double_t y, Double_t z,
190                   Double_t a1, Double_t a2, Double_t a3,
191                   Double_t a4, Double_t a5, Double_t a6) const 
192 {
193 // Fill the transformation of the module.
194 // ---
195
196   moduleId--;
197       // Modules numbers in the file are starting from 1
198       
199   GetGeometry(moduleId)
200     ->GetDEIndexing()->SetNofDetElements(nofDetElements);    
201   GetGeometry(moduleId)
202     ->SetTranslation(TGeoTranslation(x, y, z));
203   GetGeometry(moduleId)
204     ->SetRotation(TGeoRotation("rot", a1, a2, a3, a4, a5, a6));
205 }                  
206   
207 //______________________________________________________________________________
208 void AliMUONVGeometryBuilder::FillData(
209                   Int_t detElemId, const TString& volName, Int_t copyNo,
210                   Double_t x, Double_t y, Double_t z,
211                   Double_t a1, Double_t a2, Double_t a3,
212                   Double_t a4, Double_t a5, Double_t a6) const 
213 {
214 // Fill the transformation of the detection element.
215 // ---
216
217   // Module Id
218   Int_t moduleId 
219     = AliMUONVGeometryDEIndexing::GetModuleId(detElemId);
220
221   // Compose path
222   TString path = ComposePath(volName, copyNo);
223   
224   // Compose matrix
225   TGeoCombiTrans transform(path, x, y, z, 
226                            new TGeoRotation(path, a1, a2, a3, a4, a5, a6));
227     
228   // Get detection element store
229   AliMUONGeometryStore* detElements = GetDetElements(moduleId);     
230
231   // Add detection element
232   detElements->Add(detElemId,
233      new AliMUONGeometryDetElement(detElemId, path, transform)); 
234 }                  
235   
236 //______________________________________________________________________________
237 void AliMUONVGeometryBuilder::FillData(
238                    const TString& sensVolumePath, Int_t detElemId) const
239 {
240 // Fill the mapping of the sensitive volume path to the detection element.
241 // ---
242
243   // Module Id
244   Int_t moduleId 
245     = AliMUONVGeometryDEIndexing::GetModuleId(detElemId);
246
247   // Get module sensitive volumes map
248   AliMUONGeometrySVMap* svMap = GetSVMap(moduleId);     
249
250   // Map the sensitive volume to detection element
251   svMap->Add(sensVolumePath, detElemId); 
252 }                  
253   
254 //______________________________________________________________________________
255 TString  AliMUONVGeometryBuilder::ReadData1(ifstream& in) const
256 {
257 // Reads and fills modules transformations from a file
258 // Returns true, if reading finished correctly.
259 // ---
260
261   TString key("CH");
262   while ( key == TString("CH") ) {
263     Int_t id, n;
264     Double_t  x, y, z;
265     Double_t  a1, a2, a3, a4, a5, a6;
266     TString dummy;
267   
268     in >> id;
269     in >> n;
270     in >> dummy;
271     in >> x;
272     in >> y;
273     in >> z;
274     in >> dummy;
275     in >> a1; 
276     in >> a2; 
277     in >> a3; 
278     in >> a4; 
279     in >> a5; 
280     in >> a6; 
281
282     //cout << "id="     << id << "  "
283     //   << "position= " << x << ", " << y << ", " << z << "  "
284     //   << "rotation= " << a1 << ", " << a2 << ", " << a3  << ", "
285     //                   << a4 << ", " << a5 << ", " << a6 
286     //   << endl;   
287          
288     // Fill data
289     FillData(id, n, x, y, z, a1, a2, a3, a4, a5, a6);
290     
291     // Go to next line
292     in >> key;
293   }
294   
295   return key;            
296 }
297
298 //______________________________________________________________________________
299 TString  AliMUONVGeometryBuilder::ReadData2(ifstream& in) const
300 {
301 // Reads detection elements transformations from a file
302 // Returns true, if reading finished correctly.
303 // ---
304
305   TString key("DE");
306   while ( key == TString("DE") ) {
307
308     // Input data
309     Int_t detElemId;
310     TString   volumeName;
311     Int_t     copyNo;
312     Double_t  x, y, z;
313     Double_t  a1, a2, a3, a4, a5, a6;
314     TString dummy;
315   
316     in >> detElemId;
317     in >> volumeName;
318     in >> copyNo;
319     in >> dummy;
320     in >> x;
321     in >> y;
322     in >> z;
323     in >> dummy;
324     in >> a1; 
325     in >> a2; 
326     in >> a3; 
327     in >> a4; 
328     in >> a5; 
329     in >> a6; 
330
331     //cout << "detElemId=" << detElemId << "  "
332     //     << "volume=" << volumeName << "  "
333     //     << "copyNo=" << copyNo << "  "
334     //     << "position= " << x << ", " << y << ", " << z << "  "
335     //     << "rotation= " << a1 << ", " << a2 << ", " << a3  << ", "
336     //                   << a4 << ", " << a5 << ", " << a6 
337     //     << endl;   
338          
339     // Fill data
340     FillData(detElemId, volumeName, copyNo, x, y, z, a1, a2, a3, a4, a5, a6);    
341     
342     // Go to next line
343     in >> key;
344   } 
345   
346   return key;
347 }
348
349 //______________________________________________________________________________
350 TString  AliMUONVGeometryBuilder::ReadData3(ifstream& in) const
351 {
352 // Reads detection elements transformations from a file
353 // Returns true, if reading finished correctly.
354 // ---
355
356   TString key("SV");
357   while ( key == TString("SV") ) {
358
359     // Input data
360     TString   volumePath;
361     Int_t     detElemId;
362   
363     in >> volumePath;
364     in >> detElemId;
365
366     //cout << "volumePath=" << volumePath << "  "
367     //   << "detElemId=" << detElemId    
368     //     << endl;   
369          
370     // Fill data
371     FillData(volumePath, detElemId); 
372      
373     // Go to next line
374     in >> key;
375   } 
376   
377   return key;
378 }
379
380 //______________________________________________________________________________
381 void AliMUONVGeometryBuilder::WriteTransform(ofstream& out, 
382                                    const TGeoCombiTrans* transform) const
383 {
384 // Writes the transformations 
385 // ---
386
387   out << "   pos: ";
388   const Double_t* xyz = transform->GetTranslation();
389   out << setw(10) << setprecision(4) << xyz[0] << "  " 
390       << setw(10) << setprecision(4) << xyz[1] << "  " 
391       << setw(10) << setprecision(4) << xyz[2];
392
393   out << "   rot: ";
394   Double_t a1, a2, a3, a4, a5, a6;
395   TGeoRotation* rotation = transform->GetRotation();
396   if (rotation) { 
397     rotation->GetAngles(a1, a2, a3, a4, a5, a6);
398   }
399   else {
400     TGeoRotation rotation2; 
401     rotation2.GetAngles(a1, a2, a3, a4, a5, a6);
402   }  
403       
404   out << setw(8) << setprecision(4) << a1 << "  " 
405       << setw(8) << setprecision(4) << a2 << "  " 
406       << setw(8) << setprecision(4) << a3 << "  " 
407       << setw(8) << setprecision(4) << a4 << "  " 
408       << setw(8) << setprecision(4) << a5 << "  " 
409       << setw(8) << setprecision(4) << a6 << "  " << endl; 
410 }
411
412 //______________________________________________________________________________
413 void AliMUONVGeometryBuilder::WriteData1(ofstream& out) const
414 {
415 // Writes modules transformations
416 // ---
417
418   for (Int_t i=0; i<fModuleGeometries->GetEntriesFast(); i++) {
419     AliMUONGeometryModule* geometry 
420       = (AliMUONGeometryModule*)fModuleGeometries->At(i);
421     const TGeoCombiTrans* transform 
422       = geometry->GetTransformation();    
423
424     out << "CH " 
425         << setw(4) << geometry->GetModuleId() + 1 << "  "
426         << setw(4) << geometry->GetDetElementStore()->GetNofEntries() << "  ";
427     
428     WriteTransform(out, transform);
429   }
430   out << endl;
431 }
432
433 //______________________________________________________________________________
434 void AliMUONVGeometryBuilder::WriteData2(ofstream& out) const
435 {
436 // Writes detection elements (envelopes) transformations
437 // ---
438
439
440   for (Int_t i=0; i<fModuleGeometries->GetEntriesFast(); i++) {
441     AliMUONGeometryModule* geometry 
442       = (AliMUONGeometryModule*)fModuleGeometries->At(i);
443     const TObjArray* envelopes 
444       = geometry->GetEnvelopeStore()->GetEnvelopes();    
445
446     for (Int_t j=0; j<envelopes->GetEntriesFast(); j++) {
447       AliMUONGeometryEnvelope* envelope
448         = (AliMUONGeometryEnvelope*)envelopes->At(j);
449       const TGeoCombiTrans* transform 
450         = envelope->GetTransformation(); 
451       
452       // skip envelope not corresponding to detection element
453       if(envelope->GetUniqueID() == 0) continue;
454        
455       out << "DE " 
456           << setw(4) << envelope->GetUniqueID() << "    " 
457           << envelope->GetName() << " " 
458           << setw(4)<< envelope->GetCopyNo();
459      
460       WriteTransform(out, transform);
461     }
462     out << endl;                        
463   }     
464 }
465
466 //______________________________________________________________________________
467 void AliMUONVGeometryBuilder::WriteData3(ofstream& out) const
468 {
469 // Writes association of sensitive volumes and detection elements
470 // from the sensitive volume map
471 // ---
472
473   for (Int_t i=0; i<fModuleGeometries->GetEntriesFast(); i++) {
474     AliMUONGeometryModule* geometry 
475       = (AliMUONGeometryModule*)fModuleGeometries->At(i);
476     AliMUONGeometrySVMap* svMap
477       = geometry->GetSVMap();
478
479     svMap->WriteMap(out);
480     out << endl;  
481   }    
482 }
483
484 //
485 // protected methods
486 //
487
488 //______________________________________________________________________________
489 AliMUONGeometryModule*  
490 AliMUONVGeometryBuilder::GetGeometry(Int_t moduleId) const
491 {
492 // Returns the module geometry specified by moduleId
493 // ---
494
495   for (Int_t i=0; i<fModuleGeometries->GetEntriesFast(); i++) {
496
497     AliMUONGeometryModule* geometry 
498       = (AliMUONGeometryModule*)fModuleGeometries->At(i);
499
500     if ( geometry->GetModuleId() == moduleId) return geometry;
501   }   
502   
503   return 0;
504 }  
505
506 //______________________________________________________________________________
507 AliMUONGeometryEnvelopeStore*  
508 AliMUONVGeometryBuilder::GetEnvelopes(Int_t moduleId) const
509 {
510 // Returns the envelope store of the module geometry specified by moduleId
511 // ---
512
513   AliMUONGeometryModule* geometry = GetGeometry(moduleId);
514   
515   if (!geometry) {
516     AliFatal(Form("Module geometry %d is not defined", moduleId)); 
517     return 0;
518   }
519   
520   return geometry->GetEnvelopeStore();
521 }  
522
523 //______________________________________________________________________________
524 AliMUONGeometryStore*  
525 AliMUONVGeometryBuilder::GetDetElements(Int_t moduleId) const
526 {
527 // Returns the detection elemnts store of the module geometry specified 
528 // by moduleId
529 // ---
530
531   AliMUONGeometryModule* geometry = GetGeometry(moduleId);
532   
533   if (!geometry) {
534     AliFatal(Form("Module geometry %d is not defined", moduleId)); 
535     return 0;
536   }
537   
538   return geometry->GetDetElementStore();
539 }  
540
541 //______________________________________________________________________________
542 AliMUONGeometrySVMap*  
543 AliMUONVGeometryBuilder::GetSVMap(Int_t moduleId) const
544 {
545 // Returns the transformation store of the module geometry specified by moduleId
546 // ---
547
548   AliMUONGeometryModule* geometry = GetGeometry(moduleId);
549   
550   if (!geometry) {
551     AliFatal(Form("Geometry %d is not defined", moduleId)); 
552     return 0;
553   }
554   
555   return geometry->GetSVMap();
556 }  
557
558 //
559 // public functions
560 //
561
562 //______________________________________________________________________________
563 void  AliMUONVGeometryBuilder::FillTransformations() const
564 {
565 // Fills transformations store from defined geometry.
566 // ---
567
568   for (Int_t i=0; i<fModuleGeometries->GetEntriesFast(); i++) {
569     AliMUONGeometryModule* geometry 
570       = (AliMUONGeometryModule*)fModuleGeometries->At(i);
571     const TObjArray* envelopes 
572       = geometry->GetEnvelopeStore()->GetEnvelopes();    
573     
574     AliMUONGeometryStore* detElements = geometry->GetDetElementStore(); 
575       
576     // Set nof detection elements to the indexing
577     geometry->GetDEIndexing()
578       ->SetNofDetElements(geometry->GetEnvelopeStore()->GetNofDetElements()); 
579
580     for (Int_t j=0; j<envelopes->GetEntriesFast(); j++) {
581       AliMUONGeometryEnvelope* envelope
582         = (AliMUONGeometryEnvelope*)envelopes->At(j);
583
584       // skip envelope not corresponding to detection element
585       if(envelope->GetUniqueID() == 0) continue;
586        
587       // Get envelope data 
588       Int_t detElemId = envelope->GetUniqueID();        
589       TString path = ComposePath(envelope->GetName(), 
590                                  envelope->GetCopyNo());
591       const TGeoCombiTrans* transform = envelope->GetTransformation(); 
592
593       // Add detection element transformation 
594       detElements->Add(detElemId,
595         new AliMUONGeometryDetElement(detElemId, path, *transform)); 
596     }  
597   }
598 }
599
600 //_____ _________________________________________________________________________
601 void  AliMUONVGeometryBuilder::RebuildSVMaps() const
602 {
603 // Clear the SV maps in memory and fill them from defined geometry.
604 // ---
605
606   for (Int_t i=0; i<fModuleGeometries->GetEntriesFast(); i++) {
607     AliMUONGeometryModule* geometry 
608       = (AliMUONGeometryModule*)fModuleGeometries->At(i);
609     
610     // Clear the map   
611     geometry->GetSVMap()->Clear();
612      
613     // Fill the map from geometry
614     const TObjArray* envelopes 
615       = geometry->GetEnvelopeStore()->GetEnvelopes();    
616
617     for (Int_t j=0; j<envelopes->GetEntriesFast(); j++) {
618       AliMUONGeometryEnvelope* envelope
619         = (AliMUONGeometryEnvelope*)envelopes->At(j);
620
621       // skip envelope not corresponding to detection element
622       if(envelope->GetUniqueID() == 0) continue;
623        
624       TString path0("/ALIC.1");
625       if (geometry->GetMotherVolume() != "ALIC") {
626         path0 += "/";
627         path0 += ComposePath(geometry->GetMotherVolume(), 1);
628       }  
629        
630       if (!envelope->IsVirtual()) {
631          TString path = path0;
632          path += "/";
633          path += ComposePath(envelope->GetName(), envelope->GetCopyNo());
634          MapSV(path, envelope->GetName(), envelope->GetUniqueID());
635       }
636       else {     
637         for  (Int_t k=0; k<envelope->GetConstituents()->GetEntriesFast(); k++) {
638           AliMUONGeometryConstituent* constituent
639             = (AliMUONGeometryConstituent*)envelope->GetConstituents()->At(k);
640          TString path = path0;
641          path += "/";
642          path += ComposePath(constituent->GetName(), constituent->GetCopyNo());
643          MapSV(path, constituent->GetName(), envelope->GetUniqueID());
644         }
645       }
646     }  
647   }                  
648 }
649
650 //______________________________________________________________________________
651 Bool_t  AliMUONVGeometryBuilder::ReadTransformations() const
652 {
653 // Reads transformations from a file
654 // Returns true, if reading finished correctly.
655 // ---
656
657   // No reading
658   // if builder is not associated with any geometry module
659   if (fModuleGeometries->GetEntriesFast() == 0) return false;
660
661   // File path
662   TString filePath = gSystem->Getenv("ALICE_ROOT");
663   filePath += "/MUON/data/";
664   filePath += fTransformFileName;
665   
666   // Open input file
667   ifstream in(filePath, ios::in);
668   if (!in) {
669     cerr << filePath << endl;   
670     AliFatal("File not found.");
671     return false;
672   }
673
674   TString key;
675   in >> key;
676   while ( !in.eof() ) {
677     if (key == TString("CH")) 
678       key = ReadData1(in);
679     else if (key == TString("DE"))
680       key = ReadData2(in);
681     else {
682       AliFatal(Form("%s key not recognized",  key.Data()));
683       return false;
684     }
685   }     
686
687   return true;
688 }
689
690 //______________________________________________________________________________
691 Bool_t  AliMUONVGeometryBuilder::ReadSVMap() const
692 {
693 // Reads the sensitive volume from a file
694 // Returns true, if reading finished correctly.
695 // ---
696
697   // No reading
698   // if builder is not associated with any geometry module
699   if (fModuleGeometries->GetEntriesFast() == 0) return false;
700
701   // File path
702   TString filePath = gSystem->Getenv("ALICE_ROOT");
703   filePath += "/MUON/data/";
704   filePath += fSVMapFileName;
705   
706   // Open input file
707   ifstream in(filePath, ios::in);
708   if (!in) {
709     cerr << filePath << endl;   
710     AliFatal("File not found.");
711     return false;
712   }
713
714   TString key;
715   in >> key;
716   while ( !in.eof() ) {
717     if (key == TString("SV")) 
718       key = ReadData3(in);
719     else {
720       AliFatal(Form("%s key not recognized",  key.Data()));
721       return false;
722     }
723   }     
724
725   return true;
726 }
727
728 //______________________________________________________________________________
729 Bool_t  AliMUONVGeometryBuilder::WriteTransformations() const
730 {
731 // Writes transformations into a file
732 // Returns true, if writing finished correctly.
733 // ---
734
735   // No writing
736   // if builder is not associated with any geometry module
737   if (fModuleGeometries->GetEntriesFast() == 0) return false;
738
739   // File path
740   TString filePath = gSystem->Getenv("ALICE_ROOT");
741   filePath += "/MUON/data/";
742   filePath += fTransformFileName;
743   filePath += fgkOutFileNameSuffix;
744   
745   // Open input file
746   ofstream out(filePath, ios::out);
747   if (!out) {
748     cerr << filePath << endl;   
749     AliError("File not found.");
750     return false;
751   }
752 #if !defined (__DECCXX)
753   out.setf(std::ios::fixed);
754 #endif
755   WriteData1(out);
756   WriteData2(out);
757   
758   return true;
759 }  
760
761 //______________________________________________________________________________
762 Bool_t  AliMUONVGeometryBuilder::WriteSVMap(Bool_t rebuild) const
763 {
764 // Writes sensitive volume map into a file
765 // Returns true, if writing finished correctly.
766 // ---
767
768   // No writing
769   // if builder is not associated with any geometry module
770   if (fModuleGeometries->GetEntriesFast() == 0) return false;
771
772   // File path
773   TString filePath = gSystem->Getenv("ALICE_ROOT");
774   filePath += "/MUON/data/";
775   filePath += fSVMapFileName;
776   filePath += fgkOutFileNameSuffix;
777   
778   // Open input file
779   ofstream out(filePath, ios::out);
780   if (!out) {
781     cerr << filePath << endl;   
782     AliError("File not found.");
783     return false;
784   }
785 #if !defined (__DECCXX)
786   out.setf(std::ios::fixed);
787 #endif  
788   if (rebuild)  RebuildSVMaps();
789
790   WriteData3(out);
791   
792   return true;
793 }  
794