From 58e33bd3339b40ab981863812980c69f63719664 Mon Sep 17 00:00:00 2001 From: Andrea Carlo Marini Date: Wed, 20 Oct 2021 14:58:48 +0200 Subject: [PATCH 1/3] rebin for aqgc --- script/FwBinning.py | 13 +++++++++++++ script/bwsVBSHad.py | 11 ++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/script/FwBinning.py b/script/FwBinning.py index d33e3d2c..026b33d4 100644 --- a/script/FwBinning.py +++ b/script/FwBinning.py @@ -12,7 +12,20 @@ def applyMapping(self, x, h): h2.Rebin(self.nmerge) return h2 +gc=[] +class FixedRebin: + def __init__(self,l): + self.boundaries_=array.array('d',l) + def applyMapping(self,x,h): + global gc + h1 = h.Rebin(len(self.boundaries_)-1,h.GetName(),self.boundaries_) + if h != None and h1 == None: + print "[ERROR], Unable to rebin",h.GetName() + return h1 + class Rebin: + def __init__(self,n): + self.nmerge=n h = None # sum of bkgs h_ref = None # reference (TTbar) diff --git a/script/bwsVBSHad.py b/script/bwsVBSHad.py index 2e463d18..1c66f32b 100644 --- a/script/bwsVBSHad.py +++ b/script/bwsVBSHad.py @@ -145,8 +145,9 @@ def find_closest_values(par, point): LikeBins=25 -#likelihoodBinning = FwRebin.RebinLikelihood(LikeBins) if not opt.aqgc else FwRebin.SimpleRebin(2) -likelihoodBinning = FwRebin.RebinLikelihood(LikeBins) if not opt.aqgc else FwRebin.SimpleRebin(10) +#likelihoodBinning = FwRebin.RebinLikelihood(LikeBins) if not opt.aqgc else FwRebin.SimpleRebin(10) +aqgc_rebin = [500.,750.,1000.,1250.,1500.,2000.,5000.] if opt.category in ["BBtag", "BMET"] and opt.region == "SR" else [500.,750.,1000.,1250.,1500.,1750.,2000.,5000.] +likelihoodBinning = FwRebin.RebinLikelihood(LikeBins) if not opt.aqgc else FwRebin.FixedRebin(aqgc_rebin) def read_input(): psig = [] @@ -580,7 +581,11 @@ def write_inputs(self,outname): #datacard.txt data=self._get_histo("%(path)s/%(fname)s"%d,"%(base)s_%(suffix)s"%d,"%(cat)s_data_obs"%d) if data==None: print "[WARNING] Creating fake data histogram for",cat - data=ROOT.TH1D("%(cat)s_data_obs"%d,"fake data histogram with 100 bins",100,0,100) + xmin,xmax=0,100 + if opt.aqgc: xmin=500.,5000. + data=ROOT.TH1D("%(cat)s_data_obs"%d,"fake data histogram with 100 bins",100,xmin,xmax) + if opt.aqgc: + data = likelihoodBinning.applyMapping(LikelihoodMapping, data) else: data = likelihoodBinning.applyMapping(LikelihoodMapping, data) self._write(data) From dba7e0d2bddd2d5279e1a43154dfe930af6fade3 Mon Sep 17 00:00:00 2001 From: Andrea Carlo Marini Date: Wed, 20 Oct 2021 15:01:10 +0200 Subject: [PATCH 2/3] fix changes not meant to be --- script/FwBinning.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/script/FwBinning.py b/script/FwBinning.py index 026b33d4..337186d9 100644 --- a/script/FwBinning.py +++ b/script/FwBinning.py @@ -24,9 +24,6 @@ def applyMapping(self,x,h): return h1 class Rebin: - def __init__(self,n): - self.nmerge=n - h = None # sum of bkgs h_ref = None # reference (TTbar) maxStat = 0.3 #original 0.3 miao change From 827f7442f7906e559b111113acbb88a28d22511c Mon Sep 17 00:00:00 2001 From: Andrea Carlo Marini Date: Wed, 20 Oct 2021 15:05:40 +0200 Subject: [PATCH 3/3] updating commands --- test/cmd_aqgc_amarini.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/cmd_aqgc_amarini.sh b/test/cmd_aqgc_amarini.sh index 34c4b72a..a90bb4cf 100644 --- a/test/cmd_aqgc_amarini.sh +++ b/test/cmd_aqgc_amarini.sh @@ -31,4 +31,6 @@ python ../../script/makeNLLPlots.py --xtitle ft7 -o deltaNLL_ft7 -p VALUE -f hig python script/plotAQGC.py --more $(ls Datacards/OCT15/AQGC/higgs*all.root | while read f ; do echo "$f:$(echo ${f%%_all.root} | sed 's:.*_::g')" ; done | tr '\n' ',' | sed 's/,$//') -o plot_aqgc/all --xrange -16,16 -b python script/plotAQGC_panel.py -o plot_aqgc/all -rsync -avP plot_aqgc/ ~/www/cms-private/VBSHadronic/OCT15/plot_aqgc/ + +mkdir ~/www/cms-private/VBSHadronic/OCT15_rebinĀ§ +rsync -avP plot_aqgc/ ~/www/cms-private/VBSHadronic/OCT15_rebin/plot_aqgc/