2 #ifndef RIVET_RivetHepMC_HH 3 #define RIVET_RivetHepMC_HH 5 #include "Rivet/Config/RivetConfig.hh" 6 #include "Rivet/Tools/RivetSTL.hh" 7 #include "Rivet/Tools/Exceptions.hh" 11 #ifdef RIVET_ENABLE_HEPMC_3 13 #include "HepMC3/HepMC3.h" 14 #include "HepMC3/Relatives.h" 15 #include "HepMC3/Reader.h" 16 #ifndef HEPMC_HAS_CROSS_SECTION 17 #define HEPMC_HAS_CROSS_SECTION 20 namespace RivetHepMC =
HepMC3;
22 using RivetHepMC::ConstGenParticlePtr;
23 using RivetHepMC::ConstGenVertexPtr;
24 using RivetHepMC::Relatives;
25 using RivetHepMC::ConstGenHeavyIonPtr;
27 using HepMC_IO_type = RivetHepMC::Reader;
28 using PdfInfo = RivetHepMC::GenPdfInfo;
33 #include "HepMC/GenEvent.h" 34 #include "HepMC/GenParticle.h" 35 #include "HepMC/HeavyIon.h" 36 #include "HepMC/GenVertex.h" 37 #include "HepMC/Version.h" 38 #include "HepMC/GenRanges.h" 39 #include "HepMC/IO_GenEvent.h" 41 namespace RivetHepMC = HepMC;
44 typedef const HepMC::GenParticle* ConstGenParticlePtr;
45 typedef const HepMC::GenVertex* ConstGenVertexPtr;
46 typedef const HepMC::HeavyIon* ConstGenHeavyIonPtr;
53 constexpr Relatives(HepMC::IteratorRange relo): _internal(relo){}
55 constexpr HepMC::IteratorRange operator()()
const {
return _internal;}
56 operator HepMC::IteratorRange()
const {
return _internal;}
58 const static Relatives PARENTS;
59 const static Relatives CHILDREN;
60 const static Relatives ANCESTORS;
61 const static Relatives DESCENDANTS;
64 const HepMC::IteratorRange _internal;
68 using HepMC_IO_type = HepMC::IO_GenEvent;
69 using PdfInfo = RivetHepMC::PdfInfo;
78 using RivetHepMC::GenEvent;
79 using ConstGenEventPtr = std::shared_ptr<const GenEvent>;
82 namespace HepMCUtils {
83 ConstGenParticlePtr getParticlePtr(
const RivetHepMC::GenParticle & gp);
84 std::vector<ConstGenParticlePtr> particles(ConstGenEventPtr ge);
85 std::vector<ConstGenParticlePtr> particles(
const GenEvent *ge);
86 std::vector<ConstGenVertexPtr> vertices(ConstGenEventPtr ge);
87 std::vector<ConstGenVertexPtr> vertices(
const GenEvent *ge);
88 std::vector<ConstGenParticlePtr> particles(ConstGenVertexPtr gv,
const Relatives &relo);
89 std::vector<ConstGenParticlePtr> particles(ConstGenParticlePtr gp,
const Relatives &relo);
90 int uniqueId(ConstGenParticlePtr gp);
91 int particles_size(ConstGenEventPtr ge);
92 int particles_size(
const GenEvent* ge);
93 std::pair<ConstGenParticlePtr,ConstGenParticlePtr>
beams(
const GenEvent* ge);
94 std::shared_ptr<HepMC_IO_type> makeReader(std::string filename, std::shared_ptr<std::istream>& istrp, std::string* errm = 0);
95 bool readEvent(std::shared_ptr<HepMC_IO_type> io, std::shared_ptr<GenEvent> evt);
96 void strip(GenEvent & ge,
const set<long>& stripid = {1, -1, 2, -2, 3,-3, 21});
97 vector<string> weightNames(
const GenEvent& ge);
98 std::valarray<double> weights(
const GenEvent& ge);
99 pair<double,double> crossSection(
const GenEvent& ge);
Definition: MC_Cent_pPb.hh:10
ParticlePair beams(const Event &e)
Get beam particles from an event.