def __init__( self, d ) : self.xmax_list = d["Xmax"] self.xmin_list = d["Xmin"] self.yoffset_list = d["Yoffset"] self.smooth_list = d["Smoothing"] self.filename = d["Filename"] self.plotvar = d["PlotVar"] self.label = d["Label"] self.color = d["Color"] self.directory = mcf.getPlotDirectory( d["Var1"], d["Var2"], d["CalcMode"], d["Short"] )
def main(argv=None): ROOT.gROOT.SetBatch(0) # import out configuration and command line options conf = configuration() options, files = opts() assert len(files) > 0, "Must specify files as command line arguments" # set up root to look pretty mcf.rootStyle() mcf.histoColorPalette(conf["ContourType"]) if not conf["Zmax"]: conf["Zmax"] = mcf.getHistoZMax(conf["ContourType"]) blank_histogram = len(files) > 1 or options.no_histo if blank_histogram: print "Printing blank histograms" for i, (x, y) in enumerate( zip( conf["Xvar"], conf["Yvar"] ) ): canvas_title = "MCcontour_%d" % i canvas_name = "MC_%d" % i canvas = ROOT.TCanvas(canvas_name,canvas_title,1) directory = mcf.getPlotDirectory( x, y, conf["ContourType"], \ options.short, conf["ContribVar"] ) for filename in files: f = ROOT.TFile(filename) drawHistogram( f, directory, conf, i, blank_histogram ) if not options.no_contours: drawContours( f, directory, conf, i) # if you do f.close() here then it removes teh histogram from the # pad (apparently it's owned by hte file. Need to make sure we # clean this up at the end. i.e. iterate over gDirectory mcf.drawLabel(conf) outfile = "%s_%s_%d_%d.%s" % (conf["OutfilePrefix"], conf["ContourType"], \ conf["Xvar"][i], conf["Yvar"][i], conf["OutfileType"] ) canvas.SaveAs(outfile) canvas.Close()