1 ///////////////////////////////////////////////////////////////////////////////
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. //
8 // This class is also responsible for building the geometry of the //
13 <img src="gif/AliModuleClass.gif">
17 ///////////////////////////////////////////////////////////////////////////////
18 #include "AliModule.h"
21 #include "AliPoints.h"
28 //_____________________________________________________________________________
29 AliModule::AliModule()
32 // Default constructor for the AliModule class
38 //_____________________________________________________________________________
39 AliModule::AliModule(const char* name,const char *title):TNamed(name,title)
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.
47 // Initialises the histogram list
48 fHistograms = new TList();
50 // Initialises the list of ROOT TNodes
53 // Get the Module numeric ID
54 Int_t id = gAlice->GetModuleID(name);
57 Warning("AliRun::Ctor","ERROR Unknown Module: %s\n",name);
61 // Add this Module to the list of Modules
62 gAlice->Modules()->AddAtAndExpand(this,id);
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;
72 // Prepare to find the tracking media range
77 //_____________________________________________________________________________
78 AliModule::~AliModule()
85 // Delete ROOT geometry
89 // Delete TArray objects
94 //_____________________________________________________________________________
95 void AliModule::Disable()
98 // Disable Module on viewer
104 // Loop through geometry to disable all
105 // nodes for this Module
106 while((node = (TNode*)next())) {
107 node->SetVisibility(0);
111 //_____________________________________________________________________________
112 Int_t AliModule::DistancetoPrimitive(Int_t, Int_t)
115 // Return distance from mouse pointer to object
116 // Dummy routine for the moment
121 //_____________________________________________________________________________
122 void AliModule::Enable()
125 // Enable Module on the viewver
131 // Loop through geometry to enable all
132 // nodes for this Module
133 while((node = (TNode*)next())) {
134 node->SetVisibility(1);
138 //_____________________________________________________________________________
139 void 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
144 // Store the parameters for a material
146 // imat the material index will be stored in (*fIdmate)[imat]
147 // name material name
151 // radl radiation length
152 // absl absorbtion length
153 // buf adress of an array user words
154 // nwbuf number of user words
157 AliMC::GetMC()->Material(kmat, name, a, z, dens, radl, absl, buf, nwbuf);
158 (*fIdmate)[imat]=kmat;
162 //_____________________________________________________________________________
163 void AliModule::AliMixture(Int_t imat, const char *name, Float_t *a,
164 Float_t *z, Float_t dens, Int_t nlmat,
168 // Defines mixture or compound imat as composed by
169 // nlmat materials defined by arrays a, z and wmat
171 // If nlmat > 0 wmat contains the proportion by
172 // weights of each basic material in the mixture
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.
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
183 // nlmat number of components
184 // wmat array of concentrations
187 AliMC::GetMC()->Mixture(kmat, name, a, z, dens, nlmat, wmat);
188 (*fIdmate)[imat]=kmat;
191 //_____________________________________________________________________________
192 void 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,
199 // Store the parameters of a tracking medium
201 // numed the medium number is stored into (*fIdtmed)[numed-1]
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
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
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;
226 //_____________________________________________________________________________
227 void AliModule::AliMatrix(Int_t &nmat, Float_t theta1, Float_t phi1,
228 Float_t theta2, Float_t phi2, Float_t theta3,
232 // Define a rotation matrix. Angles are in degrees.
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
242 AliMC::GetMC()->Matrix(nmat, theta1, phi1, theta2, phi2, theta3, phi3);
245 //_____________________________________________________________________________
246 void AliModule::SetEuclidFile(char* material, char* geometry)
249 // Sets the name of the Euclid file
251 fEuclidMaterial=material;
253 fEuclidGeometry=geometry;
255 char* name = new char[strlen(material)];
256 strcpy(name,material);
257 strcpy(&name[strlen(name)-4],".euc");
258 fEuclidGeometry=name;
263 //_____________________________________________________________________________
264 void AliModule::Streamer(TBuffer &R__b)
267 // Stream an object of class Module.
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);
279 // Stream the pointers but not the TClonesArrays
280 R__b >> fNodes; // diff
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);
291 // Stream the pointers but not the TClonesArrays
292 R__b << fNodes; // diff