LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
art::ProducingService Class Reference

#include "ProducingService.h"

Inheritance diagram for art::ProducingService:
art::ProductRegistryHelper geo::GeometryConfigurationWriter

Public Member Functions

 ProducingService ()
 
virtual ~ProducingService () noexcept
 
void setModuleDescription (ModuleDescription const &)
 
void registerCallbacks (ProducingServiceSignals &)
 
void doPostReadRun (RunPrincipal &)
 
void doPostReadSubRun (SubRunPrincipal &)
 
void doPostReadEvent (EventPrincipal &)
 

Static Public Attributes

static constexpr bool service_handle_allowed {false}
 

Private Member Functions

virtual void postReadRun (Run &)
 
virtual void postReadSubRun (SubRun &)
 
virtual void postReadEvent (Event &)
 
void productList (std::unique_ptr< ProductList > p)
 
void registerProducts (ProductDescriptions &productsToRegister, ModuleDescription const &md)
 
void fillDescriptions (ModuleDescription const &md)
 
template<typename P , BranchType B>
TypeLabel const & reconstitutes (std::string const &modLabel, std::string const &instanceName={})
 
template<BranchType B>
TypeLabelLookup_t const & expectedProducts () const
 
template<typename P , BranchType B = InEvent>
void produces (std::string const &instanceName={}, Persistable const persistable=Persistable::Yes)
 
ProducesCollectorproducesCollector () noexcept
 

Private Attributes

ModuleContext mc_ {ModuleContext::invalid()}
 

Detailed Description

Definition at line 17 of file ProducingService.h.

Constructor & Destructor Documentation

art::ProducingService::ProducingService ( )
art::ProducingService::~ProducingService ( )
virtualdefaultnoexcept

Referenced by ProducingService().

Member Function Documentation

void art::ProducingService::doPostReadEvent ( EventPrincipal ep)

Definition at line 54 of file ProducingService.cc.

References e, art::EventPrincipal::makeEvent(), mc_, and postReadEvent().

Referenced by registerCallbacks().

55  {
56  auto e = ep.makeEvent(mc_);
58  e.commitProducts(true, &expectedProducts<InEvent>());
59  }
virtual void postReadEvent(Event &)
Float_t e
Definition: plot.C:35
void art::ProducingService::doPostReadRun ( RunPrincipal rp)

Definition at line 38 of file ProducingService.cc.

References art::RangeSet::forRun(), art::RunPrincipal::makeRun(), mc_, postReadRun(), r, and art::RunPrincipal::runID().

Referenced by registerCallbacks().

39  {
40  auto r = rp.makeRun(mc_, RangeSet::forRun(rp.runID()));
41  postReadRun(r);
42  r.commitProducts();
43  }
TRandom r
Definition: spectrum.C:23
virtual void postReadRun(Run &)
static RangeSet forRun(RunID)
Definition: RangeSet.cc:51
void art::ProducingService::doPostReadSubRun ( SubRunPrincipal srp)

Definition at line 46 of file ProducingService.cc.

References art::RangeSet::forSubRun(), art::SubRunPrincipal::makeSubRun(), mc_, postReadSubRun(), and art::SubRunPrincipal::subRunID().

Referenced by registerCallbacks().

47  {
48  auto sr = srp.makeSubRun(mc_, RangeSet::forSubRun(srp.subRunID()));
49  postReadSubRun(sr);
50  sr.commitProducts();
51  }
static RangeSet forSubRun(SubRunID)
Definition: RangeSet.cc:57
virtual void postReadSubRun(SubRun &)
template<BranchType B>
TypeLabelLookup_t const & art::ProductRegistryHelper::expectedProducts ( ) const
inlineinherited

Definition at line 93 of file ProductRegistryHelper.h.

Referenced by art::ProductRegistryHelper::registerProducts().

94  {
95  return collector_.expectedProducts(B);
96  }
TypeLabelLookup_t const & expectedProducts(BranchType) const
void art::ProductRegistryHelper::fillDescriptions ( ModuleDescription const &  md)
inherited
void art::ProducingService::postReadEvent ( Event )
privatevirtual

Definition at line 70 of file ProducingService.cc.

Referenced by doPostReadEvent().

71  {}
void art::ProducingService::postReadRun ( Run )
privatevirtual

Reimplemented in geo::GeometryConfigurationWriter.

Definition at line 62 of file ProducingService.cc.

Referenced by doPostReadRun().

63  {}
void art::ProducingService::postReadSubRun ( SubRun )
privatevirtual

Definition at line 66 of file ProducingService.cc.

Referenced by doPostReadSubRun().

67  {}
template<typename P , art::BranchType B>
void art::ProductRegistryHelper::produces ( std::string const &  instanceName = {},
Persistable const  persistable = Persistable::Yes 
)
inlineinherited

Definition at line 100 of file ProductRegistryHelper.h.

References art::errors::ProductRegistrationFailure, and art::reconstitutes.

Referenced by larg4::LArG4::LArG4(), trkf::PMAlgTrackMaker::PMAlgTrackMaker(), trkf::PMAlgTrajFitter::PMAlgTrajFitter(), and trkf::Track3DKalmanHit::Track3DKalmanHit().

