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 | Protected Attributes
WSelector Class Reference

Example class of an EventSelector to apply a simple W Boson selection. More...

#include "PhysicsTools/FWLite/interface/WSelector.h"

Inheritance diagram for WSelector:
EventSelector

Public Member Functions

pat::MET const & met () const
 return MET of W boson More...
 
bool operator() (edm::EventBase const &event, pat::strbitset &ret) override
 here is where the selection occurs More...
 
pat::Muon const & wMuon () const
 return muon candidate of W boson More...
 
 WSelector (edm::ParameterSet const &params)
 constructor More...
 
 ~WSelector () override
 destructor More...
 
- Public Member Functions inherited from EventSelector
const std::vector< std::string > & description ()
 
 EventSelector ()
 
 EventSelector (const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
 
 EventSelector (const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
 
const std::string & name () const
 name of the module (from configuration) More...
 
virtual bool select (const edm::Event &) const =0
 decision of the selector module More...
 
virtual ~EventSelector ()
 

Protected Attributes

pat::MET const * met_
 MET from W boson. More...
 
edm::InputTag metSrc_
 met input More...
 
edm::InputTag muonSrc_
 muon input More...
 
pat::Muon const * wMuon_
 muon candidate from W boson More...
 
- Protected Attributes inherited from EventSelector
std::vector< std::string > description_
 
std::string name_
 

Detailed Description

Example class of an EventSelector to apply a simple W Boson selection.

Example class for of an EventSelector as defined in the SelectorUtils package. EventSelectors may be used to facilitate cutflows and to implement selections independent from the event loop in FWLite or full framework.

Definition at line 16 of file WSelector.h.

Constructor & Destructor Documentation

WSelector::WSelector ( edm::ParameterSet const &  params)
inline

constructor

Definition at line 19 of file WSelector.h.

References edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), met_, and wMuon_.

20  : muonSrc_(params.getParameter<edm::InputTag>("muonSrc")), metSrc_(params.getParameter<edm::InputTag>("metSrc")) {
21  double muonPtMin = params.getParameter<double>("muonPtMin");
22  double metMin = params.getParameter<double>("metMin");
23  push_back("Muon Pt", muonPtMin);
24  push_back("MET", metMin);
25  set("Muon Pt");
26  set("MET");
27  wMuon_ = nullptr;
28  met_ = nullptr;
29  if (params.exists("cutsToIgnore")) {
30  setIgnoredCuts(params.getParameter<std::vector<std::string> >("cutsToIgnore"));
31  }
32  retInternal_ = getBitTemplate();
33  }
edm::InputTag muonSrc_
muon input
Definition: WSelector.h:75
edm::InputTag metSrc_
met input
Definition: WSelector.h:77
pat::MET const * met_
MET from W boson.
Definition: WSelector.h:81
pat::Muon const * wMuon_
muon candidate from W boson
Definition: WSelector.h:79
WSelector::~WSelector ( )
inlineoverride

destructor

Definition at line 35 of file WSelector.h.

35 {}

Member Function Documentation

pat::MET const& WSelector::met ( ) const
inline

return MET of W boson

Definition at line 39 of file WSelector.h.

References met_.

Referenced by operator()().

39 { return *met_; }
pat::MET const * met_
MET from W boson.
Definition: WSelector.h:81
bool WSelector::operator() ( edm::EventBase const &  event,
pat::strbitset ret 
)
inlineoverride

here is where the selection occurs

Definition at line 42 of file WSelector.h.

References GOODCOLL_filter_cfg::cut, met(), met_, metSrc_, patZpeak::muons, muonSrc_, reco::LeafCandidate::pt(), runTheMatrix::ret, pat::strbitset::set(), and wMuon_.

42  {
43  ret.set(false);
44  // Handle to the muon collection
46  // Handle to the MET collection
48  // get the objects from the event
49  bool gotMuons = event.getByLabel(muonSrc_, muons);
50  bool gotMET = event.getByLabel(metSrc_, met);
51  // get the MET, require to be > minimum
52  if (gotMET) {
53  met_ = &met->at(0);
54  if (met_->pt() > cut("MET", double()) || ignoreCut("MET"))
55  passCut(ret, "MET");
56  }
57  // get the highest pt muon, require to have pt > minimum
58  if (gotMuons) {
59  if (!ignoreCut("Muon Pt")) {
60  if (!muons->empty()) {
61  wMuon_ = &muons->at(0);
62  if (wMuon_->pt() > cut("Muon Pt", double()) || ignoreCut("Muon Pt"))
63  passCut(ret, "Muon Pt");
64  }
65  } else {
66  passCut(ret, "Muon Pt");
67  }
68  }
69  setIgnored(ret);
70  return (bool)ret;
71  }
tuple ret
prodAgent to be discontinued
double pt() const final
transverse momentum
edm::InputTag muonSrc_
muon input
Definition: WSelector.h:75
edm::InputTag metSrc_
met input
Definition: WSelector.h:77
pat::MET const & met() const
return MET of W boson
Definition: WSelector.h:39
strbitset & set(bool val=true)
set method of all bits
Definition: strbitset.h:126
pat::MET const * met_
MET from W boson.
Definition: WSelector.h:81
tuple muons
Definition: patZpeak.py:39
pat::Muon const * wMuon_
muon candidate from W boson
Definition: WSelector.h:79
pat::Muon const& WSelector::wMuon ( ) const
inline

return muon candidate of W boson

Definition at line 37 of file WSelector.h.

References wMuon_.

37 { return *wMuon_; }
pat::Muon const * wMuon_
muon candidate from W boson
Definition: WSelector.h:79

Member Data Documentation

pat::MET const* WSelector::met_
protected

MET from W boson.

Definition at line 81 of file WSelector.h.

Referenced by met(), operator()(), and WSelector().

edm::InputTag WSelector::metSrc_
protected

met input

Definition at line 77 of file WSelector.h.

Referenced by operator()().

edm::InputTag WSelector::muonSrc_
protected

muon input

Definition at line 75 of file WSelector.h.

Referenced by operator()().

pat::Muon const* WSelector::wMuon_
protected

muon candidate from W boson

Definition at line 79 of file WSelector.h.

Referenced by operator()(), wMuon(), and WSelector().