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 
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
edm::StreamID
Definition: StreamID.h:30
edm::exceptionContext
void exceptionContext(std::ostream &, GlobalContext const &)
Definition: GlobalContext.cc:71
edm::RunID
Definition: RunID.h:28
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::ProcessContext
Definition: ProcessContext.h:27
edm::Timestamp::unixTime
unsigned int unixTime() const
Time in seconds since January 1, 1970.
Definition: Timestamp.h:40
edm::StreamContext::Transition::kBeginRun
edm::StreamContext::Transition::kEndRun
edm::StreamContext::Transition
Transition
Definition: StreamContext.h:33
LuminosityBlockID.h
edm::operator<<
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
Definition: HLTGlobalStatus.h:106
edm::LuminosityBlockIndex::value
unsigned int value() const
Definition: LuminosityBlockIndex.h:47
cond::timestamp
Definition: Time.h:19
edm::LuminosityBlockIndex
Definition: LuminosityBlockIndex.h:33
edm::StreamContext
Definition: StreamContext.h:31
edm::StreamContext::Transition::kBeginStream
edm::StreamContext::Transition::kBeginLuminosityBlock
edm::StreamContext::Transition::kEndLuminosityBlock
edm::LuminosityBlockID
Definition: LuminosityBlockID.h:31
csv2json.runIndex
runIndex
Definition: csv2json.py:29
edm::StreamContext::luminosityBlockIndex
LuminosityBlockIndex const & luminosityBlockIndex() const
Definition: StreamContext.h:61
edm::StreamContext::streamID
StreamID const & streamID() const
Definition: StreamContext.h:54
edm::StreamContext::processContext
ProcessContext const * processContext() const
Definition: StreamContext.h:63
edm::StreamContext::transition
Transition transition() const
Definition: StreamContext.h:55
edm::StreamContext::Transition::kEvent
edm::StreamContext::StreamContext
StreamContext(StreamID const &streamID, ProcessContext const *processContext)
Definition: StreamContext.cc:9
edm::Timestamp::microsecondOffset
unsigned int microsecondOffset() const
Microseconds offset within second.
Definition: Timestamp.h:43
edm::StreamContext::runIndex
RunIndex const & runIndex() const
Definition: StreamContext.h:60
writedatasetfile.run
run
Definition: writedatasetfile.py:27
edm::RunIndex
Definition: RunIndex.h:32
edm::StreamContext::timestamp
Timestamp const & timestamp() const
Definition: StreamContext.h:62
StreamContext.h
edm::EventID
Definition: EventID.h:31
ProcessContext.h
edm::RunIndex::value
unsigned int value() const
Definition: RunIndex.h:45
edm::StreamContext::eventID
EventID const & eventID() const
Definition: StreamContext.h:59
edm::StreamContext::Transition::kInvalid
edm::StreamContext::Transition::kEndStream
edm::Timestamp
Definition: Timestamp.h:30