File indexing completed on 2023-03-17 11:03:15
0001 #include "FWCore/Framework/interface/Event.h"
0002 #include "FWCore/Framework/interface/EventSetup.h"
0003 #include "FWCore/Framework/interface/global/EDFilter.h"
0004 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0005 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0006 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0007
0008 namespace edm {
0009 class BooleanFilter : public global::EDFilter<> {
0010 public:
0011 explicit BooleanFilter(ParameterSet const& config)
0012 : token_(consumes<bool>(config.getParameter<edm::InputTag>("src"))) {}
0013
0014 bool filter(StreamID sid, Event& event, EventSetup const& setup) const final { return event.get(token_); }
0015
0016 static void fillDescriptions(ConfigurationDescriptions& descriptions);
0017
0018 private:
0019 const edm::EDGetTokenT<bool> token_;
0020 };
0021
0022 void BooleanFilter::fillDescriptions(ConfigurationDescriptions& descriptions) {
0023 edm::ParameterSetDescription desc;
0024 desc.add<edm::InputTag>("src", edm::InputTag());
0025 descriptions.addWithDefaultLabel(desc);
0026 descriptions.setComment("This EDFilter accepts or rejects events based on the boolean value read from \"src\".");
0027 }
0028 }
0029
0030 #include "FWCore/Framework/interface/MakerMacros.h"
0031 using edm::BooleanFilter;
0032 DEFINE_FWK_MODULE(BooleanFilter);