2 from array
import array
6 import ProviderHistoHelpers
9 'AntiKt4EMTopo' :
'AntiKt4Topo_EMJES',
11 'AntiKt4LCTopo' :
'AntiKt4PFlow_EMJES',
16 if not dirName.endswith(
"/"):
17 dirName = dirName +
"/"
22 files =
sorted(glob.glob(dirName+
"bJES*.root"))
23 print "Found files",files
26 print "Not what I expected!"
31 inFile = TFile(aFileName,
"READ")
32 for inFileDef
in jetDefDict.keys() :
33 jetDef = jetDefDict[inFileDef]
34 if jetDef
not in histos.keys() :
36 fetchName =
"bResponseDiff_" + inFileDef
37 systematicName =
"bJES_" + jetDef
38 histo = inFile.Get(fetchName)
39 print "Trying to get histo",fetchName
42 print "Failed to get histogram:",systematicName
45 print "Got histogram",systematicName
47 nbinsx = histo.GetNbinsX()
48 binsx = histo.GetXaxis().GetXbins()
49 newhisto = TH2D(
"bJES_extendedEta_{0}".
format(jetDef),
"bJES_extendedEta_{0}".
format(jetDef),nbinsx,binsx.GetArray(),2,-4.4,4.4)
50 newhisto.SetDirectory(0)
55 for ptbin
in range(1,histo.GetNbinsX()+1) :
59 for etabin
in range(1,histo.GetNbinsY()) :
60 thisVal = histo.GetBinContent(ptbin,etabin)
61 if thisVal > maxVal : maxVal = thisVal
62 for etabin
in range(1,newhisto.GetNbinsY()+1) :
63 newhisto.SetBinContent(ptbin,etabin,maxVal)
65 histos[jetDef][
'bJES'] = newhisto