TestOutput_module.cc
Go to the documentation of this file.
3 #include "cetlib_except/exception.h"
4 #include "fhiclcpp/types/Atom.h"
7 
8 #include <cassert>
9 
10 namespace arttest {
11  class TestOutput;
12 }
13 
15 public:
16  struct Config {
19  };
20 
21  using Parameters =
23  explicit TestOutput(Parameters const&);
24 
25 private:
26  void write(art::EventPrincipal& e) override;
27  void
29  {}
30  void
32  {}
33  void endJob() override;
34 
35  unsigned num_pass_;
36  unsigned total_;
37 };
38 
40  : art::OutputModule(ps().omConfig, ps.get_PSet())
41  , num_pass_{ps().shouldPass()}
42  , total_{0u}
43 {}
44 
45 void
47 {
48  ++total_;
49 }
50 
51 void
53 {
54  mf::LogAbsolute("TestOutputReport") << "TestOutput: should pass " << num_pass_
55  << ", did pass " << total_ << "\n";
56 
57  if (total_ != num_pass_) {
58  throw cet::exception("TestOutputFailure")
59  << "Number passed should be " << num_pass_ << ", but got " << total_
60  << "\n";
61  }
62 }
63 
fhicl::TableFragment< art::OutputModule::Config > omConfig
static const double ps
Definition: Units.h:103
void endJob() override
TestOutput(Parameters const &)
const double e
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:68
OutputModule(fhicl::ParameterSet const &pset)
Definition: OutputModule.cc:81
void write(art::EventPrincipal &e) override
void writeSubRun(art::SubRunPrincipal &) override
void writeRun(art::RunPrincipal &) override
MaybeLogger_< ELseverityLevel::ELsev_severe, true > LogAbsolute
fhicl::Atom< unsigned > shouldPass
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
AdcRoiViewer::Name Name