Skip to content

Commit

Permalink
Compatiblity with pythia 8303 (#415)
Browse files Browse the repository at this point in the history
* [pythia8] make code work with 8303

* compat with pythia83



* [pythia8] backwards compatibility

* [pythia8] backwards compatibility

* [pythia8] backwards compatibility
  • Loading branch information
vvolkl authored Oct 30, 2020
1 parent 5fcf957 commit 2fd166d
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
*~
spack*
Testing
*.pyc
*.root
*.png
Expand Down
30 changes: 30 additions & 0 deletions Generation/src/components/PythiaInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,11 @@ StatusCode PythiaInterface::initialize() {
}

m_setting = std::unique_ptr<Pythia8::amcnlo_unitarised_interface>(new Pythia8::amcnlo_unitarised_interface(scheme));
#if PYTHIA_VERSION_INTEGER < 8300
m_pythiaSignal->setUserHooksPtr(m_setting.get());
#else
m_pythiaSignal->setUserHooksPtr((Pythia8::UserHooksPtr) m_setting.get());
#endif
}

// For jet matching, initialise the respective user hooks code.
Expand All @@ -112,7 +116,11 @@ StatusCode PythiaInterface::initialize() {
if (!m_matching) {
return Error(" Failed to initialise jet matching structures.");
}
#if PYTHIA_VERSION_INTEGER < 8300
m_pythiaSignal->setUserHooksPtr(m_matching.get());
#else
m_pythiaSignal->setUserHooksPtr((Pythia8::UserHooksPtr) m_matching.get());
#endif
}

// jet clustering needed for matching
Expand Down Expand Up @@ -145,16 +153,25 @@ StatusCode PythiaInterface::initialize() {


m_powhegHooks = std::make_shared<Pythia8::PowhegHooks>();
#if PYTHIA_VERSION_INTEGER < 8300
m_pythiaSignal->addUserHooksPtr(m_powhegHooks.get());
#else
m_pythiaSignal->addUserHooksPtr((Pythia8::UserHooksPtr)m_powhegHooks.get());
#endif
}
bool resonanceDecayFilter = m_pythiaSignal->settings.flag("ResonanceDecayFilter:filter");
if (resonanceDecayFilter) {
m_resonanceDecayFilterHook = std::make_shared<ResonanceDecayFilterHook>();
#if PYTHIA_VERSION_INTEGER < 8300
m_pythiaSignal->addUserHooksPtr(m_resonanceDecayFilterHook.get());
#else
m_pythiaSignal->addUserHooksPtr((Pythia8::UserHooksPtr)m_resonanceDecayFilterHook.get());
#endif
}

// Set up evtGen
if (m_doEvtGenDecays) {
#if PYTHIA_VERSION_INTEGER < 8300
m_evtgen = new EvtGenDecays(
m_pythiaSignal.get(), // the pythia instance
m_EvtGenDecayFile.value(), // the file name of the evtgen decay file
Expand All @@ -166,6 +183,19 @@ StatusCode PythiaInterface::initialize() {
true, // a flag to limit decays based on the Pythia criteria (based on the particle decay vertex)
true, // a flag to use external models with EvtGen
false); // a flag if an FSR model should be passed to EvtGen (pay attention to this, default is true)
#else
m_evtgen = new Pythia8::EvtGenDecays(
m_pythiaSignal.get(), // the pythia instance
m_EvtGenDecayFile.value(), // the file name of the evtgen decay file
m_EvtGenParticleDataFile.value(), // the file name of the evtgen data file
nullptr, // the optional EvtExternalGenList pointer (must be be provided if the next argument is provided to avoid double initializations)
nullptr, // the EvtAbsRadCorr pointer to pass to EvtGen
1, // the mixing type to pass to EvtGen
false, // a flag to use XML files to pass to EvtGen
true, // a flag to limit decays based on the Pythia criteria (based on the particle decay vertex)
true, // a flag to use external models with EvtGen
false); // a flag if an FSR model should be passed to EvtGen (pay attention to this, default is true)
#endif
if (!m_UserDecayFile.empty()) {
m_evtgen->readDecayFile(m_UserDecayFile);
}
Expand Down
17 changes: 16 additions & 1 deletion Generation/src/components/PythiaInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,31 @@
#include "Pythia8Plugins/PowhegHooks.h"
#include "Pythia8Plugins/HepMC2.h"

class EvtGenDecays;

// Forward HepMC
namespace HepMC {
class GenEvent;
}
// Forward Pythia
#if PYTHIA_VERSION_INTEGER < 8300
class EvtGenDecays;
namespace Pythia8 {
class Pythia;
class SlowJet;
class JetMatchingMadgraph;
class amcnlo_unitarised_interface;
}
#else
namespace Pythia8 {
class EvtGenDecays;
class Pythia;
class SlowJet;
class JetMatchingMadgraph;
class amcnlo_unitarised_interface;
}

#endif

namespace fcc {
class FloatValueCollection;
}
Expand Down Expand Up @@ -89,7 +100,11 @@ class PythiaInterface : public GaudiTool, virtual public IHepMCProviderTool {

Gaudi::Property<std::vector<int>> m_evtGenExcludes{this, "EvtGenExcludes", {},
"Pdg IDs of particles not to decay with EvtGen"};
#if PYTHIA_VERSION_INTEGER < 8300
EvtGenDecays* m_evtgen = nullptr;
#else
Pythia8::EvtGenDecays* m_evtgen = nullptr;
#endif
};

#endif // GENERATION_PYTHIAINTERFACE_H

0 comments on commit 2fd166d

Please sign in to comment.