CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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::InputTag
contentTags_
 
std::unordered_map
< std::string, edm::EDGetToken
contentTokens_
 

Detailed Description

Definition at line 6 of file ExpressionEvaluatorCutWithEventContent.cc.

Constructor & Destructor Documentation

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

Definition at line 26 of file ExpressionEvaluatorCutWithEventContent.cc.

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

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 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
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 { return (*cut_)(cand); }
void ExpressionEvaluatorCutWithEventContent::getEventContent ( const edm::EventBase event)
inlinefinalvirtual
const std::string& ExpressionEvaluatorCutWithEventContent::name ( void  ) const
inlinefinalvirtual
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
double ExpressionEvaluatorCutWithEventContent::value ( const reco::CandidatePtr cand) const
inlinefinalvirtual

Member Data Documentation

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

Definition at line 22 of file ExpressionEvaluatorCutWithEventContent.cc.

Referenced by name().