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 AliMUONGeometryModuleTransformer* GetModuleTransformerNonConst(
104 Int_t index, Bool_t warn = true) const;
106 TGeoHMatrix GetTransform(
107 Double_t x, Double_t y, Double_t z,
108 Double_t a1, Double_t a2, Double_t a3,
109 Double_t a4, Double_t a5, Double_t a6) const;
111 void FillModuleTransform(Int_t moduleId,
112 Double_t x, Double_t y, Double_t z,
113 Double_t a1, Double_t a2, Double_t a3,
114 Double_t a4, Double_t a5, Double_t a6);
115 void FillDetElemTransform(Int_t id,
116 Double_t x, Double_t y, Double_t z,
117 Double_t a1, Double_t a2, Double_t a3,
118 Double_t a4, Double_t a5, Double_t a6);
120 TString ReadModuleTransforms(ifstream& in);
121 TString ReadDetElemTransforms(ifstream& in);
122 Bool_t ReadTransformations(const TString& fileName);
123 Bool_t LoadTransformations();
125 void WriteTransform(ofstream& out, const TGeoMatrix* transform) const;
126 void WriteModuleTransforms(ofstream& out) const;
127 void WriteDetElemTransforms(ofstream& out) const;
129 TString GetModuleSymName(Int_t moduleId) const;
130 TString GetDESymName(Int_t detElemId) const;
132 // static data members
133 static const TString fgkDefaultDetectorName; ///< Default detector name
137 TString fDetectorName; ///< Detector name
138 TObjArray* fModuleTransformers; ///< array of module transformers
139 TClonesArray* fMisAlignArray; ///< array of misalignment data
141 ClassDef(AliMUONGeometryTransformer,3) // Geometry parametrisation
146 /// Return the number of contained module transformers
147 inline Int_t AliMUONGeometryTransformer::GetNofModuleTransformers() const
148 { return fModuleTransformers->GetEntriesFast(); }
150 /// Return the array of misalignment data
151 inline const TClonesArray* AliMUONGeometryTransformer::GetMisAlignmentData() const
152 { return fMisAlignArray; }
154 /// Set detector name
155 inline void AliMUONGeometryTransformer::SetDetName(const TString& detName)
156 { fDetectorName = detName; }
158 /// Set ownership of array module transformers
159 inline void AliMUONGeometryTransformer::SetOwner(Bool_t isOwner)
160 { fModuleTransformers->SetOwner(isOwner); }
162 #endif //ALI_MUON_GEOMETRY_TRANSFORMER_H