AliRoot Core  da88d91 (da88d91)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliMUONGeometryEnvelope.cxx
Go to the documentation of this file.
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 //-----------------------------------------------------------------------------
19 // Class AliMUONGeometryEnvelope
20 // -----------------------------
21 // Helper class for definititon of an assembly of volumes.
22 // Author: Ivana Hrivnacova, IPN Orsay
23 // 23/01/2004
24 //-----------------------------------------------------------------------------
25 
26 #include <TGeoMatrix.h>
27 #include <TString.h>
28 #include <TObjArray.h>
29 
32 #include "AliLog.h"
33 
37 
38 //______________________________________________________________________________
40  Int_t id,
41  Bool_t isVirtual,
42  const char* only)
43  : TNamed(name, name),
44  fIsVirtual(isVirtual),
45  fIsMANY(false),
46  fCopyNo(1),
47  fTransformation(0),
48  fConstituents(0)
49 {
51 
52  if (TString(only) == TString("MANY")) fIsMANY = true;
53 
54  // Create the envelope transformation
55  fTransformation = new TGeoCombiTrans("");
56  fConstituents = new TObjArray(20);
57 
58  // Set id
59  SetUniqueID(id);
60 }
61 
62 
63 //______________________________________________________________________________
65  Int_t id,
66  Int_t copyNo,
67  const char* only)
68  : TNamed(name, name),
69  fIsVirtual(false),
70  fIsMANY(false),
71  fCopyNo(copyNo),
72  fTransformation(0),
73  fConstituents(0)
74 {
77 
78  if (TString(only) == TString("MANY")) fIsMANY = true;
79 
80  // Create the envelope transformation
81  fTransformation = new TGeoCombiTrans("");
82  fConstituents = new TObjArray(20);
83 
84  // Set id
85  SetUniqueID(id);
86 }
87 
88 
89 //______________________________________________________________________________
91  : TNamed(),
92  fIsVirtual(0),
93  fIsMANY(false),
94  fCopyNo(0),
95  fTransformation(0),
96  fConstituents(0)
97 {
99 }
100 
101 //______________________________________________________________________________
103 {
105 
106  // Add deleting rotation matrices
107 
108  delete fTransformation;
109 
110  if (fConstituents) {
111  fConstituents->Delete();
112  delete fConstituents;
113  }
114 }
115 
116 //
117 // public methods
118 //
119 
120 //______________________________________________________________________________
121 void AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo)
122 {
125 
126  fConstituents->Add(new AliMUONGeometryConstituent(name, copyNo, 0, 0));
127 }
128 
129 //______________________________________________________________________________
130 void AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo,
131  const TGeoTranslation& translation)
132 {
135 
137  ->Add(new AliMUONGeometryConstituent(name, copyNo, translation, 0, 0));
138 }
139 
140 //______________________________________________________________________________
141 void AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo,
142  const TGeoTranslation& translation,
143  const TGeoRotation& rotation)
144 {
147 
149  ->Add(new AliMUONGeometryConstituent(
150  name, copyNo, translation, rotation, 0, 0));
151 }
152 
153 //______________________________________________________________________________
154 void AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo,
155  const TGeoCombiTrans& transform )
156 {
159 
161  ->Add(new AliMUONGeometryConstituent(
162  name, copyNo, transform, 0, 0));
163 }
164 
165 //______________________________________________________________________________
167  Int_t copyNo, Int_t npar, Double_t* param)
168 {
171 
173  ->Add(new AliMUONGeometryConstituent(name, copyNo, npar, param));
174 }
175 
176 //______________________________________________________________________________
178  Int_t copyNo, const TGeoTranslation& translation,
179  Int_t npar, Double_t* param)
180 {
183 
185  ->Add(new AliMUONGeometryConstituent(
186  name, copyNo, translation, npar, param));
187 }
188 
189 //______________________________________________________________________________
191  Int_t copyNo, const TGeoTranslation& translation,
192  const TGeoRotation& rotation,
193  Int_t npar, Double_t* param)
194 {
197 
199  ->Add(new AliMUONGeometryConstituent(
200  name, copyNo, translation, rotation, npar, param));
201 }
202 
203 //______________________________________________________________________________
205  Int_t copyNo,
206  const TGeoCombiTrans& transform,
207  Int_t npar, Double_t* param)
208 {
211 
213  ->Add(new AliMUONGeometryConstituent(
214  name, copyNo, transform, npar, param));
215 }
216 
217 //______________________________________________________________________________
218 void AliMUONGeometryEnvelope::SetTranslation(const TGeoTranslation& translation)
219 {
221 
223  ->SetTranslation(const_cast<Double_t*>(translation.GetTranslation()));
224 }
225 
226 //______________________________________________________________________________
227 void AliMUONGeometryEnvelope::SetRotation(const TGeoRotation& rotation)
228 {
230 
231  TGeoRotation* rot = new TGeoRotation();
232  rot->SetMatrix(const_cast<Double_t*>(rotation.GetRotationMatrix()));
233 
234  fTransformation->SetRotation(rot);
235 }
236 
237 //______________________________________________________________________________
238 void AliMUONGeometryEnvelope::SetTransform(const TGeoCombiTrans& transform)
239 {
241 
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 }
void AddConstituentParam(const TString &name, Int_t copyNo, Int_t npar, Double_t *param)
#define TObjArray
TGeoCombiTrans * fTransformation
more than one copy)
void SetTransform(const TGeoCombiTrans &transform)
ClassImp(TPCGenInfo)
Definition: AliTPCCmpNG.C:254
Geometry envelope helper class.
void AddConstituent(const TString &name, Int_t copyNo)
Helper class for definititon of an assembly of volumes.
TObjArray * fConstituents
the constituents names and transformations
void SetTranslation(const TGeoTranslation &translation)
Bool_t fIsMANY
true if envelope is placed with MANY option
void SetRotation(const TGeoRotation &rotation)