]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONGeometryEnvelope.cxx
adding histograms to check pedestal data OffLine
[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 //-----------------------------------------------------------------------------
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
30 #include "AliMUONGeometryEnvelope.h"
31 #include "AliMUONGeometryConstituent.h"
32 #include "AliLog.h"
33
34 /// \cond CLASSIMP
35 ClassImp(AliMUONGeometryEnvelope)
36 /// \endcond
37
38 //______________________________________________________________________________
39 AliMUONGeometryEnvelope::AliMUONGeometryEnvelope(const TString& name, 
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 {
50 /// Standard constructor
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 //______________________________________________________________________________
64 AliMUONGeometryEnvelope::AliMUONGeometryEnvelope(const TString& name,   
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 {
75 /// Standard constructor for a non virtual enevelope with a specified copy 
76 /// number
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 //______________________________________________________________________________
90 AliMUONGeometryEnvelope::AliMUONGeometryEnvelope()
91  : TNamed(),
92    fIsVirtual(0),
93    fIsMANY(false),
94    fCopyNo(0),
95    fTransformation(0),
96    fConstituents(0)
97 {
98 /// Default constructor
99 }
100
101 //______________________________________________________________________________
102 AliMUONGeometryEnvelope::~AliMUONGeometryEnvelope() 
103 {
104 /// Destructor
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 {
123 /// Add the volume with the specified name and transformation
124 /// to the list of envelopes.
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 {
133 /// Add the volume with the specified name and transformation
134 /// to the list of envelopes.
135
136   fConstituents
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 {
145 /// Add the volume with the specified name and transformation
146 /// to the list of envelopes.
147
148   fConstituents
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 {
157 /// Add the volume with the specified name and transformation
158 /// to the list of envelopes.
159
160   fConstituents
161     ->Add(new AliMUONGeometryConstituent(
162                      name, copyNo, transform, 0, 0));
163 }
164
165 //______________________________________________________________________________
166 void  AliMUONGeometryEnvelope::AddConstituentParam(const TString& name, 
167                                   Int_t copyNo, Int_t npar, Double_t* param) 
168 {
169 /// Add the volume with the specified name and transformation
170 /// to the list of envelopes.
171
172   fConstituents
173     ->Add(new AliMUONGeometryConstituent(name, copyNo, npar, param));
174 }
175
176 //______________________________________________________________________________
177 void  AliMUONGeometryEnvelope::AddConstituentParam(const TString& name, 
178                                   Int_t copyNo, const TGeoTranslation& translation,
179                                   Int_t npar, Double_t* param)
180 {
181 /// Add the volume with the specified name and transformation
182 /// to the list of envelopes.
183
184   fConstituents
185     ->Add(new AliMUONGeometryConstituent(
186                      name, copyNo, translation, npar, param));
187 }
188
189 //______________________________________________________________________________
190 void  AliMUONGeometryEnvelope::AddConstituentParam(const TString& name, 
191                                   Int_t copyNo, const TGeoTranslation& translation,
192                                   const TGeoRotation& rotation, 
193                                   Int_t npar, Double_t* param)
194 {
195 /// Add the volume with the specified name and transformation
196 /// to the list of envelopes.
197
198   fConstituents
199     ->Add(new AliMUONGeometryConstituent(
200                      name, copyNo, translation, rotation, npar, param));
201 }
202
203 //______________________________________________________________________________
204 void  AliMUONGeometryEnvelope::AddConstituentParam(const TString& name, 
205                                   Int_t copyNo, 
206                                   const TGeoCombiTrans& transform, 
207                                   Int_t npar, Double_t* param)
208 {
209 /// Add the volume with the specified name and transformation
210 /// to the list of envelopes.
211
212   fConstituents
213     ->Add(new AliMUONGeometryConstituent(
214                      name, copyNo, transform, npar, param));
215 }
216
217 //______________________________________________________________________________
218 void  AliMUONGeometryEnvelope::SetTranslation(const TGeoTranslation& translation)
219 {
220 /// Set the envelope position
221
222   fTransformation
223     ->SetTranslation(const_cast<Double_t*>(translation.GetTranslation()));
224 }  
225
226 //______________________________________________________________________________
227 void  AliMUONGeometryEnvelope::SetRotation(const TGeoRotation& rotation)
228 {
229 /// Set the envelope rotation
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 {
240 /// Set the envelope transformation
241
242   fTransformation
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 }