Browse Source

ResidualMatch rework

main
cetin 9 months ago
parent
commit
9ccedee74a
  1. BIN
      data_results/CompareEfficiencyBDefaultResidual.root
  2. 154
      scripts/CompareEfficiency.py

BIN
data_results/CompareEfficiencyBDefaultResidual.root

Binary file not shown.

154
scripts/CompareEfficiency.py

@ -130,8 +130,8 @@ def get_elec_colors():
kRed + 1, kRed + 1,
kGreen + 1, kGreen + 1,
kViolet, kViolet,
kOrange - 8,
kTeal - 1, kTeal - 1,
kOrange + 8,
kGray + 1, kGray + 1,
] ]
@ -879,84 +879,84 @@ def PrCheckerEfficiency(
# canvas.SetRightMargin(0.05) # canvas.SetRightMargin(0.05)
canvas.Write() canvas.Write()
# calculate ghost rate
print("\ncalculate ghost rate: ")
for histo in compareGhostHisto: # [Match, Seed, ...]
cut = compareDict[jcut][tracker]
canvastitle = "ghost_rate_vs_" + histo + "_" + jcut
name = "ghost_rate_vs_" + histo + "_" + jcut
canvas = TCanvas(name, canvastitle)
canvas.SetRightMargin(0.1)
mg = TMultiGraph()
jitr = 0
for tracker in trackers:
if tracker == "Seed":
continue
folder = folders[tracker]["folder"]
jcolor = compareColors[tracker]
gPad.SetTicks()
histoName = (
"Track/"
+ folder
+ tracker
+ "/"
+ ghostHistoDict[histo]["variable"]
)
ghost = {}
hist_den = {}
ghost = get_compare_ghost(ghost, hist_den, tf, histoName, label)
for i, lab in enumerate(label):
mg.Add(ghost[lab])
set_style(
ghost[lab], colors[jcolor + jitr], markers[2 * i], styles[i]
)
jitr += 1
xtitle = ghostHistoDict[histo]["xTitle"]
mg.GetXaxis().SetTitle(xtitle)
mg.GetYaxis().SetTitle("Fraction of fake tracks")
mg.Draw("ap")
mg.GetXaxis().SetTitleSize(0.06)
mg.GetYaxis().SetTitleSize(0.06)
mg.GetYaxis().SetTitleOffset(1.1)
mg.GetXaxis().SetRangeUser(*efficiencyHistoDict[histo]["range"])
mg.GetXaxis().SetNdivisions(10, 5, 0)
# for lab in label:
# ghost[lab].Draw("P SAME")
if histo == "p":
pos = [0.53, 0.4, 1.00, 0.71]
elif histo == "pt":
pos = [0.5, 0.4, 0.98, 0.71]
elif histo == "eta":
pos = [0.35, 0.6, 0.85, 0.9]
elif histo == "phi":
pos = [0.3, 0.3, 0.9, 0.6]
else:
pos = [0.4, 0.37, 0.80, 0.68]
legend = place_legend(
canvas, *pos, header="LHCb Simulation", option="LPE"
)
legend.SetTextFont(132)
legend.SetTextSize(0.04)
legend.Draw()
# if histo != "nPV":
# latex.DrawLatex(0.7, 0.85, "LHCb simulation")
# # calculate ghost rate
# print("\ncalculate ghost rate: ")
# for histo in compareGhostHisto: # [Match, Seed, ...]
# cut = compareDict[jcut][tracker]
# canvastitle = "ghost_rate_vs_" + histo + "_" + jcut
# name = "ghost_rate_vs_" + histo + "_" + jcut
# canvas = TCanvas(name, canvastitle)
# canvas.SetRightMargin(0.1)
# mg = TMultiGraph()
# jitr = 0
# for tracker in trackers:
# if tracker == "Seed":
# continue
# folder = folders[tracker]["folder"]
# jcolor = compareColors[tracker]
# gPad.SetTicks()
# histoName = (
# "Track/"
# + folder
# + tracker
# + "/"
# + ghostHistoDict[histo]["variable"]
# )
# ghost = {}
# hist_den = {}
# ghost = get_compare_ghost(ghost, hist_den, tf, histoName, label)
# for i, lab in enumerate(label):
# mg.Add(ghost[lab])
# set_style(
# ghost[lab], colors[jcolor + jitr], markers[2 * i], styles[i]
# )
# jitr += 1
# xtitle = ghostHistoDict[histo]["xTitle"]
# mg.GetXaxis().SetTitle(xtitle)
# mg.GetYaxis().SetTitle("Fraction of fake tracks")
# mg.Draw("ap")
# mg.GetXaxis().SetTitleSize(0.06)
# mg.GetYaxis().SetTitleSize(0.06)
# mg.GetYaxis().SetTitleOffset(1.1)
# mg.GetXaxis().SetRangeUser(*efficiencyHistoDict[histo]["range"])
# mg.GetXaxis().SetNdivisions(10, 5, 0)
# # for lab in label:
# # ghost[lab].Draw("P SAME")
# if histo == "p":
# pos = [0.53, 0.4, 1.00, 0.71]
# elif histo == "pt":
# pos = [0.5, 0.4, 0.98, 0.71]
# elif histo == "eta":
# pos = [0.35, 0.6, 0.85, 0.9]
# elif histo == "phi":
# pos = [0.3, 0.3, 0.9, 0.6]
# else: # else:
# latex.DrawLatex(0.2, 0.85, "LHCb simulation")
# pos = [0.4, 0.37, 0.80, 0.68]
# legend = place_legend(
# canvas, *pos, header="LHCb Simulation", option="LPE"
# )
# legend.SetTextFont(132)
# legend.SetTextSize(0.04)
# legend.Draw()
# # if histo != "nPV":
# # latex.DrawLatex(0.7, 0.85, "LHCb simulation")
# # else:
# # latex.DrawLatex(0.2, 0.85, "LHCb simulation")
# # mg.GetYaxis().SetRangeUser(0, 0.4)
# if histo == "eta":
# mg.GetYaxis().SetRangeUser(0, 0.4) # mg.GetYaxis().SetRangeUser(0, 0.4)
if histo == "eta":
mg.GetYaxis().SetRangeUser(0, 0.4)
# track_name = names[tracker] + " tracks"
# latex.DrawLatex(0.7, 0.75, track_name)
# canvas.PlaceLegend()
if savepdf:
filestypes = ["pdf"] # , "png", "eps", "C", "ps", "tex"]
for ftype in filestypes:
canvas.SaveAs(
"checks/" + name + "." + ftype,
)
canvas.Write()
# # track_name = names[tracker] + " tracks"
# # latex.DrawLatex(0.7, 0.75, track_name)
# # canvas.PlaceLegend()
# if savepdf:
# filestypes = ["pdf"] # , "png", "eps", "C", "ps", "tex"]
# for ftype in filestypes:
# canvas.SaveAs(
# "checks/" + name + "." + ftype,
# )
# canvas.Write()
outputfile.cd() outputfile.cd()

Loading…
Cancel
Save