1 #include "HepMC3/GenVertex.h"
2 #include "HepMC3/GenVertex_fwd.h"
3 #include "HepMC3/FourVector.h"
4 #include "HepMC3/GenEvent.h"
5 #include "HepMC3/GenParticle.h"
6 #include "HepMC3/WriterAscii.h"
7 #include "HepMC3/Print.h"
13 using HepMC3::FourVector;
23 std::string hepmc3_filename = param.
baseFileName() +
".hepmc";
35 double p_mass = 0.93827;
36 double e_mass = 0.000511;
41 double electronBeam_pz = -1.0*sqrt(electronBeam_E*electronBeam_E - e_mass*e_mass);
42 double targetBeam_pz = sqrt(targetBeam_E*targetBeam_E - p_mass*p_mass);
58 HepMC3::GenEvent hepmc3_evt(HepMC3::Units::GEV , HepMC3::Units::MM);
59 hepmc3_evt.set_event_number( eventnumber );
61 HepMC3::GenVertexPtr hepmc3_gamma_vertex_to_write = std::make_shared<HepMC3::GenVertex>(FourVector(0,0,0,0));
62 HepMC3::GenVertexPtr hepmc3_ion_vertex_to_write = std::make_shared<HepMC3::GenVertex>(FourVector(0,0,0,0));
71 hepmc3_gamma_vertex_to_write->add_particle_in( hepmc3_electronBeam_particle );
72 hepmc3_ion_vertex_to_write->add_particle_in( hepmc3_targetBeam_particle );
80 const std::vector<starlightParticle> * particle_vector =
event.getParticles();
88 FourVector hepmc3_gamma_four_vector = FourVector(gamma_lorentzVec.
GetPx(),
89 gamma_lorentzVec.
GetPy(),
90 gamma_lorentzVec.
GetPz(),
91 gamma_lorentzVec.
GetE());
92 HepMC3::GenParticlePtr hepmc3_gamma = std::make_shared<HepMC3::GenParticle>( hepmc3_gamma_four_vector, 22, 13 );
93 hepmc3_gamma_vertex_to_write->add_particle_out( hepmc3_gamma );
94 hepmc3_ion_vertex_to_write->add_particle_in( hepmc3_gamma );
97 for ( std::vector<starlightParticle>::const_iterator particle_iter = (*particle_vector).begin();
98 particle_iter != (*particle_vector).end();
101 int hepmc3_pid = (*particle_iter).getPdgCode();
103 FourVector hepmc3_four_vector = FourVector( (*particle_iter).GetPx(),
104 (*particle_iter).GetPy(),
105 (*particle_iter).GetPz(),
106 (*particle_iter).GetE());
108 HepMC3::GenParticlePtr hepmc3_particle = std::make_shared<HepMC3::GenParticle>( hepmc3_four_vector, hepmc3_pid, 1 );
109 hepmc3_ion_vertex_to_write->add_particle_out( hepmc3_particle );
112 lorentzVector electron_lorentzVec = (*
event.getSources())[0];
113 FourVector hepmc3_electron_four_vector = FourVector(electron_lorentzVec.
GetPx(),
114 electron_lorentzVec.
GetPy(),
115 electron_lorentzVec.
GetPz(),
116 electron_lorentzVec.
GetE());
118 HepMC3::GenParticlePtr hepmc3_electron = std::make_shared<HepMC3::GenParticle>( hepmc3_electron_four_vector, 11, 1 );
120 hepmc3_gamma_vertex_to_write->add_particle_out( hepmc3_electron );
124 FourVector hepmc3_ion_four_vector = FourVector(ion_lorentzVec.
GetPx(),
125 ion_lorentzVec.
GetPy(),
126 ion_lorentzVec.
GetPz(),
127 ion_lorentzVec.
GetE());
130 HepMC3::GenParticlePtr hepmc3_ion = std::make_shared<HepMC3::GenParticle>( hepmc3_ion_four_vector, 2212, 1 );
132 hepmc3_ion_vertex_to_write->add_particle_out( hepmc3_ion );
138 hepmc3_evt.add_vertex( hepmc3_gamma_vertex_to_write );
139 hepmc3_evt.add_vertex( hepmc3_ion_vertex_to_write );