#include "HepMC/IO_GenEvent.h"
#include "Photos/Photos.h"
#include "Photos/PhotosHepMCEvent.h"
#include "Photos/Log.h"
Go to the source code of this file.
void checkMomentumConservationInEvent |
( |
HepMC::GenEvent * |
evt | ) |
|
Definition at line 27 of file photos_standalone_example.cxx.
References m, p, and pz.
Referenced by main().
31 double px=0.0,py=0.0,
pz=0.0,e=0.0;
33 for ( HepMC::GenEvent::particle_const_iterator
p =
evt->particles_begin();
34 p !=
evt->particles_end(); ++
p )
36 if( (*p)->status() == 1 )
38 HepMC::FourVector
m = (*p)->momentum();
47 cout.setf(ios_base::floatfield);
48 cout<<endl<<
"Vector Sum: "<<px<<
" "<<py<<
" "<<
pz<<
" "<<e<<endl;
Definition at line 51 of file photos_standalone_example.cxx.
References buf, checkMomentumConservationInEvent(), EventsToCheck, evt, file, chigen::initialize(), and Photospp::PhotosEvent::process().
53 HepMC::IO_GenEvent
file(
"photos_standalone_example.dat",std::ios::in);
56 Photos::setInfraredCutOff(0.001/200);
58 int photonAdded=0,twoAdded=0,moreAdded=0,evtCount=0;
63 HepMC::GenEvent *HepMCEvt =
new HepMC::GenEvent();
64 file.fill_next_event(HepMCEvt);
65 if(
file.rdstate())
break;
67 int buf = -HepMCEvt->particles_size();
75 cout<<
"Momentum conservation chceck BEFORE/AFTER Photos"<<endl;
88 buf+=HepMCEvt->particles_size();
89 if(buf==1) photonAdded++;
90 else if(buf==2) twoAdded++;
91 else if(buf>2) moreAdded++;
102 cout.setf(ios::fixed);
106 cout<<
"Something went wrong with the input file: photos_standalone_example.dat"<<endl;
107 cout<<
"No events were processed."<<endl<<endl;
110 cout<<
"Summary (whole event processing):"<<endl;
111 cout<<evtCount <<
"\tevents processed"<<endl;
112 cout<<photonAdded<<
"\ttimes one photon added to the event \t("<<(photonAdded*100./evtCount)<<
"%)"<<endl;
113 cout<<twoAdded <<
"\ttimes two photons added to the event \t("<<(twoAdded*100./evtCount)<<
"%)"<<endl;
114 cout<<moreAdded <<
"\ttimes more than two photons added to the event\t("<<(moreAdded*100./evtCount)<<
"%)"<<endl<<endl;
115 cout<<
"(Contrary to results from MC-Tester, these values are technical and infrared unstable)"<<endl<<endl;
void checkMomentumConservationInEvent(HepMC::GenEvent *evt)