2 from array
import array
6 import ProviderHistoHelpers
11 return [key.GetName()
for key
in gDirectory.GetListOfKeys()]
12 TFile.GetKeyNames = GetKeyNames
15 SystematicNames = {
'lqResponsePythia' :
'flavorCompLight',
16 'gluonResponsePythia' :
'flavorCompGlu',
17 'gluonResponseDiff' :
'FlavorResponse' }
19 'AntiKt4EMTopo' :
'AntiKt4Topo_EMJES',
20 'AntiKt4EMPflow' :
'AntiKt4PFlow_EMJES',
24 print "Beginning flavour"
25 if not dirName.endswith(
"/")
and not dirName.endswith(
".root"):
26 dirName = dirName +
"/"
27 if dirName.endswith(
"/") :
28 files =
sorted(glob.glob(dirName+
"*.root"))
34 for aFileName
in files:
37 for jetDef
in jetDefDict.keys() :
38 print "Beginning jetDef",jetDef
39 if jetDefDict[jetDef]
not in histos:
40 histos[jetDefDict[jetDef]] = {}
45 inFile = TFile(aFileName,
"READ")
46 for histName
in inFile.GetKeyNames():
47 systName = histName.split(
"_")[0]
48 if not jetDef
in histName :
50 if not systName
in SystematicNames.keys() :
51 if "bResponse" in systName :
53 print "Error!!!",systName,
"not in",SystematicNames.keys()
55 systematicName = systName +
"_" + jetDefDict[jetDef]
56 histo = inFile.Get(histName)
58 print "Failed to get histogram:",systematicName
63 for ybin
in range(histo.GetNbinsY()+2) :
66 for xbin
in range(histo.GetNbinsX()+2) :
67 inbin = histo.GetBinContent(xbin,ybin)
73 histo.SetBinContent(xbin,ybin,freezeval)
78 histos[jetDefDict[jetDef]][SystematicNames[systName]] = histo
83 print "Done flavour.\n"