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