83 if not dirName.endswith(
"/"):
84 dirName = dirName +
"/"
88 subDirs =
sorted(glob.glob(dirName+
"*"))
89 for aSubDirName
in subDirs:
92 for aDirDef,aJetDef
in jetDefDict.iteritems():
93 if aDirDef
in aSubDirName:
97 print "Failed to determine jet definition for directory:",aSubDirName
102 systFiles =
sorted(glob.glob(aSubDirName+
"/SystError_*.txt"))
103 for aSystFile
in systFiles:
105 systematicNameHandle = re.sub(aSubDirName+
"/SystError_",
"",aSystFile)
106 systematicNameHandle = re.sub(
".txt",
"",systematicNameHandle)
107 systematicName = SystematicNameDictionary[systematicNameHandle]
111 systematicFile =
open(aSystFile,
"r")
116 for line
in systematicFile.readlines():
117 line = line.strip(
"\r\n")
118 lowEdge =
float(line.split()[0])
119 systVal =
float(line.split()[2].strip())
121 lowBinEdges.append(lowEdge)
122 systValues.append(systVal)
125 systematicFile.close()
128 lowBinEdges.append(2500.)
129 systValues.append(systValues[-1])
132 lowBinEdgesArray =
array(
'd',lowBinEdges)
133 systValuesArray =
array(
'd',systValues)
134 histoName = systematicName+
"_"+jetDef
135 histo1D = TH1D(histoName+
"_1D",histoName+
"_1D",len(lowBinEdges)-1,lowBinEdgesArray)
138 for iBin
in xrange(1,histo1D.GetNbinsX()+1):
139 histo1D.SetBinContent(iBin,systValues[iBin-1])
143 histo.SetDirectory(0)
144 histos[jetDef][systematicName] = histo
149 systematicName = SystematicNameDictionary[
'mjbstat11']