10 #include "Pythia8/Pythia.h"
11 #include "Pythia8Plugins/HepMC2.h"
14 #include "Photos/Photos.h"
15 #include "Photos/PhotosHepMCEvent.h"
16 #include "Photos/Log.h"
19 using namespace Pythia8;
20 using namespace Photospp;
23 unsigned long NumberOfEvents = 100000;
32 if( (*p)->pdg_id() != 23 )
continue;
35 if( !(*p)->end_vertex() || (*p)->end_vertex()->particles_out_size() < 2 )
continue;
40 pp != (*p)->end_vertex()->particles_end(HepMC::children);
44 if( (*pp)->pdg_id() != 22 ) sum += (*pp)->momentum().e();
48 ratio = sum / (*p)->momentum().e();
49 *ratio_2 = sum*sum / ( (*p)->momentum().e() * (*p)->momentum().e() );
57 int main(
int argc,
char **argv)
62 Event&
event = pythia.event;
65 pythia.readFile(
"photosLCG_pythia_example.conf");
77 cout.setf(ios::fixed);
79 double ratio_exp = 0.0, ratio_alpha = 0.0;
80 double ratio_exp_2 = 0.0, ratio_alpha_2 = 0.0;
83 Photos::setDoubleBrem(
true);
84 Photos::setExponentiation(
true);
85 Photos::setInfraredCutOff(0.000001);
87 Log::Info() <<
"---------------- First run - EXP ----------------" <<endl;
90 for(
unsigned long iEvent = 0; iEvent < NumberOfEvents; ++iEvent)
92 if(iEvent%10000==0) Log::Info()<<
"Event: "<<iEvent<<
"\t("<<iEvent*(100./NumberOfEvents)<<
"%)"<<endl;
93 if (!pythia.next())
continue;
96 ToHepMC.fill_next_event(event, HepMCEvt);
105 ratio_exp += calculate_ratio(HepMCEvt,&buf);
114 Photos::setDoubleBrem(
false);
115 Photos::setExponentiation(
false);
116 Photos::setInfraredCutOff(1./91.187);
119 Log::Info() <<
"---------------- Second run - ALPHA ORDER ----------------" <<endl;
122 for(
unsigned long iEvent = 0; iEvent < NumberOfEvents; ++iEvent)
124 if(iEvent%10000==0) Log::Info()<<
"Event: "<<iEvent<<
"\t("<<iEvent*(100./NumberOfEvents)<<
"%)"<<endl;
125 if (!pythia.next())
continue;
128 ToHepMC.fill_next_event(event, HepMCEvt);
137 ratio_alpha += calculate_ratio(HepMCEvt,&buf);
138 ratio_alpha_2 += buf;
148 ratio_exp = ratio_exp / (double)NumberOfEvents;
149 ratio_exp_2 = ratio_exp_2 / (double)NumberOfEvents;
151 ratio_alpha = ratio_alpha / (double)NumberOfEvents;
152 ratio_alpha_2 = ratio_alpha_2 / (double)NumberOfEvents;
154 double err_exp = sqrt( (ratio_exp_2 - ratio_exp * ratio_exp ) / (
double)NumberOfEvents );
155 double err_alpha = sqrt( (ratio_alpha_2 - ratio_alpha * ratio_alpha) / (
double)NumberOfEvents );
158 cout.setf(ios::fixed);
159 cout <<
"********************************************************" << endl;
160 cout <<
"* Z -> l + bar_l + gammas *" << endl;
161 cout <<
"* E(l + bar_l) / E(l + bar_l + gammas) ratio *" << endl;
162 cout <<
"* *" << endl;
163 cout <<
"* PHOTOS - EXP: " << ratio_exp <<
" +/- "<<err_exp <<
" *" << endl;
164 cout <<
"* PHOTOS - ALPHA ORDER: " << ratio_alpha <<
" +/- "<<err_alpha<<
" *" << endl;
165 cout <<
"********************************************************" << endl;
particle_const_iterator particles_begin() const
begin particle iteration
The GenEvent class is the core of HepMC.
particle_const_iterator particles_end() const
end particle iteration