1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 // Class AliMUONGeometryEnvelope
19 // -----------------------------
20 // Helper class for definititon an assembly of volumes.
21 // Author: Ivana Hrivnacova, IPN Orsay
24 #include <TGeoMatrix.h>
26 #include <TObjArray.h>
28 #include "AliMUONGeometryEnvelope.h"
29 #include "AliMUONGeometryConstituent.h"
32 ClassImp(AliMUONGeometryEnvelope)
34 //______________________________________________________________________________
35 AliMUONGeometryEnvelope::AliMUONGeometryEnvelope(const TString& name,
40 fIsVirtual(isVirtual),
46 /// Standard constructor
48 if (TString(only) == TString("MANY")) fIsMANY = true;
50 // Create the envelope transformation
51 fTransformation = new TGeoCombiTrans("");
52 fConstituents = new TObjArray(20);
59 //______________________________________________________________________________
60 AliMUONGeometryEnvelope::AliMUONGeometryEnvelope(const TString& name,
71 /// Standard constructor for a non virtual enevelope with a specified copy
74 if (TString(only) == TString("MANY")) fIsMANY = true;
76 // Create the envelope transformation
77 fTransformation = new TGeoCombiTrans("");
78 fConstituents = new TObjArray(20);
85 //______________________________________________________________________________
86 AliMUONGeometryEnvelope::AliMUONGeometryEnvelope()
94 /// Default constructor
98 //______________________________________________________________________________
99 AliMUONGeometryEnvelope::AliMUONGeometryEnvelope(
100 const AliMUONGeometryEnvelope& rhs)
103 /// Protected copy constructor
105 AliFatal("Copy constructor is not implemented.");
108 //______________________________________________________________________________
109 AliMUONGeometryEnvelope::~AliMUONGeometryEnvelope()
113 // Add deleting rotation matrices
115 delete fTransformation;
118 fConstituents->Delete();
119 delete fConstituents;
123 //______________________________________________________________________________
124 AliMUONGeometryEnvelope&
125 AliMUONGeometryEnvelope::operator = (const AliMUONGeometryEnvelope& rhs)
127 /// Protected assignement operator
129 // check assignement to self
130 if (this == &rhs) return *this;
132 AliFatal("Assignment operator is not implemented.");
141 //______________________________________________________________________________
142 void AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo)
144 /// Add the volume with the specified name and transformation
145 /// to the list of envelopes.
147 fConstituents->Add(new AliMUONGeometryConstituent(name, copyNo, 0, 0));
150 //______________________________________________________________________________
151 void AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo,
152 const TGeoTranslation& translation)
154 /// Add the volume with the specified name and transformation
155 /// to the list of envelopes.
158 ->Add(new AliMUONGeometryConstituent(name, copyNo, translation, 0, 0));
161 //______________________________________________________________________________
162 void AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo,
163 const TGeoTranslation& translation,
164 const TGeoRotation& rotation)
166 /// Add the volume with the specified name and transformation
167 /// to the list of envelopes.
170 ->Add(new AliMUONGeometryConstituent(
171 name, copyNo, translation, rotation, 0, 0));
174 //______________________________________________________________________________
175 void AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo,
176 const TGeoCombiTrans& transform )
178 /// Add the volume with the specified name and transformation
179 /// to the list of envelopes.
182 ->Add(new AliMUONGeometryConstituent(
183 name, copyNo, transform, 0, 0));
186 //______________________________________________________________________________
187 void AliMUONGeometryEnvelope::AddConstituentParam(const TString& name,
188 Int_t copyNo, Int_t npar, Double_t* param)
190 /// Add the volume with the specified name and transformation
191 /// to the list of envelopes.
194 ->Add(new AliMUONGeometryConstituent(name, copyNo, npar, param));
197 //______________________________________________________________________________
198 void AliMUONGeometryEnvelope::AddConstituentParam(const TString& name,
199 Int_t copyNo, const TGeoTranslation& translation,
200 Int_t npar, Double_t* param)
202 /// Add the volume with the specified name and transformation
203 /// to the list of envelopes.
206 ->Add(new AliMUONGeometryConstituent(
207 name, copyNo, translation, npar, param));
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)
216 /// Add the volume with the specified name and transformation
217 /// to the list of envelopes.
220 ->Add(new AliMUONGeometryConstituent(
221 name, copyNo, translation, rotation, npar, param));
224 //______________________________________________________________________________
225 void AliMUONGeometryEnvelope::AddConstituentParam(const TString& name,
227 const TGeoCombiTrans& transform,
228 Int_t npar, Double_t* param)
230 /// Add the volume with the specified name and transformation
231 /// to the list of envelopes.
234 ->Add(new AliMUONGeometryConstituent(
235 name, copyNo, transform, npar, param));
238 //______________________________________________________________________________
239 void AliMUONGeometryEnvelope::SetTranslation(const TGeoTranslation& translation)
241 /// Set the envelope position
244 ->SetTranslation(const_cast<Double_t*>(translation.GetTranslation()));
247 //______________________________________________________________________________
248 void AliMUONGeometryEnvelope::SetRotation(const TGeoRotation& rotation)
250 /// Set the enevlope rotation
252 TGeoRotation* rot = new TGeoRotation();
253 rot->SetMatrix(const_cast<Double_t*>(rotation.GetRotationMatrix()));
255 fTransformation->SetRotation(rot);
258 //______________________________________________________________________________
259 void AliMUONGeometryEnvelope::SetTransform(const TGeoCombiTrans& transform)
261 // Sets the enevlope transformation
265 ->SetTranslation(const_cast<Double_t*>(transform.GetTranslation()));
267 TGeoRotation* rot = new TGeoRotation();
268 rot->SetMatrix(const_cast<Double_t*>(transform.GetRotationMatrix()));
270 fTransformation->SetRotation(rot);