CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Functions | Variables
trainingvars Namespace Reference

Functions

def get_var_default (varname)
 
def get_var_idx (varname)
 
def get_var_name (varname)
 
def get_var_pset (mvaname)
 
def var_match (varname)
 

Variables

 training_vars
 
 varname_regex_
 

Function Documentation

◆ get_var_default()

def trainingvars.get_var_default (   varname)

Definition at line 93 of file trainingvars.py.

References get_var_name().

Referenced by get_var_pset().

93 def get_var_default(varname):
94  'returns the default value used in the traing'
95  name = get_var_name(varname)
96  return training_vars[name]['default']
97 
def get_var_default(varname)
Definition: trainingvars.py:93
def get_var_name(varname)
Definition: trainingvars.py:81

◆ get_var_idx()

def trainingvars.get_var_idx (   varname)

Definition at line 98 of file trainingvars.py.

References createfilelist.int, and var_match().

Referenced by get_var_pset().

98 def get_var_idx(varname):
99  'returns the index in case of vectorial TaggingVariableName'
100  match = var_match(varname)
101  idx = match.group('idx')
102  return int(idx) if idx else None
103 
def var_match(varname)
Definition: trainingvars.py:70
def get_var_idx(varname)
Definition: trainingvars.py:98

◆ get_var_name()

def trainingvars.get_var_name (   varname)

Definition at line 81 of file trainingvars.py.

References var_match().

Referenced by get_var_default(), and get_var_pset().

81 def get_var_name(varname):
82  'returns the TaggingVariableName of a MVA Name'
83  match = var_match(varname)
84  name = match.group('name')
85  if name not in training_vars:
86  raise ValueError(
87  'Variable name {0}, matched to name {1}, '
88  'is not among the known trainig variables.'.format(
89  varname, name)
90  )
91  return name
92 
def var_match(varname)
Definition: trainingvars.py:70
def get_var_name(varname)
Definition: trainingvars.py:81

◆ get_var_pset()

def trainingvars.get_var_pset (   mvaname)

Definition at line 104 of file trainingvars.py.

References cms::cuda.assert(), get_var_default(), get_var_idx(), and get_var_name().

Referenced by helpers.get_vars().

104 def get_var_pset(mvaname):
105  'returns the cms.PSet to be used by CharmTaggerESProducer'
106  pset = cms.PSet(
107  name = cms.string(mvaname),
108  taggingVarName = cms.string(get_var_name(mvaname)),
109  default = cms.double(get_var_default(mvaname))
110  )
111  idx = get_var_idx(mvaname)
112  if idx is not None:
113  pset.idx = cms.int32(idx)
114  return pset
115 
def get_var_pset(mvaname)
def get_var_default(varname)
Definition: trainingvars.py:93
def get_var_name(varname)
Definition: trainingvars.py:81
def get_var_idx(varname)
Definition: trainingvars.py:98

◆ var_match()

def trainingvars.var_match (   varname)
matches the name used in the MVA training to 
get the TaggingVariableName and index

Definition at line 70 of file trainingvars.py.

Referenced by get_var_idx(), and get_var_name().

70 def var_match(varname):
71  '''matches the name used in the MVA training to
72  get the TaggingVariableName and index'''
73  match = varname_regex_.match(varname)
74  if not match:
75  raise ValueError(
76  'Variable name {0} does not match '
77  'the default regular expression'.format(varname)
78  )
79  return match
80 
def var_match(varname)
Definition: trainingvars.py:70

Variable Documentation

◆ training_vars

trainingvars.training_vars

Definition at line 4 of file trainingvars.py.

◆ varname_regex_

trainingvars.varname_regex_

Definition at line 69 of file trainingvars.py.