Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:18:09

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