Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
recob::test::HitDataProductChecker Class Reference

Module verifying the presence of data products. More...

Inheritance diagram for recob::test::HitDataProductChecker:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Classes

struct  Config
 
struct  TargetInfo_t
 Configuration for a single data product check. More...
 

Public Types

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

Public Member Functions

 HitDataProductChecker (Parameters const &config)
 
virtual void analyze (const art::Event &event) 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 (SharedResources const &resources)
 
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 &)
 
fhicl::ParameterSetID selectorConfig () const
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
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 Member Functions

template<typename DATA >
void checkDataProducts (art::Event const &event, TargetInfo_t const &targetInfo, std::string desc)
 Checks the specified data product. More...
 

Private Attributes

std::vector< TargetInfo_tfHitTargets
 Configuration of all checks on hit collections. More...
 

Additional Inherited Members

- Protected Member Functions inherited from art::Observer
std::string const & processName () const
 
bool wantAllEvents () const noexcept
 
bool wantEvent (ScheduleID id, Event const &e) const
 
Handle< TriggerResultsgetTriggerResults (Event const &e) const
 
 Observer (fhicl::ParameterSet const &config)
 
 Observer (std::vector< std::string > const &select_paths, std::vector< std::string > const &reject_paths, fhicl::ParameterSet const &config)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
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 ()
 

Detailed Description

Module verifying the presence of data products.

Throws an exception on failure.

Service requirements

This module requires no service.

Configuration parameters

Definition at line 54 of file HitDataProductChecker_module.cc.

Member Typedef Documentation

Definition at line 91 of file HitDataProductChecker_module.cc.

Constructor & Destructor Documentation

recob::test::HitDataProductChecker::HitDataProductChecker ( Parameters const &  config)
explicit

Definition at line 162 of file HitDataProductChecker_module.cc.

163  : EDAnalyzer(config)
164 {
165  decltype(auto) hits = config().hits();
166  fHitTargets.reserve(hits.size());
167  std::copy(hits.begin(), hits.end(), std::back_inserter(fHitTargets));
168 } // HitDataProductChecker::HitDataProductChecker()
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
STL namespace.
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
static Config * config
Definition: config.cpp:1054
std::vector< TargetInfo_t > fHitTargets
Configuration of all checks on hit collections.
T copy(T const &v)
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:72

Member Function Documentation

void recob::test::HitDataProductChecker::analyze ( const art::Event event)
overridevirtual

Definition at line 172 of file HitDataProductChecker_module.cc.

172  {
173 
174  for (auto const& targetInfo: fHitTargets)
175  checkDataProducts<std::vector<recob::Hit>>(event, targetInfo, "hits");
176 
177 } // HitCollectionCreatorTest::analyze()
std::vector< TargetInfo_t > fHitTargets
Configuration of all checks on hit collections.
template<typename DATA >
void recob::test::HitDataProductChecker::checkDataProducts ( art::Event const &  event,
TargetInfo_t const &  targetInfo,
std::string  desc 
)
private

Checks the specified data product.

Template Parameters
DATAtype of data product to be checked
Parameters
eventthe event to read the data product from
targetInfodetails of the data product expected information
descdescription of the content of the data product
Exceptions
art::Exception(art::errors::ProductNotFound) when unexpected

The checks include:

  • existence of the data product
  • size of the data product collection (optional)

Definition at line 183 of file HitDataProductChecker_module.cc.

184 {
185  using Product_t = DATA;
186 
187  art::InputTag tag = targetInfo.name;
188 
190  bool found = event.getByLabel<Product_t>(tag, data);
191  if (found && !targetInfo.bExists) {
193  << "Data product '" << tag << "' (" << desc
194  << ") was expected not to exist, and there it is instead! (with "
195  << data->size() << " elements)";
196  }
197  if (!found && targetInfo.bExists) {
199  << "Data product '" << tag << "' (" << desc
200  << ") was expected, but there is none.";
201  }
202 
203  if (targetInfo.bCheckEntries && (data->size() != targetInfo.expectedEntries))
204  {
206  << "Data product '" << tag << "' (" << desc
207  << ") was expected to have " << targetInfo.expectedEntries
208  << " entires, but it has " << data->size() << "!";
209  }
210 
211 } // recob::test::HitDataProductChecker::HitCollectionCreator_test()
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66

Member Data Documentation

std::vector<TargetInfo_t> recob::test::HitDataProductChecker::fHitTargets
private

Configuration of all checks on hit collections.

Definition at line 126 of file HitDataProductChecker_module.cc.


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