11 #include "HepMC/IO_GenEvent.h"
14 #include "Photos/Version.h"
15 #include "Photos/Photos.h"
16 #include "Photos/PhotosHepMCEvent.h"
17 #include "Photos/Log.h"
20 using namespace Photospp;
28 void checkMomentumConservationInEvent(HepMC::GenEvent *evt)
32 double px=0.0,py=0.0,pz=0.0,e=0.0;
34 for ( HepMC::GenEvent::particle_const_iterator p = evt->particles_begin();
35 p != evt->particles_end(); ++p )
37 if( (*p)->status() == 1 )
39 HepMC::FourVector m = (*p)->momentum();
48 cout.setf(ios_base::scientific, ios_base::floatfield);
49 cout<<endl<<
"Vector Sum: "<<px<<
" "<<py<<
" "<<pz<<
" "<<e<<endl;
54 cout << endl <<
"Photospp version " << Photospp::version() <<
" standalone example" << endl << endl;
56 HepMC::IO_GenEvent file(
"photos_standalone_example.dat",std::ios::in);
59 Photos::setInfraredCutOff(0.001/200);
61 int photonAdded=0,twoAdded=0,moreAdded=0,evtCount=0;
66 HepMC::GenEvent *HepMCEvt =
new HepMC::GenEvent();
67 file.fill_next_event(HepMCEvt);
68 if(file.rdstate())
break;
70 int buf = -HepMCEvt->particles_size();
75 if(evtCount<EventsToCheck)
78 cout<<
"Momentum conservation chceck BEFORE/AFTER Photos"<<endl;
79 checkMomentumConservationInEvent(HepMCEvt);
86 if(evtCount<EventsToCheck)
88 checkMomentumConservationInEvent(HepMCEvt);
91 buf+=HepMCEvt->particles_size();
92 if(buf==1) photonAdded++;
93 else if(buf==2) twoAdded++;
94 else if(buf>2) moreAdded++;
105 cout.setf(ios_base::fixed, ios_base::floatfield);
109 cout<<
"Something went wrong with the input file: photos_standalone_example.dat"<<endl;
110 cout<<
"No events were processed."<<endl<<endl;
113 cout<<
"Summary (whole event processing):"<<endl;
114 cout<<evtCount <<
"\tevents processed"<<endl;
115 cout<<photonAdded<<
"\ttimes one photon added to the event \t("<<(photonAdded*100./evtCount)<<
"%)"<<endl;
116 cout<<twoAdded <<
"\ttimes two photons added to the event \t("<<(twoAdded*100./evtCount)<<
"%)"<<endl;
117 cout<<moreAdded <<
"\ttimes more than two photons added to the event\t("<<(moreAdded*100./evtCount)<<
"%)"<<endl<<endl;
118 cout<<
"(Contrary to results from MC-Tester, these values are technical and infrared unstable)"<<endl<<endl;