4 from array
import array
8 import ProviderHistoHelpers
13 return [key.GetName()
for key
in gDirectory.GetListOfKeys()]
14 TFile.GetKeyNames = GetKeyNames
17 SystematicNames = [
'flavorCompLight',
'flavorCompGlu',
'FlavorResponse']
19 'AntiKt4EMTopo' :
'AntiKt4Topo_EMJES',
20 'AntiKt4LCTopo' :
'AntiKt4Topo_LCJES'
24 if not dirName.endswith(
"/")
and not dirName.endswith(
".root"):
25 dirName = dirName +
"/"
26 if dirName.endswith(
"/") :
27 files =
sorted(glob.glob(dirName+
"*.root"))
33 for aFileName
in files:
36 for jetDef
in jetDefDict.keys() :
37 print "Beginning jetDef",jetDef
38 if jetDefDict[jetDef]
not in histos:
39 histos[jetDefDict[jetDef]] = {}
44 inFile = TFile(aFileName,
"READ")
45 for histName
in inFile.GetKeyNames():
46 systName = histName.split(
"_")[0]
47 if not systName
in SystematicNames :
50 if not jetDef
in histName :
52 systematicName = systName +
"_" + jetDefDict[jetDef]
53 histo = inFile.Get(histName)
55 print "Failed to get histogram:",systematicName
60 for ybin
in range(histo.GetNbinsY()+2) :
63 for xbin
in range(histo.GetNbinsX()+2) :
64 inbin = histo.GetBinContent(xbin,ybin)
70 histo.SetBinContent(xbin,ybin,freezeval)
72 if systName.find(
"FlavorResponse")!=-1 :
76 histoSym.SetDirectory(0)
77 histos[jetDefDict[jetDef]][systName] = histoSym