6 #include "boost/filesystem.hpp" 7 #include "boost/filesystem/path.hpp" 28 if(pythiaHepMCVerbosityParticles)
31 if ( ps.
exists(
"useEvtGenPlugin") ) {
34 string evtgenpath(getenv(
"EVTGENDATA"));
38 if (ps.
exists(
"evtgenDecFile")) {
43 if (ps.
exists(
"evtgenPdlFile")) {
48 if (ps.
exists(
"evtgenUserFile")) {
49 std::vector<std::string> user_decays = ps.
getParameter<std::vector<std::string> >(
"evtgenUserFile");
50 for (
unsigned int i=0;
i<user_decays.size();
i++) {
57 if (ps.
exists(
"evtgenUserFileEmbedded")) {
58 std::vector<std::string> user_decay_lines = ps.
getParameter<std::vector<std::string> >(
"evtgenUserFileEmbedded");
59 auto tmp_dir = boost::filesystem::temp_directory_path();
60 tmp_dir +=
"/%%%%-%%%%-%%%%-%%%%";
61 auto tmp_path = boost::filesystem::unique_path(tmp_dir);
63 FILE* tmpf = std::fopen(user_decay_tmp.c_str(),
"w");
65 edm::LogError(
"Py8InterfaceBase::~Py8InterfaceBase") <<
"Py8InterfaceBase::Py8InterfaceBase fails when trying to open a temporary file for embedded user.dec for EvtGenPlugin. Terminating program ";
68 for (
unsigned int i=0;
i<user_decay_lines.size();
i++) {
69 user_decay_lines.at(
i) +=
"\n";
70 std::fputs(user_decay_lines.at(
i).c_str(), tmpf);
87 fMasterGen->settings.addFlag(
"ResonanceDecayFilter:filter",
false);
88 fMasterGen->settings.addFlag(
"ResonanceDecayFilter:exclusive",
false);
89 fMasterGen->settings.addFlag(
"ResonanceDecayFilter:eMuAsEquivalent",
false);
90 fMasterGen->settings.addFlag(
"ResonanceDecayFilter:eMuTauAsEquivalent",
false);
91 fMasterGen->settings.addFlag(
"ResonanceDecayFilter:allNuAsEquivalent",
false);
92 fMasterGen->settings.addFlag(
"ResonanceDecayFilter:udscAsEquivalent",
false);
93 fMasterGen->settings.addFlag(
"ResonanceDecayFilter:udscbAsEquivalent",
false);
94 fMasterGen->settings.addFlag(
"ResonanceDecayFilter:wzAsEquivalent",
false);
95 fMasterGen->settings.addMVec(
"ResonanceDecayFilter:mothers",std::vector<int>(),
false,
false,0,0);
96 fMasterGen->settings.addMVec(
"ResonanceDecayFilter:daughters",std::vector<int>(),
false,
false,0,0);
99 fMasterGen->settings.addFlag(
"PTFilter:filter",
false);
100 fMasterGen->settings.addMode(
"PTFilter:quarkToFilter", 5 ,
true,
true,3, 6);
101 fMasterGen->settings.addParm(
"PTFilter:scaleToFilter", 0.4,
true,
true,0.0, 10.);
102 fMasterGen->settings.addParm(
"PTFilter:quarkRapidity",10.0,
true,
true,0.0, 10.);
103 fMasterGen->settings.addParm(
"PTFilter:quarkPt", -.1,
true,
true,-.1,100.);
106 fMasterGen->settings.addFlag(
"POWHEGres:calcScales",
false);
107 fMasterGen->settings.addFlag(
"POWHEG:bb4l",
false);
108 fMasterGen->settings.addFlag(
"POWHEG:bb4l:FSREmission:onlyDistance1",
false);
109 fMasterGen->settings.addFlag(
"POWHEG:bb4l:FSREmission:veto",
false);
110 fMasterGen->settings.addFlag(
"POWHEG:bb4l:FSREmission:dryRun",
false);
111 fMasterGen->settings.addFlag(
"POWHEG:bb4l:FSREmission:vetoAtPL",
false);
112 fMasterGen->settings.addFlag(
"POWHEG:bb4l:FSREmission:vetoQED",
false);
113 fMasterGen->settings.addFlag(
"POWHEG:bb4l:PartonLevel:veto",
false);
114 fMasterGen->settings.addFlag(
"POWHEG:bb4l:PartonLevel:excludeFSRConflicting",
false);
115 fMasterGen->settings.addFlag(
"POWHEG:bb4l:DEBUG",
false);
116 fMasterGen->settings.addFlag(
"POWHEG:bb4l:ScaleResonance:veto",
false);
117 fMasterGen->settings.addFlag(
"POWHEG:bb4l:FSREmission:vetoDipoleFrame",
false);
118 fMasterGen->settings.addFlag(
"POWHEG:bb4l:FSREmission:pTpythiaVeto",
false);
119 fMasterGen->settings.addParm(
"POWHEG:bb4l:pTminVeto",10.0,
true,
true,0.0, 10.);
124 fMasterGen->readString(
"Next:numberShowEvent = 0");
125 fDecayer->readString(
"Next:numberShowEvent = 0");
129 std::vector<edm::ParameterSet> randomizedParameters =
fParameters.
getParameter<std::vector<edm::ParameterSet> >(
"RandomizedParameters");
130 currentParameters = randomizedParameters[
randomIndex()];
141 if (
line->find(
"Random:") != std::string::npos)
142 throw cms::Exception(
"PythiaError") <<
"Attempted to set random number " 143 "using Pythia commands. Please use " "the RandomNumberGeneratorService." 147 <<
"Pythia 8 did not accept \"" 148 << *
line <<
"\"." << std::endl;
150 if (
line->find(
"ParticleDecays:") != std::string::npos) {
153 <<
"Pythia 8 Decayer did not accept \"" 154 << *
line <<
"\"." << std::endl;
161 if( currentParameters.
exists(
"SLHAFileForPythia8" ) ) {
165 fMasterGen->settings.mode(
"SLHA:readFrom", 2);
166 fMasterGen->settings.word(
"SLHA:file", f1.fullPath());
168 else if( currentParameters.
exists(
"SLHATableForPythia8" ) ) {
171 char tempslhaname[] =
"pythia8SLHAtableXXXXXX";
172 int fd = mkstemp(tempslhaname);
173 write(fd,slhatable.c_str(),slhatable.size());
178 fMasterGen->settings.mode(
"SLHA:readFrom", 2);
189 for (
size_t i=0;
i<pdgIds.size();
i++ )
197 int PyID = pdgIds[
i];
198 std::ostringstream pyCard ;
199 pyCard << PyID <<
":mayDecay=false";
201 if (
fMasterGen->particleData.isParticle( PyID ) ) {
206 <<
"recognize particle id = " 207 << PyID << std::endl;
220 for (
unsigned int iss=0; iss<settings.size(); iss++ ){
221 if ( settings[iss].
find(
"QED-brem-off") != std::string::npos ){
222 fMasterGen->readString(
"TimeShower:QEDshowerByL=off" );
225 size_t fnd1 = settings[iss].find(
"Pythia8:");
226 if ( fnd1 != std::string::npos ){
bool declareSpecialSettings(const std::vector< std::string > &)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
virtual void statistics()
std::auto_ptr< Pythia8::Pythia > fMasterGen
HepMC::IO_AsciiParticles * ascii_io
bool exists(std::string const ¶meterName) const
checks if a parameter exists
bool pythiaHepMCVerbosityParticles
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< std::string > evtgenUserFiles
P8RndmEngine p8RndmEngine_
unsigned int pythiaPylistVerbosity
bool declareStableParticles(const std::vector< int > &)
std::string evtgenPdlFile
unsigned int maxEventsToPrint
std::auto_ptr< Pythia8::Pythia > fDecayer
bool pythiaHepMCVerbosity
const_iterator end() const
std::string evtgenDecFile
const_iterator begin() const
std::string fullPath() const
edm::ParameterSet fParameters