CMS 3D CMS Logo

mvaPhotonID_tools.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 from PhysicsTools.SelectorUtils.centralIDRegistry import central_id_registry
3 import os.path
4 
5 weightFileBaseDir = "RecoEgamma/PhotonIdentification/data/MVA"
6 
7 # =======================================================
8 # Define simple containers for MVA cut values and related
9 # =======================================================
10 
12  """
13  This is a container class to hold MVA cut values for a 2-category MVA
14  as well as the names of the value maps that contain the MVA values computed
15  for all particles in a producer upstream.
16  """
17  def __init__(self,
18  idName,
19  mvaValueMapName,
20  mvaCategoriesMapName,
21  cutCategory0,
22  cutCategory1
23  ):
24  self.idName = idName
25  self.mvaValueMapName = mvaValueMapName
26  self.mvaCategoriesMapName = mvaCategoriesMapName
27  self.cutCategory0 = cutCategory0
28  self.cutCategory1 = cutCategory1
29 
30  def getCutValues(self):
31  return [self.cutCategory0, self.cutCategory1]
32 
33 # ==============================================================
34 # Define the complete MVA cut sets
35 # ==============================================================
36 
38  """
39  This function configures the full cms.PSet for a VID ID and returns it.
40  The inputs: an object of the class PhoMVA_2Categories_WP or similar
41  that contains all necessary parameters for this MVA.
42  """
43  parameterSet = cms.PSet(
44  #
45  idName = cms.string( mvaWP.idName ),
46  cutFlow = cms.VPSet(
47  cms.PSet( cutName = cms.string("PhoMVACut"),
48  mvaCuts = cms.vdouble( mvaWP.getCutValues() ),
49  mvaValueMapName = cms.InputTag( mvaWP.mvaValueMapName ),
50  mvaCategoriesMapName =cms.InputTag( mvaWP.mvaCategoriesMapName ),
51  needsAdditionalProducts = cms.bool(True),
52  isIgnored = cms.bool(False)
53  )
54  )
55  )
56  #
57  return parameterSet
def __init__(self, idName, mvaValueMapName, mvaCategoriesMapName, cutCategory0, cutCategory1)
def configureVIDMVAPhoID_V1(mvaWP)