Skip to content

Commit

Permalink
Merge pull request #38452 from mkirsano/hepmc3-addp8plugin
Browse files Browse the repository at this point in the history
Add to Pythia8Interface the plugin that uses HepMC3
  • Loading branch information
cmsbuild authored Jul 18, 2022
2 parents 72051cc + 921a506 commit 0308349
Show file tree
Hide file tree
Showing 9 changed files with 1,525 additions and 1 deletion.
1 change: 1 addition & 0 deletions GeneratorInterface/Pythia8Interface/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<use name="pythia8"/>
<use name="evtgen"/>
<use name="hepmc"/>
<use name="hepmc3"/>
<use name="clhep"/>
<use name="root"/>
<export>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#ifndef gen_Py8HMC3InterfaceBase_h
#define gen_Py8HMC3InterfaceBase_h

#include <vector>
#include <string>

#include "GeneratorInterface/Core/interface/ParameterCollector.h"
#include "GeneratorInterface/Pythia8Interface/interface/P8RndmEngine.h"
#include "GeneratorInterface/Core/interface/BaseHadronizer.h"

#include <Pythia8/Pythia.h>
#include <Pythia8Plugins/HepMC3.h>

namespace Pythia8 {
class EvtGenDecays;
}

namespace CLHEP {
class HepRandomEngine;
}

namespace gen {

class Py8HMC3InterfaceBase : public BaseHadronizer {
public:
Py8HMC3InterfaceBase(edm::ParameterSet const& ps);
~Py8HMC3InterfaceBase() override = default;

virtual bool generatePartonsAndHadronize() = 0;
bool decay() { return true; } // NOT used - let's call it "design imperfection"
bool readSettings(int); // common func
void makeTmpSLHA(const std::string&); //helper for above
virtual bool initializeForInternalPartons() = 0;
bool declareStableParticles(const std::vector<int>&); // common func
bool declareSpecialSettings(const std::vector<std::string>&); // common func
virtual void finalizeEvent() = 0;
virtual void statistics();
virtual const char* classname() const = 0;

void p8SetRandomEngine(CLHEP::HepRandomEngine* v) { p8RndmEngine_.setRandomEngine(v); }
P8RndmEngine& randomEngine() { return p8RndmEngine_; }

protected:
std::unique_ptr<Pythia8::Pythia> fMasterGen;
std::unique_ptr<Pythia8::Pythia> fDecayer;
HepMC3::Pythia8ToHepMC3 toHepMC;
edm::ParameterSet fParameters;

unsigned int pythiaPylistVerbosity;
bool pythiaHepMCVerbosity;
bool pythiaHepMCVerbosityParticles;
unsigned int maxEventsToPrint;

// EvtGen plugin
//
bool useEvtGen;
std::shared_ptr<Pythia8::EvtGenDecays> evtgenDecays;
std::string evtgenDecFile;
std::string evtgenPdlFile;
std::vector<std::string> evtgenUserFiles;

std::string slhafile_;

private:
P8RndmEngine p8RndmEngine_;
};
} // namespace gen
#endif
15 changes: 15 additions & 0 deletions GeneratorInterface/Pythia8Interface/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,21 @@
<flags EDM_PLUGIN="1"/>
</library>

<library file="Pythia8HepMC3Hadronizer.cc,Py8toJetInput.cc,*Hook*.cc,LHA*.cc" name="GeneratorInterfacePythia8HepMC3Filters">
<use name="GeneratorInterface/PartonShowerVeto"/>
<use name="GeneratorInterface/ExternalDecays"/>
<use name="FWCore/Concurrency"/>
<use name="FWCore/MessageLogger"/>
<use name="FWCore/ParameterSet"/>
<use name="FWCore/ServiceRegistry"/>
<use name="FWCore/Utilities"/>
<use name="GeneratorInterface/Core"/>
<use name="hepmc3"/>
<use name="pythia8"/>
<use name="SimDataFormats/GeneratorProducts"/>
<flags EDM_PLUGIN="1"/>
</library>

<library file="Py*Gun.cc" name="GeneratorInterfacePythia8Guns">
<use name="GeneratorInterface/ExternalDecays"/>
<flags EDM_PLUGIN="1"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include "Pythia8/Pythia.h"
#include "Pythia8/LesHouches.h"
#include "Pythia8Plugins/HepMC2.h"
//#include "Pythia8Plugins/HepMC2.h"

#include "SimDataFormats/GeneratorProducts/interface/LesHouches.h"
#include "GeneratorInterface/LHEInterface/interface/LHERunInfo.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ Pythia8Hadronizer::Pythia8Hadronizer(const edm::ParameterSet &params)
nMEFiltered(-1),
nISRveto(0),
nFSRveto(0) {
ivhepmc = 2;
// J.Y.: the following 3 parameters are hacked "for a reason"
//
if (params.exists("PPbarInitialState")) {
Expand Down
Loading

0 comments on commit 0308349

Please sign in to comment.