CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
mvaElectronID_tools.py
Go to the documentation of this file.
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 6-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  cutCategory2,
20  cutCategory3,
21  cutCategory4,
22  cutCategory5
23  ):
24  self.idName = idName
25  self.mvaValueMapName = mvaValueMapName
26  self.mvaCategoriesMapName = mvaCategoriesMapName
27  self.cutCategory0 = cutCategory0
28  self.cutCategory1 = cutCategory1
29  self.cutCategory2 = cutCategory2
30  self.cutCategory3 = cutCategory3
31  self.cutCategory4 = cutCategory4
32  self.cutCategory5 = cutCategory5
33 
34  def getCutValues(self):
35  return [self.cutCategory0, self.cutCategory1, self.cutCategory2,
36  self.cutCategory3, self.cutCategory4, self.cutCategory5]
37 
38 # ==============================================================
39 # Define the complete MVA cut sets
40 # ==============================================================
41 
43  """
44  This function configures the full cms.PSet for a VID ID and returns it.
45  The inputs: an object of the class EleMVA_6Categories_WP or similar
46  that contains all necessary parameters for this MVA.
47  """
48  parameterSet = cms.PSet(
49  #
50  idName = cms.string( mvaWP.idName ),
51  cutFlow = cms.VPSet(
52  cms.PSet( cutName = cms.string("GsfEleMVACut"),
53  mvaCuts = cms.vdouble( mvaWP.getCutValues() ),
54  mvaValueMapName = cms.InputTag( mvaWP.mvaValueMapName ),
55  mvaCategoriesMapName =cms.InputTag( mvaWP.mvaCategoriesMapName ),
56  needsAdditionalProducts = cms.bool(True),
57  isIgnored = cms.bool(False)
58  )
59  )
60  )
61  #
62  return parameterSet