def main(argv=None): # you should to create a splineInfo object for *each* line you want to draw # then, create a "plotInfo" that you want to define the properties of the # canvas you're drawing too (axis range, etc.) # dump the splineInfos into a list and send to drawGraphs with plotInfo. # The advantage of doing it this way: can create an mcplotting.py that # contains various setups for differetn plots # Can also have mc7_gluino as a spline object, this can then be drawn # *easily* to any of our plots, overlayed with any number of other lines # with their own styles and setup # Note, I have some hesitancy about keeping the "color"/"width"/etc. # properties with the graphs themselves. I've gone this way because ROOT # has made this choie already and I think we should probably live with that. # It would be nicer to have a setup that deals with this at plot time. i.e. # splines are *just* a line that can be passed around and plotted in # different plces with different colorsetups [ this can technically be # implemented on top of what i already have ] mcf.rootStyle() d = { "Filename": "/home/hyper/Documents/mastercode_data/cmssm-bsgOrig-g2Orig.root", "Var1": 138, "Var2": 0, "PlotVar": 1, "Label": "TEST", "Short": True, "CalcMode": "DeltaChi2", "Xmax": [3000,4400], "Xmin": [0,3600], "Yoffset": [0,0], "Smoothing": [10,50], "Color": ROOT.kRed } e = { "Filename": "/home/hyper/Documents/mastercode_data/cmssm-bsgOrig-g2Orig.root", "Var1": 119, "Var2": 0, "PlotVar": 1, "Label": "TEST", "Short": True, "CalcMode": "DeltaChi2", "Xmax": [1000], "Xmin": [0], "Yoffset": [5], "Smoothing": [10], "Color": ROOT.kGreen } p = { "Xmax": 5000.0, "Xmin": 0.0, "Ymax": 9.0, "XAxisLabel": "TESTER LOL", "YAxisLabel": "#Delta#Chi^{2}" } print "hello world" x = [ 10,11,12,13,14,15,16,17 ] y = [ 6,2,1,4,3,2,3,4 ] Err = 1.5 x_left, x_right = getErrorBands(x,Err) print x_left print x print x_right
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()