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"
17#include "HepMC3/Version.h"
18#if HEPMC3_VERSION_CODE >= 3002007
19#include "HepMC3/ReaderFactory.h"
22 std::shared_ptr<HepMC3::Reader> deduce_reader(
const std::string &filename);
23 std::shared_ptr<HepMC3::Reader> deduce_reader(std::istream &stream);
27#ifndef HEPMC_HAS_CROSS_SECTION
28#define HEPMC_HAS_CROSS_SECTION
32 namespace RivetHepMC = HepMC3;
34 using RivetHepMC::ConstGenParticlePtr;
35 using RivetHepMC::ConstGenVertexPtr;
36 using RivetHepMC::Relatives;
37 using RivetHepMC::ConstGenHeavyIonPtr;
39 using HepMC_IO_type = RivetHepMC::Reader;
40 using PdfInfo = RivetHepMC::GenPdfInfo;
45#include "HepMC/GenEvent.h"
46#include "HepMC/GenParticle.h"
47#include "HepMC/HeavyIon.h"
48#include "HepMC/GenVertex.h"
49#include "HepMC/Version.h"
50#include "HepMC/GenRanges.h"
51#include "HepMC/IO_GenEvent.h"
53 namespace RivetHepMC = HepMC;
56 typedef const HepMC::GenParticle* ConstGenParticlePtr;
57 typedef const HepMC::GenVertex* ConstGenVertexPtr;
58 typedef const HepMC::HeavyIon* ConstGenHeavyIonPtr;
65 constexpr Relatives(HepMC::IteratorRange relo): _internal(relo){}
67 constexpr HepMC::IteratorRange operator()()
const {
return _internal;}
68 operator HepMC::IteratorRange()
const {
return _internal;}
70 const static Relatives PARENTS;
71 const static Relatives CHILDREN;
72 const static Relatives ANCESTORS;
73 const static Relatives DESCENDANTS;
76 const HepMC::IteratorRange _internal;
80 using HepMC_IO_type = HepMC::IO_GenEvent;
81 using PdfInfo = RivetHepMC::PdfInfo;
90 using RivetHepMC::GenEvent;
91 using ConstGenEventPtr = std::shared_ptr<const GenEvent>;
94 namespace HepMCUtils {
95 ConstGenParticlePtr getParticlePtr(
const RivetHepMC::GenParticle & gp);
96 std::vector<ConstGenParticlePtr> particles(ConstGenEventPtr ge);
97 std::vector<ConstGenParticlePtr> particles(
const GenEvent *ge);
98 std::vector<ConstGenVertexPtr> vertices(ConstGenEventPtr ge);
99 std::vector<ConstGenVertexPtr> vertices(
const GenEvent *ge);
100 std::vector<ConstGenParticlePtr> particles(ConstGenVertexPtr gv,
const Relatives &relo);
101 std::vector<ConstGenParticlePtr> particles(ConstGenParticlePtr gp,
const Relatives &relo);
102 int uniqueId(ConstGenParticlePtr gp);
103 int particles_size(ConstGenEventPtr ge);
104 int particles_size(
const GenEvent* ge);
105 std::pair<ConstGenParticlePtr,ConstGenParticlePtr>
beams(
const GenEvent* ge);
106 std::shared_ptr<HepMC_IO_type> makeReader(std::string filename, std::shared_ptr<std::istream>& istrp, std::string* errm = 0);
107 bool readEvent(std::shared_ptr<HepMC_IO_type> io, std::shared_ptr<GenEvent> evt);
108 void strip(GenEvent & ge,
const set<long>& stripid = {1, -1, 2, -2, 3,-3, 21});
109 vector<string> weightNames(
const GenEvent& ge);
110 std::valarray<double> weights(
const GenEvent& ge);
111 pair<double,double> crossSection(
const GenEvent& ge,
size_t index = 0);
Definition MC_Cent_pPb.hh:10
ParticlePair beams(const Event &e)
Get beam particles from an event.