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 override final {
12  return (*cut_)(cand);
13  }
14 
15  void setConsumes(edm::ConsumesCollector& sumes) override final {
16  cut_->setConsumes(sumes);
17  }
18 
19  void getEventContent(const edm::EventBase& event) override final {
21  }
22 
23  double value(const reco::CandidatePtr& cand) const override final {
24  return cut_->value(cand);
25  }
26 
27  const std::string& name() const override final { return realname_; }
28 
29 private:
32 };
33 
37  realname_(c.getParameter<std::string>("realCutName"))
38 {
39  const std::string newline("\n");
40  const std::string close_function("; };");
41  const std::string candTypePreamble("CandidateType candidateType() const override final { return ");
42 
43  //construct the overload of candidateType()
44  const std::string& candType = c.getParameter<std::string>("candidateType");
45  const std::string candTypeExpr = candTypePreamble + candType + close_function;
46 
47  // read in the overload of operator()
48  const std::string& oprExpr = c.getParameter<std::string>("functionDef");
49 
50  // read in the overload of value()
51  const std::string& valExpr = c.getParameter<std::string>("valueDef");
52 
53  // read in the overload of setConsumes()
54  const std::string& setConsumesExpr =
55  c.getParameter<std::string>("setConsumesDef");
56 
57  // read in the overload of getEventContent()
58  const std::string& getEventContentExpr =
59  c.getParameter<std::string>("getEventContentDef");
60 
61 
62  // concatenate and evaluate the expression
63  const std::string total_expr = ( candTypeExpr + newline +
64  oprExpr + newline +
65  valExpr + newline +
66  setConsumesExpr + newline +
67  getEventContentExpr );
68  reco::ExpressionEvaluator eval("PhysicsTools/SelectorUtils",
69  "CutApplicatorWithEventContentBase",
70  total_expr.c_str());
72 
73 }
74 
75 
78  "ExpressionEvaluatorCutWithEventContent");
T getParameter(std::string const &) const
void getEventContent(const edm::EventBase &event) override final
double value(const reco::CandidatePtr &cand) const override final
const std::string & name() const override final
virtual void getEventContent(const edm::EventBase &)=0
virtual double value(const reco::CandidatePtr &) const =0
void setConsumes(edm::ConsumesCollector &sumes) override final
result_type asCandidate(const argument_type &cand) const override final
#define DEFINE_EDM_PLUGIN(factory, type, name)
virtual void setConsumes(edm::ConsumesCollector &)=0
Definition: event.py:1