CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/DPGAnalysis/Skims/src/HLTMuonPtFilter.cc

Go to the documentation of this file.
00001 
00008 /* This Class Header */
00009 #include "DPGAnalysis/Skims/interface/HLTMuonPtFilter.h"
00010 
00011 /* Collaborating Class Header */
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 /* C++ Headers */
00024 using namespace std;
00025 using namespace edm;
00026 
00027 /* ====================================================================== */
00028 
00030 HLTMuonPtFilter::HLTMuonPtFilter(const edm::ParameterSet& pset) {
00031 
00032   // the name of the STA rec hits collection
00033   theSTAMuonLabel = pset.getParameter<std::string>("SALabel");
00034 
00035   theMinPt = pset.getParameter<double>("minPt"); // pt min (GeV)
00036 
00037   LogDebug("HLTMuonPt") << " SALabel : " << theSTAMuonLabel 
00038     << " Min Pt : " << theMinPt;
00039 }
00040 
00042 HLTMuonPtFilter::~HLTMuonPtFilter() {
00043 }
00044 
00045 /* Operations */ 
00046 bool HLTMuonPtFilter::filter(edm::Event& event, const edm::EventSetup& eventSetup) {
00047   bool accept = false;
00048 
00049   // Get the RecTrack collection from the event
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 // define this as a plug-in
00070 DEFINE_FWK_MODULE(HLTMuonPtFilter);