File indexing completed on 2024-04-06 12:06:48
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "DPGAnalysis/Skims/interface/MuonPtFilter.h"
0010
0011
0012 #include "FWCore/Framework/interface/MakerMacros.h"
0013 #include "FWCore/Framework/interface/Frameworkfwd.h"
0014 #include "FWCore/Framework/interface/ESHandle.h"
0015 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0016
0017 #include "DataFormats/TrackReco/interface/Track.h"
0018 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0019
0020
0021 using namespace std;
0022 using namespace edm;
0023
0024
0025
0026
0027 MuonPtFilter::MuonPtFilter(const edm::ParameterSet& pset) {
0028
0029 theSTAMuonLabel = pset.getParameter<std::string>("SALabel");
0030
0031 theMinPt = pset.getParameter<double>("minPt");
0032
0033 LogDebug("MuonPt") << " SALabel : " << theSTAMuonLabel << " Min Pt : " << theMinPt;
0034 }
0035
0036
0037 MuonPtFilter::~MuonPtFilter() {}
0038
0039
0040 bool MuonPtFilter::filter(edm::Event& event, const edm::EventSetup& eventSetup) {
0041
0042 Handle<reco::TrackCollection> staTracks;
0043 event.getByLabel(theSTAMuonLabel, staTracks);
0044
0045 reco::TrackCollection::const_iterator staTrack;
0046
0047 for (staTrack = staTracks->begin(); staTrack != staTracks->end(); ++staTrack) {
0048 if (staTrack->pt() > theMinPt)
0049 return true;
0050 }
0051
0052 return false;
0053 }
0054
0055
0056 DEFINE_FWK_MODULE(MuonPtFilter);