13 #include <boost/algorithm/string/trim.hpp> 32 std::memcpy(
value,
str.c_str(), len);
101 std::map<std::string, std::string>::const_iterator
pos =
params.find(
var);
104 return parseParameter<T>(
pos->second);
107 template <
typename T>
115 if (
mode ==
"inclusive") {
118 }
else if (
mode ==
"exclusive") {
121 }
else if (
mode ==
"auto")
124 throw cms::Exception(
"Generator|LHEInterface") <<
"Madgraph jet matching scheme requires \"mode\" " 125 "parameter to be set to either \"inclusive\", " 126 "\"exclusive\" or \"auto\"." 141 std::vector<std::string> elems;
142 std::stringstream
ss(list_excres);
145 while (std::getline(
ss,
item,
',')) {
146 elems.push_back(
item);
158 std::set<std::string>
result;
159 result.insert(
"psFinalState");
166 std::map<std::string, std::string>
params;
168 for (std::vector<std::string>::const_iterator iter =
header.begin(); iter !=
header.end(); ++iter) {
174 if (
pos != std::string::npos)
178 if (
pos == std::string::npos)
190 template <
typename T>
198 throw cms::Exception(
"Generator|PartonShowerVeto") <<
"The MGParamCMS header does not specify the jet " 199 "matching parameter \"" 202 "is requested by the CMSSW configuration." 211 std::map<std::string, std::string>
parameters;
213 std::vector<std::string>
header =
runInfo->findHeader(
"MGRunCard");
215 throw cms::Exception(
"Generator|PartonShowerVeto") <<
"In order to use MadGraph jet matching, " 216 "the input file has to contain the corresponding " 224 std::vector<Param>
params;
225 std::vector<Param>
values;
226 for (std::map<std::string, std::string>::const_iterator iter =
mgParams.begin(); iter !=
mgParams.end(); ++iter) {
227 params.push_back(
" " + iter->first);
228 values.push_back(iter->second);
240 for (std::map<std::string, std::string>::const_iterator iter = mgInfoCMS.begin(); iter != mgInfoCMS.end(); ++iter) {
241 std::cout <<
"mgInfoCMS: " << iter->first <<
" " << iter->second << std::endl;
253 int nparam =
params.size();
263 throw cms::Exception(
"Generator|PartonShowerVeto") <<
"Run not initialized in JetMatchingMadgraph" << std::endl;
266 std::vector<std::string> comments =
event->getComments();
267 if (comments.size() == 1) {
268 std::istringstream
ss(comments[0].substr(1));
269 for (
int i = 0;
i < 1000;
i++) {
277 edm::LogWarning(
"Generator|LHEInterface") <<
"Expected exactly one comment line per " 278 "event containing MadGraph parton scale " 283 for (
int i = 2;
i < hepeup->
NUP;
i++) {
284 double mt2 = hepeup->
PUP[
i][0] * hepeup->
PUP[
i][0] + hepeup->
PUP[
i][1] * hepeup->
PUP[
i][1] +
285 hepeup->
PUP[
i][4] * hepeup->
PUP[
i][4];
315 throw cms::Exception(
"Generator|LHEInterface") <<
"Run not initialized in JetMatchingMadgraph" << std::endl;
318 throw cms::Exception(
"Generator|LHEInterface") <<
"Event not initialized in JetMatchingMadgraph" << std::endl;
struct gen::OUTTREE outtree_
struct gen::MEMAIN memain_
struct gen::MEMAEV memaev_
std::set< std::string > capabilities() const override
void init(const lhef::LHERunInfo *runInfo) override
struct gen::PYPART pypart_
void beforeHadronisation(const lhef::LHEEvent *event) override
static T parseParameter(const std::string &value)
static void updateOrDie(const std::map< std::string, std::string > ¶ms, T ¶m, const std::string &name)
static T getParameter(const std::map< std::string, std::string > ¶ms, const std::string &var, const T &defValue=T())
int match(const lhef::LHEEvent *partonLevel, const std::vector< fastjet::PseudoJet > *jetInput) override
std::vector< FiveVector > PUP
~JetMatchingMadgraph() override
static std::map< std::string, std::string > parseHeader(const std::vector< std::string > &header)
JetMatchingMadgraph(const edm::ParameterSet ¶ms)
void beforeHadronisationExec() override
std::map< std::string, std::string > mgParams
void mginit_(int *npara, Param *params, Param *values)
Log< level::Warning, false > LogWarning
struct gen::UPPRIV uppriv_
double getJetEtaMax() const override