4 from array
import array
8 import ProviderHistoHelpers
11 'AntiKt4EMTopo' :
'AntiKt4Topo_EMJES',
13 'AntiKt4LCTopo' :
'AntiKt4Topo_LCJES',
18 if not dirName.endswith(
"/"):
19 dirName = dirName +
"/"
24 files =
sorted(glob.glob(dirName+
"bJES*GSC.root"))
27 print "Not what I expected!"
32 inFile = TFile(aFileName,
"READ")
33 for inFileDef
in jetDefDict.keys() :
34 jetDef = jetDefDict[inFileDef]
35 if jetDef
not in histos.keys() :
37 fetchName =
"bJES_" + inFileDef
38 systematicName =
"bJES_" + jetDef
39 histo = inFile.Get(fetchName)
41 print "Failed to get histogram:",systematicName
44 nbinsx = histo.GetNbinsX()
45 binsx = histo.GetXaxis().GetXbins()
46 newhisto = TH2D(
"bJES_extendedEta_{0}".
format(jetDef),
"bJES_extendedEta_{0}".
format(jetDef),nbinsx,binsx.GetArray(),2,-4.4,4.4)
47 newhisto.SetDirectory(0)
52 for ptbin
in range(1,histo.GetNbinsX()+1) :
56 for etabin
in range(1,histo.GetNbinsY()) :
57 thisVal = histo.GetBinContent(ptbin,etabin)
58 if thisVal > maxVal : maxVal = thisVal
59 for etabin
in range(1,newhisto.GetNbinsY()+1) :
60 newhisto.SetBinContent(ptbin,etabin,maxVal)
62 histos[jetDef][
'bJES'] = newhisto