]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONGeometryEnvelope.cxx
Redefinition of data member corrected.
[u/mrichter/AliRoot.git] / MUON / AliMUONGeometryEnvelope.cxx
CommitLineData
d1cd2474 1// $Id$
2//
3// Class AliMUONGeometryEnvelope
4// -----------------------------
5// Helper class for definititon an assembly of volumes.
6//
7// Author: Ivana Hrivnacova, IPN Orsay
8
9#include <TGeoMatrix.h>
6b82c1f0 10#include <TString.h>
d1cd2474 11#include <TObjArray.h>
12
13#include "AliMUONGeometryEnvelope.h"
14#include "AliMUONGeometryConstituent.h"
15
16ClassImp(AliMUONGeometryEnvelope)
17
18//______________________________________________________________________________
19AliMUONGeometryEnvelope::AliMUONGeometryEnvelope(const TString& name,
6b82c1f0 20 Bool_t isVirtual,
21 const char* only)
d1cd2474 22 : TNamed(name, name),
23 fIsVirtual(isVirtual),
6b82c1f0 24 fIsMANY(false),
d1cd2474 25 fCopyNo(0),
26 fTransformation(0),
27 fConstituents(0)
28{
29// Standard constructor
30
6b82c1f0 31 if (TString(only) == TString("MANY")) fIsMANY = true;
32
d1cd2474 33 // Create the envelope transformation
34 fTransformation = new TGeoCombiTrans("");
35 fConstituents = new TObjArray(20);
36}
37
38
39//______________________________________________________________________________
40AliMUONGeometryEnvelope::AliMUONGeometryEnvelope(const TString& name,
6b82c1f0 41 Int_t copyNo,
42 const char* only)
d1cd2474 43 : TNamed(name, name),
44 fIsVirtual(false),
6b82c1f0 45 fIsMANY(false),
d1cd2474 46 fCopyNo(copyNo),
47 fTransformation(0),
48 fConstituents(0)
49{
50// Standard constructor
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);
57}
58
59
60//______________________________________________________________________________
61AliMUONGeometryEnvelope::AliMUONGeometryEnvelope()
62 : TNamed(),
63 fIsVirtual(0),
64 fTransformation(0),
65 fConstituents(0)
66{
67// Default constructor
68}
69
70
71//______________________________________________________________________________
72AliMUONGeometryEnvelope::AliMUONGeometryEnvelope(
73 const AliMUONGeometryEnvelope& rhs)
74 : TNamed(rhs)
75{
76 Fatal("Copy constructor",
77 "Copy constructor is not implemented.");
78}
79
80//______________________________________________________________________________
81AliMUONGeometryEnvelope::~AliMUONGeometryEnvelope()
82{
83//
84 // Add deleting rotation matrices
85
86 delete fTransformation;
87
88 if (fConstituents) {
89 fConstituents->Delete();
90 delete fConstituents;
91 }
92}
93
94//______________________________________________________________________________
95AliMUONGeometryEnvelope&
96AliMUONGeometryEnvelope::operator = (const AliMUONGeometryEnvelope& rhs)
97{
98 // check assignement to self
99 if (this == &rhs) return *this;
100
101 Fatal("operator=",
102 "Assignment operator is not implemented.");
103
104 return *this;
105}
106
107//
108// public methods
109//
110
111//______________________________________________________________________________
112void AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo)
113{
114// Adds the volume with the specified name and transformation
115// to the list of envelopes.
116// ---
117
118 fConstituents->Add(new AliMUONGeometryConstituent(name, copyNo, 0, 0));
119}
120
121//______________________________________________________________________________
122void AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo,
123 const TGeoTranslation& translation)
124{
125// Adds the volume with the specified name and transformation
126// to the list of envelopes.
127// ---
128
129 fConstituents
130 ->Add(new AliMUONGeometryConstituent(name, copyNo, translation, 0, 0));
131}
132
133//______________________________________________________________________________
134void AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo,
135 const TGeoTranslation& translation,
136 const TGeoRotation& rotation)
137{
138// Adds the volume with the specified name and transformation
139// to the list of envelopes.
140// ---
141
142 fConstituents
143 ->Add(new AliMUONGeometryConstituent(
144 name, copyNo, translation, rotation, 0, 0));
145}
146
147//______________________________________________________________________________
148void AliMUONGeometryEnvelope::AddConstituentParam(const TString& name,
149 Int_t copyNo, Int_t npar, Double_t* param)
150{
151// Adds the volume with the specified name and transformation
152// to the list of envelopes.
153// ---
154
155 fConstituents
156 ->Add(new AliMUONGeometryConstituent(name, copyNo, npar, param));
157}
158
159//______________________________________________________________________________
160void AliMUONGeometryEnvelope::AddConstituentParam(const TString& name,
161 Int_t copyNo, const TGeoTranslation& translation,
162 Int_t npar, Double_t* param)
163{
164// Adds the volume with the specified name and transformation
165// to the list of envelopes.
166// ---
167
168 fConstituents
169 ->Add(new AliMUONGeometryConstituent(
170 name, copyNo, translation, npar, param));
171}
172
173//______________________________________________________________________________
174void AliMUONGeometryEnvelope::AddConstituentParam(const TString& name,
175 Int_t copyNo, const TGeoTranslation& translation,
176 const TGeoRotation& rotation,
177 Int_t npar, Double_t* param)
178{
179// Adds the volume with the specified name and transformation
180// to the list of envelopes.
181// ---
182
183 fConstituents
184 ->Add(new AliMUONGeometryConstituent(
185 name, copyNo, translation, rotation, npar, param));
186}
187
188//______________________________________________________________________________
189void AliMUONGeometryEnvelope::SetTranslation(const TGeoTranslation& translation)
190{
191// Sets the chamber position wrt ALIC.
192// ---
193
194 fTransformation
195 ->SetTranslation(const_cast<Double_t*>(translation.GetTranslation()));
196}
197
198//______________________________________________________________________________
199void AliMUONGeometryEnvelope::SetRotation(const TGeoRotation& rotation)
200{
201// Sets the chamber rotation wrt ALIC.
202// ---
203
204 TGeoRotation* rot = new TGeoRotation();
205 rot->SetMatrix(const_cast<Double_t*>(rotation.GetRotationMatrix()));
206
207 fTransformation->SetRotation(rot);
208}