AliRoot Core  d69033e (d69033e)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliMUONGeometryTransformer.h
Go to the documentation of this file.
1 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
2  * See cxx source for full Copyright notice */
3 
4 // $Id$
5 
20 
21 #ifndef ALI_MUON_GEOMETRY_TRANSFORMER_H
22 #define ALI_MUON_GEOMETRY_TRANSFORMER_H
23 
24 #include <TObject.h>
25 #include <TObjArray.h>
26 #include <TGeoMatrix.h>
27 
30 
31 class TGeoManager;
32 class TClonesArray;
33 class AliMpExMap;
34 class AliMpArea;
35 
36 using std::ifstream;
37 using std::ofstream;
38 
39 class AliMUONGeometryTransformer : public TObject
40 {
41  public:
43  AliMUONGeometryTransformer(TRootIOCtor* /*ioCtor*/);
45 
46  // methods
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);
50  void CreateModules();
51 
52  void AddAlignableVolumes() const;
53  TClonesArray* CreateZeroAlignmentData() const;
54  void ClearMisAlignmentData();
55 
56  // IO
57  //
58  Bool_t LoadTransformations();
59  Bool_t LoadGeometryData(const TString& fileName);
60  Bool_t LoadGeometryData();
61 
62  Bool_t WriteTransformations(const TString& fileName) const;
63  Bool_t WriteMisAlignmentData(const TString& fileName) const;
64 
65  // Transformation methods
66  //
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;
80 
81  // Set methods
82  void SetDetName(const TString& detName);
83  void SetOwner(Bool_t isOwner);
84 
85  // Get methods
86  //
87  Int_t GetNofModuleTransformers() const;
89  Int_t index, Bool_t warn = true) const;
90 
92  Int_t detElemId, Bool_t warn = true) const;
93 
95  Int_t detElemId, Bool_t warn = true) const;
96 
97  const TClonesArray* GetMisAlignmentData() const;
98 
99  Bool_t HasDE(Int_t detElemId) const;
100 
101  AliMpArea* GetDEArea(Int_t detElemId) const;
102 
103  protected:
108 
109  private:
110  // static methods
111  static const TString& GetDefaultDetectorName();
112 
113  // methods
114 
115  void CreateDEAreas() const;
116 
117  Bool_t LoadMapping() const;
119  Int_t index, Bool_t warn = true) const;
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;
125 
126  void FillModuleTransform(Int_t moduleId,
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);
130  void FillDetElemTransform(Int_t id,
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 
135  TString ReadModuleTransforms(ifstream& in);
136  TString ReadDetElemTransforms(ifstream& in);
137  Bool_t ReadTransformations(const TString& fileName);
138 
139  void WriteTransform(ofstream& out, const TGeoMatrix* transform) const;
140  void WriteModuleTransforms(ofstream& out) const;
141  void WriteDetElemTransforms(ofstream& out) const;
142 
143  TString GetModuleSymName(Int_t moduleId) const;
144  TString GetDESymName(Int_t detElemId) const;
145 
146  // data members
147  TString fDetectorName;
149  TClonesArray* fMisAlignArray;
150  mutable AliMpExMap* fDEAreas;
151 
152  ClassDef(AliMUONGeometryTransformer,4) // Geometry parametrisation
153 };
154 
155 // inline methods
156 
159 { return fModuleTransformers->GetEntriesFast(); }
160 
162 inline const TClonesArray* AliMUONGeometryTransformer::GetMisAlignmentData() const
163 { return fMisAlignArray; }
164 
166 inline void AliMUONGeometryTransformer::SetDetName(const TString& detName)
167 { fDetectorName = detName; }
168 
170 inline void AliMUONGeometryTransformer::SetOwner(Bool_t isOwner)
171 { fModuleTransformers->SetOwner(isOwner); }
172 
173 #endif //ALI_MUON_GEOMETRY_TRANSFORMER_H
174 
175 
176 
177 
178 
179 
180 
AliMpExMap * fDEAreas
areas of detection elements in global coordinates
const AliMUONGeometryDetElement * GetDetElement(Int_t detElemId, Bool_t warn=true) const
AliMUONGeometryTransformer & operator=(const AliMUONGeometryTransformer &right)
Not implemented.
Int_t GetNofModuleTransformers() const
Return the number of contained module transformers.
Geometry transformer for a detector module.
AliMpArea * GetDEArea(Int_t detElemId) const
#define TObjArray
static const TString & GetDefaultDetectorName()
Top container class for geometry transformations.
void SetOwner(Bool_t isOwner)
Set ownership of array module transformers.
A rectangle area positioned in plane..
Definition: AliMpArea.h:20
void WriteDetElemTransforms(ofstream &out) const
Bool_t HasDE(Int_t detElemId) const
void WriteModuleTransforms(ofstream &out) const
void AddMisAlignDetElement(Int_t detElemId, const TGeoHMatrix &matrix, Bool_t bGlobal=kTRUE)
void FillDetElemTransform(Int_t id, Double_t x, Double_t y, Double_t z, Double_t a1, Double_t a2, Double_t a3, Double_t a4, Double_t a5, Double_t a6)
const TClonesArray * GetMisAlignmentData() const
Return the array of misalignment data.
TGeoHMatrix GetTransform(Double_t x, Double_t y, Double_t z, Double_t a1, Double_t a2, Double_t a3, Double_t a4, Double_t a5, Double_t a6) const
void Local2Global(Int_t detElemId, Float_t xl, Float_t yl, Float_t zl, Float_t &xg, Float_t &yg, Float_t &zg) const
AliMUONGeometryModuleTransformer * GetModuleTransformerNonConst(Int_t index, Bool_t warn=true) const
void AddMisAlignModule(Int_t moduleId, const TGeoHMatrix &matrix, Bool_t bGlobal=kTRUE)
TClonesArray * CreateZeroAlignmentData() const
Bool_t WriteTransformations(const TString &fileName) const
TString GetDESymName(Int_t detElemId) const
TClonesArray * fMisAlignArray
array of misalignment data
const AliMUONGeometryModuleTransformer * GetModuleTransformerByDEId(Int_t detElemId, Bool_t warn=true) const
void Global2Local(Int_t detElemId, Float_t xg, Float_t yg, Float_t zg, Float_t &xl, Float_t &yl, Float_t &zl) const
void FillModuleTransform(Int_t moduleId, Double_t x, Double_t y, Double_t z, Double_t a1, Double_t a2, Double_t a3, Double_t a4, Double_t a5, Double_t a6)
void SetDetName(const TString &detName)
Set detector name.
void AddModuleTransformer(AliMUONGeometryModuleTransformer *transformer)
TString GetModuleSymName(Int_t moduleId) const
const AliMUONGeometryModuleTransformer * GetModuleTransformer(Int_t index, Bool_t warn=true) const
Bool_t WriteMisAlignmentData(const TString &fileName) const
Class for storing detection element transformations.
TObjArray * fModuleTransformers
array of module transformers
Bool_t ReadTransformations(const TString &fileName)
void WriteTransform(ofstream &out, const TGeoMatrix *transform) const
Helper class making Root persistent TExMap.
Definition: AliMpExMap.h:28