Browse Source

EndVelo

main
cetin 8 months ago
parent
commit
bb73083251
  1. BIN
      data_results/PrCheckerBEndVelo.root
  2. 6
      moore_options/get_resolution_and_eff_data.py
  3. 84
      scripts/MyPrCheckerEfficiency.py
  4. 73
      scripts/utils/ConfigHistos.py
  5. 10
      tuner.code-workspace

BIN
data_results/PrCheckerBEndVelo.root

Binary file not shown.

6
moore_options/get_resolution_and_eff_data.py

@ -36,9 +36,9 @@ from RecoConf.hlt1_tracking import (
get_global_materiallocator, get_global_materiallocator,
) )
decay = "B"
decay = "test"
options.evt_max = -1
options.evt_max = 1
options.ntuple_file = f"data/resolutions_and_effs_{decay}_endVelo_idealstateP.root" options.ntuple_file = f"data/resolutions_and_effs_{decay}_endVelo_idealstateP.root"
options.input_type = "ROOT" options.input_type = "ROOT"
@ -56,7 +56,7 @@ elif decay == "test":
options.dddb_tag = "dddb-20210617" options.dddb_tag = "dddb-20210617"
options.conddb_tag = "sim-20210617-vc-md100" options.conddb_tag = "sim-20210617-vc-md100"
options.simulation = True options.simulation = True
options.output_level = 3
options.output_level = 2
def run_tracking_resolution(): def run_tracking_resolution():

84
scripts/MyPrCheckerEfficiency.py

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

73
scripts/utils/ConfigHistos.py

