LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
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 
15 #include "art/Framework/Core/fwd.h"
19 
20 #include <atomic>
21 #include <cstddef>
22 
23 namespace art::detail {
24  class SharedResources;
25 
26  class Filter : public Modifier {
27  public:
28  static constexpr bool Pass{true};
29  static constexpr bool Fail{false};
30 
31  template <typename UserConfig>
33 
34  virtual ~Filter() noexcept;
35  explicit Filter(fhicl::ParameterSet const&);
36  Filter(Filter const&) = delete;
37  Filter(Filter&&) = delete;
38  Filter& operator=(Filter const&) = delete;
39  Filter& operator=(Filter&&) = delete;
40 
41  void doBeginJob(SharedResources const& resources);
42  void doEndJob();
44  void doRespondToCloseInputFile(FileBlock const& fb);
45  void doRespondToOpenOutputFiles(FileBlock const& fb);
46  void doRespondToCloseOutputFiles(FileBlock const& fb);
47  bool doBeginRun(RunPrincipal& rp, ModuleContext const&);
48  bool doEndRun(RunPrincipal& rp, ModuleContext const& mc);
49  bool doBeginSubRun(SubRunPrincipal& srp, ModuleContext const& mc);
50  bool doEndSubRun(SubRunPrincipal& srp, ModuleContext const& mc);
51  bool doEvent(EventPrincipal& ep,
52  ModuleContext const& mc,
53  std::atomic<std::size_t>& counts_run,
54  std::atomic<std::size_t>& counts_passed,
55  std::atomic<std::size_t>& counts_failed);
56 
57  private:
58  virtual void setupQueues(SharedResources const&) = 0;
59  virtual void beginJobWithFrame(ProcessingFrame const&) = 0;
60  virtual void endJobWithFrame(ProcessingFrame const&) = 0;
61  virtual void respondToOpenInputFileWithFrame(FileBlock const&,
62  ProcessingFrame const&) = 0;
63  virtual void respondToCloseInputFileWithFrame(FileBlock const&,
64  ProcessingFrame const&) = 0;
65  virtual void respondToOpenOutputFilesWithFrame(FileBlock const&,
66  ProcessingFrame const&) = 0;
68  ProcessingFrame const&) = 0;
69  virtual bool beginRunWithFrame(Run&, ProcessingFrame const&) = 0;
70  virtual bool endRunWithFrame(Run&, ProcessingFrame const&) = 0;
71  virtual bool beginSubRunWithFrame(SubRun&, ProcessingFrame const&) = 0;
72  virtual bool endSubRunWithFrame(SubRun&, ProcessingFrame const&) = 0;
73  virtual bool filterWithFrame(Event&, ProcessingFrame const&) = 0;
74 
75  bool const checkPutProducts_;
76  };
77 
78 } // namespace art::detail
79 
80 #endif /* art_Framework_Core_detail_Filter_h */
81 
82 // Local Variables:
83 // mode: c++
84 // 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:28
static constexpr bool Fail
Definition: Filter.h:29
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:37
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
parameter set interface
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
TFile fb("Li6.root")
virtual bool beginSubRunWithFrame(SubRun &, ProcessingFrame const &)=0
bool const checkPutProducts_
Definition: Filter.h:75
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