]>
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; | |
afc8e661 | 33 | |
34 | class AliMUONGeometryTransformer : public TObject | |
35 | { | |
36 | public: | |
afc8e661 | 37 | AliMUONGeometryTransformer(); |
327d1302 | 38 | AliMUONGeometryTransformer(TRootIOCtor* /*ioCtor*/); |
afc8e661 | 39 | virtual ~AliMUONGeometryTransformer(); |
40 | ||
41 | // methods | |
42 | void AddModuleTransformer(AliMUONGeometryModuleTransformer* transformer); | |
a7d4e65b | 43 | void AddMisAlignModule(Int_t moduleId, const TGeoHMatrix& matrix); |
44 | void AddMisAlignDetElement(Int_t detElemId, const TGeoHMatrix& matrix); | |
327d1302 | 45 | void CreateModules(); |
d4d05625 | 46 | |
47 | void AddAlignableVolumes() const; | |
f384585c | 48 | TClonesArray* CreateZeroAlignmentData() const; |
327d1302 | 49 | void ClearMisAlignmentData(); |
afc8e661 | 50 | |
51 | // IO | |
a7d4e65b | 52 | // |
327d1302 | 53 | Bool_t LoadGeometryData(const TString& fileName); |
54 | Bool_t LoadGeometryData(); | |
55 | ||
afc8e661 | 56 | Bool_t WriteTransformations(const TString& fileName) const; |
a7d4e65b | 57 | Bool_t WriteMisAlignmentData(const TString& fileName) const; |
afc8e661 | 58 | |
a7d4e65b | 59 | // Transformation methods |
60 | // | |
afc8e661 | 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; | |
67 | ||
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; | |
327d1302 | 74 | |
75 | // Set methods | |
76 | void SetDetName(const TString& detName); | |
77 | void SetOwner(Bool_t isOwner); | |
afc8e661 | 78 | |
a7d4e65b | 79 | // Get methods |
80 | // | |
b6ddcf59 | 81 | Int_t GetNofModuleTransformers() const; |
afc8e661 | 82 | const AliMUONGeometryModuleTransformer* GetModuleTransformer( |
83 | Int_t index, Bool_t warn = true) const; | |
84 | ||
85 | const AliMUONGeometryModuleTransformer* GetModuleTransformerByDEId( | |
86 | Int_t detElemId, Bool_t warn = true) const; | |
87 | ||
a7d4e65b | 88 | const AliMUONGeometryDetElement* GetDetElement( |
89 | Int_t detElemId, Bool_t warn = true) const; | |
90 | ||
d4d05625 | 91 | const TClonesArray* GetMisAlignmentData() const; |
92 | ||
317aa7dc | 93 | Bool_t HasDE(Int_t detElemId) const; |
94 | ||
afc8e661 | 95 | protected: |
71a2d3aa | 96 | /// Not implemented |
afc8e661 | 97 | AliMUONGeometryTransformer(const AliMUONGeometryTransformer& right); |
71a2d3aa | 98 | /// Not implemented |
afc8e661 | 99 | AliMUONGeometryTransformer& operator = (const AliMUONGeometryTransformer& right); |
100 | ||
101 | private: | |
102 | // methods | |
88544f7e | 103 | Bool_t LoadMapping() const; |
afc8e661 | 104 | AliMUONGeometryModuleTransformer* GetModuleTransformerNonConst( |
105 | Int_t index, Bool_t warn = true) const; | |
afc8e661 | 106 | |
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; | |
a7d4e65b | 111 | |
a7d4e65b | 112 | void FillModuleTransform(Int_t moduleId, |
afc8e661 | 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); | |
a7d4e65b | 116 | void FillDetElemTransform(Int_t id, |
afc8e661 | 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); | |
120 | ||
a7d4e65b | 121 | TString ReadModuleTransforms(ifstream& in); |
122 | TString ReadDetElemTransforms(ifstream& in); | |
a7d4e65b | 123 | Bool_t ReadTransformations(const TString& fileName); |
327d1302 | 124 | Bool_t LoadTransformations(); |
a7d4e65b | 125 | |
126 | void WriteTransform(ofstream& out, const TGeoMatrix* transform) const; | |
a7d4e65b | 127 | void WriteModuleTransforms(ofstream& out) const; |
128 | void WriteDetElemTransforms(ofstream& out) const; | |
d4d05625 | 129 | |
130 | TString GetModuleSymName(Int_t moduleId) const; | |
131 | TString GetDESymName(Int_t detElemId) const; | |
327d1302 | 132 | |
133 | // static data members | |
134 | static const TString fgkDefaultDetectorName; ///< Default detector name | |
135 | ||
afc8e661 | 136 | |
137 | // data members | |
f384585c | 138 | TString fDetectorName; ///< Detector name |
829425a5 | 139 | TObjArray* fModuleTransformers; ///< array of module transformers |
140 | TClonesArray* fMisAlignArray; ///< array of misalignment data | |
afc8e661 | 141 | |
327d1302 | 142 | ClassDef(AliMUONGeometryTransformer,3) // Geometry parametrisation |
afc8e661 | 143 | }; |
144 | ||
b6ddcf59 | 145 | // inline methods |
a9aad96e | 146 | |
147 | /// Return the number of contained module transformers | |
b6ddcf59 | 148 | inline Int_t AliMUONGeometryTransformer::GetNofModuleTransformers() const |
149 | { return fModuleTransformers->GetEntriesFast(); } | |
150 | ||
a9aad96e | 151 | /// Return the array of misalignment data |
a7d4e65b | 152 | inline const TClonesArray* AliMUONGeometryTransformer::GetMisAlignmentData() const |
153 | { return fMisAlignArray; } | |
327d1302 | 154 | |
155 | /// Set detector name | |
156 | inline void AliMUONGeometryTransformer::SetDetName(const TString& detName) | |
157 | { fDetectorName = detName; } | |
158 | ||
159 | /// Set ownership of array module transformers | |
160 | inline void AliMUONGeometryTransformer::SetOwner(Bool_t isOwner) | |
161 | { fModuleTransformers->SetOwner(isOwner); } | |
a7d4e65b | 162 | |
afc8e661 | 163 | #endif //ALI_MUON_GEOMETRY_TRANSFORMER_H |
164 | ||
165 | ||
166 | ||
167 | ||
168 | ||
169 | ||
170 |