11 #include "HepMCInterface.h"
15 #include "HepMCEvent.H"
24 using namespace Pythia8;
25 using namespace Photospp;
39 double px=0.0,py=0.0,
pz=0.0,e=0.0;
41 for ( HepMC::GenEvent::particle_const_iterator
p = evt->particles_begin();
42 p != evt->particles_end(); ++
p )
44 if( (*p)->status() == 1 )
46 HepMC::FourVector
m = (*p)->momentum();
55 cout.setf(ios_base::floatfield);
56 cout<<endl<<
"Vector Sum: "<<px<<
" "<<py<<
" "<<
pz<<
" "<<e<<endl;
77 for ( HepMC::GenEvent::particle_const_iterator
p = evt->particles_begin();
78 p != evt->particles_end(); ++
p )
82 if((*p)->pdg_id()==22)
continue;
84 int barcode = (*p)->barcode();
86 HepMC::GenVertex *
v = (*p)->production_vertex();
91 int last_photon_position = -1;
93 for(HepMC::GenVertex::particles_out_const_iterator
p2 = v->particles_out_const_begin();
94 p2 != v->particles_out_const_end(); ++
p2)
98 if((*p2)->barcode()==barcode)
break;
100 if((*p2)->pdg_id()==22) { last_photon_position=position; }
104 if(last_photon_position<0)
continue;
106 position -= last_photon_position;
107 HepMC::GenParticle *part = NULL;
110 for(HepMC::GenVertex::particles_out_const_iterator
p2 = v->particles_out_const_begin();
111 p2 != v->particles_out_const_end(); ++
p2)
115 if (position > 0)
continue;
116 else if(position == 0) part = *
p2;
120 if((*p2)->pdg_id()==22 ) (*p2)->set_status(3);
128 if( part->pdg_id() != (*p)->pdg_id())
130 cout<<
"switch_history_entries_status: mismatch in pdg_id of history entry"<<endl;
131 cout<<
"and its corresponding particle. The algorithm does not work correctly."<<endl;
136 if(part->status()!=1)
continue;
148 HepMC::I_Pythia8 ToHepMC;
150 Event&
event = pythia.event;
153 pythia.readString(
"PartonLevel:ISR = on");
154 pythia.readString(
"PartonLevel:FSR = off");
156 pythia.readString(
"WeakSingleBoson:ffbar2gmZ = on");
157 pythia.readString(
"23:onMode = off");
158 pythia.readString(
"23:onIfAny = 13");
159 pythia.init( 11, -11, 91.187);
167 Photos::setInfraredCutOff(0.01/91.187);
168 Photos::maxWtInterference(3.0);
172 Log::SummaryAtExit();
173 cout.setf(ios::fixed);
178 if(iEvent%1000==0) Log::Info()<<
"Event: "<<iEvent<<
"\t("<<iEvent*(100./
NumberOfEvents)<<
"%)"<<endl;
179 if (!pythia.next())
continue;
182 HepMC::GenEvent * HepMCEvt =
new HepMC::GenEvent();
183 ToHepMC.fill_next_event(event, HepMCEvt);
189 cout<<
"Momentum conservation chceck BEFORE/AFTER Photos"<<endl;
211 HepMCEvent temp_event(*HepMCEvt,
false);
212 MC_Analyze(&temp_event);
215 if(iEvent>=NumberOfEvents-5) HepMCEvt->print();
int main(int argc, char **argv)
void switch_history_entries_status(HepMC::GenEvent *evt)
void checkMomentumConservationInEvent(PhotosHEPEVTEvent *evt)