]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONGeometryEnvelope.cxx
Previous commit had the bad side-effect of changing the behaviour of Raw QA to comput...
[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$
3d1463c8 17
18//-----------------------------------------------------------------------------
d1cd2474 19// Class AliMUONGeometryEnvelope
20// -----------------------------
c4ee792d 21// Helper class for definititon of an assembly of volumes.
d1cd2474 22// Author: Ivana Hrivnacova, IPN Orsay
5f1df83a 23// 23/01/2004
3d1463c8 24//-----------------------------------------------------------------------------
d1cd2474 25
26#include <TGeoMatrix.h>
6b82c1f0 27#include <TString.h>
d1cd2474 28#include <TObjArray.h>
29
30#include "AliMUONGeometryEnvelope.h"
31#include "AliMUONGeometryConstituent.h"
8c343c7c 32#include "AliLog.h"
d1cd2474 33
a9aad96e 34/// \cond CLASSIMP
d1cd2474 35ClassImp(AliMUONGeometryEnvelope)
a9aad96e 36/// \endcond
d1cd2474 37
38//______________________________________________________________________________
39AliMUONGeometryEnvelope::AliMUONGeometryEnvelope(const TString& name,
c0b51181 40 Int_t id,
6b82c1f0 41 Bool_t isVirtual,
42 const char* only)
d1cd2474 43 : TNamed(name, name),
44 fIsVirtual(isVirtual),
6b82c1f0 45 fIsMANY(false),
c0b51181 46 fCopyNo(1),
d1cd2474 47 fTransformation(0),
48 fConstituents(0)
49{
692de412 50/// Standard constructor
d1cd2474 51
6b82c1f0 52 if (TString(only) == TString("MANY")) fIsMANY = true;
53
d1cd2474 54 // Create the envelope transformation
55 fTransformation = new TGeoCombiTrans("");
56 fConstituents = new TObjArray(20);
c0b51181 57
58 // Set id
59 SetUniqueID(id);
d1cd2474 60}
61
62
63//______________________________________________________________________________
c0b51181 64AliMUONGeometryEnvelope::AliMUONGeometryEnvelope(const TString& name,
65 Int_t id,
6b82c1f0 66 Int_t copyNo,
67 const char* only)
d1cd2474 68 : TNamed(name, name),
69 fIsVirtual(false),
6b82c1f0 70 fIsMANY(false),
d1cd2474 71 fCopyNo(copyNo),
72 fTransformation(0),
73 fConstituents(0)
74{
692de412 75/// Standard constructor for a non virtual enevelope with a specified copy
76/// number
d1cd2474 77
6b82c1f0 78 if (TString(only) == TString("MANY")) fIsMANY = true;
79
d1cd2474 80 // Create the envelope transformation
81 fTransformation = new TGeoCombiTrans("");
82 fConstituents = new TObjArray(20);
c0b51181 83
84 // Set id
85 SetUniqueID(id);
d1cd2474 86}
87
88
89//______________________________________________________________________________
90AliMUONGeometryEnvelope::AliMUONGeometryEnvelope()
91 : TNamed(),
92 fIsVirtual(0),
c0b51181 93 fIsMANY(false),
94 fCopyNo(0),
d1cd2474 95 fTransformation(0),
96 fConstituents(0)
97{
692de412 98/// Default constructor
d1cd2474 99}
100
d1cd2474 101//______________________________________________________________________________
102AliMUONGeometryEnvelope::~AliMUONGeometryEnvelope()
103{
692de412 104/// Destructor
105
d1cd2474 106 // Add deleting rotation matrices
107
108 delete fTransformation;
109
110 if (fConstituents) {
111 fConstituents->Delete();
112 delete fConstituents;
113 }
114}
115
d1cd2474 116//
117// public methods
118//
119
120//______________________________________________________________________________
121void AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo)
122{
692de412 123/// Add the volume with the specified name and transformation
124/// to the list of envelopes.
d1cd2474 125
126 fConstituents->Add(new AliMUONGeometryConstituent(name, copyNo, 0, 0));
127}
128
129//______________________________________________________________________________
130void AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo,
131 const TGeoTranslation& translation)
132{
692de412 133/// Add the volume with the specified name and transformation
134/// to the list of envelopes.
d1cd2474 135
136 fConstituents
137 ->Add(new AliMUONGeometryConstituent(name, copyNo, translation, 0, 0));
138}
139
140//______________________________________________________________________________
141void AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo,
142 const TGeoTranslation& translation,
143 const TGeoRotation& rotation)
144{
692de412 145/// Add the volume with the specified name and transformation
146/// to the list of envelopes.
d1cd2474 147
148 fConstituents
149 ->Add(new AliMUONGeometryConstituent(
150 name, copyNo, translation, rotation, 0, 0));
151}
152
c0b51181 153//______________________________________________________________________________
154void AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo,
155 const TGeoCombiTrans& transform )
156{
692de412 157/// Add the volume with the specified name and transformation
158/// to the list of envelopes.
c0b51181 159
160 fConstituents
161 ->Add(new AliMUONGeometryConstituent(
162 name, copyNo, transform, 0, 0));
163}
164
d1cd2474 165//______________________________________________________________________________
166void AliMUONGeometryEnvelope::AddConstituentParam(const TString& name,
167 Int_t copyNo, Int_t npar, Double_t* param)
168{
692de412 169/// Add the volume with the specified name and transformation
170/// to the list of envelopes.
d1cd2474 171
172 fConstituents
173 ->Add(new AliMUONGeometryConstituent(name, copyNo, npar, param));
174}
175
176//______________________________________________________________________________
177void AliMUONGeometryEnvelope::AddConstituentParam(const TString& name,
178 Int_t copyNo, const TGeoTranslation& translation,
179 Int_t npar, Double_t* param)
180{
692de412 181/// Add the volume with the specified name and transformation
182/// to the list of envelopes.
d1cd2474 183
184 fConstituents
185 ->Add(new AliMUONGeometryConstituent(
186 name, copyNo, translation, npar, param));
187}
188
189//______________________________________________________________________________
190void AliMUONGeometryEnvelope::AddConstituentParam(const TString& name,
191 Int_t copyNo, const TGeoTranslation& translation,
192 const TGeoRotation& rotation,
193 Int_t npar, Double_t* param)
194{
692de412 195/// Add the volume with the specified name and transformation
196/// to the list of envelopes.
d1cd2474 197
198 fConstituents
199 ->Add(new AliMUONGeometryConstituent(
200 name, copyNo, translation, rotation, npar, param));
201}
202
c0b51181 203//______________________________________________________________________________
204void AliMUONGeometryEnvelope::AddConstituentParam(const TString& name,
205 Int_t copyNo,
206 const TGeoCombiTrans& transform,
207 Int_t npar, Double_t* param)
208{
692de412 209/// Add the volume with the specified name and transformation
210/// to the list of envelopes.
c0b51181 211
212 fConstituents
213 ->Add(new AliMUONGeometryConstituent(
214 name, copyNo, transform, npar, param));
215}
216
d1cd2474 217//______________________________________________________________________________
218void AliMUONGeometryEnvelope::SetTranslation(const TGeoTranslation& translation)
219{
692de412 220/// Set the envelope position
d1cd2474 221
222 fTransformation
223 ->SetTranslation(const_cast<Double_t*>(translation.GetTranslation()));
224}
225
226//______________________________________________________________________________
227void AliMUONGeometryEnvelope::SetRotation(const TGeoRotation& rotation)
228{
a9aad96e 229/// Set the envelope rotation
d1cd2474 230
231 TGeoRotation* rot = new TGeoRotation();
232 rot->SetMatrix(const_cast<Double_t*>(rotation.GetRotationMatrix()));
233
234 fTransformation->SetRotation(rot);
235}
c0b51181 236
237//______________________________________________________________________________
238void AliMUONGeometryEnvelope::SetTransform(const TGeoCombiTrans& transform)
239{
a9aad96e 240/// Set the envelope transformation
c0b51181 241
242 fTransformation
243 ->SetTranslation(const_cast<Double_t*>(transform.GetTranslation()));
244
245 TGeoRotation* rot = new TGeoRotation();
246 rot->SetMatrix(const_cast<Double_t*>(transform.GetRotationMatrix()));
247
248 fTransformation->SetRotation(rot);
249}