22 #include <HepMC/GenEvent.h>
23 #include <HepMC/IO_GenEvent.h>
25 #include <gsl/gsl_const.h>
26 #include <gsl/gsl_randist.h>
27 #include <gsl/gsl_rng.h>
36 : _vertex_func_x(Gaus)
37 , _vertex_func_y(Gaus)
38 , _vertex_func_z(Gaus)
39 , _vertex_func_t(Gaus)
49 , _reuse_vertex(false)
50 , _reuse_vertex_embedding_id(numeric_limits<int>::min())
51 , _geneventmap(nullptr)
71 cout <<
PHWHERE <<
"DST Node missing doing nothing" << endl;
75 _geneventmap = findNode::getClass<PHHepMCGenEventMap>(dstNode,
"PHHepMCGenEventMap");
80 dstNode->addNode(newmapnode);
106 assert(_vertex_width_x >= 0);
110 assert(_geneventmap);
113 _geneventmap->
get(_reuse_vertex_embedding_id);
117 cout <<
"PHHepMCGenHelper::move_vertex - Fatal Error - the requested source subevent with embedding ID "
118 << _reuse_vertex_embedding_id <<
" does not exist. Current HepMCEventMap:";
131 (
smear(_vertex_x, _vertex_width_x, _vertex_func_x)),
132 (
smear(_vertex_y, _vertex_width_y, _vertex_func_y)),
133 (
smear(_vertex_z, _vertex_width_z, _vertex_func_z)),
134 (
smear(_vertex_t, _vertex_width_t, _vertex_func_t)));
170 double res = position;
177 res = (position - width) + 2 * gsl_rng_uniform_pos(
RandomGenerator) * width;
179 else if (dist ==
Gaus)
185 cout <<
"PHHepMCGenHelper::smear - FATAL Error - unknown vertex function " << dist << endl;
PHHepMCGenEventMap is collection of HEPMC events input into this simulation map of embedding ID -> PH...
PHNode * findFirst(const std::string &, const std::string &)
uniform distribution with half width set via set_vertex_distribution_width()
bool addEvent(HepMC::GenEvent *evt)
host an HepMC event
virtual void moveVertex(double x, double y, double z, double t=0)
move the collision vertex position in the Hall coordinate system, use PHENIX units of cm...
PHHepMCGenEvent * insert_event(HepMC::GenEvent *evt)
send HepMC::GenEvent to DST tree. This function takes ownership of evt
const PHHepMCGenEvent * get(int idkey) const
fetch event
gsl_rng * RandomGenerator
const HepMC::FourVector & get_collision_vertex() const
collision vertex position in the Hall coordinate system, use PHENIX units of cm, ns ...
void set_vertex_distribution_mean(const double x, const double y, const double z, const double t)
set the mean value of the vertex distribution, use PHENIX units of cm, ns
void set_vertex_distribution_function(VTXFUNC x, VTXFUNC y, VTXFUNC z, VTXFUNC t)
toss a new vertex according to a Uniform or Gaus distribution
void move_vertex(PHHepMCGenEvent *genevent)
move vertex according to vertex settings
void identify(std::ostream &os=std::cout) const
PHHepMCGenEvent * insert_event(const int embedding_id, const PHHepMCGenEvent *event=nullptr)
insert a event with specific embedding ID
void set_vertex_distribution_width(const double x, const double y, const double z, const double t)
set the width of the vertex distribution function about the mean, use PHENIX units of cm...
VTXFUNC
supported function distributions
normal distribution with sigma width set via set_vertex_distribution_width()
int create_node_tree(PHCompositeNode *topNode)
init interface nodes
double smear(const double position, const double width, VTXFUNC dist) const
virtual ~PHHepMCGenHelper()