1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
20 ///////////////////////////////////////////////////////////////////////////////
22 // Base class for ALICE modules. Both sensitive modules (Modules) and //
23 // non-sensitive ones are described by this base class. This class //
24 // supports the hit and digit trees produced by the simulation and also //
25 // the objects produced by the reconstruction. //
27 // This class is also responsible for building the geometry of the //
32 <img src="picts/AliModuleClass.gif">
36 ///////////////////////////////////////////////////////////////////////////////
37 #include "AliModule.h"
40 #include "AliPoints.h"
47 //_____________________________________________________________________________
48 AliModule::AliModule()
51 // Default constructor for the AliModule class
57 //_____________________________________________________________________________
58 AliModule::AliModule(const char* name,const char *title):TNamed(name,title)
61 // Normal constructor invoked by all Modules.
62 // Create the list for Module specific histograms
63 // Add this Module to the global list of Modules in Run.
66 // Initialises the histogram list
67 fHistograms = new TList();
69 // Initialises the list of ROOT TNodes
72 // Get the Module numeric ID
73 Int_t id = gAlice->GetModuleID(name);
75 // Module already added !
76 Warning("Ctor","Module: %s already present at %d\n",name,id);
80 // Add this Module to the list of Modules
81 gAlice->Modules()->Add(this);
86 // Allocate space for tracking media and material indexes
87 fIdtmed = new TArrayI(100);
88 fIdmate = new TArrayI(100);
89 for(Int_t i=0;i<100;i++) (*fIdmate)[i]=(*fIdtmed)[i]=0;
91 // Prepare to find the tracking media range
96 //_____________________________________________________________________________
97 AliModule::~AliModule()
104 // Delete ROOT geometry
108 // Delete TArray objects
113 //_____________________________________________________________________________
114 void AliModule::Disable()
117 // Disable Module on viewer
123 // Loop through geometry to disable all
124 // nodes for this Module
125 while((node = (TNode*)next())) {
126 node->SetVisibility(0);
130 //_____________________________________________________________________________
131 Int_t AliModule::DistancetoPrimitive(Int_t, Int_t)
134 // Return distance from mouse pointer to object
135 // Dummy routine for the moment
140 //_____________________________________________________________________________
141 void AliModule::Enable()
144 // Enable Module on the viewver
150 // Loop through geometry to enable all
151 // nodes for this Module
152 while((node = (TNode*)next())) {
153 node->SetVisibility(1);
157 //_____________________________________________________________________________
158 void AliModule::AliMaterial(Int_t imat, const char* name, Float_t a,
159 Float_t z, Float_t dens, Float_t radl,
160 Float_t absl, Float_t *buf, Int_t nwbuf) const
163 // Store the parameters for a material
165 // imat the material index will be stored in (*fIdmate)[imat]
166 // name material name
170 // radl radiation length
171 // absl absorbtion length
172 // buf adress of an array user words
173 // nwbuf number of user words
176 gMC->Material(kmat, name, a, z, dens, radl, absl, buf, nwbuf);
177 (*fIdmate)[imat]=kmat;
180 //_____________________________________________________________________________
181 void AliModule::AliGetMaterial(Int_t imat, char* name, Float_t &a,
182 Float_t &z, Float_t &dens, Float_t &radl,
186 // Store the parameters for a material
188 // imat the material index will be stored in (*fIdmate)[imat]
189 // name material name
193 // radl radiation length
194 // absl absorbtion length
195 // buf adress of an array user words
196 // nwbuf number of user words
201 kmat=(*fIdmate)[imat];
202 gMC->Gfmate(kmat, name, a, z, dens, radl, absl, buf, nwbuf);
206 //_____________________________________________________________________________
207 void AliModule::AliMixture(Int_t imat, const char *name, Float_t *a,
208 Float_t *z, Float_t dens, Int_t nlmat,
212 // Defines mixture or compound imat as composed by
213 // nlmat materials defined by arrays a, z and wmat
215 // If nlmat > 0 wmat contains the proportion by
216 // weights of each basic material in the mixture
218 // If nlmat < 0 wmat contains the number of atoms
219 // of eack kind in the molecule of the compound
220 // In this case, wmat is changed on output to the relative weigths.
222 // imat the material index will be stored in (*fIdmate)[imat]
223 // name material name
224 // a array of atomic masses
225 // z array of atomic numbers
227 // nlmat number of components
228 // wmat array of concentrations
231 gMC->Mixture(kmat, name, a, z, dens, nlmat, wmat);
232 (*fIdmate)[imat]=kmat;
235 //_____________________________________________________________________________
236 void AliModule::AliMedium(Int_t numed, const char *name, Int_t nmat,
237 Int_t isvol, Int_t ifield, Float_t fieldm,
238 Float_t tmaxfd, Float_t stemax, Float_t deemax,
239 Float_t epsil, Float_t stmin, Float_t *ubuf,
243 // Store the parameters of a tracking medium
245 // numed the medium number is stored into (*fIdtmed)[numed-1]
247 // nmat the material number is stored into (*fIdmate)[nmat]
248 // isvol sensitive volume if isvol!=0
249 // ifield magnetic field flag (see below)
250 // fieldm maximum magnetic field
251 // tmaxfd maximum deflection angle due to magnetic field
252 // stemax maximum step allowed
253 // deemax maximum fractional energy loss in one step
254 // epsil tracking precision in cm
255 // stmin minimum step due to continuous processes
257 // ifield = 0 no magnetic field
258 // = -1 user decision in guswim
259 // = 1 tracking performed with Runge Kutta
260 // = 2 tracking performed with helix
261 // = 3 constant magnetic field along z
264 gMC->Medium(kmed,name, (*fIdmate)[nmat], isvol, ifield, fieldm,
265 tmaxfd, stemax, deemax, epsil, stmin, ubuf, nbuf);
266 (*fIdtmed)[numed]=kmed;
269 //_____________________________________________________________________________
270 void AliModule::AliMatrix(Int_t &nmat, Float_t theta1, Float_t phi1,
271 Float_t theta2, Float_t phi2, Float_t theta3,
275 // Define a rotation matrix. Angles are in degrees.
277 // nmat on output contains the number assigned to the rotation matrix
278 // theta1 polar angle for axis I
279 // phi1 azimuthal angle for axis I
280 // theta2 polar angle for axis II
281 // phi2 azimuthal angle for axis II
282 // theta3 polar angle for axis III
283 // phi3 azimuthal angle for axis III
285 gMC->Matrix(nmat, theta1, phi1, theta2, phi2, theta3, phi3);
288 //_____________________________________________________________________________
289 void AliModule::SetEuclidFile(char* material, char* geometry)
292 // Sets the name of the Euclid file
294 fEuclidMaterial=material;
296 fEuclidGeometry=geometry;
298 char* name = new char[strlen(material)];
299 strcpy(name,material);
300 strcpy(&name[strlen(name)-4],".euc");
301 fEuclidGeometry=name;
306 //_____________________________________________________________________________
307 void AliModule::Streamer(TBuffer &R__b)
310 // Stream an object of class Module.
312 if (R__b.IsReading()) {
313 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
314 TNamed::Streamer(R__b);
315 TAttLine::Streamer(R__b);
316 TAttMarker::Streamer(R__b);
317 fEuclidMaterial.Streamer(R__b);
318 fEuclidGeometry.Streamer(R__b);
322 // Stream the pointers but not the TClonesArrays
323 R__b >> fNodes; // diff
325 R__b.WriteVersion(AliModule::IsA());
326 TNamed::Streamer(R__b);
327 TAttLine::Streamer(R__b);
328 TAttMarker::Streamer(R__b);
329 fEuclidMaterial.Streamer(R__b);
330 fEuclidGeometry.Streamer(R__b);
334 // Stream the pointers but not the TClonesArrays
335 R__b << fNodes; // diff