14 #pragma GCC diagnostic push
15 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
16 #include <HepMC/GenEvent.h>
17 #include <HepMC/GenParticle.h>
18 #include <HepMC/GenVertex.h>
19 #include <HepMC/SimpleVector.h>
20 #include <HepMC/HeavyIon.h>
21 #pragma GCC diagnostic pop
29 RandomGenerator = gsl_rng_alloc(gsl_rng_mt19937);
35 gsl_rng_free(RandomGenerator);
50 PHHepMCGenEventMap *genevtmap = findNode::getClass<PHHepMCGenEventMap>(topNode,
"PHHepMCGenEventMap");
51 for (
auto & iter : *genevtmap)
54 HepMC::GenEvent *evt = genevt->
getEvent();
56 HepMC::HeavyIon *hi = evt->heavy_ion();
59 double psi = hi->event_plane_angle();
61 std::cout <<
"ReactionPlaneAfterburner::process_event(PHCompositeNode *topNode) psi = " << psi << std::endl;
62 std::cout<<
"non-zero psi found, skipping"<<std::endl;
65 psi = gsl_rng_uniform_pos(RandomGenerator) * 2 * M_PI;
66 hi->set_event_plane_angle(psi);
68 for (HepMC::GenEvent::particle_iterator
p = evt->particles_begin();
p != evt->particles_end(); ++
p)
70 HepMC::FourVector
v = (*p)->momentum();
73 v.setPx(px * cos(psi) - py * sin(psi));
74 v.setPy(px * sin(psi) + py * cos(psi));
75 (*p)->set_momentum(v);
77 for (HepMC::GenEvent::vertex_iterator
v = evt->vertices_begin();
v != evt->vertices_end(); ++
v)
79 HepMC::FourVector
pos = (*v)->position();
82 pos.setX(x * cos(psi) - y * sin(psi));
83 pos.setY(x * sin(psi) + y * cos(psi));
84 (*v)->set_position(pos);
88 std::cout<<
"ReactionPlaneAfterburner::process_event: no heavy ion info found, exiting"<<std::endl;