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/MuonPtFilter.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 MuonPtFilter::MuonPtFilter(const edm::ParameterSet& 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("MuonPt") << " SALabel : " << theSTAMuonLabel << " Min Pt : " << theMinPt;
0034 }
0035 
0036 /// Destructor
0037 MuonPtFilter::~MuonPtFilter() {}
0038 
0039 /* Operations */
0040 bool MuonPtFilter::filter(edm::Event& event, const edm::EventSetup& eventSetup) {
0041   // Get the RecTrack collection from the event
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 // define this as a plug-in
0056 DEFINE_FWK_MODULE(MuonPtFilter);