legFrac = TLegend(0.2, 0.79, 0.4, 0.89)
legFrac.SetFillStyle(0)
legFrac.SetBorderSize(0)
legFrac.SetTextSize(0.045)

latInfo = TLatex()
latInfo.SetNDC()
latInfo.SetTextSize(0.045)
latInfo.SetTextFont(42)
latInfo.SetTextColor(1)

hCorrYieldPrompt = hRawYields[0].Clone('hCorrYieldPrompt')
hCorrYieldPrompt.SetTitle(';#it{p}_{T} (GeV/#it{c}); #it{N}_{prompt}')
SetObjectStyle(hCorrYieldPrompt,
               color=kRed + 1,
               fillcolor=kRed + 1,
               markerstyle=kFullCircle)

hCorrYieldFD = hRawYields[0].Clone('hCorrYieldFD')
hCorrYieldFD.SetTitle(';#it{p}_{T} (GeV/#it{c}); #it{N}_{non-prompt}')
SetObjectStyle(hCorrYieldFD,
               color=kAzure + 4,
               fillcolor=kAzure + 4,
               markerstyle=kFullSquare)

hCovCorrYields = [[
    hRawYields[0].Clone('hCovPromptPrompt'),
    hRawYields[0].Clone('hCovPromptFD')
], [hRawYields[0].Clone('hCovFDPrompt'), hRawYields[0].Clone('hCovFDFD')]]
for iRow, row in enumerate(hCovCorrYields):
    for iCol, hCov in enumerate(row):
    cPtDFromB[D].DrawFrame(
        0., 1.e-7, 50.05, 2.,
        ';d#it{p}_{T} (GeV/#it{c});d#sigma/d#it{p}_{T} #times BR (#mub GeV^{-1} #it{c});'
    )
    cPtDFromB[D].SetLogy()
    for iB, (B, FFb) in enumerate(zip(Bhadrons, FFbtoB)):
        kineDfSelDSelB = kineDfSelDAcc.query(f'pdgB == {B}')
        hPtDFromB[D][B] = TH1F(f'hPt{D}From{B}', '', 1001, 0., 50.05)
        for pt in kineDfSelDSelB['ptD'].to_numpy():
            hPtDFromB[D][B].Fill(pt)
        hPtDFromB[D][B].Sumw2()
        hPtDFromB[D][B].Scale(1.e-6 * BRBhadronsToD[B][D] * FFb * norm * acc *
                              BRD / hPtDFromB[D][B].Integral())
        SetObjectStyle(hPtDFromB[D][B],
                       linecolor=Bcolors[iB],
                       markercolor=Bcolors[iB],
                       linewidth=1,
                       markerstyle=0)
        hPtDFromB[D][B].Draw('same')
        leg.AddEntry(hPtDFromB[D][B], f'{Bnames[B]} #rightarrow {Dnames[D]}',
                     'le')

    hPtDFromB[D]['sum'] = hPtDFromB[D][B].Clone(f'hPt{D}FromAllB')
    SetObjectStyle(hPtDFromB[D]['sum'],
                   linecolor=kBlack,
                   markercolor=kBlack,
                   linewidth=1,
                   markerstyle=0)
    hPtDFromB[D]['sum'].Reset()
    for B in Bhadrons:
        hPtDFromB[D]['sum'].Add(hPtDFromB[D][B])
hEffPrompt = TH1F('hEffPrompt', ';#it{p}_{T} (GeV/#it{c});Efficiency', nPtBins,
                  np.asarray(ptLims, 'd'))
hEffFD = TH1F('hEffFD', ';#it{p}_{T} (GeV/#it{c});Efficiency', nPtBins,
              np.asarray(ptLims, 'd'))
hYieldPromptGen = TH1F('hYieldPromptGen',
                       ';#it{p}_{T} (GeV/#it{c}); # Generated MC', nPtBins,
                       np.asarray(ptLims, 'd'))
hYieldFDGen = TH1F('hYieldFDGen', ';#it{p}_{T} (GeV/#it{c}); # Generated MC',
                   nPtBins, np.asarray(ptLims, 'd'))
hYieldPromptReco = TH1F('hYieldPromptReco',
                        ';#it{p}_{T} (GeV/#it{c}); # Reco MC', nPtBins,
                        np.asarray(ptLims, 'd'))
hYieldFDReco = TH1F('hYieldFDReco', ';#it{p}_{T} (GeV/#it{c}); # Reco MC',
                    nPtBins, np.asarray(ptLims, 'd'))
SetObjectStyle(hEffPrompt, color=kRed + 1, markerstyle=kFullCircle)
SetObjectStyle(hEffFD,
               color=kAzure + 4,
               markerstyle=kOpenSquare,
               markersize=1.5,
               linewidh=2,
               linestyle=7)
SetObjectStyle(hYieldPromptGen, color=kRed + 1, markerstyle=kFullCircle)
SetObjectStyle(hYieldFDGen,
               color=kAzure + 4,
               markerstyle=kOpenSquare,
               markersize=1.5,
               linewidh=2,
               linestyle=7)
