Skip to content

Commit

Permalink
Merge pull request #1 from cheidegg/80X_M17_toMerge
Browse files Browse the repository at this point in the history
80 x m17 to merge
  • Loading branch information
cheidegg authored Dec 7, 2016
2 parents edf560e + 2e26d63 commit 2c80f52
Show file tree
Hide file tree
Showing 27 changed files with 1,118 additions and 142 deletions.
35 changes: 25 additions & 10 deletions TTHAnalysis/python/plotter/mcPlots.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,10 +464,12 @@ def doRatioHists(pspec,pmap,total,totalSyst,maxRange,fixRange=False,fitRatio=Non
if (rmax > 2 and rmax <= 2.4): rmax = 2.4
unity.SetFillStyle(1001);
unity.SetFillColor(ROOT.kCyan);
unity.SetLineColor(ROOT.kBlack);
unity.SetMarkerStyle(1);
unity.SetMarkerColor(ROOT.kCyan);
unity0.SetFillStyle(1001);
unity0.SetFillColor(ROOT.kBlue-7);
unity0.SetLineColor(ROOT.kBlack);
unity0.SetMarkerStyle(1);
unity0.SetMarkerColor(ROOT.kBlue-7);
ROOT.gStyle.SetErrorX(0.5);
Expand Down Expand Up @@ -586,7 +588,7 @@ def doStatTests(total,data,test,legendCorner):


legend_ = None;
def doLegend(pmap,mca,corner="TR",textSize=0.035,cutoff=1e-2,cutoffSignals=True,mcStyle="F",legWidth=0.18,legBorder=True,signalPlotScale=None,totalError=None,header="",doWide=False):
def doLegend(pmap,mca,corner="TR",textSize=0.035,cutoff=1e-2,cutoffSignals=True,mcStyle="F",sigStyle="F",legWidth=0.18,legBorder=True,signalPlotScale=None,totalError=None,header="",doWide=False):
if (corner == None): return
total = sum([x.Integral() for x in pmap.itervalues()])
sigEntries = []; bgEntries = []
Expand All @@ -596,7 +598,8 @@ def doLegend(pmap,mca,corner="TR",textSize=0.035,cutoff=1e-2,cutoffSignals=True,
lbl = mca.getProcessOption(p,'Label',p)
if signalPlotScale and signalPlotScale!=1:
lbl=lbl+" x "+("%d"%signalPlotScale if floor(signalPlotScale)==signalPlotScale else "%.2f"%signalPlotScale)
sigEntries.append( (pmap[p],lbl,mcStyle) )
pmap[p].SetLineColor(pmap[p].GetFillColor())
sigEntries.append( (pmap[p],lbl,sigStyle) )
backgrounds = mca.listBackgrounds(allProcs=True)
for p in backgrounds:
if mca.getProcessOption(p,'HideInLegend',False): continue
Expand Down Expand Up @@ -933,10 +936,19 @@ def printOnePlot(self,mca,pspec,pmap,makeCanvas=True,outputDir=None,printDir=Non
total.GetZaxis().SetRangeUser(pspec.getOption('ZMin',1.0), pspec.getOption('ZMax',1.0))
#if options.yrange:
# total.GetYaxis().SetRangeUser(options.yrange[0], options.yrange[1])
####### ----->>> HERE
if options.showSigShape or options.showIndivSigShapes or options.showIndivSigs:
signorms = doStackSignalNorm(pspec,pmap,options.showIndivSigShapes or options.showIndivSigs,extrascale=options.signalPlotScale, norm=not options.showIndivSigs)
for signorm in signorms:
if outputDir:
signorm.SetDirectory(outputDir); outputDir.WriteTObject(signorm)
reMax(total,signorm,islog,doWide=doWide)
####### ----->>> HERE
legendCutoff = pspec.getOption('LegendCutoff', 1e-5 if c1.GetLogy() else 1e-2)
if plotmode == "norm": legendCutoff = 0
doLegend(pmap,mca,corner=pspec.getOption('Legend','TR'),
cutoff=legendCutoff, mcStyle=("F" if plotmode == "stack" else "L"),
sigStyle=("L" if options.noStackSig else "F"),
cutoffSignals=not(options.showSigShape or options.showIndivSigShapes or options.showSFitShape),
textSize=( (0.045 if doRatio else 0.022) if options.legendFontSize <= 0 else options.legendFontSize ),
legWidth=options.legendWidth, legBorder=options.legendBorder, signalPlotScale=options.signalPlotScale,
Expand All @@ -955,12 +967,14 @@ def printOnePlot(self,mca,pspec,pmap,makeCanvas=True,outputDir=None,printDir=Non
else:
doSpam(options.addspam, .23, .855, .6, .895, align=12, textSize=(0.045 if doRatio else 0.033)*options.topSpamSize)
signorm = None; datnorm = None; sfitnorm = None
if options.showSigShape or options.showIndivSigShapes or options.showIndivSigs:
signorms = doStackSignalNorm(pspec,pmap,options.showIndivSigShapes or options.showIndivSigs,extrascale=options.signalPlotScale, norm=not options.showIndivSigs)
for signorm in signorms:
if outputDir:
signorm.SetDirectory(outputDir); outputDir.WriteTObject(signorm)
reMax(total,signorm,islog,doWide=doWide)
## COPY-PASTE THIS ONE
##if options.showSigShape or options.showIndivSigShapes or options.showIndivSigs:
## signorms = doStackSignalNorm(pspec,pmap,options.showIndivSigShapes or options.showIndivSigs,extrascale=options.signalPlotScale, norm=not options.showIndivSigs)
## for signorm in signorms:
## if outputDir:
## signorm.SetDirectory(outputDir); outputDir.WriteTObject(signorm)
## reMax(total,signorm,islog,doWide=doWide)
## COPY-PASTE TILL HERE
if options.showDatShape:
datnorm = doDataNorm(pspec,pmap)
if datnorm != None:
Expand Down Expand Up @@ -1078,8 +1092,9 @@ def printOnePlot(self,mca,pspec,pmap,makeCanvas=True,outputDir=None,printDir=Non
plot.SetMarkerSize(pspec.getOption("MarkerSize",1))
if pspec.hasOption('ZMin') and pspec.hasOption('ZMax'):
plot.GetZaxis().SetRangeUser(pspec.getOption('ZMin',1.0), pspec.getOption('ZMax',1.0))
plot.SetMarkerStyle(mca.getProcessOption(p,'MarkerStyle',1))
plot.SetMarkerColor(mca.getProcessOption(p,'FillColor',ROOT.kBlack))
if not p in ["signal", "background", "data", "total"]:
plot.SetMarkerStyle(mca.getProcessOption(p,'MarkerStyle',1))
plot.SetMarkerColor(mca.getProcessOption(p,'FillColor',ROOT.kBlack))
plot.Draw(pspec.getOption("PlotMode","COLZ TEXT45"))
c1.Print("%s/%s_%s.%s" % (fdir, outputName, p, ext))
if "data" in pmap and "TGraph" in pmap["data"].ClassName():
Expand Down
9 changes: 8 additions & 1 deletion TTHAnalysis/python/plotter/susy-ewkino/3l/mca_ewkino.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
## STANDARD SELECTION (CENTRAL VALUE)
## ===========================================================

## Sync Exercises
## -----------------------------------------------------------
TTWsync : TTW_EWK_sync : 1 ; Label="TTW", FakeRate="susy-ewkino/3l/fakerate_standard_central.txt\,susy-ewkino/3l/fakerate_filters_mc.txt\,susy-ewkino/3l/fakerate_load_isprompt.txt"
WZsync : WZ_EWK_sync : 1 ; Label="WZ", FakeRate="susy-ewkino/3l/fakerate_standard_central.txt\,susy-ewkino/3l/fakerate_filters_mc.txt\,susy-ewkino/3l/fakerate_load_isprompt.txt"
ZZsync : ZZ_EWK_sync : 1 ; Label="ZZ", FakeRate="susy-ewkino/3l/fakerate_standard_central.txt\,susy-ewkino/3l/fakerate_filters_mc.txt\,susy-ewkino/3l/fakerate_load_isprompt.txt"

## Optimization
## -----------------------------------------------------------
sig_TChiNeuWZ_150_120+ : TChiNeuWZ_150_120 : 0.10099*5180.86/1000 ; Label="WZ (150/120)", LineStyle=7, FillColor=ROOT.kGreen+2, FakeRate="susy-ewkino/3l/fakerate_standard_central.txt\,susy-ewkino/3l/fakerate_filters_fastsim.txt\,susy-ewkino/3l/fakerate_load_isprompt.txt", NormSystematic=0.2
sig_TChiNeuWZ_200_100+ : TChiNeuWZ_200_100 : 0.10099*1807.39/1000 ; Label="WZ (200/100)", LineStyle=7, FillColor=ROOT.kBlue, FakeRate="susy-ewkino/3l/fakerate_standard_central.txt\,susy-ewkino/3l/fakerate_filters_fastsim.txt\,susy-ewkino/3l/fakerate_load_isprompt.txt", NormSystematic=0.2
sig_TChiNeuWZ_200_100+ : TChiNeuWZ_200_100 : 0.10099*1807.39/1000 ; Label="WZ (200/100)", LineStyle=7, FillColor=ROOT.kRed, FakeRate="susy-ewkino/3l/fakerate_standard_central.txt\,susy-ewkino/3l/fakerate_filters_fastsim.txt\,susy-ewkino/3l/fakerate_load_isprompt.txt", NormSystematic=0.2
sig_TChiNeuWZ_350_25+ : TChiNeuWZ_350_25 : 0.10099*209.439/1000 ; Label="WZ (350/25)" , LineStyle=7, FillColor=ROOT.kRed, FakeRate="susy-ewkino/3l/fakerate_standard_central.txt\,susy-ewkino/3l/fakerate_filters_fastsim.txt\,susy-ewkino/3l/fakerate_load_isprompt.txt", NormSystematic=0.2
sig_TChiNeuWZ_400_1+ : TChiNeuWZ_400_1 : 0.10099*121.013/1000 ; Label="WZ (400/1)" , LineStyle=7, FillColor=ROOT.kBlue, FakeRate="susy-ewkino/3l/fakerate_standard_central.txt\,susy-ewkino/3l/fakerate_filters_fastsim.txt\,susy-ewkino/3l/fakerate_load_isprompt.txt", NormSystematic=0.2

Expand All @@ -22,6 +28,7 @@ sig_TChiNeuSlepSneuTD_200_150+ : TChiNeuSlepSneu_TD_200_150 : 1807.39/100
sig_TChiNeuSlepSneuTD_300_125+ : TChiNeuSlepSneu_TD_300_125 : 386.936/1000 ; Label="TD (300/125)", LineStyle=7, FillColor=ROOT.kGreen, FakeRate="susy-ewkino/3l/fakerate_standard_central.txt\,susy-ewkino/3l/fakerate_filters_fastsim.txt\,susy-ewkino/3l/fakerate_load_isprompt.txt", NormSystematic=0.2
sig_TChiNeuSlepSneuTD_400_125+ : TChiNeuSlepSneu_TD_400_125 : 121.013/1000 ; Label="TD (400/125)", LineStyle=7, FillColor=ROOT.kGreen, FakeRate="susy-ewkino/3l/fakerate_standard_central.txt\,susy-ewkino/3l/fakerate_filters_fastsim.txt\,susy-ewkino/3l/fakerate_load_isprompt.txt", NormSystematic=0.2
sig_TChiNeuSlepSneuTD_500_1+ : TChiNeuSlepSneu_TD_500_1 : 46.3533/1000 ; Label="TD (500/1)" , LineStyle=1, FillColor=ROOT.kGreen+2, FakeRate="susy-ewkino/3l/fakerate_standard_central.txt\,susy-ewkino/3l/fakerate_filters_fastsim.txt\,susy-ewkino/3l/fakerate_load_isprompt.txt", NormSystematic=0.2
sig_TChiNeuSlepSneuTD_700_1+ : TChiNeuSlepSneu_TD_700_1 : 9.51032/1000 ; Label="TD (700/1)" , LineStyle=1, FillColor=ROOT.kGreen+2, FakeRate="susy-ewkino/3l/fakerate_standard_central.txt\,susy-ewkino/3l/fakerate_filters_fastsim.txt\,susy-ewkino/3l/fakerate_load_isprompt.txt", NormSystematic=0.2


## Acceptance Study
Expand Down
4 changes: 2 additions & 2 deletions TTHAnalysis/python/plotter/susy-ewkino/3l/mcc_ewkino.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
nLepFlavor\b : nLepFlavor(countTaus(3, LepSel_pdgId[0], LepSel_pdgId[1], LepSel_pdgId[2]), is_4l, is_5l) ; AlsoData
srMll\b : srMll(3, mll_3l, mllL_3l, mllT_3l)
srMt\b : srMt(3, mT_3l, mTL_3l, mTT_3l)
srMll\b : srMll(3, mll_3l, mllL_3l, mllT_3l); AlsoData
srMt\b : srMt(3, mT_3l, mTL_3l, mTT_3l) ; AlsoData
BR\b : BR(3, countTaus(3, LepSel_pdgId[0], LepSel_pdgId[1], LepSel_pdgId[2]), nOSSF_3l, nOSLF_3l, nOSTF_3l) ; AlsoData
SR\b : SR(3, countTaus(3, LepSel_pdgId[0], LepSel_pdgId[1], LepSel_pdgId[2]), nOSSF_3l, nOSLF_3l, mT2L_3l, mT2T_3l, srMll(3, mll_3l, mllL_3l, mllT_3l), srMt(3, mT_3l, mTL_3l, mTT_3l), met_pt) ; AlsoData
SuperSig\b : SuperSig(3, countTaus(3, LepSel_pdgId[0], LepSel_pdgId[1], LepSel_pdgId[2]), nOSSF_3l, nOSLF_3l, mT2L_3l, mT2T_3l, srMll(3, mll_3l, mllL_3l, mllT_3l), srMt(3, mT_3l, mTL_3l, mTT_3l), met_pt) ; AlsoData
10 changes: 5 additions & 5 deletions TTHAnalysis/python/plotter/susy-ewkino/3l/plots_ewkino.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## super signal regions
## ----------------------------------------------------------
SSR : SuperSig : 5,0.5,5.5 ; YTitle="Events", XTitle="Super Signal Region", Legend="TR", IncludeOverflows=False, LegendCutoff=1e-5
SSR : SuperSig : 6,0.5,6.5 ; YTitle="Events", XTitle="Super Signal Region", Legend="TR", IncludeOverflows=False, LegendCutoff=1e-5

## baseline region per final state
## ----------------------------------------------------------
Expand Down Expand Up @@ -110,7 +110,7 @@ lep4_mva : LepSel4_mva : 20,0,1 ; YTitle="Leptons", XTitle="
## ----------------------------------------------------------

#met : met_pt : 35,0,700 ; XTitle="E_{T}^{miss} [GeV]" , LegendCutoff=1e-4
met : met_pt : 15,-75,300 ; XTitle="E_{T}^{miss} [GeV]" , LegendCutoff=1e-4, Logy, YMin=0.7, YMax=100000, Legend="TL"
met : met_pt : 17,-75,350 ; XTitle="E_{T}^{miss} [GeV]" , LegendCutoff=1e-4, Logy, YMin=0.7, YMax=100000, Legend="TL"
htJet30j : htJet30j : 20,0,200 ; XTitle="H_{T}(jet p_{T} > 30) [GeV]" , LegendCutoff=1e-4
nJet30 : nJet30 : 10,-0.5,9.5 ; XTitle="N(jet\, p_{T} > 30)" , LegendCutoff=1e-4
nBJet25 : nBJetMedium25 : 5,-0.5,4.5 ; XTitle="N(b-jet\, p_{T} > 25\, CSVM)", LegendCutoff=1e-4
Expand All @@ -119,9 +119,9 @@ m3l : m3L : 40,0,200 ; XTitle="m_{3L} [GeV]", Legend="TL", L
#mll3l : mll_3l : 40,0,200 ; XTitle="M(ll) [GeV]" , LegendCutoff=1e-4, Logy
mll3l : mllL_3l : 14,0,210 ; XTitle="M(ll) [GeV]" , LegendCutoff=1e-4, Logy, YMin=0.7, YMax=100000, Legend="TR"
#mtW3l : mT_3l : 10,0,200 ; XTitle="M_{T}^{W} [GeV]" , LegendCutoff=1e-4, Logy, YMax=10000, Legend="TL"
mtW3l : mT_3l : 10,0,200 ; XTitle="M_{T}^{W} [GeV]" , LegendCutoff=1e-4, Logy, YMin=0.7, YMax=100000, Legend="TR"
mT2L3l : mT2L_3l : 15,0,300 ; XTitle="M_{T2}(l\,l) [GeV]" , LegendCutoff=1e-4
mT2T3l : mT2T_3l : 15,0,300 ; XTitle="M_{T2}(l\,#tau) [GeV]" , LegendCutoff=1e-4, Logy
mtW3l : mTL_3l : 10,0,200 ; XTitle="M_{T}^{W} [GeV]" , LegendCutoff=1e-4, Logy, YMin=0.007, YMax=100000, Legend="TR"
mT2L3l : mT2L_3l : 15,0,300 ; XTitle="M_{T2}(l\,l) [GeV]" , LegendCutoff=1e-4, Logy, YMin=0.007, YMax=100000
mT2T3l : mT2T_3l : 15,0,300 ; XTitle="M_{T2}(l\,#tau) [GeV]" , LegendCutoff=1e-4, Logy, YMin=0.007, YMax=100000

mll4l : mll_4l : 40,0,200 ; XTitle="M(ll) [GeV]" , LegendCutoff=1e-4
mtW4l : mT_4l : 10,0,200 ; XTitle="M_{T}^{W} [GeV]" , LegendCutoff=1e-4
Expand Down
2 changes: 2 additions & 0 deletions TTHAnalysis/python/plotter/susy-ewkino/4l/mca_ewkino.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## STANDARD SELECTION (CENTRAL VALUE)
## ===========================================================

ZZsync : ZZ_EWK_sync : 1 ; Label="ZZ", FakeRate="susy-ewkino/3l/fakerate_standard_central.txt\,susy-ewkino/3l/fakerate_filters_mc.txt\,susy-ewkino/3l/fakerate_load_isprompt.txt"

## SIGNALS
## -----------------------------------------------------------
sig_TChiNeuZZ4L_400_1+ : TChiNeuZZ4L_400_1 : 0.10099*0.10099*88.7325/1000 ; Label="ZZ (400/1)", LineStyle=7, FillColor=ROOT.kGreen, FakeRate="susy-ewkino/3l/fakerate_standard_central.txt\,susy-ewkino/3l/fakerate_filters_fastsim.txt\,susy-ewkino/3l/fakerate_load_isprompt.txt", NormSystematic=0.2
Expand Down
2 changes: 1 addition & 1 deletion TTHAnalysis/python/plotter/susy-ewkino/functionsPUW.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ TH1F* h_puw_nInt_ICHEP_Up = (TH1F*) (f_puw_nInt_ICHEP_Up->Get("puw"));
TH1F* h_puw_nInt_ICHEP_Dn = (TH1F*) (f_puw_nInt_ICHEP_Dn->Get("puw"));

float puw_nInt_ICHEP(float nInt, int var=0) {

float puw = h_puw_nInt_ICHEP->GetBinContent(h_puw_nInt_ICHEP->FindBin(nInt));
if(var== 0) return puw;
if(var== 1) return h_puw_nInt_ICHEP_Up->GetBinContent(h_puw_nInt_ICHEP_Up->FindBin(nInt)) / puw;
Expand Down
6 changes: 4 additions & 2 deletions TTHAnalysis/python/plotter/susy-ewkino/functionsSF.cc
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ float getMuonUnc(float pt, int var = 0) {
return var*TMath::Sqrt(0.02*0.02+0.01*0.01);
}

float getLepSF(float pt, float eta, int pdgId, int wp = 0, int var = 0){
float getLepSF(float pt, float eta, int pdgId, int isTight, int wp = 0, int var = 0){
if(!isTight) return 1.0;
if(abs(pdgId) == 13) return (var==0)?getMuonSF (pt, eta, wp):(1+getMuonUnc (pt, var));
if(abs(pdgId) == 11) return (var==0)?getElectronSF(pt, eta, wp):(1+getElectronUnc(pt, eta, wp, var));
if(abs(pdgId) == 15) return 0.83;
Expand Down Expand Up @@ -204,7 +205,8 @@ float getTauUncFS(float pt, float eta, int var = 0) {
return fact * getUnc(h_tauSF_FS_id, pt, abs(eta));
}

float getLepSFFS(float pt, float eta, int pdgId, int wp, int var = 0){
float getLepSFFS(float pt, float eta, int pdgId, int isTight, int wp, int var = 0){
if(!isTight) return 1.0;
if(abs(pdgId) == 13) return (var==0)?getMuonSFFS (pt, eta, wp):(1+getMuonUncFS(var));
if(abs(pdgId) == 11) return (var==0)?getElectronSFFS(pt, eta, wp):(1+getElectronUncFS(var));
if(abs(pdgId) == 15) return (var==0)?getTauSFFS (pt, eta ):(1+getTauUncFS(pt, eta, var));
Expand Down
22 changes: 11 additions & 11 deletions TTHAnalysis/python/plotter/susy-interface/accmaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,31 @@
baseBin = "python mcPlots.py {MCA} {CUTS} {PLOTFILE} -P {T} --neg --s2v --tree {TREENAME} {FINAL} {MCCS} {MACROS} -l {LUMI} --pdir {O} {FRIENDS} {PROCS} {PLOTS} {FLAGS} --perBin --print txt"
(options, args) = parser.parse_args()
options = maker.splitLists(options)
mm = maker.Maker("accmaker", baseAll, args, options)
mm = maker.Maker("accmaker", baseAll, args, options, parser.defaults)
if options.perBin: mm.reloadBase(baseBin)

friends = mm.collectFriends()
mccs = mm.collectMCCs ()
macros = mm.collectMacros ()
sl = str(options.lumi)
sl = mm.getVariable("lumi","12.9").replace(".","p")

for r in range(len(mm.regions)):
mm.iterateRegion()

scenario = mm.getScenario(True)
flags = mm.collectFlags("flagsAccs")

output = mm.outdir +"/"+ scenario +"/accs"+ sl.replace(".","p") +"/"+ mm.region.name
output = mm.outdir +"/acc/"+ scenario +"/"+ sl +"fb"
func.mkdir(output)

scenario = mm.getScenario()
flags = mm.collectFlags ("flagsAccs")

procs = mm.collectProcs()
final = "-f" if options.final else ""
fom = options.fom if options.fom else ""
procs = mm.collectProcs()
final = "-f" if options.final else ""
fom = options.fom if options.fom else ""

if options.perBin:
mm.submit([mm.getVariable("mcafile",""), mm.getVariable("cutfile",""), mm.getVariable("plotfile",""), mm.treedir, options.treename, final, mccs, macros, options.lumi, output, friends, procs, options.perBin, flags],mm.region.name,False)
mm.submit([mm.getVariable("mcafile",""), mm.getVariable("cutfile",""), mm.getVariable("plotfile",""), mm.treedir, mm.getVariable("treename","treeProducerSusyMultilepton"), final, mccs, macros, mm.getVariable("lumi","12.9"), output, friends, procs, options.perBin, flags],mm.region.name,False)
else:
mm.submit([mm.getVariable("mcafile",""), mm.getVariable("cutfile",""), mm.treedir, options.treename, final, mccs, macros, options.lumi, friends, procs, flags, fom, output, "accmap_%s_%s.txt"%(scenario,mm.region.name)],mm.region.name,False)
mm.submit([mm.getVariable("mcafile",""), mm.getVariable("cutfile",""), mm.treedir, mm.getVariable("treename","treeProducerSusyMultilepton"), final, mccs, macros, mm.getVariable("lumi","12.9"), friends, procs, flags, fom, output, "accmap_%s_%s.txt"%(scenario,mm.region.name)],mm.region.name,False)

mm.runJobs()
mm.clearJobs()
Expand Down
Loading

0 comments on commit 2c80f52

Please sign in to comment.