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