File indexing completed on 2024-04-06 12:18:40
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #include <string>
0021 #include <iostream>
0022 #include <memory>
0023
0024
0025 #include "HLTEventNumberFilter.h"
0026 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0027 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0028
0029
0030
0031
0032 HLTEventNumberFilter::HLTEventNumberFilter(const edm::ParameterSet& iConfig) {
0033
0034
0035 period_ = iConfig.getParameter<unsigned int>("period");
0036 invert_ = iConfig.getParameter<bool>("invert");
0037 }
0038
0039 void HLTEventNumberFilter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0040 edm::ParameterSetDescription desc;
0041 desc.add<int>("period", 4096);
0042 desc.add<bool>("invert", true);
0043 descriptions.add("hltEventNumberFilter", desc);
0044 }
0045
0046
0047
0048
0049
0050
0051 bool HLTEventNumberFilter::filter(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const {
0052 using namespace edm;
0053
0054 if (iEvent.isRealData()) {
0055 bool accept(false);
0056 if (period_ != 0)
0057 accept = (((iEvent.id().event()) % period_) == 0);
0058 if (invert_)
0059 accept = !accept;
0060 return accept;
0061 } else {
0062 return true;
0063 }
0064 }
0065
0066
0067 #include "FWCore/Framework/interface/MakerMacros.h"
0068 DEFINE_FWK_MODULE(HLTEventNumberFilter);