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