CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PhotonCalibrator.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, isMC, isSync=False):
7  self.random = ROOT.TRandom3()
8  self.random.SetSeed(0) # make it really random across different jobs
9  self.photonEnergyCalibratorRun2 = ROOT.PhotonEnergyCalibratorRun2(isMC, isSync, data)
10  self.photonEnergyCalibratorRun2.initPrivateRng(self.random)
11 
12  def correct(self,photon,run):
13  photon.uncalibratedP4 = photon.p4(photon.getCandidateP4type())
14  photon.uncalibratedP4Error = photon.getCorrectedEnergyError(photon.getCandidateP4type())
15  self.photonEnergyCalibratorRun2.calibrate(photon.physObj, int(run))
16  return True