]>
Commit | Line | Data |
---|---|---|
30178c30 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
d1cd2474 | 16 | // $Id$ |
17 | // | |
18 | // Class AliMUONGeometryEnvelope | |
19 | // ----------------------------- | |
20 | // Helper class for definititon an assembly of volumes. | |
d1cd2474 | 21 | // Author: Ivana Hrivnacova, IPN Orsay |
5f1df83a | 22 | // 23/01/2004 |
d1cd2474 | 23 | |
24 | #include <TGeoMatrix.h> | |
6b82c1f0 | 25 | #include <TString.h> |
d1cd2474 | 26 | #include <TObjArray.h> |
27 | ||
28 | #include "AliMUONGeometryEnvelope.h" | |
29 | #include "AliMUONGeometryConstituent.h" | |
8c343c7c | 30 | #include "AliLog.h" |
d1cd2474 | 31 | |
a9aad96e | 32 | /// \cond CLASSIMP |
d1cd2474 | 33 | ClassImp(AliMUONGeometryEnvelope) |
a9aad96e | 34 | /// \endcond |
d1cd2474 | 35 | |
36 | //______________________________________________________________________________ | |
37 | AliMUONGeometryEnvelope::AliMUONGeometryEnvelope(const TString& name, | |
c0b51181 | 38 | Int_t id, |
6b82c1f0 | 39 | Bool_t isVirtual, |
40 | const char* only) | |
d1cd2474 | 41 | : TNamed(name, name), |
42 | fIsVirtual(isVirtual), | |
6b82c1f0 | 43 | fIsMANY(false), |
c0b51181 | 44 | fCopyNo(1), |
d1cd2474 | 45 | fTransformation(0), |
46 | fConstituents(0) | |
47 | { | |
692de412 | 48 | /// Standard constructor |
d1cd2474 | 49 | |
6b82c1f0 | 50 | if (TString(only) == TString("MANY")) fIsMANY = true; |
51 | ||
d1cd2474 | 52 | // Create the envelope transformation |
53 | fTransformation = new TGeoCombiTrans(""); | |
54 | fConstituents = new TObjArray(20); | |
c0b51181 | 55 | |
56 | // Set id | |
57 | SetUniqueID(id); | |
d1cd2474 | 58 | } |
59 | ||
60 | ||
61 | //______________________________________________________________________________ | |
c0b51181 | 62 | AliMUONGeometryEnvelope::AliMUONGeometryEnvelope(const TString& name, |
63 | Int_t id, | |
6b82c1f0 | 64 | Int_t copyNo, |
65 | const char* only) | |
d1cd2474 | 66 | : TNamed(name, name), |
67 | fIsVirtual(false), | |
6b82c1f0 | 68 | fIsMANY(false), |
d1cd2474 | 69 | fCopyNo(copyNo), |
70 | fTransformation(0), | |
71 | fConstituents(0) | |
72 | { | |
692de412 | 73 | /// Standard constructor for a non virtual enevelope with a specified copy |
74 | /// number | |
d1cd2474 | 75 | |
6b82c1f0 | 76 | if (TString(only) == TString("MANY")) fIsMANY = true; |
77 | ||
d1cd2474 | 78 | // Create the envelope transformation |
79 | fTransformation = new TGeoCombiTrans(""); | |
80 | fConstituents = new TObjArray(20); | |
c0b51181 | 81 | |
82 | // Set id | |
83 | SetUniqueID(id); | |
d1cd2474 | 84 | } |
85 | ||
86 | ||
87 | //______________________________________________________________________________ | |
88 | AliMUONGeometryEnvelope::AliMUONGeometryEnvelope() | |
89 | : TNamed(), | |
90 | fIsVirtual(0), | |
c0b51181 | 91 | fIsMANY(false), |
92 | fCopyNo(0), | |
d1cd2474 | 93 | fTransformation(0), |
94 | fConstituents(0) | |
95 | { | |
692de412 | 96 | /// Default constructor |
d1cd2474 | 97 | } |
98 | ||
d1cd2474 | 99 | //______________________________________________________________________________ |
100 | AliMUONGeometryEnvelope::~AliMUONGeometryEnvelope() | |
101 | { | |
692de412 | 102 | /// Destructor |
103 | ||
d1cd2474 | 104 | // Add deleting rotation matrices |
105 | ||
106 | delete fTransformation; | |
107 | ||
108 | if (fConstituents) { | |
109 | fConstituents->Delete(); | |
110 | delete fConstituents; | |
111 | } | |
112 | } | |
113 | ||
d1cd2474 | 114 | // |
115 | // public methods | |
116 | // | |
117 | ||
118 | //______________________________________________________________________________ | |
119 | void AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo) | |
120 | { | |
692de412 | 121 | /// Add the volume with the specified name and transformation |
122 | /// to the list of envelopes. | |
d1cd2474 | 123 | |
124 | fConstituents->Add(new AliMUONGeometryConstituent(name, copyNo, 0, 0)); | |
125 | } | |
126 | ||
127 | //______________________________________________________________________________ | |
128 | void AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo, | |
129 | const TGeoTranslation& translation) | |
130 | { | |
692de412 | 131 | /// Add the volume with the specified name and transformation |
132 | /// to the list of envelopes. | |
d1cd2474 | 133 | |
134 | fConstituents | |
135 | ->Add(new AliMUONGeometryConstituent(name, copyNo, translation, 0, 0)); | |
136 | } | |
137 | ||
138 | //______________________________________________________________________________ | |
139 | void AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo, | |
140 | const TGeoTranslation& translation, | |
141 | const TGeoRotation& rotation) | |
142 | { | |
692de412 | 143 | /// Add the volume with the specified name and transformation |
144 | /// to the list of envelopes. | |
d1cd2474 | 145 | |
146 | fConstituents | |
147 | ->Add(new AliMUONGeometryConstituent( | |
148 | name, copyNo, translation, rotation, 0, 0)); | |
149 | } | |
150 | ||
c0b51181 | 151 | //______________________________________________________________________________ |
152 | void AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo, | |
153 | const TGeoCombiTrans& transform ) | |
154 | { | |
692de412 | 155 | /// Add the volume with the specified name and transformation |
156 | /// to the list of envelopes. | |
c0b51181 | 157 | |
158 | fConstituents | |
159 | ->Add(new AliMUONGeometryConstituent( | |
160 | name, copyNo, transform, 0, 0)); | |
161 | } | |
162 | ||
d1cd2474 | 163 | //______________________________________________________________________________ |
164 | void AliMUONGeometryEnvelope::AddConstituentParam(const TString& name, | |
165 | Int_t copyNo, Int_t npar, Double_t* param) | |
166 | { | |
692de412 | 167 | /// Add the volume with the specified name and transformation |
168 | /// to the list of envelopes. | |
d1cd2474 | 169 | |
170 | fConstituents | |
171 | ->Add(new AliMUONGeometryConstituent(name, copyNo, npar, param)); | |
172 | } | |
173 | ||
174 | //______________________________________________________________________________ | |
175 | void AliMUONGeometryEnvelope::AddConstituentParam(const TString& name, | |
176 | Int_t copyNo, const TGeoTranslation& translation, | |
177 | Int_t npar, Double_t* param) | |
178 | { | |
692de412 | 179 | /// Add the volume with the specified name and transformation |
180 | /// to the list of envelopes. | |
d1cd2474 | 181 | |
182 | fConstituents | |
183 | ->Add(new AliMUONGeometryConstituent( | |
184 | name, copyNo, translation, npar, param)); | |
185 | } | |
186 | ||
187 | //______________________________________________________________________________ | |
188 | void AliMUONGeometryEnvelope::AddConstituentParam(const TString& name, | |
189 | Int_t copyNo, const TGeoTranslation& translation, | |
190 | const TGeoRotation& rotation, | |
191 | Int_t npar, Double_t* param) | |
192 | { | |
692de412 | 193 | /// Add the volume with the specified name and transformation |
194 | /// to the list of envelopes. | |
d1cd2474 | 195 | |
196 | fConstituents | |
197 | ->Add(new AliMUONGeometryConstituent( | |
198 | name, copyNo, translation, rotation, npar, param)); | |
199 | } | |
200 | ||
c0b51181 | 201 | //______________________________________________________________________________ |
202 | void AliMUONGeometryEnvelope::AddConstituentParam(const TString& name, | |
203 | Int_t copyNo, | |
204 | const TGeoCombiTrans& transform, | |
205 | Int_t npar, Double_t* param) | |
206 | { | |
692de412 | 207 | /// Add the volume with the specified name and transformation |
208 | /// to the list of envelopes. | |
c0b51181 | 209 | |
210 | fConstituents | |
211 | ->Add(new AliMUONGeometryConstituent( | |
212 | name, copyNo, transform, npar, param)); | |
213 | } | |
214 | ||
d1cd2474 | 215 | //______________________________________________________________________________ |
216 | void AliMUONGeometryEnvelope::SetTranslation(const TGeoTranslation& translation) | |
217 | { | |
692de412 | 218 | /// Set the envelope position |
d1cd2474 | 219 | |
220 | fTransformation | |
221 | ->SetTranslation(const_cast<Double_t*>(translation.GetTranslation())); | |
222 | } | |
223 | ||
224 | //______________________________________________________________________________ | |
225 | void AliMUONGeometryEnvelope::SetRotation(const TGeoRotation& rotation) | |
226 | { | |
a9aad96e | 227 | /// Set the envelope rotation |
d1cd2474 | 228 | |
229 | TGeoRotation* rot = new TGeoRotation(); | |
230 | rot->SetMatrix(const_cast<Double_t*>(rotation.GetRotationMatrix())); | |
231 | ||
232 | fTransformation->SetRotation(rot); | |
233 | } | |
c0b51181 | 234 | |
235 | //______________________________________________________________________________ | |
236 | void AliMUONGeometryEnvelope::SetTransform(const TGeoCombiTrans& transform) | |
237 | { | |
a9aad96e | 238 | /// Set the envelope transformation |
c0b51181 | 239 | |
240 | fTransformation | |
241 | ->SetTranslation(const_cast<Double_t*>(transform.GetTranslation())); | |
242 | ||
243 | TGeoRotation* rot = new TGeoRotation(); | |
244 | rot->SetMatrix(const_cast<Double_t*>(transform.GetRotationMatrix())); | |
245 | ||
246 | fTransformation->SetRotation(rot); | |
247 | } |