CMS 3D CMS Logo

dqmPythonTypes.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 from FWCore.ParameterSet.Types import PSet
3 import FWCore.ParameterSet.Config as cms
4 class RunType(PSet):
5  def __init__(self,types=['pp_run','pp_run_stage1','cosmic_run','cosmic_run_stage1','hi_run','hpu_run']):
6  PSet.__init__(self)
7  self.__runTypesDict = {}
8  t=[(x,types.index(x)) for x in types ]
9  for k,v in t:
10  self.__runTypesDict[k] = v
11  self.__dict__[k] = v
12 
13  self.__runType = self.__runTypesDict[types[0]]
14  self.__runTypeName = types[0]
15 
16  def getRunType(self):
17  return self.__runType
18 
19  def getRunTypeName(self):
20  return self.__runTypeName
21 
22  def setRunType(self,rt):
23  if isinstance(rt,int):
24  if rt not in self.__runTypesDict.values():
25  raise TypeError("%d not a valid Run Type" % rt)
26 
27  self.__runType = rt
28  self.__runTypeName = [k for k, v in self.__runTypesDict.items() if v == rt][0]
29  return
30 
31  if isinstance(rt,str):
32  if rt not in self.__runTypesDict.keys():
33  raise TypeError("%s not a valid Run Type" % rt)
34 
35  self.__runTypeName = rt
36  self.__runType = self.__runTypesDict[rt]
37 
38  def __str__(self):
39  return "RunType='%s':%d of %s" % (self.__runTypeName,
40  self.__runType,
41  self.__runTypesDict )
42 
43  def __repr__(self):
44  return "RunType='%s':%d of %s" % (self.__runTypeName,
45  self.__runType,
46  self.__runTypesDict )
47 
def __init__(self, types=['pp_run', pp_run_stage1, cosmic_run, cosmic_run_stage1, hi_run, hpu_run)
def setRunType(self, rt)