Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:29:20

0001 #ifndef FWCore_Utilities_Transition_h
0002 #define FWCore_Utilities_Transition_h
0003 /*----------------------------------------------------------------------
0004 
0005 Transition: The allowed framework transitions
0006 
0007 ----------------------------------------------------------------------*/
0008 #include "FWCore/Utilities/interface/BranchType.h"
0009 #include <type_traits>
0010 
0011 namespace edm {
0012   enum class Transition {
0013     Event,
0014     BeginLuminosityBlock,
0015     EndLuminosityBlock,
0016     BeginRun,
0017     EndRun,
0018     BeginProcessBlock,
0019     EndProcessBlock,
0020     AccessInputProcessBlock,
0021     NumberOfTransitions,
0022     NumberOfEventSetupTransitions = BeginProcessBlock
0023   };
0024 
0025   //Useful for converting EndBranchType to BranchType
0026   constexpr BranchType convertToBranchType(Transition iValue) {
0027     constexpr BranchType branches[] = {InEvent, InLumi, InLumi, InRun, InRun, InProcess, InProcess};
0028     return branches[static_cast<std::underlying_type<Transition>::type>(iValue)];
0029   }
0030 
0031   constexpr Transition convertToTransition(BranchType iValue) {
0032     constexpr Transition trans[] = {
0033         Transition::Event, Transition::BeginLuminosityBlock, Transition::BeginRun, Transition::BeginProcessBlock};
0034     return trans[iValue];
0035   }
0036 
0037   constexpr bool isEndTransition(Transition iValue) {
0038     return iValue == Transition::EndLuminosityBlock or iValue == Transition::EndRun or
0039            iValue == Transition::EndProcessBlock;
0040   }
0041 
0042 }  // namespace edm
0043 #endif