#include <GeneratorInterface/GenFilters/interface/RecoDiMuon.h>
Public Member Functions | |
virtual void | endJob () |
virtual bool | filter (Event &, const EventSetup &) |
RecoDiMuon (const edm::ParameterSet &) | |
~RecoDiMuon () | |
Private Attributes | |
double | diMuonPtMin_ |
InputTag | muonLabel_ |
unsigned int | nAccepted_ |
unsigned int | nEvents_ |
double | singleMuonPtMin_ |
Definition at line 32 of file RecoDiMuon.h.
RecoDiMuon::RecoDiMuon | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 27 of file RecoDiMuon.cc.
References diMuonPtMin_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), muonLabel_, and singleMuonPtMin_.
00027 : 00028 nEvents_(0), nAccepted_(0) 00029 { 00030 muonLabel_ = iConfig.getParameter<InputTag>("MuonLabel"); 00031 singleMuonPtMin_ = iConfig.getUntrackedParameter<double>("SingleMuonPtMin",20.); 00032 diMuonPtMin_ = iConfig.getUntrackedParameter<double>("DiMuonPtMin",5.); 00033 }
RecoDiMuon::~RecoDiMuon | ( | ) |
Reimplemented from edm::EDFilter.
Definition at line 40 of file RecoDiMuon.cc.
References lat::endl(), nAccepted_, and nEvents_.
00041 { 00042 edm::LogVerbatim("RecoDiMuon") 00043 << "Events read " << nEvents_ 00044 << " Events accepted " << nAccepted_ 00045 << "\nEfficiency " << ((double)nAccepted_)/((double)nEvents_) 00046 << std::endl; 00047 }
bool RecoDiMuon::filter | ( | edm::Event & | iEvent, | |
const EventSetup & | iSetup | |||
) | [virtual] |
Implements edm::EDFilter.
Definition at line 50 of file RecoDiMuon.cc.
References diMuonPtMin_, edm::Event::getByLabel(), edm::Handle< T >::isValid(), metsig::muon, muonLabel_, muons_cfi::muons, nAccepted_, nEvents_, and singleMuonPtMin_.
00051 { 00052 00053 nEvents_++; 00054 bool accepted = false; 00055 using namespace edm; 00056 00057 Handle<reco::TrackCollection> muons; 00058 00059 iEvent.getByLabel(muonLabel_, muons); 00060 if (!muons.isValid()) { 00061 edm::LogError("RecoDiMuon") << "FAILED to get Muon Track Collection. "; 00062 return false; 00063 } 00064 00065 if ( muons->empty() ) { 00066 return false; 00067 } 00068 00069 // at least one muons above a pt threshold singleMuonPtMin 00070 // or at least 2 muons above a pt threshold diMuonPtMin 00071 int nMuonOver2ndCut = 0; 00072 for(reco::TrackCollection::const_iterator muon = muons->begin(); muon != muons->end(); ++ muon ) { 00073 00074 if ( muon->pt() > singleMuonPtMin_ ) accepted = true; 00075 if ( muon->pt() > diMuonPtMin_ ) nMuonOver2ndCut++; 00076 } 00077 if ( nMuonOver2ndCut >= 2 ) accepted = true; 00078 00079 if ( accepted ) nAccepted_++; 00080 00081 return accepted; 00082 00083 }
double RecoDiMuon::diMuonPtMin_ [private] |
InputTag RecoDiMuon::muonLabel_ [private] |
unsigned int RecoDiMuon::nAccepted_ [private] |
unsigned int RecoDiMuon::nEvents_ [private] |
double RecoDiMuon::singleMuonPtMin_ [private] |