Class Reference for E1039 Core & Analysis Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PHG4SimpleEventGenerator.h
Go to the documentation of this file.
1 #ifndef PHG4SimpleEventGenerator_H__
2 #define PHG4SimpleEventGenerator_H__
3 
5 
6 #include <map>
7 #include <vector>
8 
9 #include <TGeoManager.h>
10 #include <phgeom/PHGeomUtility.h>
11 
12 class PHG4InEvent;
13 class PHCompositeNode;
14 
16 
17 public:
18 
21 
22  PHG4SimpleEventGenerator(const std::string &name="EVTGENERATOR");
24 
25  int InitRun(PHCompositeNode *topNode);
26  int process_event(PHCompositeNode *topNode);
27 
29  void add_particles(const std::string &name, const unsigned int count);
30 
32  void add_particles(const int pid, const unsigned int count);
33 
35  void set_t0(const double t0);
36 
38  void set_eta_range(const double eta_min, const double eta_max);
39 
41  void set_phi_range(const double phi_min, const double phi_max);
42 
45  void set_pt_range(const double pt_min, const double pt_max, const double pt_gaus_width = 0);
46 
49  void set_p_range(const double p_min, const double p_max, const double p_gaus_width = 0);
50 
53 
55  void set_vertex_distribution_mean(const double x, const double y, const double z);
56 
58  void set_vertex_distribution_width(const double x, const double y, const double z);
59 
61  void set_existing_vertex_offset_vector(const double x, const double y, const double z);
62 
65 
67  void set_vertex_size_parameters(const double mean, const double width);
68 
70  void set_pxpypz_range(
71  const double x_min, const double x_max,
72  const double y_min, const double y_max,
73  const double z_min, const double z_max
74  );
75 
76 
77 private:
78 
79  double smearvtx(const double position, const double width, FUNCTION dist) const;
80  // these need to be stored separately until run time when the names
81  // can be translated using the GEANT4 lookup
82  std::vector<std::pair<int, unsigned int> > _particle_codes; // <pdgcode, count>
83  std::vector<std::pair<std::string, unsigned int> > _particle_names; // <names, count>
84  FUNCTION _vertex_func_x;
85  FUNCTION _vertex_func_y;
86  FUNCTION _vertex_func_z;
87  double _t0;
88  double _vertex_x;
89  double _vertex_y;
90  double _vertex_z;
91  double _vertex_width_x;
92  double _vertex_width_y;
93  double _vertex_width_z;
94  double _vertex_offset_x;
95  double _vertex_offset_y;
96  double _vertex_offset_z;
97  FUNCTION _vertex_size_func_r;
98  double _vertex_size_mean;
99  double _vertex_size_width;
100  double _eta_min;
101  double _eta_max;
102  double _phi_min;
103  double _phi_max;
104  double _pt_min;
105  double _pt_max;
106  double _pt_gaus_width;
107  double _p_min;
108  double _p_max;
109  double _p_gaus_width;
110 
111  double _px_min, _px_max;
112  double _py_min, _py_max;
113  double _pz_min, _pz_max;
114 
115  PHG4InEvent* _ineve;
116 };
117 
118 #endif
void set_t0(const double t0)
set the starting time for the event
void add_particles(const std::string &name, const unsigned int count)
interface for adding particles by name
int InitRun(PHCompositeNode *topNode)
PHG4SimpleEventGenerator(const std::string &name="EVTGENERATOR")
FUNCTION
supported function distributions
void set_vertex_distribution_function(FUNCTION x, FUNCTION y, FUNCTION z)
toss a new vertex according to a Uniform or Gaus distribution
int process_event(PHCompositeNode *topNode)
void set_vertex_distribution_mean(const double x, const double y, const double z)
set the mean value of the vertex distribution
void set_vertex_distribution_width(const double x, const double y, const double z)
set the width of the vertex distribution function about the mean
void set_vertex_size_parameters(const double mean, const double width)
set the dimensions of the distribution of particles about the vertex
void set_vertex_size_function(FUNCTION r)
set the distribution function of particles about the vertex
void set_existing_vertex_offset_vector(const double x, const double y, const double z)
set an offset vector from the existing vertex
void set_eta_range(const double eta_min, const double eta_max)
range of randomized eta values
void set_p_range(const double p_min, const double p_max, const double p_gaus_width=0)
void set_pt_range(const double pt_min, const double pt_max, const double pt_gaus_width=0)
void set_pxpypz_range(const double x_min, const double x_max, const double y_min, const double y_max, const double z_min, const double z_max)
void set_phi_range(const double phi_min, const double phi_max)
range of randomized phi values