CMS 3D CMS Logo

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

Public Member Functions

result_type asCandidate (const argument_type &cand) const final
 
 ExpressionEvaluatorCutWithEventContent (const edm::ParameterSet &c)
 
void getEventContent (const edm::EventBase &event) final
 
const std::string & name () const final
 
void setConsumes (edm::ConsumesCollector &sumes) final
 
double value (const reco::CandidatePtr &cand) const final
 
 ~ExpressionEvaluatorCutWithEventContent () override
 
- Public Member Functions inherited from CutApplicatorWithEventContentBase
 CutApplicatorWithEventContentBase ()
 
 CutApplicatorWithEventContentBase (const edm::ParameterSet &c)
 
 CutApplicatorWithEventContentBase (const CutApplicatorWithEventContentBase &)=delete
 
CutApplicatorWithEventContentBaseoperator= (const CutApplicatorWithEventContentBase &)=delete
 
 ~CutApplicatorWithEventContentBase () override
 Destructor. More...
 
- Public Member Functions inherited from CutApplicatorBase
virtual CandidateType candidateType () const
 
 CutApplicatorBase ()
 
 CutApplicatorBase (const edm::ParameterSet &c)
 
 CutApplicatorBase (const CutApplicatorBase &)=delete
 
result_type operator() (const argument_type &) const override 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
 
 ~CutApplicatorBase () override
 Destructor. More...
 
- Public Member Functions inherited from candidate_functions::CandidateCut
 CandidateCut ()
 
virtual ~CandidateCut ()
 

Private Attributes

CutApplicatorWithEventContentBasecut_
 
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
 
- Protected Attributes inherited from CutApplicatorWithEventContentBase
std::unordered_map< std::string, edm::InputTagcontentTags_
 
std::unordered_map< std::string, edm::EDGetTokencontentTokens_
 

Detailed Description

Definition at line 6 of file ExpressionEvaluatorCutWithEventContent.cc.

Constructor & Destructor Documentation

ExpressionEvaluatorCutWithEventContent::ExpressionEvaluatorCutWithEventContent ( const edm::ParameterSet c)

Definition at line 35 of file ExpressionEvaluatorCutWithEventContent.cc.

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

35  :
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);
72 
73 }
T getParameter(std::string const &) const
ExpressionEvaluatorCutWithEventContent::~ExpressionEvaluatorCutWithEventContent ( )
inlineoverride

Definition at line 9 of file ExpressionEvaluatorCutWithEventContent.cc.

9 {};

Member Function Documentation

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

Reimplemented from CutApplicatorBase.

Definition at line 11 of file ExpressionEvaluatorCutWithEventContent.cc.

References cut_.

11  {
12  return (*cut_)(cand);
13  }
void ExpressionEvaluatorCutWithEventContent::getEventContent ( const edm::EventBase event)
inlinefinalvirtual

Implements CutApplicatorWithEventContentBase.

Definition at line 19 of file ExpressionEvaluatorCutWithEventContent.cc.

References cut_, and CutApplicatorWithEventContentBase::getEventContent().

19  {
20  cut_->getEventContent(event);
21  }
virtual void getEventContent(const edm::EventBase &)=0
const std::string& ExpressionEvaluatorCutWithEventContent::name ( void  ) const
inlinefinalvirtual
void ExpressionEvaluatorCutWithEventContent::setConsumes ( edm::ConsumesCollector sumes)
inlinefinalvirtual

Implements CutApplicatorWithEventContentBase.

Definition at line 15 of file ExpressionEvaluatorCutWithEventContent.cc.

References cut_, and CutApplicatorWithEventContentBase::setConsumes().

15  {
16  cut_->setConsumes(sumes);
17  }
virtual void setConsumes(edm::ConsumesCollector &)=0
double ExpressionEvaluatorCutWithEventContent::value ( const reco::CandidatePtr cand) const
inlinefinalvirtual

Implements candidate_functions::CandidateCut.

Definition at line 23 of file ExpressionEvaluatorCutWithEventContent.cc.

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

23  {
24  return cut_->value(cand);
25  }
virtual double value(const reco::CandidatePtr &) const =0

Member Data Documentation

CutApplicatorWithEventContentBase* ExpressionEvaluatorCutWithEventContent::cut_
private
const std::string ExpressionEvaluatorCutWithEventContent::realname_
private

Definition at line 30 of file ExpressionEvaluatorCutWithEventContent.cc.

Referenced by name().