72 if not dirName.endswith(
"/"):
73 dirName = dirName +
"/"
77 subDirs =
sorted(glob.glob(dirName+
"*"))
78 for aSubDirName
in subDirs:
81 for aDirDef,aJetDef
in jetDefDict.iteritems():
82 if aDirDef
in aSubDirName:
86 print "Failed to determine jet definition for directory:",aSubDirName
89 print "Jet definition is",jetDef
93 systFiles =
sorted(glob.glob(aSubDirName+
"/SystError_*.txt"))
94 for aSystFile
in systFiles:
96 systematicNameHandle = re.sub(aSubDirName+
"/SystError_",
"",aSystFile)
97 systematicNameHandle = re.sub(
".txt",
"",systematicNameHandle)
98 systematicName = SystematicNameDictionary[systematicNameHandle]
99 print "Making histogram %s --> %s"%(systematicNameHandle,systematicName)
102 systematicFile =
open(aSystFile,
"r")
107 for line
in systematicFile.readlines():
108 line = line.strip(
"\r\n")
109 lowEdge =
float(line.split()[0])
110 systVal =
float(line.split()[2].strip())
112 lowBinEdges.append(lowEdge)
113 systValues.append(systVal)
116 systematicFile.close()
119 lowBinEdges.append(2500.)
120 systValues.append(systValues[-1])
123 lowBinEdgesArray =
array(
'd',lowBinEdges)
124 systValuesArray =
array(
'd',systValues)
125 histoName = systematicName+
"_"+jetDef
126 histo1D = TH1D(histoName+
"_1D",histoName+
"_1D",len(lowBinEdges)-1,lowBinEdgesArray)
129 for iBin
in xrange(1,histo1D.GetNbinsX()+1):
130 histo1D.SetBinContent(iBin,systValues[iBin-1])
138 histos[jetDef][systematicName] = histo1D