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"
33 ClassImp(AliMUONGeometryEnvelope)
36 //______________________________________________________________________________
37 AliMUONGeometryEnvelope::AliMUONGeometryEnvelope(const TString& name,
42 fIsVirtual(isVirtual),
48 /// Standard constructor
50 if (TString(only) == TString("MANY")) fIsMANY = true;
52 // Create the envelope transformation
53 fTransformation = new TGeoCombiTrans("");
54 fConstituents = new TObjArray(20);
61 //______________________________________________________________________________
62 AliMUONGeometryEnvelope::AliMUONGeometryEnvelope(const TString& name,
73 /// Standard constructor for a non virtual enevelope with a specified copy
76 if (TString(only) == TString("MANY")) fIsMANY = true;
78 // Create the envelope transformation
79 fTransformation = new TGeoCombiTrans("");
80 fConstituents = new TObjArray(20);
87 //______________________________________________________________________________
88 AliMUONGeometryEnvelope::AliMUONGeometryEnvelope()
96 /// Default constructor
99 //______________________________________________________________________________
100 AliMUONGeometryEnvelope::~AliMUONGeometryEnvelope()
104 // Add deleting rotation matrices
106 delete fTransformation;
109 fConstituents->Delete();
110 delete fConstituents;
118 //______________________________________________________________________________
119 void AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo)
121 /// Add the volume with the specified name and transformation
122 /// to the list of envelopes.
124 fConstituents->Add(new AliMUONGeometryConstituent(name, copyNo, 0, 0));
127 //______________________________________________________________________________
128 void AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo,
129 const TGeoTranslation& translation)
131 /// Add the volume with the specified name and transformation
132 /// to the list of envelopes.
135 ->Add(new AliMUONGeometryConstituent(name, copyNo, translation, 0, 0));
138 //______________________________________________________________________________
139 void AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo,
140 const TGeoTranslation& translation,
141 const TGeoRotation& rotation)
143 /// Add the volume with the specified name and transformation
144 /// to the list of envelopes.
147 ->Add(new AliMUONGeometryConstituent(
148 name, copyNo, translation, rotation, 0, 0));
151 //______________________________________________________________________________
152 void AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo,
153 const TGeoCombiTrans& transform )
155 /// Add the volume with the specified name and transformation
156 /// to the list of envelopes.
159 ->Add(new AliMUONGeometryConstituent(
160 name, copyNo, transform, 0, 0));
163 //______________________________________________________________________________
164 void AliMUONGeometryEnvelope::AddConstituentParam(const TString& name,
165 Int_t copyNo, Int_t npar, Double_t* param)
167 /// Add the volume with the specified name and transformation
168 /// to the list of envelopes.
171 ->Add(new AliMUONGeometryConstituent(name, copyNo, npar, param));
174 //______________________________________________________________________________
175 void AliMUONGeometryEnvelope::AddConstituentParam(const TString& name,
176 Int_t copyNo, const TGeoTranslation& translation,
177 Int_t npar, Double_t* param)
179 /// Add the volume with the specified name and transformation
180 /// to the list of envelopes.
183 ->Add(new AliMUONGeometryConstituent(
184 name, copyNo, translation, npar, param));
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)
193 /// Add the volume with the specified name and transformation
194 /// to the list of envelopes.
197 ->Add(new AliMUONGeometryConstituent(
198 name, copyNo, translation, rotation, npar, param));
201 //______________________________________________________________________________
202 void AliMUONGeometryEnvelope::AddConstituentParam(const TString& name,
204 const TGeoCombiTrans& transform,
205 Int_t npar, Double_t* param)
207 /// Add the volume with the specified name and transformation
208 /// to the list of envelopes.
211 ->Add(new AliMUONGeometryConstituent(
212 name, copyNo, transform, npar, param));
215 //______________________________________________________________________________
216 void AliMUONGeometryEnvelope::SetTranslation(const TGeoTranslation& translation)
218 /// Set the envelope position
221 ->SetTranslation(const_cast<Double_t*>(translation.GetTranslation()));
224 //______________________________________________________________________________
225 void AliMUONGeometryEnvelope::SetRotation(const TGeoRotation& rotation)
227 /// Set the envelope rotation
229 TGeoRotation* rot = new TGeoRotation();
230 rot->SetMatrix(const_cast<Double_t*>(rotation.GetRotationMatrix()));
232 fTransformation->SetRotation(rot);
235 //______________________________________________________________________________
236 void AliMUONGeometryEnvelope::SetTransform(const TGeoCombiTrans& transform)
238 /// Set the envelope transformation
241 ->SetTranslation(const_cast<Double_t*>(transform.GetTranslation()));
243 TGeoRotation* rot = new TGeoRotation();
244 rot->SetMatrix(const_cast<Double_t*>(transform.GetRotationMatrix()));
246 fTransformation->SetRotation(rot);