CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
ExpressionEvaluatorCut Class Reference
Inheritance diagram for ExpressionEvaluatorCut:
CutApplicatorBase candidate_functions::CandidateCut

Public Member Functions

result_type asCandidate (const argument_type &cand) const override final
 
 ExpressionEvaluatorCut (const edm::ParameterSet &c)
 
const std::string & name () const override final
 
double value (const reco::CandidatePtr &cand) const override final
 
virtual ~ExpressionEvaluatorCut ()
 
- Public Member Functions inherited from CutApplicatorBase
virtual CandidateType candidateType () const
 
 CutApplicatorBase ()
 
 CutApplicatorBase (const edm::ParameterSet &c)
 
 CutApplicatorBase (const CutApplicatorBase &)=delete
 
virtual result_type operator() (const argument_type &) const final
 
virtual result_type operator() (const reco::GsfElectronPtr &) const
 
virtual result_type operator() (const pat::ElectronPtr &) const
 
virtual result_type operator() (const reco::PhotonPtr &) const
 
virtual result_type operator() (const pat::PhotonPtr &) const
 
virtual result_type operator() (const reco::MuonPtr &) const
 
virtual result_type operator() (const pat::MuonPtr &) const
 
virtual result_type operator() (const reco::PFTauPtr &) const
 
virtual result_type operator() (const pat::TauPtr &) const
 
CutApplicatorBaseoperator= (const CutApplicatorBase &)=delete
 
virtual ~CutApplicatorBase ()
 Destructor. More...
 
- Public Member Functions inherited from candidate_functions::CandidateCut
 CandidateCut ()
 
virtual ~CandidateCut ()
 

Private Attributes

CutApplicatorBasecut_
 
const std::string realname_
 

Additional Inherited Members

- Public Types inherited from CutApplicatorBase
enum  CandidateType {
  NONE, ELECTRON, MUON, PHOTON,
  TAU, PATELECTRON, PATMUON, PATPHOTON,
  PATTAU
}
 

Detailed Description

Definition at line 6 of file ExpressionEvaluatorCut.cc.

Constructor & Destructor Documentation

ExpressionEvaluatorCut::ExpressionEvaluatorCut ( const edm::ParameterSet c)

Definition at line 27 of file ExpressionEvaluatorCut.cc.

References cut_, DEFINE_EDM_PLUGIN, edm::ParameterSet::getParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

27  :
29  realname_(c.getParameter<std::string>("realCutName"))
30 {
31  const std::string newline("\n");
32  const std::string close_function("; };");
33  const std::string candTypePreamble("CandidateType candidateType() const override final { return ");
34 
35  //construct the overload of candidateType()
36  const std::string& candType = c.getParameter<std::string>("candidateType");
37  const std::string candTypeExpr = candTypePreamble + candType + close_function;
38 
39  // read in the overload of operator()
40  const std::string& oprExpr = c.getParameter<std::string>("functionDef");
41 
42  // read in the overload of value()
43  const std::string& valExpr = c.getParameter<std::string>("valueDef");
44 
45  // concatenate and evaluate the expression
46  const std::string total_expr = ( candTypeExpr + newline +
47  oprExpr + newline +
48  valExpr );
49  reco::ExpressionEvaluator eval("PhysicsTools/SelectorUtils",
50  "CutApplicatorBase",
51  total_expr.c_str());
52  cut_ = eval.expr<CutApplicatorBase>();
53 }
T getParameter(std::string const &) const
virtual ExpressionEvaluatorCut::~ExpressionEvaluatorCut ( )
inlinevirtual

Definition at line 9 of file ExpressionEvaluatorCut.cc.

9 {};

Member Function Documentation

result_type ExpressionEvaluatorCut::asCandidate ( const argument_type &  cand) const
inlinefinaloverridevirtual

Reimplemented from CutApplicatorBase.

Definition at line 11 of file ExpressionEvaluatorCut.cc.

References cut_.

11  {
12  return (*cut_)(cand);
13  }
const std::string& ExpressionEvaluatorCut::name ( void  ) const
inlinefinaloverridevirtual

Reimplemented from CutApplicatorBase.

Definition at line 19 of file ExpressionEvaluatorCut.cc.

References realname_.

Referenced by config.CFG::__str__(), validation.Sample::digest(), and VIDSelectorBase.VIDSelectorBase::initialize().

19 { return realname_; }
double ExpressionEvaluatorCut::value ( const reco::CandidatePtr cand) const
inlinefinaloverridevirtual

Implements candidate_functions::CandidateCut.

Definition at line 15 of file ExpressionEvaluatorCut.cc.

References cut_, and candidate_functions::CandidateCut::value().

15  {
16  return cut_->value(cand);
17  }
virtual double value(const reco::CandidatePtr &) const =0

Member Data Documentation

CutApplicatorBase* ExpressionEvaluatorCut::cut_
private

Definition at line 23 of file ExpressionEvaluatorCut.cc.

Referenced by asCandidate(), ExpressionEvaluatorCut(), and value().

const std::string ExpressionEvaluatorCut::realname_
private

Definition at line 22 of file ExpressionEvaluatorCut.cc.

Referenced by name().