Extendened class description to include at least 5 subsequent lines required by rule...
[u/mrichter/AliRoot.git] / MUON / AliMUONGeometryEnvelope.cxx
1 // $Id$
2 //
3 // Class AliMUONGeometryEnvelope
4 // -----------------------------
5 // Helper class for definititon an assembly of volumes.
6 // Author: Ivana Hrivnacova, IPN Orsay
7 // 23/01/2004
8
9 #include <TGeoMatrix.h>
10 #include <TString.h>
11 #include <TObjArray.h>
12
13 #include "AliMUONGeometryEnvelope.h"
14 #include "AliMUONGeometryConstituent.h"
15
16 ClassImp(AliMUONGeometryEnvelope)
17
18 //______________________________________________________________________________
19 AliMUONGeometryEnvelope::AliMUONGeometryEnvelope(const TString& name, 
20                                                  Bool_t isVirtual,
21                                                  const char* only)
22  : TNamed(name, name),
23    fIsVirtual(isVirtual),
24    fIsMANY(false),
25    fCopyNo(0),
26    fTransformation(0),
27    fConstituents(0)
28 {
29 // Standard constructor
30
31   if (TString(only) == TString("MANY")) fIsMANY = true;
32
33   // Create the envelope transformation
34   fTransformation = new TGeoCombiTrans("");
35   fConstituents = new TObjArray(20);
36 }
37
38
39 //______________________________________________________________________________
40 AliMUONGeometryEnvelope::AliMUONGeometryEnvelope(const TString& name, 
41                                                  Int_t copyNo, 
42                                                  const char* only)
43  : TNamed(name, name),
44    fIsVirtual(false),
45    fIsMANY(false),
46    fCopyNo(copyNo),
47    fTransformation(0),
48    fConstituents(0)
49 {
50 // Standard constructor
51
52   if (TString(only) == TString("MANY")) fIsMANY = true;
53
54   // Create the envelope transformation
55   fTransformation = new TGeoCombiTrans("");
56   fConstituents = new TObjArray(20);
57 }
58
59
60 //______________________________________________________________________________
61 AliMUONGeometryEnvelope::AliMUONGeometryEnvelope()
62  : TNamed(),
63    fIsVirtual(0),
64    fTransformation(0),
65    fConstituents(0)
66 {
67 // Default constructor
68 }
69
70
71 //______________________________________________________________________________
72 AliMUONGeometryEnvelope::AliMUONGeometryEnvelope(
73                                         const AliMUONGeometryEnvelope& rhs)
74   : TNamed(rhs)
75 {
76   Fatal("Copy constructor", 
77         "Copy constructor is not implemented.");
78 }
79
80 //______________________________________________________________________________
81 AliMUONGeometryEnvelope::~AliMUONGeometryEnvelope() 
82 {
83 //
84   // Add deleting rotation matrices 
85   
86   delete fTransformation;
87   
88   if (fConstituents) {
89     fConstituents->Delete();
90     delete fConstituents;
91   }  
92 }
93
94 //______________________________________________________________________________
95 AliMUONGeometryEnvelope& 
96 AliMUONGeometryEnvelope::operator = (const AliMUONGeometryEnvelope& rhs) 
97 {
98   // check assignement to self
99   if (this == &rhs) return *this;
100
101   Fatal("operator=", 
102         "Assignment operator is not implemented.");
103     
104   return *this;  
105 }
106
107 //
108 // public methods
109 //
110
111 //______________________________________________________________________________
112 void  AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo) 
113 {
114 // Adds the volume with the specified name and transformation
115 // to the list of envelopes.
116 // ---                                             
117
118   fConstituents->Add(new AliMUONGeometryConstituent(name, copyNo, 0, 0));
119 }
120
121 //______________________________________________________________________________
122 void  AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo, 
123                                           const TGeoTranslation& translation)
124 {
125 // Adds the volume with the specified name and transformation
126 // to the list of envelopes.
127 // ---                                             
128
129   fConstituents
130     ->Add(new AliMUONGeometryConstituent(name, copyNo, translation, 0, 0));
131 }
132
133 //______________________________________________________________________________
134 void  AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo,
135                                           const TGeoTranslation& translation,
136                                           const TGeoRotation& rotation)
137 {
138 // Adds the volume with the specified name and transformation
139 // to the list of envelopes.
140 // ---                                             
141
142   fConstituents
143     ->Add(new AliMUONGeometryConstituent(
144                      name, copyNo, translation, rotation, 0, 0));
145 }
146
147 //______________________________________________________________________________
148 void  AliMUONGeometryEnvelope::AddConstituentParam(const TString& name, 
149                                   Int_t copyNo, Int_t npar, Double_t* param) 
150 {
151 // Adds the volume with the specified name and transformation
152 // to the list of envelopes.
153 // ---                                             
154
155   fConstituents
156     ->Add(new AliMUONGeometryConstituent(name, copyNo, npar, param));
157 }
158
159 //______________________________________________________________________________
160 void  AliMUONGeometryEnvelope::AddConstituentParam(const TString& name, 
161                                   Int_t copyNo, const TGeoTranslation& translation,
162                                   Int_t npar, Double_t* param)
163 {
164 // Adds the volume with the specified name and transformation
165 // to the list of envelopes.
166 // ---                                             
167
168   fConstituents
169     ->Add(new AliMUONGeometryConstituent(
170                      name, copyNo, translation, npar, param));
171 }
172
173 //______________________________________________________________________________
174 void  AliMUONGeometryEnvelope::AddConstituentParam(const TString& name, 
175                                   Int_t copyNo, const TGeoTranslation& translation,
176                                   const TGeoRotation& rotation, 
177                                   Int_t npar, Double_t* param)
178 {
179 // Adds the volume with the specified name and transformation
180 // to the list of envelopes.
181 // ---                                             
182
183   fConstituents
184     ->Add(new AliMUONGeometryConstituent(
185                      name, copyNo, translation, rotation, npar, param));
186 }
187
188 //______________________________________________________________________________
189 void  AliMUONGeometryEnvelope::SetTranslation(const TGeoTranslation& translation)
190 {
191 // Sets the chamber position wrt ALIC.
192 // ---
193
194   fTransformation
195     ->SetTranslation(const_cast<Double_t*>(translation.GetTranslation()));
196 }  
197
198 //______________________________________________________________________________
199 void  AliMUONGeometryEnvelope::SetRotation(const TGeoRotation& rotation)
200 {
201 // Sets the chamber rotation wrt ALIC.
202 // ---
203
204   TGeoRotation* rot = new TGeoRotation();
205   rot->SetMatrix(const_cast<Double_t*>(rotation.GetRotationMatrix()));
206
207   fTransformation->SetRotation(rot);
208 }