cetin
7c2194df23
and GEC Filter to eff options files trained network with correct parameterisation sample4 new effs with sample4 NN weights
229 lines
7.6 KiB
Python
229 lines
7.6 KiB
Python
# flake8: noqa
|
|
|
|
"""
|
|
Moore/run gaudirun.py /work/cetin/LHCb/reco_tuner/moore_options/get_ghost_data.py
|
|
"""
|
|
|
|
from Moore import options, run_reconstruction
|
|
from Moore.config import Reconstruction
|
|
|
|
from PyConf.Algorithms import (
|
|
PrForwardTrackingVelo,
|
|
PrForwardTracking,
|
|
PrTrackAssociator,
|
|
PrMatchNN,
|
|
PrResidualVeloTracks,
|
|
PrResidualSeedingLong,
|
|
fromPrMatchTracksV1Tracks,
|
|
fromPrVeloTracksV1Tracks,
|
|
fromPrSeedingTracksV1Tracks,
|
|
)
|
|
from PyConf.application import make_data_with_FetchDataFromFile
|
|
from PyConf.Tools import PrMCDebugForwardTool, PrMCDebugMatchToolNN
|
|
from RecoConf.data_from_file import mc_unpackers
|
|
from RecoConf.hlt1_tracking import make_hlt1_tracks, make_PrStoreSciFiHits_hits
|
|
from RecoConf.hlt2_tracking import (
|
|
get_global_ut_hits_tool,
|
|
make_PrHybridSeeding_tracks,
|
|
make_PrMatchNN_tracks,
|
|
get_fast_hlt2_tracks,
|
|
)
|
|
from RecoConf.mc_checking import make_links_lhcbids_mcparticles_tracking_system
|
|
import glob
|
|
|
|
options.evt_max = -1
|
|
|
|
decay = "B" # D, B
|
|
options.ntuple_file = (
|
|
f"/work/cetin/LHCb/reco_tuner/data/ghost_data_{decay}_sample4.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 == "test":
|
|
options.input_files = ["/auto/data/guenther/Bd_Kstee/00151673_00000002_1.xdigi"]
|
|
elif decay == "both":
|
|
options.input_files = glob.glob("/auto/data/guenther/Bd_Kstee/*.xdigi") + glob.glob(
|
|
"/auto/data/guenther/Dst_D0ee/*.xdigi"
|
|
)
|
|
|
|
options.dddb_tag = "dddb-20210617"
|
|
options.conddb_tag = "sim-20210617-vc-md100"
|
|
|
|
options.simulation = True
|
|
|
|
|
|
def run_tracking_debug():
|
|
links_to_hits = make_links_lhcbids_mcparticles_tracking_system()
|
|
hlt1_tracks = make_hlt1_tracks()
|
|
seed_tracks = make_PrHybridSeeding_tracks()
|
|
|
|
# add MCLinking to the (fitted) V1 tracks
|
|
links_to_velo_tracks = PrTrackAssociator(
|
|
SingleContainer=hlt1_tracks["Velo"]["v1"],
|
|
LinkerLocationID=links_to_hits,
|
|
MCParticleLocation=mc_unpackers()["MCParticles"],
|
|
MCVerticesInput=mc_unpackers()["MCVertices"],
|
|
).OutputLocation
|
|
|
|
links_to_upstream_tracks = PrTrackAssociator(
|
|
SingleContainer=hlt1_tracks["Upstream"]["v1"],
|
|
LinkerLocationID=links_to_hits,
|
|
MCParticleLocation=mc_unpackers()["MCParticles"],
|
|
MCVerticesInput=mc_unpackers()["MCVertices"],
|
|
).OutputLocation
|
|
|
|
links_to_seed_tracks = PrTrackAssociator(
|
|
SingleContainer=seed_tracks["v1"],
|
|
LinkerLocationID=links_to_hits,
|
|
MCParticleLocation=mc_unpackers()["MCParticles"],
|
|
MCVerticesInput=mc_unpackers()["MCVertices"],
|
|
).OutputLocation
|
|
|
|
# be more robust against imperfect data
|
|
loose_forward_params = dict(
|
|
MaxChi2PerDoF=16,
|
|
MaxChi2XProjection=30,
|
|
MaxChi2PerDoFFinal=8,
|
|
MaxChi2Stereo=8,
|
|
MaxChi2StereoAdd=8,
|
|
)
|
|
|
|
forward_debug = PrForwardTrackingVelo(
|
|
InputTracks=hlt1_tracks["Velo"]["Pr"],
|
|
SciFiHits=make_PrStoreSciFiHits_hits(),
|
|
AddUTHitsToolName=get_global_ut_hits_tool(enable=True),
|
|
DebugTool=PrMCDebugForwardTool(
|
|
InputTracks=hlt1_tracks["Velo"]["v1"],
|
|
InputTrackLinks=links_to_velo_tracks,
|
|
MCParticles=mc_unpackers()["MCParticles"],
|
|
SciFiHitLinks=links_to_hits,
|
|
SciFiHits=make_PrStoreSciFiHits_hits(),
|
|
TrackInfo=make_data_with_FetchDataFromFile(
|
|
"/Event/MC/TrackInfo", "LHCb::MCProperty"
|
|
),
|
|
),
|
|
**loose_forward_params,
|
|
)
|
|
|
|
forward_ut_debug = PrForwardTracking(
|
|
SciFiHits=make_PrStoreSciFiHits_hits(),
|
|
InputTracks=hlt1_tracks["Upstream"]["Pr"],
|
|
AddUTHitsToolName=get_global_ut_hits_tool(enable=True),
|
|
DebugTool=PrMCDebugForwardTool(
|
|
InputTracks=hlt1_tracks["Upstream"]["v1"],
|
|
InputTrackLinks=links_to_upstream_tracks,
|
|
MCParticles=mc_unpackers()["MCParticles"],
|
|
SciFiHitLinks=links_to_hits,
|
|
SciFiHits=make_PrStoreSciFiHits_hits(),
|
|
TrackInfo=make_data_with_FetchDataFromFile(
|
|
"/Event/MC/TrackInfo", "LHCb::MCProperty"
|
|
),
|
|
),
|
|
**loose_forward_params,
|
|
)
|
|
|
|
loose_matching_params = dict(
|
|
MaxMatchChi2=30.0, # 30.0,
|
|
MaxDistX=500, # 500,
|
|
MaxDistY=500, # 500,
|
|
# MaxDSlope=1.5,
|
|
# MinMatchNN=0.215, # NN response cut value
|
|
)
|
|
|
|
match_debug = PrMatchNN(
|
|
VeloInput=hlt1_tracks["Velo"]["Pr"],
|
|
SeedInput=seed_tracks["Pr"],
|
|
MatchDebugToolName=PrMCDebugMatchToolNN(
|
|
VeloTracks=hlt1_tracks["Velo"]["v1"],
|
|
SeedTracks=seed_tracks["v1"],
|
|
VeloTrackLinks=links_to_velo_tracks,
|
|
SeedTrackLinks=links_to_seed_tracks,
|
|
TrackInfo=make_data_with_FetchDataFromFile(
|
|
"/Event/MC/TrackInfo", "LHCb::MCProperty"
|
|
),
|
|
MCParticles=mc_unpackers()["MCParticles"],
|
|
),
|
|
AddUTHitsToolName=get_global_ut_hits_tool(enable=True),
|
|
**loose_matching_params,
|
|
).MatchOutput
|
|
|
|
"""
|
|
v1_match_tracks = fromPrMatchTracksV1Tracks(
|
|
InputTracksLocation=match_debug,
|
|
VeloTracksLocation=hlt1_tracks["Velo"]["v1"],
|
|
SeedTracksLocation=seed_tracks["v1"],
|
|
).OutputTracksLocation
|
|
|
|
# run Matching on residual velo and seed track segments
|
|
|
|
pr_velo_residual = PrResidualVeloTracks(
|
|
TracksLocation=match_debug,
|
|
VeloTrackLocation=hlt1_tracks["Velo"]["Pr"],
|
|
).VeloTrackOutput
|
|
|
|
v1_velo_residual = fromPrVeloTracksV1Tracks(
|
|
InputTracksLocation=pr_velo_residual
|
|
).OutputTracksLocation
|
|
|
|
pr_seed_residual = PrResidualSeedingLong(
|
|
MatchTracksLocation=match_debug,
|
|
SeedTracksLocation=seed_tracks["Pr"],
|
|
).SeedTracksOutput
|
|
|
|
v1_seed_residual = fromPrSeedingTracksV1Tracks(
|
|
InputTracksLocation=pr_seed_residual
|
|
).OutputTracksLocation
|
|
|
|
# add MCLinking to the (fitted) residual V1 tracks
|
|
links_to_res_velo_tracks = PrTrackAssociator(
|
|
SingleContainer=v1_velo_residual,
|
|
LinkerLocationID=links_to_hits,
|
|
MCParticleLocation=mc_unpackers()["MCParticles"],
|
|
MCVerticesInput=mc_unpackers()["MCVertices"],
|
|
).OutputLocation
|
|
|
|
links_to_res_seed_tracks = PrTrackAssociator(
|
|
SingleContainer=v1_seed_residual,
|
|
LinkerLocationID=links_to_hits,
|
|
MCParticleLocation=mc_unpackers()["MCParticles"],
|
|
MCVerticesInput=mc_unpackers()["MCVertices"],
|
|
).OutputLocation
|
|
|
|
loose_res_matching_params = dict(
|
|
MaxMatchChi2=30.0, # 30.0,
|
|
MaxDistX=500, # 500,
|
|
MaxDistY=500, # 500,
|
|
MaxDSlope=1.5,
|
|
MinMatchNN=0.5, # NN response cut value
|
|
FastYTol=2500.0,
|
|
)
|
|
|
|
match_residual = PrMatchNN(
|
|
VeloInput=pr_velo_residual,
|
|
SeedInput=pr_seed_residual,
|
|
MatchDebugToolName=PrMCDebugMatchToolNN(
|
|
VeloTracks=v1_velo_residual,
|
|
SeedTracks=v1_seed_residual,
|
|
VeloTrackLinks=links_to_res_velo_tracks,
|
|
SeedTrackLinks=links_to_res_seed_tracks,
|
|
TrackInfo=make_data_with_FetchDataFromFile("/Event/MC/TrackInfo"),
|
|
MCParticles=mc_unpackers()["MCParticles"],
|
|
),
|
|
AddUTHitsToolName=get_global_ut_hits_tool(enable=True),
|
|
**loose_res_matching_params,
|
|
).MatchOutput
|
|
"""
|
|
|
|
data = [forward_debug, forward_ut_debug, match_debug] # match_residual]
|
|
|
|
return Reconstruction("run_tracking_debug", data)
|
|
|
|
|
|
run_reconstruction(options, run_tracking_debug)
|