CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
ntupleEnum._Enum Class Reference

Public Member Functions

def __init__
 
def toString
 

Private Attributes

 _reverse
 

Detailed Description

Definition at line 2 of file ntupleEnum.py.

Constructor & Destructor Documentation

def ntupleEnum._Enum.__init__ (   self,
  values 
)

Definition at line 3 of file ntupleEnum.py.

3 
4  def __init__(self, **values):
5  self._reverse = {}
6  for key, value in values.items():
7  setattr(self, key, value)
8  if value in self._reverse:
9  raise Exception("Value %s is already used for a key %s, tried to re-add it for key %s" % (value, self._reverse[value], key))
10  self._reverse[value] = key

Member Function Documentation

def ntupleEnum._Enum.toString (   self,
  val 
)

Definition at line 11 of file ntupleEnum.py.

References ntupleEnum._Enum._reverse.

11 
12  def toString(self, val):
13  return self._reverse[val]

Member Data Documentation

ntupleEnum._Enum._reverse
private

Definition at line 4 of file ntupleEnum.py.

Referenced by ntupleEnum._Enum.toString().