1 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
2 * See cxx source for full Copyright notice */
7 /// \class AliMUONGeometryTransformer
8 /// \brief Top container class for geometry transformations
10 /// Geometry transformations can be filled in these ways:
11 /// - by geometry builder when geometry is built via builders
12 /// (this way is used when running simulation and building geometry
14 /// - from Root geometry file (*.root) or ASCII file (*.dat) using
15 /// the method LoadGeometryData(const TString& fileName)
16 /// - from geometry loaded in AliGeomManager using
17 /// the method LoadGeometryData() without arguments
19 /// \author Ivana Hrivnacova, IPN Orsay
21 #ifndef ALI_MUON_GEOMETRY_TRANSFORMER_H
22 #define ALI_MUON_GEOMETRY_TRANSFORMER_H
25 #include <TObjArray.h>
26 #include <TGeoMatrix.h>
28 class AliMUONGeometryModuleTransformer;
29 class AliMUONGeometryDetElement;
34 class AliMUONGeometryTransformer : public TObject
37 AliMUONGeometryTransformer();
38 AliMUONGeometryTransformer(TRootIOCtor* /*ioCtor*/);
39 virtual ~AliMUONGeometryTransformer();
42 void AddModuleTransformer(AliMUONGeometryModuleTransformer* transformer);
43 void AddMisAlignModule(Int_t moduleId, const TGeoHMatrix& matrix);
44 void AddMisAlignDetElement(Int_t detElemId, const TGeoHMatrix& matrix);
47 void AddAlignableVolumes() const;
48 TClonesArray* CreateZeroAlignmentData() const;
49 void ClearMisAlignmentData();
53 Bool_t LoadGeometryData(const TString& fileName);
54 Bool_t LoadGeometryData();
56 Bool_t WriteTransformations(const TString& fileName) const;
57 Bool_t WriteMisAlignmentData(const TString& fileName) const;
59 // Transformation methods
61 void Global2Local(Int_t detElemId,
62 Float_t xg, Float_t yg, Float_t zg,
63 Float_t& xl, Float_t& yl, Float_t& zl) const;
64 void Global2Local(Int_t detElemId,
65 Double_t xg, Double_t yg, Double_t zg,
66 Double_t& xl, Double_t& yl, Double_t& zl) const;
68 void Local2Global(Int_t detElemId,
69 Float_t xl, Float_t yl, Float_t zl,
70 Float_t& xg, Float_t& yg, Float_t& zg) const;
71 void Local2Global(Int_t detElemId,
72 Double_t xl, Double_t yl, Double_t zl,
73 Double_t& xg, Double_t& yg, Double_t& zg) const;
76 void SetDetName(const TString& detName);
77 void SetOwner(Bool_t isOwner);
81 Int_t GetNofModuleTransformers() const;
82 const AliMUONGeometryModuleTransformer* GetModuleTransformer(
83 Int_t index, Bool_t warn = true) const;
85 const AliMUONGeometryModuleTransformer* GetModuleTransformerByDEId(
86 Int_t detElemId, Bool_t warn = true) const;
88 const AliMUONGeometryDetElement* GetDetElement(
89 Int_t detElemId, Bool_t warn = true) const;
91 const TClonesArray* GetMisAlignmentData() const;
93 Bool_t HasDE(Int_t detElemId) const;
97 AliMUONGeometryTransformer(const AliMUONGeometryTransformer& right);
99 AliMUONGeometryTransformer& operator = (const AliMUONGeometryTransformer& right);
103 Bool_t LoadMapping() const;
104 AliMUONGeometryModuleTransformer* GetModuleTransformerNonConst(
105 Int_t index, Bool_t warn = true) const;
107 TGeoHMatrix GetTransform(
108 Double_t x, Double_t y, Double_t z,
109 Double_t a1, Double_t a2, Double_t a3,
110 Double_t a4, Double_t a5, Double_t a6) const;
112 void FillModuleTransform(Int_t moduleId,
113 Double_t x, Double_t y, Double_t z,
114 Double_t a1, Double_t a2, Double_t a3,
115 Double_t a4, Double_t a5, Double_t a6);
116 void FillDetElemTransform(Int_t id,
117 Double_t x, Double_t y, Double_t z,
118 Double_t a1, Double_t a2, Double_t a3,
119 Double_t a4, Double_t a5, Double_t a6);
121 TString ReadModuleTransforms(ifstream& in);
122 TString ReadDetElemTransforms(ifstream& in);
123 Bool_t ReadTransformations(const TString& fileName);
124 Bool_t LoadTransformations();
126 void WriteTransform(ofstream& out, const TGeoMatrix* transform) const;
127 void WriteModuleTransforms(ofstream& out) const;
128 void WriteDetElemTransforms(ofstream& out) const;
130 TString GetModuleSymName(Int_t moduleId) const;
131 TString GetDESymName(Int_t detElemId) const;
133 // static data members
134 static const TString fgkDefaultDetectorName; ///< Default detector name
138 TString fDetectorName; ///< Detector name
139 TObjArray* fModuleTransformers; ///< array of module transformers
140 TClonesArray* fMisAlignArray; ///< array of misalignment data
142 ClassDef(AliMUONGeometryTransformer,3) // Geometry parametrisation
147 /// Return the number of contained module transformers
148 inline Int_t AliMUONGeometryTransformer::GetNofModuleTransformers() const
149 { return fModuleTransformers->GetEntriesFast(); }
151 /// Return the array of misalignment data
152 inline const TClonesArray* AliMUONGeometryTransformer::GetMisAlignmentData() const
153 { return fMisAlignArray; }
155 /// Set detector name
156 inline void AliMUONGeometryTransformer::SetDetName(const TString& detName)
157 { fDetectorName = detName; }
159 /// Set ownership of array module transformers
160 inline void AliMUONGeometryTransformer::SetOwner(Bool_t isOwner)
161 { fModuleTransformers->SetOwner(isOwner); }
163 #endif //ALI_MUON_GEOMETRY_TRANSFORMER_H