RPTestReader_plugin.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: RPTestReader
3 // Plugin Type: resultsproducer (art v1_15_02)
4 // File: RPTestReader_plugin.cc
5 //
6 // Generated at Wed Sep 16 16:58:28 2015 by Christopher Green using cetskelgen
7 // from cetlib version v1_14_00.
8 ////////////////////////////////////////////////////////////////////////
9 
17 #include "fhiclcpp/types/Atom.h"
19 
20 namespace arttest {
21  class RPTestReader;
22 }
23 
25 public:
26  struct Config {
29  1ul};
30  };
31 
33  explicit RPTestReader(Parameters const& p);
34  // The compiler-generated destructor is fine for non-base
35  // classes without bare pointers or other resource use.
36 
37  // Plugins should not be copied or assigned.
38  RPTestReader(RPTestReader const&) = delete;
39  RPTestReader(RPTestReader&&) = delete;
40  RPTestReader& operator=(RPTestReader const&) = delete;
41  RPTestReader& operator=(RPTestReader&&) = delete;
42 
43  // Required functions.
44  void clear() override;
45  void writeResults(art::Results& res) override;
46 
47  // Selected optional functions.
48  void event(art::Event const& e) override;
49  void readResults(art::Results const& res) override;
50 
51 private:
52  bool maybeAccumulateData_(art::Results const& res);
53 
55  std::size_t expectedResultsSeen_;
56  std::size_t resultsSeen_{};
57  int total_{};
58 };
59 
61  : intResultsLabel_{p().intResultsLabel()}
62  , expectedResultsSeen_{p().nResultsExpected()}
63 {}
64 
65 void
67 {
68  resultsSeen_ = 0;
69  total_ = 0;
70 }
71 
72 void
74 {
78  << "Expected to see " << expectedResultsSeen_ << ", saw " << resultsSeen_
79  << ".\n";
80  }
81 }
82 
83 void
85 {
86  // NOP.
87 }
88 
89 void
91 {
93 }
94 
95 bool
97 {
99  bool result = res.getByLabel(intResultsLabel_, hi);
100  if (result) {
101  ++resultsSeen_;
102  if (hi->value != 5.0) {
104  << "Unexcepted value in results int product: " << hi->value << ".\n";
105  }
106  total_ += hi->value;
107  }
108  return result;
109 }
110 
std::string string
Definition: nybbler.cc:12
fhicl::Atom< std::string > intResultsLabel
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:435
bool maybeAccumulateData_(art::Results const &res)
const double e
void writeResults(art::Results &res) override
#define DEFINE_ART_RESULTS_PLUGIN(klass)
p
Definition: test.py:228
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
void readResults(art::Results const &res) override
fhicl::Atom< std::size_t > nResultsExpected
RPTestReader(Parameters const &p)
void event(art::Event const &e) override
RPTestReader & operator=(RPTestReader const &)=delete