EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHHepMCGenHelper.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHHepMCGenHelper.h
1 // $Id: $
2 
11 #ifndef PHHEPMC_PHHEPMCGENHELPER_H
12 #define PHHEPMC_PHHEPMCGENHELPER_H
13 
14 #include <CLHEP/Vector/ThreeVector.h>
15 
16 #include <gsl/gsl_rng.h>
17 
18 #include <cmath>
19 #include <string>
20 #include <utility>
21 #include <vector>
22 
23 class PHCompositeNode;
24 class PHHepMCGenEvent;
25 class PHHepMCGenEventMap;
26 
27 namespace HepMC
28 {
29  class GenEvent;
30 }
31 
36 {
37  public:
39  virtual ~PHHepMCGenHelper();
40 
42  enum VTXFUNC
43  {
48  };
49 
52 
54  void set_vertex_distribution_mean(const double x, const double y, const double z, const double t);
55 
57  void set_vertex_distribution_width(const double x, const double y, const double z, const double t);
58 
63  int get_embedding_id() const { return _embedding_id; }
64  //
69  void set_embedding_id(int id) { _embedding_id = id; }
70  //
72  void set_reuse_vertex(int src_embedding_id)
73  {
74  _reuse_vertex = true;
75  _reuse_vertex_embedding_id = src_embedding_id;
76  }
77 
78  //
80  virtual int create_node_tree(PHCompositeNode *topNode);
81 
84 
86  PHHepMCGenEvent *insert_event(HepMC::GenEvent *evt);
87 
89  {
90  return _geneventmap;
91  }
92 
94  {
95  return _geneventmap;
96  }
97 
99  {
100  return RandomGenerator;
101  }
102 
104  {
105  _geneventmap = geneventmap;
106  }
107 
114  const double beamA_theta,
115  const double beamA_phi,
116  const double beamB_theta,
117  const double beamB_phi)
118  {
119  m_beam_direction_theta_phi = {{beamA_theta, beamA_phi}, {beamB_theta, beamB_phi}};
120  }
121 
128  const double beamA_divergence_h,
129  const double beamA_divergence_v,
130  const double beamB_divergence_h,
131  const double beamB_divergence_v)
132  {
133  m_beam_angular_divergence_hv = {{beamA_divergence_h, beamA_divergence_v}, {beamB_divergence_h, beamB_divergence_v}};
134  }
135 
143  const double beamA_h,
144  const double beamA_v,
145  const double beamB_h,
146  const double beamB_v)
147  {
148  m_beam_angular_z_coefficient_hv = {{beamA_h, beamA_v}, {beamB_h, beamB_v}};
149  }
150 
153 
157  void set_beam_bunch_width(const std::vector<double> &beamA, const std::vector<double> &beamB);
158 
159  void CopySettings(PHHepMCGenHelper &helper);
160 
162  void CopySettings(PHHepMCGenHelper *helper_dest);
163 
165  void CopyHelperSettings(PHHepMCGenHelper *helper_src);
166 
167  void Print(const std::string &what = "ALL") const;
168 
170 
172 
173  protected:
176 
179 
184 
185  private:
186  gsl_rng *RandomGenerator;
187 
188  double smear(const double position, const double width, VTXFUNC dist) const;
189 
191  static CLHEP::Hep3Vector pair2Hep3Vector(const std::pair<double, double> &theta_phi);
192 
197 
198  double _vertex_x;
199  double _vertex_y;
200  double _vertex_z;
201  double _vertex_t;
202 
207 
211  std::pair<std::pair<double, double>, std::pair<double, double>> m_beam_direction_theta_phi = {
212  {0, 0}, //+z beam
213  {M_PI, 0} //-z beam
214  };
215 
219  std::pair<std::pair<double, double>, std::pair<double, double>> m_beam_angular_divergence_hv = {
220  {0, 0}, //+z beam
221  {0, 0} //-z beam
222  };
223 
228  std::pair<std::pair<double, double>, std::pair<double, double>> m_beam_angular_z_coefficient_hv = {
229  {0, 0}, //+z beam
230  {0, 0} //-z beam
231  };
232 
237 
240 
243 
246 
248  int m_verbosity = 0;
249 
251  bool m_use_beam_bunch_sim = false;
252 
256  std::pair<std::vector<double>, std::vector<double>> m_beam_bunch_width = {
257  {0, 0, 0}, //+z beam
258  {0, 0, 0} //-z beam
259  };
260 
263  double get_collision_width(unsigned int hv_index);
264 
265 };
266 
267 #endif /* PHHEPMC_PHHEPMCGENHELPER_H */