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