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