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