]>
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 | /// | |
afc8e661 | 17 | /// Author: Ivana Hrivnacova, IPN Orsay |
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: | |
35 | AliMUONGeometryTransformer(Bool_t isOwner); | |
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); | |
ae612121 | 43 | |
44 | TClonesArray* CreateZeroAlignmentData() const; | |
afc8e661 | 45 | |
46 | // IO | |
a7d4e65b | 47 | // |
48 | Bool_t ReadGeometryData(const TString& volPathFileName, | |
49 | const TString& transformFileName); | |
50 | Bool_t ReadGeometryData(const TString& volPathFileName, | |
51 | TGeoManager* geoManager); | |
52 | ||
53 | Bool_t WriteGeometryData(const TString& volPathFileName, | |
54 | const TString& transformFileName, | |
55 | const TString& misalignFileName = "") const; | |
56 | ||
57 | Bool_t WriteVolumePaths(const TString& fileName) const; | |
afc8e661 | 58 | Bool_t WriteTransformations(const TString& fileName) const; |
a7d4e65b | 59 | Bool_t WriteMisAlignmentData(const TString& fileName) const; |
afc8e661 | 60 | |
a7d4e65b | 61 | // Transformation methods |
62 | // | |
afc8e661 | 63 | void Global2Local(Int_t detElemId, |
64 | Float_t xg, Float_t yg, Float_t zg, | |
65 | Float_t& xl, Float_t& yl, Float_t& zl) const; | |
66 | void Global2Local(Int_t detElemId, | |
67 | Double_t xg, Double_t yg, Double_t zg, | |
68 | Double_t& xl, Double_t& yl, Double_t& zl) const; | |
69 | ||
70 | void Local2Global(Int_t detElemId, | |
71 | Float_t xl, Float_t yl, Float_t zl, | |
72 | Float_t& xg, Float_t& yg, Float_t& zg) const; | |
73 | void Local2Global(Int_t detElemId, | |
74 | Double_t xl, Double_t yl, Double_t zl, | |
75 | Double_t& xg, Double_t& yg, Double_t& zg) const; | |
76 | ||
a7d4e65b | 77 | // Get methods |
78 | // | |
b6ddcf59 | 79 | Int_t GetNofModuleTransformers() const; |
afc8e661 | 80 | const AliMUONGeometryModuleTransformer* GetModuleTransformer( |
81 | Int_t index, Bool_t warn = true) const; | |
82 | ||
83 | const AliMUONGeometryModuleTransformer* GetModuleTransformerByDEId( | |
84 | Int_t detElemId, Bool_t warn = true) const; | |
85 | ||
a7d4e65b | 86 | const AliMUONGeometryDetElement* GetDetElement( |
87 | Int_t detElemId, Bool_t warn = true) const; | |
88 | ||
89 | const TClonesArray* GetMisAlignmentData() const; | |
90 | ||
317aa7dc | 91 | Bool_t HasDE(Int_t detElemId) const; |
92 | ||
afc8e661 | 93 | protected: |
94 | AliMUONGeometryTransformer(const AliMUONGeometryTransformer& right); | |
95 | AliMUONGeometryTransformer& operator = (const AliMUONGeometryTransformer& right); | |
96 | ||
97 | private: | |
98 | // methods | |
99 | AliMUONGeometryModuleTransformer* GetModuleTransformerNonConst( | |
100 | Int_t index, Bool_t warn = true) const; | |
afc8e661 | 101 | |
102 | TGeoHMatrix GetTransform( | |
103 | Double_t x, Double_t y, Double_t z, | |
104 | Double_t a1, Double_t a2, Double_t a3, | |
105 | Double_t a4, Double_t a5, Double_t a6) const; | |
a7d4e65b | 106 | |
107 | void FillModuleVolPath(Int_t moduleId, const TString& volPath); | |
108 | void FillDetElemVolPath(Int_t detElemId, const TString& volPath); | |
109 | ||
110 | void FillModuleTransform(Int_t moduleId, | |
afc8e661 | 111 | Double_t x, Double_t y, Double_t z, |
112 | Double_t a1, Double_t a2, Double_t a3, | |
113 | Double_t a4, Double_t a5, Double_t a6); | |
a7d4e65b | 114 | void FillDetElemTransform(Int_t id, |
afc8e661 | 115 | Double_t x, Double_t y, Double_t z, |
116 | Double_t a1, Double_t a2, Double_t a3, | |
117 | Double_t a4, Double_t a5, Double_t a6); | |
118 | ||
a7d4e65b | 119 | Bool_t ReadVolPaths(ifstream& in); |
120 | TString ReadModuleTransforms(ifstream& in); | |
121 | TString ReadDetElemTransforms(ifstream& in); | |
122 | Bool_t LoadTransforms(TGeoManager* tgeoManager); | |
afc8e661 | 123 | |
a7d4e65b | 124 | Bool_t ReadVolPaths(const TString& fileName); |
125 | Bool_t ReadTransformations(const TString& fileName); | |
126 | Bool_t ReadTransformations2(const TString& fileName); | |
127 | ||
128 | void WriteTransform(ofstream& out, const TGeoMatrix* transform) const; | |
129 | void WriteModuleVolPaths(ofstream& out) const; | |
130 | void WriteDetElemVolPaths(ofstream& out) const; | |
131 | void WriteModuleTransforms(ofstream& out) const; | |
132 | void WriteDetElemTransforms(ofstream& out) const; | |
afc8e661 | 133 | |
134 | // data members | |
829425a5 | 135 | TObjArray* fModuleTransformers; ///< array of module transformers |
136 | TClonesArray* fMisAlignArray; ///< array of misalignment data | |
afc8e661 | 137 | |
a7d4e65b | 138 | ClassDef(AliMUONGeometryTransformer,2) // Geometry parametrisation |
afc8e661 | 139 | }; |
140 | ||
b6ddcf59 | 141 | // inline methods |
142 | inline Int_t AliMUONGeometryTransformer::GetNofModuleTransformers() const | |
143 | { return fModuleTransformers->GetEntriesFast(); } | |
144 | ||
a7d4e65b | 145 | inline const TClonesArray* AliMUONGeometryTransformer::GetMisAlignmentData() const |
146 | { return fMisAlignArray; } | |
147 | ||
afc8e661 | 148 | #endif //ALI_MUON_GEOMETRY_TRANSFORMER_H |
149 | ||
150 | ||
151 | ||
152 | ||
153 | ||
154 | ||
155 |