File indexing completed on 2024-04-06 12:06:35
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 #include <memory>
0022
0023 #include <vector>
0024
0025 #include "FWCore/Framework/interface/Frameworkfwd.h"
0026 #include "FWCore/Framework/interface/global/EDFilter.h"
0027
0028 #include "FWCore/Framework/interface/Event.h"
0029 #include "FWCore/Framework/interface/Run.h"
0030 #include "FWCore/Framework/interface/MakerMacros.h"
0031 #include "FWCore/Framework/interface/EventSetup.h"
0032 #include "FWCore/Framework/interface/ESHandle.h"
0033
0034 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0035 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0036
0037 #include "DPGAnalysis/SiStripTools/interface/EventWithHistoryFilter.h"
0038
0039
0040
0041
0042
0043 class EventWithHistoryEDFilter : public edm::global::EDFilter<> {
0044 public:
0045 explicit EventWithHistoryEDFilter(const edm::ParameterSet&);
0046
0047 private:
0048 bool filter(edm::StreamID streamId, edm::Event&, const edm::EventSetup&) const override;
0049
0050
0051
0052 std::vector<EventWithHistoryFilter> ehfilters_;
0053 const bool debu_;
0054 };
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067 EventWithHistoryEDFilter::EventWithHistoryEDFilter(const edm::ParameterSet& iConfig)
0068 : ehfilters_(), debu_(iConfig.getUntrackedParameter<bool>("debugPrint", false)) {
0069
0070
0071 std::vector<edm::ParameterSet> filterconfigs(iConfig.getUntrackedParameter<std::vector<edm::ParameterSet> >(
0072 "filterConfigurations", std::vector<edm::ParameterSet>()));
0073
0074 for (auto& ps : filterconfigs) {
0075 ps.augment(iConfig.getUntrackedParameter<edm::ParameterSet>("commonConfiguration", edm::ParameterSet()));
0076
0077 ehfilters_.emplace_back(ps, consumesCollector());
0078 }
0079 }
0080
0081
0082
0083
0084
0085
0086 bool EventWithHistoryEDFilter::filter(edm::StreamID streamId, edm::Event& iEvent, const edm::EventSetup& iSetup) const {
0087 bool selected = false;
0088
0089 for (const auto& filter : ehfilters_) {
0090 selected = selected || filter.selected(iEvent, iSetup);
0091 }
0092
0093 if (debu_ && selected)
0094 edm::LogInfo("SELECTED") << "selected event";
0095
0096 return selected;
0097 }
0098
0099
0100 DEFINE_FWK_MODULE(EventWithHistoryEDFilter);