ValidHandleTester_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: ValidHandleTester
3 // Module Type: analyzer
4 // File: ValidHandleTester_module.cc
5 //
6 // Generated at Thu Apr 11 13:40:02 2013 by Marc Paterno using artmod
7 // from cetpkgsupport v1_01_00.
8 ////////////////////////////////////////////////////////////////////////
9 
10 #include <string>
11 
18 #include "fhiclcpp/ParameterSet.h"
19 
21 
22  struct Config {
25  };
26 
27 public:
29  explicit ValidHandleTester(Parameters const& p);
30  void analyze(art::Event const& e) override;
31 
32 private:
35 };
36 
38  : art::EDAnalyzer{ps}
39  , input_tag_{ps().input_label()}
40  , expected_value_{ps().expected_value()}
41 {
42  // consumes<std::string>(input_tag_);
43 }
44 
45 void
47 {
48  // Make sure old-form access works.
50  e.getByLabel(input_tag_, h);
51  assert(h.isValid());
52  assert(*h == expected_value_);
53 
54  // Make sure new-form access works.
56  assert(*p == expected_value_);
57  auto const& prov = *p.provenance();
58  assert(prov == *h.provenance());
59 
60  // Test that Provenance::inputTag() was formed correctly
61  auto const& tag = prov.inputTag();
62  assert(tag.label() == prov.moduleLabel());
63  assert(tag.instance() == prov.productInstanceName());
64  assert(tag.process() == prov.processName());
65 
66  // Make sure conversion-to-pointer works.
67  [&](std::string const* x) { assert(*x == expected_value_); }(p);
68 }
69 
static const double ps
Definition: Units.h:103
std::string string
Definition: nybbler.cc:12
fhicl::Atom< std::string > input_label
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:27
fhicl::Atom< std::string > expected_value
bool isValid() const
Definition: Handle.h:190
ValidHandleTester(Parameters const &p)
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:435
const double e
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:68
Provenance const * provenance() const
Definition: Handle.h:204
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
Definition: DataViewImpl.h:480
void analyze(art::Event const &e) override
p
Definition: test.py:228
h
training ###############################
Definition: train_cnn.py:186