Checker
This commit is contained in:
parent
6d368da610
commit
12df93d856
Binary file not shown.
@ -1,20 +1,15 @@
|
||||
# flake8: noqa
|
||||
|
||||
|
||||
"""
|
||||
This set of options is used for reconstruction development purposes,
|
||||
and assumes that the input contains MCHits (i.e. is of `Exended`
|
||||
DST/digi type).
|
||||
author: Furkan Cetin
|
||||
date: 10/2023
|
||||
Moore/run gaudirun.py /work/cetin/LHCb/reco_tuner/moore_options/get_resolution_and_eff_data.py
|
||||
"""
|
||||
|
||||
from Moore import options, run_reconstruction
|
||||
|
||||
from Moore.config import Reconstruction
|
||||
from PyConf.Algorithms import PrKalmanFilter
|
||||
from PyConf.Tools import TrackMasterExtrapolator
|
||||
from PyConf.Algorithms import PrKalmanFilter, PrMatchNN, fromPrMatchTracksV1Tracks
|
||||
from PyConf.Tools import TrackMasterExtrapolator, PrMCDebugMatchToolNN
|
||||
from PyConf.application import make_data_with_FetchDataFromFile
|
||||
from RecoConf.data_from_file import mc_unpackers
|
||||
|
||||
|
||||
import glob
|
||||
|
||||
from RecoConf.mc_checking import (
|
||||
@ -26,7 +21,7 @@ from RecoConf.mc_checking import (
|
||||
make_links_tracks_mcparticles,
|
||||
)
|
||||
from RecoConf.core_algorithms import make_unique_id_generator
|
||||
from RecoConf.hlt2_tracking import make_hlt2_tracks
|
||||
from RecoConf.hlt2_tracking import make_hlt2_tracks, get_global_ut_hits_tool
|
||||
from RecoConf.hlt1_tracking import (
|
||||
make_VeloClusterTrackingSIMD_hits,
|
||||
make_PrStorePrUTHits_hits,
|
||||
@ -34,11 +29,23 @@ from RecoConf.hlt1_tracking import (
|
||||
get_global_materiallocator,
|
||||
)
|
||||
|
||||
"""
|
||||
This set of options is used for reconstruction development purposes,
|
||||
and assumes that the input contains MCHits (i.e. is of `Exended`
|
||||
DST/digi type).
|
||||
|
||||
author: Furkan Cetin
|
||||
date: 10/2023
|
||||
|
||||
Moore/run gaudirun.py /work/cetin/LHCb/reco_tuner/moore_options/get_resolution_and_eff_data.py
|
||||
"""
|
||||
|
||||
|
||||
decay = "test"
|
||||
|
||||
options.evt_max = -1
|
||||
|
||||
options.ntuple_file = f"data/resolutions_and_effs_{decay}_thesis.root"
|
||||
options.ntuple_file = f"data/resolutions_and_effs_{decay}_only_electrons_as_seed.root"
|
||||
options.input_type = "ROOT"
|
||||
|
||||
|
||||
@ -63,6 +70,7 @@ options.output_level = 3
|
||||
|
||||
def run_tracking_resolution():
|
||||
tracks = make_hlt2_tracks(light_reco=True, fast_reco=False, use_pr_kf=True)
|
||||
|
||||
fitted_forward_tracks = PrKalmanFilter(
|
||||
Input=tracks["Forward"]["Pr"],
|
||||
MaxChi2=2.8,
|
||||
@ -77,24 +85,60 @@ def run_tracking_resolution():
|
||||
).OutputTracks
|
||||
|
||||
links_to_lhcbids = make_links_lhcbids_mcparticles_tracking_system()
|
||||
links_to_forward = make_links_tracks_mcparticles(
|
||||
InputTracks=tracks["Forward"],
|
||||
LinksToLHCbIDs=links_to_lhcbids,
|
||||
)
|
||||
links_to_match = make_links_tracks_mcparticles(
|
||||
InputTracks=tracks["Match"],
|
||||
LinksToLHCbIDs=links_to_lhcbids,
|
||||
)
|
||||
|
||||
links_to_best = make_links_tracks_mcparticles(
|
||||
InputTracks=tracks["BestLong"],
|
||||
LinksToLHCbIDs=links_to_lhcbids,
|
||||
)
|
||||
|
||||
links_to_forward = make_links_tracks_mcparticles(
|
||||
InputTracks=tracks["Forward"],
|
||||
LinksToLHCbIDs=links_to_lhcbids,
|
||||
)
|
||||
|
||||
links_to_velo = make_links_tracks_mcparticles(
|
||||
InputTracks=tracks["Velo"],
|
||||
LinksToLHCbIDs=links_to_lhcbids,
|
||||
)
|
||||
|
||||
links_to_seed = make_links_tracks_mcparticles(
|
||||
InputTracks=tracks["Seed"],
|
||||
LinksToLHCbIDs=links_to_lhcbids,
|
||||
)
|
||||
|
||||
res_checker_forward = check_track_resolution(tracks["Forward"], suffix="Forward")
|
||||
match_debug = PrMatchNN(
|
||||
VeloInput=tracks["Velo"]["Pr"],
|
||||
SeedInput=tracks["Seed"]["Pr"],
|
||||
MatchDebugToolName=PrMCDebugMatchToolNN(
|
||||
VeloTracks=tracks["Velo"]["v1"],
|
||||
SeedTracks=tracks["Seed"]["v1"],
|
||||
VeloTrackLinks=links_to_velo,
|
||||
SeedTrackLinks=links_to_seed,
|
||||
TrackInfo=make_data_with_FetchDataFromFile(
|
||||
"/Event/MC/TrackInfo", "LHCb::MCProperty"
|
||||
),
|
||||
MCParticles=mc_unpackers()["MCParticles"],
|
||||
),
|
||||
AddUTHitsToolName=get_global_ut_hits_tool(enable=True),
|
||||
).MatchOutput
|
||||
|
||||
match_tracks = {}
|
||||
match_tracks["Pr"] = match_debug
|
||||
match_tracks["v1"] = fromPrMatchTracksV1Tracks(
|
||||
InputTracksLocation=match_debug,
|
||||
VeloTracksLocation=tracks["Velo"]["v1"],
|
||||
SeedTracksLocation=tracks["Seed"]["v1"],
|
||||
).OutputTracksLocation
|
||||
|
||||
links_to_match = make_links_tracks_mcparticles(
|
||||
InputTracks=match_tracks,
|
||||
LinksToLHCbIDs=links_to_lhcbids,
|
||||
)
|
||||
|
||||
res_checker_forward = check_track_resolution(
|
||||
tracks["Forward"],
|
||||
suffix="Forward",
|
||||
)
|
||||
res_checker_best_long = check_track_resolution(
|
||||
tracks["BestLong"],
|
||||
suffix="BestLong",
|
||||
@ -118,7 +162,7 @@ def run_tracking_resolution():
|
||||
)
|
||||
eff_checker_match = check_tracking_efficiency(
|
||||
"Match",
|
||||
tracks["Match"],
|
||||
match_tracks,
|
||||
links_to_match,
|
||||
links_to_lhcbids,
|
||||
get_mc_categories("Match"),
|
@ -83,14 +83,16 @@ def standalone_hlt2_fastest_reco():
|
||||
# filter with calo clusters
|
||||
calo_matched_seeds = PrFilterTracks2CaloClusters(
|
||||
Relation=tcmatches["Ttrack"],
|
||||
Cut=F.FILTER((F.MIN_ELEMENT_NOTZERO @ F.GET(0) @ F.WEIGHT) < 20),
|
||||
Cut=F.FILTER((F.MIN_ELEMENT_NOTZERO @ F.FORWARDARG0 @ F.WEIGHT) < 20),
|
||||
).Output
|
||||
|
||||
# corrections on track (bit better for elec?)
|
||||
# Cut=F.FILTER(F.ALL) ).Output
|
||||
electron_matched_seeds = PrFilterTracks2ElectronMatch(
|
||||
Relation=tcmatches_e["Ttrack"]["ElectronMatch"],
|
||||
Cut=F.FILTER(F.MIN_ELEMENT_NOTZERO @ F.GET(0) @ F.WEIGHT < 20),
|
||||
Cut=F.FILTER(F.MIN_ELEMENT_NOTZERO @ F.FORWARDARG0 @ F.WEIGHT < 20),
|
||||
).Output
|
||||
|
||||
# should be best; shape of shower etc; E/p statt chi2; DLL even better? GET(1)
|
||||
# Cut=F.FILTER(F.ALL)).Output
|
||||
shower_matched_seeds = PrFilterTracks2ElectronShower(
|
||||
|
@ -1,15 +1,20 @@
|
||||
# flake8: noqa
|
||||
|
||||
|
||||
"""
|
||||
This set of options is used for reconstruction development purposes,
|
||||
and assumes that the input contains MCHits (i.e. is of `Exended`
|
||||
DST/digi type).
|
||||
author: Furkan Cetin
|
||||
date: 10/2023
|
||||
Moore/run gaudirun.py /work/cetin/LHCb/reco_tuner/moore_options/get_resolution_and_eff_data.py
|
||||
"""
|
||||
|
||||
from Moore import options, run_reconstruction
|
||||
|
||||
from Moore.config import Reconstruction
|
||||
from PyConf.Algorithms import PrKalmanFilter, PrMatchNN, fromPrMatchTracksV1Tracks
|
||||
from PyConf.Tools import TrackMasterExtrapolator, PrMCDebugMatchToolNN
|
||||
from PyConf.application import make_data_with_FetchDataFromFile
|
||||
from RecoConf.data_from_file import mc_unpackers
|
||||
|
||||
|
||||
from PyConf.Algorithms import PrKalmanFilter
|
||||
from PyConf.Tools import TrackMasterExtrapolator
|
||||
import glob
|
||||
|
||||
from RecoConf.mc_checking import (
|
||||
@ -21,7 +26,7 @@ from RecoConf.mc_checking import (
|
||||
make_links_tracks_mcparticles,
|
||||
)
|
||||
from RecoConf.core_algorithms import make_unique_id_generator
|
||||
from RecoConf.hlt2_tracking import make_hlt2_tracks, get_global_ut_hits_tool
|
||||
from RecoConf.hlt2_tracking import make_hlt2_tracks
|
||||
from RecoConf.hlt1_tracking import (
|
||||
make_VeloClusterTrackingSIMD_hits,
|
||||
make_PrStorePrUTHits_hits,
|
||||
@ -29,23 +34,11 @@ from RecoConf.hlt1_tracking import (
|
||||
get_global_materiallocator,
|
||||
)
|
||||
|
||||
"""
|
||||
This set of options is used for reconstruction development purposes,
|
||||
and assumes that the input contains MCHits (i.e. is of `Exended`
|
||||
DST/digi type).
|
||||
|
||||
author: Furkan Cetin
|
||||
date: 10/2023
|
||||
|
||||
Moore/run gaudirun.py /work/cetin/LHCb/reco_tuner/moore_options/get_resolution_and_eff_data.py
|
||||
"""
|
||||
|
||||
|
||||
decay = "test"
|
||||
decay = "B"
|
||||
|
||||
options.evt_max = -1
|
||||
|
||||
options.ntuple_file = f"data/resolutions_and_effs_{decay}_only_electrons_as_seed.root"
|
||||
options.ntuple_file = f"data/resolutions_and_effs_{decay}_thesis.root"
|
||||
options.input_type = "ROOT"
|
||||
|
||||
|
||||
@ -70,7 +63,6 @@ options.output_level = 3
|
||||
|
||||
def run_tracking_resolution():
|
||||
tracks = make_hlt2_tracks(light_reco=True, fast_reco=False, use_pr_kf=True)
|
||||
|
||||
fitted_forward_tracks = PrKalmanFilter(
|
||||
Input=tracks["Forward"]["Pr"],
|
||||
MaxChi2=2.8,
|
||||
@ -85,60 +77,24 @@ def run_tracking_resolution():
|
||||
).OutputTracks
|
||||
|
||||
links_to_lhcbids = make_links_lhcbids_mcparticles_tracking_system()
|
||||
|
||||
links_to_best = make_links_tracks_mcparticles(
|
||||
InputTracks=tracks["BestLong"],
|
||||
LinksToLHCbIDs=links_to_lhcbids,
|
||||
)
|
||||
|
||||
links_to_forward = make_links_tracks_mcparticles(
|
||||
InputTracks=tracks["Forward"],
|
||||
LinksToLHCbIDs=links_to_lhcbids,
|
||||
)
|
||||
|
||||
links_to_velo = make_links_tracks_mcparticles(
|
||||
InputTracks=tracks["Velo"],
|
||||
links_to_match = make_links_tracks_mcparticles(
|
||||
InputTracks=tracks["Match"],
|
||||
LinksToLHCbIDs=links_to_lhcbids,
|
||||
)
|
||||
links_to_best = make_links_tracks_mcparticles(
|
||||
InputTracks=tracks["BestLong"],
|
||||
LinksToLHCbIDs=links_to_lhcbids,
|
||||
)
|
||||
|
||||
links_to_seed = make_links_tracks_mcparticles(
|
||||
InputTracks=tracks["Seed"],
|
||||
LinksToLHCbIDs=links_to_lhcbids,
|
||||
)
|
||||
|
||||
match_debug = PrMatchNN(
|
||||
VeloInput=tracks["Velo"]["Pr"],
|
||||
SeedInput=tracks["Seed"]["Pr"],
|
||||
MatchDebugToolName=PrMCDebugMatchToolNN(
|
||||
VeloTracks=tracks["Velo"]["v1"],
|
||||
SeedTracks=tracks["Seed"]["v1"],
|
||||
VeloTrackLinks=links_to_velo,
|
||||
SeedTrackLinks=links_to_seed,
|
||||
TrackInfo=make_data_with_FetchDataFromFile(
|
||||
"/Event/MC/TrackInfo", "LHCb::MCProperty"
|
||||
),
|
||||
MCParticles=mc_unpackers()["MCParticles"],
|
||||
),
|
||||
AddUTHitsToolName=get_global_ut_hits_tool(enable=True),
|
||||
).MatchOutput
|
||||
|
||||
match_tracks = {}
|
||||
match_tracks["Pr"] = match_debug
|
||||
match_tracks["v1"] = fromPrMatchTracksV1Tracks(
|
||||
InputTracksLocation=match_debug,
|
||||
VeloTracksLocation=tracks["Velo"]["v1"],
|
||||
SeedTracksLocation=tracks["Seed"]["v1"],
|
||||
).OutputTracksLocation
|
||||
|
||||
links_to_match = make_links_tracks_mcparticles(
|
||||
InputTracks=match_tracks,
|
||||
LinksToLHCbIDs=links_to_lhcbids,
|
||||
)
|
||||
|
||||
res_checker_forward = check_track_resolution(
|
||||
tracks["Forward"],
|
||||
suffix="Forward",
|
||||
)
|
||||
res_checker_forward = check_track_resolution(tracks["Forward"], suffix="Forward")
|
||||
res_checker_best_long = check_track_resolution(
|
||||
tracks["BestLong"],
|
||||
suffix="BestLong",
|
||||
@ -162,7 +118,7 @@ def run_tracking_resolution():
|
||||
)
|
||||
eff_checker_match = check_tracking_efficiency(
|
||||
"Match",
|
||||
match_tracks,
|
||||
tracks["Match"],
|
||||
links_to_match,
|
||||
links_to_lhcbids,
|
||||
get_mc_categories("Match"),
|
||||
|
@ -9,6 +9,9 @@ python scripts/MyPrCheckerEfficiency.py --filename data/resolutions_and_effs_B_n
|
||||
|
||||
python scripts/MyPrCheckerEfficiency.py --filename data/resolutions_and_effs_D_electron_weights.root --outfile data_results/PrCheckerDElectron.root
|
||||
|
||||
python scripts/PrCheckerEfficiency.py --filename data/resolutions_and_effs_B_thesis.root
|
||||
--outfile data_results/PrCheckerTestThesis.root --label particle --plot-velo --plot-velo-only --trackers Match Seed --savepdf
|
||||
|
||||
"""
|
||||
|
||||
import argparse
|
||||
|
@ -9,6 +9,9 @@ python scripts/MyPrCheckerEfficiency.py --filename data/resolutions_and_effs_B_n
|
||||
|
||||
python scripts/MyPrCheckerEfficiency.py --filename data/resolutions_and_effs_D_electron_weights.root --outfile data_results/PrCheckerDElectron.root
|
||||
|
||||
python scripts/PrCheckerEfficiency.py --filename data/resolutions_and_effs_B_thesis.root
|
||||
--outfile data_results/PrCheckerTestThesis.root --label particle --plot-velo --plot-velo-only --trackers Match Seed --savepdf
|
||||
|
||||
"""
|
||||
|
||||
import argparse
|
||||
@ -432,9 +435,13 @@ def PrCheckerEfficiency(
|
||||
canvas.SetRightMargin(0.1)
|
||||
mg = TMultiGraph()
|
||||
for i, lab in enumerate(label):
|
||||
if not plot_electrons_only: # and not plot_velo_only:
|
||||
mg.Add(eff[lab])
|
||||
set_style(eff[lab], colors[i], markers[i], styles[i])
|
||||
if (
|
||||
categories[tracker][cut]["plotEndVelo"]
|
||||
and plot_velo
|
||||
and (histo == "p" or histo == "pt")
|
||||
): # and not plot_velo_only:
|
||||
mg.Add(eff_velo[lab])
|
||||
set_style(eff_velo[lab], colors[i], markers[i], styles[i])
|
||||
if categories[tracker][cut]["plotElectrons"] and plot_electrons:
|
||||
if (not plot_velo_only) or (
|
||||
histo == "phi" or histo == "eta" or histo == "nPV"
|
||||
@ -446,18 +453,6 @@ def PrCheckerEfficiency(
|
||||
elec_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],
|
||||
elec_colors[i], # elec_colors[i + 1],
|
||||
elec_markers[i],
|
||||
styles[i],
|
||||
)
|
||||
|
||||
mg.Draw("AP")
|
||||
mg.GetYaxis().SetRangeUser(0, 1.05)
|
||||
@ -477,7 +472,7 @@ def PrCheckerEfficiency(
|
||||
mg.GetYaxis().SetTitleOffset(1.1)
|
||||
mg.GetXaxis().SetRangeUser(*efficiencyHistoDict[histo]["range"])
|
||||
mg.GetXaxis().SetNdivisions(10, 5, 0)
|
||||
mygray = kGray
|
||||
mygray = 18
|
||||
myblue = kBlue - 10
|
||||
mypurple = kMagenta - 10
|
||||
for i, lab in enumerate(label):
|
||||
@ -498,39 +493,23 @@ def PrCheckerEfficiency(
|
||||
hist_velo[lab].Scale(scale)
|
||||
|
||||
if i == 0:
|
||||
if not plot_electrons_only: # and not plot_velo_only:
|
||||
set_style(hist_den[lab], mygray, markers[i], styles[i])
|
||||
if (
|
||||
categories[tracker][cut]["plotEndVelo"]
|
||||
and plot_velo
|
||||
and (histo == "p" or histo == "pt")
|
||||
):
|
||||
set_style(hist_velo[lab], mygray, markers[i], styles[i])
|
||||
gStyle.SetPalette(2, array("i", [mygray - 1, myblue + 1]))
|
||||
hist_den[lab].Draw("HIST PLC SAME")
|
||||
hist_velo[lab].Draw("HIST PLC SAME")
|
||||
if categories[tracker][cut]["plotElectrons"] and plot_electrons:
|
||||
if not plot_velo_only or (
|
||||
histo == "phi" or histo == "eta" or histo == "nPV"
|
||||
):
|
||||
set_style(
|
||||
hist_elec[lab],
|
||||
myblue,
|
||||
elec_markers[i],
|
||||
styles[i],
|
||||
hist_elec[lab], myblue, elec_markers[i], styles[i]
|
||||
)
|
||||
# hist_elec[lab].SetLineColor(kBlue - 5)
|
||||
hist_elec[lab].SetFillColorAlpha(myblue, 0.5)
|
||||
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],
|
||||
myblue,
|
||||
elec_markers[i],
|
||||
styles[i],
|
||||
)
|
||||
# gStyle.SetPalette(
|
||||
# 2, array("i", [mygray - 1, myblue + 1])
|
||||
# )
|
||||
hist_velo[lab].SetFillColorAlpha(myblue, 0.5)
|
||||
hist_velo[lab].Draw("HIST PLC SAME")
|
||||
|
||||
# else:
|
||||
# print(
|
||||
@ -562,19 +541,18 @@ def PrCheckerEfficiency(
|
||||
legend.SetTextSize(0.04)
|
||||
legend.Draw()
|
||||
for lab in label:
|
||||
if not plot_electrons_only: # and not plot_velo_only:
|
||||
eff[lab].Draw("P SAME")
|
||||
if (
|
||||
categories[tracker][cut]["plotEndVelo"]
|
||||
and plot_velo
|
||||
and (histo == "p" or histo == "pt")
|
||||
):
|
||||
eff_velo[lab].Draw("P SAME")
|
||||
if categories[tracker][cut]["plotElectrons"] and plot_electrons:
|
||||
if not plot_velo_only or (
|
||||
histo == "phi" or histo == "eta" or histo == "nPV"
|
||||
):
|
||||
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
|
Loading…
Reference in New Issue
Block a user