]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TMEVSIM/TMevSim.cxx
Reflecting changes in AliPreprocessor
[u/mrichter/AliRoot.git] / TMEVSIM / TMevSim.cxx
CommitLineData
1a2762e8 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
88cb7938 16/* $Id$ */
1a2762e8 17
18////////////////////////////////////////////////////////////////////////////
19//
20// TMevSim
21//
22// TMevSim is an interface class between the event generator MEVSIM and
23// the ROOT system. The current implementation is based on the 6.11.2000
24// version provided by Lanny Ray on /afs/cern.ch/user/y/yiota/ray/mult_gen.
25//
26// Authors of MEVSIM:
27// For The STAR Collaboration
28//
29// Lanny Ray
30// Dept. of Physics
31// The University of Texas at Austin
32// Austin, Texas 78712
33// (512) 471-6107
34// ray@physics.utexas.edu
35//
36// Ron Longacre email:
37//
38//
39////////////////////////////////////////////////////////////////////////////
40//
41// I. OVERVIEW
42//
43// This code is intended to provide a quick means of producing
44// uncorrelated simulated events for event-by-event studies,
45// detector acceptance and efficiency studies, etc. The
46// user selects the number of events, the one-particle distribution
47// model, the Geant particles to include, the ranges in transverse
48// momentum, pseudorapidity and azimuthal angle, the mean
49// multiplicity for each particle type for the event run, the
50// mean temperature, Rapidity width, etc., and the standard deviations
51// for the event-to-event variation in the model parameters.
52// Note that these events are produced in the c.m. frame only.
53//
54// Anisotropic flow may also be simulated by introducing explicit
55// phi-dependence (azimuthal angle) in the particle distributions.
56// The assumed model is taken from Poskanzer and Voloshin, Phys. Rev.
57// C58, 1671 (1998), Eq.(1), where we use,
58//
59// E d^3N/dp^3 = (1/2*pi*pt)*[d^2N/dpt*dy]
60// * [1 + SUM(n=1,nflowterms){2*Vn*cos[n(phi-PSIr)]}]
61//
62// with up to 'nflowterms' (currently set to 6, see file
63// Parameter_values.inc) Fourier components allowed. Vn are
64// coefficients and PSIr is the reaction plane angle.
65// The algebraic signs of the Vn terms for n=odd are reversed
66// from their input values for particles with rapidity (y) < 0
67// as suggested in Poskanzer and Voloshin.
68// The flow parameters can depend on pt and rapidity (y) according
69// to the model suggested by Art Poskanzer (Feb. 2000) and as
70// defined in the Function Vn_pt_y.
71//
72// The user may select either to have the same multiplicity per
73// particle type for each event or to let the multiplicity vary
74// randomly according to a Poisson distribution. In addition, an
75// overall multiplicative scale factor can be applied to each
76// particle ID's multiplicity (same factor applied to each PID).
77// This scaling can vary randomly according to a Gaussian from
78// event-to-event. This is to simulate trigger acceptance
79// fluctuations. Similarly the
80// parameters of the one-particle distribution models may either
81// be fixed to the same value for each event or allowed to randomly
82// vary about a specified mean with a specified standard deviation
83// and assuming a Gaussian distribution.
84//
85// With respect to the reaction plane and anisotropic flow simulation,
86// the user may select among four options:
87// (1) ignore reaction plane and anisotropic flow effects; all
88// distributions will be azimuthally invariant, on average.
89// (2) assume a fixed reaction plane angle, PSIr, for all events
90// in the run.
91// (3) assume a Gaussian distribution with specified mean and
92// standard deviation for the reaction plane angles for the
93// events in the run. PSIr is randomly determined for each
94// event.
95// (4) assume uniformly distributed, random values for the reaction
96// plane angles from 0 to 360 deg., for each event in the run.
97//
98// The user may also select the anisotropic flow parameters, Vn,
99// to either be fixed for each event, or to randomly vary from event
100// to event according to a Gaussian distribution where the user must
101// specify the mean and std. dev. For both cases the input file must
102// list the 'nflowterms' (e.g. 6) values of the mean and Std.dev. for
103// the Vn parameters for all particle ID types included in the run.
104//
105// The available list of particles has been increased to permit a
106// number of meson and baryon resonances. For those with broad widths
107// the code samples the mass distribution for the resonance and outputs
108// the resonance mass for each instance in a special kinematic file
109// (see file unit=9, filename = 'mult_gen.kin'). The resonance shapes
110// are approximately Breit-Wigner and are specific for each resonance
111// case. The additional particle/resonances include: rho(+,-,0),
112// omega(0), eta', phi, J/Psi, Delta(-,0,+,++) and K*(+,-,0). Masses
113// are sampled for the rho, omega, phi, Deltas and D*s.
114// Refer to SUBR: Particle_prop and Particle_mass for the explicit
115// parameters, resonance shape models, and sampling ranges.
116//
117// The input is from a file, named 'mult_gen.in'. The output is
118// loaded into a file named 'mult_gen.out' which includes run
119// header information, event header information and the EVENT: and
120// TRACK: formats as in the new STAR TEXT Format for event generator
121// input to GSTAR. A log file, 'mult_gen.log' is also written which
122// may contain error messages. Normally this file should be empty
123// after a successful run. These filenames can easily be changed
124// to more suitable names by the script that runs the program or
125// by hand.
126//
127//
128// II. ALGORITHM
129//
130//
131//
132// The method for generating random multiplicities and model parameter
133// values involves the following steps:
134// (1) The Poisson or Gaussian distributions are computed and
135// loaded into function f().
136// (2) The distribution f(x') is integrated from xmin to x
137// and saved from x = xmin to x = xmax. The range and mesh
138// spaces are specified by the user.
139// (3) The integral of f is normalized to unity where
140// integral[f(x')](at x = xmin) = 0.0
141// integral[f(x')](at x = xmax) = 1.0
142// (4) A random number generator is called which delivers values
143// between 0.0 and 1.0.
144// (5) We consider the coordinate x (from xmin to xmax) to be
145// dependent on the integral[f]. Using the random number
146// for the selected value of integral[f] the value of x
147// is obtained by interpolation.
148//
149// An interpolation subroutine from Rubin Landau, Oregon State Univ.,
150// is used to do this interpolation; it involves uneven mesh point
151// spacing.
152//
153// The method for generating the particle momenta uses the
154// standard random elimination method and involves the following
155// steps:
156//
157// For model_type = 1,2,3,4 which are functions of pt,y (see following):
158// (1) The y range is computed using the pseudorapidity (eta)
159// range and includes ample cushioning around the sides
160// along the eta acceptance edges.
161// (2) The transverse momentum (pt) and rapidity (y) are
162// randomly chosen within the specified ranges.
163// (3) The pseudorapidity is computed for this (pt,y) value
164// (and the mass for each pid) and checked against the
165// pseudorapidity acceptance range.
166// (4) If the pseudorapidity is within range then the one-particle
167// model distribution is calculated at this point and its ratio
168// to the maximum value throughout (pt,eta) acceptance region
169// is calculated.
170// (5) Another random number is called and if less than the ratio
171// from step#4 the particle momentum is used; if not, then
172// another trial value of (pt,y) is obtained.
173// (6) This continues until the required multiplicity for the
174// specific event and particle type has been satisfied.
175// (7) This process is repeated for the requested number of particle
176// types and events.
177//
178// For model_type = 5,6 (see following) which are input bin-by-bin
179// in pt,eta:
180// (1) The transverse momentum (pt) and pseudorapidity (eta) are
181// randomly chosen within the specified ranges.
182// (2) The one-particle model distribution is calculated at this
183// point and its ratio to the maximum value throughout the
184// (pt,eta) region is calculated.
185// (3) Another random number is called and if less than the ratio
186// from step(2) the particle momentum is used; if not then
187// another trial value of (pt,eta) is obtained.
188// (4) This continues until the required multiplicity for the
189// specific event and particle type has been satisfied.
190// (5) This process is repeated for the requested number of particle
191// types and events.
192//
193// Problematic parameter values are tested, bad input values are checked
194// and in some cases may be changed so that the program will not crash.
195// In some cases the code execution is stopped.
196// Some distributions and/or unusual model parameter values may cause the
197// code to hang up due to the poor performance of the "elimination"
198// method for very strongly peaked distributions. These are tested for
199// certain problematic values and if necessary these events are aborted.
200// A message, "*** Event No. 2903 ABORTED:" for example is printed
201// in the 'mult_gen.out' file. Temperatures .le. 0.01 GeV and rapidity
202// width parameters .le. 0.01 will cause the event to abort.
203//
204//
205//
206// III. DESCRIPTION OF THE INPUT:
207//
208//
209// The input is described below in the 'read' statements and also in
210// the sample input file. Some additional comments are as follows:
211//
212// (1) n_events - Selected number of events in run. Can be anything
213// .ge. 1.
214// (2) n_pid_type - Number of particle ID types to include in the
215// particle list. e.g. pi(+) and pi(-) are counted
216// separately. The limit is set by parameter npid
217// in the accompanying include file 'Parameter_values.inc'
218// and is presently set at 20.
219// (3) model_type - equals 1,2,3,4,5 or 6 so far. See comments in
220// Function dNdpty to see what is calculated.
221// The models included are:
222// = 1, Factorized mt exponential, Gaussian rapidity model
223// = 2, Pratt non-expanding, spherical thermal source model
224// = 3, Bertsch non-expanding spherical thermal source model
225// = 4, Pratt spherically expanding, thermally equilibrated
226// source model.
227// = 5, Factorized pt and eta distributions input bin-by-bin.
228// = 6, Fully 2D pt,eta distributions input bin-by-bin.
229// NOTE: model_type = 1-4 are functions of (pt,y)
230// model_type = 5,6 are functions of (pt,eta)
231// (4) reac_plane_cntrl - Can be either 1,2,3 or 4 where:
232// = 1 to ignore reaction plane and anisotropic flow,
233// all distributions will be azimuthally symm.
234// = 2 to use a fixed reaction plane angle for all
235// events in the run.
236// = 3 to assume a randomly varying reaction plane
237// angle for each event as determined by a
238// Gaussian distribution.
239// = 4 to assume a randomly varying reaction plane
240// for each event in the run as determined by
241// a uniform distribution from 0 to 360 deg.
242// (5) PSIr_mean, PSIr_stdev - Reaction plane angle mean and Gaussian
243// std.dev. (both are in degrees) for cases
244// with reac_plane_cntrl = 2 (use mean value)
245// and 3. Note: these are read in regardless
246// of the value of reac_plane_cntrl.
247// (6) MultFac_mean, MultFac_stdev - Overall multiplicity scaling factor
248// for all PID types; mean and std.dev.;
249// for trigger fluctuations event-to-evt.
250// (7) pt_cut_min,pt_cut_max - Range of transverse momentum in GeV/c.
251// (8) eta_cut_min,eta_cut_max - Pseudorapidity range
252// (9) phi_cut_min,phi_cut_max - Azimuthal angular range in degrees.
253// (10) n_stdev_mult - Number of standard deviations about the mean value
254// of multiplicity to include in the random event-to-
255// event selection process. The maximum number of
256// steps that can be covered is determined by
257// parameter n_mult_max_steps in the accompanying
258// include file 'Parameter_values.inc' which is
259// presently set at 1000, but the true upper limit for
260// this is n_mult_max_steps - 1 = 999.
261// (11) n_stdev_temp - Same, except for the "Temperature" parameter.
262// (12) n_stdev_sigma- Same, except for the rapidity width parameter.
263// (13) n_stdev_expvel - Same, except for the expansion velocity parameter.
264// (14) n_stdev_PSIr - Same, except for the reaction plane angle
265// (15) n_stdev_Vn - Same, except for the anisotropy coefficients, Vn.
266// (16) n_stdev_MultFac - Same, except for the multiplicity scaling factor.
267// (17) n_integ_pts - Number of mesh points to use in the random model
268// parameter selection process. The upper limit is
269// set by parameter nmax_integ in the accompanying
270// include file 'Parameter_values.inc' which is presently
271// set at 100, but the true upper limit for n_integ_pts
272// is nmax_integ - 1 = 99.
273// (18) n_scan_pts - Number of mesh points to use to scan the (pt,y)
274// dependence of the model distributions looking for
275// the maximum value. The 2-D grid has
276// n_scan_pts * n_scan_pts points; no limit to size of
277// n_scan_pts.
278// (19) irand - Starting random number seed.
279//
280//**************************************************************************
281// FOR MODEL_TYPE = 1,2,3 or 4:
282// Input the following 7 lines for each particle type; repeat these
283// set of lines n_pid_type times:
284//
285// (a) gpid - Geant Particle ID code number
286// (b) mult_mean,mult_variance_control - Mean multiplicity and
287// variance control where:
288// mult_variance_control = 0 for no variance in multiplicity
289// mult_variance_control = 1 to allow Poisson distribution for
290// particle multiplicities for all events.
291// Note that a hard limit exists for the maximum possible
292// multiplicity for a given particle type per event. This is
293// determined by parameter factorial_max in accompanying include
294// file 'common_facfac.inc' and is presently set at 10000.
295// (c) Temp_mean, Temp_stdev - Temperature parameter mean (in GeV)
296// and standard deviation (Gaussian distribution assumed).
297// (d) sigma_mean, sigma_stdev - Rapidity distribution width (sigma)
298// parameter mean and standard deviation (Gaussian distribution
299// assumed).
300// (e) expvel_mean, expvel_stdev - S. Pratt expansion velocity
301// (in units of c) mean and standard deviation (Gaussian
302// distribution assumed).
303// (f) Vn_mean(k); k=1,4 - Anisotropic flow parameters, mean values
304// for Fourier component n=1.
305// (g) Vn_stdev(k); k=1,4 - Anisotropic flow parameters, std.dev.
306// values for Fourier component n=1.
307//
308// Repeat the last two lines of input for remaining Fourier
309// components n=2,3...6. Include all 6 sets of parameters
310// even if these are not used by the model for Vn(pt,y) (set
311// unused parameter means and std.dev. to 0.0). List 4 values
312// on every line, even though for n=even the 4th quantity is
313// not used.
314//
315//**************************************************************************
316// FOR MODEL_TYPE = 5 input the following set of lines for each particle
317// type; repeat these n_pid_type times.
318//
319// (a) gpid - Geant Particle ID code number
320// (b) mult_mean,mult_variance_control - Mean multiplicity and
321// variance control where:
322// mult_variance_control = 0 for no variance in multiplicity
323// mult_variance_control = 1 to allow Poisson distribution for
324// particle multiplicities for all events.
325// (c) pt_start, eta_start - minimum starting values for pt, eta
326// input for the bin-by-bin distributions.
327// (d) n_pt_bins, n_eta_bins - # input pt and eta bins.
328// (e) delta_pt, pt_bin - pt bin size and function value, repeat for
329// each pt bin.
330// (f) delta_eta, eta_bin - eta bin size and function value, repeat
331// for each eta bin.
332// (g) Vn_mean(k); k=1,4 - Anisotropic flow parameters, mean values
333// for Fourier component n=1.
334// (h) Vn_stdev(k); k=1,4 - Anisotropic flow parameters, std.dev.
335// values for Fourier component n=1.
336//
337// Repeat the last two lines of input for remaining Fourier
338// components n=2,3...6. Include all 6 sets of parameters
339// even if these are not used by the model for Vn(pt,y) (set
340// unused parameter means and std.dev. to 0.0). List 4 values
341// on every line, even though for n=even the 4th quantity is
342// not used.
343//
344// NOTE: The pt, eta ranges must fully include the requested ranges
345// in input #4 and 5 above; else the code execution will stop.
346//
347// Also, variable bin sizes are permitted for the input distributions.
348//
349// Also, this input distribution is used for all events in the run;
350// no fluctuations in this "parent" distribution are allowed from
351// event-to-event.
352//
353//**************************************************************************
354// FOR MODEL_TYPE = 6 input the following set of lines for each particle
355// type; repeat these n_pid_type times.
356//
357// (a) gpid - Geant Particle ID code number
358// (b) mult_mean,mult_variance_control - Mean multiplicity and
359// variance control where:
360// mult_variance_control = 0 for no variance in multiplicity
361// mult_variance_control = 1 to allow Poisson distribution for
362// particle multiplicities for all events.
363// (c) pt_start, eta_start - minimum starting values for pt, eta
364// input for the bin-by-bin distributions.
365// (d) n_pt_bins, n_eta_bins - # input pt and eta bins.
366// (e) delta_pt - pt bin size, repeat for each pt bin.
367// (f) delta_eta - eta bin size, repeat for each eta bin.
368// (g) i,j,pt_eta_bin(i,j) - read pt (index = i) and eta (index = j)
369// bin numbers and bin value for full 2D space
370// (h) Vn_mean(k); k=1,4 - Anisotropic flow parameters, mean values
371// for Fourier component n=1.
372// (i) Vn_stdev(k); k=1,4 - Anisotropic flow parameters, std.dev.
373// values for Fourier component n=1.
374//
375// Repeat the last two lines of input for remaining Fourier
376// components n=2,3...6. Include all 6 sets of parameters
377// even if these are not used by the model for Vn(pt,y) (set
378// unused parameter means and std.dev. to 0.0). List 4 values
379// on every line, even though for n=even the 4th quantity is
380// not used.
381//
382// NOTE: The pt, eta ranges must fully include the requested ranges
383// in input #4 and 5 above; else the code execution will stop.
384//
385// Also, variable bin sizes are permitted for the input distributions.
386//
387// Also, this input distribution is used for all events in the run;
388// no fluctuations in this "parent" distribution are allowed from
389// event-to-event.
390//
391///////////////////////////////////////////////////////////////////////////////
392
393
eae0fe66 394#include <Riostream.h>
3010c308 395#include <TParticle.h>
396#include <TClonesArray.h>
1a2762e8 397
31d87da2 398#include "TMevSim.h"
3010c308 399#include "TMevSimPartTypeParams.h"
1a2762e8 400
401#ifndef WIN32
402# define multgen multgen_
403# define type_of_call
404#else
405# define multgen MULTGEN
406# define type_of_call _stdcall
407#endif
408
409
410ClassImp(TMevSim)
411
412
413extern "C" void type_of_call multgen();
414
415//______________________________________________________________________________
416TMevSim::TMevSim(Int_t nEvents, Int_t modelType, Int_t reacPlaneCntrl,
417 Float_t psiRMean, Float_t psiRStDev, Float_t multFacMean, Float_t multFacStDev,
418 Float_t ptCutMin, Float_t ptCutMax, Float_t etaCutMin, Float_t etaCutMax,
419 Float_t phiCutMin, Float_t phiCutMax, Int_t irand) : TGenerator("MevSim", "MevSim")
420{
421// TMevSim constructor: initializes all the event-wide variables of MevSim with
422// user supplied values, or with the default ones (declared in the header file).
423// It also allocates space for the array which will store parameters specific to
424// each particle species.
425// Caution: Setting nEvents > 1 will have no effect, since only the last generated
426// event will be stored in POUT COMMON, and therefore only one event can be
427// accessible at a time.
428
429 fNEvents = nEvents;
430 fModelType = modelType;
431 fReacPlaneCntrl = reacPlaneCntrl;
432 fPsiRMean = psiRMean;
433 fPsiRStDev = psiRStDev;
434 fMultFacMean = multFacMean;
435 fMultFacStDev = multFacStDev;
436 fPtCutMin = ptCutMin;
437 fPtCutMax = ptCutMax;
438 fEtaCutMin = etaCutMin;
439 fEtaCutMax = etaCutMax;
440 fPhiCutMin = phiCutMin;
441 fPhiCutMax = phiCutMax;
442 fNStDevMult = fNStDevTemp = fNStDevSigma = fNStDevExpVel = fNStdDevPSIr = fNStDevVn = fNStDevMultFac = 3.0;
443 fNIntegPts = 100;
444 fNScanPts = 100;
445 firand = irand;
446 fParticleTypeParameters = new TClonesArray("TMevSimPartTypeParams",10);
4319640b 447 fNPDGCodes = 0;
1a2762e8 448 DefineParticles();
449}
450//______________________________________________________________________________
451TMevSim::~TMevSim()
452{
453// TMevSim destructor: destroys the object and all the particle information stored
454// in the list.
455
456 if (fParticleTypeParameters) {
457 fParticleTypeParameters->Clear();
458 delete fParticleTypeParameters;
459 fParticleTypeParameters = 0;
460 }
461}
462//______________________________________________________________________________
96df9573 463TMevSim::TMevSim(TMevSim& mevsim) : TGenerator(mevsim) {
1a2762e8 464// The copy constructor
465
466 *this = mevsim;
467}
468//______________________________________________________________________________
31d87da2 469
470TMevSim& TMevSim::operator=(const TMevSim& mevsim) {
1a2762e8 471// An assignment operator: initializes all the event-wide variables of MevSim with
472// the ones from a copied object. It also copies the parameters specific to
473// each particle species.
474
475 fNEvents = mevsim.GetNEvents();
476 fModelType = mevsim.GetModelType();
477 fReacPlaneCntrl = mevsim.GetReacPlaneCntrl();
478 fPsiRMean = mevsim.GetPsiRMean();
479 fPsiRStDev = mevsim.GetPsiRStDev();
480 fMultFacMean = mevsim.GetMultFacMean();
481 fMultFacStDev = mevsim.GetMultFacStDev();
482 fPtCutMin = mevsim.GetPtCutMin();
483 fPtCutMax = mevsim.GetPtCutMax();
484 fEtaCutMin = mevsim.GetEtaCutMin();
485 fEtaCutMax = mevsim.GetEtaCutMax();
486 fPhiCutMin = mevsim.GetPhiCutMin();
487 fPhiCutMax = mevsim.GetPhiCutMax();
488 fNStDevMult = mevsim.GetNStDevMult();
489 fNStDevTemp = mevsim.GetNStDevTemp();
490 fNStDevSigma =GetNStDevSigma();
491 fNStDevExpVel = mevsim.GetNStDevExpVel();
492 fNStdDevPSIr = mevsim.GetNStDevPSIr();
493 fNStDevVn = mevsim.GetNStDevVn();
494 fNStDevMultFac = mevsim.GetNStDevMultFac();
495 fNIntegPts = mevsim.GetNintegPts();
496 fNScanPts = mevsim.GetNScanPts();
497 firand = mevsim.firand;
498 fParticleTypeParameters = new TClonesArray("TMevSimPartTypeParams",mevsim.GetNPidTypes());
499 for (int i=0; i< mevsim.GetNPidTypes(); i++)
500 {
501 TMevSimPartTypeParams *temp = 0;
502 mevsim.GetPartTypeParamsByIndex(i,temp);
503 fParticleTypeParameters->AddLast(temp);
504 }
505 DefineParticles();
506 return (*this);
507}
508//______________________________________________________________________________
509void TMevSim::Initialize() {
510// TMevSim initialization: creates an input file for the FORTRAN
511// program MevSim. Converts all the event-wide information and particle
512// specific information to the format readable by MevSim and writes it
513// to disk in current directory.
514// Caution: At least one TMevSimPartTypeParams object must be created and
515// added to the collection before event generation can start.
516
517 TMevSimPartTypeParams * params = 0;
518
519
520 ofstream *file = new ofstream("mult_gen.in",ios::out | ios::trunc);
521 // Write out the parameters to the pramameter file
522 *file << " " << fNEvents << " ! Number of Events \n";
523 *file << " " << GetNPidTypes() << " \n";
524 *file << " " << fModelType << " \n";
525 *file << " " << fReacPlaneCntrl << " \n";
526 file->setf(ios::showpoint);
527 *file << " " << fPsiRMean << " " << fPsiRStDev << " \n";
528 *file << " " << fMultFacMean << " " << fMultFacStDev << " \n";
529 *file << " " << fPtCutMin << " " << fPtCutMax << " \n";
530 *file << " " << fEtaCutMin << " " << fEtaCutMax << " \n";
531 *file << " " << fPhiCutMin << " " << fPhiCutMax << " \n";
532 *file << " " << fNStDevMult << " \n";
533 *file << " " << fNStDevTemp << " \n";
534 *file << " " << fNStDevSigma << " \n";
535 *file << " " << fNStDevExpVel << " \n";
536 *file << " " << fNStdDevPSIr << " \n";
537 *file << " " << fNStDevVn << " \n";
538 *file << " " << fNStDevMultFac << " \n";
539 *file << " " << fNIntegPts << " \n";
540 *file << " " << fNScanPts << " \n";
541 *file << " " << firand << " \n";
542 // Write out particle specific information
543 for (Int_t i=0; i< (fParticleTypeParameters->GetLast() + 1); i++) {
544
545 params = (TMevSimPartTypeParams *) ((*fParticleTypeParameters)[i]);
546
547 *file << " " << params->GetGPid() << " ! Particle GEANT Pid \n";
548 *file << " " << params->GetMultMean() << " " << params->GetMultVarianceControl() << " \n";
549 *file << " " << params->GetTempMean() << " " << params->GetTempStDev() << " \n";
550 *file << " " << params->GetSigmaMean() << " " << params->GetSigmaStDev() << " \n";
551 *file << " " << params->GetExpVelMean() << " " << params->GetExpVelStDev() << " \n";
552
553 for (Int_t cnt1 = 0; cnt1 < NFLOWTERMS; cnt1++) {
554 *file << " ";
04504820 555 Int_t cnt2;
556 for (cnt2 = 0; cnt2 < 4; cnt2++) *file << params->GetVnMeanComponent(cnt1, cnt2) << " ";
1a2762e8 557 *file << " \n ";
04504820 558 for (cnt2 = 0; cnt2 < 4; cnt2++) *file << params->GetVnStDevComponent(cnt1, cnt2) << " ";
1a2762e8 559 *file << " \n";
560 }
561 }
562 file->close();
563
564}
565//______________________________________________________________________________
31d87da2 566void TMevSim::GenerateEvent() {
1a2762e8 567// Generates one MevSim event. TMevSim::Initialize() must be called prior
568// to calling this function.
569
31d87da2 570 Info("GenerateEvent","Calling FORTRAN multgen()");
1a2762e8 571 multgen();
572}
573
574//______________________________________________________________________________
96df9573 575Int_t TMevSim::ImportParticles(TClonesArray *particles, Option_t */*option*/)
1a2762e8 576{
577// Read in particles created by MevSim into the TClonesArray(). The Initialize()
578// and GenrateEvent() functions must be called prior to calling this funtion.
579// The particles are read from the COMMON POUT. Right now the only provided
580// information is Geant PID, 3 momentum components and the energy of the particle.
581
582 if (particles == 0) return 0;
31d87da2 583 TClonesArray &aParticles = *particles;
584 aParticles.Clear();
1a2762e8 585
586 Int_t totpart = 0;
587 for (Int_t nrpidtype=0; nrpidtype < (fParticleTypeParameters->GetLast() + 1); nrpidtype++) {
588 Int_t nrpart = 0;
589 Int_t pidcode = ((TMevSimPartTypeParams *) (*fParticleTypeParameters)[nrpidtype])->GetGPid();
590 while ((TRACK.pout[(4*nrpart+3)*NPID+nrpidtype] > 0.0) || (TRACK.pout[(4*nrpart)*NPID+nrpidtype] != 0.0)) {
591 int poffset = 4*nrpart*NPID+nrpidtype;
592 Float_t px = TRACK.pout[poffset];
593 poffset += NPID;
594 Float_t py = TRACK.pout[poffset];
595 poffset += NPID;
596 Float_t pz = TRACK.pout[poffset];
597 poffset += NPID;
598 Float_t mass = TRACK.pout[poffset];
31d87da2 599 new(aParticles[totpart+nrpart]) TParticle(
1a2762e8 600 PDGFromId(pidcode), // Get the PDG ID from GEANT ID
601 0,
602 0,
603 0,
604 0,
605 0,
606 px,
607 py,
608 pz,
609 sqrt(mass*mass+px*px+py*py+pz*pz),
610 0,
611 0,
612 0,
613 0);
614 nrpart++;
615 }
616 totpart += nrpart;
617 }
618 return totpart;
619}
620//______________________________________________________________________________
e8d2b601 621TObjArray * TMevSim::ImportParticles(Option_t */*option*/)
622{
623// Read in particles created by MevSim into the TClonesArray(). The Initialize()
624// and GenrateEvent() functions must be called prior to calling this funtion.
625// The particles are read from the COMMON POUT. Right now the only provided
626// information is Geant PID, 3 momentum components and the energy of the particle.
627
628 fParticles->Clear();
629
630 for (Int_t nrpidtype=0; nrpidtype < (fParticleTypeParameters->GetLast() + 1); nrpidtype++) {
631 Int_t nrpart = 0;
632 Int_t pidcode = ((TMevSimPartTypeParams *) (*fParticleTypeParameters)[nrpidtype])->GetGPid();
633 while ((TRACK.pout[(4*nrpart+3)*NPID+nrpidtype] > 0.0) || (TRACK.pout[(4*nrpart)*NPID+nrpidtype] != 0.0)) {
634 int poffset = 4*nrpart*NPID+nrpidtype;
635 Float_t px = TRACK.pout[poffset];
636 poffset += NPID;
637 Float_t py = TRACK.pout[poffset];
638 poffset += NPID;
639 Float_t pz = TRACK.pout[poffset];
640 poffset += NPID;
641 Float_t mass = TRACK.pout[poffset];
642 TParticle * p = new TParticle(
643 PDGFromId(pidcode), // Get the PDG ID from GEANT ID
644 0,
645 0,
646 0,
647 0,
648 0,
649 px,
650 py,
651 pz,
652 sqrt(mass*mass+px*px+py*py+pz*pz),
653 0,
654 0,
655 0,
656 0);
657 fParticles->Add(p);
658 nrpart++;
659 }
660 }
661 return fParticles;
662}
663//______________________________________________________________________________
1a2762e8 664void TMevSim::SetNEvents(Int_t nEvents ) {
665// Sets the number of events to be generated by MevSim.
666// Caution: Setting nEvents > 1 will have no effect, since only the last generated
667// event will be stored in POUT COMMON, and therefore only one event can be
668// accessible at a time.
669
670 fNEvents = nEvents;
671}
672//______________________________________________________________________________
673Int_t TMevSim::GetNEvents() const {
674 return fNEvents;
675}
676//______________________________________________________________________________
677Int_t TMevSim::GetNPidTypes() const {
678 return fParticleTypeParameters->GetLast()+1;
679}
680//______________________________________________________________________________
681void TMevSim::SetModelType(Int_t modelType) {
682 fModelType = modelType;
683}
684//______________________________________________________________________________
685Int_t TMevSim::GetModelType() const {
686 return fModelType;
687}
688//______________________________________________________________________________
689void TMevSim::SetReacPlaneCntrl(Int_t reacPlaneCntrl) {
690 fReacPlaneCntrl = reacPlaneCntrl;
691}
692//______________________________________________________________________________
693Int_t TMevSim::GetReacPlaneCntrl() const {
694 return fReacPlaneCntrl;
695}
696//______________________________________________________________________________
697void TMevSim::SetPsiRParams(Float_t psiRMean, Float_t psiRStDev) {
698 fPsiRMean = psiRMean;
699 fPsiRStDev = psiRStDev;
700}
701//______________________________________________________________________________
702Float_t TMevSim::GetPsiRMean() const {
703 return fPsiRMean;
704}
705//______________________________________________________________________________
706Float_t TMevSim::GetPsiRStDev() const {
707 return fPsiRStDev;
708}
709//______________________________________________________________________________
710void TMevSim::SetMultFacParams(Float_t multFacMean, Float_t multFacStDev) {
711 fMultFacMean = multFacMean;
712 fMultFacStDev = multFacStDev;
713}
714//______________________________________________________________________________
715Float_t TMevSim::GetMultFacMean() const {
716 return fMultFacMean;
717}
718//______________________________________________________________________________
719Float_t TMevSim::GetMultFacStDev() const {
720 return fMultFacStDev;
721}
722//______________________________________________________________________________
723void TMevSim::SetPtCutRange(Float_t ptCutMin, Float_t ptCutMax) {
724 fPtCutMin = ptCutMin;
725 fPtCutMax = ptCutMax;
726}
727//______________________________________________________________________________
728Float_t TMevSim::GetPtCutMin() const {
729 return fPtCutMin;
730}
731//______________________________________________________________________________
732Float_t TMevSim::GetPtCutMax() const {
733 return fPtCutMax;
734}
735//______________________________________________________________________________
736void TMevSim::SetEtaCutRange(Float_t etaCutMin, Float_t etaCutMax) { fEtaCutMin = etaCutMin;
737 fEtaCutMax = etaCutMax;
738}
739
740//______________________________________________________________________________
741 Float_t TMevSim::GetEtaCutMin() const {
742 return fEtaCutMin;
743}
744//______________________________________________________________________________
745 Float_t TMevSim::GetEtaCutMax() const {
746 return fEtaCutMax;
747}
748//______________________________________________________________________________
749void TMevSim::SetPhiCutRange(Float_t phiCutMin, Float_t phiCutMax) {
750 fPhiCutMin = phiCutMin;
751 fPhiCutMax = phiCutMax;
752}
753//______________________________________________________________________________
754Float_t TMevSim::GetPhiCutMin() const {
755 return fPhiCutMin;
756}
757//______________________________________________________________________________
758Float_t TMevSim::GetPhiCutMax() const {
759 return fPhiCutMax;
760}
761//______________________________________________________________________________
762void TMevSim::SetNStDevMult(Float_t nStDevMult) {
763 fNStDevMult = nStDevMult;
764}
765//______________________________________________________________________________
766Float_t TMevSim::GetNStDevMult() const {
767 return fNStDevMult;
768}
769//______________________________________________________________________________
770void TMevSim::SetNStDevTemp(Float_t nStDevTemp) {
771 fNStDevTemp = nStDevTemp;
772}
773//______________________________________________________________________________
774Float_t TMevSim::GetNStDevTemp() const {
775 return fNStDevTemp;
776}
777//______________________________________________________________________________
778void TMevSim::SetNStDevSigma(Float_t nStDevSigma) {
779 fNStDevSigma = nStDevSigma;
780}
781//______________________________________________________________________________
782Float_t TMevSim::GetNStDevSigma() const {
783 return fNStDevSigma;
784}
785//______________________________________________________________________________
786void TMevSim::SetNStDevExpVel(Float_t nStDevExpVel) {
787 fNStDevExpVel = nStDevExpVel;
788}
789//______________________________________________________________________________
790Float_t TMevSim::GetNStDevExpVel() const {
791 return fNStDevExpVel;
792}
793//______________________________________________________________________________
794void TMevSim::SetNStDevPSIr(Float_t nStDevPSIr) {
795 fNStdDevPSIr = nStDevPSIr;
796}
797//______________________________________________________________________________
798Float_t TMevSim::GetNStDevPSIr() const {
799 return fNStdDevPSIr;
800}
801//______________________________________________________________________________
802void TMevSim::SetNStDevVn(Float_t nStDevVn) {
803 fNStDevVn = nStDevVn;
804}
805//______________________________________________________________________________
806Float_t TMevSim::GetNStDevVn() const {
807 return fNStDevVn;
808}
809//______________________________________________________________________________
810void TMevSim::SetNStDevMultFac(Float_t nStDevMultFac) {
811 fNStDevMultFac = nStDevMultFac;
812}
813//______________________________________________________________________________
814Float_t TMevSim::GetNStDevMultFac() const {
815 return fNStDevMultFac;
816}
817//______________________________________________________________________________
818void TMevSim::SetNIntegPts(Int_t nIntegPts) {
819 fNIntegPts = nIntegPts;
820}
821//______________________________________________________________________________
822Int_t TMevSim::GetNintegPts() const {
823 return fNIntegPts;
824}
825//______________________________________________________________________________
826void TMevSim::SetNScanPts(Int_t nScanPts) {
827 fNScanPts = nScanPts;
828}
829//______________________________________________________________________________
830Int_t TMevSim::GetNScanPts() const {
831 return fNScanPts;
832}
833//______________________________________________________________________________
834void TMevSim::AddPartTypeParams(TMevSimPartTypeParams *params) {
835// Add the particle specied parameters and the end of the list.
836
837 //cout << params << " " << fParticleTypeParameters << endl;
838
839 //fParticleTypeParameters->Dump();
840 params->Dump();
841
842 Int_t last = fParticleTypeParameters->GetLast();
843 new ((*fParticleTypeParameters)[last+1]) TMevSimPartTypeParams(*params);
844}
845//______________________________________________________________________________
846void TMevSim::SetPartTypeParams(Int_t index, TMevSimPartTypeParams *params)
847{
848// Create the new copy particle species parameters provided by params, and store
849// them in the position designated by index.
850
851 *((TMevSimPartTypeParams *) ((*fParticleTypeParameters)[index])) = *params;
852}
853//______________________________________________________________________________
31d87da2 854void TMevSim::GetPartTypeParamsByIndex(Int_t index, TMevSimPartTypeParams *params) const
1a2762e8 855{
856// Return the particle parameters stored in the list at the postion index.
857// Returns NULL if index is out of bounds.
858
859 if ((index < fParticleTypeParameters->GetLast()) && (index >= 0))
860 params = (TMevSimPartTypeParams *) (*fParticleTypeParameters)[index];
861 else
862 params = NULL;
863}
864//______________________________________________________________________________
31d87da2 865void TMevSim::GetPartTypeParamsByGPid(Int_t gpid, TMevSimPartTypeParams *params) const
1a2762e8 866{
867// Return the particle parameters for the particle with Geant PID gpid.
868// Returns NULL if the parameters for such particle do not exist in the list.
869
870 Int_t i = -1;
871
872 while (++i <= fParticleTypeParameters->GetLast())
873 {
874 if (((TMevSimPartTypeParams *) (*fParticleTypeParameters)[i])->GetGPid() == gpid)
875 {
876 params = (TMevSimPartTypeParams *) (*fParticleTypeParameters)[i];
877 return;
878 }
879 }
880 params = NULL;
881 return;
882}
883//_____________________________________________________________________________
884Int_t TMevSim::PDGFromId(Int_t id) const
885{
886 //
887 // Return PDG code and pseudo ENDF code from Geant3 code
888 //
889 if(id>0 && id<fNPDGCodes) return fPDGCode[id];
890 else return -1;
891}
892//_____________________________________________________________________________
893void TMevSim::DefineParticles()
894{
895 //
896 // Load standard numbers for GEANT particles and PDG conversion
897 fPDGCode[fNPDGCodes++]=-99; // 0 = unused location
898 fPDGCode[fNPDGCodes++]=22; // 1 = photon
899 fPDGCode[fNPDGCodes++]=-11; // 2 = positron
900 fPDGCode[fNPDGCodes++]=11; // 3 = electron
901 fPDGCode[fNPDGCodes++]=12; // 4 = neutrino e
902 fPDGCode[fNPDGCodes++]=-13; // 5 = muon +
903 fPDGCode[fNPDGCodes++]=13; // 6 = muon -
904 fPDGCode[fNPDGCodes++]=111; // 7 = pi0
905 fPDGCode[fNPDGCodes++]=211; // 8 = pi+
906 fPDGCode[fNPDGCodes++]=-211; // 9 = pi-
907 fPDGCode[fNPDGCodes++]=130; // 10 = Kaon Long
908 fPDGCode[fNPDGCodes++]=321; // 11 = Kaon +
909 fPDGCode[fNPDGCodes++]=-321; // 12 = Kaon -
910 fPDGCode[fNPDGCodes++]=2112; // 13 = Neutron
911 fPDGCode[fNPDGCodes++]=2212; // 14 = Proton
912 fPDGCode[fNPDGCodes++]=-2212; // 15 = Anti Proton
913 fPDGCode[fNPDGCodes++]=310; // 16 = Kaon Short
914 fPDGCode[fNPDGCodes++]=221; // 17 = Eta
915 fPDGCode[fNPDGCodes++]=3122; // 18 = Lambda
916 fPDGCode[fNPDGCodes++]=3222; // 19 = Sigma +
917 fPDGCode[fNPDGCodes++]=3212; // 20 = Sigma 0
918 fPDGCode[fNPDGCodes++]=3112; // 21 = Sigma -
919 fPDGCode[fNPDGCodes++]=3322; // 22 = Xi0
920 fPDGCode[fNPDGCodes++]=3312; // 23 = Xi-
921 fPDGCode[fNPDGCodes++]=3334; // 24 = Omega-
922 fPDGCode[fNPDGCodes++]=-2112; // 25 = Anti Proton
923 fPDGCode[fNPDGCodes++]=-3122; // 26 = Anti Proton
924 fPDGCode[fNPDGCodes++]=-3222; // 27 = Anti Sigma -
925 fPDGCode[fNPDGCodes++]=-3212; // 28 = Anti Sigma 0
926 fPDGCode[fNPDGCodes++]=-3112; // 29 = Anti Sigma 0
927 fPDGCode[fNPDGCodes++]=-3322; // 30 = Anti Xi 0
928 fPDGCode[fNPDGCodes++]=-3312; // 31 = Anti Xi +
929 fPDGCode[fNPDGCodes++]=-3334; // 32 = Anti Omega +
930}
931