4 from array
import array
8 import ProviderHistoHelpers
12 from ParseInsituInput
import ReadInSituHistograms
14 InSituCompDictionary =
ReadInSituHistograms(
"/cluster/warehouse/kpachal/JetCalibration/JetUncertainties/JetUncertainties/inputs/Moriond2016/AllInSitu/")
15 SingleParticleFile = TFile(
"/cluster/warehouse/kpachal/JetCalibration/JetUncertainties/JetUncertainties/inputs/Moriond2016/HighPt2012/AggressiveHighPt_Final2014.root")
18 'EMJES_R4' :
'AntiKt4Topo_EMJES',
20 'LCJES_R4' :
'AntiKt4Topo_LCJES',
24 outputFile = TFile(
"2012HighPtTerm_2015adjusted.root",
"RECREATE")
26 for readJetDef
in jetDefDict :
28 jetDef = jetDefDict[readJetDef]
30 inSituHist = InSituCompDictionary[jetDef][
'InSituProp_PunchThroughMC'].Clone(
"InSitu_Quad")
32 inSituHist.SetDirectory(0)
35 for histkey
in InSituCompDictionary[jetDef] :
37 hist = InSituCompDictionary[jetDef][histkey]
39 for bin
in range(0, hist.GetNbinsX()+2) :
40 assert(inSituHist.GetBinLowEdge(bin) == hist.GetBinLowEdge(bin)
and inSituHist.GetBinWidth(bin) == hist.GetBinWidth(bin))
42 inSituHist.SetBinContent(bin,inSituHist.GetBinContent(bin)+math.pow(hist.GetBinContent(bin),2))
47 spHist = SingleParticleFile.Get(
"SingleParticle_HighPt_{0}".
format(jetDef))
49 outputHist = spHist.Clone(
"adjustedInterpolatedSingleParticleUncertainty")
50 outputHist.SetDirectory(0)
55 for bin
in range(0,spHist.GetNbinsX()+2) :
57 pT = spHist.GetXaxis().GetBinCenter(bin)
58 inSituBin = inSituHist.FindBin(pT)
59 if inSituBin > inSituHist.GetNbinsX() : inSituBin = inSituHist.GetNbinsX()
60 inSituVal2 = inSituHist.GetBinContent(inSituBin)
61 spVal = spHist.Interpolate(pT)
63 diff = spVal*spVal - inSituVal2
68 keepSPVal = math.sqrt(spVal*spVal - inSituVal2)
73 smoothedSPVal = keepSPVal * ((pT - 2000)/200)
75 smoothedSPVal = keepSPVal
77 outputHist.SetBinContent(bin,smoothedSPVal)
80 outputHist.Write(
"SingleParticle_HighPt_{0}".
format(jetDef))