@ -284,6 +284,15 @@ def categoriesDict():
"Electrons" "Electrons"
] = "10_long_fromB_electrons_P>3GeV_Pt>0.5GeV" ] = "10_long_fromB_electrons_P>3GeV_Pt>0.5GeV"
basedict["Forward"]["01_long"]["EndVelo"] = "07_long_electrons_EndVelo"
basedict["Forward"]["05_long_fromB"]["EndVelo"] = "08_long_fromB_electrons_EndVelo"
basedict["Forward"]["06_long_fromB_P>5GeV"][
"EndVelo"
] = "09_long_fromB_electrons_P>5GeV_EndVelo"
basedict["Forward"]["10_long_fromB_P>3GeV_Pt>0.5GeV"][
"EndVelo"
] = "10_long_fromB_electrons_P>3GeV_Pt>0.5GeV_EndVelo"
basedict["Forward"]["01_long"]["title"] = "Long, 2 <#eta < 5" basedict["Forward"]["01_long"]["title"] = "Long, 2 <#eta < 5"
basedict["Forward"]["02_long_P>5GeV"]["title"] = "Long, p>5GeV, 2 <#eta < 5" basedict["Forward"]["02_long_P>5GeV"]["title"] = "Long, p>5GeV, 2 <#eta < 5"
basedict["Forward"]["03_long_strange"]["title"] = "Long, from strange, 2 <#eta < 5" basedict["Forward"]["03_long_strange"]["title"] = "Long, from strange, 2 <#eta < 5"
@ -313,6 +322,15 @@ def categoriesDict():
basedict["Forward"]["10_long_fromB_P>3GeV_Pt>0.5GeV"]["plotElectrons"] = False basedict["Forward"]["10_long_fromB_P>3GeV_Pt>0.5GeV"]["plotElectrons"] = False
basedict["Forward"]["11_UT_long_fromB_P>3GeV_Pt>0.5GeV"]["plotElectrons"] = False basedict["Forward"]["11_UT_long_fromB_P>3GeV_Pt>0.5GeV"]["plotElectrons"] = False
basedict["Forward"]["01_long"]["plotEndVelo"] = True
basedict["Forward"]["02_long_P>5GeV"]["plotEndVelo"] = False
basedict["Forward"]["03_long_strange"]["plotEndVelo"] = False
basedict["Forward"]["04_long_strange_P>5GeV"]["plotEndVelo"] = False
basedict["Forward"]["05_long_fromB"]["plotEndVelo"] = True
basedict["Forward"]["06_long_fromB_P>5GeV"]["plotEndVelo"] = True
basedict["Forward"]["10_long_fromB_P>3GeV_Pt>0.5GeV"]["plotEndVelo"] = False
basedict["Forward"]["11_UT_long_fromB_P>3GeV_Pt>0.5GeV"]["plotEndVelo"] = False
# MUONMATCH # MUONMATCH
basedict["MuonMatch"]["01_long"]["title"] = "Long, forward track, 2 <#eta< 5" basedict["MuonMatch"]["01_long"]["title"] = "Long, forward track, 2 <#eta< 5"
basedict["MuonMatch"]["02_long_muon"][ basedict["MuonMatch"]["02_long_muon"][
@ -332,6 +350,15 @@ def categoriesDict():
"Electrons" "Electrons"
] = "10_long_fromB_electrons_P>3GeV_Pt>0.5GeV" ] = "10_long_fromB_electrons_P>3GeV_Pt>0.5GeV"
basedict["Match"]["01_long"]["EndVelo"] = "07_long_electrons_EndVelo"
basedict["Match"]["05_long_fromB"]["EndVelo"] = "08_long_fromB_electrons_EndVelo"
basedict["Match"]["06_long_fromB_P>5GeV"][
"EndVelo"
] = "09_long_fromB_electrons_P>5GeV_EndVelo"
basedict["Match"]["10_long_fromB_P>3GeV_Pt>0.5GeV"][
"EndVelo"
] = "10_long_fromB_electrons_P>3GeV_Pt>0.5GeV_EndVelo"
basedict["Match"]["01_long"]["title"] = "Long, 2 <#eta < 5" basedict["Match"]["01_long"]["title"] = "Long, 2 <#eta < 5"
basedict["Match"]["02_long_P>5GeV"]["title"] = "Long, p>5GeV, 2 <#eta < 5" basedict["Match"]["02_long_P>5GeV"]["title"] = "Long, p>5GeV, 2 <#eta < 5"
basedict["Match"]["03_long_strange"]["title"] = "Long, from strange, 2 <#eta < 5" basedict["Match"]["03_long_strange"]["title"] = "Long, from strange, 2 <#eta < 5"
@ -362,6 +389,16 @@ def categoriesDict():
basedict["Match"]["10_long_strange_P>3GeV_Pt>0.5GeV"]["plotElectrons"] = False basedict["Match"]["10_long_strange_P>3GeV_Pt>0.5GeV"]["plotElectrons"] = False
basedict["Match"]["11_UT_long_fromB_P>3GeV_Pt>0.5GeV"]["plotElectrons"] = False basedict["Match"]["11_UT_long_fromB_P>3GeV_Pt>0.5GeV"]["plotElectrons"] = False
basedict["Match"]["01_long"]["plotEndVelo"] = True
basedict["Match"]["02_long_P>5GeV"]["plotEndVelo"] = False
basedict["Match"]["03_long_strange"]["plotEndVelo"] = False
basedict["Match"]["04_long_strange_P>5GeV"]["plotEndVelo"] = False
basedict["Match"]["05_long_fromB"]["plotEndVelo"] = True
basedict["Match"]["06_long_fromB_P>5GeV"]["plotEndVelo"] = True
basedict["Match"]["10_long_fromB_P>3GeV_Pt>0.5GeV"]["plotEndVelo"] = False
basedict["Match"]["10_long_strange_P>3GeV_Pt>0.5GeV"]["plotEndVelo"] = False
basedict["Match"]["11_UT_long_fromB_P>3GeV_Pt>0.5GeV"]["plotEndVelo"] = False
# MergedMatch # MergedMatch
basedict["MergedMatch"]["01_long"]["Electrons"] = "07_long_electrons" basedict["MergedMatch"]["01_long"]["Electrons"] = "07_long_electrons"
basedict["MergedMatch"]["05_long_fromB"]["Electrons"] = "08_long_fromB_electrons" basedict["MergedMatch"]["05_long_fromB"]["Electrons"] = "08_long_fromB_electrons"
@ -461,6 +498,14 @@ def categoriesDict():
"Electrons" "Electrons"
] = "17_long_fromB_electrons_P>5GeV" ] = "17_long_fromB_electrons_P>5GeV"
basedict["Seed"]["01_hasT"]["EndVelo"] = "13_hasT_electrons_EndVelo"
basedict["Seed"]["02_long"]["EndVelo"] = "14_long_electrons_EndVelo"
basedict["Seed"]["03_long_P>5GeV"]["EndVelo"] = "16_long_electrons_P>5GeV_EndVelo"
basedict["Seed"]["04_long_fromB"]["EndVelo"] = "15_long_fromB_electrons_EndVelo"
basedict["Seed"]["05_long_fromB_P>5GeV"][
"EndVelo"
] = "17_long_fromB_electrons_P>5GeV_EndVelo"
basedict["Seed"]["01_hasT"]["title"] = "T, 2 <#eta < 5" basedict["Seed"]["01_hasT"]["title"] = "T, 2 <#eta < 5"
basedict["Seed"]["02_long"]["title"] = "Long, 2 <#eta < 5" basedict["Seed"]["02_long"]["title"] = "Long, 2 <#eta < 5"
basedict["Seed"]["03_long_P>5GeV"]["title"] = "Long, p>5GeV, 2 <#eta < 5" basedict["Seed"]["03_long_P>5GeV"]["title"] = "Long, p>5GeV, 2 <#eta < 5"
@ -488,6 +533,16 @@ def categoriesDict():
basedict["Seed"]["09_noVelo+UT+T_strange_P>5GeV"]["plotElectrons"] = False basedict["Seed"]["09_noVelo+UT+T_strange_P>5GeV"]["plotElectrons"] = False
basedict["Seed"]["12_noVelo+UT+T_SfromDB_P>5GeV"]["plotElectrons"] = False basedict["Seed"]["12_noVelo+UT+T_SfromDB_P>5GeV"]["plotElectrons"] = False
basedict["Seed"]["01_hasT"]["plotEndVelo"] = False
basedict["Seed"]["02_long"]["plotEndVelo"] = True
basedict["Seed"]["03_long_P>5GeV"]["plotEndVelo"] = False
basedict["Seed"]["04_long_fromB"]["plotEndVelo"] = True
basedict["Seed"]["05_long_fromB_P>5GeV"]["plotEndVelo"] = True
###
basedict["Seed"]["08_noVelo+UT+T_strange"]["plotEndVelo"] = False
basedict["Seed"]["09_noVelo+UT+T_strange_P>5GeV"]["plotEndVelo"] = False
basedict["Seed"]["12_noVelo+UT+T_SfromDB_P>5GeV"]["plotEndVelo"] = False
# DOWNSTREAM # DOWNSTREAM
basedict["Downstream"]["01_UT+T"]["title"] = "UT+T, 2 <#eta < 5" basedict["Downstream"]["01_UT+T"]["title"] = "UT+T, 2 <#eta < 5"
basedict["Downstream"]["05_noVelo+UT+T_strange"][ basedict["Downstream"]["05_noVelo+UT+T_strange"][
@ -545,6 +600,24 @@ def categoriesDict():
"Electrons" "Electrons"
] = "10_long_fromB_electrons_P>3GeV_Pt>0.5GeV" ] = "10_long_fromB_electrons_P>3GeV_Pt>0.5GeV"
basedict["BestLong"]["01_long"]["plotEndVelo"] = True
basedict["BestLong"]["02_long_P>5GeV"]["plotEndVelo"] = False
basedict["BestLong"]["03_long_strange"]["plotEndVelo"] = False
basedict["BestLong"]["04_long_strange_P>5GeV"]["plotEndVelo"] = False
basedict["BestLong"]["05_long_fromB"]["plotEndVelo"] = True
basedict["BestLong"]["06_long_fromB_P>5GeV"]["plotEndVelo"] = True
basedict["BestLong"]["10_long_fromB_P>3GeV_Pt>0.5GeV"]["plotEndVelo"] = False
basedict["BestLong"]["10_long_strange_P>3GeV_Pt>0.5GeV"]["plotEndVelo"] = False
basedict["BestLong"]["01_long"]["EndVelo"] = "07_long_electrons_EndVelo"
basedict["BestLong"]["05_long_fromB"]["EndVelo"] = "08_long_fromB_electrons_EndVelo"
basedict["BestLong"]["06_long_fromB_P>5GeV"][
"EndVelo"
] = "09_long_fromB_electrons_P>5GeV_EndVelo"
basedict["BestLong"]["10_long_fromB_P>3GeV_Pt>0.5GeV"][
"EndVelo"
] = "10_long_fromB_electrons_P>3GeV_Pt>0.5GeV_EndVelo"
# #
# BESTDOWNSTREAM # BESTDOWNSTREAM
basedict["BestDownstream"]["01_UT+T"]["title"] = "UT+T, 2 <#eta < 5" basedict["BestDownstream"]["01_UT+T"]["title"] = "UT+T, 2 <#eta < 5"

