File indexing completed on 2025-08-05 08:18:11
0001
0002
0003 #ifndef G4MAIN_PHG4SIMPLEEVENTGENERATOR_H
0004 #define G4MAIN_PHG4SIMPLEEVENTGENERATOR_H
0005
0006 #include "PHG4ParticleGeneratorBase.h"
0007
0008 #include <cmath>
0009 #include <map>
0010 #include <string> // for string
0011 #include <utility> // for pair
0012 #include <vector>
0013
0014 class PHG4InEvent;
0015 class PHCompositeNode;
0016
0017 class PHG4SimpleEventGenerator : public PHG4ParticleGeneratorBase
0018 {
0019 public:
0020
0021 enum FUNCTION
0022 {
0023 Uniform,
0024 Gaus
0025 };
0026
0027 PHG4SimpleEventGenerator(const std::string &name = "EVTGENERATOR");
0028 ~PHG4SimpleEventGenerator() override {}
0029
0030 int InitRun(PHCompositeNode *topNode) override;
0031 int process_event(PHCompositeNode *topNode) override;
0032
0033
0034 void add_particles(const std::string &name, const unsigned int count);
0035
0036
0037 void add_particles(const int pid, const unsigned int count);
0038
0039
0040 void set_eta_range(const double eta_min, const double eta_max);
0041
0042
0043 void set_theta_range(const double theta_min, const double theta_max);
0044
0045
0046 void set_phi_range(const double phi_min, const double phi_max);
0047
0048
0049 void set_power_law_n(const double n);
0050
0051
0052
0053 void set_pt_range(const double pt_min, const double pt_max, const double pt_gaus_width = 0);
0054
0055
0056
0057 void set_p_range(const double p_min, const double p_max, const double p_gaus_width = 0);
0058
0059
0060 void set_vertex_distribution_function(FUNCTION x, FUNCTION y, FUNCTION z);
0061
0062
0063 void set_vertex_distribution_mean(const double x, const double y, const double z);
0064
0065
0066 void set_vertex_distribution_width(const double x, const double y, const double z);
0067
0068
0069 void set_existing_vertex_offset_vector(const double x, const double y, const double z);
0070
0071
0072 void set_vertex_size_function(FUNCTION r) { m_VertexSizeFunc_r = r; }
0073
0074
0075 void set_vertex_size_parameters(const double mean, const double width);
0076
0077 private:
0078 double smearvtx(const double position, const double width, FUNCTION dist) const;
0079
0080
0081
0082 std::vector<std::pair<int, unsigned int> > _particle_codes;
0083 std::vector<std::pair<std::string, unsigned int> > _particle_names;
0084
0085
0086 std::map<FUNCTION, std::string> m_FunctionNames = {{Uniform, "Uniform"}, {Gaus, "Gaus"}};
0087
0088 PHG4InEvent *m_InEvent = nullptr;
0089 FUNCTION m_VertexFunc_x = Uniform;
0090 FUNCTION m_VertexFunc_y = Uniform;
0091 FUNCTION m_VertexFunc_z = Uniform;
0092 double m_Vertex_x = 0.;
0093 double m_Vertex_y = 0.;
0094 double m_Vertex_z = 0.;
0095 double m_VertexWidth_x = 0.;
0096 double m_VertexWidth_y = 0.;
0097 double m_VertexWidth_z = 0.;
0098 double m_VertexOffset_x = 0.;
0099 double m_VertexOffset_y = 0.;
0100 double m_VertexOffset_z = 0.;
0101 FUNCTION m_VertexSizeFunc_r = Uniform;
0102 double m_VertexSizeMean = 0.;
0103 double m_VertexSizeWidth = 0.;
0104 double m_EtaMin = -1.25;
0105 double m_EtaMax = 1.25;
0106 double m_ThetaMin = NAN;
0107 double m_ThetaMax = NAN;
0108 double m_PhiMin = -M_PI;
0109 double m_PhiMax = M_PI;
0110 double m_Pt_Min = 0.;
0111 double m_Pt_Max = 10.;
0112 double m_Pt_GausWidth = 0.;
0113 double m_P_Min = NAN;
0114 double m_P_Max = NAN;
0115 double m_P_GausWidth = NAN;
0116 double m_powerLawN = NAN;
0117 };
0118
0119 #endif