00001
00002
00003
00004
00005
00006
00007
00009
00010 #include "art/Framework/Core/EDFilter.h"
00011 #include "art/Framework/Core/ModuleMacros.h"
00012 #include "art/Framework/Principal/Event.h"
00013 #include "art/Framework/Principal/Handle.h"
00014 #include "art/Framework/Principal/Run.h"
00015 #include "art/Framework/Principal/SubRun.h"
00016 #include "canvas/Utilities/InputTag.h"
00017
00018 #include "fhiclcpp/ParameterSet.h"
00019 #include "messagefacility/MessageLogger/MessageLogger.h"
00020
00021 #include <memory>
00022
00023 class NthEvent;
00024
00028 class NthEvent : public art::EDFilter
00029 {
00030 public:
00035 explicit NthEvent(fhicl::ParameterSet const& p);
00036
00037
00038
00039
00041 NthEvent(NthEvent const&) = delete;
00042
00044 NthEvent(NthEvent&&) = delete;
00045
00047 NthEvent& operator =(NthEvent const&) = delete;
00048
00050 NthEvent& operator =(NthEvent&&) = delete;
00051
00057 bool filter(art::Event& e) override;
00058
00059
00060 private:
00061
00062 uint32_t nth_;
00063 };
00064
00065
00066 NthEvent::NthEvent(fhicl::ParameterSet const& p)
00067 : nth_(p.get<uint32_t>("nth")) {}
00068
00069 inline
00070 bool NthEvent::filter(art::Event& e)
00071 {
00072 return e.event() % nth_ == 0 ? true : false;
00073 }
00074
00075 DEFINE_ART_MODULE(NthEvent)