11 #include "Pythia8/Pythia.h"
12 #include "Pythia8Plugins/HepMC2.h"
16 #include "HepMCEvent.H"
20 #include "Tauola/Tauola.h"
21 #include "Tauola/TauolaHepMCEvent.h"
24 #include "Photos/Photos.h"
25 #include "Photos/PhotosHepMCParticle.h"
26 #include "Photos/PhotosHepMCEvent.h"
27 #include "Photos/Log.h"
30 using namespace Pythia8;
31 using namespace Photospp;
32 using namespace Tauolapp;
34 unsigned long NumberOfEvents = 10000;
35 unsigned int EventsToCheck=20;
41 void checkMomentumConservationInEvent(HepMC::GenEvent *evt)
45 double px=0.0,py=0.0,pz=0.0,e=0.0;
47 for ( HepMC::GenEvent::particle_const_iterator p = evt->particles_begin();
48 p != evt->particles_end(); ++p )
50 if( (*p)->status() == 1 )
52 HepMC::FourVector m = (*p)->momentum();
61 cout.setf(ios_base::scientific, ios_base::floatfield);
62 cout<<endl<<
"Vector Sum: "<<px<<
" "<<py<<
" "<<pz<<
" "<<e<<endl;
65 int main(
int argc,
char **argv)
71 cout<<endl<<
"Usage: "<<argv[0]<<
" <pythia_conf> <no_events> <tauola_mode> [ <alpha_order> <ScalarNLO_mode> ]"<<endl;
72 cout<<endl<<
" eg. "<<argv[0]<<
" pythia_H.conf 10000 4 0 0"<<endl;
77 HepMC::Pythia8ToHepMC ToHepMC;
81 Event&
event = pythia.event;
102 pythia.readFile(argv[1]);
105 NumberOfEvents = atoi(argv[2]);
110 Tauola::setSameParticleDecayMode(atoi(argv[3]));
111 Tauola::setOppositeParticleDecayMode(atoi(argv[3]));
114 Tauola::initialize();
115 Photos::initialize();
117 Photos::setExponentiation(
true);
118 Photos::setInfraredCutOff(1.e-6);
119 Photos::maxWtInterference(3.0);
122 if( argc>4 && atoi(argv[4]) )
124 Photos::setDoubleBrem(
false);
125 Photos::setExponentiation(
false);
128 if(atoi(argv[2])==1) Photos::setInfraredCutOff(0.01/91.187);
129 else Photos::setInfraredCutOff(0.01/500.);
131 Photos::maxWtInterference(2.0);
137 Tauola::setEtaK0sPi(1,1,0);
140 if(atoi(argv[5])) Photos::setMeCorrectionWtForScalar(
true);
143 Log::SummaryAtExit();
148 for(
unsigned long iEvent = 0; iEvent < NumberOfEvents; ++iEvent)
150 cout.setf(ios_base::fixed, ios_base::floatfield);
151 if(iEvent%1000==0) Log::Info()<<
"Event: "<<iEvent<<
"\t("<<iEvent*(100./NumberOfEvents)<<
"%)"<<endl;
152 if(!pythia.next())
continue;
154 HepMC::GenEvent * HepMCEvt =
new HepMC::GenEvent();
155 ToHepMC.fill_next_event(event, HepMCEvt);
157 if(iEvent<EventsToCheck)
160 cout<<
"Momentum conservation chceck BEFORE/AFTER Photos"<<endl;
161 checkMomentumConservationInEvent(HepMCEvt);
165 TauolaHepMCEvent * t_event =
new TauolaHepMCEvent(HepMCEvt);
168 t_event->undecayTaus();
169 t_event->decayTaus();
176 if(iEvent<EventsToCheck)
178 checkMomentumConservationInEvent(HepMCEvt);
182 HepMCEvent temp_event(*HepMCEvt,
false);
183 MC_Analyze(&temp_event);