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