4 from array
import array
8 import ProviderHistoHelpers
12 return [key.GetName()
for key
in gDirectory.GetListOfKeys()]
13 TFile.GetKeyNames = GetKeyNames
15 SystematicNameDictionary = {
16 'PunchThroughUncertainties_interpolation_resp_eta_0' :
'PunchThroughCentral',
17 'PunchThroughUncertainties_interpolation_resp_eta_1' :
'PunchThroughCrack',
18 'PunchThroughUncertainties_interpolation_resp_eta_2' :
'PunchThroughForward'
22 'AntiKt4TopoEM' :
'AntiKt4Topo_EMJES',
23 'AntiKt6TopoEM' :
'AntiKt6Topo_EMJES',
24 'AntiKt4LCTopo' :
'AntiKt4Topo_LCJES',
25 'AntiKt6LCTopo' :
'AntiKt6Topo_LCJES'
32 if not dirName.endswith(
"/"):
33 dirName = dirName +
"/"
36 rootFileList =
sorted(glob.glob(dirName+
"*.root"))
37 if len(rootFileList) != 1:
38 print "Found a number of root files not equal to 1 in dir:",dirName
40 rootFile = TFile(rootFileList[0],
"READ")
43 for aJetDef,aJetDefProv
in jetDefDict.iteritems():
44 histos[aJetDefProv] = {}
46 for histName
in rootFile.GetKeyNames():
47 if aJetDef
not in histName:
continue
48 for aKey,aVal
in SystematicNameDictionary.iteritems():
49 histName = aJetDef+
"_"+aKey
50 histo = rootFile.Get(histName)
52 print "Failed to get histogram:",histName
54 histo.SetName(aVal+
"_"+aJetDefProv)
57 histos[aJetDefProv][aVal] = histo