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