Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:01:02

0001 #include "FWCore/Framework/interface/stream/EDFilter.h"
0002 #include "FWCore/Framework/interface/Event.h"
0003 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0004 #include "DataFormats/Common/interface/Handle.h"
0005 #include "DataFormats/Candidate/interface/Candidate.h"
0006 
0007 using namespace edm;
0008 using namespace reco;
0009 
0010 class CandCollectionExistFilter : public edm::stream::EDFilter<> {
0011 public:
0012   CandCollectionExistFilter(const ParameterSet& cfg)
0013       : srcToken_(consumes<CandidateView>(cfg.getParameter<InputTag>("src"))) {}
0014 
0015 private:
0016   bool filter(Event& evt, const EventSetup&) override { return evt.getHandle(srcToken_).isValid(); }
0017   const EDGetTokenT<CandidateView> srcToken_;
0018 };
0019 
0020 #include "FWCore/Framework/interface/MakerMacros.h"
0021 DEFINE_FWK_MODULE(CandCollectionExistFilter);