File indexing completed on 2024-04-06 12:07:42
0001
0002 from FWCore.ParameterSet.Types import PSet
0003 import FWCore.ParameterSet.Config as cms
0004 class RunType(PSet):
0005 def __init__(self,types=['pp_run','pp_run_stage1','cosmic_run','cosmic_run_stage1','hi_run','hpu_run','commissioning_run']):
0006 PSet.__init__(self)
0007 self.__runTypesDict = {}
0008 t=[(x,types.index(x)) for x in types ]
0009 for k,v in t:
0010 self.__runTypesDict[k] = v
0011 self.__dict__[k] = v
0012
0013 self.__runType = self.__runTypesDict[types[0]]
0014 self.__runTypeName = types[0]
0015
0016 def getRunType(self):
0017 return self.__runType
0018
0019 def getRunTypeName(self):
0020 return self.__runTypeName
0021
0022 def setRunType(self,rt):
0023 if isinstance(rt,int):
0024 if rt not in self.__runTypesDict.values():
0025 raise TypeError("%d not a valid Run Type" % rt)
0026
0027 self.__runType = rt
0028 self.__runTypeName = [k for k, v in self.__runTypesDict.items() if v == rt][0]
0029 return
0030
0031 if isinstance(rt,str):
0032 if rt not in self.__runTypesDict.keys():
0033 raise TypeError("%s not a valid Run Type" % rt)
0034
0035 self.__runTypeName = rt
0036 self.__runType = self.__runTypesDict[rt]
0037
0038 def __str__(self):
0039 return "RunType='%s':%d of %s" % (self.__runTypeName,
0040 self.__runType,
0041 self.__runTypesDict )
0042
0043 def __repr__(self):
0044 return "RunType='%s':%d of %s" % (self.__runTypeName,
0045 self.__runType,
0046 self.__runTypesDict )
0047