CMS 3D CMS Logo

StreamContext.cc
Go to the documentation of this file.
4 
5 #include <ostream>
6 
7 namespace edm {
8 
9  StreamContext::StreamContext(StreamID const& streamID, ProcessContext const* processContext)
10  : streamID_(streamID),
11  transition_(Transition::kInvalid),
12  eventID_(EventID(0, 0, 0)),
13  runIndex_(RunIndex::invalidRunIndex()),
14  luminosityBlockIndex_(LuminosityBlockIndex::invalidLuminosityBlockIndex()),
15  timestamp_(),
16  processContext_(processContext) {}
17 
20  EventID const& eventID,
21  RunIndex const& runIndex,
23  Timestamp const& timestamp,
25  : streamID_(streamID),
26  transition_(transition),
27  eventID_(eventID),
28  runIndex_(runIndex),
29  luminosityBlockIndex_(luminosityBlockIndex),
30  timestamp_(timestamp),
31  processContext_(processContext) {}
32 
33  std::ostream& operator<<(std::ostream& os, StreamContext const& sc) {
34  os << "StreamContext: StreamID = " << sc.streamID() << " transition = ";
35  switch (sc.transition()) {
37  os << "BeginStream";
38  break;
40  os << "BeginRun";
41  break;
43  os << "BeginLuminosityBlock";
44  break;
46  os << "Event";
47  break;
49  os << "EndLuminosityBlock";
50  break;
52  os << "EndRun";
53  break;
55  os << "EndStream";
56  break;
58  os << "Invalid";
59  break;
60  }
61  os << "\n " << sc.eventID() << "\n runIndex = " << sc.runIndex().value()
62  << " luminosityBlockIndex = " << sc.luminosityBlockIndex().value()
63  << " unixTime = " << sc.timestamp().unixTime() << " microsecondOffset = " << sc.timestamp().microsecondOffset()
64  << "\n";
65  if (sc.processContext()) {
66  os << " " << *sc.processContext();
67  }
68  return os;
69  }
70 
71  void exceptionContext(std::ostream& os, StreamContext const& sc) {
72  os << "Processing ";
73  auto id = sc.eventID();
74  switch (sc.transition()) {
76  os << "begin Stream";
77  break;
79  os << "stream begin Run " << RunID(id.run());
80  break;
82  os << "stream begin LuminosityBlock " << LuminosityBlockID(id.run(), id.luminosityBlock());
83  break;
85  os << "Event " << sc.eventID();
86  break;
88  os << "stream end LuminosityBlock " << LuminosityBlockID(id.run(), id.luminosityBlock());
89  break;
91  os << "stream end Run " << RunID(id.run());
92  break;
94  os << "end Stream";
95  break;
97  os << "Invalid";
98  break;
99  }
100  os << " stream: " << sc.streamID();
101  }
102 
103 } // namespace edm
LuminosityBlockIndex const & luminosityBlockIndex() const
Definition: StreamContext.h:61
ProcessContext const * processContext_
Definition: StreamContext.h:78
unsigned int value() const
Definition: RunIndex.h:44
RunIndex const & runIndex() const
Definition: StreamContext.h:60
void exceptionContext(std::ostream &, GlobalContext const &)
unsigned int microsecondOffset() const
Microseconds offset within second.
Definition: Timestamp.h:52
Transition transition() const
Definition: StreamContext.h:55
StreamContext(StreamID const &streamID, ProcessContext const *processContext)
Definition: StreamContext.cc:9
unsigned int value() const
unsigned int unixTime() const
Time in seconds since January 1, 1970.
Definition: Timestamp.h:46
ProcessContext const * processContext() const
Definition: StreamContext.h:63
StreamID const & streamID() const
Definition: StreamContext.h:54
Timestamp timestamp_
Definition: StreamContext.h:77
HLT enums.
LuminosityBlockIndex luminosityBlockIndex_
Definition: StreamContext.h:76
EventID const & eventID() const
Definition: StreamContext.h:59
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
Transition transition_
Definition: StreamContext.h:73
Timestamp const & timestamp() const
Definition: StreamContext.h:62