Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
arttest::IntVectorAnalyzer Class Reference
Inheritance diagram for arttest::IntVectorAnalyzer:
art::SharedAnalyzer art::detail::Analyzer art::detail::SharedModule art::Observer art::ModuleBase

Classes

struct  Config
 

Public Types

using Parameters = Table< Config >
 
- Public Types inherited from art::SharedAnalyzer
using WorkerType = WorkerT< SharedAnalyzer >
 
using ModuleType = SharedAnalyzer
 

Public Member Functions

 IntVectorAnalyzer (Parameters const &p, ProcessingFrame const &)
 
- Public Member Functions inherited from art::SharedAnalyzer
 SharedAnalyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 SharedAnalyzer (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)
 
- Public Member Functions inherited from art::detail::SharedModule
 SharedModule ()
 
 SharedModule (std::string const &moduleLabel)
 
 ~SharedModule () noexcept
 
hep::concurrency::SerialTaskQueueChain * serialTaskQueueChain () const
 
void createQueues ()
 
template<BranchType BT = InEvent, typename... T>
void serialize (T const &...)
 
template<BranchType BT = InEvent>
void async ()
 
template<BranchType , typename... T>
void serialize (T const &...resources)
 

Private Member Functions

void analyze (Event const &, ProcessingFrame const &) override
 

Private Attributes

string const moduleLabel_
 
size_t const nvalues_
 
ViewToken< int > const viewToken_
 

Additional Inherited Members

- 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 22 of file IntVectorAnalyzer_module.cc.

Member Typedef Documentation

Definition at line 28 of file IntVectorAnalyzer_module.cc.

Constructor & Destructor Documentation

arttest::IntVectorAnalyzer::IntVectorAnalyzer ( Parameters const &  p,
ProcessingFrame const &   
)
explicit

Definition at line 39 of file IntVectorAnalyzer_module.cc.

41  : SharedAnalyzer{p}
42  , moduleLabel_{p().input_label()}
43  , nvalues_{p().nvalues()}
44  , viewToken_{consumesView<int>(moduleLabel_)}
45  {
46  async<InEvent>();
47  }
p
Definition: test.py:228

Member Function Documentation

void arttest::IntVectorAnalyzer::analyze ( Event const &  e,
ProcessingFrame const &   
)
overrideprivatevirtual

Implements art::SharedAnalyzer.

Definition at line 50 of file IntVectorAnalyzer_module.cc.

51  {
52  {
53  vector<int const*> ptrs;
54  size_t sz = e.getView(moduleLabel_, ptrs);
55  if (sz != nvalues_) {
56  cerr << "SizeMismatch expected a view of size " << nvalues_
57  << " but the obtained size is " << sz << '\n';
58  throw cet::exception("SizeMismatch")
59  << "Expected a view of size " << nvalues_
60  << " but the obtained size is " << sz << '\n';
61  }
62  for (size_t k = 0; k != sz; ++k) {
63  if (*ptrs[k] != (int)(e.id().event() + k)) {
64  cerr << "ValueMismatch at position " << k << " expected value "
65  << e.id().event() + k << " but obtained " << *ptrs[k] << '\n';
66  throw cet::exception("ValueMismatch")
67  << "At position " << k << " expected value " << e.id().event() + k
68  << " but obtained " << *ptrs[k] << '\n';
69  }
70  }
71  }
72  {
73  View<int> vw;
74  e.getView(viewToken_, vw);
75  assert(vw.isValid());
76  // Test that the range-for loop compiles.
77  for (auto it : vw) {
78  assert(*it >= 0);
79  }
80  }
81  }
const double e
Definition: fwd.h:43
auto isValid() const
Definition: View.h:60
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33

Member Data Documentation

string const arttest::IntVectorAnalyzer::moduleLabel_
private

Definition at line 34 of file IntVectorAnalyzer_module.cc.

size_t const arttest::IntVectorAnalyzer::nvalues_
private

Definition at line 35 of file IntVectorAnalyzer_module.cc.

ViewToken<int> const arttest::IntVectorAnalyzer::viewToken_
private

Definition at line 36 of file IntVectorAnalyzer_module.cc.


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