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

 category_cuts
 
 ebeeSplit
 
 mvaClassName
 
 mvaProducerModuleLabel
 
 weightFileBaseDir
 

Function Documentation

◆ configureFullVIDMVAPhoID()

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

Definition at line 93 of file mvaPhotonID_tools.py.

93 def configureFullVIDMVAPhoID(mvaTag, variablesFile, weightFiles, wpConfig, **addKwargsForValueProducer):
94 
95  mvaValueMapName = mvaProducerModuleLabel + ":" + mvaClassName + mvaTag + "Values"
96  mvaCategoriesMapName = mvaProducerModuleLabel + ":" + mvaClassName + mvaTag + "Categories"
97 
98  # Create the PSet that will be fed to the MVA value map producer
99  producer_config = cms.PSet(
100  mvaName = cms.string(mvaClassName),
101  mvaTag = cms.string(mvaTag),
102  weightFileNames = cms.vstring(*weightFiles),
103  variableDefinition = cms.string(variablesFile),
104  **addKwargsForValueProducer
105  )
106 
107  # Create the VPset's for VID cuts
108  VID_config = {}
109  for wpc in wpConfig:
110  idName = wpc["idName"]
111  VID_config[idName] = configureVIDMVAPhoID_V1(
112  PhoMVA_2Categories_WP(
113  idName = idName,
114  mvaValueMapName = mvaValueMapName, # map with MVA values for all particles
115  mvaCategoriesMapName = mvaCategoriesMapName, # map with category index for all particles
116  cutCategory0 = wpc["cuts"]["EB"], # EB
117  cutCategory1 = wpc["cuts"]["EE"] # EE
118  )
119  )
120 
121  configs = {"producer_config": producer_config, "VID_config": VID_config}
122  return configs

References configureVIDMVAPhoID_V1().

◆ configureVIDMVAPhoID_V1()

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 54 of file mvaPhotonID_tools.py.

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

Referenced by configureFullVIDMVAPhoID().

Variable Documentation

◆ category_cuts

mvaPhotonID_tools.category_cuts

Definition at line 10 of file mvaPhotonID_tools.py.

◆ ebeeSplit

mvaPhotonID_tools.ebeeSplit

Definition at line 8 of file mvaPhotonID_tools.py.

◆ mvaClassName

mvaPhotonID_tools.mvaClassName

Definition at line 16 of file mvaPhotonID_tools.py.

◆ mvaProducerModuleLabel

mvaPhotonID_tools.mvaProducerModuleLabel

Definition at line 22 of file mvaPhotonID_tools.py.

◆ weightFileBaseDir

mvaPhotonID_tools.weightFileBaseDir

Definition at line 5 of file mvaPhotonID_tools.py.

mvaPhotonID_tools.configureVIDMVAPhoID_V1
def configureVIDMVAPhoID_V1(mvaWP)
Definition: mvaPhotonID_tools.py:54
mvaPhotonID_tools.configureFullVIDMVAPhoID
def configureFullVIDMVAPhoID(mvaTag, variablesFile, weightFiles, wpConfig, **addKwargsForValueProducer)
Definition: mvaPhotonID_tools.py:93