Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4SimpleEventGenerator.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4SimpleEventGenerator.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef G4MAIN_PHG4SIMPLEEVENTGENERATOR_H
4 #define G4MAIN_PHG4SIMPLEEVENTGENERATOR_H
5 
7 
8 #include <cmath>
9 #include <map>
10 #include <string> // for string
11 #include <utility> // for pair
12 #include <vector>
13 
14 class PHG4InEvent;
15 class PHCompositeNode;
16 
18 {
19  public:
21  enum FUNCTION
22  {
25  };
26 
27  PHG4SimpleEventGenerator(const std::string &name = "EVTGENERATOR");
29 
30  int InitRun(PHCompositeNode *topNode) override;
31  int process_event(PHCompositeNode *topNode) override;
32 
34  void add_particles(const std::string &name, const unsigned int count);
35 
37  void add_particles(const int pid, const unsigned int count);
38 
40  void set_eta_range(const double eta_min, const double eta_max);
41 
43  void set_theta_range(const double theta_min, const double theta_max);
44 
46  void set_phi_range(const double phi_min, const double phi_max);
47 
49  void set_power_law_n(const double n);
50 
53  void set_pt_range(const double pt_min, const double pt_max, const double pt_gaus_width = 0);
54 
57  void set_p_range(const double p_min, const double p_max, const double p_gaus_width = 0);
58 
61 
63  void set_vertex_distribution_mean(const double x, const double y, const double z);
64 
66  void set_vertex_distribution_width(const double x, const double y, const double z);
67 
69  void set_existing_vertex_offset_vector(const double x, const double y, const double z);
70 
73 
75  void set_vertex_size_parameters(const double mean, const double width);
76 
77  private:
78  double smearvtx(const double position, const double width, FUNCTION dist) const;
79 
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  // so we can print out the function names without many if's
85  // also used to check if function is implemented
86  std::map<FUNCTION, std::string> m_FunctionNames = {{Uniform, "Uniform"}, {Gaus, "Gaus"}};
87 
88  PHG4InEvent *m_InEvent = nullptr;
92  double m_Vertex_x = 0.;
93  double m_Vertex_y = 0.;
94  double m_Vertex_z = 0.;
95  double m_VertexWidth_x = 0.;
96  double m_VertexWidth_y = 0.;
97  double m_VertexWidth_z = 0.;
98  double m_VertexOffset_x = 0.;
99  double m_VertexOffset_y = 0.;
100  double m_VertexOffset_z = 0.;
102  double m_VertexSizeMean = 0.;
103  double m_VertexSizeWidth = 0.;
104  double m_EtaMin = -1.25;
105  double m_EtaMax = 1.25;
106  double m_ThetaMin = NAN;
107  double m_ThetaMax = NAN;
108  double m_PhiMin = -M_PI;
109  double m_PhiMax = M_PI;
110  double m_Pt_Min = 0.;
111  double m_Pt_Max = 10.;
112  double m_Pt_GausWidth = 0.;
113  double m_P_Min = NAN;
114  double m_P_Max = NAN;
115  double m_P_GausWidth = NAN;
116  double m_powerLawN = NAN;
117 };
118 
119 #endif