]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONGeometryEnvelope.cxx
Bug on error calculations (Christian)
[u/mrichter/AliRoot.git] / MUON / AliMUONGeometryEnvelope.cxx
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
31 ClassImp(AliMUONGeometryEnvelope)
32
33 //______________________________________________________________________________
34 AliMUONGeometryEnvelope::AliMUONGeometryEnvelope(const TString& name, 
35                                                  Bool_t isVirtual,
36                                                  const char* only)
37  : TNamed(name, name),
38    fIsVirtual(isVirtual),
39    fIsMANY(false),
40    fCopyNo(0),
41    fTransformation(0),
42    fConstituents(0)
43 {
44 // Standard constructor
45
46   if (TString(only) == TString("MANY")) fIsMANY = true;
47
48   // Create the envelope transformation
49   fTransformation = new TGeoCombiTrans("");
50   fConstituents = new TObjArray(20);
51 }
52
53
54 //______________________________________________________________________________
55 AliMUONGeometryEnvelope::AliMUONGeometryEnvelope(const TString& name, 
56                                                  Int_t copyNo, 
57                                                  const char* only)
58  : TNamed(name, name),
59    fIsVirtual(false),
60    fIsMANY(false),
61    fCopyNo(copyNo),
62    fTransformation(0),
63    fConstituents(0)
64 {
65 // Standard constructor
66
67   if (TString(only) == TString("MANY")) fIsMANY = true;
68
69   // Create the envelope transformation
70   fTransformation = new TGeoCombiTrans("");
71   fConstituents = new TObjArray(20);
72 }
73
74
75 //______________________________________________________________________________
76 AliMUONGeometryEnvelope::AliMUONGeometryEnvelope()
77  : TNamed(),
78    fIsVirtual(0),
79    fTransformation(0),
80    fConstituents(0)
81 {
82 // Default constructor
83 }
84
85
86 //______________________________________________________________________________
87 AliMUONGeometryEnvelope::AliMUONGeometryEnvelope(
88                                         const AliMUONGeometryEnvelope& rhs)
89   : TNamed(rhs)
90 {
91   Fatal("Copy constructor", 
92         "Copy constructor is not implemented.");
93 }
94
95 //______________________________________________________________________________
96 AliMUONGeometryEnvelope::~AliMUONGeometryEnvelope() 
97 {
98 //
99   // Add deleting rotation matrices 
100   
101   delete fTransformation;
102   
103   if (fConstituents) {
104     fConstituents->Delete();
105     delete fConstituents;
106   }  
107 }
108
109 //______________________________________________________________________________
110 AliMUONGeometryEnvelope& 
111 AliMUONGeometryEnvelope::operator = (const AliMUONGeometryEnvelope& rhs) 
112 {
113   // check assignement to self
114   if (this == &rhs) return *this;
115
116   Fatal("operator=", 
117         "Assignment operator is not implemented.");
118     
119   return *this;  
120 }
121
122 //
123 // public methods
124 //
125
126 //______________________________________________________________________________
127 void  AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo) 
128 {
129 // Adds the volume with the specified name and transformation
130 // to the list of envelopes.
131 // ---                                             
132
133   fConstituents->Add(new AliMUONGeometryConstituent(name, copyNo, 0, 0));
134 }
135
136 //______________________________________________________________________________
137 void  AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo, 
138                                           const TGeoTranslation& translation)
139 {
140 // Adds the volume with the specified name and transformation
141 // to the list of envelopes.
142 // ---                                             
143
144   fConstituents
145     ->Add(new AliMUONGeometryConstituent(name, copyNo, translation, 0, 0));
146 }
147
148 //______________________________________________________________________________
149 void  AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo,
150                                           const TGeoTranslation& translation,
151                                           const TGeoRotation& rotation)
152 {
153 // Adds the volume with the specified name and transformation
154 // to the list of envelopes.
155 // ---                                             
156
157   fConstituents
158     ->Add(new AliMUONGeometryConstituent(
159                      name, copyNo, translation, rotation, 0, 0));
160 }
161
162 //______________________________________________________________________________
163 void  AliMUONGeometryEnvelope::AddConstituentParam(const TString& name, 
164                                   Int_t copyNo, Int_t npar, Double_t* param) 
165 {
166 // Adds the volume with the specified name and transformation
167 // to the list of envelopes.
168 // ---                                             
169
170   fConstituents
171     ->Add(new AliMUONGeometryConstituent(name, copyNo, npar, param));
172 }
173
174 //______________________________________________________________________________
175 void  AliMUONGeometryEnvelope::AddConstituentParam(const TString& name, 
176                                   Int_t copyNo, const TGeoTranslation& translation,
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, npar, param));
186 }
187
188 //______________________________________________________________________________
189 void  AliMUONGeometryEnvelope::AddConstituentParam(const TString& name, 
190                                   Int_t copyNo, const TGeoTranslation& translation,
191                                   const TGeoRotation& rotation, 
192                                   Int_t npar, Double_t* param)
193 {
194 // Adds the volume with the specified name and transformation
195 // to the list of envelopes.
196 // ---                                             
197
198   fConstituents
199     ->Add(new AliMUONGeometryConstituent(
200                      name, copyNo, translation, rotation, npar, param));
201 }
202
203 //______________________________________________________________________________
204 void  AliMUONGeometryEnvelope::SetTranslation(const TGeoTranslation& translation)
205 {
206 // Sets the chamber position wrt ALIC.
207 // ---
208
209   fTransformation
210     ->SetTranslation(const_cast<Double_t*>(translation.GetTranslation()));
211 }  
212
213 //______________________________________________________________________________
214 void  AliMUONGeometryEnvelope::SetRotation(const TGeoRotation& rotation)
215 {
216 // Sets the chamber rotation wrt ALIC.
217 // ---
218
219   TGeoRotation* rot = new TGeoRotation();
220   rot->SetMatrix(const_cast<Double_t*>(rotation.GetRotationMatrix()));
221
222   fTransformation->SetRotation(rot);
223 }