CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RecoDiMuon.cc
Go to the documentation of this file.
1 
11 //-ap #include "Configuration/CSA06Skimming/interface/RecoDiMuon.h"
13 
16 
17 #include <iostream>
18 
20 
21 using namespace edm;
22 using namespace std;
23 
24 
26  nEvents_(0), nAccepted_(0)
27 {
28  muonLabel_ = iConfig.getParameter<InputTag>("MuonLabel");
29  singleMuonPtMin_ = iConfig.getUntrackedParameter<double>("SingleMuonPtMin",20.);
30  diMuonPtMin_ = iConfig.getUntrackedParameter<double>("DiMuonPtMin",5.);
31 }
32 
33 
35 {
36 }
37 
39 {
40  edm::LogVerbatim("RecoDiMuon")
41  << "Events read " << nEvents_
42  << " Events accepted " << nAccepted_
43  << "\nEfficiency " << ((double)nAccepted_)/((double)nEvents_)
44  << std::endl;
45 }
46 
47 // ------------ method called to skim the data ------------
49 {
50 
51  nEvents_++;
52  bool accepted = false;
53  using namespace edm;
54 
56 
57  iEvent.getByLabel(muonLabel_, muons);
58  if (!muons.isValid()) {
59  edm::LogError("RecoDiMuon") << "FAILED to get Muon Track Collection. ";
60  return false;
61  }
62 
63  if ( muons->empty() ) {
64  return false;
65  }
66 
67  // at least one muons above a pt threshold singleMuonPtMin
68  // or at least 2 muons above a pt threshold diMuonPtMin
69  int nMuonOver2ndCut = 0;
70  for(reco::TrackCollection::const_iterator muon = muons->begin(); muon != muons->end(); ++ muon ) {
71 
72  if ( muon->pt() > singleMuonPtMin_ ) accepted = true;
73  if ( muon->pt() > diMuonPtMin_ ) nMuonOver2ndCut++;
74  }
75  if ( nMuonOver2ndCut >= 2 ) accepted = true;
76 
77  if ( accepted ) nAccepted_++;
78 
79  return accepted;
80 
81 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
RecoDiMuon(const edm::ParameterSet &)
Definition: RecoDiMuon.cc:25
virtual bool filter(edm::Event &, const edm::EventSetup &)
Definition: RecoDiMuon.cc:48
unsigned int nAccepted_
Definition: RecoDiMuon.h:39
edm::InputTag muonLabel_
Definition: RecoDiMuon.h:35
int iEvent
Definition: GenABIO.cc:230
unsigned int nEvents_
Definition: RecoDiMuon.h:38
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:420
double singleMuonPtMin_
Definition: RecoDiMuon.h:36
tuple muons
Definition: patZpeak.py:38
double diMuonPtMin_
Definition: RecoDiMuon.h:37
virtual void endJob()
Definition: RecoDiMuon.cc:38