]>
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; | |
f384585c | 45 | TClonesArray* CreateZeroAlignmentData() const; |
46 | void ClearMisAlignmentData(); | |
afc8e661 | 47 | |
48 | // IO | |
a7d4e65b | 49 | // |
50 | Bool_t ReadGeometryData(const TString& volPathFileName, | |
51 | const TString& transformFileName); | |
52 | Bool_t ReadGeometryData(const TString& volPathFileName, | |
53 | TGeoManager* geoManager); | |
54 | ||
55 | Bool_t WriteGeometryData(const TString& volPathFileName, | |
56 | const TString& transformFileName, | |
57 | const TString& misalignFileName = "") const; | |
58 | ||
59 | Bool_t WriteVolumePaths(const TString& fileName) const; | |
afc8e661 | 60 | Bool_t WriteTransformations(const TString& fileName) const; |
a7d4e65b | 61 | Bool_t WriteMisAlignmentData(const TString& fileName) const; |
afc8e661 | 62 | |
a7d4e65b | 63 | // Transformation methods |
64 | // | |
afc8e661 | 65 | void Global2Local(Int_t detElemId, |
66 | Float_t xg, Float_t yg, Float_t zg, | |
67 | Float_t& xl, Float_t& yl, Float_t& zl) const; | |
68 | void Global2Local(Int_t detElemId, | |
69 | Double_t xg, Double_t yg, Double_t zg, | |
70 | Double_t& xl, Double_t& yl, Double_t& zl) const; | |
71 | ||
72 | void Local2Global(Int_t detElemId, | |
73 | Float_t xl, Float_t yl, Float_t zl, | |
74 | Float_t& xg, Float_t& yg, Float_t& zg) const; | |
75 | void Local2Global(Int_t detElemId, | |
76 | Double_t xl, Double_t yl, Double_t zl, | |
77 | Double_t& xg, Double_t& yg, Double_t& zg) const; | |
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: |
96 | AliMUONGeometryTransformer(const AliMUONGeometryTransformer& right); | |
97 | AliMUONGeometryTransformer& operator = (const AliMUONGeometryTransformer& right); | |
98 | ||
99 | private: | |
100 | // methods | |
101 | AliMUONGeometryModuleTransformer* GetModuleTransformerNonConst( | |
102 | Int_t index, Bool_t warn = true) const; | |
afc8e661 | 103 | |
104 | TGeoHMatrix GetTransform( | |
105 | Double_t x, Double_t y, Double_t z, | |
106 | Double_t a1, Double_t a2, Double_t a3, | |
107 | Double_t a4, Double_t a5, Double_t a6) const; | |
a7d4e65b | 108 | |
109 | void FillModuleVolPath(Int_t moduleId, const TString& volPath); | |
110 | void FillDetElemVolPath(Int_t detElemId, const TString& volPath); | |
111 | ||
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 | Bool_t ReadVolPaths(ifstream& in); |
122 | TString ReadModuleTransforms(ifstream& in); | |
123 | TString ReadDetElemTransforms(ifstream& in); | |
124 | Bool_t LoadTransforms(TGeoManager* tgeoManager); | |
afc8e661 | 125 | |
a7d4e65b | 126 | Bool_t ReadVolPaths(const TString& fileName); |
127 | Bool_t ReadTransformations(const TString& fileName); | |
128 | Bool_t ReadTransformations2(const TString& fileName); | |
129 | ||
130 | void WriteTransform(ofstream& out, const TGeoMatrix* transform) const; | |
131 | void WriteModuleVolPaths(ofstream& out) const; | |
132 | void WriteDetElemVolPaths(ofstream& out) const; | |
133 | void WriteModuleTransforms(ofstream& out) const; | |
134 | void WriteDetElemTransforms(ofstream& out) const; | |
d4d05625 | 135 | |
136 | TString GetModuleSymName(Int_t moduleId) const; | |
137 | TString GetDESymName(Int_t detElemId) const; | |
afc8e661 | 138 | |
139 | // data members | |
f384585c | 140 | TString fDetectorName; ///< Detector name |
829425a5 | 141 | TObjArray* fModuleTransformers; ///< array of module transformers |
142 | TClonesArray* fMisAlignArray; ///< array of misalignment data | |
afc8e661 | 143 | |
a7d4e65b | 144 | ClassDef(AliMUONGeometryTransformer,2) // Geometry parametrisation |
afc8e661 | 145 | }; |
146 | ||
b6ddcf59 | 147 | // inline methods |
a9aad96e | 148 | |
149 | /// Return the number of contained module transformers | |
b6ddcf59 | 150 | inline Int_t AliMUONGeometryTransformer::GetNofModuleTransformers() const |
151 | { return fModuleTransformers->GetEntriesFast(); } | |
152 | ||
a9aad96e | 153 | /// Return the array of misalignment data |
a7d4e65b | 154 | inline const TClonesArray* AliMUONGeometryTransformer::GetMisAlignmentData() const |
155 | { return fMisAlignArray; } | |
156 | ||
afc8e661 | 157 | #endif //ALI_MUON_GEOMETRY_TRANSFORMER_H |
158 | ||
159 | ||
160 | ||
161 | ||
162 | ||
163 | ||
164 |