CMS 3D CMS Logo

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