|
[Rivet-svn] r3964 - in branches/2012-06-aidarivet: bin docblackhole at projects.hepforge.org blackhole at projects.hepforge.orgMon Oct 15 09:59:45 BST 2012
Author: fsiegert Date: Mon Oct 15 09:59:45 2012 New Revision: 3964 Log: Add option for RatioPlotMode=datamc, which does not make much sense most of the time but might be useful once in a while. Modified: branches/2012-06-aidarivet/bin/make-plots branches/2012-06-aidarivet/doc/make-plots.txt Modified: branches/2012-06-aidarivet/bin/make-plots ============================================================================== --- branches/2012-06-aidarivet/bin/make-plots Mon Oct 15 04:03:06 2012 (r3963) +++ branches/2012-06-aidarivet/bin/make-plots Mon Oct 15 09:59:45 2012 (r3964) @@ -653,8 +653,12 @@ inputdata.description['YLabel']='$(\\text{MC}-\\text{data})$' inputdata.description['YMin']=-3.5 inputdata.description['YMax']=3.5 + elif inputdata.description.has_key('RatioPlotMode') and inputdata.description['RatioPlotMode']=='datamc': + inputdata.description['YLabel']='Data/MC' + inputdata.description['YMin']=0.5 + inputdata.description['YMax']=1.5 else: - inputdata.description['YLabel']='MC/data' + inputdata.description['YLabel']='MC/Data' inputdata.description['YMin']=0.5 inputdata.description['YMax']=1.5 if inputdata.description.has_key('RatioPlotYLabel'): @@ -699,17 +703,26 @@ if i!=self.refdata: if inputdata.description.has_key('RatioPlotMode') and inputdata.description['RatioPlotMode']=='deviation': inputdata.histos[i].deviation(inputdata.histos[self.refdata]) + elif inputdata.description.has_key('RatioPlotMode') and inputdata.description['RatioPlotMode']=='datamc': + inputdata.histos[i].dividereverse(inputdata.histos[self.refdata]) + inputdata.histos[i].description['ErrorBars']='1' else: inputdata.histos[i].divide(inputdata.histos[self.refdata]) if inputdata.description.has_key('RatioPlotMode') and inputdata.description['RatioPlotMode']=='deviation': inputdata.histos[self.refdata].deviation(inputdata.histos[self.refdata]) + elif inputdata.description.has_key('RatioPlotMode') and inputdata.description['RatioPlotMode']=='datamc': + inputdata.histos[self.refdata].dividereverse(inputdata.histos[self.refdata]) else: inputdata.histos[self.refdata].divide(inputdata.histos[self.refdata]) def _draw(self, inputdata): out = "" for i in inputdata.description['DrawOnly']: - out += inputdata.histos[i].draw(self.coors) + if inputdata.description.has_key('RatioPlotMode') and inputdata.description['RatioPlotMode']=='datamc': + if i!=self.refdata: + out += inputdata.histos[i].draw(self.coors) + else: + out += inputdata.histos[i].draw(self.coors) frame = Frame() out += frame.draw(inputdata) @@ -1355,6 +1368,27 @@ else: print '+++ Error in Histogram.divide(): Binning of histograms differs' + def dividereverse(self,name): + if len(self.data)!=len(name.data): + print '+++ Error in Histogram.divide(): Binning of histograms differs' + for i in range(len(self.data)): + if fuzzyeq(self.data[i]['LowEdge'], name.data[i]['LowEdge']) and \ + fuzzyeq(self.data[i]['UpEdge'], name.data[i]['UpEdge']): + try: + self.data[i]['Error'][0] = name.data[i]['Error'][0]/self.data[i]['Content'] + except ZeroDivisionError: + self.data[i]['Error'][0]=0. + try: + self.data[i]['Error'][1] = name.data[i]['Error'][1]/self.data[i]['Content'] + except ZeroDivisionError: + self.data[i]['Error'][1]=0. + try: + self.data[i]['Content'] = name.data[i]['Content']/self.data[i]['Content'] + except ZeroDivisionError: + self.data[i]['Content']=1. + else: + print '+++ Error in Histogram.divide(): Binning of histograms differs' + def deviation(self,name): if len(self.data)!=len(name.data): print '+++ Error in Histogram.deviation(): Binning of histograms differs' Modified: branches/2012-06-aidarivet/doc/make-plots.txt ============================================================================== --- branches/2012-06-aidarivet/doc/make-plots.txt Mon Oct 15 04:03:06 2012 (r3963) +++ branches/2012-06-aidarivet/doc/make-plots.txt Mon Oct 15 09:59:45 2012 (r3964) @@ -304,10 +304,12 @@ must specify your reference data ID. This option is used by the link:compare-histos.html[`compare-histos`] script. -If you prefer showing `(MC-data)/uncertainty` rather than `MC/data`, you can set -------------------- -RatioPlotMode=deviation +RatioPlotMode=<default|deviation|datamc> -------------------- +By default, the ratio plot displays MC/Data. You can switch to +(MC-data)/uncertainty (`deviation`) or Data/MC (`datamc`) with this +option. In ratio plots the following additional options are available and work in a similar way as their regular counterparts:
More information about the Rivet-svn mailing list |