ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/OSUT3Analysis/Configuration/scripts/makePlots.py
(Generate patch)

Comparing UserCode/OSUT3Analysis/Configuration/scripts/makePlots.py (file contents):
Revision 1.43 by wulsin, Thu Jun 20 09:00:41 2013 UTC vs.
Revision 1.44 by wulsin, Fri Jun 21 13:06:43 2013 UTC

# Line 15 | Line 15 | from OSUT3Analysis.Configuration.process
15  
16   parser = OptionParser()
17   parser = set_commandline_arguments(parser)
18 + parser.add_option("--ylog", action="store_true", dest="setLogY", default=False,          
19 +                  help="Set logarithmic scale on vertical axis on all plots")    
20 + parser.add_option("--ymin", dest="setYMin",
21 +                  help="Minimum of y axis")      
22 + parser.add_option("--ymax", dest="setYMax",
23 +                  help="Maximum of y axis")      
24 +
25   (arguments, args) = parser.parse_args()
26  
27 +
28   if arguments.localConfig:
29      sys.path.append(os.getcwd())
30      exec("from " + arguments.localConfig.rstrip('.py') + " import *")
31  
24
32   #### deal with conflicting arguments
33   if arguments.normalizeToData and arguments.normalizeToUnitArea:
34      print "Conflicting normalizations requsted, will normalize to unit area"
# Line 336 | Line 343 | def MakeOneDHist(pathToDir,histogramName
343          if(dataHist.GetMaximum() > finalMax):
344              finalMax = dataHist.GetMaximum() + dataHist.GetBinError(dataHist.GetMaximumBin())
345      finalMax = 1.15*finalMax
346 +    if arguments.setYMax:  
347 +        finalMax = float(arguments.setYMax)
348  
349  
350      ### Drawing histograms to canvas
# Line 357 | Line 366 | def MakeOneDHist(pathToDir,histogramName
366          gPad.SetFillStyle(0)
367          gPad.Update()
368          gPad.Draw()
369 +        if arguments.setLogY:
370 +            gPad.SetLogy()
371          Canvas.cd(2)
372          gPad.SetPad(0.01,0.01,0.99,0.25)
373          #format: gPad.SetMargin(l,r,b,t)
# Line 369 | Line 380 | def MakeOneDHist(pathToDir,histogramName
380          Canvas.cd(1)
381  
382      if numBgMCSamples is not 0: # the first thing to draw to the canvas is a bgMC sample
372
383          
384 +        yAxisMin = 0.0001
385 +        if arguments.setYMin:
386 +            yAxisMin = float(arguments.setYMin)
387          if not arguments.noStack: # draw unstacked background samples
388              Stack.SetTitle(histoTitle)
389              Stack.Draw("HIST")
390              Stack.GetXaxis().SetTitle(xAxisLabel)
391              Stack.SetMaximum(finalMax)
392 <            Stack.SetMinimum(0.0001)
392 >            Stack.SetMinimum(yAxisMin)
393              if makeRatioPlots or makeDiffPlots:
394                  Stack.GetHistogram().GetXaxis().SetLabelSize(0)
395              #draw shaded error bands
# Line 387 | Line 400 | def MakeOneDHist(pathToDir,histogramName
400              BgMCHistograms[0].Draw("HIST")
401              BgMCHistograms[0].GetXaxis().SetTitle(xAxisLabel)
402              BgMCHistograms[0].SetMaximum(finalMax)
403 <            BgMCHistograms[0].SetMinimum(0.0001)
403 >            BgMCHistograms[0].SetMinimum(yAxisMin)            
404              for bgMCHist in BgMCHistograms:
405                  bgMCHist.Draw("A HIST SAME")
406  
# Line 402 | Line 415 | def MakeOneDHist(pathToDir,histogramName
415          SignalMCHistograms[0].Draw("HIST")
416          SignalMCHistograms[0].GetXaxis().SetTitle(xAxisLabel)
417          SignalMCHistograms[0].SetMaximum(finalMax)
418 <        SignalMCHistograms[0].SetMinimum(0.0001)
418 >        SignalMCHistograms[0].SetMinimum(yAxisMin)
419  
420          for signalMCHist in SignalMCHistograms:
421              if(signalMCHist is not SignalMCHistograms[0]):
# Line 416 | Line 429 | def MakeOneDHist(pathToDir,histogramName
429          DataHistograms[0].Draw("E")
430          DataHistograms[0].GetXaxis().SetTitle(xAxisLabel)
431          DataHistograms[0].SetMaximum(finalMax)
432 <        DataHistograms[0].SetMinimum(0.0001)
432 >        DataHistograms[0].SetMinimum(yAxisMin)
433          for dataHist in DataHistograms:
434              if(dataHist is not DataHistograms[0]):
435                  dataHist.Draw("A E SAME")

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines