- Disentangle masks effect from trigger chamber efficiency estimation.
[u/mrichter/AliRoot.git] / MUON / AliMUONGeometryTransformer.h
CommitLineData
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 28class AliMUONGeometryModuleTransformer;
a7d4e65b 29class AliMUONGeometryDetElement;
30
31class TGeoManager;
32class TClonesArray;
9bf6860b 33class AliMpExMap;
34class AliMpArea;
afc8e661 35
36class AliMUONGeometryTransformer : public TObject
37{
38 public:
afc8e661 39 AliMUONGeometryTransformer();
327d1302 40 AliMUONGeometryTransformer(TRootIOCtor* /*ioCtor*/);
afc8e661 41 virtual ~AliMUONGeometryTransformer();
42
43 // methods
44 void AddModuleTransformer(AliMUONGeometryModuleTransformer* transformer);
d148dd1c 45 void AddMisAlignModule(Int_t moduleId, const TGeoHMatrix& matrix, Bool_t bGlobal = kTRUE);
46 void AddMisAlignDetElement(Int_t detElemId, const TGeoHMatrix& matrix, Bool_t bGlobal = kTRUE);
327d1302 47 void CreateModules();
d4d05625 48
49 void AddAlignableVolumes() const;
f384585c 50 TClonesArray* CreateZeroAlignmentData() const;
327d1302 51 void ClearMisAlignmentData();
afc8e661 52
53 // IO
a7d4e65b 54 //
450ca6fb 55 Bool_t LoadTransformations();
327d1302 56 Bool_t LoadGeometryData(const TString& fileName);
57 Bool_t LoadGeometryData();
58
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;
327d1302 77
78 // Set methods
79 void SetDetName(const TString& detName);
80 void SetOwner(Bool_t isOwner);
afc8e661 81
a7d4e65b 82 // Get methods
83 //
b6ddcf59 84 Int_t GetNofModuleTransformers() const;
afc8e661 85 const AliMUONGeometryModuleTransformer* GetModuleTransformer(
86 Int_t index, Bool_t warn = true) const;
87
88 const AliMUONGeometryModuleTransformer* GetModuleTransformerByDEId(
89 Int_t detElemId, Bool_t warn = true) const;
90
a7d4e65b 91 const AliMUONGeometryDetElement* GetDetElement(
92 Int_t detElemId, Bool_t warn = true) const;
93
d4d05625 94 const TClonesArray* GetMisAlignmentData() const;
95
317aa7dc 96 Bool_t HasDE(Int_t detElemId) const;
97
9bf6860b 98 AliMpArea* GetDEArea(Int_t detElemId) const;
99
afc8e661 100 protected:
71a2d3aa 101 /// Not implemented
afc8e661 102 AliMUONGeometryTransformer(const AliMUONGeometryTransformer& right);
71a2d3aa 103 /// Not implemented
afc8e661 104 AliMUONGeometryTransformer& operator = (const AliMUONGeometryTransformer& right);
105
106 private:
31edb2d7 107 // static methods
108 static const TString& GetDefaultDetectorName();
109
afc8e661 110 // methods
9bf6860b 111
31edb2d7 112 void CreateDEAreas() const;
9bf6860b 113
88544f7e 114 Bool_t LoadMapping() const;
afc8e661 115 AliMUONGeometryModuleTransformer* GetModuleTransformerNonConst(
116 Int_t index, Bool_t warn = true) const;
afc8e661 117
118 TGeoHMatrix GetTransform(
119 Double_t x, Double_t y, Double_t z,
120 Double_t a1, Double_t a2, Double_t a3,
121 Double_t a4, Double_t a5, Double_t a6) const;
a7d4e65b 122
a7d4e65b 123 void FillModuleTransform(Int_t moduleId,
afc8e661 124 Double_t x, Double_t y, Double_t z,
125 Double_t a1, Double_t a2, Double_t a3,
126 Double_t a4, Double_t a5, Double_t a6);
a7d4e65b 127 void FillDetElemTransform(Int_t id,
afc8e661 128 Double_t x, Double_t y, Double_t z,
129 Double_t a1, Double_t a2, Double_t a3,
130 Double_t a4, Double_t a5, Double_t a6);
131
a7d4e65b 132 TString ReadModuleTransforms(ifstream& in);
133 TString ReadDetElemTransforms(ifstream& in);
a7d4e65b 134 Bool_t ReadTransformations(const TString& fileName);
a7d4e65b 135
136 void WriteTransform(ofstream& out, const TGeoMatrix* transform) const;
a7d4e65b 137 void WriteModuleTransforms(ofstream& out) const;
138 void WriteDetElemTransforms(ofstream& out) const;
d4d05625 139
140 TString GetModuleSymName(Int_t moduleId) const;
141 TString GetDESymName(Int_t detElemId) const;
afc8e661 142
143 // data members
f384585c 144 TString fDetectorName; ///< Detector name
829425a5 145 TObjArray* fModuleTransformers; ///< array of module transformers
146 TClonesArray* fMisAlignArray; ///< array of misalignment data
9bf6860b 147 mutable AliMpExMap* fDEAreas; ///< areas of detection elements in global coordinates
148
149 ClassDef(AliMUONGeometryTransformer,4) // Geometry parametrisation
afc8e661 150};
151
b6ddcf59 152// inline methods
a9aad96e 153
154/// Return the number of contained module transformers
b6ddcf59 155inline Int_t AliMUONGeometryTransformer::GetNofModuleTransformers() const
156{ return fModuleTransformers->GetEntriesFast(); }
157
a9aad96e 158/// Return the array of misalignment data
a7d4e65b 159inline const TClonesArray* AliMUONGeometryTransformer::GetMisAlignmentData() const
160{ return fMisAlignArray; }
327d1302 161
162/// Set detector name
163inline void AliMUONGeometryTransformer::SetDetName(const TString& detName)
164{ fDetectorName = detName; }
165
166/// Set ownership of array module transformers
167inline void AliMUONGeometryTransformer::SetOwner(Bool_t isOwner)
168{ fModuleTransformers->SetOwner(isOwner); }
a7d4e65b 169
afc8e661 170#endif //ALI_MUON_GEOMETRY_TRANSFORMER_H
171
172
173
174
175
176
177