]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONGeometryEnvelopeStore.h
Corrected converting of DE local transformations
[u/mrichter/AliRoot.git] / MUON / AliMUONGeometryEnvelopeStore.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 AliMUONGeometryEnvelopeStore
8 /// \brief Store for temporary volumes envelopes
9 ///
10 /// Class for definititon of the temporary volume envelopes
11 /// used in geometry construction
12 ///
13 /// Author: Ivana Hrivnacova, IPN Orsay
14
15 #ifndef ALI_MUON_GEOMETRY_ENVELOPE_STORE_H
16 #define ALI_MUON_GEOMETRY_ENVELOPE_STORE_H
17
18 #include <TObject.h>
19 #include <TString.h>
20 #include <TGeoMatrix.h>
21
22 class TGeoTranslation;
23 class TGeoRotation;
24 class TGeoCombiTrans;
25 class TObjArray;
26 class TArrayI;
27
28 class AliMUONChamber;
29 class AliMUONGeometryEnvelope;
30 class AliMUONGeometryStore;
31
32 class AliMUONGeometryEnvelopeStore : public TObject
33 {
34   public:
35     AliMUONGeometryEnvelopeStore(AliMUONGeometryStore* detElements);
36     AliMUONGeometryEnvelopeStore();
37     AliMUONGeometryEnvelopeStore(const AliMUONGeometryEnvelopeStore& rhs);
38     virtual ~AliMUONGeometryEnvelopeStore();
39
40     // operators  
41     AliMUONGeometryEnvelopeStore& 
42     operator = (const AliMUONGeometryEnvelopeStore& rhs);
43   
44     // methods
45         
46           // adding virtual envelopes   
47           // (not placed in MC geometry, only logical assembly of volumes,
48           //  cannot have more copies)  
49     void  AddEnvelope(const TString& name, Int_t id, 
50                       Bool_t isVirtual, const char* only="ONLY"); 
51     void  AddEnvelope(const TString& name, Int_t id,  
52                       Bool_t isVirtual,
53                       const TGeoTranslation& translation, 
54                       const char* only="ONLY"); 
55     void  AddEnvelope(const TString& name, Int_t id, 
56                       Bool_t isVirtual, 
57                       const TGeoTranslation& translation, 
58                       const TGeoRotation& rotation,
59                       const char* only="ONLY");
60     void  AddEnvelope(const TString& name, Int_t id,  
61                       Bool_t isVirtual,
62                       const TGeoCombiTrans& transform,
63                       const char* only="ONLY");
64                       
65           // adding non-virtual envelopes       
66           // (placed in MC geometry with transformation composed
67           //  of transformation of chamber and their transformation, 
68           //  can have more copies )    
69     void  AddEnvelope(const TString& name, Int_t id, 
70                       Int_t copyNo, const char* only="ONLY"); 
71     void  AddEnvelope(const TString& name, Int_t id, 
72                       Int_t copyNo, 
73                       const TGeoTranslation& translation,
74                       const char* only="ONLY"); 
75     void  AddEnvelope(const TString& name,  Int_t id, 
76                       Int_t copyNo,
77                       const TGeoTranslation& translation, 
78                       const TGeoRotation& rotation,
79                       const char* only="ONLY");
80     void  AddEnvelope(const TString& name,  Int_t id, 
81                       Int_t copyNo, 
82                       const TGeoCombiTrans& transform,
83                       const char* only="ONLY");
84
85           // adding constituents to virtual envelopes   
86           // (placed in MC geometry with transformation composed
87           //  of transformation of chamber, envelope and their own
88           //  transformation )  
89     void  AddEnvelopeConstituent(const TString& name, const TString& envName, 
90                       Int_t copyNo); 
91     void  AddEnvelopeConstituent(const TString& name, const TString& envName, 
92                       Int_t copyNo, const TGeoTranslation& translation); 
93     void  AddEnvelopeConstituent(const TString& name, const TString& envName, 
94                       Int_t copyNo, const TGeoTranslation& translation, 
95                       const TGeoRotation& rotation);
96     void  AddEnvelopeConstituent(const TString& name, const TString& envName, 
97                       Int_t copyNo, const TGeoCombiTrans& transform);
98                                       
99           // adding constituents to virtual envelopes with specified shape
100           // parameters
101           // (placed in MC geometry with transformation composed
102           //  of transformation of chamber, envelope and their own
103           //  transformation )  
104     void  AddEnvelopeConstituentParam(const TString& name, const TString& envName, 
105                       Int_t copyNo, Int_t npar, Double_t* param); 
106     void  AddEnvelopeConstituentParam(const TString& name, const TString& envName, 
107                       Int_t copyNo, const TGeoTranslation& translation,
108                       Int_t npar, Double_t* param); 
109     void  AddEnvelopeConstituentParam(const TString& name, const TString& envName, 
110                       Int_t copyNo, const TGeoTranslation& translation, 
111                       const TGeoRotation& rotation, Int_t npar, Double_t* param);
112     void  AddEnvelopeConstituentParam(const TString& name, const TString& envName, 
113                       Int_t copyNo, const TGeoCombiTrans& transform,
114                       Int_t npar, Double_t* param);
115                                       
116     void  SetDebug(Bool_t debug);
117     void  SetReferenceFrame(const TGeoCombiTrans& referenceFrame);
118
119     // Alignement
120     virtual Bool_t  GetAlign() const;
121     virtual void    SetAlign(Bool_t align);
122  
123     // get methods
124     const TObjArray*  GetEnvelopes() const;
125     Int_t             GetNofDetElements() const;
126
127   private:
128     // methods
129     TGeoHMatrix ConvertDETransform(const TGeoHMatrix& transform) const;
130     AliMUONGeometryEnvelope* FindEnvelope(const TString& name) const;
131     Bool_t AlignEnvelope(AliMUONGeometryEnvelope* envelope) const;
132  
133     // data members
134     TObjArray*  fEnvelopes; // the envelopes names and transformations
135                             // wrt to the chamber position in mother volume                                 
136     AliMUONGeometryStore*  fDetElements; // detection elements
137                             // used for alignement of enevelopes
138     TGeoCombiTrans fReferenceFrame; // the transformation from the builder 
139                                     // reference frame to that of the transform 
140                                     // data files
141     Bool_t      fDebug;     // Switch for debugging  
142     Bool_t      fAlign;     // option to read transformations from a file
143  
144   ClassDef(AliMUONGeometryEnvelopeStore,2) // Geometry envelope store
145 };
146
147 // inline functions
148
149 inline void  AliMUONGeometryEnvelopeStore::SetDebug(Bool_t debug)
150 { fDebug = debug; }
151
152 inline Bool_t  AliMUONGeometryEnvelopeStore::GetAlign() const
153 { return fAlign; }
154
155 inline void AliMUONGeometryEnvelopeStore::SetAlign(Bool_t align)
156 { fAlign = align; }
157
158 inline const TObjArray* AliMUONGeometryEnvelopeStore::GetEnvelopes() const
159 { return fEnvelopes; }
160
161 inline void 
162 AliMUONGeometryEnvelopeStore::SetReferenceFrame(const TGeoCombiTrans& referenceFrame)
163 { fReferenceFrame = referenceFrame; }
164
165 #endif //ALI_MUON_CHAMBER_ENVELOPE_STORE_H