1 """ @package CrombieTools.SkimmingTools.HistWriter 2 Submodule of CrombieTools.SkimmingTools. 3 Contains the constructor and default HistWriter object. 8 newHistWriter =
Load(
'HistWriter')
11 def MakeHist(inputFile, outputFile='', outputHist='', writer=histWriter):
12 """A convenience function for HistWriter assuming the text file is named something you like. 14 @param inputFile is the text file where the histogram is written out. 15 @param outputFile is the location where the root histogram will be saved. 16 If left blank, the name is just the inputFile replaced with .txt changed to .root 17 @param outputHist is the name of the histogram saved. If left blank, it uses the 18 basename of the inputFile. (e.g. a/place/hist.txt -> 'hist'). 19 @param writer specifies a HistWriter to use. This is probably rarely, if ever, needs to be changed. 22 writer.SetFileName(outputFile)
23 writer.SetHistName(outputHist)
28 outputFile = op.splitext(inputFile)[0] +
'.root' 31 outputHist = op.splitext(op.basename(inputFile))[0]
36 with open(inputFile,
'r') as check_input: 37 for line
in check_input:
39 numX = len(line.split())
46 writer.Make2DHist(inputFile, numX, numY)
48 writer.MakeHist(inputFile)