LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
art::SourceHelper Class Reference

#include "SourceHelper.h"

Public Member Functions

 SourceHelper (ModuleDescription const &md)
 
 SourceHelper (SourceHelper const &)=delete
 
 SourceHelper (SourceHelper &&)=delete
 
SourceHelperoperator= (SourceHelper const &)=delete
 
SourceHelperoperator= (SourceHelper &&)=delete
 
template<typename T >
Ptr< T > makePtr (TypeLabel const &t, Principal const &p, typename Ptr< T >::key_type key) const
 
RunPrincipalmakeRunPrincipal (RunAuxiliary const &runAux) const
 
RunPrincipalmakeRunPrincipal (RunID r, Timestamp const &startTime) const
 
RunPrincipalmakeRunPrincipal (RunNumber_t r, Timestamp const &startTime) const
 
SubRunPrincipalmakeSubRunPrincipal (SubRunAuxiliary const &subRunAux) const
 
SubRunPrincipalmakeSubRunPrincipal (SubRunID const &sr, Timestamp const &startTime) const
 
SubRunPrincipalmakeSubRunPrincipal (RunNumber_t r, SubRunNumber_t sr, Timestamp const &startTime) const
 
EventPrincipalmakeEventPrincipal (EventAuxiliary const &eventAux, std::shared_ptr< History > &&history) const
 
EventPrincipalmakeEventPrincipal (EventID const &e, Timestamp const &startTime, bool isRealData=true, EventAuxiliary::ExperimentType eType=EventAuxiliary::Data) const
 
EventPrincipalmakeEventPrincipal (RunNumber_t r, SubRunNumber_t sr, EventNumber_t e, Timestamp const &startTime, bool isRealData=true, EventAuxiliary::ExperimentType eType=EventAuxiliary::Data) const
 
template<typename T >
art::Ptr< T > makePtr (TypeLabel const &tl, Principal const &p, typename Ptr< T >::key_type key) const
 

Private Member Functions

void throwIfProductsNotRegistered_ () const
 
void setPresentProducts (cet::exempt_ptr< ProductTables const > presentProducts)
 

Private Attributes

cet::exempt_ptr< ProductTables const > presentProducts_ {nullptr}
 
ModuleDescription md_
 

Friends

template<typename T >
class Source
 

Detailed Description

Definition at line 37 of file SourceHelper.h.

Constructor & Destructor Documentation

art::SourceHelper::SourceHelper ( ModuleDescription const &  md)
explicit

Definition at line 10 of file SourceHelper.cc.

10 : md_{md} {}
ModuleDescription md_
Definition: SourceHelper.h:97
art::SourceHelper::SourceHelper ( SourceHelper const &  )
delete
art::SourceHelper::SourceHelper ( SourceHelper &&  )
delete

Member Function Documentation

art::EventPrincipal * art::SourceHelper::makeEventPrincipal ( EventAuxiliary const &  eventAux,
std::shared_ptr< History > &&  history 
) const

Definition at line 83 of file SourceHelper.cc.

References art::InEvent, md_, presentProducts_, art::ModuleDescription::processConfiguration(), and throwIfProductsNotRegistered_().

Referenced by makeEventPrincipal(), lris::LArRawInputDriverShortBo::readNext(), lris::LArRawInputDriverLongBo::readNext(), lris::LArRawInputDriver::readNext(), and lris::LArRawInputDriverJP250L::readNext().

85 {
87  return new EventPrincipal{eventAux,
90  history};
91 }
cet::exempt_ptr< ProductTables const > presentProducts_
Definition: SourceHelper.h:96
void throwIfProductsNotRegistered_() const
Definition: SourceHelper.cc:13
ModuleDescription md_
Definition: SourceHelper.h:97
ProcessConfiguration const & processConfiguration() const
art::EventPrincipal * art::SourceHelper::makeEventPrincipal ( EventID const &  e,
Timestamp const &  startTime,
bool  isRealData = true,
EventAuxiliary::ExperimentType  eType = EventAuxiliary::Data 
) const

Definition at line 94 of file SourceHelper.cc.

References e, art::InEvent, md_, presentProducts_, art::ModuleDescription::processConfiguration(), and throwIfProductsNotRegistered_().

99 {
101  EventAuxiliary const eventAux{e, startTime, isRealData, eType};
102  return new EventPrincipal{
103  eventAux, md_.processConfiguration(), &presentProducts_->get(InEvent)};
104 }
cet::exempt_ptr< ProductTables const > presentProducts_
Definition: SourceHelper.h:96
void throwIfProductsNotRegistered_() const
Definition: SourceHelper.cc:13
ModuleDescription md_
Definition: SourceHelper.h:97
Float_t e
Definition: plot.C:34
ProcessConfiguration const & processConfiguration() const
art::EventPrincipal * art::SourceHelper::makeEventPrincipal ( RunNumber_t  r,
SubRunNumber_t  sr,
EventNumber_t  e,
Timestamp const &  startTime,
bool  isRealData = true,
EventAuxiliary::ExperimentType  eType = EventAuxiliary::Data 
) const

Definition at line 107 of file SourceHelper.cc.

References makeEventPrincipal().

