Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:32:28

0001 import ROOT 
0002 
0003 class ElectronMVAID:
0004     def __init__(self,name,type,*xmls):
0005         self.name = name
0006         self.estimator = ROOT.heppy.EGammaMvaEleEstimatorFWLite() 
0007         self.sxmls = ROOT.vector(ROOT.string)()
0008         for x in xmls: self.sxmls.push_back(x)  
0009         self.etype = -1
0010         if type == "Trig":     self.etype = self.estimator.kTrig;
0011         if type == "NonTrig":  self.etype = self.estimator.kNonTrig;
0012         if type == "TrigNoIP": self.etype = self.estimator.kTrigNoIP;
0013         if type == "TrigCSA14":     self.etype = self.estimator.kTrigCSA14;
0014         if type == "NonTrigCSA14":  self.etype = self.estimator.kNonTrigCSA14;
0015         if type == "NonTrigPhys14":  self.etype = self.estimator.kNonTrigPhys14;
0016         if self.etype == -1: raise RuntimeError("Unknown type %s" % type)
0017         self._init = False
0018     def __call__(self,ele,vtx,rho,full5x5=False,debug=False):
0019         if not self._init:
0020             self.estimator.initialize(self.name,self.etype,True,self.sxmls)
0021             self._init = True
0022         return self.estimator.mvaValue(ele,vtx,rho,full5x5,debug)
0023 
0024 ElectronMVAID_Trig = ElectronMVAID("BDT", "Trig", 
0025         "EgammaAnalysis/ElectronTools/data/Electrons_BDTG_TrigV0_Cat1.weights.xml.gz",
0026         "EgammaAnalysis/ElectronTools/data/Electrons_BDTG_TrigV0_Cat2.weights.xml.gz",
0027         "EgammaAnalysis/ElectronTools/data/Electrons_BDTG_TrigV0_Cat3.weights.xml.gz",
0028         "EgammaAnalysis/ElectronTools/data/Electrons_BDTG_TrigV0_Cat4.weights.xml.gz",
0029         "EgammaAnalysis/ElectronTools/data/Electrons_BDTG_TrigV0_Cat5.weights.xml.gz",
0030         "EgammaAnalysis/ElectronTools/data/Electrons_BDTG_TrigV0_Cat6.weights.xml.gz",
0031 )
0032 ElectronMVAID_NonTrig = ElectronMVAID("BDT", "NonTrig", 
0033         "EgammaAnalysis/ElectronTools/data/Electrons_BDTG_NonTrigV0_Cat1.weights.xml.gz",
0034         "EgammaAnalysis/ElectronTools/data/Electrons_BDTG_NonTrigV0_Cat2.weights.xml.gz",
0035         "EgammaAnalysis/ElectronTools/data/Electrons_BDTG_NonTrigV0_Cat3.weights.xml.gz",
0036         "EgammaAnalysis/ElectronTools/data/Electrons_BDTG_NonTrigV0_Cat4.weights.xml.gz",
0037         "EgammaAnalysis/ElectronTools/data/Electrons_BDTG_NonTrigV0_Cat5.weights.xml.gz",
0038         "EgammaAnalysis/ElectronTools/data/Electrons_BDTG_NonTrigV0_Cat6.weights.xml.gz",
0039 )
0040 ElectronMVAID_TrigNoIP = ElectronMVAID("BDT", "TrigNoIP", 
0041         "EgammaAnalysis/ElectronTools/data/Electrons_BDTG_TrigNoIPV0_2012_Cat1.weights.xml.gz",
0042         "EgammaAnalysis/ElectronTools/data/Electrons_BDTG_TrigNoIPV0_2012_Cat2.weights.xml.gz",
0043         "EgammaAnalysis/ElectronTools/data/Electrons_BDTG_TrigNoIPV0_2012_Cat3.weights.xml.gz",
0044         "EgammaAnalysis/ElectronTools/data/Electrons_BDTG_TrigNoIPV0_2012_Cat4.weights.xml.gz",
0045         "EgammaAnalysis/ElectronTools/data/Electrons_BDTG_TrigNoIPV0_2012_Cat5.weights.xml.gz",
0046         "EgammaAnalysis/ElectronTools/data/Electrons_BDTG_TrigNoIPV0_2012_Cat6.weights.xml.gz",
0047 )
0048 
0049 ElectronMVAID_TrigCSA14bx50 = ElectronMVAID("BDT", "TrigCSA14", 
0050         "EgammaAnalysis/ElectronTools/data/CSA14/TrigIDMVA_50ns_EB_BDT.weights.xml.gz",
0051         "EgammaAnalysis/ElectronTools/data/CSA14/TrigIDMVA_50ns_EE_BDT.weights.xml.gz",
0052 )
0053 ElectronMVAID_TrigCSA14bx25 = ElectronMVAID("BDT", "TrigCSA14", 
0054         "EgammaAnalysis/ElectronTools/data/CSA14/TrigIDMVA_25ns_EB_BDT.weights.xml.gz",
0055         "EgammaAnalysis/ElectronTools/data/CSA14/TrigIDMVA_25ns_EE_BDT.weights.xml.gz",
0056 )
0057 
0058 ElectronMVAID_NonTrigCSA14bx25 = ElectronMVAID("BDT", "NonTrigCSA14", 
0059         "EgammaAnalysis/ElectronTools/data/CSA14/EIDmva_EB_5_25ns_BDT.weights.xml.gz",
0060         "EgammaAnalysis/ElectronTools/data/CSA14/EIDmva_EE_5_25ns_BDT.weights.xml.gz",
0061         "EgammaAnalysis/ElectronTools/data/CSA14/EIDmva_EB_10_25ns_BDT.weights.xml.gz",
0062         "EgammaAnalysis/ElectronTools/data/CSA14/EIDmva_EE_10_25ns_BDT.weights.xml.gz",
0063 )
0064 ElectronMVAID_NonTrigCSA14bx50 = ElectronMVAID("BDT", "NonTrigCSA14", 
0065         "EgammaAnalysis/ElectronTools/data/CSA14/EIDmva_EB_5_50ns_BDT.weights.xml.gz",
0066         "EgammaAnalysis/ElectronTools/data/CSA14/EIDmva_EE_5_50ns_BDT.weights.xml.gz",
0067         "EgammaAnalysis/ElectronTools/data/CSA14/EIDmva_EB_10_50ns_BDT.weights.xml.gz",
0068         "EgammaAnalysis/ElectronTools/data/CSA14/EIDmva_EE_10_50ns_BDT.weights.xml.gz",
0069 )
0070 
0071 ElectronMVAID_NonTrigPhys14 = ElectronMVAID("BDT", "NonTrigPhys14", 
0072         "EgammaAnalysis/ElectronTools/data/PHYS14/EIDmva_EB1_5_oldscenario2phys14_BDT.weights.xml.gz",
0073         "EgammaAnalysis/ElectronTools/data/PHYS14/EIDmva_EB2_5_oldscenario2phys14_BDT.weights.xml.gz",
0074         "EgammaAnalysis/ElectronTools/data/PHYS14/EIDmva_EE_5_oldscenario2phys14_BDT.weights.xml.gz",
0075         "EgammaAnalysis/ElectronTools/data/PHYS14/EIDmva_EB1_10_oldscenario2phys14_BDT.weights.xml.gz",
0076         "EgammaAnalysis/ElectronTools/data/PHYS14/EIDmva_EB2_10_oldscenario2phys14_BDT.weights.xml.gz",
0077         "EgammaAnalysis/ElectronTools/data/PHYS14/EIDmva_EE_10_oldscenario2phys14_BDT.weights.xml.gz",
0078 )
0079 
0080 ElectronMVAID_ByName = {
0081     'Trig':ElectronMVAID_Trig,
0082     'NonTrig':ElectronMVAID_NonTrig,
0083     'TrigNoIP':ElectronMVAID_TrigNoIP,
0084     'TrigCSA14bx50':ElectronMVAID_TrigCSA14bx50,
0085     'TrigCSA14bx25':ElectronMVAID_TrigCSA14bx25,
0086     'NonTrigCSA14bx25':ElectronMVAID_NonTrigCSA14bx25,
0087     'NonTrigCSA14bx50':ElectronMVAID_NonTrigCSA14bx50,
0088     'NonTrigPhys14':ElectronMVAID_NonTrigPhys14,
0089 }