File indexing completed on 2024-04-06 12:08:35
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #include <memory>
0021 #include <algorithm>
0022 #include <vector>
0023
0024
0025 #include "DataFormats/SiStripCommon/interface/SiStripEnumsAndStrings.h"
0026 #include "DataFormats/SiStripCommon/interface/SiStripEventSummary.h"
0027 #include "FWCore/Framework/interface/stream/EDFilter.h"
0028 #include "FWCore/Framework/interface/Event.h"
0029 #include "FWCore/Framework/interface/Frameworkfwd.h"
0030 #include "FWCore/Framework/interface/MakerMacros.h"
0031 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0032 #include "FWCore/Utilities/interface/EDGetToken.h"
0033 #include "FWCore/Utilities/interface/InputTag.h"
0034
0035
0036
0037
0038 class SiStripEventSummary;
0039
0040 class SiStripCommissioningRunTypeFilter : public edm::stream::EDFilter<> {
0041 public:
0042 explicit SiStripCommissioningRunTypeFilter(const edm::ParameterSet&);
0043 ~SiStripCommissioningRunTypeFilter() override = default;
0044
0045 private:
0046 bool filter(edm::Event&, const edm::EventSetup&) override;
0047
0048
0049
0050 edm::EDGetTokenT<SiStripEventSummary> summaryToken_;
0051 std::vector<sistrip::RunType> runTypes_;
0052 };
0053
0054
0055
0056
0057 SiStripCommissioningRunTypeFilter::SiStripCommissioningRunTypeFilter(const edm::ParameterSet& iConfig) {
0058
0059 summaryToken_ = consumes<SiStripEventSummary>(iConfig.getParameter<edm::InputTag>("InputModuleLabel"));
0060
0061 std::vector<std::string> runTypes = iConfig.getParameter<std::vector<std::string> >("runTypes");
0062 for (std::vector<std::string>::const_iterator run = runTypes.begin(); run != runTypes.end(); ++run) {
0063 runTypes_.push_back(SiStripEnumsAndStrings::runType(*run));
0064 }
0065 }
0066
0067
0068
0069
0070
0071
0072 bool SiStripCommissioningRunTypeFilter::filter(edm::Event& iEvent, const edm::EventSetup& iSetup) {
0073 using namespace edm;
0074
0075 edm::Handle<SiStripEventSummary> summary;
0076 iEvent.getByToken(summaryToken_, summary);
0077 return (std::find(runTypes_.begin(), runTypes_.end(), summary->runType()) != runTypes_.end());
0078 }
0079
0080 #include "FWCore/Framework/interface/MakerMacros.h"
0081 DEFINE_FWK_MODULE(SiStripCommissioningRunTypeFilter);