2 from array
import array
6 import ProviderHistoHelpers
10 from ParseInsituInput
import ReadInSituHistograms
12 InSituCompDictionary =
ReadInSituHistograms(
"/afs/cern.ch/work/k/kpachal/JetUncertainties/JetUncertainties/athena/Reconstruction/Jet/JetUncertainties/inputs/Fall2018/AllInSitu/")
13 SingleParticleFile = TFile(
"/afs/cern.ch/work/k/kpachal/JetUncertainties/JetUncertainties/athena/Reconstruction/Jet/JetUncertainties/inputs/Fall2018/HighPt/Release20p7_SingleParticle_FullRange.root")
21 outputFile = TFile(
"Release20p7_HighPtTerm_Fall2018adjusted.root",
"RECREATE")
23 for jetDef
in jetDefList :
25 print InSituCompDictionary.keys()
26 inSituHist = InSituCompDictionary[jetDef][
'InSituProp_PunchThroughMC'].Clone(
"InSitu_Quad")
28 inSituHist.SetDirectory(0)
31 for histkey
in InSituCompDictionary[jetDef] :
33 hist = InSituCompDictionary[jetDef][histkey]
35 for bin
in range(0, hist.GetNbinsX()+2) :
36 assert(inSituHist.GetBinLowEdge(bin) == hist.GetBinLowEdge(bin)
and inSituHist.GetBinWidth(bin) == hist.GetBinWidth(bin))
38 inSituHist.SetBinContent(bin,inSituHist.GetBinContent(bin)+math.pow(hist.GetBinContent(bin),2))
43 spHist = SingleParticleFile.Get(
"totalHist")
45 outputHist = spHist.Clone(
"adjustedInterpolatedSingleParticleUncertainty")
46 outputHist.SetDirectory(0)
51 for bin
in range(0,spHist.GetNbinsX()+2) :
53 pT = spHist.GetXaxis().GetBinCenter(bin)
54 inSituBin = inSituHist.FindBin(pT)
55 if inSituBin > inSituHist.GetNbinsX() : inSituBin = inSituHist.GetNbinsX()
56 inSituVal2 = inSituHist.GetBinContent(inSituBin)
57 spVal = spHist.Interpolate(pT)
59 diff = spVal*spVal - inSituVal2
64 keepSPVal = math.sqrt(spVal*spVal - inSituVal2)
69 smoothedSPVal = keepSPVal * ((pT - 2200)/200)
71 smoothedSPVal = keepSPVal
73 outputHist.SetBinContent(bin,smoothedSPVal)
76 outputHist.Write(
"SingleParticle_HighPt_{0}".
format(jetDef))