File indexing completed on 2024-04-06 12:26:44
0001 #include "FWCore/Framework/interface/Frameworkfwd.h"
0002 #include "FWCore/Framework/interface/global/EDFilter.h"
0003 #include "FWCore/Framework/interface/Event.h"
0004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0005 #include "DataFormats/METReco/interface/BeamHaloSummary.h"
0006
0007 class CSCTightHaloTrkMuUnvetoFilter : public edm::global::EDFilter<> {
0008 public:
0009 explicit CSCTightHaloTrkMuUnvetoFilter(const edm::ParameterSet& iConfig);
0010 ~CSCTightHaloTrkMuUnvetoFilter() override {}
0011
0012 private:
0013 bool filter(edm::StreamID iID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override;
0014
0015 const bool taggingMode_;
0016 edm::EDGetTokenT<reco::BeamHaloSummary> beamHaloSummaryToken_;
0017 };
0018
0019 CSCTightHaloTrkMuUnvetoFilter::CSCTightHaloTrkMuUnvetoFilter(const edm::ParameterSet& iConfig)
0020 : taggingMode_(iConfig.getParameter<bool>("taggingMode")),
0021 beamHaloSummaryToken_(consumes<reco::BeamHaloSummary>(edm::InputTag("BeamHaloSummary"))) {
0022 produces<bool>();
0023 }
0024
0025 bool CSCTightHaloTrkMuUnvetoFilter::filter(edm::StreamID iID, edm::Event& iEvent, const edm::EventSetup& iSetup) const {
0026 edm::Handle<reco::BeamHaloSummary> beamHaloSummary;
0027 iEvent.getByToken(beamHaloSummaryToken_, beamHaloSummary);
0028
0029 const bool pass = !beamHaloSummary->CSCTightHaloIdTrkMuUnveto();
0030
0031 iEvent.put(std::make_unique<bool>(pass));
0032
0033 return taggingMode_ || pass;
0034 }
0035
0036 #include "FWCore/Framework/interface/MakerMacros.h"
0037 DEFINE_FWK_MODULE(CSCTightHaloTrkMuUnvetoFilter);