Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
art::test::PtrListAnalyzer Class Reference
Inheritance diagram for art::test::PtrListAnalyzer:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Public Member Functions

 PtrListAnalyzer (fhicl::ParameterSet const &pset)
 
- Public Member Functions inherited from art::EDAnalyzer
 EDAnalyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDAnalyzer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Analyzer
virtual ~Analyzer () noexcept
 
 Analyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 Analyzer (Table< Config > const &config)
 
void doBeginJob ()
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
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)
 
- Public Member Functions inherited from art::Observer
 ~Observer () noexcept
 
 Observer (Observer const &)=delete
 
 Observer (Observer &&)=delete
 
Observeroperator= (Observer const &)=delete
 
Observeroperator= (Observer &&)=delete
 
void registerProducts (ProductDescriptions &, ModuleDescription const &)
 
void fillDescriptions (ModuleDescription const &)
 
std::string const & processName () const
 
bool wantAllEvents () const
 
bool wantEvent (Event const &e)
 
fhicl::ParameterSetID selectorConfig () const
 
Handle< TriggerResultsgetTriggerResults (Event const &e) const
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Types

using input_t = std::vector< int >
 

Private Member Functions

void analyze (art::Event const &ev) override
 
void test_fill_list (art::Event const &)
 
void test_fill_vector (art::Event const &)
 

Private Attributes

std::string input_label_
 
unsigned num_expected_
 

Additional Inherited Members

- Public Types inherited from art::EDAnalyzer
using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 
- Protected Member Functions inherited from art::Observer
 Observer (fhicl::ParameterSet const &config)
 
 Observer (std::vector< std::string > const &paths, fhicl::ParameterSet const &config)
 
detail::ProcessAndEventSelectorsprocessAndEventSelectors ()
 

Detailed Description

Definition at line 16 of file PtrListAnalyzer_module.cc.

Member Typedef Documentation

using art::test::PtrListAnalyzer::input_t = std::vector<int>
private

Definition at line 24 of file PtrListAnalyzer_module.cc.

Constructor & Destructor Documentation

art::test::PtrListAnalyzer::PtrListAnalyzer ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 33 of file PtrListAnalyzer_module.cc.

34  : art::EDAnalyzer{pset}
35  , input_label_{pset.get<std::string>("input_label")}
36  , num_expected_{pset.get<unsigned>("nvalues")}
37  {
38  // consumes<input_t>(input_label_);
39  }
std::string string
Definition: nybbler.cc:12

Member Function Documentation

void art::test::PtrListAnalyzer::analyze ( art::Event const &  ev)
overrideprivatevirtual

Implements art::EDAnalyzer.

Definition at line 42 of file PtrListAnalyzer_module.cc.

43  {
45  ev.getByLabel(input_label_, h);
46  assert(h.isValid());
47  assert(h->size() == num_expected_);
48 
49  test_fill_list(ev);
50  test_fill_vector(ev);
51  }
void test_fill_list(art::Event const &)
void test_fill_vector(art::Event const &)
bool isValid() const
Definition: Handle.h:190
h
training ###############################
Definition: train_cnn.py:186
void art::test::PtrListAnalyzer::test_fill_list ( art::Event const &  ev)
private

Definition at line 54 of file PtrListAnalyzer_module.cc.

55  {
56  // This is how to fill a list of Ptr<T> from a Handle<T>.
58  ev.getByLabel(input_label_, h);
59  assert(h.isValid());
60 
61  std::list<art::Ptr<int>> ptrs;
62  art::fill_ptr_list(ptrs, h);
63  assert(ptrs.size() == num_expected_);
64 
65  int expected_value = ev.id().event();
66  for (std::list<art::Ptr<int>>::const_iterator i = ptrs.begin(),
67  e = ptrs.end();
68  i != e;
69  ++i) {
70  assert(**i == expected_value);
71  ++expected_value;
72  }
73 
74  // Basic test of ensurePointer for Ptrs.
75  art::ensurePointer<int const*>(ptrs.begin());
76  std::list<art::Ptr<int>> const& ptrscref(ptrs);
77  art::ensurePointer<int const*>(ptrscref.begin());
78  }
bool isValid() const
Definition: Handle.h:190
const double e
void fill_ptr_list(std::list< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:305
Definition: fwd.h:26
h
training ###############################
Definition: train_cnn.py:186
void art::test::PtrListAnalyzer::test_fill_vector ( art::Event const &  ev)
private

Definition at line 81 of file PtrListAnalyzer_module.cc.

82  {
83  // This is how to fill a vector of Ptr<T> from a Handle<T>.
85  ev.getByLabel(input_label_, h);
86  assert(h.isValid());
87 
88  std::vector<art::Ptr<int>> ptrs;
89  art::fill_ptr_vector(ptrs, h);
90  assert(ptrs.size() == num_expected_);
91 
92  int expected_value = ev.id().event();
93  for (std::vector<art::Ptr<int>>::const_iterator i = ptrs.begin(),
94  e = ptrs.end();
95  i != e;
96  ++i) {
97  assert(**i == expected_value);
98  ++expected_value;
99  }
100  }
bool isValid() const
Definition: Handle.h:190
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
const double e
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:295
Definition: fwd.h:26
h
training ###############################
Definition: train_cnn.py:186

Member Data Documentation

std::string art::test::PtrListAnalyzer::input_label_
private

Definition at line 29 of file PtrListAnalyzer_module.cc.

unsigned art::test::PtrListAnalyzer::num_expected_
private

Definition at line 30 of file PtrListAnalyzer_module.cc.


The documentation for this class was generated from the following file: