Skip to content

Commit

Permalink
now the validation script can actually spot differences
Browse files Browse the repository at this point in the history
  • Loading branch information
gpetruc committed Oct 16, 2014
1 parent 4538698 commit 54c883a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CMGTools/TTHAnalysis/cfg/validate_multilep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ X=$PWD/$1;
if test \! -d $X/TTHToWW_PUS14; then echo "Did not find TTHToWW_PUS14 in $X"; exit 1; fi
test -L $PWD/Reference_TTHToWW_PUS14 || ln -sd $PWD/Reference_TTHToWW_PUS14 $X/ -v;
( cd ../python/plotter;
python mcPlots.py -f --s2v --tree treeProducerSusyMultilepton -P $X bins/validation_mca.txt bins/validation.txt bins/validation_plots.txt --pdir plots/70X/validation -p ref_ttHWW,ttHWW -u -e --plotmode=nostack --showRatio --maxRatioRange 0.65 1.35
python mcPlots.py -f --s2v --tree treeProducerSusyMultilepton -P $X bins/validation_mca.txt bins/validation.txt bins/validation_plots.txt --pdir plots/70X/validation -p ref_ttHWW,ttHWW -u -e --plotmode=nostack --showRatio --maxRatioRange 0.65 1.35 --flagDifferences
)
4 changes: 2 additions & 2 deletions CMGTools/TTHAnalysis/python/plotter/bins/validation_mca.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ttHWW+ : TTHToWW_PUS14 : 1 ; FillColor=ROOT.kOrange+10
ref_ttHWW : TTHToWW_PUS14 : 1 ; FillColor=ROOT.kAzure+2
ttHWW : TTHToWW_PUS14 : 1 ; FillColor=ROOT.kOrange+10
ref_ttHWW+ : Reference_TTHToWW_PUS14 : 1 ; FillColor=ROOT.kAzure+2, Label="Ref."
16 changes: 16 additions & 0 deletions CMGTools/TTHAnalysis/python/plotter/mcPlots.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,11 @@ def doRatioHists(pspec,pmap,total,totalSyst,maxRange,fitRatio=False):
numkey = "data"
if "data" not in pmap:
if len(pmap) == 4 and 'signal' in pmap and 'background' in pmap:
# do this first
total.GetXaxis().SetLabelOffset(999) ## send them away
total.GetXaxis().SetTitleOffset(999) ## in outer space
total.GetYaxis().SetLabelSize(0.05)
# then we can overwrite total with background
numkey = 'signal'
total = pmap['background']
totalSyst = pmap['background']
Expand Down Expand Up @@ -621,6 +626,16 @@ def run(self,mca,cuts,plots,makeStack=True,makeCanvas=True):
if sfitnorm != None:
sfitnorm.SetDirectory(dir); dir.WriteTObject(sfitnorm)
reMax(total,sfitnorm,islog)
if options.flagDifferences and len(pmap) == 4:
new = pmap['signal']
ref = pmap['background']
if "TH1" in new.ClassName():
for b in xrange(1,new.GetNbinsX()+1):
if new.GetBinContent(b) != ref.GetBinContent(b):
print "Plot: difference found in %s, bin %d" % (pspec.name, b)
p1.SetFillColor(ROOT.kYellow-10)
if p2: p2.SetFillColor(ROOT.kYellow-10)
break
if makeCanvas: dir.WriteTObject(c1)
rdata,rnorm,rnorm2,rline = (None,None,None,None)
if doRatio:
Expand Down Expand Up @@ -685,6 +700,7 @@ def addPlotMakerOptions(parser):
parser.add_option("--poisson", dest="poisson", action="store_true", default=False, help="Draw Poisson error bars")
parser.add_option("--select-plot", "--sP", dest="plotselect", action="append", default=[], help="Select only these plots out of the full file")
parser.add_option("--exclude-plot", "--xP", dest="plotexclude", action="append", default=[], help="Exclude these plots from the full file")
parser.add_option("--flagDifferences", dest="flagDifferences", action="store_true", default=False, help="Flag plots that are different (when using only two processes, and plotmode nostack")

if __name__ == "__main__":
from optparse import OptionParser
Expand Down

0 comments on commit 54c883a

Please sign in to comment.