Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-19 09:06:54

0001 // -*- C++ -*-
0002 #ifndef RIVET_RivetHepMC_HH
0003 #define RIVET_RivetHepMC_HH
0004 
0005 #include "Rivet/Config/RivetConfig.hh"
0006 #include "Rivet/Tools/RivetSTL.hh"
0007 #include "Rivet/Tools/Exceptions.hh"
0008 #include <valarray>
0009 
0010 #include "HepMC3/HepMC3.h"
0011 #include "HepMC3/Relatives.h"
0012 #include "HepMC3/Reader.h"
0013 
0014 #include "HepMC3/Version.h"
0015 #if HEPMC3_VERSION_CODE >= 3003000
0016 #define HEPMC3_Z_SUPPORT 1
0017 #define HEPMC3_USE_COMPRESSION 1
0018 #endif
0019 #if HEPMC3_VERSION_CODE > 3002007
0020 #include "HepMC3/ReaderFactory.h"
0021 #else
0022 namespace HepMC3 {
0023   std::shared_ptr<HepMC3::Reader> deduce_reader(const std::string &filename);
0024   std::shared_ptr<HepMC3::Reader> deduce_reader(std::istream &stream);
0025 }
0026 #endif
0027 
0028 #ifndef HEPMC_HAS_CROSS_SECTION
0029 #define HEPMC_HAS_CROSS_SECTION
0030 #endif
0031 
0032 namespace Rivet {
0033   namespace RivetHepMC = HepMC3;
0034 
0035   using RivetHepMC::ConstGenParticlePtr;
0036   using RivetHepMC::ConstGenVertexPtr;
0037   using RivetHepMC::Relatives;
0038   using RivetHepMC::ConstGenHeavyIonPtr;
0039 
0040   using HepMC_IO_type = RivetHepMC::Reader;
0041   using PdfInfo = RivetHepMC::GenPdfInfo;
0042 }
0043 
0044 
0045 namespace Rivet {
0046 
0047 
0048   using RivetHepMC::GenEvent;
0049   using ConstGenEventPtr = std::shared_ptr<const GenEvent>;
0050 
0051   /// @todo Use MCUtils?
0052   namespace HepMCUtils {
0053     ConstGenParticlePtr              getParticlePtr(const RivetHepMC::GenParticle & gp);
0054     std::vector<ConstGenParticlePtr> particles(ConstGenEventPtr ge);
0055     std::vector<ConstGenParticlePtr> particles(const GenEvent *ge);
0056     std::vector<ConstGenVertexPtr>   vertices(ConstGenEventPtr ge);
0057     std::vector<ConstGenVertexPtr>   vertices(const GenEvent *ge);
0058     std::vector<ConstGenParticlePtr> particles(ConstGenVertexPtr gv, const Relatives &relo);
0059     std::vector<ConstGenParticlePtr> particles(ConstGenParticlePtr gp, const Relatives &relo);
0060     int uniqueId(ConstGenParticlePtr gp);
0061     int particles_size(ConstGenEventPtr ge);
0062     int particles_size(const GenEvent* ge);
0063     std::pair<ConstGenParticlePtr,ConstGenParticlePtr> beams(const GenEvent* ge);
0064     bool readEvent(std::shared_ptr<HepMC_IO_type> io, std::shared_ptr<GenEvent> evt);
0065     void strip(GenEvent & ge, const set<long>& stripid = {1, -1, 2, -2, 3,-3, 21});
0066     vector<string> weightNames(const GenEvent& ge);
0067     std::valarray<double> weights(const GenEvent& ge);
0068     pair<double,double> crossSection(const GenEvent& ge, size_t index = 0);
0069   }
0070 
0071 
0072 }
0073 
0074 #endif