![]() |
![]() |
00001 // Original Author: Dmytro Kovalskyi, UCSB 00002 // $Id: TopDiLeptonFilter.cc,v 1.5 2010/03/09 13:18:20 snaumann Exp $ 00003 #include "TopQuarkAnalysis/TopSkimming/plugins/TopDiLeptonFilter.h" 00004 #include "DataFormats/MuonReco/interface/MuonFwd.h" 00005 #include "DataFormats/MuonReco/interface/Muon.h" 00006 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" 00007 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h" 00008 #include "FWCore/Framework/interface/Frameworkfwd.h" 00009 #include "FWCore/Framework/interface/MakerMacros.h" 00010 #include "FWCore/Framework/interface/Event.h" 00011 #include "FWCore/Framework/interface/EventSetup.h" 00012 #include "FWCore/Framework/interface/MakerMacros.h" 00013 #include "DataFormats/Common/interface/Handle.h" 00014 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00015 00016 TopDiLeptonFilter::TopDiLeptonFilter(const edm::ParameterSet& iConfig) 00017 { 00018 thePtThreshold = iConfig.getParameter<double>("ptThreshold"); 00019 theElectronCollection = iConfig.getParameter<edm::InputTag>("electronCollection"); 00020 theMuonCollection = iConfig.getParameter<edm::InputTag>("muonCollection"); 00021 } 00022 00023 bool TopDiLeptonFilter::filter(edm::Event& iEvent, const edm::EventSetup& iSetup) 00024 { 00025 edm::Handle<reco::MuonCollection> muons; 00026 iEvent.getByLabel(theMuonCollection,muons); 00027 edm::Handle<reco::GsfElectronCollection> electrons; 00028 iEvent.getByLabel(theElectronCollection,electrons); 00029 00030 unsigned int nMuons = 0; 00031 unsigned int nElectrons = 0; 00032 for(reco::MuonCollection::const_iterator muon=muons->begin(); muon!=muons->end(); ++muon) 00033 if(muon->pt()>thePtThreshold) ++nMuons; 00034 for(reco::GsfElectronCollection::const_iterator electron=electrons->begin(); electron!=electrons->end(); ++electron) 00035 if(electron->pt()>thePtThreshold) ++nElectrons; 00036 00037 if (nMuons+nElectrons>1) 00038 return true; 00039 else 00040 return false; 00041 } 00042 00043 //define this as a plug-in 00044 DEFINE_FWK_MODULE(TopDiLeptonFilter); 00045 00046