]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - MUON/AliMUONGeometryTransformer.h
New class AliESDEvent, backward compatibility with the old AliESD (Christian)
[u/mrichter/AliRoot.git] / MUON / AliMUONGeometryTransformer.h
... / ...
CommitLineData
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///
10/// Geometry transformations can be filled in these ways:
11/// - by geometry builder when geometry is built via builders
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
18///
19/// \author Ivana Hrivnacova, IPN Orsay
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
28class AliMUONGeometryModuleTransformer;
29class AliMUONGeometryDetElement;
30
31class TGeoManager;
32class TClonesArray;
33
34class AliMUONGeometryTransformer : public TObject
35{
36 public:
37 AliMUONGeometryTransformer();
38 AliMUONGeometryTransformer(TRootIOCtor* /*ioCtor*/);
39 virtual ~AliMUONGeometryTransformer();
40
41 // methods
42 void AddModuleTransformer(AliMUONGeometryModuleTransformer* transformer);
43 void AddMisAlignModule(Int_t moduleId, const TGeoHMatrix& matrix);
44 void AddMisAlignDetElement(Int_t detElemId, const TGeoHMatrix& matrix);
45 void CreateModules();
46
47 void AddAlignableVolumes() const;
48 TClonesArray* CreateZeroAlignmentData() const;
49 void ClearMisAlignmentData();
50
51 // IO
52 //
53 Bool_t LoadGeometryData(const TString& fileName);
54 Bool_t LoadGeometryData();
55
56 Bool_t WriteTransformations(const TString& fileName) const;
57 Bool_t WriteMisAlignmentData(const TString& fileName) const;
58
59 // Transformation methods
60 //
61 void Global2Local(Int_t detElemId,
62 Float_t xg, Float_t yg, Float_t zg,
63 Float_t& xl, Float_t& yl, Float_t& zl) const;
64 void Global2Local(Int_t detElemId,
65 Double_t xg, Double_t yg, Double_t zg,
66 Double_t& xl, Double_t& yl, Double_t& zl) const;
67
68 void Local2Global(Int_t detElemId,
69 Float_t xl, Float_t yl, Float_t zl,
70 Float_t& xg, Float_t& yg, Float_t& zg) const;
71 void Local2Global(Int_t detElemId,
72 Double_t xl, Double_t yl, Double_t zl,
73 Double_t& xg, Double_t& yg, Double_t& zg) const;
74
75 // Set methods
76 void SetDetName(const TString& detName);
77 void SetOwner(Bool_t isOwner);
78
79 // Get methods
80 //
81 Int_t GetNofModuleTransformers() const;
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
88 const AliMUONGeometryDetElement* GetDetElement(
89 Int_t detElemId, Bool_t warn = true) const;
90
91 const TClonesArray* GetMisAlignmentData() const;
92
93 Bool_t HasDE(Int_t detElemId) const;
94
95 protected:
96 /// Not implemented
97 AliMUONGeometryTransformer(const AliMUONGeometryTransformer& right);
98 /// Not implemented
99 AliMUONGeometryTransformer& operator = (const AliMUONGeometryTransformer& right);
100
101 private:
102 // methods
103 Bool_t LoadMapping() const;
104 AliMUONGeometryModuleTransformer* GetModuleTransformerNonConst(
105 Int_t index, Bool_t warn = true) const;
106
107 TGeoHMatrix GetTransform(
108 Double_t x, Double_t y, Double_t z,
109 Double_t a1, Double_t a2, Double_t a3,
110 Double_t a4, Double_t a5, Double_t a6) const;
111
112 void FillModuleTransform(Int_t moduleId,
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);
116 void FillDetElemTransform(Int_t id,
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
121 TString ReadModuleTransforms(ifstream& in);
122 TString ReadDetElemTransforms(ifstream& in);
123 Bool_t ReadTransformations(const TString& fileName);
124 Bool_t LoadTransformations();
125
126 void WriteTransform(ofstream& out, const TGeoMatrix* transform) const;
127 void WriteModuleTransforms(ofstream& out) const;
128 void WriteDetElemTransforms(ofstream& out) const;
129
130 TString GetModuleSymName(Int_t moduleId) const;
131 TString GetDESymName(Int_t detElemId) const;
132
133 // static data members
134 static const TString fgkDefaultDetectorName; ///< Default detector name
135
136
137 // data members
138 TString fDetectorName; ///< Detector name
139 TObjArray* fModuleTransformers; ///< array of module transformers
140 TClonesArray* fMisAlignArray; ///< array of misalignment data
141
142 ClassDef(AliMUONGeometryTransformer,3) // Geometry parametrisation
143};
144
145// inline methods
146
147/// Return the number of contained module transformers
148inline Int_t AliMUONGeometryTransformer::GetNofModuleTransformers() const
149{ return fModuleTransformers->GetEntriesFast(); }
150
151/// Return the array of misalignment data
152inline const TClonesArray* AliMUONGeometryTransformer::GetMisAlignmentData() const
153{ return fMisAlignArray; }
154
155/// Set detector name
156inline void AliMUONGeometryTransformer::SetDetName(const TString& detName)
157{ fDetectorName = detName; }
158
159/// Set ownership of array module transformers
160inline void AliMUONGeometryTransformer::SetOwner(Bool_t isOwner)
161{ fModuleTransformers->SetOwner(isOwner); }
162
163#endif //ALI_MUON_GEOMETRY_TRANSFORMER_H
164
165
166
167
168
169
170