CMS 3D CMS Logo

GlobalContext.cc
Go to the documentation of this file.
3 
4 #include <ostream>
5 
6 namespace edm {
7 
9  LuminosityBlockID const& luminosityBlockID,
10  RunIndex const& runIndex,
11  LuminosityBlockIndex const& luminosityBlockIndex,
12  Timestamp const& timestamp,
13  ProcessContext const* processContext)
14  : transition_(transition),
15  luminosityBlockID_(luminosityBlockID),
16  runIndex_(runIndex),
17  luminosityBlockIndex_(luminosityBlockIndex),
18  timestamp_(timestamp),
19  processContext_(processContext) {}
20 
21  GlobalContext::GlobalContext(Transition transition, ProcessContext const* processContext)
22  : transition_(transition),
23  luminosityBlockID_(),
24  runIndex_(RunIndex::invalidRunIndex()),
25  luminosityBlockIndex_(LuminosityBlockIndex::invalidLuminosityBlockIndex()),
26  timestamp_(),
27  processContext_(processContext) {}
28 
29  std::ostream& operator<<(std::ostream& os, GlobalContext const& gc) {
30  os << "GlobalContext: transition = ";
31  switch (gc.transition()) {
33  os << "BeginJob";
34  break;
36  os << "BeginProcessBlock";
37  break;
39  os << "AccessInputProcessBlock";
40  break;
42  os << "BeginRun";
43  break;
45  os << "BeginLuminosityBlock";
46  break;
48  os << "EndLuminosityBlock";
49  break;
51  os << "EndRun";
52  break;
54  os << "EndProcessBlock";
55  break;
57  os << "EndJob";
58  break;
60  os << "WriteProcessBlock";
61  break;
63  os << "WriteRun";
64  break;
66  os << "WriteLuminosityBlock";
67  break;
68  }
69  os << "\n " << gc.luminosityBlockID() << "\n runIndex = " << gc.runIndex().value()
70  << " luminosityBlockIndex = " << gc.luminosityBlockIndex().value()
71  << " unixTime = " << gc.timestamp().unixTime() << " microsecondOffset = " << gc.timestamp().microsecondOffset()
72  << "\n";
73  if (gc.processContext()) {
74  os << " " << *gc.processContext();
75  }
76  return os;
77  }
78 
79  void exceptionContext(std::ostream& os, GlobalContext const& gc) {
80  os << "Processing ";
81  switch (gc.transition()) {
83  os << "begin Job";
84  break;
86  os << "begin ProcessBlock";
87  break;
89  os << "access input ProcessBlock";
90  break;
92  os << "global begin Run " << RunID(gc.luminosityBlockID().run());
93  break;
95  os << "global begin LuminosityBlock " << gc.luminosityBlockID();
96  break;
98  os << "global end LuminosityBlock " << gc.luminosityBlockID();
99  break;
101  os << "global end Run " << RunID(gc.luminosityBlockID().run());
102  break;
104  os << "end ProcessBlock";
105  break;
107  os << "endJob";
108  break;
110  os << "write ProcessBlock";
111  break;
113  os << "write Run " << RunID(gc.luminosityBlockID().run());
114  break;
116  os << "write LuminosityBlock " << gc.luminosityBlockID();
117  break;
118  }
119  }
120 
121  std::string_view transitionName(GlobalContext::Transition iTrans) {
122  switch (iTrans) {
124  return "begin Job";
126  return "begin ProcessBlock";
128  return "access input ProcessBlock";
130  return "global begin Run";
132  return "global begin LuminosityBlock";
134  return "global end LuminosityBlock";
136  return "global end Run";
138  return "end ProcessBlock";
140  return "endJob";
142  return "write ProcessBlock";
144  return "write Run";
146  return "write LuminosityBlock";
147  }
148  return "Unknown";
149  }
150 } // namespace edm
std::string_view transitionName(GlobalContext::Transition)
void exceptionContext(cms::Exception &, ESModuleCallingContext const &)
unsigned int value() const
Definition: RunIndex.h:45
unsigned int value() const
GlobalContext(Transition transition, LuminosityBlockID const &luminosityBlockID, RunIndex const &runIndex, LuminosityBlockIndex const &luminosityBlockIndex, Timestamp const &timestamp, ProcessContext const *processContext)
Definition: GlobalContext.cc:8
unsigned int microsecondOffset() const
Microseconds offset within second.
Definition: Timestamp.h:36
LuminosityBlockIndex const & luminosityBlockIndex() const
Definition: GlobalContext.h:64
ProcessContext const * processContext() const
Definition: GlobalContext.h:66
LuminosityBlockID const & luminosityBlockID() const
Definition: GlobalContext.h:62
Timestamp const & timestamp() const
Definition: GlobalContext.h:65
RunNumber_t run() const
Transition transition() const
Definition: GlobalContext.h:55
RunIndex const & runIndex() const
Definition: GlobalContext.h:63
HLT enums.
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
unsigned int unixTime() const
Time in seconds since January 1, 1970.
Definition: Timestamp.h:33