CMS 3D CMS Logo

ModuloStreamIDFilter.cc
Go to the documentation of this file.
1 
7 
8 namespace edm {
10  public:
11  explicit ModuloStreamIDFilter(ParameterSet const&);
12  ~ModuloStreamIDFilter() override;
13 
14  static void fillDescriptions(ConfigurationDescriptions& descriptions);
15  bool filter(StreamID, Event& e, EventSetup const& c) const final;
16 
17  private:
18  const unsigned int n_; // accept one in n
19  const unsigned int offset_; // with offset, ie. sequence of events does not have to start at first event
20  };
21 
23  : n_(ps.getParameter<unsigned int>("modulo")), offset_(ps.getParameter<unsigned int>("offset")) {}
24 
26 
27  bool ModuloStreamIDFilter::filter(StreamID iStreamID, Event&, EventSetup const&) const {
28  return (iStreamID.value() % n_ == offset_);
29  }
30 
33  desc.add<unsigned int>("modulo")->setComment("Accept event if (streamID % modulo) == offset.");
34  desc.add<unsigned int>("offset")->setComment("Used to shift which value of modulo to accept.");
35  descriptions.add("streamIDFilter", desc);
36  }
37 } // namespace edm
38 
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
ModuloStreamIDFilter(ParameterSet const &)
static void fillDescriptions(ConfigurationDescriptions &descriptions)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool filter(StreamID, Event &e, EventSetup const &c) const final
unsigned int value() const
Definition: StreamID.h:42
void add(std::string const &label, ParameterSetDescription const &psetDescription)
HLT enums.