]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONGeometryTransformer.h
New TGeo features allow us to avoid the use of MANY.
[u/mrichter/AliRoot.git] / MUON / AliMUONGeometryTransformer.h
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 /// Author: Ivana Hrivnacova, IPN Orsay
11
12 #ifndef ALI_MUON_GEOMETRY_TRANSFORMER_H
13 #define ALI_MUON_GEOMETRY_TRANSFORMER_H
14
15 #include <TObject.h>
16 #include <TObjArray.h>
17 #include <TGeoMatrix.h>
18
19 class AliMUONGeometryModuleTransformer;
20
21 class AliMUONGeometryTransformer : public TObject
22 {
23   public:
24     AliMUONGeometryTransformer(Bool_t isOwner);
25     AliMUONGeometryTransformer();
26     virtual  ~AliMUONGeometryTransformer();
27     
28     // methods
29     void  AddModuleTransformer(AliMUONGeometryModuleTransformer* transformer);
30
31     // IO
32     Bool_t  ReadTransformations(const TString& fileName);
33     Bool_t  WriteTransformations(const TString& fileName) const;
34
35     // transformation methods 
36     void Global2Local(Int_t detElemId,
37                  Float_t xg, Float_t yg, Float_t zg, 
38                  Float_t& xl, Float_t& yl, Float_t& zl) const;
39     void Global2Local(Int_t detElemId,
40                  Double_t xg, Double_t yg, Double_t zg, 
41                  Double_t& xl, Double_t& yl, Double_t& zl) const;
42
43     void Local2Global(Int_t detElemId,
44                  Float_t xl, Float_t yl, Float_t zl, 
45                  Float_t& xg, Float_t& yg, Float_t& zg) const;
46     void Local2Global(Int_t detElemId,
47                  Double_t xl, Double_t yl, Double_t zl, 
48                  Double_t& xg, Double_t& yg, Double_t& zg) const;
49
50     // get methods
51     Int_t GetNofModuleTransformers() const;
52     const AliMUONGeometryModuleTransformer* GetModuleTransformer(
53                                Int_t index, Bool_t warn = true) const;
54
55     const AliMUONGeometryModuleTransformer* GetModuleTransformerByDEId(
56                                Int_t detElemId, Bool_t warn = true) const;
57
58     Bool_t  HasDE(Int_t detElemId) const;
59
60   protected:
61     AliMUONGeometryTransformer(const AliMUONGeometryTransformer& right);
62     AliMUONGeometryTransformer&  operator = (const AliMUONGeometryTransformer& right);
63  
64   private:
65     // methods
66     AliMUONGeometryModuleTransformer* GetModuleTransformerNonConst(
67                                     Int_t index, Bool_t warn = true) const;
68     TString  ComposePath(const TString& volName, Int_t copyNo) const; 
69
70     TGeoHMatrix GetTransform(
71                   Double_t x, Double_t y, Double_t z,
72                   Double_t a1, Double_t a2, Double_t a3, 
73                   Double_t a4, Double_t a5, Double_t a6) const;
74     void FillData(Int_t moduleId, 
75                   Double_t x, Double_t y, Double_t z,
76                   Double_t a1, Double_t a2, Double_t a3, 
77                   Double_t a4, Double_t a5, Double_t a6); 
78     void FillData(Int_t id, const TString& volName, Int_t copyNo,
79                   Double_t x, Double_t y, Double_t z,
80                   Double_t a1, Double_t a2, Double_t a3, 
81                   Double_t a4, Double_t a5, Double_t a6);
82
83     TString ReadData1(ifstream& in);
84     TString ReadData2(ifstream& in);
85
86     void WriteTransform(ofstream& out, const TGeoCombiTrans* transform) const;
87     void WriteData1(ofstream& out) const;
88     void WriteData2(ofstream& out) const;
89
90     // data members
91     TObjArray*  fModuleTransformers; // list of module transformers
92
93   ClassDef(AliMUONGeometryTransformer,1)  // Geometry parametrisation
94 };
95
96 // inline methods
97 inline Int_t AliMUONGeometryTransformer::GetNofModuleTransformers() const
98 { return fModuleTransformers->GetEntriesFast(); }
99
100 #endif //ALI_MUON_GEOMETRY_TRANSFORMER_H
101
102
103
104
105
106
107