Classes | Public Types | Public Member Functions | Private Attributes | List of all members
arttest::GenericOneSimpleProductAnalyzer< V, P > Class Template Reference

#include <GenericOneSimpleProductAnalyzer.h>

Inheritance diagram for arttest::GenericOneSimpleProductAnalyzer< V, P >:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Classes

struct  Config
 

Public Types

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

Public Member Functions

 GenericOneSimpleProductAnalyzer (Parameters const &ps)
 
void verify_value (art::BranchType const bt, art::Handle< P > const &h) const
 
void analyze (art::Event const &e) override
 
void endSubRun (art::SubRun const &sr) override
 
void endRun (art::Run const &r) override
 
- 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 Attributes

value_ {}
 
std::string input_label_
 
art::BranchType branch_type_
 
bool require_presence_
 

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

template<typename V, typename P>
class arttest::GenericOneSimpleProductAnalyzer< V, P >

Definition at line 20 of file GenericOneSimpleProductAnalyzer.h.

Member Typedef Documentation

template<typename V , typename P >
using arttest::GenericOneSimpleProductAnalyzer< V, P >::Parameters = EDAnalyzer::Table<Config>

Definition at line 89 of file GenericOneSimpleProductAnalyzer.h.

Constructor & Destructor Documentation

template<typename V , typename P >
arttest::GenericOneSimpleProductAnalyzer< V, P >::GenericOneSimpleProductAnalyzer ( Parameters const &  ps)
inline

Definition at line 90 of file GenericOneSimpleProductAnalyzer.h.

91  : EDAnalyzer{ps}
92  , input_label_{ps().input_label()}
93  , branch_type_{art::BranchType(ps().branch_type())}
94  , require_presence_{ps().require_presence()}
95  {
96  switch (branch_type_) {
97  case art::InEvent:
98  consumes<P>(input_label_);
99  break;
100  case art::InSubRun:
101  consumes<P, art::InSubRun>(input_label_);
102  break;
103  case art::InRun:
104  consumes<P, art::InRun>(input_label_);
105  break;
106  default:
107  throw cet::exception("BranchTypeMismatch")
108  << "Branch type: " << branch_type_
109  << "not supported for this module.";
110  }
111  if (require_presence_) {
112  value_ = ps().expected_value();
113  }
114  }
static const double ps
Definition: Units.h:103
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:27
BranchType
Definition: BranchType.h:18
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33

Member Function Documentation

template<typename V , typename P >
void arttest::GenericOneSimpleProductAnalyzer< V, P >::analyze ( art::Event const &  e)
inlineoverridevirtual

Implements art::EDAnalyzer.

Definition at line 132 of file GenericOneSimpleProductAnalyzer.h.

133  {
134  if (branch_type_ != art::InEvent)
135  return;
136  art::Handle<P> handle;
137  e.getByLabel(input_label_, handle);
138  assert(handle.isValid() == require_presence_);
139  if (require_presence_) {
140  verify_value(art::InEvent, handle);
141  }
142  }
void verify_value(art::BranchType const bt, art::Handle< P > const &h) const
bool isValid() const
Definition: Handle.h:190
const double e
template<typename V , typename P >
void arttest::GenericOneSimpleProductAnalyzer< V, P >::endRun ( art::Run const &  r)
inlineoverridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 158 of file GenericOneSimpleProductAnalyzer.h.

159  {
160  if (branch_type_ != art::InRun)
161  return;
162  art::Handle<P> handle;
163  r.getByLabel(input_label_, handle);
164  assert(handle.isValid() == require_presence_);
165  if (require_presence_) {
166  verify_value(art::InRun, handle);
167  }
168  }
void verify_value(art::BranchType const bt, art::Handle< P > const &h) const
bool isValid() const
Definition: Handle.h:190
template<typename V , typename P >
void arttest::GenericOneSimpleProductAnalyzer< V, P >::endSubRun ( art::SubRun const &  sr)
inlineoverridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 145 of file GenericOneSimpleProductAnalyzer.h.

146  {
148  return;
149  art::Handle<P> handle;
150  sr.getByLabel(input_label_, handle);
151  assert(handle.isValid() == require_presence_);
152  if (require_presence_) {
153  verify_value(art::InSubRun, handle);
154  }
155  }
void verify_value(art::BranchType const bt, art::Handle< P > const &h) const
bool isValid() const
Definition: Handle.h:190
static const double sr
Definition: Units.h:167
template<typename V , typename P >
void arttest::GenericOneSimpleProductAnalyzer< V, P >::verify_value ( art::BranchType const  bt,
art::Handle< P > const &  h 
) const
inline

Definition at line 117 of file GenericOneSimpleProductAnalyzer.h.

118  {
120  detail::GetValue<V, P>,
121  detail::DereferenceHandle<V, P>>
122  get_value;
123  if (get_value(h) != value_) {
124  throw cet::exception("ValueMismatch")
125  << "The value for \"" << input_label_ << "\", branchType \"" << bt
126  << "\" is " << get_value(h) << " but was supposed to be " << value_
127  << '\n';
128  }
129  }
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33

Member Data Documentation

template<typename V , typename P >
art::BranchType arttest::GenericOneSimpleProductAnalyzer< V, P >::branch_type_
private

Definition at line 173 of file GenericOneSimpleProductAnalyzer.h.

template<typename V , typename P >
std::string arttest::GenericOneSimpleProductAnalyzer< V, P >::input_label_
private

Definition at line 172 of file GenericOneSimpleProductAnalyzer.h.

template<typename V , typename P >
bool arttest::GenericOneSimpleProductAnalyzer< V, P >::require_presence_
private

Definition at line 174 of file GenericOneSimpleProductAnalyzer.h.

template<typename V , typename P >
V arttest::GenericOneSimpleProductAnalyzer< V, P >::value_ {}
private

Definition at line 171 of file GenericOneSimpleProductAnalyzer.h.


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