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