54 if not dirName.endswith(
"/"):
55 dirName = dirName +
"/"
60 files =
sorted(glob.glob(dirName+
"*{0}*.root".
format(year)))
61 for aFileName
in files:
64 for aFileDef,aJetDef
in jetDefDict.iteritems():
65 if aFileDef
in aFileName:
69 print "Failed to determine jet definition for file:",aFileName
71 if jetDef
not in histos.keys() :
75 inFile = TFile(aFileName,
"READ")
76 contents = inFile.GetKeyNames()
79 SystematicNames = SystematicNames_timedependent
81 SystematicNames = SystematicNames_timeinvariant
83 for aName
in SystematicNames.keys():
84 if not "NonClosure" in SystematicNames[aName] :
86 getsystematicName = aName +
"_" + jetDef.replace(
"Topo",
"")
88 getsystematicName = aName +
"_" + jetDef.replace(
"4PFlow",
"4EMPFlow").
replace(
"_EMJES",
"_PFlowJES")
90 getsystematicName = aName
92 if not getsystematicName
in contents :
95 histo = inFile.Get(getsystematicName)
97 systematicName = SystematicNames[aName] +
"_" + jetDef
98 histo.SetName(systematicName+
"_old")
102 histoNew.SetDirectory(0)
103 histos[jetDef][SystematicNames[aName]] = histoNew
109 for aName,storeName
in SystematicNames.iteritems():
110 for aJetDef
in histos.keys():
111 if not storeName
in histos[aJetDef].
keys() :
112 print "Failed to find histogram:", storeName,
"for jet definition",aJetDef
116 for thisDef
in jetDefDict.keys() :
117 files =
sorted(glob.glob(dirName+
"*{0}*_statErr_*{1}*.root".
format(year,thisDef)))
119 print "Did not find right number of stat term files!"
127 print "Histos out here"