10 #include "Pythia8/Pythia.h"
11 #include "Pythia8Plugins/HepMC2.h"
14 #include "Photos/Photos.h"
15 #include "Photos/PhotosHepMCParticle.h"
16 #include "Photos/Log.h"
19 using namespace Pythia8;
20 using namespace Photospp;
32 double px=0.0,py=0.0,pz=0.0,e=0.0;
37 if( (*p)->status() == 1 )
48 cout.setf(ios_base::floatfield);
49 cout<<endl<<
"Vector Sum: "<<px<<
" "<<py<<
" "<<pz<<
" "<<e<<endl;
52 int main(
int argc,
char **argv)
57 Event&
event = pythia.event;
59 pythia.readFile(
"single_photos_gun_example.conf");
63 Photos::setInfraredCutOff(0.001/200);
65 int NumberOfEvents = 10000;
66 if(argc>1) NumberOfEvents=atoi(argv[1]);
68 int photonAdded=0,twoAdded=0,moreAdded=0,tauCount=0;
71 for (
int iEvent = 0; iEvent < NumberOfEvents; ++iEvent)
73 if(iEvent%(NumberOfEvents/10)==0) Log::Info()<<iEvent<<endl;
74 if(!pythia.next())
continue;
77 ToHepMC.fill_next_event(event, HepMCEvt);
79 if(iEvent<EventsToCheck)
82 cout<<
"Momentum conservation chceck BEFORE/AFTER Photos"<<endl;
83 checkMomentumConservationInEvent(HepMCEvt);
92 if((*p)->pdg_id()==15) tau=*p;
106 if(buf==1) photonAdded++;
107 else if(buf==2) twoAdded++;
108 else if(buf>2) moreAdded++;
111 if(iEvent<EventsToCheck)
113 checkMomentumConservationInEvent(HepMCEvt);
123 cout.setf(ios::fixed);
127 cout<<
"Something went wrong with pythia generation."<<endl;
128 cout<<
"No taus were processed."<<endl<<endl;
131 cout<<
"Summary (single tau decay processing):"<<endl;
132 cout<<tauCount <<
"\ttaus processed"<<endl;
133 cout<<photonAdded<<
"\ttimes one photon added to the decay \t("<<(photonAdded*100./tauCount)<<
"%)"<<endl;
134 cout<<twoAdded <<
"\ttimes two photons added to the decay \t("<<(twoAdded*100./tauCount)<<
"%)"<<endl;
135 cout<<moreAdded <<
"\ttimes more than two photons added to the decay\t("<<(moreAdded*100./tauCount)<<
"%)"<<endl<<endl;
136 cout<<
"(Contrary to results from MC-Tester, these values are technical and infrared unstable)"<<endl<<endl;
137 cout<<
"To proccess different number of events use:"<<endl<<
" ./single_photos_gun_example <number_of_events>"<<endl<<endl;
std::vector< HepMC::GenParticle * >::const_iterator particles_in_const_iterator
const iterator for incoming particles
int particles_size() const
how many particle barcodes exist?
particle_const_iterator particles_begin() const
begin particle iteration
double e() const
return E
double px() const
return px
The GenEvent class is the core of HepMC.
double pz() const
return pz
vertex_const_iterator vertices_end() const
end vertex iteration
particle_const_iterator particles_end() const
end particle iteration
FourVector is a simple representation of a physics 4 vector.
vertex_const_iterator vertices_begin() const
begin vertex iteration
double py() const
return py
The GenParticle class contains information about generated particles.