]>
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 | |
32 | ClassImp(AliMUONGeometryEnvelope) | |
33 | ||
34 | //______________________________________________________________________________ | |
35 | AliMUONGeometryEnvelope::AliMUONGeometryEnvelope(const TString& name, | |
c0b51181 | 36 | Int_t id, |
6b82c1f0 | 37 | Bool_t isVirtual, |
38 | const char* only) | |
d1cd2474 | 39 | : TNamed(name, name), |
40 | fIsVirtual(isVirtual), | |
6b82c1f0 | 41 | fIsMANY(false), |
c0b51181 | 42 | fCopyNo(1), |
d1cd2474 | 43 | fTransformation(0), |
44 | fConstituents(0) | |
45 | { | |
692de412 | 46 | /// Standard constructor |
d1cd2474 | 47 | |
6b82c1f0 | 48 | if (TString(only) == TString("MANY")) fIsMANY = true; |
49 | ||
d1cd2474 | 50 | // Create the envelope transformation |
51 | fTransformation = new TGeoCombiTrans(""); | |
52 | fConstituents = new TObjArray(20); | |
c0b51181 | 53 | |
54 | // Set id | |
55 | SetUniqueID(id); | |
d1cd2474 | 56 | } |
57 | ||
58 | ||
59 | //______________________________________________________________________________ | |
c0b51181 | 60 | AliMUONGeometryEnvelope::AliMUONGeometryEnvelope(const TString& name, |
61 | Int_t id, | |
6b82c1f0 | 62 | Int_t copyNo, |
63 | const char* only) | |
d1cd2474 | 64 | : TNamed(name, name), |
65 | fIsVirtual(false), | |
6b82c1f0 | 66 | fIsMANY(false), |
d1cd2474 | 67 | fCopyNo(copyNo), |
68 | fTransformation(0), | |
69 | fConstituents(0) | |
70 | { | |
692de412 | 71 | /// Standard constructor for a non virtual enevelope with a specified copy |
72 | /// number | |
d1cd2474 | 73 | |
6b82c1f0 | 74 | if (TString(only) == TString("MANY")) fIsMANY = true; |
75 | ||
d1cd2474 | 76 | // Create the envelope transformation |
77 | fTransformation = new TGeoCombiTrans(""); | |
78 | fConstituents = new TObjArray(20); | |
c0b51181 | 79 | |
80 | // Set id | |
81 | SetUniqueID(id); | |
d1cd2474 | 82 | } |
83 | ||
84 | ||
85 | //______________________________________________________________________________ | |
86 | AliMUONGeometryEnvelope::AliMUONGeometryEnvelope() | |
87 | : TNamed(), | |
88 | fIsVirtual(0), | |
c0b51181 | 89 | fIsMANY(false), |
90 | fCopyNo(0), | |
d1cd2474 | 91 | fTransformation(0), |
92 | fConstituents(0) | |
93 | { | |
692de412 | 94 | /// Default constructor |
d1cd2474 | 95 | } |
96 | ||
97 | ||
98 | //______________________________________________________________________________ | |
99 | AliMUONGeometryEnvelope::AliMUONGeometryEnvelope( | |
100 | const AliMUONGeometryEnvelope& rhs) | |
101 | : TNamed(rhs) | |
102 | { | |
692de412 | 103 | /// Protected copy constructor |
104 | ||
8c343c7c | 105 | AliFatal("Copy constructor is not implemented."); |
d1cd2474 | 106 | } |
107 | ||
108 | //______________________________________________________________________________ | |
109 | AliMUONGeometryEnvelope::~AliMUONGeometryEnvelope() | |
110 | { | |
692de412 | 111 | /// Destructor |
112 | ||
d1cd2474 | 113 | // Add deleting rotation matrices |
114 | ||
115 | delete fTransformation; | |
116 | ||
117 | if (fConstituents) { | |
118 | fConstituents->Delete(); | |
119 | delete fConstituents; | |
120 | } | |
121 | } | |
122 | ||
123 | //______________________________________________________________________________ | |
124 | AliMUONGeometryEnvelope& | |
125 | AliMUONGeometryEnvelope::operator = (const AliMUONGeometryEnvelope& rhs) | |
126 | { | |
692de412 | 127 | /// Protected assignement operator |
128 | ||
d1cd2474 | 129 | // check assignement to self |
130 | if (this == &rhs) return *this; | |
131 | ||
8c343c7c | 132 | AliFatal("Assignment operator is not implemented."); |
d1cd2474 | 133 | |
134 | return *this; | |
135 | } | |
136 | ||
137 | // | |
138 | // public methods | |
139 | // | |
140 | ||
141 | //______________________________________________________________________________ | |
142 | void AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo) | |
143 | { | |
692de412 | 144 | /// Add the volume with the specified name and transformation |
145 | /// to the list of envelopes. | |
d1cd2474 | 146 | |
147 | fConstituents->Add(new AliMUONGeometryConstituent(name, copyNo, 0, 0)); | |
148 | } | |
149 | ||
150 | //______________________________________________________________________________ | |
151 | void AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo, | |
152 | const TGeoTranslation& translation) | |
153 | { | |
692de412 | 154 | /// Add the volume with the specified name and transformation |
155 | /// to the list of envelopes. | |
d1cd2474 | 156 | |
157 | fConstituents | |
158 | ->Add(new AliMUONGeometryConstituent(name, copyNo, translation, 0, 0)); | |
159 | } | |
160 | ||
161 | //______________________________________________________________________________ | |
162 | void AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo, | |
163 | const TGeoTranslation& translation, | |
164 | const TGeoRotation& rotation) | |
165 | { | |
692de412 | 166 | /// Add the volume with the specified name and transformation |
167 | /// to the list of envelopes. | |
d1cd2474 | 168 | |
169 | fConstituents | |
170 | ->Add(new AliMUONGeometryConstituent( | |
171 | name, copyNo, translation, rotation, 0, 0)); | |
172 | } | |
173 | ||
c0b51181 | 174 | //______________________________________________________________________________ |
175 | void AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo, | |
176 | const TGeoCombiTrans& transform ) | |
177 | { | |
692de412 | 178 | /// Add the volume with the specified name and transformation |
179 | /// to the list of envelopes. | |
c0b51181 | 180 | |
181 | fConstituents | |
182 | ->Add(new AliMUONGeometryConstituent( | |
183 | name, copyNo, transform, 0, 0)); | |
184 | } | |
185 | ||
d1cd2474 | 186 | //______________________________________________________________________________ |
187 | void AliMUONGeometryEnvelope::AddConstituentParam(const TString& name, | |
188 | Int_t copyNo, Int_t npar, Double_t* param) | |
189 | { | |
692de412 | 190 | /// Add the volume with the specified name and transformation |
191 | /// to the list of envelopes. | |
d1cd2474 | 192 | |
193 | fConstituents | |
194 | ->Add(new AliMUONGeometryConstituent(name, copyNo, npar, param)); | |
195 | } | |
196 | ||
197 | //______________________________________________________________________________ | |
198 | void AliMUONGeometryEnvelope::AddConstituentParam(const TString& name, | |
199 | Int_t copyNo, const TGeoTranslation& translation, | |
200 | Int_t npar, Double_t* param) | |
201 | { | |
692de412 | 202 | /// Add the volume with the specified name and transformation |
203 | /// to the list of envelopes. | |
d1cd2474 | 204 | |
205 | fConstituents | |
206 | ->Add(new AliMUONGeometryConstituent( | |
207 | name, copyNo, translation, npar, param)); | |
208 | } | |
209 | ||
210 | //______________________________________________________________________________ | |
211 | void AliMUONGeometryEnvelope::AddConstituentParam(const TString& name, | |
212 | Int_t copyNo, const TGeoTranslation& translation, | |
213 | const TGeoRotation& rotation, | |
214 | Int_t npar, Double_t* param) | |
215 | { | |
692de412 | 216 | /// Add the volume with the specified name and transformation |
217 | /// to the list of envelopes. | |
d1cd2474 | 218 | |
219 | fConstituents | |
220 | ->Add(new AliMUONGeometryConstituent( | |
221 | name, copyNo, translation, rotation, npar, param)); | |
222 | } | |
223 | ||
c0b51181 | 224 | //______________________________________________________________________________ |
225 | void AliMUONGeometryEnvelope::AddConstituentParam(const TString& name, | |
226 | Int_t copyNo, | |
227 | const TGeoCombiTrans& transform, | |
228 | Int_t npar, Double_t* param) | |
229 | { | |
692de412 | 230 | /// Add the volume with the specified name and transformation |
231 | /// to the list of envelopes. | |
c0b51181 | 232 | |
233 | fConstituents | |
234 | ->Add(new AliMUONGeometryConstituent( | |
235 | name, copyNo, transform, npar, param)); | |
236 | } | |
237 | ||
d1cd2474 | 238 | //______________________________________________________________________________ |
239 | void AliMUONGeometryEnvelope::SetTranslation(const TGeoTranslation& translation) | |
240 | { | |
692de412 | 241 | /// Set the envelope position |
d1cd2474 | 242 | |
243 | fTransformation | |
244 | ->SetTranslation(const_cast<Double_t*>(translation.GetTranslation())); | |
245 | } | |
246 | ||
247 | //______________________________________________________________________________ | |
248 | void AliMUONGeometryEnvelope::SetRotation(const TGeoRotation& rotation) | |
249 | { | |
692de412 | 250 | /// Set the enevlope rotation |
d1cd2474 | 251 | |
252 | TGeoRotation* rot = new TGeoRotation(); | |
253 | rot->SetMatrix(const_cast<Double_t*>(rotation.GetRotationMatrix())); | |
254 | ||
255 | fTransformation->SetRotation(rot); | |
256 | } | |
c0b51181 | 257 | |
258 | //______________________________________________________________________________ | |
259 | void AliMUONGeometryEnvelope::SetTransform(const TGeoCombiTrans& transform) | |
260 | { | |
261 | // Sets the enevlope transformation | |
262 | // --- | |
263 | ||
264 | fTransformation | |
265 | ->SetTranslation(const_cast<Double_t*>(transform.GetTranslation())); | |
266 | ||
267 | TGeoRotation* rot = new TGeoRotation(); | |
268 | rot->SetMatrix(const_cast<Double_t*>(transform.GetRotationMatrix())); | |
269 | ||
270 | fTransformation->SetRotation(rot); | |
271 | } |