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 
ElectronCalibrator.Run2ElectronCalibrator.epCombinationTool
epCombinationTool
Definition: ElectronCalibrator.py:7
ElectronCalibrator.Run2ElectronCalibrator.random
random
Definition: ElectronCalibrator.py:9
ElectronCalibrator.Run2ElectronCalibrator.correct
def correct(self, electron, run)
Definition: ElectronCalibrator.py:14
ElectronCalibrator.Run2ElectronCalibrator.electronEnergyCalibratorRun2
electronEnergyCalibratorRun2
Definition: ElectronCalibrator.py:11
createfilelist.int
int
Definition: createfilelist.py:10
init
Definition: init.py:1
ElectronCalibrator.Run2ElectronCalibrator.__init__
def __init__(self, data, gbrForest, isMC, isSync=False)
Definition: ElectronCalibrator.py:6
ElectronCalibrator.Run2ElectronCalibrator
Definition: ElectronCalibrator.py:5