CMS 3D CMS Logo

Classes | Functions | Variables
mvaPhotonID_tools Namespace Reference

Classes

class  PhoMVA_2Categories_WP
 

Functions

def configureFullVIDMVAPhoID (mvaTag, variablesFile, weightFiles, wpConfig, addKwargsForValueProducer)
 
def configureVIDMVAPhoID_V1 (mvaWP)
 

Variables

 ebeeSplit
 
 mvaClassName
 
 mvaProducerModuleLabel
 
 weightFileBaseDir
 

Function Documentation

def mvaPhotonID_tools.configureFullVIDMVAPhoID (   mvaTag,
  variablesFile,
  weightFiles,
  wpConfig,
  addKwargsForValueProducer 
)

Definition at line 88 of file mvaPhotonID_tools.py.

References configureVIDMVAPhoID_V1().

88 def configureFullVIDMVAPhoID(mvaTag, variablesFile, weightFiles, wpConfig, **addKwargsForValueProducer):
89 
90  mvaValueMapName = mvaProducerModuleLabel + ":" + mvaClassName + mvaTag + "Values"
91  mvaCategoriesMapName = mvaProducerModuleLabel + ":" + mvaClassName + mvaTag + "Categories"
92 
93  # Create the PSet that will be fed to the MVA value map producer
94  producer_config = cms.PSet(
95  mvaName = cms.string(mvaClassName),
96  mvaTag = cms.string(mvaTag),
97  weightFileNames = cms.vstring(*weightFiles),
98  variableDefinition = cms.string(variablesFile),
99  ebeeSplit = cms.double(ebeeSplit),
100  **addKwargsForValueProducer
101  )
102 
103  # Create the VPset's for VID cuts
104  VID_config = {}
105  for wpc in wpConfig:
106  idName = wpc["idName"]
107  VID_config[idName] = configureVIDMVAPhoID_V1(
109  idName = idName,
110  mvaValueMapName = mvaValueMapName, # map with MVA values for all particles
111  mvaCategoriesMapName = mvaCategoriesMapName, # map with category index for all particles
112  cutCategory0 = wpc["cuts"]["EB"], # EB
113  cutCategory1 = wpc["cuts"]["EE"] # EE
114  )
115  )
116 
117  configs = {"producer_config": producer_config, "VID_config": VID_config}
118  return configs
119 
def configureFullVIDMVAPhoID(mvaTag, variablesFile, weightFiles, wpConfig, addKwargsForValueProducer)
def configureVIDMVAPhoID_V1(mvaWP)
def mvaPhotonID_tools.configureVIDMVAPhoID_V1 (   mvaWP)
This function configures the full cms.PSet for a VID ID and returns it.
The inputs: an object of the class PhoMVA_2Categories_WP or similar
that contains all necessary parameters for this MVA.

Definition at line 49 of file mvaPhotonID_tools.py.

Referenced by configureFullVIDMVAPhoID().

50  """
51  This function configures the full cms.PSet for a VID ID and returns it.
52  The inputs: an object of the class PhoMVA_2Categories_WP or similar
53  that contains all necessary parameters for this MVA.
54  """
55  parameterSet = cms.PSet(
56  #
57  idName = cms.string( mvaWP.idName ),
58  cutFlow = cms.VPSet(
59  cms.PSet( cutName = cms.string("PhoMVACut"),
60  mvaCuts = cms.vdouble( mvaWP.getCutValues() ),
61  mvaValueMapName = cms.InputTag( mvaWP.mvaValueMapName ),
62  mvaCategoriesMapName =cms.InputTag( mvaWP.mvaCategoriesMapName ),
63  needsAdditionalProducts = cms.bool(True),
64  isIgnored = cms.bool(False)
65  )
66  )
67  )
68  #
69  return parameterSet
70 
71 # ===============================================
72 # High level function to create a two category ID
73 # ===============================================
74 
75 # mvaTag:
76 # The mvaTag is an extra string attached to the names of the products
77 # such as ValueMaps that needs to distinguish cases when the same MVA estimator
78 # class is used with different tuning/weights
79 # variablesFile:
80 # The file listing the variables used in this MVA
81 # weightFiles:
82 # The weight files in the order EB first, then EE
83 # wpConfig:
84 # A dictionary with the names and cut values of the working points
85 # addKwargsForValueProducer:
86 # Additional keyword parameters passed to the producer config
87 
def configureVIDMVAPhoID_V1(mvaWP)

Variable Documentation

mvaPhotonID_tools.ebeeSplit

Definition at line 8 of file mvaPhotonID_tools.py.

mvaPhotonID_tools.mvaClassName

Definition at line 11 of file mvaPhotonID_tools.py.

mvaPhotonID_tools.mvaProducerModuleLabel

Definition at line 17 of file mvaPhotonID_tools.py.

mvaPhotonID_tools.weightFileBaseDir

Definition at line 5 of file mvaPhotonID_tools.py.