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 self.etype == -1: raise RuntimeError, "Unknown type %s" % type
15  self._init = False
16  def __call__(self,ele,vtx,rho,full5x5=False,debug=False):
17 #FIXME:
18  return -99
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 )