Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:21:59

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef G4MAIN_PHG4PARTICLEGENERATORVECTORMESON_H
0004 #define G4MAIN_PHG4PARTICLEGENERATORVECTORMESON_H
0005 
0006 #include "PHG4ParticleGeneratorBase.h"
0007 
0008 #include <cmath>
0009 #include <limits>
0010 #include <map>
0011 #include <string>  // for string
0012 
0013 class PHCompositeNode;
0014 class PHG4InEvent;
0015 class TRandom;
0016 class TF1;
0017 
0018 class PHG4ParticleGeneratorVectorMeson : public PHG4ParticleGeneratorBase
0019 {
0020  public:
0021   //! supported function distributions
0022   enum FUNCTION
0023   {
0024     Uniform,
0025     Gaus
0026   };
0027 
0028   explicit PHG4ParticleGeneratorVectorMeson(const std::string &name = "VMESON");
0029   ~PHG4ParticleGeneratorVectorMeson() override;
0030 
0031   int InitRun(PHCompositeNode *topNode) override;
0032   int process_event(PHCompositeNode *topNode) override;
0033 
0034   //! interface for adding particles by name
0035   void add_decay_particles(const std::string &name1, const std::string &name2, const unsigned int decay_id);
0036   void add_decay_particles(const std::string &name, const unsigned int decay_id);
0037 
0038   void set_decay_vertex_offset(double dx, double dy, double dz, const unsigned int decay_id);
0039   void set_eta_range(const double eta_min, const double eta_max);
0040   void set_rapidity_range(const double y_min, const double y_max);
0041   void set_mom_range(const double mom_min, const double mom_max);
0042   void set_pt_range(const double pt_min, const double pt_max);
0043   //! toss a new vertex according to a Uniform or Gaus distribution
0044   void set_vertex_distribution_function(FUNCTION x, FUNCTION y, FUNCTION z);
0045 
0046   //! set the mean value of the vertex distribution
0047   void set_vertex_distribution_mean(const double x, const double y, const double z);
0048 
0049   //! set the width of the vertex distribution function about the mean
0050   void set_vertex_distribution_width(const double x, const double y, const double z);
0051 
0052   //! set an offset vector from the existing vertex
0053   void set_existing_vertex_offset_vector(const double x, const double y, const double z);
0054 
0055   //! set the distribution function of particles about the vertex
0056   void set_vertex_size_function(FUNCTION r);
0057 
0058   //! set the dimensions of the distribution of particles about the vertex
0059   void set_vertex_size_parameters(const double mean, const double width);
0060 
0061   void set_read_vtx_from_hepmc(bool read_vtx) { read_vtx_from_hepmc = read_vtx; }
0062 
0063   void set_mass(const double mass_in) { mass = mass_in; }
0064   void set_width(const double width_in) { m_Width = width_in; }
0065   void set_decay_types(const std::string &name1, const std::string &name2);
0066   void set_histrand_init(const int initflag) { _histrand_init = initflag; }
0067   void set_upsilon_1s();
0068   void set_upsilon_2s();
0069   void set_upsilon_3s();
0070 
0071  private:
0072   double smearvtx(const double position, const double width, FUNCTION dist) const;
0073   std::map<unsigned int, int> decay1_codes;          // <pdgcode, count>
0074   std::map<unsigned int, std::string> decay1_names;  // <names, count>
0075   std::map<unsigned int, int> decay2_codes;          // <pdgcode, count>
0076   std::map<unsigned int, std::string> decay2_names;  // <names, count>
0077   std::map<unsigned int, double> decay_vtx_offset_x;
0078   std::map<unsigned int, double> decay_vtx_offset_y;
0079   std::map<unsigned int, double> decay_vtx_offset_z;
0080 
0081   FUNCTION _vertex_func_x = Uniform;
0082   FUNCTION _vertex_func_y = Uniform;
0083   FUNCTION _vertex_func_z = Uniform;
0084   double _vertex_x = 0.;         // primary vertex (or mean) x component, cf. vtx_x = track-by-track vertex x component
0085   double _vertex_y = 0.;         // primary vertex (or mean) y component, cf. vtx_y = track-by-track vertex y component
0086   double _vertex_z = 0.;         // primary vertex (or mean)z component, cf. vtx_z = track-by-track vertex z component
0087   double _vertex_width_x = 0.;   // sigma x if not use existing vtx
0088   double _vertex_width_y = 0.;   // sigma y if not use existing vtx
0089   double _vertex_width_z = 0.;   // sigma z if not use existing vtx
0090   double _vertex_offset_x = 0.;  // track-by-track decay vertex offset if use existing vtx
0091   double _vertex_offset_y = 0.;  // track-by-track decay vertex offset if use existing vtx
0092   double _vertex_offset_z = 0.;  // track-by-track decay vertex offset if use existing vtx
0093   FUNCTION _vertex_size_func_r = Uniform;
0094   double _vertex_size_mean = 0.;
0095   double _vertex_size_width = 0.;
0096   bool read_vtx_from_hepmc = true;
0097 
0098   double y_min = 0.;
0099   double y_max = 0.;
0100   double eta_min = -1.;
0101   double eta_max = 1.;
0102   double mom_min = 0.;
0103   double mom_max = 10.;
0104   double pt_min = 4.;
0105   double pt_max = 4.;
0106   double mass = std::numeric_limits<double>::quiet_NaN();
0107   double m_Width = std::numeric_limits<double>::quiet_NaN();
0108   double m1 = std::numeric_limits<double>::quiet_NaN();
0109   double m2 = std::numeric_limits<double>::quiet_NaN();
0110   int _histrand_init = 0;
0111   std::string decay1 = "e+";
0112   std::string decay2 = "e-";
0113 
0114   TF1 *fsin = nullptr;
0115   TF1 *frap = nullptr;
0116   TF1 *fpt = nullptr;
0117   TRandom *trand = nullptr;
0118 
0119   PHG4InEvent *ineve = nullptr;
0120 };
0121 
0122 #endif