CMS 3D CMS Logo

StreamContext.cc
Go to the documentation of this file.
4 
5 #include <ostream>
6 
7 namespace edm {
8 
10  ProcessContext const* processContext) :
11  streamID_(streamID),
12  transition_(Transition::kInvalid),
13  eventID_(EventID(0,0,0)),
14  runIndex_(RunIndex::invalidRunIndex()),
15  luminosityBlockIndex_(LuminosityBlockIndex::invalidLuminosityBlockIndex()),
16  timestamp_(),
17  processContext_(processContext) {
18  }
19 
22  EventID const& eventID,
23  RunIndex const& runIndex,
25  Timestamp const& timestamp,
27  streamID_(streamID),
28  transition_(transition),
29  eventID_(eventID),
30  runIndex_(runIndex),
31  luminosityBlockIndex_(luminosityBlockIndex),
32  timestamp_(timestamp),
33  processContext_(processContext) {
34  }
35 
36  std::ostream& operator<<(std::ostream& os, StreamContext const& sc) {
37  os << "StreamContext: StreamID = " << sc.streamID()
38  << " transition = ";
39  switch (sc.transition()) {
41  os << "BeginStream";
42  break;
44  os << "BeginRun";
45  break;
47  os << "BeginLuminosityBlock";
48  break;
50  os << "Event";
51  break;
53  os << "EndLuminosityBlock";
54  break;
56  os << "EndRun";
57  break;
59  os << "EndStream";
60  break;
62  os << "Invalid";
63  break;
64  }
65  os << "\n " << sc.eventID()
66  << "\n runIndex = " << sc.runIndex().value()
67  << " luminosityBlockIndex = " << sc.luminosityBlockIndex().value()
68  << " unixTime = " << sc.timestamp().unixTime()
69  << " microsecondOffset = " << sc.timestamp().microsecondOffset() <<"\n";
70  if(sc.processContext()) {
71  os << " " << *sc.processContext();
72  }
73  return os;
74  }
75 
76  void exceptionContext(std::ostream& os, StreamContext const& sc) {
77  os << "Processing " ;
78  auto id = sc.eventID();
79  switch (sc.transition()) {
81  os << "begin Stream";
82  break;
84  os << "stream begin Run " <<RunID(id.run());
85  break;
87  os << "stream begin LuminosityBlock "<<LuminosityBlockID(id.run(), id.luminosityBlock());
88  break;
90  os << "Event "<<sc.eventID();
91  break;
93  os << "stream end LuminosityBlock "<<LuminosityBlockID(id.run(), id.luminosityBlock());
94  break;
96  os << "stream end Run "<<RunID(id.run());
97  break;
99  os << "end Stream";
100  break;
102  os << "Invalid";
103  break;
104  }
105  os <<" stream: "<<sc.streamID();
106  }
107 
108 }
LuminosityBlockIndex const & luminosityBlockIndex() const
Definition: StreamContext.h:61
ProcessContext const * processContext_
Definition: StreamContext.h:78
unsigned int value() const
Definition: RunIndex.h:50
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:58
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:57
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