EventPrincipal.h
Go to the documentation of this file.
1 #ifndef art_Framework_Principal_EventPrincipal_h
2 #define art_Framework_Principal_EventPrincipal_h
3 // vim: set sw=2:
4 
5 // EventPrincipal
6 //
7 // Manages per-event data products.
8 //
9 // This is not visible to modules, instead they use the Event class,
10 // which is a proxy for this class.
11 
20 #include "cetlib/exempt_ptr.h"
21 
22 #include <map>
23 #include <memory>
24 #include <vector>
25 
26 namespace art {
27 
28  class EventID;
29 
30  class EventPrincipal final : public Principal {
31  public:
34 
36  EventAuxiliary const& aux,
37  ProcessConfiguration const& pc,
39  bool const parentageEnabled = true,
40  bool const rangesEnabled = true,
41  std::shared_ptr<History> history = std::make_shared<History>(),
42  std::unique_ptr<BranchMapper>&& mapper = std::make_unique<BranchMapper>(),
43  std::unique_ptr<DelayedReader>&& rtrv =
44  std::make_unique<NoDelayedReader>(),
45  bool lastInSubRun = false);
46 
47  SubRunPrincipal const& subRunPrincipal() const;
48 
51  {
52  return subRunPrincipal_;
53  }
54  void
56  {
57  subRunPrincipal_ = srp;
58  }
59 
60  EventID const&
61  id() const
62  {
63  return aux().id();
64  }
65  Timestamp const&
66  time() const
67  {
68  return aux().time();
69  }
70  bool
71  isReal() const
72  {
73  return aux().isRealData();
74  }
75 
78  {
79  return aux().experimentType();
80  }
81 
82  EventAuxiliary const&
83  aux() const
84  {
85  return aux_;
86  }
88  subRun() const
89  {
90  return id().subRun();
91  }
93  run() const
94  {
95  return id().run();
96  }
98  event() const
99  {
100  return id().event();
101  }
102 
104 
105  History const&
106  history() const
107  {
108  return *history_;
109  }
110 
111  using Principal::getGroup;
112 
113  void put(std::unique_ptr<EDProduct>&& edp,
114  BranchDescription const& pd,
115  std::unique_ptr<ProductProvenance const>&& productProvenance);
116 
117  void fillGroup(BranchDescription const&) override;
118 
119  BranchType
120  branchType() const override
121  {
122  return branch_type;
123  }
124 
125  bool
127  {
128  return lastInSubRun_;
129  }
130  RangeSet
131  seenRanges() const override
132  {
133  return RangeSet::invalid();
134  }
135 
136  bool
137  parentageEnabled() const override
138  {
139  return parentageEnabled_;
140  }
141 
142  bool
143  rangesEnabled() const override
144  {
145  return rangesEnabled_;
146  }
147 
148  private:
149  void throwIfExistingGroup(BranchDescription const& pd) const;
150 
151  ProcessHistoryID const&
152  processHistoryID() const override
153  {
154  return history().processHistoryID();
155  }
156 
157  void
158  setProcessHistoryID(ProcessHistoryID const& phid) override
159  {
160  return history().setProcessHistoryID(phid);
161  }
162 
163  private:
166  std::shared_ptr<History> history_;
167  bool lastInSubRun_{false};
168  bool parentageEnabled_{true};
169  bool rangesEnabled_{true};
170  };
171 
172 } // namespace art
173 
174 // Local Variables:
175 // mode: c++
176 // End:
177 #endif /* art_Framework_Principal_EventPrincipal_h */
bool isRealData() const
SubRunPrincipal const & subRunPrincipal() const
SubRunNumber_t subRun() const
void put(std::unique_ptr< EDProduct > &&edp, BranchDescription const &pd, std::unique_ptr< ProductProvenance const > &&productProvenance)
EventAuxiliary aux_
void throwIfExistingGroup(BranchDescription const &pd) const
RunNumber_t run() const
EventAuxiliary::ExperimentType ExperimentType() const
ProcessHistoryID const & processHistoryID() const
Definition: History.h:42
Timestamp const & time() const
EventNumber_t event() const
void setProcessHistoryID(ProcessHistoryID const &phid) override
EventAuxiliary const & aux() const
void setSubRunPrincipal(cet::exempt_ptr< SubRunPrincipal const > srp)
RunNumber_t run() const
Definition: EventID.h:98
Timestamp const & time() const
bool rangesEnabled() const override
bool isReal() const
bool parentageEnabled() const override
History const & history() const
EventPrincipal(EventAuxiliary const &aux, ProcessConfiguration const &pc, cet::exempt_ptr< ProductTable const > presentProducts, bool const parentageEnabled=true, bool const rangesEnabled=true, std::shared_ptr< History > history=std::make_shared< History >(), std::unique_ptr< BranchMapper > &&mapper=std::make_unique< BranchMapper >(), std::unique_ptr< DelayedReader > &&rtrv=std::make_unique< NoDelayedReader >(), bool lastInSubRun=false)
cet::exempt_ptr< SubRunPrincipal const > subRunPrincipalExemptPtr() const
std::vector< EventSelectionID > EventSelectionIDVector
ProcessHistoryID const & processHistoryID() const override
static RangeSet invalid()
static constexpr BranchType branch_type
cet::exempt_ptr< SubRunPrincipal const > subRunPrincipal_
BranchType branchType() const override
bool isLastInSubRun() const
IDNumber_t< Level::SubRun > SubRunNumber_t
Definition: IDNumber.h:118
void setProcessHistoryID(ProcessHistoryID const &phid) const
Definition: History.h:48
EventNumber_t event() const
Definition: EventID.h:116
EventSelectionIDVector const & eventSelectionIDs() const
SubRunNumber_t subRun() const
Definition: EventID.h:110
void fillGroup(BranchDescription const &) override
cet::exempt_ptr< Group const > getGroup(ProductID const pid) const
IDNumber_t< Level::Event > EventNumber_t
Definition: IDNumber.h:117
BranchType
Definition: BranchType.h:18
Service to store calibration data products (CDP) in the SQLite3 metadatabase of a file...
Definition: FillParentInfo.h:8
EventID const & id() const
ExperimentType experimentType() const
std::shared_ptr< History > history_
RangeSet seenRanges() const override
static constexpr BranchType branch_type
EventID const & id() const
IDNumber_t< Level::Run > RunNumber_t
Definition: IDNumber.h:119