]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONGeometryTransformer.h
Flexible pt range for the efficiency histogramming
[u/mrichter/AliRoot.git] / MUON / AliMUONGeometryTransformer.h
index 596c51d56281eaf87d73cad1c93033874dd017ee..9f49185b12087dfaeeb49e27c16f97ae29140cdc 100644 (file)
@@ -7,7 +7,16 @@
 /// \class AliMUONGeometryTransformer
 /// \brief Top container class for geometry transformations
 ///
-/// Author: Ivana Hrivnacova, IPN Orsay
+/// Geometry transformations can be filled in these ways:
+/// - by geometry builder when geometry is built via builders
+///   (this way is used when running simulation and building geometry
+///    via VirtualMC)
+/// - from Root geometry file (*.root) or ASCII file (*.dat) using
+///   the method LoadGeometryData(const TString& fileName)
+/// - from geometry loaded in AliGeomManager using
+///   the method LoadGeometryData() without arguments
+/// 
+/// \author Ivana Hrivnacova, IPN Orsay
 
 #ifndef ALI_MUON_GEOMETRY_TRANSFORMER_H
 #define ALI_MUON_GEOMETRY_TRANSFORMER_H
 #include <TGeoMatrix.h>
 
 class AliMUONGeometryModuleTransformer;
+class AliMUONGeometryDetElement;
+
+class TGeoManager;
+class TClonesArray;
+class AliMpExMap;
+class AliMpArea;
+
+using std::ifstream;
+using std::ofstream;
 
 class AliMUONGeometryTransformer : public TObject
 {
   public:
-    AliMUONGeometryTransformer(Bool_t isOwner);
     AliMUONGeometryTransformer();
+    AliMUONGeometryTransformer(TRootIOCtor* /*ioCtor*/);
     virtual  ~AliMUONGeometryTransformer();
     
     // methods
     void  AddModuleTransformer(AliMUONGeometryModuleTransformer* transformer);
+    void  AddMisAlignModule(Int_t moduleId, const TGeoHMatrix& matrix, Bool_t bGlobal = kTRUE);
+    void  AddMisAlignDetElement(Int_t detElemId, const TGeoHMatrix& matrix, Bool_t bGlobal = kTRUE);
+    void  CreateModules();
+
+    void  AddAlignableVolumes() const; 
+    TClonesArray* CreateZeroAlignmentData() const;
+    void  ClearMisAlignmentData();     
 
     // IO
-    Bool_t  ReadTransformations(const TString& fileName);
+    //
+    Bool_t  LoadTransformations(); 
+    Bool_t  LoadGeometryData(const TString& fileName);
+    Bool_t  LoadGeometryData();
+
     Bool_t  WriteTransformations(const TString& fileName) const;
+    Bool_t  WriteMisAlignmentData(const TString& fileName) const;
 
-    // transformation methods 
+    // Transformation methods 
+    //
     void Global2Local(Int_t detElemId,
                  Float_t xg, Float_t yg, Float_t zg, 
                  Float_t& xl, Float_t& yl, Float_t& zl) const;
@@ -46,8 +77,13 @@ class AliMUONGeometryTransformer : public TObject
     void Local2Global(Int_t detElemId,
                  Double_t xl, Double_t yl, Double_t zl, 
                  Double_t& xg, Double_t& yg, Double_t& zg) const;
+                 
+    // Set methods
+    void SetDetName(const TString& detName);                 
+    void SetOwner(Bool_t isOwner);                 
 
-    // get methods
+    // Get methods
+    //
     Int_t GetNofModuleTransformers() const;
     const AliMUONGeometryModuleTransformer* GetModuleTransformer(
                                Int_t index, Bool_t warn = true) const;
@@ -55,48 +91,85 @@ class AliMUONGeometryTransformer : public TObject
     const AliMUONGeometryModuleTransformer* GetModuleTransformerByDEId(
                                Int_t detElemId, Bool_t warn = true) const;
 
+    const AliMUONGeometryDetElement* GetDetElement(
+                               Int_t detElemId, Bool_t warn = true) const;
+
+    const TClonesArray* GetMisAlignmentData() const;
+    
     Bool_t  HasDE(Int_t detElemId) const;
 
+    AliMpArea* GetDEArea(Int_t detElemId) const;
+    
   protected:
+    /// Not implemented
     AliMUONGeometryTransformer(const AliMUONGeometryTransformer& right);
+    /// Not implemented
     AliMUONGeometryTransformer&  operator = (const AliMUONGeometryTransformer& right);
  
   private:
+    // static methods
+    static const TString&  GetDefaultDetectorName(); 
+
     // methods
+      
+    void CreateDEAreas() const;
+    
+    Bool_t LoadMapping() const;
     AliMUONGeometryModuleTransformer* GetModuleTransformerNonConst(
                                     Int_t index, Bool_t warn = true) const;
-    TString  ComposePath(const TString& volName, Int_t copyNo) const; 
 
     TGeoHMatrix GetTransform(
                   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 moduleId, 
+
+    void FillModuleTransform(Int_t moduleId,
                   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); 
-    void FillData(Int_t id, const TString& volName, Int_t copyNo,
+    void FillDetElemTransform(Int_t id, 
                   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);
 
-    TString ReadData1(ifstream& in);
-    TString ReadData2(ifstream& in);
+    TString ReadModuleTransforms(ifstream& in);
+    TString ReadDetElemTransforms(ifstream& in);
+    Bool_t  ReadTransformations(const TString& fileName);
 
-    void WriteTransform(ofstream& out, const TGeoCombiTrans* transform) const;
-    void WriteData1(ofstream& out) const;
-    void WriteData2(ofstream& out) const;
+    void    WriteTransform(ofstream& out, const TGeoMatrix* transform) const;
+    void    WriteModuleTransforms(ofstream& out) const;
+    void    WriteDetElemTransforms(ofstream& out) const;
+    
+    TString GetModuleSymName(Int_t moduleId) const;
+    TString GetDESymName(Int_t detElemId) const;
 
     // data members
-    TObjArray*  fModuleTransformers; // list of module transformers
-
-  ClassDef(AliMUONGeometryTransformer,1)  // Geometry parametrisation
+    TString        fDetectorName;       ///< Detector name
+    TObjArray*     fModuleTransformers; ///< array of module transformers
+    TClonesArray*  fMisAlignArray;      ///< array of misalignment data
+    mutable AliMpExMap*    fDEAreas; ///< areas of detection elements in global coordinates
+    
+  ClassDef(AliMUONGeometryTransformer,4)  // Geometry parametrisation
 };
 
 // inline methods
+
+/// Return the number of contained module transformers
 inline Int_t AliMUONGeometryTransformer::GetNofModuleTransformers() const
 { return fModuleTransformers->GetEntriesFast(); }
 
+/// Return the array of misalignment data
+inline const TClonesArray* AliMUONGeometryTransformer::GetMisAlignmentData() const     
+{ return fMisAlignArray; }                    
+                              
+/// Set detector name
+inline void AliMUONGeometryTransformer::SetDetName(const TString& detName)
+{  fDetectorName = detName; }               
+
+/// Set ownership of array module transformers
+inline void AliMUONGeometryTransformer::SetOwner(Bool_t isOwner)
+{  fModuleTransformers->SetOwner(isOwner); }               
+
 #endif //ALI_MUON_GEOMETRY_TRANSFORMER_H