trained e def and e filter
This commit is contained in:
parent
5597683360
commit
b5c6e51864
BIN
data_results/PrCheckerB_dp.root
Normal file
BIN
data_results/PrCheckerB_dp.root
Normal file
Binary file not shown.
@ -185,8 +185,8 @@ if args.matching_weights and not args.residuals:
|
||||
only_electrons=True,
|
||||
filter_seeds=True,
|
||||
outdir="nn_electron_training",
|
||||
n_train_signal=100e3,
|
||||
n_train_bkg=100e3,
|
||||
n_train_signal=150e3,
|
||||
n_train_bkg=150e3,
|
||||
n_test_signal=10e3,
|
||||
n_test_bkg=10e3,
|
||||
)
|
||||
|
@ -53,9 +53,6 @@ elif decay == "both":
|
||||
options.dddb_tag = "dddb-20210617"
|
||||
options.conddb_tag = "sim-20210617-vc-md100"
|
||||
|
||||
|
||||
# options.geometry_version = "run3/trunk" #"run3/before-rich1-geom-update-26052022"
|
||||
# options.conditions_version = "master"
|
||||
options.simulation = True
|
||||
|
||||
|
||||
|
@ -39,7 +39,7 @@ decay = "B"
|
||||
|
||||
options.evt_max = -1
|
||||
|
||||
options.ntuple_file = f"data/resolutions_and_effs_{decay}_thesis.root"
|
||||
options.ntuple_file = f"data/resolutions_and_effs_{decay}_elec_sig_def_bkg.root"
|
||||
options.input_type = "ROOT"
|
||||
|
||||
|
||||
|
168
moore_options/get_resolution_and_eff_data2.py
Normal file
168
moore_options/get_resolution_and_eff_data2.py
Normal file
@ -0,0 +1,168 @@
|
||||
# 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
|
||||
import glob
|
||||
|
||||
from RecoConf.mc_checking import (
|
||||
check_track_resolution,
|
||||
check_tracking_efficiency,
|
||||
get_mc_categories,
|
||||
get_hit_type_mask,
|
||||
make_links_lhcbids_mcparticles_tracking_system,
|
||||
make_links_tracks_mcparticles,
|
||||
get_track_checkers,
|
||||
)
|
||||
from RecoConf.core_algorithms import make_unique_id_generator
|
||||
from RecoConf.hlt2_tracking import make_hlt2_tracks
|
||||
from RecoConf.hlt1_tracking import (
|
||||
make_VeloClusterTrackingSIMD_hits,
|
||||
make_PrStorePrUTHits_hits,
|
||||
make_PrStoreSciFiHits_hits,
|
||||
get_global_materiallocator,
|
||||
)
|
||||
|
||||
decay = "BJpsi"
|
||||
|
||||
options.evt_max = -1
|
||||
|
||||
options.ntuple_file = f"data/resolutions_and_effs_{decay}_elec_sig_def_bkg.root"
|
||||
options.input_type = "ROOT"
|
||||
|
||||
|
||||
if decay == "B":
|
||||
options.input_files = glob.glob("/auto/data/guenther/Bd_Kstee/*.xdigi")
|
||||
elif decay == "BJpsi":
|
||||
options.input_files = glob.glob("/auto/data/guenther/Bd_JpsiKst_ee/*.xdigi")
|
||||
elif decay == "D":
|
||||
options.input_files = glob.glob("/auto/data/guenther/Dst_D0ee/*.xdigi")
|
||||
elif decay == "test2":
|
||||
options.input_files = [
|
||||
"/auto/data/guenther/Bd_JpsiKst_ee/00143565_00000009_1.xdigi"
|
||||
]
|
||||
elif decay == "test":
|
||||
options.input_files = ["/auto/data/guenther/Bd_Kstee/00151673_00000002_1.xdigi"]
|
||||
|
||||
options.dddb_tag = "dddb-20210617"
|
||||
options.conddb_tag = "sim-20210617-vc-md100"
|
||||
options.simulation = True
|
||||
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,
|
||||
MaxChi2PreOutlierRemoval=20,
|
||||
HitsVP=make_VeloClusterTrackingSIMD_hits(),
|
||||
HitsUT=make_PrStorePrUTHits_hits(),
|
||||
HitsFT=make_PrStoreSciFiHits_hits(),
|
||||
ReferenceExtrapolator=TrackMasterExtrapolator(
|
||||
MaterialLocator=get_global_materiallocator(),
|
||||
),
|
||||
InputUniqueIDGenerator=make_unique_id_generator(),
|
||||
).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_seed = make_links_tracks_mcparticles(
|
||||
InputTracks=tracks["Seed"],
|
||||
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",
|
||||
)
|
||||
res_checker_best_forward = check_track_resolution(
|
||||
dict(v1=fitted_forward_tracks),
|
||||
suffix="BestForward",
|
||||
)
|
||||
res_checker_seed = check_track_resolution(
|
||||
tracks["Seed"],
|
||||
suffix="Seed",
|
||||
)
|
||||
|
||||
eff_checker_forward = check_tracking_efficiency(
|
||||
"Forward",
|
||||
tracks["Forward"],
|
||||
links_to_forward,
|
||||
links_to_lhcbids,
|
||||
get_mc_categories("Forward"),
|
||||
get_hit_type_mask("Forward"),
|
||||
)
|
||||
eff_checker_match = check_tracking_efficiency(
|
||||
"Match",
|
||||
tracks["Match"],
|
||||
links_to_match,
|
||||
links_to_lhcbids,
|
||||
get_mc_categories("Match"),
|
||||
get_hit_type_mask("Match"),
|
||||
)
|
||||
eff_checker_best_long = check_tracking_efficiency(
|
||||
"BestLong",
|
||||
tracks["BestLong"],
|
||||
links_to_best,
|
||||
links_to_lhcbids,
|
||||
get_mc_categories("BestLong"),
|
||||
get_hit_type_mask("BestLong"),
|
||||
)
|
||||
eff_checker_seed = check_tracking_efficiency(
|
||||
"Seed",
|
||||
tracks["Seed"],
|
||||
links_to_seed,
|
||||
links_to_lhcbids,
|
||||
get_mc_categories("Seed"),
|
||||
get_hit_type_mask("Seed"),
|
||||
)
|
||||
|
||||
# types_and_locations_for_checkers = {
|
||||
# "Forward": tracks["Forward"],
|
||||
# "Seed": tracks["Seed"],
|
||||
# "Match": tracks["Match"],
|
||||
# }
|
||||
|
||||
# data = []
|
||||
# data += get_track_checkers(types_and_locations_for_checkers)
|
||||
|
||||
data = [
|
||||
res_checker_forward,
|
||||
res_checker_best_long,
|
||||
res_checker_best_forward,
|
||||
res_checker_seed,
|
||||
eff_checker_forward,
|
||||
eff_checker_match,
|
||||
eff_checker_best_long,
|
||||
eff_checker_seed,
|
||||
]
|
||||
|
||||
return Reconstruction("run_tracking_debug", data)
|
||||
|
||||
|
||||
run_reconstruction(options, run_tracking_resolution)
|
@ -105,20 +105,20 @@ def train_matching_ghost_mlp(
|
||||
dataloader.AddVariable("distX", "F")
|
||||
dataloader.AddVariable("distY", "F")
|
||||
dataloader.AddVariable("dSlope", "F")
|
||||
# dataloader.AddVariable("dSlopeY", "F")
|
||||
dataloader.AddVariable("dSlopeY", "F")
|
||||
# dataloader.AddVariable("zmag", "F")
|
||||
dataloader.AddVariable("eta", "F")
|
||||
# dataloader.AddVariable("eta", "F")
|
||||
# dataloader.AddVariable("dEta", "F")
|
||||
# dataloader.AddVariable("meanEta", "F")
|
||||
# dataloader.AddVariable("eta_scifi", "F")
|
||||
|
||||
|
||||
|
||||
dataloader.AddSignalTree(signal_tree, 1.0)
|
||||
dataloader.AddBackgroundTree(bkg_tree, 1.0)
|
||||
|
||||
# these cuts are also applied in the algorithm
|
||||
preselectionCuts = ROOT.TCut(
|
||||
# "chi2<30 && distX<500 && distY<500 && dSlope<2.0 && dSlopeY<0.15", #### ganz raus für elektronen
|
||||
# "eta>2 && eta<5 && eta_scifi>2 && eta_scifi<5"
|
||||
)
|
||||
dataloader.PrepareTrainingAndTestTree(
|
||||
preselectionCuts,
|
||||
|
@ -236,6 +236,11 @@ def get_eff(eff, hist, tf, histoName, label, var):
|
||||
numerator = findRootObjByName(tf[lab], numeratorName)
|
||||
except:
|
||||
numerator = denominator
|
||||
# except:
|
||||
# denominator = findRootObjByName(
|
||||
# tf[lab], denominatorName.replace("dP_", "P_")
|
||||
# )
|
||||
# numerator = findRootObjByName(tf[lab], numeratorName.replace("dP_", "P_"))
|
||||
|
||||
if numerator.GetEntries() == 0 or denominator.GetEntries() == 0:
|
||||
continue
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user