LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
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,
38  cet::exempt_ptr<ProductTable const> presentProducts,
39  std::shared_ptr<History> history = std::make_shared<History>(),
40  std::unique_ptr<BranchMapper>&& mapper = std::make_unique<BranchMapper>(),
41  std::unique_ptr<DelayedReader>&& rtrv =
42  std::make_unique<NoDelayedReader>(),
43  bool lastInSubRun = false);
44 
45  SubRunPrincipal const& subRunPrincipal() const;
46 
47  cet::exempt_ptr<SubRunPrincipal const>
49  {
50  return subRunPrincipal_;
51  }
52  void
53  setSubRunPrincipal(cet::exempt_ptr<SubRunPrincipal const> srp)
54  {
55  subRunPrincipal_ = srp;
56  }
57 
58  EventID const&
59  id() const
60  {
61  return aux().id();
62  }
63  Timestamp const&
64  time() const
65  {
66  return aux().time();
67  }
68  bool
69  isReal() const
70  {
71  return aux().isRealData();
72  }
73 
76  {
77  return aux().experimentType();
78  }
79 
80  EventAuxiliary const&
81  aux() const
82  {
83  return aux_;
84  }
86  subRun() const
87  {
88  return id().subRun();
89  }
91  run() const
92  {
93  return id().run();
94  }
96  event() const
97  {
98  return id().event();
99  }
100 
102 
103  History const&
104  history() const
105  {
106  return *history_;
107  }
108 
109  using Principal::getGroup;
110 
111  void put(std::unique_ptr<EDProduct>&& edp,
112  BranchDescription const& pd,
113  std::unique_ptr<ProductProvenance const>&& productProvenance);
114 
115  void fillGroup(BranchDescription const&) override;
116 
117  BranchType
118  branchType() const override
119  {
120  return branch_type;
121  }
122 
123  bool
125  {
126  return lastInSubRun_;
127  }
128  RangeSet
129  seenRanges() const override
130  {
131  return RangeSet::invalid();
132  }
133 
134  private:
135  void throwIfExistingGroup(BranchDescription const& pd) const;
136 
137  ProcessHistoryID const&
138  processHistoryID() const override
139  {
140  return history().processHistoryID();
141  }
142 
143  void
144  setProcessHistoryID(ProcessHistoryID const& phid) override
145  {
146  return history().setProcessHistoryID(phid);
147  }
148 
149  private:
151 
152  cet::exempt_ptr<SubRunPrincipal const> subRunPrincipal_{nullptr};
153  std::shared_ptr<History> history_;
154  bool lastInSubRun_{false};
155  };
156 
157 } // namespace art
158 
159 // Local Variables:
160 // mode: c++
161 // End:
162 #endif /* art_Framework_Principal_EventPrincipal_h */
bool isRealData() const
SubRunNumber_t subRun() const
SubRunPrincipal const & subRunPrincipal() 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
EventSelectionIDVector const & eventSelectionIDs() 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
cet::exempt_ptr< Group const > getGroup(ProductID const pid) const
Definition: Principal.cc:525
void setSubRunPrincipal(cet::exempt_ptr< SubRunPrincipal const > srp)
Timestamp const & time() const
bool isReal() const
History const & history() const
RunNumber_t run() const
Definition: EventID.h:99
cet::exempt_ptr< SubRunPrincipal const > subRunPrincipalExemptPtr() const
std::vector< EventSelectionID > EventSelectionIDVector
ProcessHistoryID const & processHistoryID() const override
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
EventPrincipal(EventAuxiliary const &aux, ProcessConfiguration const &pc, cet::exempt_ptr< ProductTable const > presentProducts, 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)
void fillGroup(BranchDescription const &) override
static RangeSet invalid()
Definition: RangeSet.cc:46
IDNumber_t< Level::Event > EventNumber_t
Definition: IDNumber.h:117
BranchType
Definition: BranchType.h:18
HLT enums.
EventNumber_t event() const
Definition: EventID.h:117
EventID const & id() const
ExperimentType experimentType() const
std::shared_ptr< History > history_
RangeSet seenRanges() const override
static constexpr BranchType branch_type
SubRunNumber_t subRun() const
Definition: EventID.h:111
EventID const & id() const
IDNumber_t< Level::Run > RunNumber_t
Definition: IDNumber.h:119