SetObjectStyle(hYieldPromptReco, color=kRed + 1, markerstyle=kFullCircle)
SetObjectStyle(hYieldFDReco,
 for iParCut, (ParCutMin,
               ParCutMax) in enumerate(zip(ParCutMins, ParCutMaxs)):
     if len(varNames) == 1:
         for est in estNames:
             minVar = cutVars[varNames[0]]['min'][iPt] - cutVars[
                 varNames[0]]['step'][iPt] / 2
             maxVar = cutVars[varNames[0]]['max'][iPt] + cutVars[
                 varNames[0]]['step'][iPt] / 2
             nBinsVar = int(
                 (maxVar - minVar) / cutVars[varNames[0]]['step'][iPt])
             hEstimVsCut[iPt][est] = TH1F(
                 f'h{est}VsCut_pT{ptMin}-{ptMax}_{ParCutsName}{ParCutMin}-{ParCutMax}',
                 f';{varNames[0]};{estNames[est]}', nBinsVar, minVar,
                 maxVar)
             SetObjectStyle(hEstimVsCut[iPt][est],
                            color=kBlack,
                            marker=kFullCircle,
                            linewidth=1)
     elif len(varNames) == 2:
         for est in estNames:
             minVar0 = cutVars[varNames[0]]['min'][iPt] - cutVars[
                 varNames[0]]['step'][iPt] / 2
             minVar1 = cutVars[varNames[1]]['min'][iPt] - cutVars[
                 varNames[1]]['step'][iPt] / 2
             maxVar0 = cutVars[varNames[0]]['max'][iPt] + cutVars[
                 varNames[0]]['step'][iPt] / 2
             maxVar1 = cutVars[varNames[1]]['max'][iPt] + cutVars[
                 varNames[1]]['step'][iPt] / 2
             nBinsVar0 = int(
                 (maxVar0 - minVar0) / cutVars[varNames[0]]['step'][iPt])
             nBinsVar1 = int(
                 (maxVar1 - minVar1) / cutVars[varNames[1]]['step'][iPt])
Beispiel #5
0
hFracPrompt, hFracNonPrompt, hRatioFracPrompt, hRatioFracNonPrompt = ([] for _ in range(4))
gFracNonPrompt, gRatioFracNonPrompt = ([] for _ in range(2))
hFracNonPromptRawYieldSys, hFracNonPromptCutSetsSys, \
    hFracNonPromptMultWeightsSys, hFracNonPromptPtWeightsSys = ([] for _ in range(4))
hRatioFracNonPromptRawYieldSys, hRatioFracNonPromptCutSetsSys, \
    hRatioFracNonPromptMultWeightsSys, hRatioFracNonPromptPtWeightsSys = ([] for _ in range(4))

for iFile, fileName in enumerate(inFileNames):

    inFile = TFile.Open(fileName)

    hFracPrompt.append(inFile.Get('hPromptFracCorr'))
    hFracPrompt[iFile].SetDirectory(0)
    hFracPrompt[iFile].SetName(f'hFracPrompt_{labels[iFile]}')
    SetObjectStyle(hFracPrompt[iFile], color=GetROOTColor(colors[iFile]))

    hFracNonPrompt.append(inFile.Get('hFDFracCorr'))
    hFracNonPrompt[iFile].SetDirectory(0)
    hFracNonPrompt[iFile].SetName(f'hFracNonPrompt_{labels[iFile]}')
    SetObjectStyle(hFracNonPrompt[iFile], color=GetROOTColor(colors[iFile]))

    hFracNonPromptRawYieldSys.append(
        hFracNonPrompt[iFile].Clone(f'hFracNonPromptRawYieldSys_{labels[iFile]}')
    )
    hFracNonPromptCutSetsSys.append(
        hFracNonPrompt[iFile].Clone(f'hFracNonPromptCutSetsSys_{labels[iFile]}')
    )
    hFracNonPromptMultWeightsSys.append(
        hFracNonPrompt[iFile].Clone(f'hFracNonPromptMultWeightsSys_{labels[iFile]}')
    )
Beispiel #6
0
systColors = {
    'YieldExtr': 'kAzure+4',
    'SelEff': 'kRed',
    'TrEff': 'kBlue+1',
    'PIDEff': 'kOrange+7',
    'PtShape': 'kRed',
    'FD': 'kAzure+4',
    'Tot': 'kBlack'
}
gCrossSectionSyst = {}
for systSource in systGetter:
    gCrossSectionSyst[systSource] = TGraphErrors(1)
    gCrossSectionSyst[systSource].SetName(f'g{histoName}Syst{systSource}')
    gCrossSectionSyst[systSource].SetTitle(axisTitle)
    SetObjectStyle(gCrossSectionSyst[systSource],
                   color=GetROOTColor(systColors[systSource]),
                   fillstyle=0)

hPromptFrac = hEffAccPrompt.Clone('hPromptFrac')
hFDFrac = hEffAccFD.Clone('hFDFrac')
hPromptFrac.SetTitle(';#it{p}_{T} (GeV/#it{c}); #it{f}_{prompt}')
hFDFrac.SetTitle(';#it{p}_{T} (GeV/#it{c}); #it{f}_{FD}')

for iPt in range(hCrossSection.GetNbinsX()):
    ptMin = hRawYields.GetBinLowEdge(iPt + 1)
    ptMax = ptMin + hRawYields.GetBinWidth(iPt + 1)
    ptCent = hRawYields.GetBinCenter(iPt + 1)
    rawYield = hRawYields.GetBinContent(iPt + 1)
    rawYieldUnc = hRawYields.GetBinError(iPt + 1)
    effAccPrompt = hEffAccPrompt.GetBinContent(iPt + 1)
    effAccFD = hEffAccFD.GetBinContent(iPt + 1)
#output histos
nbins = len(cutVars['Pt']['max'])
xbins = cutVars['Pt']['min'] + list(
    set(cutVars['Pt']['max']) - set(cutVars['Pt']['min']))
for iVar, VartoDraw in enumerate(VarDrawList):
    hProject.append(
        TH1F(
            f'hProject{VartoDraw}', f'{VartoDraw} over p'
            '_{T}'
            f'; p'
            '_{T}'
            ' [GeV/c] ;'
            f'{VartoDraw}', nbins, np.asarray(xbins, float)))
    SetObjectStyle(hProject[iVar],
                   color=kGreen - iVar,
                   markerstyle=kOpenCrossX,
                   markersize=1.5,
                   linewidh=2,
                   linestyle=7)
    for iPt, _ in enumerate(cutVars['Pt']['min']):
        dfSignifSel = dfSignif.query(selToApply[iPt])
        hProject[iVar].SetBinContent(iPt + 1, dfSignifSel[f'{VartoDraw}'])
        if VartoDraw in ('EffAccFD', 'EffAccPrompt'):
            hProject[iVar].SetBinError(iPt + 1,
                                       dfSignifSel[f'{VartoDraw}Error'])
        if VartoDraw == 'S':
            hProject[iVar].SetBinError(
                iPt + 1, dfSignifSel['S'] / dfSignifSel['Signif'])
        if VartoDraw == 'B':
            hProject[iVar].SetBinError(iPt + 1, np.sqrt(dfSignifSel['B']))
    TProject.cd(iVar + 1)
    hProject[iVar].DrawCopy()
Beispiel #8
0
 hSignif[iFile].SetDirectory(0)
 hEv[iFile].SetDirectory(0)
 hSignal[iFile].Scale(1. / hEv[iFile].GetBinContent(1))
 hBackground[iFile].Scale(1. / hEv[iFile].GetBinContent(1))
 hSignif[iFile].Scale(1. / math.sqrt(hEv[iFile].GetBinContent(1)))
 hRatioSignal.append(ComputeRatioDiffBins(hSignal[iFile], hSignal[0]))
 hRatioSignal[iFile].SetDirectory(0)
 hRatioSignal[iFile].SetName(f'hRatioSignal{iFile}')
 hRatioBkg.append(ComputeRatioDiffBins(hBackground[iFile], hBackground[0]))
 hRatioBkg[iFile].SetDirectory(0)
 hRatioBkg[iFile].SetName(f'hRatioBkg{iFile}')
 hRatioSignif.append(ComputeRatioDiffBins(hSignif[iFile], hSignif[0]))
 hRatioSignif[iFile].SetDirectory(0)
 hRatioSignif[iFile].SetName(f'hRatioSignif{iFile}')
 SetObjectStyle(hSignal[iFile],
                linecolor=colors[iFile],
                markercolor=colors[iFile],
                markerstyle=markers[iFile])
 SetObjectStyle(hBackground[iFile],
                linecolor=colors[iFile],
                markercolor=colors[iFile],
                markerstyle=markers[iFile])
 SetObjectStyle(hSoverB[iFile],
                linecolor=colors[iFile],
                markercolor=colors[iFile],
                markerstyle=markers[iFile])
 SetObjectStyle(hSignif[iFile],
                linecolor=colors[iFile],
                markercolor=colors[iFile],
                markerstyle=markers[iFile])
 SetObjectStyle(hRatioSignal[iFile],
                linecolor=colors[iFile],
Beispiel #9
0
leg = TLegend(0.45, 0.6, 0.85, 0.9)
leg.SetTextSize(0.04)

hMass = []
cMassMLSel = TCanvas('cMassMLSel', '', 800, 800)
cMassMLSel.cd().DrawFrame(hMassVsML.GetYaxis().GetBinLowEdge(1), 0., \
    hMassVsML.GetYaxis().GetBinUpEdge(nMassbins), hMassVsML.ProjectionY().GetMaximum()*1.5*args.rebin, \
        ';#it{M}(KK#pi) (GeV/#it{c}^{2}); Counts')

for iBin, MLbin in enumerate(
        range(MLoutBinMin, MLoutBinMax + MLoutStepBin, MLoutStepBin)):
    MLoutBinMax = sparseBkg.GetAxis(13).SetRange(MLbin, nMLbins + 1)
    hMass.append(sparseBkg.Projection(0))
    SetObjectStyle(hMass[iBin],
                   color=kRed - 5 + iBin,
                   markerstyle=kFullCircle,
                   linewidth=2)
    if args.rebin:
        hMass[iBin].Rebin(args.rebin)
    hMass[iBin].Draw('Esame')
    leg.AddEntry(
        hMass[iBin], 'ML output > {:0.4f}'.format(
            sparseBkg.GetAxis(13).GetBinLowEdge(MLbin)), 'p')

leg.Draw()

cMassVsML.SaveAs('{0}_MassVsML.pdf'.format(args.outFileName))
cMassMLSel.SaveAs('{0}_MassDiffSel.pdf'.format(args.outFileName))

if six.PY2:
    raw_input('Press Enter to exit')
Beispiel #10
0
                MLbinmin = sPIDNsigma.GetAxis(1).FindBin(MLmin[iPt] * 1.0001)
                MLbinmax = sPIDNsigma.GetAxis(1).FindBin(MLmax[iPt] * 0.9999)

                if det != 'Comb':
                    sparse = sPIDNsigma
                else:
                    sparse = sPIDNsigmaComb

                sparse.GetAxis(0).SetRange(ptbinmin, ptbinmax)

                hNsigma[det][spe][prong]['Pt{:.0f}_{:.0f}'.format(ptmin, ptmax)] = \
                    sparse.Projection(axes[det][spe][prong])
                hNsigma[det][spe][prong]['Pt{:.0f}_{:.0f}'.format(ptmin, ptmax)].SetName(\
                    'hNsigma{0}_{1}_Prong{2}_Pt{3:.0f}_{4:.0f}'.format(det, spe, prong, ptmin, ptmax))
                SetObjectStyle(hNsigma[det][spe][prong]['Pt{:.0f}_{:.0f}'.format(\
                    ptmin, ptmax)], color=kBlue, linealpha=0.25, fillalpha=0.25, markeralpha=1, markerstyle=kFullCircle, markersize=0.5, linewidth=1)

                sparse.GetAxis(1).SetRange(MLbinmin, MLbinmax)

                hNsigmaSel[det][spe][prong]['Pt{:.0f}_{:.0f}'.format(ptmin, ptmax)] = \
                    sparse.Projection(axes[det][spe][prong])
                hNsigmaSel[det][spe][prong]['Pt{:.0f}_{:.0f}'.format(ptmin, ptmax)].SetName(\
                    'hNsigmaSel{0}_{1}_Prong{2}_Pt{3:.0f}_{4:.0f}'.format(det, spe, prong, ptmin, ptmax))
                SetObjectStyle(hNsigmaSel[det][spe][prong]['Pt{:.0f}_{:.0f}'.format(\
                    ptmin, ptmax)], color=kRed, linealpha=0.25, fillalpha=0.25, markeralpha=1, markerstyle=kOpenCircle, markersize=0.5, linewidth=1)

                sparse.GetAxis(0).SetRange(-1, -1)
                sparse.GetAxis(1).SetRange(-1, -1)

#2D distributions (TPC vs TOF)
hNsigma['TPCTOF'], hNsigmaSel['TPCTOF'] = {}, {}
Beispiel #11
0
def main():  #pylint: disable=too-many-statements
    """
    main function of script
    """
    SetGlobalStyle(padleftmargin=0.18,
                   padbottommargin=0.14,
                   titleoffsety=1.6,
                   maxdigits=2,
                   optstat=0)

    n_bins = 1001
    bin_width = 0.05  # GeV
    bin_lims = [i * bin_width for i in range(0, n_bins + 1)]
    hFONLLBtoDCentral = TH1D(
        'hDfromBpred_central',
        ';#it{p}_{T} (GeV/#it{c});#frac{d#sigma}{d#it{p}_{T}} (pb GeV^{-1} #it{c})',
        n_bins, np.asarray(bin_lims, 'd'))
    hFONLLBtoDMin = TH1D(
        'hDfromBpred_min',
        ';#it{p}_{T} (GeV/#it{c});#frac{d#sigma}{d#it{p}_{T}} (pb GeV^{-1} #it{c})',
        n_bins, np.asarray(bin_lims, 'd'))
    hFONLLBtoDMax = TH1D(
        'hDfromBpred_max',
        ';#it{p}_{T} (GeV/#it{c});#frac{d#sigma}{d#it{p}_{T}} (pb GeV^{-1} #it{c})',
        n_bins, np.asarray(bin_lims, 'd'))
    hFONLLBCentral = TH1D(
        'hBpred_central',
        ';#it{p}_{T} (GeV/#it{c});#frac{d#sigma}{d#it{p}_{T}} (pb GeV^{-1} #it{c})',
        n_bins, np.asarray(bin_lims, 'd'))
    hFONLLBMin = TH1D(
        'hBpred_min',
        ';#it{p}_{T} (GeV/#it{c});#frac{d#sigma}{d#it{p}_{T}} (pb GeV^{-1} #it{c})',
        n_bins, np.asarray(bin_lims, 'd'))
    hFONLLBMax = TH1D(
        'hBpred_max',
        ';#it{p}_{T} (GeV/#it{c});#frac{d#sigma}{d#it{p}_{T}} (pb GeV^{-1} #it{c})',
        n_bins, np.asarray(bin_lims, 'd'))

    fonllBtoD_df = pd.read_csv("fonll/FONLL_DfromB_pp5_y05_toCook.txt",
                               sep=" ",
                               header=14).astype('float64')
    fonllB_df = pd.read_csv("fonll/FONLL_B_pp5_y05.txt", sep=" ",
                            header=13).astype('float64')

    for pt, cen, low, up in zip(fonllBtoD_df['pt'].to_numpy(),
                                fonllBtoD_df['central'].to_numpy(),
                                fonllBtoD_df['min'].to_numpy(),
                                fonllBtoD_df['max'].to_numpy()):
        hFONLLBtoDCentral.Fill(pt, cen)
        hFONLLBtoDMin.Fill(pt, low)
        hFONLLBtoDMax.Fill(pt, up)
    for pt, cen, low, up in zip(fonllB_df['pt'].to_numpy(),
                                fonllB_df['central'].to_numpy(),
                                fonllB_df['min'].to_numpy(),
                                fonllB_df['max'].to_numpy()):
        hFONLLBCentral.Fill(pt, cen)
        hFONLLBMin.Fill(pt, low)
        hFONLLBMax.Fill(pt, up)

    for iBin in range(hFONLLBtoDCentral.GetNbinsX()):
        hFONLLBtoDCentral.SetBinError(iBin + 1, 1.e-3)
        hFONLLBtoDMin.SetBinError(iBin + 1, 1.e-3)
        hFONLLBtoDMax.SetBinError(iBin + 1, 1.e-3)
        hFONLLBCentral.SetBinError(iBin + 1, 1.e-3)
        hFONLLBMin.SetBinError(iBin + 1, 1.e-3)
        hFONLLBMax.SetBinError(iBin + 1, 1.e-3)

    hFONLL = [hFONLLBtoDCentral, hFONLLBtoDMin, hFONLLBtoDMax]
    hBFONLL = [hFONLLBCentral, hFONLLBMin, hFONLLBMax]
    labels = ['Central', 'Min', 'Max']
    canvas = []

    for label in labels:
        canvas.append(TCanvas(f'cComp{label}', '', 2000, 1000))

    for (histo, histo_std, label, canv) in zip(hFONLL, hBFONLL, labels,
                                               canvas):
        pt_lims = np.array(histo.GetXaxis().GetXbins(), 'd')

        pt_min = list(pt_lims)[0]
        pt_max = list(pt_lims)[-1]
        histo_std = histo_std.Rebin(histo.GetNbinsX(), f'hBFONLL{label}',
                                    pt_lims)
        histo.Rebin(5)
        histo_std.Rebin(5)
        histo.Scale(1.e-6)
        histo_std.Scale(1.e-6)
        histo_ratio = histo.Clone(f'hRatioDfromBOverB{label}')
        histo_ratio.Divide(histo, histo_std)
        histo_ratio.GetYaxis().SetTitle('FONLL D from B / FONLL B')

        print(
            f'\nFONLL B {label} integral (ub): {histo_std.Integral("width"):.4e}'
        )
        print(
            f'FONLL B from D {label} integral (ub): {histo.Integral("width"):.4e}\n'
        )

        canv.Divide(2, 1)
        canv.cd(1).DrawFrame(
            pt_min, 1e-4, pt_max, 100.,
            ';#it{p}_{T} (GeV/#it{c});#frac{d#sigma}{d#it{p}_{T}} (#mub GeV^{-1} #it{c})'
        )
        leg = TLegend(0.4, 0.7, 0.8, 0.9)
        leg.SetTextSize(0.045)
        leg.SetBorderSize(0)
        leg.SetFillStyle(0)
        SetObjectStyle(histo, color=kAzure + 4, markerstyle=kFullSquare)
        SetObjectStyle(histo_std, color=kRed, markerstyle=kFullCircle)
        histo.Draw('same')
        histo_std.Draw('same')
        leg.AddEntry(histo, f'FONLL D from B {label}', 'p')
        leg.AddEntry(histo_std, f'FONLL B {label}', 'p')
        gPad.SetLogy()
        leg.Draw()

        hframe_ratio = canv.cd(2).DrawFrame(
            pt_min, 0., pt_max, 3.5,
            ';#it{p}_{T} (GeV/#it{c}); FONLL D from B / FONLL B')
        hframe_ratio.GetYaxis().SetDecimals()
        SetObjectStyle(histo_ratio, color=kAzure + 4, markerstyle=kFullSquare)
        histo_ratio.Draw('same')
        canv.Update()
        canv.SaveAs(f'CompFONLL_DfromBvsB_{label}.pdf')

    input('Press enter to exit')
Beispiel #12
0
def main(): #pylint: disable=too-many-statements
    SetGlobalStyle(padleftmargin=0.18, padbottommargin=0.14, titleoffsety=1.6, maxdigits=2, optstat=0)

    inFileFONLL = TFile.Open('fonll/feeddown/DmesonLcPredictions_502TeV_y05_FFee_BRpythia8_SepContr_PDG2020.root')
    hFONLLPromptD0 = inFileFONLL.Get('hD0Kpipred_max')
    hFONLLPromptDplus = inFileFONLL.Get('hDpluskpipipred_max')
    hFONLLPromptDs = inFileFONLL.Get('hDsPhipitoKkpipred_max')
    hFONLLNonPromptD0 = inFileFONLL.Get('hD0KpifromBpred_central_corr')
    hFONLLNonPromptDplus = inFileFONLL.Get('hDpluskpipifromBpred_central_corr')
    hFONLLNonPromptDs = inFileFONLL.Get('hDsPhipitoKkpifromBpred_central_corr')

    binLims = np.array([0., 1., 2., 3., 4., 5., 6., 7., 8., 10., 12., 16., 24.], 'd')
    nBins = 12

    hFONLLPromptD0 = hFONLLPromptD0.Rebin(nBins, 'hFONLLPromptD0', binLims)
    hFONLLPromptDplus = hFONLLPromptDplus.Rebin(nBins, 'hFONLLPromptDplus', binLims)
    hFONLLPromptDs = hFONLLPromptDs.Rebin(nBins, 'hFONLLPromptDs', binLims)
    hFONLLNonPromptD0 = hFONLLNonPromptD0.Rebin(nBins, 'hFONLLNonPromptD0', binLims)
    hFONLLNonPromptDplus = hFONLLNonPromptDplus.Rebin(nBins, 'hFONLLNonPromptDplus', binLims)
    hFONLLNonPromptDs = hFONLLNonPromptDs.Rebin(nBins, 'hFONLLNonPromptDs', binLims)

    hFONLLNPfracD0 = hFONLLPromptD0.Clone('hFONLLNPfracD0')
    hFONLLNPfracD0.Divide(hFONLLNonPromptD0, hFONLLNPfracD0)
    hFONLLNPfracDplus = hFONLLPromptDplus.Clone('hFONLLNPfracDplus')
    hFONLLNPfracDplus.Divide(hFONLLNonPromptDplus, hFONLLNPfracDplus)
    hFONLLNPfracDs = hFONLLPromptDs.Clone('hFONLLNPfracDs')
    hFONLLNPfracDs.Divide(hFONLLNonPromptDs, hFONLLNPfracDs)

    SetObjectStyle(hFONLLNPfracD0, color=kRed, linewitdh=2, markerstyle=0, fillstyle=0)
    SetObjectStyle(hFONLLNPfracDplus, color=kGreen, linewitdh=2, markerstyle=0, fillstyle=0)
    SetObjectStyle(hFONLLNPfracDs, color=kOrange, linewitdh=2, markerstyle=0, fillstyle=0)

    mesonList = ['D0', 'D+', 'Ds']
    histoList = [hFONLLNPfracD0, hFONLLNPfracDplus, hFONLLNPfracDs]

    print(*binLims, sep=' ')
    for meson, histo in zip(mesonList, histoList):
        valueList = []
        for iBin in range(1, nBins + 1):
            valueList.append(f'{histo.GetBinContent(iBin):.3f}')
        print(meson)
        print(*valueList, sep=' ')

    legMeson = TLegend(0.65, 0.6, 0.85, 0.8)
    legMeson.SetTextSize(0.04)
    legMeson.SetFillStyle(0)
    legMeson.AddEntry(hFONLLNPfracD0, 'D^{0}', 'l')
    legMeson.AddEntry(hFONLLNPfracDplus, 'D^{+}', 'l')
    legMeson.AddEntry(hFONLLNPfracDs, 'D_{s}^{+}', 'l')

    cFrac = TCanvas('cFrac', '', 500, 500)
    hFrame = cFrac.DrawFrame(0., 0.01, 24., 1.05, ';#it{p}_{T} (GeV/#it{c}); #it{f}_{non-prompt}')
    hFrame.GetYaxis().SetDecimals()
    hFrame.Draw('axis same')
    hFONLLNPfracD0.Draw('same')
    hFONLLNPfracDplus.Draw('same')
    hFONLLNPfracDs.Draw('same')
    legMeson.Draw('same')
    cFrac.Update()

    TFile('./NaturalNonPromptFrac_FONLL_FFee_BRpythia8.root', 'recreate')
    hFONLLNPfracD0.Write()
    hFONLLNPfracDplus.Write()
    hFONLLNPfracDs.Write()
    cFrac.Write()

    input('Press enter to exit')
def comp_fit_pars(do_ratio=False, meson='Ds'): #pylint: disable-msg=too-many-statements,too-many-locals
    inputdir = '../../AnalysisNonPromptDpp2017/Dplus/outputs/rawyields'
    input_files = ['RawYieldsDplus_pp5TeV_prompt_central.root', 'RawYieldsDplus_pp5TeV_FD_central_freesigma.root']
    input_files_MC = ['RawYieldsDplusMC_pp5TeV_prompt_central.root', 'RawYieldsDplusMC_pp5TeV_FD_central.root']
    colors = [kOrange+7, kAzure+2, kRed+1, kAzure+4]
    markers = [kOpenCircle, kOpenSquare, kFullCircle, kFullSquare]
    legendnames = ['MC - prompt enhanced', 'MC - FD enhanced', 'data - prompt enhanced', 'data - FD enhanced']
    suffix = 'CompMCData'
    min_pt = 2.
    max_pt = 16.

    SetGlobalStyle(padleftmargin=0.18, padtopmargin=0.05, padbottommargin=0.14,
                   titleoffsety=1.6, titlesize=0.045, labelsize=0.04)
    hMean, hSigma = [], []
    input_files = input_files_MC + input_files

    if meson == 'Ds':
        massD = TDatabasePDG.Instance().GetParticle(431).Mass()
    elif meson == 'Dplus':
        massD = TDatabasePDG.Instance().GetParticle(411).Mass()

    lineMass = TLine(min_pt, massD, max_pt, massD)
    lineMass.SetLineWidth(2)
    lineMass.SetLineColor(kBlack)
    lineMass.SetLineStyle(9)

    legSigma = TLegend(0.2, 0.78, 0.8, 0.93)
    legSigma.SetFillStyle(0)
    legSigma.SetBorderSize(0)
    legSigma.SetTextSize(0.04)

    legMean = TLegend(0.4, 0.73, 0.7, 0.93)
    legMean.SetFillStyle(0)
    legMean.SetBorderSize(0)
    legMean.SetTextSize(0.04)
    legMean.AddEntry(lineMass, "PDG", 'l')

    for file_path, color, marker, legend_name in zip(input_files, colors, markers, legendnames):
        input_file = TFile(f'{inputdir}/{file_path}')
        histo_mean = input_file.Get('hRawYieldsMean')
        histo_sigma = input_file.Get('hRawYieldsSigma')
        histo_mean.SetDirectory(0)
        histo_sigma.SetDirectory(0)
        SetObjectStyle(histo_mean, linecolor=color, markercolor=color, markerstyle=marker)
        SetObjectStyle(histo_sigma, linecolor=color, markercolor=color, markerstyle=marker)
        legMean.AddEntry(histo_mean, legend_name, 'p')
        legSigma.AddEntry(histo_sigma, legend_name, 'p')
        hMean.append(histo_mean)
        hSigma.append(histo_sigma)

    if do_ratio:
        mean_num_list = list(hMean)
        mean_num_list.pop(0)
        mean_den_hist = hMean[0]
        mean_ratio_list = []
        for histo in mean_num_list:
            mean_ratio_list.append(ComputeRatioDiffBins(histo, mean_den_hist))
        cMeanRatio = TCanvas('cMeanRatio', '', 800, 800)
        cMeanRatio.DrawFrame(min_pt, 0.99, max_pt, 1.01, ';#it{p}_{T} (GeV/#it{c}); peak mean / peak mean MC')
        lineRatio = TLine(min_pt, 1., max_pt, 1.)
        lineRatio.SetLineWidth(2)
        lineRatio.SetLineColor(kBlack)
        lineRatio.SetLineStyle(9)
        legMeanRatio = TLegend(0.4, 0.73, 0.7, 0.93)
        legMeanRatio.SetFillStyle(0)
        legMeanRatio.SetBorderSize(0)
        legMeanRatio.SetTextSize(0.04)
        for hist, color, marker, legend_name in zip(mean_ratio_list, colors[1:],
                                                    markers[1:], legendnames[1:]):
            SetObjectStyle(hist, linecolor=color, markercolor=color, markerstyle=marker)
            hist.Draw('same')
            legMeanRatio.AddEntry(hist, legend_name, 'p')
        lineRatio.Draw()
        legMeanRatio.Draw()

        sigma_num_list = list(hSigma)
        sigma_num_list.pop(0)
        sigma_den_hist = hSigma[0]
        sigma_ratio_list = []
        for histo in sigma_num_list:
            sigma_ratio_list.append(ComputeRatioDiffBins(histo, sigma_den_hist))
        cSigmaRatio = TCanvas('cSigmaRatio', '', 800, 800)
        hFrameSigma = cSigmaRatio.DrawFrame(min_pt, 0.6, max_pt, 1.8,
                                            ';#it{p}_{T} (GeV/#it{c}); peak width / peak width MC')
        hFrameSigma.GetYaxis().SetDecimals()
        legSigmaRatio = TLegend(0.4, 0.73, 0.7, 0.93)
        legSigmaRatio.SetFillStyle(0)
        legSigmaRatio.SetBorderSize(0)
        legSigmaRatio.SetTextSize(0.04)
        for hist, color, marker, legend_name in zip(sigma_ratio_list, colors[1:],
                                                    markers[1:], legendnames[1:]):
            SetObjectStyle(hist, linecolor=color, markercolor=color, markerstyle=marker)
            hist.Draw('same')
            legSigmaRatio.AddEntry(hist, legend_name, 'p')
        lineRatio.Draw()
        legSigmaRatio.Draw()
        cMeanRatio.SaveAs(f'{inputdir}/MeanRatio_{suffix}.pdf')
        cSigmaRatio.SaveAs(f'{inputdir}/SigmaRatio_{suffix}.pdf')

    cMean = TCanvas('cMean', '', 800, 800)
    hFrameMean = cMean.DrawFrame(min_pt, massD*0.995, max_pt, massD*1.01,
                                 ';#it{p}_{T} (GeV/#it{c}); peak mean (GeV/#it{c}^{2})')
    hFrameMean.GetYaxis().SetDecimals()
    lineMass.Draw("same")
    for histo_mean in hMean:
        histo_mean.Draw('same')
    legMean.Draw()

    cSigma = TCanvas('cSigma', '', 800, 800)
    cSigma.DrawFrame(min_pt, 0., max_pt, 0.025, ';#it{p}_{T} (GeV/#it{c}); peak width (GeV/#it{c}^{2})')
    for histo_sigma in hSigma:
        histo_sigma.Draw('same')
    legSigma.Draw()

    cMean.SaveAs(f'{inputdir}/Mean_{suffix}.pdf')
    cSigma.SaveAs(f'{inputdir}/Sigma_{suffix}.pdf')
    input('Press enter to exit')
parser = argparse.ArgumentParser(description='Arguments')
parser.add_argument('inFileNameMultiTrial',
                    metavar='text',
                    default='MultiTrial.root')
parser.add_argument('inFileNameRawYields',
                    metavar='text',
                    default='RawYieldsDefault.root')
parser.add_argument('outFileName', metavar='text', default='Output.root')
args = parser.parse_args()

inFileRaw = TFile.Open(args.inFileNameRawYields)
hRawYields = inFileRaw.Get('hRawYields')
hSoverB = inFileRaw.Get('hRawYieldsSoverB')
hRawYields.SetDirectory(0)
hSoverB.SetDirectory(0)
SetObjectStyle(hRawYields, color=kBlack, fillstyle=0, linewidth=3)
SetObjectStyle(hSoverB, color=kRed + 1, fillstyle=0, linewidth=3)
inFileRaw.Close()

nPtBins = hRawYields.GetNbinsX()

hRawYieldDistr = []
hRMS = hRawYields.Clone('hRMS')
hRMS.Reset()
hMeanShift = hRawYields.Clone('hMeanShift')
hMeanShift.Reset()
hSyst = hRawYields.Clone('hSyst')
hSyst.Reset()
inFileMT = TFile.Open(args.inFileNameMultiTrial)
for iPt in range(1, nPtBins + 1):
    ptMin = hRawYields.GetBinLowEdge(iPt)
outDir = inputCfg['outputfile']['directory']
outSuffix = inputCfg['outputfile']['suffix']

inFilePtWeightsName = inputCfg['inputs']['ptweightsfile']
inFilePtWeights = TFile.Open(inFilePtWeightsName)
enableBweights = inputCfg['inputs']['enableBweights']

hPtDistrD, hPtWeightsD, hPtDistrB, hPtWeightsB, hEffPrompt, \
    hEffFD, hEffPromptRatio, hEffFDRatio = ({} for _ in range(8))

for model in modelNames:
    if model == 'pythia' or inputCfg['inputs']['shapes'][model]['enabled']:
        if model != 'pythia':
            hPtDistrD[model] = inFilePtWeights.Get(f'{histoNames[model]}Dcent')
            hPtWeightsD[model] = inFilePtWeights.Get(f'{histoWeightNames[model]}Dcent')
            SetObjectStyle(hPtWeightsD[model], linewidth=2, linecolor=colors[model],
                           markerstyle=markers[model], markercolor=colors[model])
        else:
            hPtDistrD[model] = inFilePtWeights.Get(f'{histoNames[model]}D')
        SetObjectStyle(hPtDistrD[model], linewidth=2, linecolor=colors[model],
                       markerstyle=markers[model], markercolor=colors[model])
        if enableBweights:
            if model != 'pythia':
                hPtDistrB[model] = inFilePtWeights.Get(f'{histoNames[model]}Bcent')
                hPtWeightsB[model] = inFilePtWeights.Get(f'{histoWeightNames[model]}Bcent')
                SetObjectStyle(hPtWeightsB[model], linewidth=2, linecolor=colors[model],
                               markerstyle=markers[model], markercolor=colors[model])
            else:
                hPtDistrB[model] = inFilePtWeights.Get(f'{histoNames[model]}B')
            SetObjectStyle(hPtDistrB[model], linewidth=2, linecolor=colors[model],
                           markerstyle=markers[model], markercolor=colors[model])
        inFileEff = TFile.Open(inputCfg['inputs']['shapes'][model]['efffile'])
Beispiel #16
0
        hMass.append(
            infile.Get('hPromptMass_{0:.0f}_{1:.0f}'.format(
                ptMin * 10, ptMax * 10)))
        hMass[iPt].Add(
            infile.Get('hFDMass_{0:.0f}_{1:.0f}'.format(
                ptMin * 10, ptMax * 10)))
        if secPeak:
            hMass[iPt].Add(
                infile.Get('hPromptSecPeakMass_{0:.0f}_{1:.0f}'.format(
                    ptMin * 10, ptMax * 10)))
            hMass[iPt].Add(
                infile.Get('hFDSecPeakMass_{0:.0f}_{1:.0f}'.format(
                    ptMin * 10, ptMax * 10)))
            hMass[iPt].SetDirectory(0)
    hMass[iPt].Sumw2()
    SetObjectStyle(hMass[iPt], color=kBlack, markerstyle=kFullCircle)

hEv = infile.Get('hEvForNorm')
hEv.SetDirectory(0)
hEv.Sumw2()
SetObjectStyle(hEv, color=kBlack, markerstyle=kFullCircle)
infile.Close()

hSigmaToFix = None
if sum(fixSigma) > 0:
    infileSigma = TFile.Open(fitConfig[cent]['SigmaFile'])
    if not infileSigma:
        print(f'ERROR: file "{infileSigma}" cannot be opened! Exit!')
        sys.exit()
    hSigmaToFix = infileSigma.Get('hRawYieldsSigma')
    hSigmaToFix.SetDirectory(0)
                hTmp = inList.FindObject('hSPDMultVsCentCandInMass')
                hNtrklCandInMass[inpt].Add(
                    hTmp.ProjectionY('hSPDMultCandInMass', binCentMin,
                                     binCentMax).Clone())

    hNtrkl[inpt].SetName(f'hNtrkl{inpt}')
    hNtrklCand[inpt].SetName(f'hNtrklCand{inpt}')
    hNtrklCandInMass[inpt].SetName(f'hNtrklCandInMass{inpt}')
    hNtrkl[inpt].Sumw2()
    hNtrklCand[inpt].Sumw2()
    hNtrklCandInMass[inpt].Sumw2()
    hNtrkl[inpt].Scale(1. / hNtrkl[inpt].Integral())
    hNtrklCand[inpt].Scale(1. / hNtrklCand[inpt].Integral())
    hNtrklCandInMass[inpt].Scale(1. / hNtrklCandInMass[inpt].Integral())
    SetObjectStyle(hNtrkl[inpt],
                   fillstyle=0,
                   color=colors[inpt],
                   markerstyle=markers[inpt])
    SetObjectStyle(hNtrklCand[inpt],
                   fillstyle=0,
                   color=colors[inpt],
                   markerstyle=markers[inpt])
    SetObjectStyle(hNtrklCandInMass[inpt],
                   fillstyle=0,
                   color=colors[inpt],
                   markerstyle=markers[inpt])

hNtrklWeights = hNtrkl['data'].Clone('hNtrklWeights')
hNtrklWeights.Divide(hNtrkl['MC'])
hNtrklWeightsCand = hNtrklCand['data'].Clone('hNtrklWeightsCand')
hNtrklWeightsCand.Divide(hNtrklCand['MC'])
hNtrklWeightsCandInMass = hNtrklCandInMass['data'].Clone(
Beispiel #18
0
hMassKKSigRegionMC, hMassKKSigRegionData, hSideBandsMC, hSideBandsData, hMassKKwoPhiMC, hMassKKwoPhiData, \
    fMassKKwoPhiMC, fMassKKwoPhiData, hMassKKBkgSubMC, hMassKKBkgSubData, fMassKKMC, fMassKKData, \
        hConfIntMassKKMC, hConfIntMassKKData = ([] for _ in range(14))

hMeanMC = TH1F('hMeanMC', ';#it{p}_{T} (GeV/#it{c}); mean (GeV/#it{c}^{2})',
               nPtBinsMC - 1, np.array(ptLims, 'f'))
hMeanData = TH1F('hMeanData',
                 ';#it{p}_{T} (GeV/#it{c}); mean (GeV/#it{c}^{2})',
                 nPtBinsMC - 1, np.array(ptLims, 'f'))
hFWHMMC = TH1F('hFWHMMC', ';#it{p}_{T} (GeV/#it{c}); sigma (GeV/#it{c}^{2})',
               nPtBinsMC - 1, np.array(ptLims, 'f'))
hFWHMData = TH1F('hFWHMData',
                 ';#it{p}_{T} (GeV/#it{c}); sigma (GeV/#it{c}^{2})',
                 nPtBinsMC - 1, np.array(ptLims, 'f'))
SetObjectStyle(hMeanMC, color=kRed + 1, markerstyle=kFullSquare)
SetObjectStyle(hMeanData, color=kAzure + 4, markerstyle=kFullCircle)
SetObjectStyle(hFWHMMC, color=kRed + 1, markerstyle=kFullSquare)
SetObjectStyle(hFWHMData, color=kAzure + 4, markerstyle=kFullCircle)
hEffMC = {
    5:
    TH1F('hEffMC05', ';#it{p}_{T} (GeV/#it{c}); efficiency', nPtBinsMC - 1,
         np.array(ptLims, 'f')),
    10:
    TH1F('hEffMC10', ';#it{p}_{T} (GeV/#it{c}); efficiency', nPtBinsMC - 1,
         np.array(ptLims, 'f')),
    15:
    TH1F('hEffMC15', ';#it{p}_{T} (GeV/#it{c}); efficiency', nPtBinsMC - 1,
         np.array(ptLims, 'f')),
    20:
    TH1F('hEffMC20', ';#it{p}_{T} (GeV/#it{c}); efficiency', nPtBinsMC - 1,
def main():  #pylint: disable=too-many-locals,too-many-statements
    """
    Main function of the script
    """
    parser = argparse.ArgumentParser(description='Arguments to pass')
    parser.add_argument('cfgFileName',
                        metavar='text',
                        default='cfgFileName.yml',
                        help='config file name')
    parser.add_argument('outFileDir',
                        metavar='text',
                        default='./',
                        help='output file directory')
    args = parser.parse_args()

    with open(args.cfgFileName, 'r') as ymlCfgFile:
        inputCfg = yaml.load(ymlCfgFile, yaml.FullLoader)

    #Load data
    dfPromptP6 = LoadDfFromRootOrParquet(inputCfg['input']['prompt_files'][0])
    dfPromptP8 = LoadDfFromRootOrParquet(inputCfg['input']['prompt_files'][1])
    dfFDP6 = LoadDfFromRootOrParquet(inputCfg['input']['fd_files'][0])
    dfFDP8 = LoadDfFromRootOrParquet(inputCfg['input']['fd_files'][1])

    #Select pt bin
    ptMin = inputCfg['pt_bin'][0]
    ptMax = inputCfg['pt_bin'][1]
    dfPromptP6 = dfPromptP6.query(f'{ptMin} < pt_cand < {ptMax}')
    dfPromptP8 = dfPromptP8.query(f'{ptMin} < pt_cand < {ptMax}')
    dfFDP6 = dfFDP6.query(f'{ptMin} < pt_cand < {ptMax}')
    dfFDP8 = dfFDP8.query(f'{ptMin} < pt_cand < {ptMax}')

    SetGlobalStyle(padbottommargin=0.14,
                   padleftmargin=0.18,
                   padrightmargin=0.06,
                   titleoffsety=1.6)
    varTitle = inputCfg['scan_variable']['title']
    nBins = inputCfg['scan_variable']['histo_bins']
    binLims = inputCfg['scan_variable']['histo_lims']
    varName = inputCfg['scan_variable']['name']
    hPromptP6 = TH1F('hPromptP6', f';{varTitle};Counts', nBins, binLims[0],
                     binLims[1])
    hPromptP8 = TH1F('hPromptP8', f';{varTitle};Counts', nBins, binLims[0],
                     binLims[1])
    hFDP6 = TH1F('hFDP6', f';{varTitle};Counts', nBins, binLims[0], binLims[1])
    hFDP8 = TH1F('hFDP8', f';{varTitle};Counts', nBins, binLims[0], binLims[1])
    scaleFactor = inputCfg['scan_variable']['rescale_factor']
    dfPromptP6[varName] = dfPromptP6[varName] * scaleFactor
    dfPromptP8[varName] = dfPromptP8[varName] * scaleFactor
    dfFDP6[varName] = dfFDP6[varName] * scaleFactor
    dfFDP8[varName] = dfFDP8[varName] * scaleFactor
    for value in dfPromptP6[varName].to_numpy():
        hPromptP6.Fill(value)
    for value in dfPromptP8[varName].to_numpy():
        hPromptP8.Fill(value)
    for value in dfFDP6[varName].to_numpy():
        hFDP6.Fill(value)
    for value in dfFDP8[varName].to_numpy():
        hFDP8.Fill(value)
    SetObjectStyle(hPromptP6, color=kAzure + 4, marker=kFullCircle)
    SetObjectStyle(hPromptP8, color=kRed + 1, marker=kFullCircle)
    SetObjectStyle(hFDP6, color=kAzure + 4, marker=kFullCircle)
    SetObjectStyle(hFDP8, color=kRed + 1, marker=kFullCircle)
    hPromptP6.GetXaxis().SetNdivisions(505)
    hFDP6.GetXaxis().SetNdivisions(505)
    hPromptP8.GetXaxis().SetNdivisions(505)
    hFDP8.GetXaxis().SetNdivisions(505)

    scanRange = inputCfg['scan_variable']['scan_range']
    scanStep = inputCfg['scan_variable']['scan_step']
    nEffBins = round((scanRange[1] - scanRange[0]) / scanStep)
    hEffPromptP6 = TH1F('hEffPromptP6', f';{varTitle} >;Efficiency', nEffBins,
                        scanRange[0], scanRange[1])
    hEffPromptP8 = TH1F('hEffPromptP8', f';{varTitle} >;Efficiency', nEffBins,
                        scanRange[0], scanRange[1])
    hEffFDP6 = TH1F('hEffFDP6', f';{varTitle} >;Efficiency', nEffBins,
                    scanRange[0], scanRange[1])
    hEffFDP8 = TH1F('hEffFDP8', f';{varTitle} >;Efficiency', nEffBins,
                    scanRange[0], scanRange[1])
    SetObjectStyle(hEffPromptP6, color=kAzure + 4, marker=kFullCircle)
    SetObjectStyle(hEffPromptP8, color=kRed + 1, marker=kFullCircle)
    SetObjectStyle(hEffFDP6, color=kAzure + 4, marker=kFullCircle)
    SetObjectStyle(hEffFDP8, color=kRed + 1, marker=kFullCircle)

    effPromptP6, effPromptP8, effFDP6, effFDP8 = ([] for _ in range(4))
    effPromptUncP6, effPromptUncP8, effFDUncP6, effFDUncP8 = (
        [] for _ in range(4))
    labelsConf = inputCfg['legend']['conf_labels']
    legPrompt = TLegend(0.25, 0.2, 0.6, 0.4)
    legPrompt.SetBorderSize(0)
    legPrompt.SetFillStyle(0)
    legPrompt.SetHeader('Prompt')
    legPrompt.AddEntry(hEffPromptP6, labelsConf[0], 'p')
    legPrompt.AddEntry(hEffPromptP8, labelsConf[1], 'p')
    legFD = TLegend(0.25, 0.2, 0.65, 0.4)
    legFD.SetBorderSize(0)
    legFD.SetFillStyle(0)
    legFD.SetHeader('Non-prompt')
    legFD.AddEntry(hEffPromptP6, labelsConf[0], 'p')
    legFD.AddEntry(hEffPromptP8, labelsConf[1], 'p')

    for iBin, cut in enumerate(np.arange(scanRange[0], scanRange[1],
                                         scanStep)):
        dfPromptP6Sel = dfPromptP6.query(f'{varName} > {cut}')
        dfPromptP8Sel = dfPromptP8.query(f'{varName} > {cut}')
        dfFDP6Sel = dfFDP6.query(f'{varName} > {cut}')
        dfFDP8Sel = dfFDP8.query(f'{varName} > {cut}')

        effPromptP6.append(float(len(dfPromptP6Sel) / len(dfPromptP6)))
        effPromptP8.append(float(len(dfPromptP8Sel) / len(dfPromptP8)))
        effFDP6.append(float(len(dfFDP6Sel) / len(dfFDP6)))
        effFDP8.append(float(len(dfFDP8Sel) / len(dfFDP8)))

        effPromptUncP6.append(
            np.sqrt(effPromptP6[-1] * (1 - effPromptP6[-1]) / len(dfPromptP6)))
        effPromptUncP8.append(
            np.sqrt(effPromptP8[-1] * (1 - effPromptP8[-1]) / len(dfPromptP8)))
        effFDUncP6.append(
            np.sqrt(effFDP6[-1] * (1 - effFDP6[-1]) / len(dfFDP6)))
        effFDUncP8.append(
            np.sqrt(effFDP8[-1] * (1 - effFDP8[-1]) / len(dfFDP8)))

        hEffPromptP6.SetBinContent(iBin + 1, effPromptP6[-1])
        hEffPromptP8.SetBinContent(iBin + 1, effPromptP8[-1])
        hEffFDP6.SetBinContent(iBin + 1, effFDP6[-1])
        hEffFDP8.SetBinContent(iBin + 1, effFDP8[-1])

        hEffPromptP6.SetBinError(iBin + 1, effPromptUncP6[-1])
        hEffPromptP8.SetBinError(iBin + 1, effPromptUncP8[-1])
        hEffFDP6.SetBinError(iBin + 1, effFDUncP6[-1])
        hEffFDP8.SetBinError(iBin + 1, effFDUncP8[-1])

    hEffPromptP6.GetXaxis().SetNdivisions(505)
    hEffFDP6.GetXaxis().SetNdivisions(505)
    hEffPromptP8.GetXaxis().SetNdivisions(505)
    hEffFDP8.GetXaxis().SetNdivisions(505)

    hEffPromptRatio = hEffPromptP8.Clone('hEffPromptRatio')
    hEffPromptRatio.Divide(hEffPromptP6)
    hEffPromptRatio.GetYaxis().SetTitle(
        f'Prompt eff ratio {labelsConf[1]} / {labelsConf[0]}')
    hEffFDRatio = hEffFDP8.Clone('hEffFDRatio')
    hEffFDRatio.Divide(hEffFDP6)
    hEffFDRatio.GetYaxis().SetTitle(
        f'Non-prompt eff ratio {labelsConf[1]} / {labelsConf[0]}')

    hEffPromptRatio.GetXaxis().SetNdivisions(505)
    hEffFDRatio.GetXaxis().SetNdivisions(505)

    cDistributions = TCanvas('cDistributions', '', 1920, 1080)
    cDistributions.Divide(2, 1)
    cDistributions.cd(1).SetLogy()
    hPromptP8.Draw('e')
    hPromptP6.Draw('esame')
    legPrompt.Draw()
    cDistributions.cd(2).SetLogy()
    hFDP8.Draw('e')
    hFDP6.Draw('esame')
    legFD.Draw()

    cEfficiency = TCanvas('cEfficiency', '', 1920, 1080)
    cEfficiency.Divide(2, 1)
    cEfficiency.cd(1).SetLogy()
    hEffPromptP6.Draw('e')
    hEffPromptP8.Draw('esame')
    legPrompt.Draw()
    cEfficiency.cd(2).SetLogy()
    hEffFDP6.Draw('e')
    hEffFDP8.Draw('esame')
    legFD.Draw()

    cEfficiencyRatio = TCanvas('cEfficiencyRatio', '', 1920, 1080)
    cEfficiencyRatio.Divide(2, 1)
    cEfficiencyRatio.cd(1)
    hEffPromptRatio.Draw('e')
    cEfficiencyRatio.cd(2)
    hEffFDRatio.Draw('e')

    tag = f'{labelsConf[0]}Vs{labelsConf[1]}_pT{ptMin}_{ptMax}'
    cDistributions.SaveAs(f'{args.outFileDir}/{varName}_Distr_{tag}.pdf')
    cEfficiency.SaveAs(f'{args.outFileDir}/{varName}_CutEff_{tag}.pdf')
    cEfficiencyRatio.SaveAs(
        f'{args.outFileDir}/{varName}_CutEffRatio_{tag}.pdf')

    print('Press any key to exit!')
    input()
Beispiel #20
0
        hCrossSectionPrompt.Scale(1.e-6 / BR)
        hCrossSectionPrompt.SetStats(0)
        if args.syst:
            gCrossSectionPrompt = infilePrompt.Get('gSigmaCorr')
            gCrossSectionPrompt.RemovePoint(0)
            ScaleGraph(gCrossSectionPrompt, 1.e-6 / BR)
            for iPt in range(hCrossSectionPrompt.GetNbinsX()):
                gCrossSectionPrompt.SetPointEXhigh(
                    iPt,
                    hCrossSectionPrompt.GetBinWidth(iPt + 1) / 2.5)
                gCrossSectionPrompt.SetPointEXlow(
                    iPt,
                    hCrossSectionPrompt.GetBinWidth(iPt + 1) / 2.5)
    hCrossSectionPrompt.SetName('hCrossSectionPrompt')
    hCrossSectionPrompt.SetDirectory(0)
    SetObjectStyle(hCrossSectionPrompt, color=kBlack, markerstyle=kFullCircle)
    if args.syst:
        SetObjectStyle(gCrossSectionPrompt, color=kBlack, fillstyle=0)
        gCrossSectionPrompt.SetName('gCrossSectionPrompt')
    infilePrompt.Close()

    ptLimitsPrompt = np.array(hCrossSectionPrompt.GetXaxis().GetXbins(), 'd')
    ptMinPrompt = list(ptLimitsPrompt)[0]
    ptMaxPrompt = list(ptLimitsPrompt)[-1]
    ptMin = ptMinPrompt
    ptMax = ptMaxPrompt
    sigmaMin = hCrossSectionPrompt.GetMinimum() * 0.2
    sigmaMax = hCrossSectionPrompt.GetMaximum() * 5

    infileFONLL = TFile.Open(args.FONLLFileName)
    if args.Dplus:
sFracRatioVsMult, multFactor = [], []
tunes = [0, 3, 7, 8, 9]
for tune in tunes:
    fRatioVsMult = uproot.open(
        args.multDepFileName)[f'hfnonprompt_ratioMB_meson_tune{tune}']
    bins = fRatioVsMult.axis(0).edges()
    multCent = [(bins[iBin] + bins[iBin + 1]) / 2
                for iBin in range(len(bins) - 1)]
    sFracRatioVsMult.append(
        InterpolatedUnivariateSpline(multCent, fRatioVsMult.values()))
    multFactor.append(sFracRatioVsMult[-1](args.multFactor))

gFracFONLLUnc, gFracMultUnc, gFracTotUnc = (TGraphAsymmErrors(0)
                                            for _ in range(3))
SetObjectStyle(gFracFONLLUnc, color=kAzure + 4, fillalpha=0.2)
SetObjectStyle(gFracMultUnc, color=kGreen + 2, fillalpha=0.2)
SetObjectStyle(gFracTotUnc, color=kRed + 1, fillalpha=0.2)
ptMin, ptMax = -1., 1.
for iPt in range(gFrac.GetN() - 1):

    promptFrac, pT = ctypes.c_double(), ctypes.c_double()
    gFrac.GetPoint(iPt + 1, pT, promptFrac)
    FONLLUncLow = gFrac.GetErrorYlow(iPt + 1)
    FONLLUncHigh = gFrac.GetErrorYhigh(iPt + 1)
    ptUncLow = gFrac.GetErrorXlow(iPt + 1)
    ptUncHigh = gFrac.GetErrorXhigh(iPt + 1)

    nonPromptFrac = 1 - promptFrac.value
    nonPromptFracLow = nonPromptFrac * min(multFactor)
    nonPromptFracHigh = nonPromptFrac * max(multFactor)
                    help='config file name with root input files')
args = parser.parse_args()

with open(args.cfgFileName, 'r') as ymlCutSetFile:
    inCfg = yaml.load(ymlCutSetFile, yaml.FullLoader)

inFile = TFile.Open(inCfg['infilename'])
hCrossSec = inFile.Get('hCrossSection')
hCrossSec.SetName('hCrossSecMeas')
hCrossSec.SetDirectory(0)
gCrossSec = inFile.Get('gCrossSectionSystTot')
gCrossSec.SetName('gCrossSectionSystTotMeas')
gCrossSecLumi = inFile.Get('gCrossSectionSystLumi')
systErr = inFile.Get('AliHFSystErr')
SetObjectStyle(hCrossSec,
               color=GetROOTColor('kBlack'),
               markerstyle=GetROOTMarker('kFullSquare'),
               markersize=0.8)
SetObjectStyle(gCrossSec, color=GetROOTColor('kBlack'), fillstyle=0)
inFile.Close()

ptMaxMeas = hCrossSec.GetXaxis().GetXmax()
ptLimsMeas = [
    hCrossSec.GetBinLowEdge(iPt) for iPt in range(1,
                                                  hCrossSec.GetNbinsX() + 1)
]
ptLimsMeas.append(ptMaxMeas)
ptMinMeas = ptLimsMeas[0]

colors = {
    'cent': GetROOTColor('kBlack'),
    'min': GetROOTColor('kRed+1'),
hVisibleCrossSectionStat = TH1F(f'h{graphName}', utilStr, 1, 0.5, 1.5)

gVisCrossSecUncorrSyst, gVisCrossSecCorrSyst, gVisCrossSecTotSyst, gVisCrossSecSystWoTrFDBRAndLumi, \
    gVisCrossSecSystTracking, gVisCrossSecSystFD, gVisCrossSecSystLumi, gVisCrossSecSystBR = \
        (TGraphAsymmErrors(0) for _ in range(8))
gVisCrossSecUncorrSyst.SetNameTitle(f'g{graphName}UncorrSys', utilStr)
gVisCrossSecCorrSyst.SetNameTitle(f'g{graphName}PtCorrSys', utilStr)
gVisCrossSecTotSyst.SetNameTitle(f'g{graphName}TotSys', utilStr)
gVisCrossSecSystWoTrFDBRAndLumi.SetNameTitle(f'g{graphName}SysWoTrFDBRAndLumi', utilStr)
gVisCrossSecSystTracking.SetNameTitle('gVisCrossSecSysTracking', utilStr)
gVisCrossSecSystFD.SetNameTitle(f'g{graphName}SysFD', utilStr)
gVisCrossSecSystLumi.SetNameTitle(f'g{graphName}SysLumi', utilStr)
gVisCrossSecSystBR.SetNameTitle(f'g{graphName}SysBR', utilStr)

SetObjectStyle(hVisibleCrossSectionStat, color=kBlack, markerstyle=kFullCircle)
SetObjectStyle(gVisCrossSecUncorrSyst, color=kBlack, fillstyle=0)
SetObjectStyle(gVisCrossSecCorrSyst, color=kBlack, fillstyle=0)
SetObjectStyle(gVisCrossSecTotSyst, color=kBlack, fillstyle=0)
SetObjectStyle(gVisCrossSecSystLumi, color=kBlack, fillstyle=0)
SetObjectStyle(gVisCrossSecSystBR, color=kBlack, fillstyle=0)
SetObjectStyle(gVisCrossSecSystFD, color=kBlack, fillstyle=0)
SetObjectStyle(gVisCrossSecSystTracking, color=kBlack, fillstyle=0)
SetObjectStyle(gVisCrossSecSystWoTrFDBRAndLumi, color=kBlack, fillstyle=0)

hVisibleCrossSectionStat.SetBinContent(1, visCrossSec)
hVisibleCrossSectionStat.SetBinError(1, statUnc)
gVisCrossSecUncorrSyst.SetPoint(0, 1., visCrossSec)
gVisCrossSecCorrSyst.SetPoint(0, 1., visCrossSec)
gVisCrossSecTotSyst.SetPoint(0, 1., visCrossSec)
gVisCrossSecSystWoTrFDBRAndLumi.SetPoint(0, 1., visCrossSec)
        legAbs.AddEntry(gRelVar, 'considered', 'p')
        legAbs.AddEntry(gRelVarOutliers, 'outliers', 'p')

if doRelVar:
    cRelVar = TCanvas('cRelVar', '', 800, 800)
    minVals = np.min(relVar, axis=0)
    maxVals = np.max(relVar, axis=0)
    hFrameRel = cRelVar.DrawFrame(
        minVals[0] - 0.5 * abs(minVals[0]), minVals[1] - 0.5 * abs(minVals[1]),
        maxVals[0] + 0.5 * abs(maxVals[0]), maxVals[1] + 0.5 * abs(maxVals[1]),
        f";relative variation of {varName['var1']};relative variation of {varName['var2']}"
    )
    hFrameRel.GetYaxis().SetDecimals()
    hFrameRel.GetYaxis().SetNdivisions(505)
    hFrameRel.GetXaxis().SetNdivisions(505)
    SetObjectStyle(gRelVar, color=kAzure + 4, markerstyle=kFullCircle)
    gRelVar.Draw('P')
    if removeOutliersRel:
        SetObjectStyle(gRelVarOutliers,
                       color=kRed + 1,
                       markerstyle=kFullCircle)
        gRelVarOutliers.Draw('P')
        legRel.Draw()
    cRelVar.SaveAs(f'{outFileName}_RelativeVariation.pdf')
if doAbsVar:
    cAbsVar = TCanvas('cAbsVar', '', 800, 800)
    minVals = np.min(absVar, axis=0)
    maxVals = np.max(absVar, axis=0)
    hFrameAbs = cAbsVar.DrawFrame(
        minVals[0] - 0.5 * abs(minVals[0]), minVals[1] - 0.5 * abs(minVals[1]),
        maxVals[0] + 0.5 * abs(maxVals[0]), maxVals[1] + 0.5 * abs(maxVals[1]),
Beispiel #25
0
    leg.SetFillStyle(0)

    leg2D = TLegend(0.18, 0.17, 0.52, 0.4)
    leg2D.SetTextSize(0.05)
    leg2D.SetFillStyle(0)

    for iVar, axis in enumerate(topovars):

        hVars[f'Pt{ptmin:.0f}_{ptmax:.0f}'][
            topovars[axis]] = sparseReco['RecoPrompt'].Projection(axis)
        hVars[f'Pt{ptmin:.0f}_{ptmax:.0f}'][topovars[axis]].SetName(
            f'hVarsSel_{topovars[axis]}_Pt{ptmin:.0f}_{ptmax:.0f}')
        SetObjectStyle(hVars[f'Pt{ptmin:.0f}_{ptmax:.0f}'][topovars[axis]],
                       color=kBlue,
                       linealpha=0.25,
                       fillalpha=0.25,
                       markeralpha=1,
                       markerstyle=kFullCircle,
                       markersize=0.5,
                       linewidth=1)

        hVarsVsPt[f'Pt{ptmin:.0f}_{ptmax:.0f}'][
            topovars[axis]] = sparseReco['RecoPrompt'].Projection(axis, 1)
        hVarsVsPt[f'Pt{ptmin:.0f}_{ptmax:.0f}'][topovars[axis]].SetName(
            f'hVarsSel_{topovars[axis]}_Pt{ptmin:.0f}_{ptmax:.0f}')
        SetObjectStyle(hVarsVsPt[f'Pt{ptmin:.0f}_{ptmax:.0f}'][topovars[axis]],
                       color=kBlue,
                       linealpha=0.25,
                       fillalpha=0.25,
                       markeralpha=1,
                       markerstyle=kFullCircle,
                       markersize=0.3,
Beispiel #26
0
    sys.exit()

SetGlobalStyle(padleftmargin=0.15,
               padtopmargin=0.05,
               titlesize=0.045,
               labelsize=0.04)

hMassTask, hMassTreeCreator, cComparison = ({} for iDic in range(3))

infile = TFile.Open(args.inputfile)
listTask = infile.Get('{0}/{1}'.format(args.inputdir, args.inputlist))
hEv = listTask.FindObject('hNEvents')
sparse = listTask.FindObject('fnSparse')
for iVar in Vars:
    hMassTask[iVar] = sparse.Projection(Vars[iVar])
    SetObjectStyle(hMassTask[iVar], color=kBlack, markerstyle=kFullCircle)

dfD = uproot.open(args.inputfile)['PWGHF_TreeCreator/tree_Ds'].arrays(
    library='pd')  #tree_event_char
dfEv = uproot.open(
    args.inputfile)['PWGHF_TreeCreator/tree_event_char'].arrays(library='pd')
dfEvSel = dfEv.query('is_ev_rej==0')

dfMerged = pd.merge(dfD, dfEvSel, on=['run_number', 'ev_id'])

isSel = FidAccSel(dfMerged['pt_cand'].to_numpy(), dfMerged.y_cand.to_numpy())
dfMerged['fidacc'] = isSel
dfMergedSel = dfMerged.query('fidacc==True')

leg = TLegend(0.4, 0.6, 0.8, 0.8)
for counter, iVar in enumerate(Vars):
styleMarkerPrompt = [
    kFullDiamond, kFullSquare, kFullStar, kFullTriangleUp, kFullCross
]
styleMarkerFD = [
    kOpenDiamond, kOpenSquare, kOpenStar, kOpenTriangleUp, kOpenCross
]
hEffPrompt, hEffFD = [], []

for iReso, fileName, in enumerate(inputFile):
    infile = TFile.Open(fileName)
    hEffPrompt.append(infile.Get('hAccEffPrompt'))
    hEffFD.append(infile.Get('hAccEffFD'))
    hEffPrompt[iReso].SetDirectory(0)
    hEffFD[iReso].SetDirectory(0)
    SetObjectStyle(hEffPrompt[iReso],
                   color=colorMarkerPrompt[iReso],
                   markerstyle=styleMarkerPrompt[iReso])
    SetObjectStyle(hEffFD[iReso],
                   color=colorMarkerFD[iReso],
                   markerstyle=styleMarkerFD[iReso],
                   markersize=1.5,
                   linewidh=2,
                   linestyle=7)

ptMin = hEffPrompt[0].GetBinLowEdge(1)
ptMax = hEffPrompt[0].GetBinLowEdge(
    hEffPrompt[0].GetNbinsX()) + hEffPrompt[0].GetBinWidth(
        hEffPrompt[0].GetNbinsX())

cEffPrompt = TCanvas('cEffPrompt', '', 800, 800)
cEffPrompt.DrawFrame(ptMin, 1.e-5, ptMax, 1.,
cRho00VsPromptFrac = TCanvas('cRho00VsPromptFrac', '', 1200, 400)
cRho00VsNonPromptFrac = TCanvas('cRho00VsNonPromptFrac', '', 1200, 400)
DivideCanvas(cRho00VsPromptFrac, nPtBins)
DivideCanvas(cRho00VsNonPromptFrac, nPtBins)
gRho00VsPromptFrac, gRho00VsNonPromptFrac, fRho00VsPromptFrac, fRho00VsNonPromptFrac = (
    [] for _ in range(4))
ciRho00VsPromptFrac, ciRho00VsNonPromptFrac = [], []

ptLims = ptMins.copy()
ptLims.append(ptMaxs[-1])
ptLims = np.array(ptLims, 'f')

hRho00Charm = TH1D('hRho00Charm', ';#it{p}_{T} (GeV/#it{c});#it{#rho}_{00}',
                   nPtBins, ptLims)
SetObjectStyle(hRho00Charm,
               color=GetROOTColor('kRed+1'),
               marker=GetROOTMarker('kFullSquare'))
hRho00Beauty = TH1D('hRho00Beauty', ';#it{p}_{T} (GeV/#it{c});#it{#rho}_{00}',
                    nPtBins, ptLims)
SetObjectStyle(hRho00Beauty,
               color=GetROOTColor('kAzure+4'),
               marker=GetROOTMarker('kFullCircle'))

lat = TLatex()
lat.SetNDC()
lat.SetTextFont(42)
lat.SetTextSize(0.045)
lat.SetTextColor(GetROOTColor('kBlack'))

for iPt, (ptMin, ptMax) in enumerate(zip(ptMins, ptMaxs)):
Beispiel #29
0
 inFile = TFile.Open(inFileName)
 hEffPrompt.append(inFile.Get(f'{histoNames[iFile]}Prompt'))
 hEffFD.append(inFile.Get(f'{histoNames[iFile]}FD'))
 hEffPrompt[iFile].SetDirectory(0)
 hEffFD[iFile].SetDirectory(0)
 hEffPrompt[iFile].GetYaxis().SetRangeUser(1e-4, 1.)
 hEffFD[iFile].GetYaxis().SetRangeUser(1e-4, 1.)
 hEffPromptRatio.append(
     ComputeRatioDiffBins(hEffPrompt[iFile], hEffPrompt[0], 'B'))
 hEffPromptRatio[iFile].SetDirectory(0)
 hEffPromptRatio[iFile].SetName(f'hEffPromptRatio{iFile}')
 hEffFDRatio.append(ComputeRatioDiffBins(hEffFD[iFile], hEffFD[0], 'B'))
 hEffFDRatio[iFile].SetDirectory(0)
 hEffFDRatio[iFile].SetName(f'hEffFDRatio{iFile}')
 SetObjectStyle(hEffPrompt[iFile],
                linecolor=colors[iFile],
                markercolor=colors[iFile],
                markerstyle=markers[iFile])
 SetObjectStyle(hEffFD[iFile],
                linecolor=colors[iFile],
                markercolor=colors[iFile],
                markerstyle=markers[iFile],
                linestyle=1)
 SetObjectStyle(hEffPromptRatio[iFile],
                linecolor=colors[iFile],
                markercolor=colors[iFile],
                markerstyle=markers[iFile],
                linestyle=1)
 SetObjectStyle(hEffFDRatio[iFile],
                linecolor=colors[iFile],
                markercolor=colors[iFile],
                markerstyle=markers[iFile])
Beispiel #30
0
    leg = TLegend(0.18, 0.76, 0.52, 0.89)
    leg.SetTextSize(0.05)
    leg.SetFillStyle(0)

    leg2D = TLegend(0.18, 0.17, 0.52, 0.4)
    leg2D.SetTextSize(0.05)
    leg2D.SetFillStyle(0)

    for iVar, axis in enumerate(topovars):

        hVars['Pt{:.0f}_{:.0f}'.format(
            ptmin, ptmax)][topovars[axis]] = sparseReco['RecoPrompt'].Projection(axis)
        hVars['Pt{:.0f}_{:.0f}'.format(ptmin, ptmax)][topovars[axis]].SetName(
            'hVarsSel_{:s}_Pt{:.0f}_{:.0f}'.format(topovars[axis], ptmin, ptmax))
        SetObjectStyle(hVars['Pt{:.0f}_{:.0f}'.format(
            ptmin, ptmax)][topovars[axis]], color=kBlue, linealpha=0.25, fillalpha=0.25, markeralpha=1, markerstyle=kFullCircle, markersize=0.5, linewidth=1)

        hVarsVsPt['Pt{:.0f}_{:.0f}'.format(
            ptmin, ptmax)][topovars[axis]] = sparseReco['RecoPrompt'].Projection(axis, 1)
        hVarsVsPt['Pt{:.0f}_{:.0f}'.format(ptmin, ptmax)][topovars[axis]].SetName(
            'hVarsSel_{:s}_Pt{:.0f}_{:.0f}'.format(topovars[axis], ptmin, ptmax))
        SetObjectStyle(hVarsVsPt['Pt{:.0f}_{:.0f}'.format(
            ptmin, ptmax)][topovars[axis]], color=kBlue, linealpha=0.25, fillalpha=0.25, markeralpha=1, markerstyle=kFullCircle, markersize=0.3, linewidth=1)

        hVarsVsML['Pt{:.0f}_{:.0f}'.format(
            ptmin, ptmax)][topovars[axis]] = sparseReco['RecoPrompt'].Projection(axis, 13)
        hVarsVsML['Pt{:.0f}_{:.0f}'.format(ptmin, ptmax)][topovars[axis]].SetName(
            'hVarsSel_{:s}_Pt{:.0f}_{:.0f}'.format(topovars[axis], ptmin, ptmax))
        SetObjectStyle(hVarsVsML['Pt{:.0f}_{:.0f}'.format(
            ptmin, ptmax)][topovars[axis]], color=kBlue, linealpha=0.25, fillalpha=0.25, markeralpha=1, markerstyle=kFullCircle, markersize=0.3, linewidth=1)