12 #include "CLHEP/Units/SystemOfUnits.h"
18 #include "GaudiKernel/ThreadLocalContext.h"
26 std::cerr <<
"This test can not be run" << std::endl;
32 inputTestDataHandle = std::make_unique<McEventCollection>();
37 Gaudi::Hive::setCurrentContext( ctx );
40 const int process_id1(20);
41 const int event_number1(17);
43 HepMC::GenEvent& ge1 = *(inputTestDataHandle->at(0));
50 inputTestDataHandle->push_back(
new HepMC::GenEvent(ge1));
51 HepMC::GenEvent& ge2 = *(inputTestDataHandle->at(1));
52 const int event_number2(89);
53 ge2.set_event_number(event_number2);
61 if (genPartList.empty()) {
return maxBarcode; }
69 void populateGenEvent(HepMC::GenEvent & ge,
int pdgid1,
int pdgid2, std::vector<HepMC::GenParticlePtr>& genPartList)
72 HepMC::FourVector myPos( 0.0, 0.0, 0.0, 0.0);
74 HepMC::FourVector fourMomentum1( 0.0, 0.0, 1.0, 1.0*
CLHEP::TeV);
76 myVertex->add_particle_in(inParticle1);
77 HepMC::FourVector fourMomentum2( 0.0, 0.0, -1.0, 1.0*
CLHEP::TeV);
79 myVertex->add_particle_in(inParticle2);
80 HepMC::FourVector fourMomentum3( 0.0, 1.0, 0.0, 1.0*
CLHEP::TeV);
82 myVertex->add_particle_out(inParticle3);
83 genPartList.push_back(inParticle3);
84 HepMC::FourVector fourMomentum4( 0.0, -1.0, 0.0, 1.0*
CLHEP::TeV);
86 myVertex->add_particle_out(inParticle4);
87 genPartList.push_back(inParticle4);
88 ge.add_vertex( myVertex );
94 ge.set_beam_particles(inParticle1,inParticle2);
101 genPart->set_pdg_id(999);
102 genPart->set_status(1);
106 genVertex->add_particle_out(genPart);
107 genPartVector.push_back(genPart);
111 if (hScatVx!=
nullptr) {
112 HepMC::FourVector pmvxpos=hScatVx->position();
113 genVertex->set_position(pmvxpos);
116 auto itrp =hScatVx->particles_in().cbegin();
117 if (hScatVx->particles_in().size()==2) {
118 HepMC::FourVector mom1=(*itrp)->momentum();
119 HepMC::FourVector mom2=(*(++itrp))->momentum();
120 HepMC::FourVector vxmom;
121 vxmom.setPx(mom1.e()+mom2.e());
124 vxmom.setE(mom1.e()+mom2.e());
125 genPart->set_momentum(vxmom);
128 HepMC::GenVertex::particles_in_const_iterator itrp =hScatVx->particles_in_const_begin();
129 if (hScatVx->particles_in_size()==2) {
130 HepMC::FourVector mom1=(*itrp)->momentum();
131 HepMC::FourVector mom2=(*(++itrp))->momentum();
132 HepMC::FourVector vxmom;
133 vxmom.setPx(mom1.e()+mom2.e());
136 vxmom.setE(mom1.e()+mom2.e());
137 genPart->set_momentum(vxmom);
143 if (!ge.vertices().empty()) {
144 std::vector<HepMC::GenVertexPtr> vtxvec;
145 for (
const auto& vtx: ge.vertices()) {
146 vtxvec.push_back(vtx);
147 ge.remove_vertex(vtx);
152 if (!ge.vertices_empty()) {
153 HepMC::GenEvent::vertex_iterator itvtx = ge.vertices_begin();
154 while (itvtx != ge.vertices_end()) {
157 ge.remove_vertex(pvtx);
164 ge.add_vertex(genVertex);