]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONVGeometryBuilder.h
Adapting to CORRFW changes (Chiara)
[u/mrichter/AliRoot.git] / MUON / AliMUONVGeometryBuilder.h
index 9b26948665ce43d1b87c5ef242246e0f4a1be0e5..c2a21a6c4ce0bceed6fc94dcb1a0fd53f60a53b6 100644 (file)
@@ -3,20 +3,21 @@
 
 // $Id$
 // Revision of includes 07/05/2004
-//
-// Class AliMUONVGeometryBuilder
-// -----------------------------
-// Abstract base class for geometry construction per chamber(s).
-//
-// Author: Ivana Hrivnacova, IPN Orsay
 
-#ifndef ALI_MUON_V_GEOMETRY_BUILDER_H
-#define ALI_MUON_V_GEOMETRY_BUILDER_H
+/// \ingroup geometry
+/// \class AliMUONVGeometryBuilder
+/// \brief Abstract base class for geometry construction per module(s)
+///
+/// \author Ivana Hrivnacova, IPN Orsay
+
+#ifndef ALI_MUONV_GEOMETRY_BUILDER_H
+#define ALI_MUONV_GEOMETRY_BUILDER_H
 
 #include <fstream>
 
 #include <TObject.h>
 #include <TObjArray.h>
+#include <TGeoMatrix.h>
 
 class TGeoTranslation;
 class TGeoRotation;
@@ -24,54 +25,59 @@ class TGeoCombiTrans;
 
 class AliMUONGeometryModule;
 class AliMUONGeometryEnvelopeStore;
