CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
19  Transition transition,
20  EventID const& eventID,
21  RunIndex const& runIndex,
22  LuminosityBlockIndex const& luminosityBlockIndex,
23  Timestamp const& timestamp,
24  ProcessContext const* processContext)
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
void exceptionContext(cms::Exception &, ESModuleCallingContext const &)
unsigned int value() const
Definition: RunIndex.h:45
RunIndex const & runIndex() const
Definition: StreamContext.h:60
unsigned int microsecondOffset() const
Microseconds offset within second.
Definition: Timestamp.h:43
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:40
ProcessContext const * processContext() const
Definition: StreamContext.h:63
StreamID const & streamID() const
Definition: StreamContext.h:54
EventID const & eventID() const
Definition: StreamContext.h:59
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
Timestamp const & timestamp() const
Definition: StreamContext.h:62