From e56a7ddf13cfe190208d609b4399c7d67f645d54 Mon Sep 17 00:00:00 2001 From: Marco Cipriani Date: Fri, 10 Apr 2026 19:24:29 +0200 Subject: [PATCH] bug fixes --- scripts/analysisTools/plotUtils/utility.py | 2 ++ scripts/plotting/makeDataMCStackPlot.py | 14 ++++++++++++-- scripts/rabbit/setupRabbit.py | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/scripts/analysisTools/plotUtils/utility.py b/scripts/analysisTools/plotUtils/utility.py index f0722dba7..de988a35a 100644 --- a/scripts/analysisTools/plotUtils/utility.py +++ b/scripts/analysisTools/plotUtils/utility.py @@ -991,6 +991,7 @@ def drawCorrelationPlot( invertPalette=False, canvasSize="700,625", passCanvas=None, + topMargin=0.1, bottomMargin=0.1, plotError=False, plotRelativeError=False, @@ -1074,6 +1075,7 @@ def drawCorrelationPlot( canvas.SetTicky(1) canvas.SetLeftMargin(leftMargin) canvas.SetRightMargin(rightMargin) + canvas.SetTopMargin(topMargin) canvas.SetBottomMargin(bottomMargin) canvas.cd() diff --git a/scripts/plotting/makeDataMCStackPlot.py b/scripts/plotting/makeDataMCStackPlot.py index 99f6690fa..60cc782ab 100644 --- a/scripts/plotting/makeDataMCStackPlot.py +++ b/scripts/plotting/makeDataMCStackPlot.py @@ -184,7 +184,7 @@ parser.add_argument( "--fakeTransferCorrFileName", type=str, - default="fakeTransferTemplates", + default="fakeTransferTemplates_smoothTF", help=""" Name of pkl.lz4 file (without extension) with pTmu correction for the shape of data-driven fakes. Currently used only when utAngleSign is a fakerate axis (detected automatically), since the shape @@ -224,6 +224,12 @@ default=[], help="Horizontal axis edges where to plot vertical lines", ) +parser.add_argument( + "--customXlabel", + type=str, + help="Set this label for the x axis (Latex format supported), otherwise it is inferred from the plotted axis.", + default=None, +) subparsers = parser.add_subparsers(dest="variation") variation = subparsers.add_parser( @@ -605,6 +611,9 @@ def collapseSyst(h): if groups.flavor in ["e", "ee"]: xlabel = xlabel.replace(r"\mu", "e") + if args.customXlabel is not None: + xlabel = r"{args.customXlabel}" + fig = plot_tools.makeStackPlotWithRatio( histInfo, prednames, @@ -646,8 +655,9 @@ def collapseSyst(h): width_scale=( args.customFigureWidth if args.customFigureWidth - else 1.25 if len(h.split("-")) == 1 else 1 + else 1.25 if len(h.split("-")) > 1 else 1 ), + automatic_scale=args.customFigureWidth is None, legPos=args.legPos, leg_padding=args.legPadding, lowerLeg=not args.noLowerLeg, diff --git a/scripts/rabbit/setupRabbit.py b/scripts/rabbit/setupRabbit.py index ac59f9b17..490600f50 100644 --- a/scripts/rabbit/setupRabbit.py +++ b/scripts/rabbit/setupRabbit.py @@ -1347,7 +1347,7 @@ def setup( ), fakeTransferCorrFileName=args.fakeTransferCorrFileName, histAxesRemovedBeforeFakes=( - [str(x[0]) for x in args.presel] if args.presel else [] + [str(x[0].split(":")[0]) for x in args.presel] if args.presel else [] ), ) datagroups.set_histselectors(