114 {
115  return makeEventPrincipal(EventID{r, sr, e}, startTime, isRealData, eType);
116 }
Float_t e
Definition: plot.C:34
EventPrincipal * makeEventPrincipal(EventAuxiliary const &eventAux, std::shared_ptr< History > &&history) const
Definition: SourceHelper.cc:83
template<typename T >
Ptr<T> art::SourceHelper::makePtr ( TypeLabel const &  t,
Principal const &  p,
typename Ptr< T >::key_type  key 
) const
template<typename T >
art::Ptr<T> art::SourceHelper::makePtr ( TypeLabel const &  tl,
Principal const &  p,
typename Ptr< T >::key_type  key 
) const

Definition at line 102 of file SourceHelper.h.

References art::Principal::branchType(), md_, and art::Principal::productGetter().

105 {
106  BranchDescription const pd{p.branchType(), tl, md_};
107  ProductID const pid{pd.productID()};
108  return Ptr<T>{pid, key, p.productGetter(pid)};
109 }
ModuleDescription md_
Definition: SourceHelper.h:97
art::RunPrincipal * art::SourceHelper::makeRunPrincipal ( RunAuxiliary const &  runAux) const
art::RunPrincipal * art::SourceHelper::makeRunPrincipal ( RunID  r,
Timestamp const &  startTime 
) const

Definition at line 44 of file SourceHelper.cc.

References art::Timestamp::invalidTimestamp(), and makeRunPrincipal().

46 {
47  RunAuxiliary const runAux{r, startTime, Timestamp::invalidTimestamp()};
48  return makeRunPrincipal(runAux);
49 }
RunPrincipal * makeRunPrincipal(RunAuxiliary const &runAux) const
Definition: SourceHelper.cc:36
static constexpr Timestamp invalidTimestamp()
Definition: Timestamp.h:83
art::RunPrincipal * art::SourceHelper::makeRunPrincipal ( RunNumber_t  r,
Timestamp const &  startTime 
) const

Definition at line 52 of file SourceHelper.cc.

References makeRunPrincipal().

54 {
55  return makeRunPrincipal(RunID{r}, startTime);
56 }
RunPrincipal * makeRunPrincipal(RunAuxiliary const &runAux) const
Definition: SourceHelper.cc:36
art::SubRunPrincipal * art::SourceHelper::makeSubRunPrincipal ( SubRunAuxiliary const &  subRunAux) const
art::SubRunPrincipal * art::SourceHelper::makeSubRunPrincipal ( SubRunID const &  sr,
Timestamp const &  startTime 
) const

Definition at line 67 of file SourceHelper.cc.

References art::Timestamp::invalidTimestamp(), and makeSubRunPrincipal().

69 {
70  SubRunAuxiliary const subRunAux{sr, startTime, Timestamp::invalidTimestamp()};
71  return makeSubRunPrincipal(subRunAux);
72 }
SubRunPrincipal * makeSubRunPrincipal(SubRunAuxiliary const &subRunAux) const
Definition: SourceHelper.cc:59
static constexpr Timestamp invalidTimestamp()
Definition: Timestamp.h:83
art::SubRunPrincipal * art::SourceHelper::makeSubRunPrincipal ( RunNumber_t  r,
SubRunNumber_t  sr,
Timestamp const &  startTime 
) const

Definition at line 75 of file SourceHelper.cc.

References makeSubRunPrincipal().

78 {
79  return makeSubRunPrincipal(SubRunID{r, sr}, startTime);
80 }
SubRunPrincipal * makeSubRunPrincipal(SubRunAuxiliary const &subRunAux) const
Definition: SourceHelper.cc:59
SourceHelper& art::SourceHelper::operator= ( SourceHelper const &  )
delete
SourceHelper& art::SourceHelper::operator= ( SourceHelper &&  )
delete
void art::SourceHelper::setPresentProducts ( cet::exempt_ptr< ProductTables const >  presentProducts)
private

Definition at line 29 of file SourceHelper.cc.

References presentProducts_.

Referenced by art::Source< T >::finishProductRegistration_().

31 {
32  presentProducts_ = presentProducts;
33 }
cet::exempt_ptr< ProductTables const > presentProducts_
Definition: SourceHelper.h:96
void art::SourceHelper::throwIfProductsNotRegistered_ ( ) const
private

Definition at line 13 of file SourceHelper.cc.

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

Referenced by makeEventPrincipal(), makeRunPrincipal(), and makeSubRunPrincipal().

14 {
15  if (!presentProducts_) {
16  throw Exception(
18  "Error while attempting to create principal from SourceHelper.\n")
19  << "Principals cannot be created until product registration is "
20  "complete.\n"
21  << "This can happen if you are attempting to create a Principal\n"
22  "outside of your 'readNext' function, or if you are using a\n"
23  "different SourceHelper object than the one provided by art.\n"
24  "Please contact artists@fnal.gov for guidance.";
25  }
26 }
cet::exempt_ptr< ProductTables const > presentProducts_
Definition: SourceHelper.h:96
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66

Friends And Related Function Documentation

template<typename T >
friend class Source
friend

Definition at line 93 of file SourceHelper.h.

Member Data Documentation

ModuleDescription art::SourceHelper::md_
private

Definition at line 97 of file SourceHelper.h.

Referenced by makeEventPrincipal(), makePtr(), makeRunPrincipal(), and makeSubRunPrincipal().

cet::exempt_ptr<ProductTables const> art::SourceHelper::presentProducts_ {nullptr}
private

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