LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
SubRunAuxiliary.cc
Go to the documentation of this file.
2 // vim: set sw=2 expandtab :
3 
4 #include <ostream>
5 #include <utility>
6 
7 using namespace std;
8 
9 namespace art {
10 
11  SubRunAuxiliary::SubRunAuxiliary() = default;
12 
13  SubRunAuxiliary::SubRunAuxiliary(SubRunID const& theId,
14  Timestamp const theTime,
15  Timestamp const theEndTime)
16  : id_{theId}, beginTime_{theTime}, endTime_{theEndTime}
17  {}
18 
20  SubRunNumber_t const theSubRun,
21  Timestamp const theTime,
22  Timestamp const theEndTime)
23  : SubRunAuxiliary{SubRunID{theRun, theSubRun}, theTime, theEndTime}
24  {}
25 
26  // private
28  Timestamp const beginTime,
29  Timestamp const endTime,
31  unsigned const rangeSetID)
32  : processHistoryID_{processHistoryID}
34  , id_{id}
36  , endTime_{endTime}
37  {}
38 
41  Timestamp const endTime) const
42  {
43  return SubRunAuxiliary{
45  }
46 
47  ProcessHistoryID const&
49  {
50  return processHistoryID_;
51  }
52 
53  void
55  {
56  processHistoryID_ = phid;
57  }
58 
59  SubRunID const&
60  SubRunAuxiliary::id() const noexcept
61  {
62  return id_;
63  }
64 
65  SubRunID const&
66  SubRunAuxiliary::subRunID() const noexcept
67  {
68  return id_;
69  }
70 
71  RunID const&
72  SubRunAuxiliary::runID() const noexcept
73  {
74  return id_.runID();
75  }
76 
78  SubRunAuxiliary::run() const noexcept
79  {
80  return id_.run();
81  }
82 
84  SubRunAuxiliary::subRun() const noexcept
85  {
86  return id_.subRun();
87  }
88 
89  Timestamp const&
90  SubRunAuxiliary::beginTime() const noexcept
91  {
92  return beginTime_;
93  }
94 
95  Timestamp const&
96  SubRunAuxiliary::endTime() const noexcept
97  {
98  return endTime_;
99  }
100 
101  void
102  SubRunAuxiliary::setRangeSetID(unsigned const id) const
103  {
104  rangeSetID_ = id;
105  }
106 
107  unsigned
109  {
110  return rangeSetID_;
111  }
112 
113  void
114  SubRunAuxiliary::write(ostream& os) const
115  {
116  os << "Process History ID = " << processHistoryID_ << endl;
117  os << id_ << endl;
118  }
119 
120  bool
122  {
124  (newAux.beginTime() == Timestamp::invalidTimestamp())) {
126  } else if (newAux.beginTime() < beginTime_) {
127  beginTime_ = newAux.beginTime();
128  }
130  (newAux.endTime() == Timestamp::invalidTimestamp())) {
132  } else if (newAux.endTime() > endTime_) {
133  endTime_ = newAux.endTime();
134  }
135  // Keep the process history ID that is in the preexisting principal
136  // It may have been updated to include the current process.
137  // There is one strange other case where the two ProcessHistoryIDs
138  // could be different which should not be important and we just ignore.
139  // There could have been previous processes which only dropped products.
140  // These processes could have dropped the same branches but had different
141  // process names ... Ignore this.
142  if (id_ != newAux.id()) {
143  return false;
144  }
145  return true;
146  }
147 
148  ostream&
149  operator<<(ostream& os, SubRunAuxiliary const& p)
150  {
151  p.write(os);
152  return os;
153  }
154 
155 } // namespace art
RunID const & runID() const noexcept
void write(std::ostream &os) const
void setProcessHistoryID(ProcessHistoryID const &phid)
STL namespace.
ProcessHistoryID processHistoryID_
SubRunID const & subRunID() const noexcept
SubRunNumber_t subRun() const noexcept
RunID const & runID() const
Definition: SubRunID.h:79
std::ostream & operator<<(std::ostream &os, const GroupSelector &gs)
unsigned rangeSetID() const noexcept
RunNumber_t run() const
Definition: SubRunID.h:85
bool mergeAuxiliary(SubRunAuxiliary const &)
IDNumber_t< Level::SubRun > SubRunNumber_t
Definition: IDNumber.h:119
Timestamp const & endTime() const noexcept
RunNumber_t run() const noexcept
void setRangeSetID(unsigned const id) const
SubRunAuxiliary duplicateWith(Timestamp beginTime, Timestamp endTime={}) const
static constexpr Timestamp invalidTimestamp()
Definition: Timestamp.h:82
SubRunID const & id() const noexcept
ProcessHistoryID const & processHistoryID() const noexcept
Definition: MVAAlg.h:12
SubRunNumber_t subRun() const
Definition: SubRunID.h:91
Timestamp const & beginTime() const noexcept
IDNumber_t< Level::Run > RunNumber_t
Definition: IDNumber.h:120