LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
SourceHelper.cc
Go to the documentation of this file.
2 
9 
11 
12 void
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 }
27 
28 void
30  cet::exempt_ptr<ProductTables const> presentProducts)
31 {
32  presentProducts_ = presentProducts;
33 }
34 
37 {
39  return new RunPrincipal{
41 }
42 
45  Timestamp const& startTime) const
46 {
47  RunAuxiliary const runAux{r, startTime, Timestamp::invalidTimestamp()};
48  return makeRunPrincipal(runAux);
49 }
50 
53  Timestamp const& startTime) const
54 {
55  return makeRunPrincipal(RunID{r}, startTime);
56 }
57 
60 {
62  return new SubRunPrincipal{
63  subRunAux, md_.processConfiguration(), &presentProducts_->get(InSubRun)};
64 }
65 
68  Timestamp const& startTime) const
69 {
70  SubRunAuxiliary const subRunAux{sr, startTime, Timestamp::invalidTimestamp()};
71  return makeSubRunPrincipal(subRunAux);
72 }
73 
76  SubRunNumber_t const sr,
77  Timestamp const& startTime) const
78 {
79  return makeSubRunPrincipal(SubRunID{r, sr}, startTime);
80 }
81 
84  std::shared_ptr<History>&& history) const
85 {
87  return new EventPrincipal{eventAux,
90  history};
91 }
92 
95  EventID const& e,
96  Timestamp const& startTime,
97  bool const isRealData,
98  EventAuxiliary::ExperimentType const eType) const
99 {
101  EventAuxiliary const eventAux{e, startTime, isRealData, eType};
102  return new EventPrincipal{
103  eventAux, md_.processConfiguration(), &presentProducts_->get(InEvent)};
104 }
105 
108  RunNumber_t const r,
109  SubRunNumber_t const sr,
110  EventNumber_t const e,
111  Timestamp const& startTime,
112  bool const isRealData,
113  EventAuxiliary::ExperimentType const eType) const
114 {
115  return makeEventPrincipal(EventID{r, sr, e}, startTime, isRealData, eType);
116 }
cet::exempt_ptr< ProductTables const > presentProducts_
Definition: SourceHelper.h:96
void setPresentProducts(cet::exempt_ptr< ProductTables const > presentProducts)
Definition: SourceHelper.cc:29
SubRunPrincipal * makeSubRunPrincipal(SubRunAuxiliary const &subRunAux) const
Definition: SourceHelper.cc:59
RunPrincipal * makeRunPrincipal(RunAuxiliary const &runAux) const
Definition: SourceHelper.cc:36
SourceHelper(ModuleDescription const &md)
Definition: SourceHelper.cc:10
IDNumber_t< Level::SubRun > SubRunNumber_t
Definition: IDNumber.h:118
void throwIfProductsNotRegistered_() const
Definition: SourceHelper.cc:13
static constexpr Timestamp invalidTimestamp()
Definition: Timestamp.h:83
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
IDNumber_t< Level::Event > EventNumber_t
Definition: IDNumber.h:117
ModuleDescription md_
Definition: SourceHelper.h:97
Float_t e
Definition: plot.C:34
EventPrincipal * makeEventPrincipal(EventAuxiliary const &eventAux, std::shared_ptr< History > &&history) const
Definition: SourceHelper.cc:83
ProcessConfiguration const & processConfiguration() const
IDNumber_t< Level::Run > RunNumber_t
Definition: IDNumber.h:119