10
tuner.code-workspace

@ -24,11 +24,11 @@
"editor.defaultFormatter": "ms-python.black-formatter" "editor.defaultFormatter": "ms-python.black-formatter"
}, },
"python.analysis.extraPaths": [ "python.analysis.extraPaths": [
"/auto/work/cetin/LHCb/stack/Moore/Hlt/Moore/python",
"/auto/work/cetin/LHCb/stack/Moore/Hlt/RecoConf/python",
"/auto/work/cetin/LHCb/stack/DBASE/PRConfig/python",
"/auto/work/cetin/LHCb/stack/LHCb/PyConf/python",
"/auto/work/cetin/LHCb/stack/Gaudi/Gaudi/python"
"/auto/work/cetin/LHCb/lb-stack/Moore/Hlt/Moore/python",
"/auto/work/cetin/LHCb/lb-stack/Moore/Hlt/RecoConf/python",
"/auto/work/cetin/LHCb/lb-stack/DBASE/PRConfig/python",
"/auto/work/cetin/LHCb/lb-stack/LHCb/PyConf/python",
"/auto/work/cetin/LHCb/lb-stack/Gaudi/Gaudi/python"
], ],
"C_Cpp.default.includePath": [ "C_Cpp.default.includePath": [
"/auto/work/cetin/LHCb/stack/Detector/Detector/Magnet/include/**", "/auto/work/cetin/LHCb/stack/Detector/Detector/Magnet/include/**",

Loading…
Cancel
Save