]>
Commit | Line | Data |
---|---|---|
afc8e661 | 1 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * |
2 | * See cxx source for full Copyright notice */ | |
3 | ||
4 | // $Id$ | |
5 | ||
6 | /// \ingroup geometry | |
7 | /// \class AliMUONGeometryTransformer | |
8 | /// \brief Top container class for geometry transformations | |
9 | /// | |
a7d4e65b | 10 | /// Geometry transformations can be filled in these ways: |
11 | /// - by geometry builder when geometry is built via builders | |
327d1302 | 12 | /// (this way is used when running simulation and building geometry |
13 | /// via VirtualMC) | |
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 | |
a7d4e65b | 18 | /// |
a9aad96e | 19 | /// \author Ivana Hrivnacova, IPN Orsay |
afc8e661 | 20 | |
21 | #ifndef ALI_MUON_GEOMETRY_TRANSFORMER_H | |
22 | #define ALI_MUON_GEOMETRY_TRANSFORMER_H | |
23 | ||
24 | #include <TObject.h> | |
b6ddcf59 | 25 | #include <TObjArray.h> |
afc8e661 | 26 | #include <TGeoMatrix.h> |
27 | ||
afc8e661 | 28 | class AliMUONGeometryModuleTransformer; |
a7d4e65b | 29 | class AliMUONGeometryDetElement; |
30 | ||
31 | class TGeoManager; | |
32 | class TClonesArray; | |
9bf6860b | 33 | class AliMpExMap; |
34 | class AliMpArea; | |
afc8e661 | 35 | |
b80faac0 | 36 | using std::ifstream; |
37 | using std::ofstream; | |
38 | ||
afc8e661 | 39 | class AliMUONGeometryTransformer : public TObject |
40 | { | |
41 | public: | |
afc8e661 | 42 | AliMUONGeometryTransformer(); |
327d1302 | 43 | AliMUONGeometryTransformer(TRootIOCtor* /*ioCtor*/); |
afc8e661 | 44 | virtual ~AliMUONGeometryTransformer(); |
45 | ||
46 | // methods | |
47 | void AddModuleTransformer(AliMUONGeometryModuleTransformer* transformer); | |
d148dd1c | 48 | void AddMisAlignModule(Int_t moduleId, const TGeoHMatrix& matrix, Bool_t bGlobal = kTRUE); |
49 | void AddMisAlignDetElement(Int_t detElemId, const TGeoHMatrix& matrix, Bool_t bGlobal = kTRUE); | |
327d1302 | 50 | void CreateModules(); |
d4d05625 | 51 | |
52 | void AddAlignableVolumes() const; | |
f384585c | 53 | TClonesArray* CreateZeroAlignmentData() const; |
327d1302 | 54 | void ClearMisAlignmentData(); |
afc8e661 | 55 | |
56 | // IO | |
a7d4e65b | 57 | // |
450ca6fb | 58 | Bool_t LoadTransformations(); |
327d1302 | 59 | Bool_t LoadGeometryData(const TString& fileName); |
60 | Bool_t LoadGeometryData(); | |
61 | ||
afc8e661 | 62 | Bool_t WriteTransformations(const TString& fileName) const; |
a7d4e65b | 63 | Bool_t WriteMisAlignmentData(const TString& fileName) const; |
afc8e661 | 64 | |
a7d4e65b | 65 | // Transformation methods |
66 | // | |
afc8e661 | 67 | void Global2Local(Int_t detElemId, |
68 | Float_t xg, Float_t yg, Float_t zg, | |
69 | Float_t& xl, Float_t& yl, Float_t& zl) const; | |
70 | void Global2Local(Int_t detElemId, | |
71 | Double_t xg, Double_t yg, Double_t zg, | |
72 | Double_t& xl, Double_t& yl, Double_t& zl) const; | |
73 | ||
74 | void Local2Global(Int_t detElemId, | |
75 | Float_t xl, Float_t yl, Float_t zl, | |
76 | Float_t& xg, Float_t& yg, Float_t& zg) const; | |
77 | void Local2Global(Int_t detElemId, | |
78 | Double_t xl, Double_t yl, Double_t zl, | |
79 | Double_t& xg, Double_t& yg, Double_t& zg) const; | |
327d1302 | 80 | |
81 | // Set methods | |
82 | void SetDetName(const TString& detName); | |
83 | void SetOwner(Bool_t isOwner); | |
afc8e661 | 84 | |
a7d4e65b | 85 | // Get methods |
86 | // | |
b6ddcf59 | 87 | Int_t GetNofModuleTransformers() const; |
afc8e661 | 88 | const AliMUONGeometryModuleTransformer* GetModuleTransformer( |
89 | Int_t index, Bool_t warn = true) const; | |
90 | ||
91 | const AliMUONGeometryModuleTransformer* GetModuleTransformerByDEId( | |
92 | Int_t detElemId, Bool_t warn = true) const; | |
93 | ||
a7d4e65b | 94 | const AliMUONGeometryDetElement* GetDetElement( |
95 | Int_t detElemId, Bool_t warn = true) const; | |
96 | ||
d4d05625 | 97 | const TClonesArray* GetMisAlignmentData() const; |
98 | ||
317aa7dc | 99 | Bool_t HasDE(Int_t detElemId) const; |
100 | ||
9bf6860b | 101 | AliMpArea* GetDEArea(Int_t detElemId) const; |
102 | ||
afc8e661 | 103 | protected: |
71a2d3aa | 104 | /// Not implemented |
afc8e661 | 105 | AliMUONGeometryTransformer(const AliMUONGeometryTransformer& right); |
71a2d3aa | 106 | /// Not implemented |
afc8e661 | 107 | AliMUONGeometryTransformer& operator = (const AliMUONGeometryTransformer& right); |
108 | ||
109 | private: | |
31edb2d7 | 110 | // static methods |
111 | static const TString& GetDefaultDetectorName(); | |
112 | ||
afc8e661 | 113 | // methods |
9bf6860b | 114 | |
31edb2d7 | 115 | void CreateDEAreas() const; |
9bf6860b | 116 | |
88544f7e | 117 | Bool_t LoadMapping() const; |
afc8e661 | 118 | AliMUONGeometryModuleTransformer* GetModuleTransformerNonConst( |
119 | Int_t index, Bool_t warn = true) const; | |
afc8e661 | 120 | |
121 | TGeoHMatrix GetTransform( | |
122 | Double_t x, Double_t y, Double_t z, | |
123 | Double_t a1, Double_t a2, Double_t a3, | |
124 | Double_t a4, Double_t a5, Double_t a6) const; | |
a7d4e65b | 125 | |
a7d4e65b | 126 | void FillModuleTransform(Int_t moduleId, |
afc8e661 | 127 | Double_t x, Double_t y, Double_t z, |
128 | Double_t a1, Double_t a2, Double_t a3, | |
129 | Double_t a4, Double_t a5, Double_t a6); | |
a7d4e65b | 130 | void FillDetElemTransform(Int_t id, |
afc8e661 | 131 | Double_t x, Double_t y, Double_t z, |
132 | Double_t a1, Double_t a2, Double_t a3, | |
133 | Double_t a4, Double_t a5, Double_t a6); | |
134 | ||
a7d4e65b | 135 | TString ReadModuleTransforms(ifstream& in); |
136 | TString ReadDetElemTransforms(ifstream& in); | |
a7d4e65b | 137 | Bool_t ReadTransformations(const TString& fileName); |
a7d4e65b | 138 | |
139 | void WriteTransform(ofstream& out, const TGeoMatrix* transform) const; | |
a7d4e65b | 140 | void WriteModuleTransforms(ofstream& out) const; |
141 | void WriteDetElemTransforms(ofstream& out) const; | |
d4d05625 | 142 | |
143 | TString GetModuleSymName(Int_t moduleId) const; | |
144 | TString GetDESymName(Int_t detElemId) const; | |
afc8e661 | 145 | |
146 | // data members | |
f384585c | 147 | TString fDetectorName; ///< Detector name |
829425a5 | 148 | TObjArray* fModuleTransformers; ///< array of module transformers |
149 | TClonesArray* fMisAlignArray; ///< array of misalignment data | |
9bf6860b | 150 | mutable AliMpExMap* fDEAreas; ///< areas of detection elements in global coordinates |
151 | ||
152 | ClassDef(AliMUONGeometryTransformer,4) // Geometry parametrisation | |
afc8e661 | 153 | }; |
154 | ||
b6ddcf59 | 155 | // inline methods |
a9aad96e | 156 | |
157 | /// Return the number of contained module transformers | |
b6ddcf59 | 158 | inline Int_t AliMUONGeometryTransformer::GetNofModuleTransformers() const |
159 | { return fModuleTransformers->GetEntriesFast(); } | |
160 | ||
a9aad96e | 161 | /// Return the array of misalignment data |
a7d4e65b | 162 | inline const TClonesArray* AliMUONGeometryTransformer::GetMisAlignmentData() const |
163 | { return fMisAlignArray; } | |
327d1302 | 164 | |
165 | /// Set detector name | |
166 | inline void AliMUONGeometryTransformer::SetDetName(const TString& detName) | |
167 | { fDetectorName = detName; } | |
168 | ||
169 | /// Set ownership of array module transformers | |
170 | inline void AliMUONGeometryTransformer::SetOwner(Bool_t isOwner) | |
171 | { fModuleTransformers->SetOwner(isOwner); } | |
a7d4e65b | 172 | |
afc8e661 | 173 | #endif //ALI_MUON_GEOMETRY_TRANSFORMER_H |
174 | ||
175 | ||
176 | ||
177 | ||
178 | ||
179 | ||
180 |