#include "Tauola/Log.h" #include "Tauola/Tauola.h" #include "Tauola/TauolaHepMCEvent.h" #include "Pythia8/Pythia.h" #include "Pythia8/Pythia8ToHepMC.h" #include "HepMC/IO_GenEvent.h" using namespace std; using namespace Pythia8; using namespace Tauolapp; void recursive_copy_daughters(HepMC::GenEvent *evt, HepMC::GenVertex *v) { if(!v) return; evt->add_vertex(v); for(HepMC::GenVertex::particles_out_const_iterator i = v->particles_out_const_begin(); i!=v->particles_out_const_end(); i++) { recursive_copy_daughters(evt,(*i)->end_vertex()); } } int main(int argc,char **argv){ if(argc<5) { cout<<"Usage: "< "<use_units(HepMC::Units::GEV,HepMC::Units::MM); ToHepMC.fill_next_event(event, HepMCEvt); // Run TAUOLA on the event TauolaHepMCEvent * t_event = new TauolaHepMCEvent(HepMCEvt); t_event->decayTaus(); delete t_event; // Cut smaller sub-event HepMC::GenParticle *beam1 = NULL, *beam2 = NULL; for(HepMC::GenEvent::particle_const_iterator p=HepMCEvt->particles_begin();p!=HepMCEvt->particles_end();p++) { if(!(*p)->end_vertex()) continue; int abs_pdg = abs( (*p)->pdg_id() ); int pdg2 = (*(*p)->end_vertex()->particles_out_const_begin())->pdg_id(); if( ((abs_pdg>0 && abs_pdg<7) || abs_pdg==21) && (pdg2==22 || pdg2==23 || pdg2==25 || pdg2==36) ) { if(!beam1) beam1 = (*p); else if(!beam2) beam2 = (*p); else { cout<<"Error: found more than two mothers of H/Z"<add_particle_out(beam1); HepMC::GenVertex *v2 = new HepMC::GenVertex(); v2->add_particle_out(beam2); HepMCEvt_copy->add_vertex(v1); HepMCEvt_copy->add_vertex(v2); HepMCEvt_copy->set_beam_particles(beam1,beam2); recursive_copy_daughters(HepMCEvt_copy,beam1->end_vertex()); recursive_copy_daughters(HepMCEvt_copy,beam2->end_vertex()); if(iEvent==0) HepMCEvt_copy->print(); file.write_event(HepMCEvt_copy); // Clean up delete HepMCEvt; delete HepMCEvt_copy; } pythia.statistics(); Tauola::summary(); }