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 //-----------------------------------------------------------------------------
19 // Class AliMUONGeometryEnvelope
20 // -----------------------------
21 // Helper class for definititon of an assembly of volumes.
22 // Author: Ivana Hrivnacova, IPN Orsay
24 //-----------------------------------------------------------------------------
26 #include <TGeoMatrix.h>
28 #include <TObjArray.h>
30 #include "AliMUONGeometryEnvelope.h"
31 #include "AliMUONGeometryConstituent.h"
35 ClassImp(AliMUONGeometryEnvelope)
38 //______________________________________________________________________________
39 AliMUONGeometryEnvelope::AliMUONGeometryEnvelope(const TString& name,
44 fIsVirtual(isVirtual),
50 /// Standard constructor
52 if (TString(only) == TString("MANY")) fIsMANY = true;
54 // Create the envelope transformation
55 fTransformation = new TGeoCombiTrans("");
56 fConstituents = new TObjArray(20);
63 //______________________________________________________________________________
64 AliMUONGeometryEnvelope::AliMUONGeometryEnvelope(const TString& name,
75 /// Standard constructor for a non virtual enevelope with a specified copy
78 if (TString(only) == TString("MANY")) fIsMANY = true;
80 // Create the envelope transformation
81 fTransformation = new TGeoCombiTrans("");
82 fConstituents = new TObjArray(20);
89 //______________________________________________________________________________
90 AliMUONGeometryEnvelope::AliMUONGeometryEnvelope()
98 /// Default constructor
101 //______________________________________________________________________________
102 AliMUONGeometryEnvelope::~AliMUONGeometryEnvelope()
106 // Add deleting rotation matrices
108 delete fTransformation;
111 fConstituents->Delete();
112 delete fConstituents;
120 //______________________________________________________________________________
121 void AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo)
123 /// Add the volume with the specified name and transformation
124 /// to the list of envelopes.
126 fConstituents->Add(new AliMUONGeometryConstituent(name, copyNo, 0, 0));
129 //______________________________________________________________________________
130 void AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo,
131 const TGeoTranslation& translation)
133 /// Add the volume with the specified name and transformation
134 /// to the list of envelopes.
137 ->Add(new AliMUONGeometryConstituent(name, copyNo, translation, 0, 0));
140 //______________________________________________________________________________
141 void AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo,
142 const TGeoTranslation& translation,
143 const TGeoRotation& rotation)
145 /// Add the volume with the specified name and transformation
146 /// to the list of envelopes.
149 ->Add(new AliMUONGeometryConstituent(
150 name, copyNo, translation, rotation, 0, 0));
153 //______________________________________________________________________________
154 void AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo,
155 const TGeoCombiTrans& transform )
157 /// Add the volume with the specified name and transformation
158 /// to the list of envelopes.
161 ->Add(new AliMUONGeometryConstituent(
162 name, copyNo, transform, 0, 0));
165 //______________________________________________________________________________
166 void AliMUONGeometryEnvelope::AddConstituentParam(const TString& name,
167 Int_t copyNo, Int_t npar, Double_t* param)
169 /// Add the volume with the specified name and transformation
170 /// to the list of envelopes.
173 ->Add(new AliMUONGeometryConstituent(name, copyNo, npar, param));
176 //______________________________________________________________________________
177 void AliMUONGeometryEnvelope::AddConstituentParam(const TString& name,
178 Int_t copyNo, const TGeoTranslation& translation,
179 Int_t npar, Double_t* param)
181 /// Add the volume with the specified name and transformation
182 /// to the list of envelopes.
185 ->Add(new AliMUONGeometryConstituent(
186 name, copyNo, translation, npar, param));
189 //______________________________________________________________________________
190 void AliMUONGeometryEnvelope::AddConstituentParam(const TString& name,
191 Int_t copyNo, const TGeoTranslation& translation,
192 const TGeoRotation& rotation,
193 Int_t npar, Double_t* param)
195 /// Add the volume with the specified name and transformation
196 /// to the list of envelopes.
199 ->Add(new AliMUONGeometryConstituent(
200 name, copyNo, translation, rotation, npar, param));
203 //______________________________________________________________________________
204 void AliMUONGeometryEnvelope::AddConstituentParam(const TString& name,
206 const TGeoCombiTrans& transform,
207 Int_t npar, Double_t* param)
209 /// Add the volume with the specified name and transformation
210 /// to the list of envelopes.
213 ->Add(new AliMUONGeometryConstituent(
214 name, copyNo, transform, npar, param));
217 //______________________________________________________________________________
218 void AliMUONGeometryEnvelope::SetTranslation(const TGeoTranslation& translation)
220 /// Set the envelope position
223 ->SetTranslation(const_cast<Double_t*>(translation.GetTranslation()));
226 //______________________________________________________________________________
227 void AliMUONGeometryEnvelope::SetRotation(const TGeoRotation& rotation)
229 /// Set the envelope rotation
231 TGeoRotation* rot = new TGeoRotation();
232 rot->SetMatrix(const_cast<Double_t*>(rotation.GetRotationMatrix()));
234 fTransformation->SetRotation(rot);
237 //______________________________________________________________________________
238 void AliMUONGeometryEnvelope::SetTransform(const TGeoCombiTrans& transform)
240 /// Set the envelope transformation
243 ->SetTranslation(const_cast<Double_t*>(transform.GetTranslation()));
245 TGeoRotation* rot = new TGeoRotation();
246 rot->SetMatrix(const_cast<Double_t*>(transform.GetRotationMatrix()));
248 fTransformation->SetRotation(rot);