2 from array
import array
6 import ProviderHistoHelpers
9 SystematicNameDictionary = {
10 'RelativeNonClosure_AFII_AntiKt4EMTopo' :
'RelativeNonClosure_AFII',
11 'RelativeNonClosure_AFII_AntiKt4EMPFlow' :
'RelativeNonClosure_AFII'
15 'EMTopo' :
'AntiKt4Topo_EMJES',
16 'EMPFlow' :
'AntiKt4PFlow_EMJES',
20 if dirName.endswith(
".root") :
23 elif not dirName.endswith(
"/") :
24 dirName = dirName +
"/"
25 print "Looking in dirName",dirName
28 files =
sorted(glob.glob(dirName+
"*.root"))
32 for aFileName
in files:
35 for aFileDef,aJetDef
in jetDefDict.iteritems():
36 if aFileDef
in aFileName:
40 print "Failed to determine jet definition for file:",aFileName
45 inFile = TFile(aFileName,
"READ")
46 for aName,aSystName
in SystematicNameDictionary.iteritems():
47 print aName,aFileDef,aSystName
48 if not aFileDef
in aName :
continue
49 systematicName = aSystName +
"_" + jetDef
51 histo = inFile.Get(aName)
53 print "Failed to get histogram:",systematicName
58 for ybin
in range(histo.GetNbinsY()+2) :
61 for xbin
in range(histo.GetNbinsX()+2) :
62 inbin = histo.GetBinContent(xbin,ybin)
68 histo.SetBinContent(xbin,ybin,freezeval)
72 histoSym.SetDirectory(0)
73 histos[jetDef][aSystName] = histoSym
74 print "Added hist with name",aSystName,
"for jetDef",jetDef
80 histos[jetDef][
"RelativeNonClosure_MC16"].
SetDirectory(0)