13 #include <boost/algorithm/string/trim.hpp> 32 std::memcpy(
value,
str.c_str(), len);
99 std::map<std::string, std::string>::const_iterator
pos =
params.find(
var);
102 return parseParameter<T>(
pos->second);
105 template <
typename T>
113 if (
mode ==
"inclusive") {
116 }
else if (
mode ==
"exclusive") {
119 }
else if (
mode ==
"auto")
122 throw cms::Exception(
"Generator|LHEInterface") <<
"Madgraph jet matching scheme requires \"mode\" " 123 "parameter to be set to either \"inclusive\", " 124 "\"exclusive\" or \"auto\"." 139 std::vector<std::string> elems;
140 std::stringstream
ss(list_excres);
143 while (std::getline(
ss,
item,
',')) {
144 elems.push_back(
item);
156 std::set<std::string>
result;
157 result.insert(
"psFinalState");
164 std::map<std::string, std::string>
params;
166 for (std::vector<std::string>::const_iterator iter =
header.begin(); iter !=
header.end(); ++iter) {
172 if (
pos != std::string::npos)
176 if (
pos == std::string::npos)
188 template <
typename T>
196 throw cms::Exception(
"Generator|PartonShowerVeto") <<
"The MGParamCMS header does not specify the jet " 197 "matching parameter \"" 200 "is requested by the CMSSW configuration." 209 std::map<std::string, std::string>
parameters;
211 std::vector<std::string>
header =
runInfo->findHeader(
"MGRunCard");
213 throw cms::Exception(
"Generator|PartonShowerVeto") <<
"In order to use MadGraph jet matching, " 214 "the input file has to contain the corresponding " 222 std::vector<Param>
params;
223 std::vector<Param>
values;
224 for (std::map<std::string, std::string>::const_iterator iter =
mgParams.begin(); iter !=
mgParams.end(); ++iter) {
225 params.push_back(
" " + iter->first);
226 values.push_back(iter->second);
238 for (std::map<std::string, std::string>::const_iterator iter = mgInfoCMS.begin(); iter != mgInfoCMS.end(); ++iter) {
239 std::cout <<
"mgInfoCMS: " << iter->first <<
" " << iter->second << std::endl;
251 int nparam =
params.size();
261 throw cms::Exception(
"Generator|PartonShowerVeto") <<
"Run not initialized in JetMatchingMadgraph" << std::endl;
264 std::vector<std::string> comments =
event->getComments();
265 if (comments.size() == 1) {
266 std::istringstream
ss(comments[0].substr(1));
267 for (
int i = 0;
i < 1000;
i++) {
275 edm::LogWarning(
"Generator|LHEInterface") <<
"Expected exactly one comment line per " 276 "event containing MadGraph parton scale " 281 for (
int i = 2;
i < hepeup->
NUP;
i++) {
282 double mt2 = hepeup->
PUP[
i][0] * hepeup->
PUP[
i][0] + hepeup->
PUP[
i][1] * hepeup->
PUP[
i][1] +
283 hepeup->
PUP[
i][4] * hepeup->
PUP[
i][4];
313 throw cms::Exception(
"Generator|LHEInterface") <<
"Run not initialized in JetMatchingMadgraph" << std::endl;
316 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