11 #include "HepMC3/ReaderAscii.h"
12 #include "HepMC3/GenEvent.h"
13 #include "HepMC3/Print.h"
16 #include "Photos/Photos.h"
17 #include "Photos/PhotosHepMC3Event.h"
18 #include "Photos/Log.h"
21 using namespace Photospp;
29 void checkMomentumConservationInEvent(HepMC3::GenEvent &evt)
36 for (
auto p : evt.particles())
40 HepMC3::FourVector m = p->momentum();
48 cout.setf(ios_base::scientific, ios_base::floatfield);
49 cout << endl <<
"Vector Sum: " << px <<
" " << py <<
" " << pz <<
" " << e << endl;
54 HepMC3::ReaderAscii input_file(
"photos_hepmc3_standalone_example.dat");
57 Photos::setInfraredCutOff(0.001/200);
65 while (!input_file.failed()) {
67 HepMC3::GenEvent evt(Units::GEV, Units::MM);
70 input_file.read_event(evt);
73 if (input_file.failed()) {
79 int buf = -evt.particles().size();
84 if (evtCount < EventsToCheck)
87 cout <<
"Momentum conservation chceck BEFORE/AFTER Photos" << endl;
88 checkMomentumConservationInEvent(evt);
93 photosEvent.process();
95 if (evtCount < EventsToCheck)
97 checkMomentumConservationInEvent(evt);
100 buf += evt.particles().size();
120 cout.setf(ios_base::fixed, ios_base::floatfield);
125 cout<<
"Something went wrong with the input file: photos_standalone_example.dat"<<endl;
126 cout<<
"No events were processed."<<endl<<endl;
130 cout <<
"Summary (whole event processing):" << endl;
131 cout << evtCount <<
"\tevents processed" << endl;
132 cout << photonAdded <<
"\ttimes one photon added to the event \t(" << (photonAdded*100./evtCount) <<
"%)" << endl;
133 cout << twoAdded <<
"\ttimes two photons added to the event \t(" << (twoAdded*100./evtCount) <<
"%)" << endl;
134 cout << moreAdded <<
"\ttimes more than two photons added to the event\t(" << (moreAdded*100./evtCount) <<
"%)" << endl << endl;
135 cout <<
"(Contrary to results from MC-Tester, these values are technical and infrared unstable)" << endl << endl;