102  {
105  "An error occurred while registering a product.\n"}
106  << "The following product was registered with 'produces' when\n"
107  "'reconstitutes' should have been called instead.\n"
108  << " Branch type: " << B << '\n'
109  << " Class name: " << cet::demangle_symbol(typeid(P).name()) << '\n'
110  << " Instance name: '" << instanceName << "'\n";
111  }
112  collector_.produces<P, B>(instanceName, persistable);
113  }
void produces(std::string const &instanceName={}, Persistable const persistable=Persistable::Yes)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
void art::ProductRegistryHelper::productList ( std::unique_ptr< ProductList p)
inlineinherited

Definition at line 52 of file ProductRegistryHelper.h.

References art::produces, art::reconstitutes, and art::Yes.

53  {
54  productList_ = std::move(p);
55  }
std::unique_ptr< ProductList const > productList_
template<typename P , BranchType B>
TypeLabel const & art::ProductRegistryHelper::reconstitutes ( std::string const &  modLabel,
std::string const &  instanceName = {} 
)
inherited

Definition at line 117 of file ProductRegistryHelper.h.

References art::produces, and art::errors::ProductRegistrationFailure.

Referenced by lris::LArRawInputDriver::LArRawInputDriver(), lris::LArRawInputDriverJP250L::LArRawInputDriverJP250L(), lris::LArRawInputDriverLongBo::LArRawInputDriverLongBo(), lris::LArRawInputDriverShortBo::LArRawInputDriverShortBo(), and fluxr::PPFXFluxReader::PPFXFluxReader().

119  {
122  "An error occurred while registering a product.\n"}
123  << "The following product was registered with 'reconstitutes' when\n"
124  "'produces' should have been called instead.\n"
125  << " Branch type: " << B << '\n'
126  << " Class name: " << cet::demangle_symbol(typeid(P).name()) << '\n'
127  << " Emulated module name: '" << emulatedModule << "'\n"
128  << " Instance name: '" << instanceName << "'\n";
129  }
130  return collector_.reconstitutes<P, B>(emulatedModule, instanceName);
131  }
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
TypeLabel const & reconstitutes(std::string const &modLabel, std::string const &instanceName={})
void art::ProducingService::registerCallbacks ( ProducingServiceSignals cbReg)

Definition at line 30 of file ProducingService.cc.

References doPostReadEvent(), doPostReadRun(), doPostReadSubRun(), art::ProducingServiceSignals::sPostReadEvent, art::ProducingServiceSignals::sPostReadRun, and art::ProducingServiceSignals::sPostReadSubRun.

31  {
32  cbReg.sPostReadRun.watch(this, &ProducingService::doPostReadRun);
33  cbReg.sPostReadSubRun.watch(this, &ProducingService::doPostReadSubRun);
34  cbReg.sPostReadEvent.watch(this, &ProducingService::doPostReadEvent);
35  }
void doPostReadSubRun(SubRunPrincipal &)
void doPostReadEvent(EventPrincipal &)
void doPostReadRun(RunPrincipal &)
void art::ProductRegistryHelper::registerProducts ( ProductDescriptions productsToRegister,
ModuleDescription const &  md 
)
inherited

Definition at line 24 of file ProductRegistryHelper.cc.

References art::ProductRegistryHelper::collector_, art::ProductRegistryHelper::expectedProducts(), art::ProducesCollector::expectedProducts(), art::ProductRegistryHelper::fillDescriptions(), art::for_each_branch_type(), art::ProductRegistryHelper::productList_, and util::values().

Referenced by art::Source< T >::finishProductRegistration_(), and art::Modifier::registerProducts().

27  {
28  // Possible products from input source
29  if (productList_) {
30  cet::transform_all(*productList_,
31  back_inserter(productsToRegister),
32  [](auto const& pr) { return pr.second; });
33  }
34 
35  // Now fill the descriptions for products that are to be produced.
36  fillDescriptions(md);
37  auto registerProductsPerBT = [this,
38  &productsToRegister](BranchType const bt) {
40  for (auto const& pd : expectedProducts | ::ranges::views::values) {
41  productsToRegister.push_back(pd);
42  }
43  };
44  for_each_branch_type(registerProductsPerBT);
45  }
std::unique_ptr< ProductList const > productList_
decltype(auto) values(Coll &&coll)
Range-for loop helper iterating across the values of the specified collection.
void fillDescriptions(ModuleDescription const &md)
TypeLabelLookup_t const & expectedProducts() const
BranchType
Definition: BranchType.h:20
void for_each_branch_type(F f)
Definition: BranchType.h:38
TypeLabelLookup_t const & expectedProducts(BranchType) const
void art::ProducingService::setModuleDescription ( ModuleDescription const &  md)

Definition at line 21 of file ProducingService.cc.

References mc_.

22  {
23  // We choose the one-argument constructor since the path
24  // information is irrelevant when the doPostRead* functions are
25  // invoked.
26  mc_ = ModuleContext{md};
27  }

Member Data Documentation

ModuleContext art::ProducingService::mc_ {ModuleContext::invalid()}
private
constexpr bool art::ProducingService::service_handle_allowed {false}
static

Definition at line 19 of file ProducingService.h.


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