Commit 487eb30c authored by Gitlab CI's avatar Gitlab CI Committed by Dorothea Vom Bruch
Browse files
parent 3d43c981
Pipeline #933079 passed with stage
in 1 minute and 18 seconds
......@@ -44,7 +44,7 @@ def setLHCbStyle():
# set the paper & margin sizes
lhcbStyle.SetPaperSize(20, 26)
lhcbStyle.SetPadTopMargin(0.05)
lhcbStyle.SetPadRightMargin(0.10) # increase for colz plots
lhcbStyle.SetPadRightMargin(0.10) # increase for colz plots
lhcbStyle.SetPadBottomMargin(0.16)
lhcbStyle.SetPadLeftMargin(0.14)
......
......@@ -115,7 +115,8 @@ def place_legend(canvas,
# As a fallback, use the default values, taken from TCanvas::BuildLegend
return canvas.BuildLegend(0.5, 0.67, 0.88, 0.88, header, option)
def find_place(canvas, default = 3, x1=None, y1=None, x2=None, y2=None):
def find_place(canvas, default=3, x1=None, y1=None, x2=None, y2=None):
# Make sure all objects are correctly registered
canvas.Update()
......@@ -134,7 +135,8 @@ def find_place(canvas, default = 3, x1=None, y1=None, x2=None, y2=None):
continue
return place
return PLACES[default] # fallback solution
return PLACES[default] # fallback solution
# Monkey patch ROOT objects to make it all work
ROOT.THStack.__iter__ = lambda self: iter(self.GetHists())
......
......@@ -104,33 +104,38 @@ for category in muonCategories:
# draw variable distribution in same canvas
norm = 0.9 / numerator.GetMaximum()
numerator.Scale(norm)
numerator.SetTitle( efficiencyHistoDict[histo]["title"]+ " distribution")
numerator.SetTitle(efficiencyHistoDict[histo]["title"] +
" distribution")
numerator.SetFillColorAlpha(ROOT.kBlack, 0.2)
numerator.SetLineColor(ROOT.kWhite)
numerator.Draw("hist bar same")
if ( category == "matched_isMuon"):
if (category == "matched_isMuon"):
place = find_place(canvas, 3)
else:
place = PLACES[0]
#place = find_place(canvas, 0)
legend = TLegend(place[0], place[1], place[2], place[3])
legend.AddEntry(g_efficiency, muonCatDict[category]["title"], "ep")
legend.AddEntry(numerator, efficiencyHistoDict[histo]["title"]+ " distribution","f")
legend.AddEntry(numerator,
efficiencyHistoDict[histo]["title"] + " distribution",
"f")
legend.SetFillColorAlpha(ROOT.kWhite, 0.)
legend.Draw("same")
canvas.Write()
cleantitle = muonCatDict[category]["title"].replace(
" ", "").replace(",", "_").replace("<", "_")
canvas.SaveAs("../../../plotsfornote/muonID_isMuon_" + histo + "_"+ cleantitle + ".pdf")
cleantitle = muonCatDict[category]["title"].replace(" ", "").replace(
",", "_").replace("<", "_")
canvas.SaveAs("../../../plotsfornote/muonID_isMuon_" + histo + "_" +
cleantitle + ".pdf")
# ghost histos
for histo in ghostHistos:
title = "muon ID in ghost tracks vs. " + histo
canvas = ROOT.TCanvas(title, title)
ROOT.gPad.SetTicks()
numeratorName = "Forward/ghost_isMuon_" + efficiencyHistoDict[histo]["variable"] + "_reconstructed"
numeratorName = "Forward/ghost_isMuon_" + efficiencyHistoDict[histo][
"variable"] + "_reconstructed"
denominatorName = "Forward/" + histo + "_Ghosts"
print("Opening " + numeratorName)
print("Opening " + denominatorName)
......@@ -152,7 +157,7 @@ for histo in ghostHistos:
# draw variable distribution in same canvas
norm = 0.9 / numerator.GetMaximum()
numerator.Scale(norm)
numerator.SetTitle( efficiencyHistoDict[histo]["title"]+ " distribution")
numerator.SetTitle(efficiencyHistoDict[histo]["title"] + " distribution")
numerator.SetFillColorAlpha(ROOT.kBlack, 0.2)
numerator.SetLineColor(ROOT.kWhite)
numerator.Draw("hist bar same")
......@@ -160,11 +165,13 @@ for histo in ghostHistos:
place = find_place(canvas, 0)
legend = TLegend(place[0], place[1], place[2], place[3])
legend.AddEntry(g_efficiency, "muon ID in ghost tracks", "ep")
legend.AddEntry(numerator, efficiencyHistoDict[histo]["title"]+ " distribution","f")
legend.AddEntry(numerator,
efficiencyHistoDict[histo]["title"] + " distribution", "f")
legend.Draw("same")
canvas.Write()
canvas.SaveAs("../../../plotsfornote/muonID_isMuon_ghosts_" + histo + ".pdf")
canvas.SaveAs("../../../plotsfornote/muonID_isMuon_ghosts_" + histo +
".pdf")
outputfile.Write()
outputfile.Close()
......
......@@ -159,7 +159,8 @@ for tracker in trackers:
variable.SetTitle(efficiencyHistoDict[histo]["title"] +
" distribution, not electrons")
else:
variable.SetTitle( efficiencyHistoDict[histo]["title"]+ " distribution")
variable.SetTitle(efficiencyHistoDict[histo]["title"] +
" distribution")
variable.SetLineColor(ROOT.kWhite)
variable.SetFillColorAlpha(ROOT.kBlack, 0.2)
variable.Draw("hist bar same")
......@@ -173,7 +174,8 @@ for tracker in trackers:
variable_electrons.Add(infile.Get(variableHistoName))
norm = 0.9 / variable_electrons.GetMaximum()
variable_electrons.Scale(norm)
variable_electrons.SetTitle( efficiencyHistoDict[histo]["title"]+ " distribution, electrons")
variable_electrons.SetTitle(efficiencyHistoDict[histo]["title"]
+ " distribution, electrons")
variable_electrons.SetLineColor(ROOT.kWhite)
variable_electrons.SetFillColorAlpha(ROOT.kAzure - 3, 0.2)
variable_electrons.Draw("hist bar same")
......@@ -245,7 +247,8 @@ for tracker in trackers:
print("norm:")
print(norm)
numerator.Scale(norm)
numerator.SetTitle( efficiencyHistoDict[histo]["title"]+ " distribution")
numerator.SetTitle(efficiencyHistoDict[histo]["title"] +
" distribution")
numerator.SetFillColorAlpha(ROOT.kBlack, 0.2)
numerator.SetLineColor(ROOT.kWhite)
numerator.Draw("hist bar same")
......@@ -253,7 +256,9 @@ for tracker in trackers:
place = find_place(canvas)
legend = TLegend(place[0], place[1], place[2], place[3])
legend.AddEntry(g_efficiency, "ghost rate", "ep")
legend.AddEntry(numerator, efficiencyHistoDict[histo]["title"]+ " distribution","f")
legend.AddEntry(numerator,
efficiencyHistoDict[histo]["title"] + " distribution",
"f")
legend.Draw("same")
canvas.Write()
......
......@@ -104,7 +104,6 @@ def getResolutionInSlices(histo2D, var, var_dict):
#gr.Write()
#name = "dp_vs_p_rms"
#title = "dp vs p, histogram RMS"
#canvas = ROOT.TCanvas(name, title)
......@@ -132,7 +131,8 @@ def getResolutionInSlices(histo2D, var, var_dict):
#histo1D.Draw("hist bar same")
canvas.Write()
canvas.SaveAs("../../../plotsfornote/" + tracker + "MomResVs" + var + ".pdf")
canvas.SaveAs("../../../plotsfornote/" + tracker + "MomResVs" + var +
".pdf")
histo1D.Fit("gaus")
sigma_p = histo1D.GetFunction("gaus").GetParameter(2)
......@@ -140,6 +140,7 @@ def getResolutionInSlices(histo2D, var, var_dict):
print('{:s}: sigma p = {:f} +/- {:f}'.format(tracker, sigma_p,
delta_sigma_p))
f = ROOT.TFile.Open("../../../output/PrCheckerPlots.root", "read")
outputfile = ROOT.TFile("../../../plotsfornote_root/momentum_resolution.root",
"recreate")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment