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 21 std::shared_ptr<HepMC3::Reader> deduce_reader(
const std::string &filename);
22 std::shared_ptr<HepMC3::Reader> deduce_reader(std::istream &stream);
26 namespace RivetHepMC =
HepMC3;
28 using RivetHepMC::ConstGenParticlePtr;
29 using RivetHepMC::ConstGenVertexPtr;
30 using RivetHepMC::Relatives;
31 using RivetHepMC::ConstGenHeavyIonPtr;
33 using HepMC_IO_type = RivetHepMC::Reader;
34 using PdfInfo = RivetHepMC::GenPdfInfo;
39 #include "HepMC/GenEvent.h" 40 #include "HepMC/GenParticle.h" 41 #include "HepMC/HeavyIon.h" 42 #include "HepMC/GenVertex.h" 43 #include "HepMC/Version.h" 44 #include "HepMC/GenRanges.h" 45 #include "HepMC/IO_GenEvent.h" 47 namespace RivetHepMC = HepMC;
50 typedef const HepMC::GenParticle* ConstGenParticlePtr;
51 typedef const HepMC::GenVertex* ConstGenVertexPtr;
52 typedef const HepMC::HeavyIon* ConstGenHeavyIonPtr;
59 constexpr Relatives(HepMC::IteratorRange relo): _internal(relo){}
61 constexpr HepMC::IteratorRange operator()()
const {
return _internal;}
62 operator HepMC::IteratorRange()
const {
return _internal;}
64 const static Relatives PARENTS;
65 const static Relatives CHILDREN;
66 const static Relatives ANCESTORS;
67 const static Relatives DESCENDANTS;
70 const HepMC::IteratorRange _internal;
74 using HepMC_IO_type = HepMC::IO_GenEvent;
75 using PdfInfo = RivetHepMC::PdfInfo;
84 using RivetHepMC::GenEvent;
85 using ConstGenEventPtr = std::shared_ptr<const GenEvent>;
88 namespace HepMCUtils {
89 ConstGenParticlePtr getParticlePtr(
const RivetHepMC::GenParticle & gp);
90 std::vector<ConstGenParticlePtr> particles(ConstGenEventPtr ge);
91 std::vector<ConstGenParticlePtr> particles(
const GenEvent *ge);
92 std::vector<ConstGenVertexPtr> vertices(ConstGenEventPtr ge);
93 std::vector<ConstGenVertexPtr> vertices(
const GenEvent *ge);
94 std::vector<ConstGenParticlePtr> particles(ConstGenVertexPtr gv,
const Relatives &relo);
95 std::vector<ConstGenParticlePtr> particles(ConstGenParticlePtr gp,
const Relatives &relo);
96 int uniqueId(ConstGenParticlePtr gp);
97 int particles_size(ConstGenEventPtr ge);
98 int particles_size(
const GenEvent* ge);
99 std::pair<ConstGenParticlePtr,ConstGenParticlePtr>
beams(
const GenEvent* ge);
100 std::shared_ptr<HepMC_IO_type> makeReader(std::string filename, std::shared_ptr<std::istream>& istrp, std::string* errm = 0);
101 bool readEvent(std::shared_ptr<HepMC_IO_type> io, std::shared_ptr<GenEvent> evt);
102 void strip(GenEvent & ge,
const set<long>& stripid = {1, -1, 2, -2, 3,-3, 21});
103 vector<string> weightNames(
const GenEvent& ge);
104 std::valarray<double> weights(
const GenEvent& ge);
105 pair<double,double> crossSection(
const GenEvent& ge);
Definition: MC_Cent_pPb.hh:10
ParticlePair beams(const Event &e)
Get beam particles from an event.