|
|
@ -186,6 +186,11 @@ def argument_parser(): |
|
|
|
action="store_true", |
|
|
|
help="plot only electrons", |
|
|
|
) |
|
|
|
parser.add_argument( |
|
|
|
"--plot-velo", |
|
|
|
action="store_true", |
|
|
|
help="plot using momentum at EndVelo", |
|
|
|
) |
|
|
|
return parser |
|
|
|
|
|
|
|
|
|
|
@ -220,10 +225,7 @@ def get_eff(eff, hist, tf, histoName, label, var): |
|
|
|
eff[lab] = teff.CreateGraph() |
|
|
|
eff[lab].SetName(lab) |
|
|
|
eff[lab].SetTitle(lab + " not e^{-}") |
|
|
|
# if histoName.find("strange") != -1: |
|
|
|
# eff[lab].SetTitle(lab + " from stranges") |
|
|
|
# if histoName.find("electron") != -1: |
|
|
|
# eff[lab].SetTitle(lab + " e^{-}") |
|
|
|
|
|
|
|
if histoName.find("Forward") != -1: |
|
|
|
if histoName.find("electron") != -1: |
|
|
|
eff[lab].SetTitle(lab + " Forward, e^{-}") |
|
|
@ -234,12 +236,12 @@ def get_eff(eff, hist, tf, histoName, label, var): |
|
|
|
eff[lab].SetTitle(lab + " MergedMatch, e^{-}") |
|
|
|
else: |
|
|
|
eff[lab].SetTitle(lab + " MergedMatch") |
|
|
|
elif histoName.find("DefaultMatch") != -1: |
|
|
|
if histoName.find("DefaultMatch") != -1: |
|
|
|
if histoName.find("electron") != -1: |
|
|
|
eff[lab].SetTitle(lab + " DefaultMatch, e^{-}") |
|
|
|
else: |
|
|
|
eff[lab].SetTitle(lab + " DefaultMatch") |
|
|
|
elif histoName.find("Match") != -1: |
|
|
|
if histoName.find("Match") != -1: |
|
|
|
if histoName.find("electron") != -1: |
|
|
|
eff[lab].SetTitle(lab + " Match, e^{-}") |
|
|
|
else: |
|
|
@ -254,6 +256,8 @@ def get_eff(eff, hist, tf, histoName, label, var): |
|
|
|
eff[lab].SetTitle(lab + " BestLong, e^{-}") |
|
|
|
else: |
|
|
|
eff[lab].SetTitle(lab + " BestLong") |
|
|
|
if histoName.find("EndVelo") != -1: |
|
|
|
eff[lab].SetTitle(lab + " EndVelo, e^{-}") |
|
|
|
|
|
|
|
hist[lab] = denominator.Clone() |
|
|
|
hist[lab].SetName("h_numerator_notElectrons") |
|
|
@ -262,6 +266,8 @@ def get_eff(eff, hist, tf, histoName, label, var): |
|
|
|
hist[lab].SetTitle(var + " distribution, stranges") |
|
|
|
if histoName.find("electron") != -1: |
|
|
|
hist[lab].SetTitle(var + " distribution, e^{-}") |
|
|
|
if histoName.find("EndVelo") != -1: |
|
|
|
hist[lab].SetTitle(var + " distribution, EndVelo, e^{-}") |
|
|
|
|
|
|
|
return eff, hist |
|
|
|
|
|
|
@ -292,6 +298,7 @@ def PrCheckerEfficiency( |
|
|
|
savepdf, |
|
|
|
plot_electrons, |
|
|
|
plot_electrons_only, |
|
|
|
plot_velo, |
|
|
|
): |
|
|
|
from utils.LHCbStyle import setLHCbStyle, set_style |
|
|
|
from utils.ConfigHistos import ( |
|
|
@ -374,6 +381,36 @@ def PrCheckerEfficiency( |
|
|
|
label, |
|
|
|
histo, |
|
|
|
) |
|
|
|
if ( |
|
|
|
categories[tracker][cut]["plotEndVelo"] |
|
|
|
and plot_velo |
|
|
|
and (histo == "p" or histo == "pt") |
|
|
|
): |
|
|
|
histoNameEndVelo = ( |
|
|
|
"Track/" |
|
|
|
+ folder |
|
|
|
+ tracker |
|
|
|
+ "/" |
|
|
|
+ categories[tracker][cut]["EndVelo"] |
|
|
|
) |
|
|
|
histoName_v = ( |
|
|
|
histoNameEndVelo |
|
|
|
+ "_" |
|
|
|
+ efficiencyHistoDict[histo]["variable"] |
|
|
|
) |
|
|
|
print( |
|
|
|
"EndVelo: " + histoName_v.replace(unique_name_ext_re(), "") |
|
|
|
) |
|
|
|
eff_velo = {} |
|
|
|
hist_velo = {} |
|
|
|
eff_velo, hist_velo = get_eff( |
|
|
|
eff_velo, |
|
|
|
hist_velo, |
|
|
|
tf, |
|
|
|
histoName_v, |
|
|
|
label, |
|
|
|
histo, |
|
|
|
) |
|
|
|
name = "efficiency_" + histo |
|
|
|
canvas = TCanvas(name, canvastitle) |
|
|
|
canvas.SetRightMargin(0.1) |
|
|
@ -385,6 +422,15 @@ def PrCheckerEfficiency( |
|
|
|
if categories[tracker][cut]["plotElectrons"] and plot_electrons: |
|
|
|
mg.Add(eff_elec[lab]) |
|
|
|
set_style(eff_elec[lab], elec_colors[i], markers[i], styles[i]) |
|
|
|
if ( |
|
|
|
categories[tracker][cut]["plotEndVelo"] |
|
|
|
and plot_velo |
|
|
|
and (histo == "p" or histo == "pt") |
|
|
|
): |
|
|
|
mg.Add(eff_velo[lab]) |
|
|
|
set_style( |
|
|
|
eff_velo[lab], kMagenta + 1, markers[i], styles[i] |
|
|
|
) |
|
|
|
|
|
|
|
mg.Draw("AP") |
|
|
|
mg.GetYaxis().SetRangeUser(0, 1.05) |
|
|
@ -406,6 +452,7 @@ def PrCheckerEfficiency( |
|
|
|
mg.GetXaxis().SetNdivisions(10, 5, 0) |
|
|
|
mygray = 18 |
|
|
|
myblue = kBlue - 9 |
|
|
|
mypurple = kMagenta - 7 |
|
|
|
for i, lab in enumerate(label): |
|
|
|
rightmax = 1.05 * hist_den[lab].GetMaximum() |
|
|
|
scale = gPad.GetUymax() / rightmax |
|
|
@ -414,6 +461,15 @@ def PrCheckerEfficiency( |
|
|
|
rightmax = 1.05 * hist_elec[lab].GetMaximum() |
|
|
|
scale = gPad.GetUymax() / rightmax |
|
|
|
hist_elec[lab].Scale(scale) |
|
|
|
if ( |
|
|
|
categories[tracker][cut]["plotEndVelo"] |
|
|
|
and plot_velo |
|
|
|
and (histo == "p" or histo == "pt") |
|
|
|
): |
|
|
|
rightmax = 1.05 * hist_velo[lab].GetMaximum() |
|
|
|
scale = gPad.GetUymax() / rightmax |
|
|
|
hist_velo[lab].Scale(scale) |
|
|
|
|
|
|
|
if i == 0: |
|
|
|
if not plot_electrons_only: |
|
|
|
set_style(hist_den[lab], mygray, markers[i], styles[i]) |
|
|
@ -423,6 +479,16 @@ def PrCheckerEfficiency( |
|
|
|
set_style(hist_elec[lab], myblue, markers[i], styles[i]) |
|
|
|
hist_elec[lab].SetFillColorAlpha(myblue, 0.35) |
|
|
|
hist_elec[lab].Draw("HIST PLC SAME") |
|
|
|
if ( |
|
|
|
categories[tracker][cut]["plotEndVelo"] |
|
|
|
and plot_velo |
|
|
|
and (histo == "p" or histo == "pt") |
|
|
|
): |
|
|
|
set_style( |
|
|
|
hist_velo[lab], mypurple, markers[i], styles[i] |
|
|
|
) |
|
|
|
hist_velo[lab].SetFillColorAlpha(mypurple, 0.35) |
|
|
|
hist_velo[lab].Draw("HIST PLC SAME") |
|
|
|
# else: |
|
|
|
# print( |
|
|
|
# "No distribution plotted for other labels.", |
|
|
@ -456,6 +522,12 @@ def PrCheckerEfficiency( |
|
|
|
eff[lab].Draw("P SAME") |
|
|
|
if categories[tracker][cut]["plotElectrons"] and plot_electrons: |
|
|
|
eff_elec[lab].Draw("P SAME") |
|
|
|
if ( |
|
|
|
categories[tracker][cut]["plotEndVelo"] |
|
|
|
and plot_velo |
|
|
|
and (histo == "p" or histo == "pt") |
|
|
|
): |
|
|
|
eff_velo[lab].Draw("P SAME") |
|
|
|
cutName = categories[tracker][cut]["title"] |
|
|
|
latex.DrawLatex(legend.GetX1() + 0.01, legend.GetY1() - 0.05, cutName) |
|
|
|
low = 0 |
|
|
|