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 final
 
 ExpressionEvaluatorCut (const edm::ParameterSet &c)
 
const std::string & name () const final
 
double value (const reco::CandidatePtr &cand) const final
 
 ~ExpressionEvaluatorCut () override
 
- Public Member Functions inherited from CutApplicatorBase
virtual CandidateType candidateType () const
 
 CutApplicatorBase ()
 
 CutApplicatorBase (const CutApplicatorBase &)=delete
 
 CutApplicatorBase (const edm::ParameterSet &c)
 
result_type operator() (const argument_type &) const final
 
virtual result_type operator() (const pat::ElectronPtr &) const
 
virtual result_type operator() (const pat::MuonPtr &) const
 
virtual result_type operator() (const pat::PhotonPtr &) const
 
virtual result_type operator() (const pat::TauPtr &) const
 
virtual result_type operator() (const reco::GsfElectronPtr &) const
 
virtual result_type operator() (const reco::MuonPtr &) const
 
virtual result_type operator() (const reco::PFTauPtr &) const
 
virtual result_type operator() (const reco::PhotonPtr &) const
 
CutApplicatorBaseoperator= (const CutApplicatorBase &)=delete
 
 ~CutApplicatorBase () override
 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
}
 
- Public Types inherited from candidate_functions::CandidateCut
using argument_type = reco::CandidatePtr
 
using result_type = bool
 

Detailed Description

Definition at line 6 of file ExpressionEvaluatorCut.cc.

Constructor & Destructor Documentation

◆ ExpressionEvaluatorCut()

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

Definition at line 22 of file ExpressionEvaluatorCut.cc.

23  : CutApplicatorBase(c), realname_(c.getParameter<std::string>("realCutName")) {
24  const std::string newline("\n");
25  const std::string close_function("; };");
26  const std::string candTypePreamble("CandidateType candidateType() const override final { return ");
27 
28  //construct the overload of candidateType()
29  const std::string& candType = c.getParameter<std::string>("candidateType");
30  const std::string candTypeExpr = candTypePreamble + candType + close_function;
31 
32  // read in the overload of operator()
33  const std::string& oprExpr = c.getParameter<std::string>("functionDef");
34 
35  // read in the overload of value()
36  const std::string& valExpr = c.getParameter<std::string>("valueDef");
37 
38  // concatenate and evaluate the expression
39  const std::string total_expr = (candTypeExpr + newline + oprExpr + newline + valExpr);
40  reco::ExpressionEvaluator eval("PhysicsTools/SelectorUtils", "CutApplicatorBase", total_expr);
41  cut_ = eval.expr<CutApplicatorBase>();
42 }

References c, cut_, reco::ExpressionEvaluator::expr(), and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~ExpressionEvaluatorCut()

ExpressionEvaluatorCut::~ExpressionEvaluatorCut ( )
inlineoverride

Definition at line 9 of file ExpressionEvaluatorCut.cc.

9 {};

Member Function Documentation

◆ asCandidate()

result_type ExpressionEvaluatorCut::asCandidate ( const argument_type cand) const
inlinefinalvirtual

Reimplemented from CutApplicatorBase.

Definition at line 11 of file ExpressionEvaluatorCut.cc.

11 { return (*cut_)(cand); }

References cut_.

◆ name()

const std::string& ExpressionEvaluatorCut::name ( void  ) const
inlinefinalvirtual

Reimplemented from CutApplicatorBase.

Definition at line 15 of file ExpressionEvaluatorCut.cc.

15 { return realname_; }

References realname_.

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

◆ value()

double ExpressionEvaluatorCut::value ( const reco::CandidatePtr cand) const
inlinefinalvirtual

Implements candidate_functions::CandidateCut.

Definition at line 13 of file ExpressionEvaluatorCut.cc.

13 { return cut_->value(cand); }

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

Member Data Documentation

◆ cut_

CutApplicatorBase* ExpressionEvaluatorCut::cut_
private

Definition at line 19 of file ExpressionEvaluatorCut.cc.

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

◆ realname_

const std::string ExpressionEvaluatorCut::realname_
private

Definition at line 18 of file ExpressionEvaluatorCut.cc.

Referenced by name().

CutApplicatorBase::CutApplicatorBase
CutApplicatorBase()
Definition: CutApplicatorBase.h:49
ExpressionEvaluatorCut::realname_
const std::string realname_
Definition: ExpressionEvaluatorCut.cc:18
cand
Definition: decayParser.h:32
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CutApplicatorBase
Definition: CutApplicatorBase.h:45
candidate_functions::CandidateCut::value
virtual double value(const reco::CandidatePtr &) const =0
ExpressionEvaluatorCut::cut_
CutApplicatorBase * cut_
Definition: ExpressionEvaluatorCut.cc:19
reco::ExpressionEvaluator
Definition: ExpressionEvaluator.h:8
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56