rivet is hosted by Hepforge, IPPP Durham
Rivet 4.0.0
RivetHepMC.hh
1// -*- C++ -*-
2#ifndef RIVET_RivetHepMC_HH
3#define RIVET_RivetHepMC_HH
4
5#include "Rivet/Config/RivetConfig.hh"
6#include "Rivet/Tools/RivetSTL.hh"
7#include "Rivet/Tools/Exceptions.hh"
8#include <valarray>
9
10#include "HepMC3/HepMC3.h"
11#include "HepMC3/Relatives.h"
12#include "HepMC3/Reader.h"
13
14#include "HepMC3/Version.h"
15#if HEPMC3_VERSION_CODE > 3002007
16#include "HepMC3/ReaderFactory.h"
17#else
18namespace HepMC3 {
19 std::shared_ptr<HepMC3::Reader> deduce_reader(const std::string &filename);
20 std::shared_ptr<HepMC3::Reader> deduce_reader(std::istream &stream);
21}
22#endif
23
24#ifndef HEPMC_HAS_CROSS_SECTION
25#define HEPMC_HAS_CROSS_SECTION
26#endif
27
28namespace Rivet {
29 namespace RivetHepMC = HepMC3;
30
31 using RivetHepMC::ConstGenParticlePtr;
32 using RivetHepMC::ConstGenVertexPtr;
33 using RivetHepMC::Relatives;
34 using RivetHepMC::ConstGenHeavyIonPtr;
35
36 using HepMC_IO_type = RivetHepMC::Reader;
37 using PdfInfo = RivetHepMC::GenPdfInfo;
38}
39
40
41namespace Rivet {
42
43
44 using RivetHepMC::GenEvent;
45 using ConstGenEventPtr = std::shared_ptr<const GenEvent>;
46
48 namespace HepMCUtils {
49 ConstGenParticlePtr getParticlePtr(const RivetHepMC::GenParticle & gp);
50 std::vector<ConstGenParticlePtr> particles(ConstGenEventPtr ge);
51 std::vector<ConstGenParticlePtr> particles(const GenEvent *ge);
52 std::vector<ConstGenVertexPtr> vertices(ConstGenEventPtr ge);
53 std::vector<ConstGenVertexPtr> vertices(const GenEvent *ge);
54 std::vector<ConstGenParticlePtr> particles(ConstGenVertexPtr gv, const Relatives &relo);
55 std::vector<ConstGenParticlePtr> particles(ConstGenParticlePtr gp, const Relatives &relo);
56 int uniqueId(ConstGenParticlePtr gp);
57 int particles_size(ConstGenEventPtr ge);
58 int particles_size(const GenEvent* ge);
59 std::pair<ConstGenParticlePtr,ConstGenParticlePtr> beams(const GenEvent* ge);
60 std::shared_ptr<HepMC_IO_type> makeReader(std::string filename, std::shared_ptr<std::istream>& istrp, std::string* errm = 0);
61 bool readEvent(std::shared_ptr<HepMC_IO_type> io, std::shared_ptr<GenEvent> evt);
62 void strip(GenEvent & ge, const set<long>& stripid = {1, -1, 2, -2, 3,-3, 21});
63 vector<string> weightNames(const GenEvent& ge);
64 std::valarray<double> weights(const GenEvent& ge);
65 pair<double,double> crossSection(const GenEvent& ge, size_t index = 0);
66 }
67
68
69}
70
71#endif
ParticlePair beams(const Event &e)
Get beam particles from an event.
Definition MC_CENT_PPB_Projections.hh:10