13 #include <boost/shared_ptr.hpp>
14 #include <boost/algorithm/string/trim.hpp>
35 std::memcpy(
value, str.c_str(), len);
42 extern void mginit_(
int *npara, Param *params, Param *
values);
79 std::istringstream
ss(value);
89 if (!result.empty() && result[0] ==
'\'')
90 result = result.substr(1);
91 if (!result.empty() && result[result.length() - 1] ==
'\'')
92 result.resize(result.length() - 1);
101 value.begin(), (int(*)(int))std::toupper);
102 return value ==
"T" || value ==
"Y" || value==
"True" ||
103 value ==
"1" || value ==
".TRUE.";
108 const std::map<std::string, std::string> ¶ms,
111 std::map<std::string, std::string>::const_iterator pos =
113 if (pos == params.end())
115 return parseParameter<T>(pos->second);
120 const T &defValue)
const
127 runInitialized(
false)
130 if (mode ==
"inclusive") {
133 }
else if (mode ==
"exclusive") {
136 }
else if (mode ==
"auto")
140 <<
"Madgraph jet matching scheme requires \"mode\" "
141 "parameter to be set to either \"inclusive\", "
142 "\"exclusive\" or \"auto\"." << std::endl;
156 std::vector<std::string> elems;
157 std::stringstream
ss(list_excres);
160 while(std::getline(ss, item,
',')) {
161 elems.push_back(item);
182 std::set<std::string>
result;
183 result.insert(
"psFinalState");
184 result.insert(
"hepevt");
185 result.insert(
"pythia6");
189 static std::map<std::string, std::string>
192 std::map<std::string, std::string> params;
194 for(std::vector<std::string>::const_iterator iter = header.begin();
195 iter != header.end(); ++iter) {
197 if (line.empty() || line[0] ==
'#')
201 if (pos != std::string::npos)
204 pos = line.find(
'=');
205 if (pos == std::string::npos)
209 boost::algorithm::trim_copy(line.substr(pos + 1));
211 boost::algorithm::trim_copy(line.substr(0, pos));
221 const std::map<std::string, std::string> ¶ms,
229 <<
"The MGParamCMS header does not specify the jet "
230 "matching parameter \"" << name <<
"\", but it "
231 "is requested by the CMSSW configuration."
241 std::map<std::string, std::string>
parameters;
243 std::vector<std::string> header = runInfo->
findHeader(
"MGRunCard");
246 <<
"In order to use MadGraph jet matching, "
247 "the input file has to contain the corresponding "
248 "MadGraph headers." << std::endl;
254 std::vector<Param> params;
255 std::vector<Param>
values;
256 for(std::map<std::string, std::string>::const_iterator iter =
258 params.push_back(
" " + iter->first);
259 values.push_back(iter->second);
270 std::map<std::string, std::string> mgInfoCMS =
parseHeader(header);
272 for(std::map<std::string, std::string>::const_iterator iter =
273 mgInfoCMS.begin(); iter != mgInfoCMS.end(); ++iter) {
274 std::cout<<
"mgInfoCMS: "<<iter->first<<
" "<<iter->second<<std::endl;
288 int nparam = params.size();
289 mginit_(&nparam, ¶ms.front(), &values.front());
300 <<
"Run not initialized in JetMatchingMadgraph"
306 std::vector<std::string>
comments =
event->getComments();
307 if (comments.size() == 1)
309 std::istringstream
ss(comments[0].substr(1));
310 for(
int i = 0;
i < 1000;
i++)
322 <<
"Expected exactly one comment line per "
323 "event containing MadGraph parton scale "
328 for(
int i = 2;
i < hepeup->
NUP;
i++)
331 hepeup->
PUP[
i][0] * hepeup->
PUP[
i][0] +
332 hepeup->
PUP[
i][1] * hepeup->
PUP[
i][1] +
333 hepeup->
PUP[
i][4] * hepeup->
PUP[
i][4];
366 <<
"Run not initialized in JetMatchingMadgraph"
371 <<
"Event not initialized in JetMatchingMadgraph"
T getParameter(std::string const &) const
struct gen::OUTTREE outtree_
struct gen::MEMAIN memain_
struct gen::MEMAEV memaev_
virtual void init(const lhef::LHERunInfo *runInfo)
struct gen::PYPART pypart_
virtual void beforeHadronisation(const lhef::LHEEvent *event)
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())
std::vector< FiveVector > PUP
virtual int match(const lhef::LHEEvent *partonLevel, const std::vector< fastjet::PseudoJet > *jetInput)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
static std::map< std::string, std::string > parseHeader(const std::vector< std::string > &header)
JetMatchingMadgraph(const edm::ParameterSet ¶ms)
std::map< std::string, std::string > mgParams
void mginit_(int *npara, Param *params, Param *values)
std::set< std::string > capabilities() const
virtual void beforeHadronisationExec()
std::vector< std::string > findHeader(const std::string &tag) const
volatile std::atomic< bool > shutdown_flag false
virtual double getJetEtaMax() const
struct gen::UPPRIV uppriv_