10 #include "boost/filesystem.hpp" 11 #include "boost/filesystem/path.hpp" 32 if(pythiaHepMCVerbosityParticles)
35 if ( ps.
exists(
"useEvtGenPlugin") ) {
38 string evtgenpath(getenv(
"EVTGENDATA"));
42 if (ps.
exists(
"evtgenDecFile")) {
47 if (ps.
exists(
"evtgenPdlFile")) {
52 if (ps.
exists(
"evtgenUserFile")) {
53 std::vector<std::string> user_decays = ps.
getParameter<std::vector<std::string> >(
"evtgenUserFile");
54 for (
unsigned int i=0;
i<user_decays.size();
i++) {
61 if (ps.
exists(
"evtgenUserFileEmbedded")) {
62 std::vector<std::string> user_decay_lines = ps.
getParameter<std::vector<std::string> >(
"evtgenUserFileEmbedded");
63 auto tmp_dir = boost::filesystem::temp_directory_path();
64 tmp_dir +=
"/%%%%-%%%%-%%%%-%%%%";
65 auto tmp_path = boost::filesystem::unique_path(tmp_dir);
67 FILE* tmpf = std::fopen(user_decay_tmp.c_str(),
"w");
69 edm::LogError(
"Py8InterfaceBase::~Py8InterfaceBase") <<
"Py8InterfaceBase::Py8InterfaceBase fails when trying to open a temporary file for embedded user.dec for EvtGenPlugin. Terminating program ";
72 for (
unsigned int i=0;
i<user_decay_lines.size();
i++) {
73 user_decay_lines.at(
i) +=
"\n";
74 std::fputs(user_decay_lines.at(
i).c_str(), tmpf);
91 fMasterGen->settings.addFlag(
"ResonanceDecayFilter:filter",
false);
92 fMasterGen->settings.addFlag(
"ResonanceDecayFilter:exclusive",
false);
93 fMasterGen->settings.addFlag(
"ResonanceDecayFilter:eMuAsEquivalent",
false);
94 fMasterGen->settings.addFlag(
"ResonanceDecayFilter:eMuTauAsEquivalent",
false);
95 fMasterGen->settings.addFlag(
"ResonanceDecayFilter:allNuAsEquivalent",
false);
96 fMasterGen->settings.addFlag(
"ResonanceDecayFilter:udscAsEquivalent",
false);
97 fMasterGen->settings.addFlag(
"ResonanceDecayFilter:udscbAsEquivalent",
false);
98 fMasterGen->settings.addFlag(
"ResonanceDecayFilter:wzAsEquivalent",
false);
99 fMasterGen->settings.addMVec(
"ResonanceDecayFilter:mothers",std::vector<int>(),
false,
false,0,0);
100 fMasterGen->settings.addMVec(
"ResonanceDecayFilter:daughters",std::vector<int>(),
false,
false,0,0);
103 fMasterGen->settings.addFlag(
"PTFilter:filter",
false);
104 fMasterGen->settings.addMode(
"PTFilter:quarkToFilter", 5 ,
true,
true,3, 6);
105 fMasterGen->settings.addParm(
"PTFilter:scaleToFilter", 0.4,
true,
true,0.0, 10.);
106 fMasterGen->settings.addParm(
"PTFilter:quarkRapidity",10.0,
true,
true,0.0, 10.);
107 fMasterGen->settings.addParm(
"PTFilter:quarkPt", -.1,
true,
true,-.1,100.);
110 fMasterGen->settings.addFlag(
"POWHEGres:calcScales",
false);
111 fMasterGen->settings.addFlag(
"POWHEG:bb4l",
false);
112 fMasterGen->settings.addFlag(
"POWHEG:bb4l:FSREmission:onlyDistance1",
false);
113 fMasterGen->settings.addFlag(
"POWHEG:bb4l:FSREmission:veto",
false);
114 fMasterGen->settings.addFlag(
"POWHEG:bb4l:FSREmission:dryRun",
false);
115 fMasterGen->settings.addFlag(
"POWHEG:bb4l:FSREmission:vetoAtPL",
false);
116 fMasterGen->settings.addFlag(
"POWHEG:bb4l:FSREmission:vetoQED",
false);
117 fMasterGen->settings.addFlag(
"POWHEG:bb4l:PartonLevel:veto",
false);
118 fMasterGen->settings.addFlag(
"POWHEG:bb4l:PartonLevel:excludeFSRConflicting",
false);
119 fMasterGen->settings.addFlag(
"POWHEG:bb4l:DEBUG",
false);
120 fMasterGen->settings.addFlag(
"POWHEG:bb4l:ScaleResonance:veto",
false);
121 fMasterGen->settings.addFlag(
"POWHEG:bb4l:FSREmission:vetoDipoleFrame",
false);
122 fMasterGen->settings.addFlag(
"POWHEG:bb4l:FSREmission:pTpythiaVeto",
false);
123 fMasterGen->settings.addParm(
"POWHEG:bb4l:pTminVeto",10.0,
true,
true,0.0, 10.);
128 fMasterGen->readString(
"Next:numberShowEvent = 0");
129 fDecayer->readString(
"Next:numberShowEvent = 0");
133 std::vector<edm::ParameterSet> randomizedParameters =
fParameters.
getParameter<std::vector<edm::ParameterSet> >(
"RandomizedParameters");
134 currentParameters = randomizedParameters[
randomIndex()];
145 if (
line->find(
"Random:") != std::string::npos)
146 throw cms::Exception(
"PythiaError") <<
"Attempted to set random number " 147 "using Pythia commands. Please use " "the RandomNumberGeneratorService." 151 <<
"Pythia 8 did not accept \"" 152 << *
line <<
"\"." << std::endl;
154 if (
line->find(
"ParticleDecays:") != std::string::npos) {
157 <<
"Pythia 8 Decayer did not accept \"" 158 << *
line <<
"\"." << std::endl;
165 if( currentParameters.
exists(
"SLHAFileForPythia8" ) ) {
169 fMasterGen->settings.mode(
"SLHA:readFrom", 2);
170 fMasterGen->settings.word(
"SLHA:file", f1.fullPath());
172 else if( currentParameters.
exists(
"SLHATableForPythia8" ) ) {
176 }
else if (currentParameters.
exists(
"SLHATreeForPythia8")) {
187 char tempslhaname[] =
"pythia8SLHAtableXXXXXX";
188 int fd = mkstemp(tempslhaname);
189 write(fd, slhatable.c_str(), slhatable.size());
194 fMasterGen->settings.mode(
"SLHA:readFrom", 2);
201 for (
size_t i=0;
i<pdgIds.size();
i++ )
209 int PyID = pdgIds[
i];
210 std::ostringstream pyCard ;
211 pyCard << PyID <<
":mayDecay=false";
213 if (
fMasterGen->particleData.isParticle( PyID ) ) {
218 <<
"recognize particle id = " 219 << PyID << std::endl;
232 for (
unsigned int iss=0; iss<settings.size(); iss++ ){
233 if ( settings[iss].
find(
"QED-brem-off") != std::string::npos ){
234 fMasterGen->readString(
"TimeShower:QEDshowerByL=off" );
237 size_t fnd1 = settings[iss].find(
"Pythia8:");
238 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
def create(alignables, pedeDump, additionalData, outputFile, config)
void makeTmpSLHA(const std::string &)
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
T get(const Candidate &c)