Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:06:48

0001 /** \file
0002  *
0003  * $Date: 2012/01/21 14:56:53 $
0004  * $Revision: 1.3 $
0005  * \author Silvia Goy Lopez - CERN <silvia.goy.lopez@cern.ch>
0006  */
0007 
0008 /* This Class Header */
0009 #include "DPGAnalysis/Skims/interface/HLTMuonPtFilter.h"
0010 
0011 /* Collaborating Class Header */
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 /* C++ Headers */
0021 using namespace std;
0022 using namespace edm;
0023 
0024 /* ====================================================================== */
0025 
0026 /// Constructor
0027 HLTMuonPtFilter::HLTMuonPtFilter(const edm::ParameterSet& pset) : HLTFilter(pset) {
0028   // the name of the STA rec hits collection
0029   theSTAMuonLabel = pset.getParameter<std::string>("SALabel");
0030 
0031   theMinPt = pset.getParameter<double>("minPt");  // pt min (GeV)
0032 
0033   LogDebug("HLTMuonPt") << " SALabel : " << theSTAMuonLabel << " Min Pt : " << theMinPt;
0034 }
0035 
0036 /// Destructor
0037 HLTMuonPtFilter::~HLTMuonPtFilter() {}
0038 
0039 /* Operations */
0040 bool HLTMuonPtFilter::hltFilter(edm::Event& event,
0041                                 const edm::EventSetup& eventSetup,
0042                                 trigger::TriggerFilterObjectWithRefs& filterproduct) const {
0043   // Get the RecTrack collection from the event
0044   Handle<reco::TrackCollection> staTracks;
0045   event.getByLabel(theSTAMuonLabel, staTracks);
0046 
0047   reco::TrackCollection::const_iterator staTrack;
0048 
0049   for (staTrack = staTracks->begin(); staTrack != staTracks->end(); ++staTrack) {
0050     if (staTrack->pt() > theMinPt)
0051       return true;
0052   }
0053 
0054   return false;
0055 }
0056 
0057 // define this as a plug-in
0058 DEFINE_FWK_MODULE(HLTMuonPtFilter);