From 8745c22af31876afbbfeafe11f608d54812fcbf1 Mon Sep 17 00:00:00 2001 From: Maarten Van Veghel <maarten.vanveghel@cern.ch> Date: Wed, 24 May 2023 18:02:31 +0200 Subject: [PATCH] further upstream persistency config --- .../python/RecoConf/hlt2_global_reco.py | 44 ++++++++++++------- .../python/RecoConf/rich_reconstruction.py | 6 ++- 2 files changed, 31 insertions(+), 19 deletions(-) diff --git a/Hlt/RecoConf/python/RecoConf/hlt2_global_reco.py b/Hlt/RecoConf/python/RecoConf/hlt2_global_reco.py index ea475dbfe62..e0301dbdb92 100644 --- a/Hlt/RecoConf/python/RecoConf/hlt2_global_reco.py +++ b/Hlt/RecoConf/python/RecoConf/hlt2_global_reco.py @@ -54,8 +54,7 @@ def make_legacy_reconstruction(): # Calo, enable v3 track versions tracks_v3, trackrels = convert_tracks_to_v3_from_v1( best_tracks["v1"], - track_types=rich_and_charged_proto_track_types + - ["Upstream", "Ttrack"]) + track_types=rich_and_charged_proto_track_types + ["Ttrack"]) calo_pids = make_calo(tracks_v3, pvs["v3"], trackrels=trackrels) # Muons @@ -156,11 +155,18 @@ def make_light_reconstruction(usePatPVFuture=False, # split/unmerged track conversion # TODO should be for all track types like this (or rather within the convert function) - upstream_tracks = hlt2_tracks.get( + best_upstream = hlt2_tracks.get( 'BestUpstream', {"v1": TracksEmptyProducer(name="FakeUpstreamTracks")}) + upstream_tracks = TrackContainerCopy( + name="CreateBestUpstreamContainer_{hash}", + inputLocations=[best_upstream['v1']], + outputs={ + 'outputLocation': persisted_location('Upstream') + }).outputLocation + upstream_v3, upstream_rels = convert_tracks_to_v3_from_v1( - upstream_tracks["v1"], + upstream_tracks, track_types=["Upstream"], ) tracks_v3.update(upstream_v3) @@ -170,9 +176,8 @@ def make_light_reconstruction(usePatPVFuture=False, pvs = make_reco_pvs(velo_tracks, persisted_location('PVs')) # RICH - if skipRich: - rich_pids = None - else: + rich_pids = {'Merged': None, 'Upstream': None} + if not skipRich: rich_options = default_rich_reco_options() richRecConfs = make_all_rich_pids( best_tracks, @@ -180,11 +185,14 @@ def make_light_reconstruction(usePatPVFuture=False, make_pids=make_rich_pids, track_types=rich_and_charged_proto_track_types) # specifically for optional upstream - richRecConfs["Upstream"] = make_rich_pids( - "Upstream", upstream_tracks["v1"], rich_options) + rich_pids['Upstream'] = make_rich_pids( + 'Upstream', + upstream_tracks, + rich_options, + location=persisted_location('UpstreamRichPIDs'))['RichPIDs'] # Merge them for now to be backwards compatible. - rich_pids = make_merged_rich_pids(richRecConfs, - rich_and_charged_proto_track_types) + rich_pids['Merged'] = make_merged_rich_pids( + richRecConfs, rich_and_charged_proto_track_types) # Calo, enable v3 track versions calo_pids = make_calo( @@ -219,7 +227,7 @@ def make_light_reconstruction(usePatPVFuture=False, # default charged protoparticles charged_protos = make_charged_protoparticles_from( tracks=best_tracks, - rich_pids=rich_pids, + rich_pids=rich_pids['Merged'], calo_pids=calo_pids, muon_pids=muon_pids, track_types=rich_and_charged_proto_track_types, @@ -228,9 +236,8 @@ def make_light_reconstruction(usePatPVFuture=False, # optional/split upstream protoparticles # TODO should be for all track types like this upstream_protos = make_charged_protoparticles_from( - tracks=upstream_tracks, - rich_pids=richRecConfs['Upstream']['RichPIDs'] - if not skipRich else None, + tracks={"v1": upstream_tracks}, + rich_pids=rich_pids['Upstream'], calo_pids=calo_pids, muon_pids=None, track_types=['Upstream'], @@ -246,7 +253,7 @@ def make_light_reconstruction(usePatPVFuture=False, output = { "AllTrackHandles": hlt2_tracks, "Tracks": best_tracks["v1"], - "UpstreamTracks": upstream_tracks["v1"], + "Upstream": upstream_tracks, "VeloTracks": velo_tracks["v1"], "PVs": pvs["v3"], "PVs_v1": pvs["v1"], @@ -277,7 +284,10 @@ def make_light_reconstruction(usePatPVFuture=False, output.update(caloDict) if not skipRich: - richDict = {"RichPIDs": rich_pids} + richDict = { + "RichPIDs": rich_pids['Merged'], + "UpstreamRichPIDs": rich_pids['Upstream'], + } output.update(richDict) if not skipMuon: diff --git a/Hlt/RecoConf/python/RecoConf/rich_reconstruction.py b/Hlt/RecoConf/python/RecoConf/rich_reconstruction.py index 7f04673571e..8c90c0431bd 100644 --- a/Hlt/RecoConf/python/RecoConf/rich_reconstruction.py +++ b/Hlt/RecoConf/python/RecoConf/rich_reconstruction.py @@ -587,7 +587,8 @@ def make_rich_photons(track_name, def make_rich_pids(track_name, input_tracks, options, - make_raw=default_raw_banks): + make_raw=default_raw_banks, + location=None): """ Return RICH PID data. @@ -723,7 +724,8 @@ def make_rich_pids(track_name, TracksLocation=track_conf["InputTracks"], SummaryTracksLocation=recSum.SummaryTracksLocation, TrackPIDHyposInputLocation=PIDs[options["nLikelihoodIterations"]], - TrackDLLsInputLocation=DLLs[options["nLikelihoodIterations"]]) + TrackDLLsInputLocation=DLLs[options["nLikelihoodIterations"]], + outputs={'RichPIDsLocation': location}) results["RichPIDs"] = writePIDs.RichPIDsLocation # return the final dict -- GitLab