Filter.h
Go to the documentation of this file.
1 #ifndef art_Framework_Core_detail_Filter_h
2 #define art_Framework_Core_detail_Filter_h
3 // vim: set sw=2 expandtab :
4 
5 //==================================================================
6 // The base class of all modules used to control the flow of
7 // processing in a trigger path. Filters can also insert products
8 // into the event. These products should be informational products
9 // about the filter decision.
10 //==================================================================
11 
18 
19 #include <atomic>
20 #include <cstddef>
21 
22 namespace art::detail {
23  class SharedResources;
24 
25  class Filter : public Modifier {
26  public:
27  static constexpr bool Pass{true};
28  static constexpr bool Fail{false};
29 
30  template <typename UserConfig>
32 
33  virtual ~Filter() noexcept;
34  explicit Filter(fhicl::ParameterSet const&);
35  Filter(Filter const&) = delete;
36  Filter(Filter&&) = delete;
37  Filter& operator=(Filter const&) = delete;
38  Filter& operator=(Filter&&) = delete;
39 
40  void doBeginJob(SharedResources const& resources);
41  void doEndJob();
42  void doRespondToOpenInputFile(FileBlock const& fb);
43  void doRespondToCloseInputFile(FileBlock const& fb);
44  void doRespondToOpenOutputFiles(FileBlock const& fb);
45  void doRespondToCloseOutputFiles(FileBlock const& fb);
46  bool doBeginRun(RunPrincipal& rp, ModuleContext const&);
47  bool doEndRun(RunPrincipal& rp, ModuleContext const& mc);
48  bool doBeginSubRun(SubRunPrincipal& srp, ModuleContext const& mc);
49  bool doEndSubRun(SubRunPrincipal& srp, ModuleContext const& mc);
50  bool doEvent(EventPrincipal& ep,
51  ModuleContext const& mc,
52  std::atomic<std::size_t>& counts_run,
53  std::atomic<std::size_t>& counts_passed,
54  std::atomic<std::size_t>& counts_failed);
55 
56  private:
57  virtual void setupQueues(SharedResources const&) = 0;
58  virtual void beginJobWithFrame(ProcessingFrame const&) = 0;
59  virtual void endJobWithFrame(ProcessingFrame const&) = 0;
60  virtual void respondToOpenInputFileWithFrame(FileBlock const&,
61  ProcessingFrame const&) = 0;
62  virtual void respondToCloseInputFileWithFrame(FileBlock const&,
63  ProcessingFrame const&) = 0;
64  virtual void respondToOpenOutputFilesWithFrame(FileBlock const&,
65  ProcessingFrame const&) = 0;
67  ProcessingFrame const&) = 0;
68  virtual bool beginRunWithFrame(Run&, ProcessingFrame const&) = 0;
69  virtual bool endRunWithFrame(Run&, ProcessingFrame const&) = 0;
70  virtual bool beginSubRunWithFrame(SubRun&, ProcessingFrame const&) = 0;
71  virtual bool endSubRunWithFrame(SubRun&, ProcessingFrame const&) = 0;
72  virtual bool filterWithFrame(Event&, ProcessingFrame const&) = 0;
73 
74  bool const checkPutProducts_;
75  };
76 
77 } // namespace art::detail
78 
79 #endif /* art_Framework_Core_detail_Filter_h */
80 
81 // Local Variables:
82 // mode: c++
83 // End:
bool doEndSubRun(SubRunPrincipal &srp, ModuleContext const &mc)
Definition: Filter.cc:102
virtual void setupQueues(SharedResources const &)=0
virtual bool endSubRunWithFrame(SubRun &, ProcessingFrame const &)=0
static constexpr bool Pass
Definition: Filter.h:27
static constexpr bool Fail
Definition: Filter.h:28
virtual void endJobWithFrame(ProcessingFrame const &)=0
bool doBeginSubRun(SubRunPrincipal &srp, ModuleContext const &mc)
Definition: Filter.cc:92
STL namespace.
void doRespondToOpenInputFile(FileBlock const &fb)
Definition: Filter.cc:44
Definition: Run.h:17
virtual ~Filter() noexcept
bool doEvent(EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
Definition: Filter.cc:112
void doRespondToCloseInputFile(FileBlock const &fb)
Definition: Filter.cc:51
bool doEndRun(RunPrincipal &rp, ModuleContext const &mc)
Definition: Filter.cc:82
virtual bool filterWithFrame(Event &, ProcessingFrame const &)=0
void doRespondToCloseOutputFiles(FileBlock const &fb)
Definition: Filter.cc:65
void doBeginJob(SharedResources const &resources)
Definition: Filter.cc:29
virtual bool endRunWithFrame(Run &, ProcessingFrame const &)=0
virtual bool beginSubRunWithFrame(SubRun &, ProcessingFrame const &)=0
bool const checkPutProducts_
Definition: Filter.h:74
virtual bool beginRunWithFrame(Run &, ProcessingFrame const &)=0
virtual void respondToCloseOutputFilesWithFrame(FileBlock const &, ProcessingFrame const &)=0
bool doBeginRun(RunPrincipal &rp, ModuleContext const &)
Definition: Filter.cc:72
virtual void respondToOpenInputFileWithFrame(FileBlock const &, ProcessingFrame const &)=0
void doRespondToOpenOutputFiles(FileBlock const &fb)
Definition: Filter.cc:58
virtual void beginJobWithFrame(ProcessingFrame const &)=0
virtual void respondToCloseInputFileWithFrame(FileBlock const &, ProcessingFrame const &)=0
virtual void respondToOpenOutputFilesWithFrame(FileBlock const &, ProcessingFrame const &)=0