CMS 3D CMS Logo

WSelectorFast.h
Go to the documentation of this file.
1 #ifndef PhysicsTools_FWLite_WSelectorFast_h
2 #define PhysicsTools_FWLite_WSelectorFast_h
6 
16 class WSelectorFast : public EventSelector {
17 public:
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_ = 0;
28  met_ = 0;
29  if (params.exists("cutsToIgnore")) {
30  setIgnoredCuts(params.getParameter<std::vector<std::string> >("cutsToIgnore"));
31  }
32  retInternal_ = getBitTemplate();
33  }
35  virtual ~WSelectorFast() {}
37  pat::Muon const& wMuon() const { return *wMuon_; }
39  pat::MET const& met() const { return *met_; }
40 
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(metIndex_, double()) || ignoreCut(metIndex_))
55  passCut(ret, metIndex_);
56  }
57  // get the highest pt muon, require to have pt > minimum
58  if (gotMuons) {
59  if (!ignoreCut(muonPtIndex_)) {
60  if (muons->size() > 0) {
61  wMuon_ = &muons->at(0);
62  if (wMuon_->pt() > cut(muonPtIndex_, double()) || ignoreCut(muonPtIndex_))
63  passCut(ret, muonPtIndex_);
64  }
65  } else {
66  passCut(ret, muonPtIndex_);
67  }
68  }
69  setIgnored(ret);
70  return (bool)ret;
71  }
72 
73 protected:
79  pat::Muon const* wMuon_;
81  pat::MET const* met_;
83  index_type muonPtIndex_;
85  index_type metIndex_;
86 };
87 #endif // PhysicsTools_FWLite_WSelectorFast_h
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:373
PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
TkAlMuonSelectors_cfi.cut
cut
Definition: TkAlMuonSelectors_cfi.py:5
WSelectorFast::metIndex_
index_type metIndex_
index for MET cut
Definition: WSelectorFast.h:85
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
WSelectorFast::metSrc_
edm::InputTag metSrc_
met input
Definition: WSelectorFast.h:77
edm
HLT enums.
Definition: AlignableModifier.h:19
Muon.h
WSelectorFast::wMuon_
pat::Muon const * wMuon_
muon candidate from W boson
Definition: WSelectorFast.h:79
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89287
reco::LeafCandidate::pt
double pt() const final
transverse momentum
Definition: LeafCandidate.h:146
pat::Muon
Analysis-level muon class.
Definition: Muon.h:51
WSelectorFast::wMuon
pat::Muon const & wMuon() const
return muon candidate of W boson
Definition: WSelectorFast.h:37
edm::Handle
Definition: AssociativeIterator.h:50
mhtProducer_cfi.muonPtMin
muonPtMin
Definition: mhtProducer_cfi.py:20
WSelectorFast::~WSelectorFast
virtual ~WSelectorFast()
destructor
Definition: WSelectorFast.h:35
WSelectorFast::met_
pat::MET const * met_
MET from W boson.
Definition: WSelectorFast.h:81
EventSelector.h
WSelectorFast::met
pat::MET const & met() const
return MET of W boson
Definition: WSelectorFast.h:39
edm::ParameterSet
Definition: ParameterSet.h:47
wplusjetsAnalysis_cfi.metMin
metMin
Definition: wplusjetsAnalysis_cfi.py:89
pat::MET
Analysis-level MET class.
Definition: MET.h:40
WSelectorFast::WSelectorFast
WSelectorFast(edm::ParameterSet const &params)
constructor
Definition: WSelectorFast.h:19
WSelectorFast
Definition: WSelectorFast.h:16
WSelectorFast::muonSrc_
edm::InputTag muonSrc_
muon input
Definition: WSelectorFast.h:75
MET.h
pat::strbitset
Definition: strbitset.h:23
WSelectorFast::operator()
virtual bool operator()(edm::EventBase const &event, pat::strbitset &ret)
here is where the selection occurs
Definition: WSelectorFast.h:42
edm::EventBase
Definition: EventBase.h:46
EventSelector
A selector of events.
Definition: EventSelector.h:16
event
Definition: event.py:1
WSelectorFast::muonPtIndex_
index_type muonPtIndex_
index for muon Pt cut
Definition: WSelectorFast.h:83
edm::InputTag
Definition: InputTag.h:15