CMS 3D CMS Logo

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