Go to the documentation of this file.00001
00008
00009 #include "DPGAnalysis/Skims/interface/MuonPtFilter.h"
00010
00011
00012 #include "FWCore/Framework/interface/MakerMacros.h"
00013 #include "FWCore/Framework/interface/Frameworkfwd.h"
00014 #include "FWCore/Framework/interface/ESHandle.h"
00015 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00016
00017 #include "DataFormats/TrackReco/interface/Track.h"
00018 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00019
00020
00021
00022
00023
00024 using namespace std;
00025 using namespace edm;
00026
00027
00028
00030 MuonPtFilter::MuonPtFilter(const edm::ParameterSet& pset) {
00031
00032
00033 theSTAMuonLabel = pset.getParameter<std::string>("SALabel");
00034
00035 theMinPt = pset.getParameter<double>("minPt");
00036
00037 LogDebug("MuonPt") << " SALabel : " << theSTAMuonLabel
00038 << " Min Pt : " << theMinPt;
00039 }
00040
00042 MuonPtFilter::~MuonPtFilter() {
00043 }
00044
00045
00046 bool MuonPtFilter::filter(edm::Event& event, const edm::EventSetup& eventSetup) {
00047 bool accept = false;
00048
00049
00050 Handle<reco::TrackCollection> staTracks;
00051 event.getByLabel(theSTAMuonLabel, staTracks);
00052
00053 reco::TrackCollection::const_iterator staTrack;
00054
00055 for (staTrack = staTracks->begin(); staTrack != staTracks->end(); ++staTrack){
00056
00057 if(staTrack->pt()>theMinPt){
00058 accept=true;
00059 return accept;
00060 }
00061
00062 }
00063
00064 return accept;
00065
00066
00067 }
00068
00069
00070 DEFINE_FWK_MODULE(MuonPtFilter);