CMS 3D CMS Logo

ElectronMVAID.py
Go to the documentation of this file.
1 import ROOT
2 
4  def __init__(self,name,type,*xmls):
5  self.name = name
6  self.estimator = ROOT.heppy.EGammaMvaEleEstimatorFWLite()
7  self.sxmls = ROOT.vector(ROOT.string)()
8  for x in xmls: self.sxmls.push_back(x)
9  self.etype = -1
10  if type == "Trig": self.etype = self.estimator.kTrig;
11  if type == "NonTrig": self.etype = self.estimator.kNonTrig;
12  if type == "TrigNoIP": self.etype = self.estimator.kTrigNoIP;
13  if type == "TrigCSA14": self.etype = self.estimator.kTrigCSA14;
14  if type == "NonTrigCSA14": self.etype = self.estimator.kNonTrigCSA14;
15  if type == "NonTrigPhys14": self.etype = self.estimator.kNonTrigPhys14;
16  if self.etype == -1: raise RuntimeError("Unknown type %s" % type)
17  self._init = False
18  def __call__(self,ele,vtx,rho,full5x5=False,debug=False):
19  if not self._init:
20  self.estimator.initialize(self.name,self.etype,True,self.sxmls)
21  self._init = True
22  return self.estimator.mvaValue(ele,vtx,rho,full5x5,debug)
23 
24 ElectronMVAID_Trig = ElectronMVAID("BDT", "Trig",
25  "EgammaAnalysis/ElectronTools/data/Electrons_BDTG_TrigV0_Cat1.weights.xml.gz",
26  "EgammaAnalysis/ElectronTools/data/Electrons_BDTG_TrigV0_Cat2.weights.xml.gz",
27  "EgammaAnalysis/ElectronTools/data/Electrons_BDTG_TrigV0_Cat3.weights.xml.gz",
28  "EgammaAnalysis/ElectronTools/data/Electrons_BDTG_TrigV0_Cat4.weights.xml.gz",
29  "EgammaAnalysis/ElectronTools/data/Electrons_BDTG_TrigV0_Cat5.weights.xml.gz",
30  "EgammaAnalysis/ElectronTools/data/Electrons_BDTG_TrigV0_Cat6.weights.xml.gz",
31 )
32 ElectronMVAID_NonTrig = ElectronMVAID("BDT", "NonTrig",
33  "EgammaAnalysis/ElectronTools/data/Electrons_BDTG_NonTrigV0_Cat1.weights.xml.gz",
34  "EgammaAnalysis/ElectronTools/data/Electrons_BDTG_NonTrigV0_Cat2.weights.xml.gz",
35  "EgammaAnalysis/ElectronTools/data/Electrons_BDTG_NonTrigV0_Cat3.weights.xml.gz",
36  "EgammaAnalysis/ElectronTools/data/Electrons_BDTG_NonTrigV0_Cat4.weights.xml.gz",
37  "EgammaAnalysis/ElectronTools/data/Electrons_BDTG_NonTrigV0_Cat5.weights.xml.gz",
38  "EgammaAnalysis/ElectronTools/data/Electrons_BDTG_NonTrigV0_Cat6.weights.xml.gz",
39 )
40 ElectronMVAID_TrigNoIP = ElectronMVAID("BDT", "TrigNoIP",
41  "EgammaAnalysis/ElectronTools/data/Electrons_BDTG_TrigNoIPV0_2012_Cat1.weights.xml.gz",
42  "EgammaAnalysis/ElectronTools/data/Electrons_BDTG_TrigNoIPV0_2012_Cat2.weights.xml.gz",
43  "EgammaAnalysis/ElectronTools/data/Electrons_BDTG_TrigNoIPV0_2012_Cat3.weights.xml.gz",
44  "EgammaAnalysis/ElectronTools/data/Electrons_BDTG_TrigNoIPV0_2012_Cat4.weights.xml.gz",
45  "EgammaAnalysis/ElectronTools/data/Electrons_BDTG_TrigNoIPV0_2012_Cat5.weights.xml.gz",
46  "EgammaAnalysis/ElectronTools/data/Electrons_BDTG_TrigNoIPV0_2012_Cat6.weights.xml.gz",
47 )
48 
49 ElectronMVAID_TrigCSA14bx50 = ElectronMVAID("BDT", "TrigCSA14",
50  "EgammaAnalysis/ElectronTools/data/CSA14/TrigIDMVA_50ns_EB_BDT.weights.xml.gz",
51  "EgammaAnalysis/ElectronTools/data/CSA14/TrigIDMVA_50ns_EE_BDT.weights.xml.gz",
52 )
53 ElectronMVAID_TrigCSA14bx25 = ElectronMVAID("BDT", "TrigCSA14",
54  "EgammaAnalysis/ElectronTools/data/CSA14/TrigIDMVA_25ns_EB_BDT.weights.xml.gz",
55  "EgammaAnalysis/ElectronTools/data/CSA14/TrigIDMVA_25ns_EE_BDT.weights.xml.gz",
56 )
57 
58 ElectronMVAID_NonTrigCSA14bx25 = ElectronMVAID("BDT", "NonTrigCSA14",
59  "EgammaAnalysis/ElectronTools/data/CSA14/EIDmva_EB_5_25ns_BDT.weights.xml.gz",
60  "EgammaAnalysis/ElectronTools/data/CSA14/EIDmva_EE_5_25ns_BDT.weights.xml.gz",
61  "EgammaAnalysis/ElectronTools/data/CSA14/EIDmva_EB_10_25ns_BDT.weights.xml.gz",
62  "EgammaAnalysis/ElectronTools/data/CSA14/EIDmva_EE_10_25ns_BDT.weights.xml.gz",
63 )
64 ElectronMVAID_NonTrigCSA14bx50 = ElectronMVAID("BDT", "NonTrigCSA14",
65  "EgammaAnalysis/ElectronTools/data/CSA14/EIDmva_EB_5_50ns_BDT.weights.xml.gz",
66  "EgammaAnalysis/ElectronTools/data/CSA14/EIDmva_EE_5_50ns_BDT.weights.xml.gz",
67  "EgammaAnalysis/ElectronTools/data/CSA14/EIDmva_EB_10_50ns_BDT.weights.xml.gz",
68  "EgammaAnalysis/ElectronTools/data/CSA14/EIDmva_EE_10_50ns_BDT.weights.xml.gz",
69 )
70 
71 ElectronMVAID_NonTrigPhys14 = ElectronMVAID("BDT", "NonTrigPhys14",
72  "EgammaAnalysis/ElectronTools/data/PHYS14/EIDmva_EB1_5_oldscenario2phys14_BDT.weights.xml.gz",
73  "EgammaAnalysis/ElectronTools/data/PHYS14/EIDmva_EB2_5_oldscenario2phys14_BDT.weights.xml.gz",
74  "EgammaAnalysis/ElectronTools/data/PHYS14/EIDmva_EE_5_oldscenario2phys14_BDT.weights.xml.gz",
75  "EgammaAnalysis/ElectronTools/data/PHYS14/EIDmva_EB1_10_oldscenario2phys14_BDT.weights.xml.gz",
76  "EgammaAnalysis/ElectronTools/data/PHYS14/EIDmva_EB2_10_oldscenario2phys14_BDT.weights.xml.gz",
77  "EgammaAnalysis/ElectronTools/data/PHYS14/EIDmva_EE_10_oldscenario2phys14_BDT.weights.xml.gz",
78 )
79 
80 ElectronMVAID_ByName = {
81  'Trig':ElectronMVAID_Trig,
82  'NonTrig':ElectronMVAID_NonTrig,
83  'TrigNoIP':ElectronMVAID_TrigNoIP,
84  'TrigCSA14bx50':ElectronMVAID_TrigCSA14bx50,
85  'TrigCSA14bx25':ElectronMVAID_TrigCSA14bx25,
86  'NonTrigCSA14bx25':ElectronMVAID_NonTrigCSA14bx25,
87  'NonTrigCSA14bx50':ElectronMVAID_NonTrigCSA14bx50,
88  'NonTrigPhys14':ElectronMVAID_NonTrigPhys14,
89 }
ElectronMVAID.ElectronMVAID.__call__
def __call__(self, ele, vtx, rho, full5x5=False, debug=False)
Definition: ElectronMVAID.py:18
ElectronMVAID.ElectronMVAID._init
_init
Definition: ElectronMVAID.py:17
ElectronMVAID.ElectronMVAID.sxmls
sxmls
Definition: ElectronMVAID.py:7
ElectronMVAID.ElectronMVAID.name
name
Definition: ElectronMVAID.py:5
ElectronMVAID.ElectronMVAID.estimator
estimator
Definition: ElectronMVAID.py:6
ElectronMVAID.ElectronMVAID
Definition: ElectronMVAID.py:3
initialize
static AlgebraicMatrix initialize()
Definition: BeamSpotTransientTrackingRecHit.cc:24
ElectronMVAID.ElectronMVAID.etype
etype
Definition: ElectronMVAID.py:9
ElectronMVAID.ElectronMVAID.__init__
def __init__(self, name, type, *xmls)
Definition: ElectronMVAID.py:4