cms-tau-pog / TauFW

Analysis framework for tau analysis at CMS using NanoAOD
9 stars 40 forks source link

TES combine stuff #8

Closed HuajieChengCN closed 3 years ago

HuajieChengCN commented 3 years ago

Hi all, this is the pull request to add the combine stuff for TES measurement.

IzaakWN commented 3 years ago

Hi Huajie, great! This look good overall.

However, I see you are using the PlotTools, which was an outdated version of the plotting tools you'll find in Plotter/python/plot and common/python/tools. We would like to use one set of plotting tool, so we can ensure a uniform style, and avoid code duplication. Could you please replace the use of these outdated tools everywhere where possible, e.g. in

and remove PlotTools all together, please?

You can find some examples in the README.md of Plotter or in Fitter/python/plot/postfit.py, e.g. for making TES variation comparisons:

from TauFW.Plotter.plot.Stack import Stack, CMSStyle
CMSStyle.setCMSEra(2018)
plot = Stack("p_{T} [GeV]",datahist,exphists)
plot.draw(ratio=True,logy=False)
plot.drawlegend(pos='right')
plot.drawtext("#mu#tau_{h} baseline")
plot.saveas("stack.png")
plot.saveas("stack.pdf")
plots.close()

for making stacked plots:

from TauFW.Plotter.plot.Stack import Stack
plot = Stack(xtitle,obshist,exphists)
plot.draw(xmin=xmin,xmax=xmax,ymax=ymax,square=square,ratio=ratio,rmin=rmin,rmax=rmax,
              staterror=True,errtitle=errtitle)
plot.drawlegend(position,tsize=tsize,text=text,ncol=ncol)
if title:
  plot.drawtext(title,bold=False)
plot.saveas(pname,outdir=outdir,ext=exts)
plot.close()

and to get the CMSSW style for the NLL profiles, TES summaries, etc., you can use

from TauFW.Plotter.sample.utils import CMSStyle
CMSStyle.setCMSEra(2018)
... # prepare canvas (=gPad)
CMSStyle.setCMSLumiStyle(gPad,0)

Let me know if you need help.

IzaakWN commented 3 years ago

Superseded by clean PR https://github.com/cms-tau-pog/TauFW/pull/12.