ResidualMatch rework

This commit is contained in:
cetin 2024-01-08 10:27:33 +01:00
parent 6a286bfec7
commit 9ccedee74a
2 changed files with 77 additions and 77 deletions

View File

@ -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 # # calculate ghost rate
print("\ncalculate ghost rate: ") # print("\ncalculate ghost rate: ")
for histo in compareGhostHisto: # [Match, Seed, ...] # for histo in compareGhostHisto: # [Match, Seed, ...]
cut = compareDict[jcut][tracker] # cut = compareDict[jcut][tracker]
canvastitle = "ghost_rate_vs_" + histo + "_" + jcut # canvastitle = "ghost_rate_vs_" + histo + "_" + jcut
name = "ghost_rate_vs_" + histo + "_" + jcut # name = "ghost_rate_vs_" + histo + "_" + jcut
canvas = TCanvas(name, canvastitle) # canvas = TCanvas(name, canvastitle)
canvas.SetRightMargin(0.1) # canvas.SetRightMargin(0.1)
mg = TMultiGraph() # mg = TMultiGraph()
jitr = 0 # jitr = 0
for tracker in trackers: # for tracker in trackers:
if tracker == "Seed": # if tracker == "Seed":
continue # continue
folder = folders[tracker]["folder"] # folder = folders[tracker]["folder"]
jcolor = compareColors[tracker] # jcolor = compareColors[tracker]
gPad.SetTicks() # gPad.SetTicks()
histoName = ( # histoName = (
"Track/" # "Track/"
+ folder # + folder
+ tracker # + tracker
+ "/" # + "/"
+ ghostHistoDict[histo]["variable"] # + ghostHistoDict[histo]["variable"]
) # )
ghost = {} # ghost = {}
hist_den = {} # hist_den = {}
ghost = get_compare_ghost(ghost, hist_den, tf, histoName, label) # ghost = get_compare_ghost(ghost, hist_den, tf, histoName, label)
for i, lab in enumerate(label): # for i, lab in enumerate(label):
mg.Add(ghost[lab]) # mg.Add(ghost[lab])
set_style( # set_style(
ghost[lab], colors[jcolor + jitr], markers[2 * i], styles[i] # ghost[lab], colors[jcolor + jitr], markers[2 * i], styles[i]
) # )
jitr += 1 # jitr += 1
xtitle = ghostHistoDict[histo]["xTitle"] # xtitle = ghostHistoDict[histo]["xTitle"]
mg.GetXaxis().SetTitle(xtitle) # mg.GetXaxis().SetTitle(xtitle)
mg.GetYaxis().SetTitle("Fraction of fake tracks") # mg.GetYaxis().SetTitle("Fraction of fake tracks")
mg.Draw("ap") # mg.Draw("ap")
mg.GetXaxis().SetTitleSize(0.06) # mg.GetXaxis().SetTitleSize(0.06)
mg.GetYaxis().SetTitleSize(0.06) # mg.GetYaxis().SetTitleSize(0.06)
mg.GetYaxis().SetTitleOffset(1.1) # mg.GetYaxis().SetTitleOffset(1.1)
mg.GetXaxis().SetRangeUser(*efficiencyHistoDict[histo]["range"]) # mg.GetXaxis().SetRangeUser(*efficiencyHistoDict[histo]["range"])
mg.GetXaxis().SetNdivisions(10, 5, 0) # mg.GetXaxis().SetNdivisions(10, 5, 0)
# for lab in label: # # for lab in label:
# ghost[lab].Draw("P SAME") # # ghost[lab].Draw("P SAME")
if histo == "p": # if histo == "p":
pos = [0.53, 0.4, 1.00, 0.71] # pos = [0.53, 0.4, 1.00, 0.71]
elif histo == "pt": # elif histo == "pt":
pos = [0.5, 0.4, 0.98, 0.71] # pos = [0.5, 0.4, 0.98, 0.71]
elif histo == "eta": # elif histo == "eta":
pos = [0.35, 0.6, 0.85, 0.9] # pos = [0.35, 0.6, 0.85, 0.9]
elif histo == "phi": # elif histo == "phi":
pos = [0.3, 0.3, 0.9, 0.6] # 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")
# 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": # # track_name = names[tracker] + " tracks"
mg.GetYaxis().SetRangeUser(0, 0.4) # # latex.DrawLatex(0.7, 0.75, track_name)
# track_name = names[tracker] + " tracks" # # canvas.PlaceLegend()
# latex.DrawLatex(0.7, 0.75, track_name) # if savepdf:
# canvas.PlaceLegend() # filestypes = ["pdf"] # , "png", "eps", "C", "ps", "tex"]
if savepdf: # for ftype in filestypes:
filestypes = ["pdf"] # , "png", "eps", "C", "ps", "tex"] # canvas.SaveAs(
for ftype in filestypes: # "checks/" + name + "." + ftype,
canvas.SaveAs( # )
"checks/" + name + "." + ftype, # canvas.Write()
)
canvas.Write()
outputfile.cd() outputfile.cd()