Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated minimal pythia 8 interface changes for 8.200pre1 #5436

Merged
4 commits merged into from
Sep 22, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion FastSimulation/ParticleDecay/interface/PythiaDecays.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <HepMC/GenEvent.h>
#include <HepMC/GenParticle.h>
#include <Pythia8/Pythia.h>
#include <Pythia8/Pythia8ToHepMC.h>
#include "Pythia8Plugins/HepMC2.h"
#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
#include "SimDataFormats/GeneratorProducts/interface/GenRunInfoProduct.h"
#include "GeneratorInterface/ExternalDecays/interface/ExternalDecayDriver.h"
Expand Down
6 changes: 3 additions & 3 deletions FastSimulation/ParticleDecay/src/PythiaDecays.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ PythiaDecays::PythiaDecays(std::string program)
decayer.reset(new Pythia8::Pythia);
p8RndmEngine.reset(new gen::P8RndmEngine);
decayer->setRndmEnginePtr(p8RndmEngine.get());
decayer->readString("ProcessLevel:all = off");
decayer->readString("PartonLevel:FSRinResonances = off"); //?
decayer->readString("ProcessLevel:resonanceDecays = off"); //?
decayer->settings.flag("ProcessLevel:all",false);
decayer->settings.flag("PartonLevel:FSRinResonances",false);
decayer->settings.flag("ProcessLevel:resonanceDecays",false);
decayer->init();

// forbid all decays
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define Pythia8_SetNumberOfPartonsDynamically_H

#include "Pythia8/Pythia.h"
#include "Pythia8/Pythia8ToHepMC.h"
#include "Pythia8Plugins/HepMC2.h"
#include <unistd.h>

#include "HepMC/GenEvent.h"
Expand Down
2 changes: 1 addition & 1 deletion GeneratorInterface/Pythia8Interface/interface/Py8GunBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "FWCore/ParameterSet/interface/ParameterSet.h"

#include <Pythia8/Pythia.h>
#include <Pythia8/Pythia8ToHepMC.h>
#include <Pythia8Plugins/HepMC2.h>

