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
73 if (TString(only) == TString("MANY")) fIsMANY = true;
75 // Create the envelope transformation
76 fTransformation = new TGeoCombiTrans("");
77 fConstituents = new TObjArray(20);
84 //______________________________________________________________________________
85 AliMUONGeometryEnvelope::AliMUONGeometryEnvelope()
93 // Default constructor
97 //______________________________________________________________________________
98 AliMUONGeometryEnvelope::AliMUONGeometryEnvelope(
99 const AliMUONGeometryEnvelope& rhs)
102 AliFatal("Copy constructor is not implemented.");
105 //______________________________________________________________________________
106 AliMUONGeometryEnvelope::~AliMUONGeometryEnvelope()
109 // Add deleting rotation matrices
111 delete fTransformation;
114 fConstituents->Delete();
115 delete fConstituents;
119 //______________________________________________________________________________
120 AliMUONGeometryEnvelope&
121 AliMUONGeometryEnvelope::operator = (const AliMUONGeometryEnvelope& rhs)
123 // check assignement to self
124 if (this == &rhs) return *this;
126 AliFatal("Assignment operator is not implemented.");
135 //______________________________________________________________________________
136 void AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo)
138 // Adds the volume with the specified name and transformation
139 // to the list of envelopes.
142 fConstituents->Add(new AliMUONGeometryConstituent(name, copyNo, 0, 0));
145 //______________________________________________________________________________
146 void AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo,
147 const TGeoTranslation& translation)
149 // Adds the volume with the specified name and transformation
150 // to the list of envelopes.
154 ->Add(new AliMUONGeometryConstituent(name, copyNo, translation, 0, 0));
157 //______________________________________________________________________________
158 void AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo,
159 const TGeoTranslation& translation,
160 const TGeoRotation& rotation)
162 // Adds the volume with the specified name and transformation
163 // to the list of envelopes.
167 ->Add(new AliMUONGeometryConstituent(
168 name, copyNo, translation, rotation, 0, 0));
171 //______________________________________________________________________________
172 void AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo,
173 const TGeoCombiTrans& transform )
175 // Adds the volume with the specified name and transformation
176 // to the list of envelopes.
180 ->Add(new AliMUONGeometryConstituent(
181 name, copyNo, transform, 0, 0));
184 //______________________________________________________________________________
185 void AliMUONGeometryEnvelope::AddConstituentParam(const TString& name,
186 Int_t copyNo, Int_t npar, Double_t* param)
188 // Adds the volume with the specified name and transformation
189 // to the list of envelopes.
193 ->Add(new AliMUONGeometryConstituent(name, copyNo, npar, param));
196 //______________________________________________________________________________
197 void AliMUONGeometryEnvelope::AddConstituentParam(const TString& name,
198 Int_t copyNo, const TGeoTranslation& translation,
199 Int_t npar, Double_t* param)
201 // Adds the volume with the specified name and transformation
202 // 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 // Adds the volume with the specified name and transformation
217 // to the list of envelopes.
221 ->Add(new AliMUONGeometryConstituent(
222 name, copyNo, translation, rotation, npar, param));
225 //______________________________________________________________________________
226 void AliMUONGeometryEnvelope::AddConstituentParam(const TString& name,
228 const TGeoCombiTrans& transform,
229 Int_t npar, Double_t* param)
231 // Adds the volume with the specified name and transformation
232 // to the list of envelopes.
236 ->Add(new AliMUONGeometryConstituent(
237 name, copyNo, transform, npar, param));
240 //______________________________________________________________________________
241 void AliMUONGeometryEnvelope::SetTranslation(const TGeoTranslation& translation)
243 // Sets the envelope position
247 ->SetTranslation(const_cast<Double_t*>(translation.GetTranslation()));
250 //______________________________________________________________________________
251 void AliMUONGeometryEnvelope::SetRotation(const TGeoRotation& rotation)
253 // Sets the enevlope rotation
256 TGeoRotation* rot = new TGeoRotation();
257 rot->SetMatrix(const_cast<Double_t*>(rotation.GetRotationMatrix()));
259 fTransformation->SetRotation(rot);
262 //______________________________________________________________________________
263 void AliMUONGeometryEnvelope::SetTransform(const TGeoCombiTrans& transform)
265 // Sets the enevlope transformation
269 ->SetTranslation(const_cast<Double_t*>(transform.GetTranslation()));
271 TGeoRotation* rot = new TGeoRotation();
272 rot->SetMatrix(const_cast<Double_t*>(transform.GetRotationMatrix()));
274 fTransformation->SetRotation(rot);