File indexing completed on 2024-07-28 22:48:28
0001 #ifndef FWCore_ServiceRegistry_GlobalContext_h
0002 #define FWCore_ServiceRegistry_GlobalContext_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #include "DataFormats/Provenance/interface/LuminosityBlockID.h"
0019 #include "DataFormats/Provenance/interface/Timestamp.h"
0020 #include "FWCore/Utilities/interface/LuminosityBlockIndex.h"
0021 #include "FWCore/Utilities/interface/RunIndex.h"
0022
0023 #include <iosfwd>
0024 #include <string_view>
0025
0026 namespace cms {
0027 class Exception;
0028 }
0029
0030 namespace edm {
0031
0032 class ProcessContext;
0033
0034 class GlobalContext {
0035 public:
0036 enum class Transition {
0037 kBeginJob,
0038 kBeginProcessBlock,
0039 kAccessInputProcessBlock,
0040 kBeginRun,
0041 kBeginLuminosityBlock,
0042 kEndLuminosityBlock,
0043 kEndRun,
0044 kEndProcessBlock,
0045 kEndJob,
0046 kWriteProcessBlock,
0047 kWriteRun,
0048 kWriteLuminosityBlock
0049 };
0050
0051 GlobalContext(Transition transition,
0052 LuminosityBlockID const& luminosityBlockID,
0053 RunIndex const& runIndex,
0054 LuminosityBlockIndex const& luminosityBlockIndex,
0055 Timestamp const& timestamp,
0056 ProcessContext const* processContext);
0057 GlobalContext(Transition transition, ProcessContext const* processContext);
0058
0059 Transition transition() const { return transition_; }
0060 bool isAtEndTransition() const {
0061 return transition() == Transition::kEndLuminosityBlock or transition() == Transition::kEndRun or
0062 transition() == Transition::kEndProcessBlock or transition() == Transition::kWriteRun or
0063 transition() == Transition::kWriteLuminosityBlock or transition() == Transition::kWriteProcessBlock;
0064 }
0065
0066 LuminosityBlockID const& luminosityBlockID() const { return luminosityBlockID_; }
0067 RunIndex const& runIndex() const { return runIndex_; }
0068 LuminosityBlockIndex const& luminosityBlockIndex() const { return luminosityBlockIndex_; }
0069 Timestamp const& timestamp() const { return timestamp_; }
0070 ProcessContext const* processContext() const { return processContext_; }
0071
0072 private:
0073 Transition transition_;
0074 LuminosityBlockID luminosityBlockID_;
0075 RunIndex runIndex_;
0076 LuminosityBlockIndex luminosityBlockIndex_;
0077 Timestamp timestamp_;
0078 ProcessContext const* processContext_;
0079 };
0080
0081 void exceptionContext(std::ostream&, GlobalContext const&);
0082 std::ostream& operator<<(std::ostream&, GlobalContext const&);
0083 void exceptionContext(cms::Exception&, GlobalContext const&, char const* context);
0084
0085 std::string_view transitionName(GlobalContext::Transition);
0086 }
0087 #endif