28 if (ps.
exists(
"useEvtGenPlugin")) {
30 string evtgenpath(std::getenv(
"EVTGENDATA"));
34 if (ps.
exists(
"evtgenDecFile")) {
39 if (ps.
exists(
"evtgenPdlFile")) {
44 if (ps.
exists(
"evtgenUserFile")) {
45 std::vector<std::string> user_decays = ps.
getParameter<std::vector<std::string> >(
"evtgenUserFile");
46 for (
unsigned int i = 0;
i < user_decays.size();
i++) {
52 if (ps.
exists(
"evtgenUserFileEmbedded")) {
53 std::vector<std::string> user_decay_lines =
54 ps.
getParameter<std::vector<std::string> >(
"evtgenUserFileEmbedded");
55 char tempslhaname[] =
"pythia8evtgenXXXXXX";
56 int fd = mkstemp(tempslhaname);
58 for (
unsigned int i = 0;
i < user_decay_lines.size();
i++) {
59 user_decay_lines.at(
i) +=
"\n";
60 write(
fd, user_decay_lines.at(
i).c_str(), user_decay_lines.at(
i).size());
71 fDecayer = std::make_unique<Pythia>();
74 fMasterGen->settings.addFlag(
"BiasedTauDecayer:filter",
false);
75 fMasterGen->settings.addFlag(
"BiasedTauDecayer:eDecays",
true);
76 fMasterGen->settings.addFlag(
"BiasedTauDecayer:muDecays",
true);
79 fMasterGen->settings.addFlag(
"ResonanceDecayFilter:filter",
false);
80 fMasterGen->settings.addFlag(
"ResonanceDecayFilter:exclusive",
false);
81 fMasterGen->settings.addFlag(
"ResonanceDecayFilter:eMuAsEquivalent",
false);
82 fMasterGen->settings.addFlag(
"ResonanceDecayFilter:eMuTauAsEquivalent",
false);
83 fMasterGen->settings.addFlag(
"ResonanceDecayFilter:allNuAsEquivalent",
false);
84 fMasterGen->settings.addFlag(
"ResonanceDecayFilter:udscAsEquivalent",
false);
85 fMasterGen->settings.addFlag(
"ResonanceDecayFilter:udscbAsEquivalent",
false);
86 fMasterGen->settings.addFlag(
"ResonanceDecayFilter:wzAsEquivalent",
false);
87 fMasterGen->settings.addMVec(
"ResonanceDecayFilter:mothers", std::vector<int>(),
false,
false, 0, 0);
88 fMasterGen->settings.addMVec(
"ResonanceDecayFilter:daughters", std::vector<int>(),
false,
false, 0, 0);
91 fMasterGen->settings.addFlag(
"PTFilter:filter",
false);
92 fMasterGen->settings.addMode(
"PTFilter:quarkToFilter", 5,
true,
true, 3, 6);
93 fMasterGen->settings.addParm(
"PTFilter:scaleToFilter", 0.4,
true,
true, 0.0, 10.);
94 fMasterGen->settings.addParm(
"PTFilter:quarkRapidity", 10.0,
true,
true, 0.0, 10.);
95 fMasterGen->settings.addParm(
"PTFilter:quarkPt", -.1,
true,
true, -.1, 100.);
98 fMasterGen->settings.addFlag(
"POWHEGres:calcScales",
false);
99 fMasterGen->settings.addFlag(
"POWHEG:bb4l",
false);
100 fMasterGen->settings.addFlag(
"POWHEG:bb4l:FSREmission:onlyDistance1",
false);
101 fMasterGen->settings.addFlag(
"POWHEG:bb4l:FSREmission:veto",
false);
102 fMasterGen->settings.addFlag(
"POWHEG:bb4l:FSREmission:dryRun",
false);
103 fMasterGen->settings.addFlag(
"POWHEG:bb4l:FSREmission:vetoAtPL",
false);
104 fMasterGen->settings.addFlag(
"POWHEG:bb4l:FSREmission:vetoQED",
false);
105 fMasterGen->settings.addFlag(
"POWHEG:bb4l:PartonLevel:veto",
false);
106 fMasterGen->settings.addFlag(
"POWHEG:bb4l:PartonLevel:excludeFSRConflicting",
false);
107 fMasterGen->settings.addFlag(
"POWHEG:bb4l:DEBUG",
false);
108 fMasterGen->settings.addFlag(
"POWHEG:bb4l:ScaleResonance:veto",
false);
109 fMasterGen->settings.addFlag(
"POWHEG:bb4l:FSREmission:vetoDipoleFrame",
false);
110 fMasterGen->settings.addFlag(
"POWHEG:bb4l:FSREmission:pTpythiaVeto",
false);
111 fMasterGen->settings.addParm(
"POWHEG:bb4l:pTminVeto", 10.0,
true,
true, 0.0, 10.);
116 fMasterGen->readString(
"Next:numberShowEvent = 0");
117 fDecayer->readString(
"Next:numberShowEvent = 0");
121 std::vector<edm::ParameterSet> randomizedParameters =
123 currentParameters = randomizedParameters[
randomIndex()];
131 if (
line->find(
"Random:") != std::string::npos)
132 throw cms::Exception(
"PythiaError") <<
"Attempted to set random number " 133 "using Pythia commands. Please use " 134 "the RandomNumberGeneratorService." 138 throw cms::Exception(
"PythiaError") <<
"Pythia 8 did not accept \"" << *
line <<
"\"." << std::endl;
140 if (
line->find(
"ParticleDecays:") != std::string::npos) {
142 throw cms::Exception(
"PythiaError") <<
"Pythia 8 Decayer did not accept \"" << *
line <<
"\"." << std::endl;
148 if (currentParameters.
exists(
"SLHAFileForPythia8")) {
152 fMasterGen->settings.mode(
"SLHA:readFrom", 2);
154 }
else if (currentParameters.
exists(
"SLHATableForPythia8")) {
158 }
else if (currentParameters.
exists(
"SLHATreeForPythia8")) {
160 std::unique_ptr<SLHAReaderBase>
reader =
170 char tempslhaname[] =
"pythia8SLHAtableXXXXXX";
171 int fd = mkstemp(tempslhaname);
172 write(
fd, slhatable.c_str(), slhatable.size());
177 fMasterGen->settings.mode(
"SLHA:readFrom", 2);
182 for (
size_t i = 0;
i <
pdgIds.size();
i++) {
184 std::ostringstream pyCard;
185 pyCard << PyID <<
":mayDecay=false";
187 if (
fMasterGen->particleData.isParticle(PyID)) {
191 <<
"recognize particle id = " << PyID << std::endl;
203 for (
unsigned int iss = 0; iss < settings.size(); iss++) {
204 if (settings[iss].
find(
"QED-brem-off") != std::string::npos) {
205 fMasterGen->readString(
"TimeShower:QEDshowerByL=off");
207 size_t fnd1 = settings[iss].find(
"Pythia8:");
208 if (fnd1 != std::string::npos) {
T getParameter(std::string const &) const
bool declareSpecialSettings(const std::vector< std::string > &)
bool declareStableParticles(const std::vector< int > &)
std::string fullPath() const
const_iterator begin() const
bool exists(std::string const ¶meterName) const
checks if a parameter exists
std::unique_ptr< Pythia8::Pythia > fDecayer
const_iterator end() const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void makeTmpSLHA(const std::string &)
T getUntrackedParameter(std::string const &, T const &) const
unsigned int maxEventsToPrint
std::string evtgenDecFile
edm::ParameterSet fParameters
unsigned int pythiaPylistVerbosity
bool pythiaHepMCVerbosity
std::unique_ptr< Pythia8::Pythia > fMasterGen
std::shared_ptr< P8RndmEngine > p8RndmEngine_
virtual void statistics()
std::vector< std::string > evtgenUserFiles
Log< level::Warning, false > LogWarning
std::string evtgenPdlFile
bool pythiaHepMCVerbosityParticles