CMS 3D CMS Logo

ExpressionEvaluatorCutWithEventContent.cc
Go to the documentation of this file.
3 
5 
7 public:
10 
11  result_type asCandidate(const argument_type& cand) const final { return (*cut_)(cand); }
12 
13  void setConsumes(edm::ConsumesCollector& sumes) final { cut_->setConsumes(sumes); }
14 
16 
17  double value(const reco::CandidatePtr& cand) const final { return cut_->value(cand); }
18 
19  const std::string& name() const final { return realname_; }
20 
21 private:
24 };
25 
27  : CutApplicatorWithEventContentBase(c), realname_(c.getParameter<std::string>("realCutName")) {
28  const std::string newline("\n");
29  const std::string close_function("; };");
30  const std::string candTypePreamble("CandidateType candidateType() const override final { return ");
31 
32  //construct the overload of candidateType()
33  const std::string& candType = c.getParameter<std::string>("candidateType");
34  const std::string candTypeExpr = candTypePreamble + candType + close_function;
35 
36  // read in the overload of operator()
37  const std::string& oprExpr = c.getParameter<std::string>("functionDef");
38 
39  // read in the overload of value()
40  const std::string& valExpr = c.getParameter<std::string>("valueDef");
41 
42  // read in the overload of setConsumes()
43  const std::string& setConsumesExpr = c.getParameter<std::string>("setConsumesDef");
44 
45  // read in the overload of getEventContent()
46  const std::string& getEventContentExpr = c.getParameter<std::string>("getEventContentDef");
47 
48  // concatenate and evaluate the expression
49  const std::string total_expr = (candTypeExpr + newline + oprExpr + newline + valExpr + newline + setConsumesExpr +
50  newline + getEventContentExpr);
51  reco::ExpressionEvaluator eval("PhysicsTools/SelectorUtils", "CutApplicatorWithEventContentBase", total_expr);
53 }
54 
57  "ExpressionEvaluatorCutWithEventContent");
ExpressionEvaluatorCutWithEventContent::cut_
CutApplicatorWithEventContentBase * cut_
Definition: ExpressionEvaluatorCutWithEventContent.cc:23
ExpressionEvaluatorCutWithEventContent::getEventContent
void getEventContent(const edm::EventBase &event) final
Definition: ExpressionEvaluatorCutWithEventContent.cc:15
watchdog.const
const
Definition: watchdog.py:83
ExpressionEvaluatorCutWithEventContent::setConsumes
void setConsumes(edm::ConsumesCollector &sumes) final
Definition: ExpressionEvaluatorCutWithEventContent.cc:13
candidate_functions::CandidateCut::result_type
bool result_type
Definition: CandidateCut.h:11
ExpressionEvaluatorTemplates.h
CutApplicatorWithEventContentBase.h
ExpressionEvaluatorCutWithEventContent::name
const std::string & name() const final
Definition: ExpressionEvaluatorCutWithEventContent.cc:19
CutApplicatorWithEventContentBase::setConsumes
virtual void setConsumes(edm::ConsumesCollector &)=0
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition: PluginFactory.h:124
CutApplicatorWithEventContentBase::getEventContent
virtual void getEventContent(const edm::EventBase &)=0
ExpressionEvaluatorCutWithEventContent::~ExpressionEvaluatorCutWithEventContent
~ExpressionEvaluatorCutWithEventContent() override
Definition: ExpressionEvaluatorCutWithEventContent.cc:9
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:36
ExpressionEvaluatorCutWithEventContent
Definition: ExpressionEvaluatorCutWithEventContent.cc:6
edmplugin::PluginFactory
Definition: PluginFactory.h:34
cand
Definition: decayParser.h:34
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
ExpressionEvaluatorCutWithEventContent::ExpressionEvaluatorCutWithEventContent
ExpressionEvaluatorCutWithEventContent(const edm::ParameterSet &c)
Definition: ExpressionEvaluatorCutWithEventContent.cc:26
edm::Ptr< Candidate >
ExpressionEvaluator.h
ExpressionEvaluatorCutWithEventContent::value
double value(const reco::CandidatePtr &cand) const final
Definition: ExpressionEvaluatorCutWithEventContent.cc:17
std
Definition: JetResolutionObject.h:76
candidate_functions::CandidateCut::value
virtual double value(const reco::CandidatePtr &) const =0
edm::EventBase
Definition: EventBase.h:46
ExpressionEvaluatorCutWithEventContent::asCandidate
result_type asCandidate(const argument_type &cand) const final
Definition: ExpressionEvaluatorCutWithEventContent.cc:11
reco::ExpressionEvaluator::expr
EXPR * expr() const
Definition: ExpressionEvaluator.h:14
reco::ExpressionEvaluator
Definition: ExpressionEvaluator.h:8
event
Definition: event.py:1
ExpressionEvaluatorCutWithEventContent::realname_
const std::string realname_
Definition: ExpressionEvaluatorCutWithEventContent.cc:22
edm::ConsumesCollector
Definition: ConsumesCollector.h:39
CutApplicatorWithEventContentBase
Definition: CutApplicatorWithEventContentBase.h:19