CMS 3D CMS Logo

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

Classes

class  PhoMVA_2Categories_WP
 

Functions

def configureFullVIDMVAPhoID
 
def configureVIDMVAPhoID_V1
 

Variables

tuple category_cuts
 
float ebeeSplit = 1.479
 
string mvaClassName = "PhotonMVAEstimator"
 
string mvaProducerModuleLabel = "photonMVAValueMapProducer"
 
string weightFileBaseDir = "RecoEgamma/PhotonIdentification/data/MVA"
 

Function Documentation

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

Definition at line 93 of file mvaPhotonID_tools.py.

References configureVIDMVAPhoID_V1().

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

Referenced by configureFullVIDMVAPhoID().

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

Variable Documentation

tuple mvaPhotonID_tools.category_cuts
Initial value:
1 = cms.vstring(
2  "abs(superCluster.eta) < 1.479",
3  "abs(superCluster.eta) >= 1.479",
4  )

Definition at line 10 of file mvaPhotonID_tools.py.

float mvaPhotonID_tools.ebeeSplit = 1.479

Definition at line 8 of file mvaPhotonID_tools.py.

string mvaPhotonID_tools.mvaClassName = "PhotonMVAEstimator"

Definition at line 16 of file mvaPhotonID_tools.py.

string mvaPhotonID_tools.mvaProducerModuleLabel = "photonMVAValueMapProducer"

Definition at line 22 of file mvaPhotonID_tools.py.

string mvaPhotonID_tools.weightFileBaseDir = "RecoEgamma/PhotonIdentification/data/MVA"

Definition at line 5 of file mvaPhotonID_tools.py.