]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliModule.cxx
Set variable dummy even if not used.
[u/mrichter/AliRoot.git] / STEER / AliModule.cxx
CommitLineData
8494b010 1///////////////////////////////////////////////////////////////////////////////
2// //
3// Base class for ALICE modules. Both sensitive modules (Modules) and //
4// non-sensitive ones are described by this base class. This class //
5// supports the hit and digit trees produced by the simulation and also //
6// the objects produced by the reconstruction. //
7// //
8// This class is also responsible for building the geometry of the //
9// Modules. //
10// //
11//Begin_Html
12/*
13<img src="gif/AliModuleClass.gif">
14*/
15//End_Html
16// //
17///////////////////////////////////////////////////////////////////////////////
18#include "AliModule.h"
19#include "AliRun.h"
20#include "AliHit.h"
21#include "AliPoints.h"
22#include <TClass.h>
23#include <TNode.h>
24#include <TRandom.h>
25
26ClassImp(AliModule)
27
28//_____________________________________________________________________________
29AliModule::AliModule()
30{
31 //
32 // Default constructor for the AliModule class
33 //
34 fHistograms = 0;
35 fNodes = 0;
36}
37
38//_____________________________________________________________________________
39AliModule::AliModule(const char* name,const char *title):TNamed(name,title)
40{
41 //
42 // Normal constructor invoked by all Modules.
43 // Create the list for Module specific histograms
44 // Add this Module to the global list of Modules in Run.
45 //
46 //
47 // Initialises the histogram list
48 fHistograms = new TList();
49 //
50 // Initialises the list of ROOT TNodes
51 fNodes = new TList();
52 //
53 // Get the Module numeric ID
54 Int_t id = gAlice->GetModuleID(name);
55 if (id < 0) {
56 // Unknown Module !
57 Warning("AliRun::Ctor","ERROR Unknown Module: %s\n",name);
58 return;
59 }
60 //
61 // Add this Module to the list of Modules
62 gAlice->Modules()->AddAtAndExpand(this,id);
63 //
64 //
65 SetMarkerColor(3);
66 //
67 // Allocate space for tracking media and material indexes
68 fIdtmed = new TArrayI(100);
69 fIdmate = new TArrayI(100);
70 for(Int_t i=0;i<100;i++) (*fIdmate)[i]=(*fIdtmed)[i]=0;
71 //
72 // Prepare to find the tracking media range
73 fLoMedium = 65536;
74 fHiMedium = 0;
75}
76
77//_____________________________________________________________________________
78AliModule::~AliModule()
79{
80 //
81 // Destructor
82 //
83 fHistograms = 0;
84 //
85 // Delete ROOT geometry
86 fNodes->Clear();
87 delete fNodes;
88 //
89 // Delete TArray objects
90 delete fIdtmed;
91 delete fIdmate;
92}
93
94//_____________________________________________________________________________
95void AliModule::Disable()
96{
97 //
98 // Disable Module on viewer
99 //
100 fActive = kFALSE;
101 TIter next(fNodes);
102 TNode *node;
103 //
104 // Loop through geometry to disable all
105 // nodes for this Module
106 while((node = (TNode*)next())) {
107 node->SetVisibility(0);
108 }
109}
110
111//_____________________________________________________________________________
112Int_t AliModule::DistancetoPrimitive(Int_t, Int_t)
113{
114 //
115 // Return distance from mouse pointer to object
116 // Dummy routine for the moment
117 //
118 return 9999;
119}
120
121//_____________________________________________________________________________
122void AliModule::Enable()
123{
124 //
125 // Enable Module on the viewver
126 //
127 fActive = kTRUE;
128 TIter next(fNodes);
129 TNode *node;
130 //
131 // Loop through geometry to enable all
132 // nodes for this Module
133 while((node = (TNode*)next())) {
134 node->SetVisibility(1);
135 }
136}
137
138//_____________________________________________________________________________
139void AliModule::AliMaterial(Int_t imat, const char* name, Float_t a,
140 Float_t z, Float_t dens, Float_t radl,
141 Float_t absl, Float_t *buf, Int_t nwbuf) const
142{
143 //
144 // Store the parameters for a material
145 //
146 // imat the material index will be stored in (*fIdmate)[imat]
147 // name material name
148 // a atomic mass
149 // z atomic number
150 // dens density
151 // radl radiation length
152 // absl absorbtion length
153 // buf adress of an array user words
154 // nwbuf number of user words
155 //
156 Int_t kmat;
157 AliMC::GetMC()->Material(kmat, name, a, z, dens, radl, absl, buf, nwbuf);
158 (*fIdmate)[imat]=kmat;
159}
160
161
162//_____________________________________________________________________________
163void AliModule::AliMixture(Int_t imat, const char *name, Float_t *a,
164 Float_t *z, Float_t dens, Int_t nlmat,
165 Float_t *wmat) const
166{
167 //
168 // Defines mixture or compound imat as composed by
169 // nlmat materials defined by arrays a, z and wmat
170 //
171 // If nlmat > 0 wmat contains the proportion by
172 // weights of each basic material in the mixture
173 //
174 // If nlmat < 0 wmat contains the number of atoms
175 // of eack kind in the molecule of the compound
176 // In this case, wmat is changed on output to the relative weigths.
177 //
178 // imat the material index will be stored in (*fIdmate)[imat]
179 // name material name
180 // a array of atomic masses
181 // z array of atomic numbers
182 // dens density
183 // nlmat number of components
184 // wmat array of concentrations
185 //
186 Int_t kmat;
187 AliMC::GetMC()->Mixture(kmat, name, a, z, dens, nlmat, wmat);
188 (*fIdmate)[imat]=kmat;
189}
190
191//_____________________________________________________________________________
192void AliModule::AliMedium(Int_t numed, const char *name, Int_t nmat,
193 Int_t isvol, Int_t ifield, Float_t fieldm,
194 Float_t tmaxfd, Float_t stemax, Float_t deemax,
195 Float_t epsil, Float_t stmin, Float_t *ubuf,
196 Int_t nbuf) const
197{
198 //
199 // Store the parameters of a tracking medium
200 //
201 // numed the medium number is stored into (*fIdtmed)[numed-1]
202 // name medium name
203 // nmat the material number is stored into (*fIdmate)[nmat]
204 // isvol sensitive volume if isvol!=0
205 // ifield magnetic field flag (see below)
206 // fieldm maximum magnetic field
207 // tmaxfd maximum deflection angle due to magnetic field
208 // stemax maximum step allowed
209 // deemax maximum fractional energy loss in one step
210 // epsil tracking precision in cm
211 // stmin minimum step due to continuous processes
212 //
213 // ifield = 0 no magnetic field
214 // = -1 user decision in guswim
215 // = 1 tracking performed with Runge Kutta
216 // = 2 tracking performed with helix
217 // = 3 constant magnetic field along z
218 //
219 Int_t kmed;
220 Int_t *idtmed = gAlice->Idtmed();
221 AliMC::GetMC()->Medium(kmed,name, (*fIdmate)[nmat], isvol, ifield, fieldm,
222 tmaxfd, stemax, deemax, epsil, stmin, ubuf, nbuf);
223 idtmed[numed-1]=kmed;
224}
225
226//_____________________________________________________________________________
227void AliModule::AliMatrix(Int_t &nmat, Float_t theta1, Float_t phi1,
228 Float_t theta2, Float_t phi2, Float_t theta3,
229 Float_t phi3) const
230{
231 //
232 // Define a rotation matrix. Angles are in degrees.
233 //
234 // nmat on output contains the number assigned to the rotation matrix
235 // theta1 polar angle for axis I
236 // phi1 azimuthal angle for axis I
237 // theta2 polar angle for axis II
238 // phi2 azimuthal angle for axis II
239 // theta3 polar angle for axis III
240 // phi3 azimuthal angle for axis III
241 //
242 AliMC::GetMC()->Matrix(nmat, theta1, phi1, theta2, phi2, theta3, phi3);
243}
244
245//_____________________________________________________________________________
246void AliModule::SetEuclidFile(char* material, char* geometry)
247{
248 //
249 // Sets the name of the Euclid file
250 //
251 fEuclidMaterial=material;
252 if(geometry) {
253 fEuclidGeometry=geometry;
254 } else {
255 char* name = new char[strlen(material)];
256 strcpy(name,material);
257 strcpy(&name[strlen(name)-4],".euc");
258 fEuclidGeometry=name;
259 delete [] name;
260 }
261}
262
263//_____________________________________________________________________________
264void AliModule::Streamer(TBuffer &R__b)
265{
266 //
267 // Stream an object of class Module.
268 //
269 if (R__b.IsReading()) {
270 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
271 TNamed::Streamer(R__b);
272 TAttLine::Streamer(R__b);
273 TAttMarker::Streamer(R__b);
274 fEuclidMaterial.Streamer(R__b);
275 fEuclidGeometry.Streamer(R__b);
276 R__b >> fActive;
277 R__b >> fHistograms;
278 //
279 // Stream the pointers but not the TClonesArrays
280 R__b >> fNodes; // diff
281 } else {
282 R__b.WriteVersion(AliModule::IsA());
283 TNamed::Streamer(R__b);
284 TAttLine::Streamer(R__b);
285 TAttMarker::Streamer(R__b);
286 fEuclidMaterial.Streamer(R__b);
287 fEuclidGeometry.Streamer(R__b);
288 R__b << fActive;
289 R__b << fHistograms;
290 //
291 // Stream the pointers but not the TClonesArrays
292 R__b << fNodes; // diff
293 }
294}
295