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 CutApplicatorWithEventContentBase &)=delete
 
 CutApplicatorWithEventContentBase (const edm::ParameterSet &c)
 
CutApplicatorWithEventContentBaseoperator= (const CutApplicatorWithEventContentBase &)=delete
 
 ~CutApplicatorWithEventContentBase () override
 Destructor. More...
 
- 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

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.

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 }

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

◆ ~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.

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

References cut_.

◆ 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

◆ value()

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

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().

ExpressionEvaluatorCutWithEventContent::cut_
CutApplicatorWithEventContentBase * cut_
Definition: ExpressionEvaluatorCutWithEventContent.cc:23
CutApplicatorWithEventContentBase::setConsumes
virtual void setConsumes(edm::ConsumesCollector &)=0
CutApplicatorWithEventContentBase::getEventContent
virtual void getEventContent(const edm::EventBase &)=0
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CutApplicatorWithEventContentBase::CutApplicatorWithEventContentBase
CutApplicatorWithEventContentBase()
Definition: CutApplicatorWithEventContentBase.h:21
cand
Definition: decayParser.h:32
candidate_functions::CandidateCut::value
virtual double value(const reco::CandidatePtr &) const =0
reco::ExpressionEvaluator
Definition: ExpressionEvaluator.h:8
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:46
event
Definition: event.py:1
ExpressionEvaluatorCutWithEventContent::realname_
const std::string realname_
Definition: ExpressionEvaluatorCutWithEventContent.cc:22
CutApplicatorWithEventContentBase
Definition: CutApplicatorWithEventContentBase.h:19