]>
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 | |
12 | /// - from Root geometry file (*.root) or Root geometry manager | |
13 | /// - from ASCII file (*.dat) | |
14 | /// If geometry is loaded from a file, the list of aligned volume paths | |
15 | /// has to be read first from volpaths.dat file. | |
16 | /// | |
a9aad96e | 17 | /// \author Ivana Hrivnacova, IPN Orsay |
afc8e661 | 18 | |
19 | #ifndef ALI_MUON_GEOMETRY_TRANSFORMER_H | |
20 | #define ALI_MUON_GEOMETRY_TRANSFORMER_H | |
21 | ||
22 | #include <TObject.h> | |
b6ddcf59 | 23 | #include <TObjArray.h> |
afc8e661 | 24 | #include <TGeoMatrix.h> |
25 | ||
afc8e661 | 26 | class AliMUONGeometryModuleTransformer; |
a7d4e65b | 27 | class AliMUONGeometryDetElement; |
28 | ||
29 | class TGeoManager; | |
30 | class TClonesArray; | |
afc8e661 | 31 | |
32 | class AliMUONGeometryTransformer : public TObject | |
33 | { | |
34 | public: | |
d4d05625 | 35 | AliMUONGeometryTransformer(Bool_t isOwner, const TString& detName = "MUON"); |
afc8e661 | 36 | AliMUONGeometryTransformer(); |
37 | virtual ~AliMUONGeometryTransformer(); | |
38 | ||
39 | // methods | |
40 | void AddModuleTransformer(AliMUONGeometryModuleTransformer* transformer); | |
a7d4e65b | 41 | void AddMisAlignModule(Int_t moduleId, const TGeoHMatrix& matrix); |
42 | void AddMisAlignDetElement(Int_t detElemId, const TGeoHMatrix& matrix); | |
d4d05625 | 43 | |
44 | void AddAlignableVolumes() const; | |
ae612121 | 45 | TClonesArray* CreateZeroAlignmentData() const; |
afc8e661 | 46 | |
47 | // IO | |
a7d4e65b | 48 | // |
49 | Bool_t ReadGeometryData(const TString& volPathFileName, | |
50 | const TString& transformFileName); | |
51 | Bool_t ReadGeometryData(const TString& volPathFileName, | |
52 | TGeoManager* geoManager); | |
53 | ||
54 | Bool_t WriteGeometryData(const TString& volPathFileName, | |
55 | const TString& transformFileName, | |
56 | const TString& misalignFileName = "") const; | |
57 | ||
58 | Bool_t WriteVolumePaths(const TString& fileName) const; | |
afc8e661 | 59 | Bool_t WriteTransformations(const TString& fileName) const; |
a7d4e65b | 60 | Bool_t WriteMisAlignmentData(const TString& fileName) const; |
afc8e661 | 61 | |
a7d4e65b | 62 | // Transformation methods |
63 | // | |
afc8e661 | 64 | void Global2Local(Int_t detElemId, |
65 | Float_t xg, Float_t yg, Float_t zg, | |
66 | Float_t& xl, Float_t& yl, Float_t& zl) const; | |
67 | void Global2Local(Int_t detElemId, | |
68 | Double_t xg, Double_t yg, Double_t zg, | |
69 | Double_t& xl, Double_t& yl, Double_t& zl) const; | |
70 | ||
71 | void Local2Global(Int_t detElemId, | |
72 | Float_t xl, Float_t yl, Float_t zl, | |
73 | Float_t& xg, Float_t& yg, Float_t& zg) const; | |
74 | void Local2Global(Int_t detElemId, | |
75 | Double_t xl, Double_t yl, Double_t zl, | |
76 | Double_t& xg, Double_t& yg, Double_t& zg) const; | |
77 | ||
a7d4e65b | 78 | // Get methods |
79 | // | |
b6ddcf59 | 80 | Int_t GetNofModuleTransformers() const; |
afc8e661 | 81 | const AliMUONGeometryModuleTransformer* GetModuleTransformer( |
82 | Int_t index, Bool_t warn = true) const; | |
83 | ||
84 | const AliMUONGeometryModuleTransformer* GetModuleTransformerByDEId( | |
85 | Int_t detElemId, Bool_t warn = true) const; | |
86 | ||
a7d4e65b | 87 | const AliMUONGeometryDetElement* GetDetElement( |
88 | Int_t detElemId, Bool_t warn = true) const; | |
89 | ||
d4d05625 | 90 | const TClonesArray* GetMisAlignmentData() const; |
91 | ||
317aa7dc | 92 | Bool_t HasDE(Int_t detElemId) const; |
93 | ||
afc8e661 | 94 | protected: |
95 | AliMUONGeometryTransformer(const AliMUONGeometryTransformer& right); | |
96 | AliMUONGeometryTransformer& operator = (const AliMUONGeometryTransformer& right); | |
97 | ||
98 | private: | |
99 | // methods | |
100 | AliMUONGeometryModuleTransformer* GetModuleTransformerNonConst( | |
101 | Int_t index, Bool_t warn = true) const; | |
afc8e661 | 102 | |
103 | TGeoHMatrix GetTransform( | |
104 | Double_t x, Double_t y, Double_t z, | |
105 | Double_t a1, Double_t a2, Double_t a3, | |
106 | Double_t a4, Double_t a5, Double_t a6) const; | |
a7d4e65b | 107 | |
108 | void FillModuleVolPath(Int_t moduleId, const TString& volPath); | |
109 | void FillDetElemVolPath(Int_t detElemId, const TString& volPath); | |
110 | ||
111 | void FillModuleTransform(Int_t moduleId, | |
afc8e661 | 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); | |
a7d4e65b | 115 | void FillDetElemTransform(Int_t id, |
afc8e661 | 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); | |
119 | ||
a7d4e65b | 120 | Bool_t ReadVolPaths(ifstream& in); |
121 | TString ReadModuleTransforms(ifstream& in); | |
122 | TString ReadDetElemTransforms(ifstream& in); | |
123 | Bool_t LoadTransforms(TGeoManager* tgeoManager); | |
afc8e661 | 124 | |
a7d4e65b | 125 | Bool_t ReadVolPaths(const TString& fileName); |
126 | Bool_t ReadTransformations(const TString& fileName); | |
127 | Bool_t ReadTransformations2(const TString& fileName); | |
128 | ||
129 | void WriteTransform(ofstream& out, const TGeoMatrix* transform) const; | |
130 | void WriteModuleVolPaths(ofstream& out) const; | |
131 | void WriteDetElemVolPaths(ofstream& out) const; | |
132 | void WriteModuleTransforms(ofstream& out) const; | |
133 | void WriteDetElemTransforms(ofstream& out) const; | |
d4d05625 | 134 | |
135 | TString GetModuleSymName(Int_t moduleId) const; | |
136 | TString GetDESymName(Int_t detElemId) const; | |
afc8e661 | 137 | |
138 | // data members | |
d4d05625 | 139 | TString fDetectorName; /// < Detector name |
829425a5 | 140 | TObjArray* fModuleTransformers; ///< array of module transformers |
141 | TClonesArray* fMisAlignArray; ///< array of misalignment data | |
afc8e661 | 142 | |
a7d4e65b | 143 | ClassDef(AliMUONGeometryTransformer,2) // Geometry parametrisation |
afc8e661 | 144 | }; |
145 | ||
b6ddcf59 | 146 | // inline methods |
a9aad96e | 147 | |
148 | /// Return the number of contained module transformers | |
b6ddcf59 | 149 | inline Int_t AliMUONGeometryTransformer::GetNofModuleTransformers() const |
150 | { return fModuleTransformers->GetEntriesFast(); } | |
151 | ||
a9aad96e | 152 | /// Return the array of misalignment data |
a7d4e65b | 153 | inline const TClonesArray* AliMUONGeometryTransformer::GetMisAlignmentData() const |
154 | { return fMisAlignArray; } | |
155 | ||
afc8e661 | 156 | #endif //ALI_MUON_GEOMETRY_TRANSFORMER_H |
157 | ||
158 | ||
159 | ||
160 | ||
161 | ||
162 | ||
163 |