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="picts/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);
56 // Module already added !
57 Warning("Ctor","Module: %s already present at %d\n",name,id);
61 // Add this Module to the list of Modules
62 gAlice->Modules()->Add(this);
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 gMC->Material(kmat, name, a, z, dens, radl, absl, buf, nwbuf);
158 (*fIdmate)[imat]=kmat;
161 //_____________________________________________________________________________
162 void AliModule::AliGetMaterial(Int_t imat, char* name, Float_t &a,
163 Float_t &z, Float_t &dens, Float_t &radl,
167 // Store the parameters for a material
169 // imat the material index will be stored in (*fIdmate)[imat]
170 // name material name
174 // radl radiation length
175 // absl absorbtion length
176 // buf adress of an array user words
177 // nwbuf number of user words
182 kmat=(*fIdmate)[imat];
183 gMC->Gfmate(kmat, name, a, z, dens, radl, absl, buf, nwbuf);
187 //_____________________________________________________________________________
188 void AliModule::AliMixture(Int_t imat, const char *name, Float_t *a,
189 Float_t *z, Float_t dens, Int_t nlmat,
193 // Defines mixture or compound imat as composed by
194 // nlmat materials defined by arrays a, z and wmat
196 // If nlmat > 0 wmat contains the proportion by
197 // weights of each basic material in the mixture
199 // If nlmat < 0 wmat contains the number of atoms
200 // of eack kind in the molecule of the compound
201 // In this case, wmat is changed on output to the relative weigths.
203 // imat the material index will be stored in (*fIdmate)[imat]
204 // name material name
205 // a array of atomic masses
206 // z array of atomic numbers
208 // nlmat number of components
209 // wmat array of concentrations
212 gMC->Mixture(kmat, name, a, z, dens, nlmat, wmat);
213 (*fIdmate)[imat]=kmat;
216 //_____________________________________________________________________________
217 void AliModule::AliMedium(Int_t numed, const char *name, Int_t nmat,
218 Int_t isvol, Int_t ifield, Float_t fieldm,
219 Float_t tmaxfd, Float_t stemax, Float_t deemax,
220 Float_t epsil, Float_t stmin, Float_t *ubuf,
224 // Store the parameters of a tracking medium
226 // numed the medium number is stored into (*fIdtmed)[numed-1]
228 // nmat the material number is stored into (*fIdmate)[nmat]
229 // isvol sensitive volume if isvol!=0
230 // ifield magnetic field flag (see below)
231 // fieldm maximum magnetic field
232 // tmaxfd maximum deflection angle due to magnetic field
233 // stemax maximum step allowed
234 // deemax maximum fractional energy loss in one step
235 // epsil tracking precision in cm
236 // stmin minimum step due to continuous processes
238 // ifield = 0 no magnetic field
239 // = -1 user decision in guswim
240 // = 1 tracking performed with Runge Kutta
241 // = 2 tracking performed with helix
242 // = 3 constant magnetic field along z
245 gMC->Medium(kmed,name, (*fIdmate)[nmat], isvol, ifield, fieldm,
246 tmaxfd, stemax, deemax, epsil, stmin, ubuf, nbuf);
247 (*fIdtmed)[numed]=kmed;
250 //_____________________________________________________________________________
251 void AliModule::AliMatrix(Int_t &nmat, Float_t theta1, Float_t phi1,
252 Float_t theta2, Float_t phi2, Float_t theta3,
256 // Define a rotation matrix. Angles are in degrees.
258 // nmat on output contains the number assigned to the rotation matrix
259 // theta1 polar angle for axis I
260 // phi1 azimuthal angle for axis I
261 // theta2 polar angle for axis II
262 // phi2 azimuthal angle for axis II
263 // theta3 polar angle for axis III
264 // phi3 azimuthal angle for axis III
266 gMC->Matrix(nmat, theta1, phi1, theta2, phi2, theta3, phi3);
269 //_____________________________________________________________________________
270 void AliModule::SetEuclidFile(char* material, char* geometry)
273 // Sets the name of the Euclid file
275 fEuclidMaterial=material;
277 fEuclidGeometry=geometry;
279 char* name = new char[strlen(material)];
280 strcpy(name,material);
281 strcpy(&name[strlen(name)-4],".euc");
282 fEuclidGeometry=name;
287 //_____________________________________________________________________________
288 void AliModule::Streamer(TBuffer &R__b)
291 // Stream an object of class Module.
293 if (R__b.IsReading()) {
294 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
295 TNamed::Streamer(R__b);
296 TAttLine::Streamer(R__b);
297 TAttMarker::Streamer(R__b);
298 fEuclidMaterial.Streamer(R__b);
299 fEuclidGeometry.Streamer(R__b);
303 // Stream the pointers but not the TClonesArrays
304 R__b >> fNodes; // diff
306 R__b.WriteVersion(AliModule::IsA());
307 TNamed::Streamer(R__b);
308 TAttLine::Streamer(R__b);
309 TAttMarker::Streamer(R__b);
310 fEuclidMaterial.Streamer(R__b);
311 fEuclidGeometry.Streamer(R__b);
315 // Stream the pointers but not the TClonesArrays
316 R__b << fNodes; // diff