10 #include "Pythia8/Pythia.h"
11 #include "Pythia8Plugins/HepMC2.h"
15 #include "HepMCEvent.H"
19 #include "Photos/Photos.h"
20 #include "Photos/PhotosHepMCEvent.h"
21 #include "Photos/Log.h"
24 using namespace Pythia8;
25 using namespace Photospp;
28 unsigned long NumberOfEvents = 10000;
29 unsigned int EventsToCheck=20;
39 double px=0.0,py=0.0,pz=0.0,e=0.0;
44 if( (*p)->status() == 1 )
55 cout.setf(ios_base::floatfield);
56 cout<<endl<<
"Vector Sum: "<<px<<
" "<<py<<
" "<<pz<<
" "<<e<<endl;
82 if((*p)->pdg_id()==22)
continue;
84 int barcode = (*p)->barcode();
91 int last_photon_position = -1;
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;
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;
145 int main(
int argc,
char **argv)
150 Event&
event = pythia.event;
153 pythia.readFile(
"photos_pythia_example.conf");
158 Photos::initialize();
162 Photos::setInfraredCutOff(0.01/91.187);
163 Photos::maxWtInterference(3.0);
167 Log::SummaryAtExit();
168 cout.setf(ios::fixed);
171 for(
unsigned long iEvent = 0; iEvent < NumberOfEvents; ++iEvent)
173 if(iEvent%1000==0) Log::Info()<<
"Event: "<<iEvent<<
"\t("<<iEvent*(100./NumberOfEvents)<<
"%)"<<endl;
174 if (!pythia.next())
continue;
178 ToHepMC.fill_next_event(event, HepMCEvt);
181 if(iEvent<EventsToCheck)
184 cout<<
"Momentum conservation chceck BEFORE/AFTER Photos"<<endl;
185 checkMomentumConservationInEvent(HepMCEvt);
198 if(iEvent<EventsToCheck)
200 checkMomentumConservationInEvent(HepMCEvt);
206 HepMCEvent temp_event(*HepMCEvt,
false);
207 MC_Analyze(&temp_event);
210 if(iEvent>=NumberOfEvents-5) HepMCEvt->
print();
int pdg_id() const
particle ID
void set_status(int status=0)
set decay status
particle_const_iterator particles_begin() const
begin particle iteration
particles_out_const_iterator particles_out_const_end() const
end iteration of outgoing particles
std::vector< HepMC::GenParticle * >::const_iterator particles_out_const_iterator
const iterator for outgoing particles
double e() const
return E
double px() const
return px
GenVertex contains information about decay vertices.
The GenEvent class is the core of HepMC.
double pz() const
return pz
int status() const
HEPEVT decay status.
void print(std::ostream &ostr=std::cout) const
dumps to ostr
particle_const_iterator particles_end() const
end particle iteration
particles_out_const_iterator particles_out_const_begin() const
begin iteration of outgoing particles
FourVector is a simple representation of a physics 4 vector.
double py() const
return py
The GenParticle class contains information about generated particles.