32 if (ps.
exists(
"useEvtGenPlugin")) {
34 string evtgenpath(std::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 =
59 ps.
getParameter<std::vector<std::string> >(
"evtgenUserFileEmbedded");
60 char tempslhaname[] =
"pythia8evtgenXXXXXX";
61 int fd = mkstemp(tempslhaname);
63 for (
unsigned int i = 0;
i < user_decay_lines.size();
i++) {
64 user_decay_lines.at(
i) +=
"\n";
65 write(
fd, user_decay_lines.at(
i).c_str(), user_decay_lines.at(
i).size());
75 const string xmlDir =
"../share/Pythia8/xmldoc";
85 fMasterGen->settings.addFlag(
"BiasedTauDecayer:filter",
false);
86 fMasterGen->settings.addFlag(
"BiasedTauDecayer:eDecays",
true);
87 fMasterGen->settings.addFlag(
"BiasedTauDecayer:muDecays",
true);
90 fMasterGen->settings.addFlag(
"ResonanceDecayFilter:filter",
false);
91 fMasterGen->settings.addFlag(
"ResonanceDecayFilter:exclusive",
false);
92 fMasterGen->settings.addFlag(
"ResonanceDecayFilter:eMuAsEquivalent",
false);
93 fMasterGen->settings.addFlag(
"ResonanceDecayFilter:eMuTauAsEquivalent",
false);
94 fMasterGen->settings.addFlag(
"ResonanceDecayFilter:allNuAsEquivalent",
false);
95 fMasterGen->settings.addFlag(
"ResonanceDecayFilter:udscAsEquivalent",
false);
96 fMasterGen->settings.addFlag(
"ResonanceDecayFilter:udscbAsEquivalent",
false);
97 fMasterGen->settings.addFlag(
"ResonanceDecayFilter:wzAsEquivalent",
false);
98 fMasterGen->settings.addMVec(
"ResonanceDecayFilter:mothers", std::vector<int>(),
false,
false, 0, 0);
99 fMasterGen->settings.addMVec(
"ResonanceDecayFilter:daughters", std::vector<int>(),
false,
false, 0, 0);
102 fMasterGen->settings.addFlag(
"PTFilter:filter",
false);
103 fMasterGen->settings.addMode(
"PTFilter:quarkToFilter", 5,
true,
true, 3, 6);
104 fMasterGen->settings.addParm(
"PTFilter:scaleToFilter", 0.4,
true,
true, 0.0, 10.);
105 fMasterGen->settings.addParm(
"PTFilter:quarkRapidity", 10.0,
true,
true, 0.0, 10.);
106 fMasterGen->settings.addParm(
"PTFilter:quarkPt", -.1,
true,
true, -.1, 100.);
109 fMasterGen->settings.addFlag(
"TopRecoilHook:doTopRecoilIn",
false);
110 fMasterGen->settings.addFlag(
"TopRecoilHook:useOldDipoleIn",
false);
111 fMasterGen->settings.addFlag(
"TopRecoilHook:doListIn",
false);
114 fMasterGen->settings.addFlag(
"POWHEGres:calcScales",
false);
115 fMasterGen->settings.addFlag(
"POWHEG:bb4l",
false);
116 fMasterGen->settings.addFlag(
"POWHEG:bb4l:FSREmission:veto",
false);
117 fMasterGen->settings.addFlag(
"POWHEG:bb4l:FSREmission:vetoQED",
false);
118 fMasterGen->settings.addFlag(
"POWHEG:bb4l:DEBUG",
false);
119 fMasterGen->settings.addFlag(
"POWHEG:bb4l:ScaleResonance:veto",
false);
120 fMasterGen->settings.addFlag(
"POWHEG:bb4l:FSREmission:vetoDipoleFrame",
false);
121 fMasterGen->settings.addFlag(
"POWHEG:bb4l:FSREmission:pTpythiaVeto",
false);
122 fMasterGen->settings.addParm(
"POWHEG:bb4l:pTminVeto", 10.0,
true,
true, 0.0, 10.);
123 fMasterGen->settings.addFlag(
"POWHEG:bb4l:vetoAllRadtypes",
false);
128 fMasterGen->readString(
"Next:numberShowEvent = 0");
129 fDecayer->readString(
"Next:numberShowEvent = 0");
133 std::vector<edm::ParameterSet> randomizedParameters =
135 currentParameters = randomizedParameters[
randomIndex()];
143 if (
line->find(
"Random:") != std::string::npos)
144 throw cms::Exception(
"PythiaError") <<
"Attempted to set random number " 145 "using Pythia commands. Please use " 146 "the RandomNumberGeneratorService." 150 throw cms::Exception(
"PythiaError") <<
"Pythia 8 did not accept \"" << *
line <<
"\"." << std::endl;
152 if (
line->find(
"ParticleDecays:") != std::string::npos) {
154 throw cms::Exception(
"PythiaError") <<
"Pythia 8 Decayer did not accept \"" << *
line <<
"\"." << std::endl;
160 if (currentParameters.
exists(
"SLHAFileForPythia8")) {
164 fMasterGen->settings.mode(
"SLHA:readFrom", 2);
166 }
else if (currentParameters.
exists(
"SLHATableForPythia8")) {
170 }
else if (currentParameters.
exists(
"SLHATreeForPythia8")) {
172 std::unique_ptr<SLHAReaderBase>
reader =
182 char tempslhaname[] =
"pythia8SLHAtableXXXXXX";
183 int fd = mkstemp(tempslhaname);
184 write(
fd, slhatable.c_str(), slhatable.size());
189 fMasterGen->settings.mode(
"SLHA:readFrom", 2);
194 for (
size_t i = 0;
i <
pdgIds.size();
i++) {
202 std::ostringstream pyCard;
203 pyCard << PyID <<
":mayDecay=false";
205 if (
fMasterGen->particleData.isParticle(PyID)) {
209 <<
"recognize particle id = " << PyID << std::endl;
221 for (
unsigned int iss = 0; iss < settings.size(); iss++) {
222 if (settings[iss].
find(
"QED-brem-off") != std::string::npos) {
223 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
std::shared_ptr< P8RndmEngine > p8RndmEngine_
virtual void statistics()
std::unique_ptr< Pythia8::Pythia > fDecayer
void makeTmpSLHA(const std::string &)
std::string fullPath() const
HepMC::IO_AsciiParticles * ascii_io
const_iterator begin() const
bool exists(std::string const ¶meterName) const
checks if a parameter exists
const_iterator end() const
bool pythiaHepMCVerbosityParticles
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< std::string > evtgenUserFiles
T getUntrackedParameter(std::string const &, T const &) const
unsigned int pythiaPylistVerbosity
bool declareStableParticles(const std::vector< int > &)
std::string evtgenPdlFile
unsigned int maxEventsToPrint
bool pythiaHepMCVerbosity
std::string evtgenDecFile
std::unique_ptr< Pythia8::Pythia > fMasterGen
Log< level::Warning, false > LogWarning
edm::ParameterSet fParameters