rivet is hosted by Hepforge, IPPP Durham
RivetHepMC.hh
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #ifndef RIVET_RivetHepMC_HH
00003 #define RIVET_RivetHepMC_HH
00004 
00005 #include "HepMC/GenEvent.h"
00006 #include "HepMC/GenParticle.h"
00007 #include "HepMC/GenVertex.h"
00008 
00009 #include <vector>
00010 
00011 namespace Rivet {
00012 
00013 
00014   using HepMC::GenEvent;
00015   using HepMC::GenParticle;
00016   using HepMC::GenVertex;
00017 
00018 
00019   inline vector<GenParticle*> particles(const GenEvent& ge) {
00020     vector<GenParticle*> rtn;
00021     for (GenEvent::particle_const_iterator pi = ge.particles_begin(); pi != ge.particles_end(); ++pi) {
00022       rtn.push_back(*pi);
00023     }
00024     return rtn;
00025   }
00026   inline vector<GenParticle*> particles(const GenEvent* ge) {
00027     assert(ge);
00028     return particles(*ge);
00029   }
00030 //  inline std::pair<GenEvent::particle_const_iterator, GenEvent::particle_const_iterator> particles(const GenEvent& ge) {
00031 //    return make_pair(ge.particles_begin(), ge.particles_end());
00032 //  }
00033 //  inline std::pair<GenEvent::particle_const_iterator, GenEvent::particle_const_iterator> particles(const GenEvent* ge) {
00034 //    assert(ge);
00035 //    return particles(*ge);
00036 //  }
00037 
00038 
00039   inline vector<GenVertex*> vertices(const GenEvent& ge) {
00040     vector<GenVertex*> rtn;
00041     for (GenEvent::vertex_const_iterator vi = ge.vertices_begin(); vi != ge.vertices_end(); ++vi) {
00042       rtn.push_back(*vi);
00043     }
00044     return rtn;
00045   }
00046   inline vector<GenVertex*> vertices(const GenEvent* ge) {
00047     assert(ge);
00048     return vertices(*ge);
00049   }
00050 //  inline std::pair<GenEvent::vertex_const_iterator, GenEvent::vertex_const_iterator> vertices(const GenEvent& ge) {
00051 //    return make_pair(ge.vertices_begin(), ge.vertices_end());
00052 //  }
00053 //  inline std::pair<GenEvent::vertex_const_iterator, GenEvent::vertex_const_iterator> vertices(const GenEvent* ge) {
00054 //    assert(ge);
00055 //    return vertices(*ge);
00056 //  }
00057 
00058 
00059   inline const std::pair<GenVertex::particles_in_const_iterator, GenVertex::particles_in_const_iterator> particles_in(const GenVertex* gv) {
00060     return make_pair(gv->particles_in_const_begin(), gv->particles_in_const_end());
00061   }
00062 
00063 
00064   inline const std::pair<GenVertex::particles_out_const_iterator, GenVertex::particles_out_const_iterator> particles_out(const GenVertex* gv) {
00065     return make_pair(gv->particles_out_const_begin(), gv->particles_out_const_end());
00066   }
00067 
00068 
00069   inline vector<GenParticle*> particles(GenVertex* gv, HepMC::IteratorRange range=HepMC::relatives) {
00070     vector<GenParticle*> rtn;
00071     for (GenVertex::particle_iterator pi = gv->particles_begin(range); pi != gv->particles_end(range); ++pi) {
00072       rtn.push_back(*pi);
00073     }
00074     return rtn;
00075   }
00076 //  inline std::pair<GenVertex::particle_iterator, GenVertex::particle_iterator> particles(GenVertex* gv, HepMC::IteratorRange range=HepMC::relatives) {
00077 //    return make_pair(gv->particles_begin(range), gv->particles_end(range));
00078 //  }
00079 
00080 
00081 }
00082 
00083 #endif