artdaq_demo  3.12.05
NthEvent_module.cc
1 // Class: NthEvent
3 // Module Type: filter
4 // File: NthEvent_module.cc
5 //
6 // Generated at Tue Jan 6 11:52:08 2015 by John Freeman using artmod
7 // from cetpkgsupport v1_07_01.
9 
10 #include "art/Framework/Core/EDFilter.h"
11 #include "art/Framework/Core/ModuleMacros.h"
12 #include "art/Framework/Principal/Event.h"
13 #include "art/Framework/Principal/Handle.h"
14 #include "art/Framework/Principal/Run.h"
15 #include "art/Framework/Principal/SubRun.h"
16 #include "canvas/Utilities/InputTag.h"
17 
18 #include "fhiclcpp/ParameterSet.h"
19 #include "messagefacility/MessageLogger/MessageLogger.h"
20 
21 #include <memory>
22 
23 class NthEvent;
24 
28 class NthEvent : public art::EDFilter
29 {
30 public:
35  explicit NthEvent(fhicl::ParameterSet const& p);
36 
37  // The destructor generated by the compiler is fine for classes
38  // without bare pointers or other resource use.
39 
41  NthEvent(NthEvent const&) = delete;
42 
44  NthEvent(NthEvent&&) = delete;
45 
47  NthEvent& operator=(NthEvent const&) = delete;
48 
50  NthEvent& operator=(NthEvent&&) = delete;
51 
57  bool filter(art::Event& e) override;
58 
59 private:
60  uint32_t nth_;
61 };
62 
63 NthEvent::NthEvent(fhicl::ParameterSet const& p)
64  : art::EDFilter{p}
65  , nth_(p.get<uint32_t>("nth"))
66 {}
67 
68 inline bool NthEvent::filter(art::Event& e) { return e.event() % nth_ == 0; }
69 
70 DEFINE_ART_MODULE(NthEvent) // NOLINT(performance-unnecessary-value-param)
NthEvent & operator=(NthEvent const &)=delete
Plugins should not be copied or assigned.
An art::EDFilter module that passes one out of N events.
bool filter(art::Event &e) override
Perform the filtering. NthEvent module passes events where event number % nth == 0.
NthEvent(fhicl::ParameterSet const &p)
Construct the NthEvent Filter.