-class AliMUONGeometryStore;
-class AliMUONGeometrySVMap;
+class AliMUONStringIntMap;
 
 class AliMUONVGeometryBuilder : public TObject
 {
   public:
-    AliMUONVGeometryBuilder(const TString& fileName,
-                            AliMUONGeometryModule* mg1,
-                            AliMUONGeometryModule* mg2 = 0,
-                            AliMUONGeometryModule* mg3 = 0,
-                            AliMUONGeometryModule* mg4 = 0,
-                            AliMUONGeometryModule* mg5 = 0,
-                            AliMUONGeometryModule* mg6 = 0);
+    AliMUONVGeometryBuilder(Int_t firstModuleId, Int_t nofModules);
     AliMUONVGeometryBuilder();
     virtual ~AliMUONVGeometryBuilder();
   
     // methods
-    virtual void  FillTransformations() const;
-    virtual void  RebuildSVMaps() const;
-    virtual Bool_t  ReadTransformations() const;
-    virtual Bool_t  ReadSVMap() const;
-    virtual Bool_t  WriteTransformations() const;
-    virtual Bool_t  WriteSVMap(Bool_t rebuild) const;
-    
+    void  SetReferenceFrame(const TGeoCombiTrans& referenceFrame);
+    void  RebuildSVMaps(Bool_t withEnvelopes = true) const;
+    void  UpdateDetElements(Bool_t create) const;
+
+                  /// Function to be overriden in a concrete chamber/station
+                 /// geometry builder class.
+                 /// Only materials that are not defined in the common
+                 /// functions should be defined here.
     virtual void CreateMaterials() {}  // make = 0; ?
-                  // Function to be overriden in a concrete chamber/station
-                 // geometry builder class.
-                 // Only materials that are not defined in the common
-                 // functions should be defined here.
+
+                  /// Function to be overriden in a concrete chamber/station
+                 /// geometry builder class. \n
+                 /// The geometry built there should not be placed
+                 /// in ALIC; but all volumes going to ALIC
+                 /// have to be added as envelopes to the chamber
+                 /// geometries
+                 /// (They will be then placed automatically 
+                 /// usind the provided transformation.
     virtual void CreateGeometry() = 0;
-                  // Function to be overriden in a concrete chamber/station
-                 // geometry builder class.
-                 // The geometry built there should not be placed
-                 // in ALIC; but all volumes going to ALIC
-                 // have to be added as envelopes to the chamber
-                 // geometries
-                 // (They will be then placed automatically 
-                 // usind the provided transformation.
+
+                  /// Function to be overriden in a concrete chamber/station
+                 /// geometry class. \n
+                 /// The volume name for each geometry module, its virtuality
+                  /// and eventually the mother volume name should be defined
+    virtual void SetVolumes() = 0;
+
+                  /// Function to be overriden in a concrete chamber/station
+                 /// geometry class. \n
+                 /// The transformation of each chamber(s) wrt ALICE
+                 /// should be defined and set to its geometry class. 
     virtual void SetTransformations() = 0;
-                  // Function to be overriden in a concrete chamber/station
-                 // geometry class.
-                 // The transformation of each chamber(s) wrt ALICE
-                 // should be defined and set to its geometry class. 
+
+                  /// Function to be overriden in a concrete chamber/station
+                 /// geometry class. \n
+                 /// The sensitive volumes Ids for each chamber
+                 /// should be defined and set to its geometry class. 
     virtual void SetSensitiveVolumes() = 0;
-                  // Function to be overriden in a concrete chamber/station
-                 // geometry class.
-                 // The sensitive volumes Ids for each chamber
-                 // should be defined and set to its geometry class. 
+
+                  /// Function to be overriden (and return false) 
+                 /// in the concrete geometry builder classes 
+                 /// which are already defined in the new ALICE
+                 /// coordinate frame
+    virtual bool ApplyGlobalTransformation() { return true; }
 
     // access to module geometries
     Int_t  NofGeometries() const;
@@ -80,67 +86,57 @@ class AliMUONVGeometryBuilder : public TObject
                  // this function access geometry via index and not
                  // via moduleId
 
-
   protected:
-    AliMUONVGeometryBuilder(const AliMUONVGeometryBuilder& rhs);
-
-    // operators  
-    AliMUONVGeometryBuilder& operator = (const AliMUONVGeometryBuilder& rhs);
-
     // methods
     AliMUONGeometryModule*         GetGeometry(Int_t moduleId) const;
     AliMUONGeometryEnvelopeStore*  GetEnvelopes(Int_t moduleId) const;
-    AliMUONGeometryStore*          GetDetElements(Int_t moduleId) const;
-    AliMUONGeometrySVMap*          GetSVMap(Int_t moduleId) const;
+    AliMUONStringIntMap*           GetSVMap(Int_t moduleId) const;
+    Int_t                          GetModuleId(const TString& envName) const;
+    
+    // set module transformation
+    void SetTranslation(Int_t moduleId, 
+                        const TGeoTranslation& translation);
+    void SetTransformation(Int_t moduleId, 
+                        const TGeoTranslation& translation,
+                       const TGeoRotation& rotation);
+                       
+    // set volumes 
+    void SetVolume(Int_t moduleId, const TString& volumeName, 
+                   Bool_t isVirtual = false);                  
+    void SetMotherVolume(Int_t moduleId, const TString& volumeName);                   
     
   private:
     //methods
-    TString  ComposePath(const TString& volName, Int_t copyNo) const; 
-    void     MapSV(const TString&path, const TString& volName, 
-                  Int_t detElemId) const;
-
-    void FillData(Int_t moduleId, Int_t nofDetElements, 
-                  Double_t x, Double_t y, Double_t z,
-                 Double_t a1, Double_t a2, Double_t a3, 
-                 Double_t a4, Double_t a5, Double_t a6) const; 
-    void FillData(Int_t id, const TString& volName, Int_t copyNo,
-                  Double_t x, Double_t y, Double_t z,
-                 Double_t a1, Double_t a2, Double_t a3, 
-                 Double_t a4, Double_t a5, Double_t a6) const;
-    void FillData(const TString& sensVolumePath, Int_t detElemId) const;                  
-
-    TString ReadData1(ifstream& in) const;
-    TString ReadData2(ifstream& in) const;
-    TString ReadData3(ifstream& in) const;
-
-    void WriteTransform(ofstream& out, const TGeoCombiTrans* transform) const;
-    void WriteData1(ofstream& out) const;
-    void WriteData2(ofstream& out) const;
-    void WriteData3(ofstream& out) const;
-
-    // static data members
-    static const TString fgkTransformFileNamePrefix; // the prefix for the name 
-                                                 // of file with transformations
-    static const TString fgkSVMapFileNamePrefix; // the prefix for the name of file 
-                                                 // with sensitive volume map
-    static const TString fgkOutFileNameSuffix;   // the suffix for the name of 
-                                                 // generated files
     
+    /// Not implemented
+    AliMUONVGeometryBuilder(const AliMUONVGeometryBuilder& rhs);
+    /// Not implemented
+    AliMUONVGeometryBuilder& operator = (const AliMUONVGeometryBuilder& rhs);
+
+    TGeoHMatrix ConvertTransform(const TGeoHMatrix& transform) const;
+    TGeoHMatrix ConvertDETransform(const TGeoHMatrix& transform) const;
+    TString     ComposePath(const TString& volName, Int_t copyNo) const; 
+    void        MapSV(const TString& path0, 
+                      const TString& volName, Int_t detElemId) const;
+
     // data members
-    TString     fTransformFileName; // the name file with transformations 
-    TString     fSVMapFileName;     // the name file with sensitive volume map 
-    TObjArray*  fModuleGeometries;  // the modules geometries that will be built
-                                    // by this builder
-    
-  ClassDef(AliMUONVGeometryBuilder,3) // MUON chamber geometry base class
+    TObjArray*  fGeometryModules;   ///< \brief the modules geometries that will be built
+                                    /// by this builder                                    
+    TGeoCombiTrans fReferenceFrame; ///< \brief the transformation from the builder 
+                                    /// reference frame to that of the transform 
+                                   /// data files
+                                       
+  ClassDef(AliMUONVGeometryBuilder,4) // MUON chamber geometry base class
 };
 
 // inline functions
 
+/// Return the number of geometry modules
 inline Int_t  AliMUONVGeometryBuilder::NofGeometries() const
-{ return fModuleGeometries->GetEntriesFast(); }
+{ return fGeometryModules->GetEntriesFast(); }
 
+/// Return the \a i th geometry module
 inline AliMUONGeometryModule* AliMUONVGeometryBuilder::Geometry(Int_t i) const
-{ return (AliMUONGeometryModule*)fModuleGeometries->At(i); }
+{ return (AliMUONGeometryModule*)fGeometryModules->At(i); }
 
-#endif //ALI_MUON_V_GEOMETRY_BUILDER_H
+#endif //ALI_MUONV_GEOMETRY_BUILDER_H