// foward declarations
namespace edm {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "GeneratorInterface/Pythia8Interface/interface/P8RndmEngine.h"

#include <Pythia8/Pythia.h>
#include <Pythia8/Pythia8ToHepMC.h>
#include <Pythia8Plugins/HepMC2.h>

namespace CLHEP {
class HepRandomEngine;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#include "Pythia8/Pythia.h"
#include "Pythia8/LesHouches.h"
#include "Pythia8/Pythia8ToHepMC.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
@@ -1,7 +1,7 @@
#ifndef gen_Py8toJetInput_h
#define gen_Py8toJetInput_h

#include "Pythia8/FastJet3.h" // Py8 overhead on top of FastJets package
#include "Pythia8Plugins/FastJet3.h" // Py8 overhead on top of FastJets package
#include "Pythia8/Event.h"

namespace lhef {
Expand Down
64 changes: 42 additions & 22 deletions GeneratorInterface/Pythia8Interface/plugins/Pythia8Hadronizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "HepMC/GenParticle.h"

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

#include "GeneratorInterface/Pythia8Interface/interface/Py8InterfaceBase.h"

Expand Down Expand Up @@ -316,20 +316,29 @@ Pythia8Hadronizer::~Pythia8Hadronizer()

bool Pythia8Hadronizer::initializeForInternalPartons()
{

// pythiaEvent = &pythia->event;

if ( fInitialState == PP ) // default
{
fMasterGen->init(2212, 2212, comEnergy);
//fMasterGen->init(2212, 2212, comEnergy);
fMasterGen->settings.mode("Beams:idA", 2212);
fMasterGen->settings.mode("Beams:idB", 2212);
fMasterGen->settings.parm("Beams:eCM", comEnergy);
fMasterGen->init();
}
else if ( fInitialState == PPbar )
{
fMasterGen->init(2212, -2212, comEnergy);
//fMasterGen->init(2212, -2212, comEnergy);
fMasterGen->settings.mode("Beams:idA", 2212);
fMasterGen->settings.mode("Beams:idB", -2212);
fMasterGen->settings.parm("Beams:eCM", comEnergy);
fMasterGen->init();
}
else if ( fInitialState == ElectronPositron )
{
fMasterGen->init(11, -11, comEnergy);
//fMasterGen->init(11, -11, comEnergy);
fMasterGen->settings.mode("Beams:idA", 11);
fMasterGen->settings.mode("Beams:idB", -11);
fMasterGen->settings.parm("Beams:eCM", comEnergy);
fMasterGen->init();
}
else
{
Expand All @@ -349,8 +358,10 @@ bool Pythia8Hadronizer::initializeForInternalPartons()
}

// init decayer
fDecayer->readString("ProcessLevel:all = off"); // trick
fDecayer->readString("ProcessLevel::resonanceDecays=on");
//fDecayer->readString("ProcessLevel:all = off"); // trick
//fDecayer->readString("ProcessLevel::resonanceDecays=on");
fDecayer->settings.flag("ProcessLevel:all", false ); // trick
fDecayer->settings.flag("ProcessLevel:resonanceDecays", true );
fDecayer->init();

return true;
Expand All @@ -364,10 +375,13 @@ bool Pythia8Hadronizer::initializeForExternalPartons()

if(LHEInputFileName != string()) {

std::cout << std::endl;
std::cout << "LHE Input File Name = " << LHEInputFileName << std::endl;
std::cout << std::endl;
fMasterGen->init(LHEInputFileName);
edm::LogInfo("Pythia8Interface") << "Initialize direct pythia8 reading from LHE file "
<< LHEInputFileName;
edm::LogInfo("Pythia8Interface") << "Some LHE information can be not stored";
//fMasterGen->init(LHEInputFileName);
fMasterGen->settings.mode("Beams:frameType", 4);
fMasterGen->settings.word("Beams:LHEF", LHEInputFileName);
fMasterGen->init();

} else {

Expand Down Expand Up @@ -396,14 +410,18 @@ bool Pythia8Hadronizer::initializeForExternalPartons()
}
file.close();

std::string lhareadcmd = "SLHA:readFrom = 2";
std::string lhafilecmd = std::string("SLHA:file = ") + std::string(fname);

fMasterGen->readString(lhareadcmd);
fMasterGen->readString(lhafilecmd);
//std::string lhareadcmd = "SLHA:readFrom = 2";
//std::string lhafilecmd = std::string("SLHA:file = ") + std::string(fname);
//fMasterGen->readString(lhareadcmd);
//fMasterGen->readString(lhafilecmd);
fMasterGen->settings.mode("SLHA:readFrom", 2);
fMasterGen->settings.word("SLHA:file", std::string(fname));
}

fMasterGen->init(lhaUP.get());
//fMasterGen->init(lhaUP.get());
fMasterGen->settings.mode("Beams:frameType", 5);
fMasterGen->setLHAupPtr(lhaUP.get());
fMasterGen->init();

if (doslha) {
std::remove( fname );
Expand All @@ -420,8 +438,10 @@ bool Pythia8Hadronizer::initializeForExternalPartons()
}

// init decayer
fDecayer->readString("ProcessLevel:all = off"); // trick
fDecayer->readString("ProcessLevel::resonanceDecays=on");
//fDecayer->readString("ProcessLevel:all = off"); // trick
//fDecayer->readString("ProcessLevel::resonanceDecays=on");
fDecayer->settings.flag("ProcessLevel:all", false ); // trick
fDecayer->settings.flag("ProcessLevel:resonanceDecays", true );
fDecayer->init();

return true;
Expand All @@ -430,7 +450,7 @@ bool Pythia8Hadronizer::initializeForExternalPartons()

void Pythia8Hadronizer::statistics()
{
fMasterGen->statistics();
fMasterGen->stat();

double xsec = fMasterGen->info.sigmaGen(); // cross section in mb
xsec *= 1.0e9; // translate to pb (CMS/Gen "convention" as of May 2009)
Expand Down
2 changes: 1 addition & 1 deletion GeneratorInterface/Pythia8Interface/src/Py8GunBase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ void Py8GunBase::finalizeEvent()
void Py8GunBase::statistics()
{

fMasterGen->statistics();
fMasterGen->stat();

double xsec = fMasterGen->info.sigmaGen(); // cross section in mb
xsec *= 1.0e9; // translate to pb (CMS/Gen "convention" as of May 2009)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ bool Py8InterfaceBase:: declareSpecialSettings( const std::vector<std::string>&
void Py8InterfaceBase::statistics()
{

fMasterGen->statistics();
fMasterGen->stat();
return;

}
Expand Down
3 changes: 3 additions & 0 deletions GeneratorInterface/Pythia8Interface/test/pythia8ex2_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
)
)

# in order to use lhapdf PDF add a line like this to pythia8_example02:
# 'PDF:pSet = LHAPDF5:MRST2004nlo.LHpdf'

process.load("FWCore.MessageLogger.MessageLogger_cfi")
process.MessageLogger = cms.Service("MessageLogger",
cout = cms.untracked.PSet(
Expand Down