]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONGeometryTransformer.h
Adding PDG Pid monitor
[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);
a7d4e65b 45 void AddMisAlignModule(Int_t moduleId, const TGeoHMatrix& matrix);
46 void AddMisAlignDetElement(Int_t detElemId, const TGeoHMatrix& matrix);
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 //
327d1302 55 Bool_t LoadGeometryData(const TString& fileName);
56 Bool_t LoadGeometryData();
57
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;
327d1302 76
77 // Set methods
78 void SetDetName(const TString& detName);
79 void SetOwner(Bool_t isOwner);
afc8e661 80
a7d4e65b 81 // Get methods
82 //
b6ddcf59 83 Int_t GetNofModuleTransformers() const;
afc8e661 84 const AliMUONGeometryModuleTransformer* GetModuleTransformer(
85 Int_t index, Bool_t warn = true) const;
86
87 const AliMUONGeometryModuleTransformer* GetModuleTransformerByDEId(
88 Int_t detElemId, Bool_t warn = true) const;
89
a7d4e65b 90 const AliMUONGeometryDetElement* GetDetElement(
91 Int_t detElemId, Bool_t warn = true) const;
92
d4d05625 93 const TClonesArray* GetMisAlignmentData() const;
94
317aa7dc 95 Bool_t HasDE(Int_t detElemId) const;
96
9bf6860b 97 AliMpArea* GetDEArea(Int_t detElemId) const;
98
afc8e661 99 protected:
71a2d3aa 100 /// Not implemented
afc8e661 101 AliMUONGeometryTransformer(const AliMUONGeometryTransformer& right);
71a2d3aa 102 /// Not implemented
afc8e661 103 AliMUONGeometryTransformer& operator = (const AliMUONGeometryTransformer& right);
104
105 private:
106 // methods
9bf6860b 107
108 void CreateDEAreas() const;
109
88544f7e 110 Bool_t LoadMapping() const;
afc8e661 111 AliMUONGeometryModuleTransformer* GetModuleTransformerNonConst(
112 Int_t index, Bool_t warn = true) const;
afc8e661 113
114 TGeoHMatrix GetTransform(
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) const;
a7d4e65b 118
a7d4e65b 119 void FillModuleTransform(Int_t moduleId,
afc8e661 120 Double_t x, Double_t y, Double_t z,
121 Double_t a1, Double_t a2, Double_t a3,
122 Double_t a4, Double_t a5, Double_t a6);
a7d4e65b 123 void FillDetElemTransform(Int_t id,
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);
127
a7d4e65b 128 TString ReadModuleTransforms(ifstream& in);
129 TString ReadDetElemTransforms(ifstream& in);
a7d4e65b 130 Bool_t ReadTransformations(const TString& fileName);
327d1302 131 Bool_t LoadTransformations();
a7d4e65b 132
133 void WriteTransform(ofstream& out, const TGeoMatrix* transform) const;
a7d4e65b 134 void WriteModuleTransforms(ofstream& out) const;
135 void WriteDetElemTransforms(ofstream& out) const;
d4d05625 136
137 TString GetModuleSymName(Int_t moduleId) const;
138 TString GetDESymName(Int_t detElemId) const;
327d1302 139
140 // static data members
141 static const TString fgkDefaultDetectorName; ///< Default detector name
142
afc8e661 143
144 // data members
f384585c 145 TString fDetectorName; ///< Detector name
829425a5 146 TObjArray* fModuleTransformers; ///< array of module transformers
147 TClonesArray* fMisAlignArray; ///< array of misalignment data
9bf6860b 148 mutable AliMpExMap* fDEAreas; ///< areas of detection elements in global coordinates
149
150 ClassDef(AliMUONGeometryTransformer,4) // Geometry parametrisation
afc8e661 151};
152
b6ddcf59 153// inline methods
a9aad96e 154
155/// Return the number of contained module transformers
b6ddcf59 156inline Int_t AliMUONGeometryTransformer::GetNofModuleTransformers() const
157{ return fModuleTransformers->GetEntriesFast(); }
158
a9aad96e 159/// Return the array of misalignment data
a7d4e65b 160inline const TClonesArray* AliMUONGeometryTransformer::GetMisAlignmentData() const
161{ return fMisAlignArray; }
327d1302 162
163/// Set detector name
164inline void AliMUONGeometryTransformer::SetDetName(const TString& detName)
165{ fDetectorName = detName; }
166
167/// Set ownership of array module transformers
168inline void AliMUONGeometryTransformer::SetOwner(Bool_t isOwner)
169{ fModuleTransformers->SetOwner(isOwner); }
a7d4e65b 170
afc8e661 171#endif //ALI_MUON_GEOMETRY_TRANSFORMER_H
172
173
174
175
176
177
178