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 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::ExpressionEvaluatorCutWithEventContent ( const edm::ParameterSet c)

Definition at line 26 of file ExpressionEvaluatorCutWithEventContent.cc.

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

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 }

◆ ~ExpressionEvaluatorCutWithEventContent()

ExpressionEvaluatorCutWithEventContent::~ExpressionEvaluatorCutWithEventContent ( )
inlineoverride

Definition at line 9 of file ExpressionEvaluatorCutWithEventContent.cc.

9 {};

Member Function Documentation

◆ asCandidate()

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

Reimplemented from CutApplicatorBase.

Definition at line 11 of file ExpressionEvaluatorCutWithEventContent.cc.

References cut_.

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

◆ getEventContent()

void ExpressionEvaluatorCutWithEventContent::getEventContent ( const edm::EventBase event)
inlinefinalvirtual

◆ name()

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

◆ setConsumes()

void ExpressionEvaluatorCutWithEventContent::setConsumes ( edm::ConsumesCollector sumes)
inlinefinalvirtual

Implements CutApplicatorWithEventContentBase.

Definition at line 13 of file ExpressionEvaluatorCutWithEventContent.cc.

References cut_, and CutApplicatorWithEventContentBase::setConsumes().

13 { cut_->setConsumes(sumes); }
virtual void setConsumes(edm::ConsumesCollector &)=0

◆ value()

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

Implements candidate_functions::CandidateCut.

Definition at line 17 of file ExpressionEvaluatorCutWithEventContent.cc.

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

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

Member Data Documentation

◆ cut_

CutApplicatorWithEventContentBase* ExpressionEvaluatorCutWithEventContent::cut_
private

◆ realname_

const std::string ExpressionEvaluatorCutWithEventContent::realname_
private

Definition at line 22 of file ExpressionEvaluatorCutWithEventContent.cc.

Referenced by name().