diff --git a/Generators/AtlasHepMC/AtlasHepMC/GenEvent.h b/Generators/AtlasHepMC/AtlasHepMC/GenEvent.h index 8d574751cca9e9726311b607f39145300772d794..27bb413999ee7f89afe8b59f9b5e9334d77f5a85 100644 --- a/Generators/AtlasHepMC/AtlasHepMC/GenEvent.h +++ b/Generators/AtlasHepMC/AtlasHepMC/GenEvent.h @@ -3,6 +3,93 @@ */ #ifndef ATLASHEPMC_GENEVENT_H #define ATLASHEPMC_GENEVENT_H +#ifdef HEPMC3 +#undef private +#undef protected +#include "HepMC3/GenEvent.h" +#include "HepMC3/GenHeavyIon.h" +#include "HepMC3/PrintStreams.h" +#include "AtlasHepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +namespace HepMC3 +{ +inline std::vector<HepMC3::GenParticlePtr>::const_iterator begin(HepMC3::GenEvent& e){ return e.particles().begin(); } +inline std::vector<HepMC3::GenParticlePtr>::const_iterator end(HepMC3::GenEvent& e){ return e.particles().end(); } +inline std::vector<HepMC3::ConstGenParticlePtr>::const_iterator begin(const HepMC3::GenEvent& e){ return e.particles().begin(); } +inline std::vector<HepMC3::ConstGenParticlePtr>::const_iterator end(const HepMC3::GenEvent& e){ return e.particles().end(); } +} + +namespace HepMC { +using Print=HepMC3::Print; +using GenHeavyIon=HepMC3::GenHeavyIon; +using GenEvent=HepMC3::GenEvent; + +inline std::vector<HepMC3::GenParticlePtr>::const_iterator begin(HepMC3::GenEvent& e){ return e.particles().begin(); } +inline std::vector<HepMC3::GenParticlePtr>::const_iterator end(HepMC3::GenEvent& e){ return e.particles().end(); } +inline std::vector<HepMC3::ConstGenParticlePtr>::const_iterator begin(const HepMC3::GenEvent& e){ return e.particles().begin(); } +inline std::vector<HepMC3::ConstGenParticlePtr>::const_iterator end(const HepMC3::GenEvent& e){ return e.particles().end(); } + +inline GenEvent* newGenEvent(const int signal_process_id, const int event_number ){ GenEvent* e= new GenEvent(); +std::shared_ptr<HepMC3::IntAttribute> signal_process_id_A = std::make_shared<HepMC3::IntAttribute>(signal_process_id); +e->add_attribute("signal_process_id",signal_process_id_A); +e->set_event_number(event_number); +return e; +} + +inline GenVertexPtr barcode_to_vertex(const GenEvent* e, int id ){ +auto vertices=((GenEvent*)e)->vertices(); +for (auto v: vertices) +{ +auto barcode_attr=e->attribute<HepMC3::IntAttribute>("barcode"); +if (!barcode_attr) continue; +if (barcode_attr->value()==id) return v; +} +if (-id>0&&-id<(int)vertices.size()) return vertices[-id]; +return HepMC3::GenVertexPtr(); +} + +inline GenParticlePtr barcode_to_particle(const GenEvent* e, int id ){ +auto particles=((GenEvent*)e)->particles(); +for (auto p: particles) +{ +auto barcode_attr=p->attribute<HepMC3::IntAttribute>("barcode"); +if (!barcode_attr) continue; +if (barcode_attr->value()==id) return p; +} +if (id>0&&id<(int)particles.size()) return particles[id]; +return HepMC3::GenParticlePtr(); +} + + +inline int signal_process_id(const GenEvent evt) { +std::shared_ptr<HepMC3::IntAttribute> A_signal_process_id=evt.attribute<HepMC3::IntAttribute>("signal_process_id"); + return A_signal_process_id?(A_signal_process_id->value()):0; +} +inline int signal_process_id(const GenEvent* evt) { +std::shared_ptr<HepMC3::IntAttribute> A_signal_process_id=evt->attribute<HepMC3::IntAttribute>("signal_process_id"); + return A_signal_process_id?(A_signal_process_id->value()):0; +} +namespace Print { +inline void line(std::ostream& os,const GenEvent& e){e.print(os);} +inline void line(std::ostream& os,const GenEvent* e){e->print(os);} +} +inline bool valid_beam_particles(const GenEvent* e){return e->valid_beam_particles();} + +inline void set_signal_process_id(GenEvent* e, const int i=0) { std::shared_ptr<HepMC3::IntAttribute> signal_process_id = std::make_shared<HepMC3::IntAttribute>(i); + e->add_attribute("signal_process_id",signal_process_id); } +inline void set_random_states(GenEvent* e, std::vector<long int>& a) { + e->add_attribute("random_states",std::make_shared<HepMC3::VectorLongIntAttribute>(a)); +} +template <class T> void set_signal_process_vertex(GenEvent* e, T v){ +if (!v) return; +if (v->parent_event()!=e) return; +v->add_attribute("signal_process_vertex",std::make_shared<HepMC3::IntAttribute>(1)); +} +inline ConstGenVertexPtr signal_process_vertex(const GenEvent* e) { for (auto v: e->vertices()) if (v->attribute<HepMC3::IntAttribute>("signal_process_vertex")) return v; return nullptr; } +inline GenVertexPtr signal_process_vertex(GenEvent* e) { for (auto v: e->vertices()) if (v->attribute<HepMC3::IntAttribute>("signal_process_vertex")) return v; return nullptr; } +inline bool valid_beam_particles(const GenEvent* e){ if (!e) return false; if (e->beams().size()!=2) return false; return true;} +} +#else #include "HepMC/GenEvent.h" #include "HepMC/GenVertex.h" #include "AtlasHepMC/GenVertex.h" @@ -38,3 +125,4 @@ inline bool valid_beam_particles(const GenEvent* e){return e->valid_beam_particl } #include "AtlasHepMC/SimpleVector.h" #endif +#endif diff --git a/Generators/AtlasHepMC/AtlasHepMC/GenEvent_fwd.h b/Generators/AtlasHepMC/AtlasHepMC/GenEvent_fwd.h index cea90d473a2737490e24494654f1b7ae4cb2c3a0..e7113d8ee86a94273a938281cd1164e0bc5a9e81 100644 --- a/Generators/AtlasHepMC/AtlasHepMC/GenEvent_fwd.h +++ b/Generators/AtlasHepMC/AtlasHepMC/GenEvent_fwd.h @@ -3,7 +3,14 @@ */ #ifndef ATLASHEPMC_GENEVENTFWD_H #define ATLASHEPMC_GENEVENTFWD_H +#ifdef HEPMC3 +namespace HepMC3 { class GenEvent; } +namespace HepMC { +using GenEvent=HepMC3::GenEvent; +} +#else namespace HepMC { class GenEvent; } #endif +#endif diff --git a/Generators/AtlasHepMC/AtlasHepMC/GenParticle.h b/Generators/AtlasHepMC/AtlasHepMC/GenParticle.h index d96e0e501729257f36efc86a34610d2c8f131ff6..a90880fb7d094f547919245be529a11697da3c7a 100644 --- a/Generators/AtlasHepMC/AtlasHepMC/GenParticle.h +++ b/Generators/AtlasHepMC/AtlasHepMC/GenParticle.h @@ -3,6 +3,35 @@ */ #ifndef ATLASHEPMC_GENPARTICLE_H #define ATLASHEPMC_GENPARTICLE_H +#ifdef HEPMC3 +#include "HepMC3/GenParticle.h" +#include "HepMC3/PrintStreams.h" +#include "AtlasHepMC/Polarization.h" +#include "AtlasHepMC/Flow.h" +namespace HepMC { +typedef HepMC3::GenParticlePtr GenParticlePtr; +typedef HepMC3::ConstGenParticlePtr ConstGenParticlePtr; +inline GenParticlePtr newGenParticlePtr(const HepMC3::FourVector &mom = HepMC3::FourVector::ZERO_VECTOR(), int pid = 0, int status = 0) { + return std::make_shared<HepMC3::GenParticle>(mom,pid,status); +} +inline GenParticlePtr newGenParticlePtr(const HepMC3::FourVector &mom, int pid , int status , HepMC::Flow fl, HepMC::Polarization pol) { + return std::make_shared<HepMC3::GenParticle>(mom,pid,status); +} +inline int barcode(GenParticlePtr p){ + std::shared_ptr<HepMC3::IntAttribute> barcode=p->attribute<HepMC3::IntAttribute>("barcode"); + return barcode?(barcode->value()):0; +} +inline int barcode(ConstGenParticlePtr p){ + std::shared_ptr<HepMC3::IntAttribute> barcode=p->attribute<HepMC3::IntAttribute>("barcode"); + return barcode?(barcode->value()):0; +} +inline int barcode(const HepMC3::GenParticle p){ + std::shared_ptr<HepMC3::IntAttribute> barcode=p.attribute<HepMC3::IntAttribute>("barcode"); + return barcode?(barcode->value()):0; +} +template <class T> void suggest_barcode(T p, int i){p->add_attribute("barcode",std::make_shared<HepMC3::IntAttribute>(i));} +} +#else #include "HepMC/GenParticle.h" namespace HepMC { typedef GenParticle* GenParticlePtr; @@ -12,6 +41,7 @@ inline GenParticlePtr newGenParticlePtr(const HepMC::FourVector &mom = HepMC::Fo } inline int barcode(GenParticle p) { return p.barcode(); } template <class T> inline int barcode(T p) { return p->barcode(); } +template <class T> void suggest_barcode(T p, int i){p->suggest_barcode(i);} inline void suggest_barcode(GenParticle p, int i){p.suggest_barcode(i);} template <class T> void suggest_barcode(T* p, int i){p->suggest_barcode(i);} namespace Print { @@ -20,3 +50,4 @@ inline void line(std::ostream& os,const GenParticle* p){p->print(os);} } } #endif +#endif diff --git a/Generators/AtlasHepMC/AtlasHepMC/GenParticle_fwd.h b/Generators/AtlasHepMC/AtlasHepMC/GenParticle_fwd.h index 15f0ac57861cc47993a7cf724f74579c20bb8a36..06e26fead4d681b2e6fb979afc8eab42ac9952d7 100644 --- a/Generators/AtlasHepMC/AtlasHepMC/GenParticle_fwd.h +++ b/Generators/AtlasHepMC/AtlasHepMC/GenParticle_fwd.h @@ -3,8 +3,16 @@ */ #ifndef ATLASHEPMC_GENPARTICLEFWD_H #define ATLASHEPMC_GENPARTICLEFWD_H +#ifdef HEPMC3 +#include "HepMC3/GenParticle_fwd.h" +namespace HepMC { +typedef HepMC3::GenParticlePtr GenParticlePtr; +typedef HepMC3::ConstGenParticlePtr ConstGenParticlePtr; +} +#else namespace HepMC { class GenParticle; typedef GenParticle* GenParticlePtr; } #endif +#endif diff --git a/Generators/AtlasHepMC/AtlasHepMC/GenRanges.h b/Generators/AtlasHepMC/AtlasHepMC/GenRanges.h index f07a1886e972f1b12bdb4eaa232bcafb03a47376..57349312ef42785f288cef5a067f239209d1da58 100644 --- a/Generators/AtlasHepMC/AtlasHepMC/GenRanges.h +++ b/Generators/AtlasHepMC/AtlasHepMC/GenRanges.h @@ -3,5 +3,9 @@ */ #ifndef ATLASHEPMC_GENRANGES_H #define ATLASHEPMC_GENRANGES_H +#ifdef HEPMC3 +#include "HepMC3/Version.h" +#else #include "HepMC/GenRanges.h" #endif +#endif diff --git a/Generators/AtlasHepMC/AtlasHepMC/GenVertex.h b/Generators/AtlasHepMC/AtlasHepMC/GenVertex.h index 8b7c2eb2e8d75e097aa4ca648f7c64ddef64553f..d34899f96f78c29a21d64d685086b26997ece045 100644 --- a/Generators/AtlasHepMC/AtlasHepMC/GenVertex.h +++ b/Generators/AtlasHepMC/AtlasHepMC/GenVertex.h @@ -3,6 +3,41 @@ */ #ifndef ATLASHEPMC_GENVERTEX_H #define ATLASHEPMC_GENVERTEX_H +#ifdef HEPMC3 +#include "HepMC3/GenVertex.h" +#include "HepMC3/PrintStreams.h" +namespace HepMC { +typedef HepMC3::GenVertexPtr GenVertexPtr; +typedef HepMC3::ConstGenVertexPtr ConstGenVertexPtr; +inline GenVertexPtr newGenVertexPtr(const HepMC3::FourVector &pos = HepMC3::FourVector::ZERO_VECTOR(),const int i=0) { + GenVertexPtr v=std::make_shared<HepMC3::GenVertex>(pos); + v->set_status(i); + return v; +} +inline int barcode(GenVertexPtr p){ + std::shared_ptr<HepMC3::IntAttribute> barcode=p->attribute<HepMC3::IntAttribute>("barcode"); + return barcode?(barcode->value()):0; +} +inline int barcode(ConstGenVertexPtr p){ + std::shared_ptr<HepMC3::IntAttribute> barcode=p->attribute<HepMC3::IntAttribute>("barcode"); + return barcode?(barcode->value()):0; +} +inline int barcode(HepMC3::GenVertex p){ + std::shared_ptr<HepMC3::IntAttribute> barcode=p.attribute<HepMC3::IntAttribute>("barcode"); + return barcode?(barcode->value()):0; +} + +inline std::vector<HepMC3::GenVertexPtr> DESCENDANTS(HepMC3::GenVertexPtr endvtx) +{ +return std::vector<HepMC3::GenVertexPtr>(); +} +inline std::vector<HepMC3::ConstGenVertexPtr> DESCENDANTS(HepMC3::ConstGenVertexPtr endvtx) +{ +return std::vector<HepMC3::ConstGenVertexPtr>(); +} +inline void* raw_pointer(GenVertexPtr p){ return p.get();} +} +#else #include "HepMC/GenVertex.h" namespace HepMC { typedef HepMC::GenVertex* GenVertexPtr; @@ -12,3 +47,4 @@ inline GenVertexPtr newGenVertexPtr(const HepMC::FourVector &pos = HepMC::FourVe } } #endif +#endif diff --git a/Generators/AtlasHepMC/AtlasHepMC/GenVertex_fwd.h b/Generators/AtlasHepMC/AtlasHepMC/GenVertex_fwd.h index 2c98b4f9dafe17533e948790226012f9efb13b6e..680b4f2d6303d1b1757d0880d630288bad920d58 100644 --- a/Generators/AtlasHepMC/AtlasHepMC/GenVertex_fwd.h +++ b/Generators/AtlasHepMC/AtlasHepMC/GenVertex_fwd.h @@ -3,8 +3,16 @@ */ #ifndef ATLASHEPMC_GENVERTEXFWD_H #define ATLASHEPMC_GENVERTEXFWD_H +#ifdef HEPMC3 +#include "HepMC3/GenVertex_fwd.h" +namespace HepMC { +typedef HepMC3::GenVertexPtr GenVertexPtr; +typedef HepMC3::ConstGenVertexPtr ConstGenVertexPtr; +} +#else namespace HepMC { class GenVertex; typedef HepMC::GenVertex* GenVertexPtr; } #endif +#endif diff --git a/Generators/AtlasHepMC/AtlasHepMC/HEPEVT_Wrapper.h b/Generators/AtlasHepMC/AtlasHepMC/HEPEVT_Wrapper.h index 40434b23f35ef4cfec50a647bc722fd1bf2ea8b7..6c9e621462eb4b0c13dc35fcc45f8c1f8bfe7f85 100644 --- a/Generators/AtlasHepMC/AtlasHepMC/HEPEVT_Wrapper.h +++ b/Generators/AtlasHepMC/AtlasHepMC/HEPEVT_Wrapper.h @@ -3,5 +3,13 @@ */ #ifndef ATLASHEPMC_HEPEVTWRAPPER_H #define ATLASHEPMC_HEPEVTWRAPPER_H +#ifdef HEPMC3 +#include "HepMC3/HEPEVT_Wrapper.h" +namespace HepMC +{ +typedef HepMC3::HEPEVT_Wrapper HEPEVT_Wrapper; +} +#else #include "HepMC/HEPEVT_Wrapper.h" #endif +#endif diff --git a/Generators/AtlasHepMC/AtlasHepMC/HeavyIon.h b/Generators/AtlasHepMC/AtlasHepMC/HeavyIon.h index d5019486d16f499e78182cd4a15962da2d8b612f..36f5c2484fb8759666e85e2ef132ffb9464a6d9b 100644 --- a/Generators/AtlasHepMC/AtlasHepMC/HeavyIon.h +++ b/Generators/AtlasHepMC/AtlasHepMC/HeavyIon.h @@ -3,5 +3,14 @@ */ #ifndef ATLASHEPMC_HEAVYION_H #define ATLASHEPMC_HEAVYION_H +#ifdef HEPMC3 +#include "HepMC3/GenHeavyIon.h" +#include "HepMC3/PrintStreams.h" +namespace HepMC { +typedef HepMC3::GenHeavyIonPtr GenHeavyIonPtr; +typedef HepMC3::GenHeavyIon GenHeavyIon; +} +#else #include "HepMC/HeavyIon.h" #endif +#endif diff --git a/Generators/AtlasHepMC/AtlasHepMC/IO_AsciiParticles.h b/Generators/AtlasHepMC/AtlasHepMC/IO_AsciiParticles.h index f08aa07f05ccabcabe8d0bcc1f111ba17e2cbbe9..2988e277731d4aa02b1cfe4c1de7d94e4384bd23 100644 --- a/Generators/AtlasHepMC/AtlasHepMC/IO_AsciiParticles.h +++ b/Generators/AtlasHepMC/AtlasHepMC/IO_AsciiParticles.h @@ -3,5 +3,9 @@ */ #ifndef ATLASHEPMC_IOASCIIPARTICLES_H #define ATLASHEPMC_IOASCIIPARTICLES_H +#ifdef HEPMC3 +#include "HepMC3/Version.h" +#else #include "HepMC/IO_AsciiParticles.h" #endif +#endif diff --git a/Generators/AtlasHepMC/AtlasHepMC/IO_BaseClass.h b/Generators/AtlasHepMC/AtlasHepMC/IO_BaseClass.h index b41a56970177b93c0d3ec35e5f846b03172d385a..26a0e105b4a2a62271601735386ecf824f8556e2 100644 --- a/Generators/AtlasHepMC/AtlasHepMC/IO_BaseClass.h +++ b/Generators/AtlasHepMC/AtlasHepMC/IO_BaseClass.h @@ -3,5 +3,9 @@ */ #ifndef ATLASHEPMC_IOBASECLASS_H #define ATLASHEPMC_IOBASECLASS_H +#ifdef HEPMC3 +#include "HepMC3/Version.h" +#else #include "HepMC/IO_BaseClass.h" #endif +#endif diff --git a/Generators/AtlasHepMC/AtlasHepMC/IO_GenEvent.h b/Generators/AtlasHepMC/AtlasHepMC/IO_GenEvent.h index 145f50b91cba9e6635fda35b5afdb07cb19cb55d..93d4a0254f7efefc55187cf11e8dde33f47eeda9 100644 --- a/Generators/AtlasHepMC/AtlasHepMC/IO_GenEvent.h +++ b/Generators/AtlasHepMC/AtlasHepMC/IO_GenEvent.h @@ -3,5 +3,18 @@ */ #ifndef ATLASHEPMC_IOGENEVENT_H #define ATLASHEPMC_IOGENEVENT_H +#ifdef HEPMC3 +#include "HepMC3/Version.h" +#include "HepMC3/Reader.h" +#include "HepMC3/Writer.h" +#include "HepMC3/ReaderAsciiHepMC2.h" +#include "HepMC3/WriterAsciiHepMC2.h" +namespace HepMC +{ +typedef HepMC3::WriterAsciiHepMC2 WriterAsciiHepMC2; +typedef HepMC3::ReaderAsciiHepMC2 ReaderAsciiHepMC2; +} +#else #include "HepMC/IO_GenEvent.h" #endif +#endif diff --git a/Generators/AtlasHepMC/AtlasHepMC/IO_HEPEVT.h b/Generators/AtlasHepMC/AtlasHepMC/IO_HEPEVT.h index 95152b32ebc554585b71daefb2cb957261a980cd..681ae7f2bdcbfdc82888436f2d53e7d46eb47858 100644 --- a/Generators/AtlasHepMC/AtlasHepMC/IO_HEPEVT.h +++ b/Generators/AtlasHepMC/AtlasHepMC/IO_HEPEVT.h @@ -3,5 +3,10 @@ */ #ifndef ATLASHEPMC_IOHEPEVT_H #define ATLASHEPMC_IOHEPEVT_H +#ifdef HEPMC3 +#include "HepMC3/Version.h" +#include "HepMC3/HEPEVT_Wrapper.h" +#else #include "HepMC/IO_HEPEVT.h" #endif +#endif diff --git a/Generators/AtlasHepMC/AtlasHepMC/IO_HERWIG.h b/Generators/AtlasHepMC/AtlasHepMC/IO_HERWIG.h index 9eb2314399e0e3c51446b928f5a45d8891eebe16..f6567ecb4d4dc7de8727a8a11bf63c8ed36f9ac0 100644 --- a/Generators/AtlasHepMC/AtlasHepMC/IO_HERWIG.h +++ b/Generators/AtlasHepMC/AtlasHepMC/IO_HERWIG.h @@ -3,5 +3,9 @@ */ #ifndef ATLASHEPMC_IOHERWIG_H #define ATLASHEPMC_IOHERWIG_H +#ifdef HEPMC3 +#include "HepMC3/Version.h" +#else #include "HepMC/IO_HERWIG.h" #endif +#endif diff --git a/Generators/AtlasHepMC/AtlasHepMC/PdfInfo.h b/Generators/AtlasHepMC/AtlasHepMC/PdfInfo.h index bf074824222a744e0edee01cf54db14ced225ab5..7b2455445501118b5caac2fb057a54327ff9dab4 100644 --- a/Generators/AtlasHepMC/AtlasHepMC/PdfInfo.h +++ b/Generators/AtlasHepMC/AtlasHepMC/PdfInfo.h @@ -3,9 +3,18 @@ */ #ifndef ATLASHEPMC_PDFINFO_H #define ATLASHEPMC_PDFINFO_H +#ifdef HEPMC3 +#include "HepMC3/GenEvent.h" +#include "HepMC3/PrintStreams.h" +namespace HepMC +{ +typedef std::shared_ptr<HepMC3::GenPdfInfo> GenPdfInfoPtr; +} +#else #include "HepMC/PdfInfo.h" namespace HepMC { typedef HepMC::PdfInfo* GenPdfInfoPtr; } #endif +#endif diff --git a/Generators/AtlasHepMC/AtlasHepMC/Polarization.h b/Generators/AtlasHepMC/AtlasHepMC/Polarization.h index 65033c4dff71973bc28b9e8a489bedaeec155b5c..c637be312b2f081984b71f51e47ed4106728057e 100644 --- a/Generators/AtlasHepMC/AtlasHepMC/Polarization.h +++ b/Generators/AtlasHepMC/AtlasHepMC/Polarization.h @@ -3,6 +3,36 @@ */ #ifndef ATLASHEPMC_POLARIZATION_H #define ATLASHEPMC_POLARIZATION_H +#ifdef HEPMC3 +#include "HepMC3/GenParticle.h" +#include "HepMC3/Attribute.h" +namespace HepMC +{ +class Polarization { +public: +Polarization( const double a=0.0, const double b=0.0): m_theta(a), m_phi(b) {}; +~Polarization(){}; +double theta() const { return m_theta;} +double phi() const { return m_phi;} +bool is_defined() const { if (std::abs(m_theta)<0.00001&&std::abs(m_phi)<0.00001) return false; return true; } +private: +double m_theta; +double m_phi; +}; +inline Polarization polarization(HepMC3::GenParticlePtr a){ + std::shared_ptr<HepMC3::DoubleAttribute> phi_A =a->attribute<HepMC3::DoubleAttribute>("phi"); + std::shared_ptr<HepMC3::DoubleAttribute> theta_A=a->attribute<HepMC3::DoubleAttribute>("theta"); + double phi=(phi_A?phi_A->value():0.0); + double theta=(theta_A?theta_A->value():0.0); + return Polarization(theta,phi); +} +template<class T> void set_polarization( T a, Polarization b) +{ +a->add_attribute("phi",std::make_shared<HepMC3::DoubleAttribute>(b.phi())); +a->add_attribute("theta",std::make_shared<HepMC3::DoubleAttribute>(b.theta())); +} +} +#else #include "HepMC/Polarization.h" namespace HepMC { @@ -14,3 +44,4 @@ template<class T> Polarization polarization(T a) { } } #endif +#endif diff --git a/Generators/AtlasHepMC/AtlasHepMC/SimpleVector.h b/Generators/AtlasHepMC/AtlasHepMC/SimpleVector.h index fe7a493ae59628c22a0bd1f19eaf096fe0820490..d65497de6d753075da90b94f1c294fbd4eafd9cd 100644 --- a/Generators/AtlasHepMC/AtlasHepMC/SimpleVector.h +++ b/Generators/AtlasHepMC/AtlasHepMC/SimpleVector.h @@ -3,5 +3,14 @@ */ #ifndef ATLASHEPMC_SIMPLEVECTOR_H #define ATLASHEPMC_SIMPLEVECTOR_H +#ifdef HEPMC3 +#include "HepMC3/FourVector.h" +#include "HepMC3/PrintStreams.h" +namespace HepMC +{ +typedef HepMC3::FourVector FourVector; +} +#else #include "HepMC/SimpleVector.h" #endif +#endif diff --git a/Generators/AtlasHepMC/AtlasHepMC/WeightContainer.h b/Generators/AtlasHepMC/AtlasHepMC/WeightContainer.h index ec680f6373c70877463ee5da54d940865cedda41..5dd69b24860844deac773cef6c7509b6ef56b189 100644 --- a/Generators/AtlasHepMC/AtlasHepMC/WeightContainer.h +++ b/Generators/AtlasHepMC/AtlasHepMC/WeightContainer.h @@ -3,5 +3,9 @@ */ #ifndef ATLASHEPMC_WEIGHTCONTAINER_H #define ATLASHEPMC_WEIGHTCONTAINER_H +#ifdef HEPMC3 +#include "HepMC3/Version.h" +#else #include "HepMC/WeightContainer.h" #endif +#endif diff --git a/Generators/AtlasHepMC/CMakeLists.txt b/Generators/AtlasHepMC/CMakeLists.txt index a4e5b03554e4748b74d7a671fc3225cde3dad3ed..4a50fb1e304f35914bd39bfafeedef65aceee0b3 100644 --- a/Generators/AtlasHepMC/CMakeLists.txt +++ b/Generators/AtlasHepMC/CMakeLists.txt @@ -5,6 +5,30 @@ atlas_subdir( AtlasHepMC ) # External(s) needed by the package. find_package( HepMC COMPONENTS HepMC HepMCfio ) +if (HEPMC3_USE) +# Component(s) in the package. +atlas_add_library( AtlasHepMCLib + AtlasHepMC/*.h + INTERFACE + PUBLIC_HEADERS AtlasHepMC + INCLUDE_DIRS ${HEPMC3_INCLUDE_DIRS} + LINK_LIBRARIES ${HEPMC3_HepMC3_LIBRARY} ) + +atlas_add_library( AtlasHepMCfioLib + AtlasHepMC/*.h + INTERFACE + PUBLIC_HEADERS AtlasHepMC + INCLUDE_DIRS ${HEPMC3_INCLUDE_DIRS} + ) + +atlas_add_library( AtlasHepMCsearchLib + AtlasHepMC/*.h + INTERFACE + PUBLIC_HEADERS AtlasHepMC + INCLUDE_DIRS ${HEPMC3_INCLUDE_DIRS} + LINK_LIBRARIES ${HEPMC3_HepMC3search_LIBRARY} ) + +else() # Component(s) in the package. atlas_add_library( AtlasHepMCLib AtlasHepMC/*.h @@ -13,9 +37,16 @@ atlas_add_library( AtlasHepMCLib INCLUDE_DIRS ${HEPMC_INCLUDE_DIRS} LINK_LIBRARIES ${_HEPMC_HepMC_library} ) +atlas_add_library( AtlasHepMCsearchLib + AtlasHepMC/*.h + INTERFACE + PUBLIC_HEADERS AtlasHepMC + INCLUDE_DIRS ${HEPMC_INCLUDE_DIRS} + ) atlas_add_library( AtlasHepMCfioLib AtlasHepMC/*.h INTERFACE PUBLIC_HEADERS AtlasHepMC INCLUDE_DIRS ${HEPMC_INCLUDE_DIRS} LINK_LIBRARIES ${_HEPMC_HepMCfio_library} ) +endif()