CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
WSelector.h
Go to the documentation of this file.
4 
15 class WSelector : public EventSelector {
16 
17 public:
19  WSelector(edm::ParameterSet const& params) :
20  muonSrc_(params.getParameter<edm::InputTag>("muonSrc")),
21  metSrc_ (params.getParameter<edm::InputTag>("metSrc"))
22  {
23  double muonPtMin = params.getParameter<double>("muonPtMin");
24  double metMin = params.getParameter<double>("metMin");
25  push_back("Muon Pt", muonPtMin );
26  push_back("MET" , metMin );
27  set("Muon Pt"); set("MET");
28  wMuon_ = 0; met_ = 0;
29  if ( params.exists("cutsToIgnore") ){
30  setIgnoredCuts( params.getParameter<std::vector<std::string> >("cutsToIgnore") );
31  }
32  retInternal_ = getBitTemplate();
33  }
35  virtual ~WSelector() {}
37  pat::Muon const& wMuon() const { return *wMuon_;}
39  pat::MET const& met() const { return *met_; }
40 
42  virtual bool operator()( edm::EventBase const & event, pat::strbitset & ret){
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->size() > 0 ){
61  wMuon_ = &muons->at(0);
62  if( wMuon_->pt() > cut("Muon Pt", double()) || ignoreCut("Muon Pt") )
63  passCut(ret, "Muon Pt");
64  }
65  }
66  else{
67  passCut( ret, "Muon Pt");
68  }
69  }
70  setIgnored(ret);
71  return (bool)ret;
72  }
73 
74 protected:
80  pat::Muon const* wMuon_;
82  pat::MET const* met_;
83 };
Analysis-level MET class.
Definition: MET.h:42
T getParameter(std::string const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::InputTag muonSrc_
muon input
Definition: WSelector.h:76
edm::InputTag metSrc_
met input
Definition: WSelector.h:78
pat::Muon const & wMuon() const
return muon candidate of W boson
Definition: WSelector.h:37
WSelector(edm::ParameterSet const &params)
constructor
Definition: WSelector.h:19
pat::MET const & met() const
return MET of W boson
Definition: WSelector.h:39
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
virtual double pt() const
transverse momentum
strbitset & set(bool val=true)
set method of all bits
Definition: strbitset.h:144
A selector of events.
Definition: EventSelector.h:15
virtual ~WSelector()
destructor
Definition: WSelector.h:35
tuple muons
Definition: patZpeak.py:38
virtual bool operator()(edm::EventBase const &event, pat::strbitset &ret)
here is where the selection occurs
Definition: WSelector.h:42
pat::MET const * met_
MET from W boson.
Definition: WSelector.h:82
pat::Muon const * wMuon_
muon candidate from W boson
Definition: WSelector.h:80
Example class of an EventSelector to apply a simple W Boson selection.
Definition: WSelector.h:15
Analysis-level muon class.
Definition: Muon.h:51
void set(const std::string &name, int value)
set the flag, with a run-time name