CMS 3D CMS Logo

ElectronCalibrator.py
Go to the documentation of this file.
1 import ROOT
2 import os.path
3 ROOT.gSystem.Load("libEgammaAnalysisElectronTools")
4 
6  def __init__(self, data, gbrForest, isMC, isSync=False):
7  self.epCombinationTool = ROOT.EpCombinationTool()
8  self.epCombinationTool.init(os.path.expandvars(gbrForest[0]), gbrForest[1])
9  self.random = ROOT.TRandom3()
10  self.random.SetSeed(0) # make it really random across different jobs
11  self.electronEnergyCalibratorRun2 = ROOT.ElectronEnergyCalibratorRun2(self.epCombinationTool, isMC, isSync, data)
12  self.electronEnergyCalibratorRun2.initPrivateRng(self.random)
13 
14  def correct(self,electron,run):
15  if not electron.validCandidateP4Kind(): return False # these can't be calibrated
16  electron.uncalibratedP4 = electron.p4()
17  electron.uncalibratedP4Error = electron.p4Error(electron.candidateP4Kind())
18  self.electronEnergyCalibratorRun2.calibrate(electron.physObj, int(run))
19  return True
20 
Definition: init.py:1
def __init__(self, data, gbrForest, isMC, isSync=False)