From 5feab202833c4796f11afd8f957947c95553c224 Mon Sep 17 00:00:00 2001
From: Maarten Van Veghel <maarten.vanveghel@cern.ch>
Date: Wed, 21 Jun 2023 18:20:30 +0200
Subject: [PATCH] improved naming conventions

---
 .../options/hlt2_2or3bodytopo_fromfile.py     |  2 +-
 Hlt/Hlt2Conf/options/hlt2_all_lines.py        |  1 +
 Hlt/Hlt2Conf/options/hlt2_example.py          |  1 +
 Hlt/Hlt2Conf/options/hlt2_ganga.py            |  1 +
 .../options/hlt2_persistreco_fromfile.py      |  1 +
 .../options/hlt2_persistreco_rawbanksp.py     |  1 +
 .../options/hlt2_persistreco_realtime.py      |  1 +
 Hlt/Hlt2Conf/options/run_hlt2_line_example.py |  1 +
 .../lbexec_yamls/excl_spruce_2022_data.yaml   |  3 +-
 .../python/Hlt2Conf/standard_particles.py     |  9 ++--
 .../Hlt2Conf/tests/test_algorithms_thor.py    |  3 ++
 .../Moore/persistence/truth_matching.py       | 23 +++++++--
 Hlt/Moore/python/Moore/tests/test_lines.py    |  3 ++
 .../tests/options/mdf_input_and_conds_hlt2.py |  2 +-
 Hlt/RecoConf/options/hlt1_hlt2_comparison.py  |  2 +-
 Hlt/RecoConf/options/run_two_hlt2_recos.py    |  7 ++-
 .../python/RecoConf/data_from_file.py         |  9 ++--
 .../python/RecoConf/hlt2_global_reco.py       | 50 +++++--------------
 Hlt/RecoConf/python/RecoConf/hlt2_tracking.py |  8 ++-
 Hlt/RecoConf/python/RecoConf/standalone.py    | 41 ++++++++-------
 20 files changed, 94 insertions(+), 75 deletions(-)

diff --git a/Hlt/Hlt2Conf/options/hlt2_2or3bodytopo_fromfile.py b/Hlt/Hlt2Conf/options/hlt2_2or3bodytopo_fromfile.py
index 5639d507a05..38136ceef21 100644
--- a/Hlt/Hlt2Conf/options/hlt2_2or3bodytopo_fromfile.py
+++ b/Hlt/Hlt2Conf/options/hlt2_2or3bodytopo_fromfile.py
@@ -38,7 +38,7 @@ options.dddb_tag = 'dddb-20171126'
 options.conddb_tag = 'sim-20171127-vc-md100'
 options.geometry_version = 'trunk'
 options.conditions_version = 'master'
-options.persistency_version = 'v0'
+options.persistency_locations_version = '1.0'
 
 options.output_file = 'hlt2_2or3bodytopo_fromfile.mdf'
 options.output_type = 'MDF'
diff --git a/Hlt/Hlt2Conf/options/hlt2_all_lines.py b/Hlt/Hlt2Conf/options/hlt2_all_lines.py
index 3752135af06..f7bc15d6f67 100644
--- a/Hlt/Hlt2Conf/options/hlt2_all_lines.py
+++ b/Hlt/Hlt2Conf/options/hlt2_all_lines.py
@@ -23,6 +23,7 @@ from Hlt2Conf.lines import all_lines
 
 options.set_input_and_conds_from_testfiledb('upgrade_minbias_hlt1_filtered')
 
+options.persistency_locations_version = '1.0'
 options.input_raw_format = 4.3
 make_digits.global_bind(calo_raw_bank=False)
 options.evt_max = 100
diff --git a/Hlt/Hlt2Conf/options/hlt2_example.py b/Hlt/Hlt2Conf/options/hlt2_example.py
index c062e65f382..6f16fd42f12 100644
--- a/Hlt/Hlt2Conf/options/hlt2_example.py
+++ b/Hlt/Hlt2Conf/options/hlt2_example.py
@@ -42,6 +42,7 @@ options.dddb_tag = 'dddb-20171126'
 options.conddb_tag = 'sim-20171127-vc-md100'
 options.geometry_version = 'trunk'
 options.conditions_version = 'master'
+options.persistency_locations_version = '1.0'
 
 options.output_file = 'hlt2_example.dst'
 options.output_type = 'ROOT'
diff --git a/Hlt/Hlt2Conf/options/hlt2_ganga.py b/Hlt/Hlt2Conf/options/hlt2_ganga.py
index 6c6b486cd12..6fdcaa569b7 100644
--- a/Hlt/Hlt2Conf/options/hlt2_ganga.py
+++ b/Hlt/Hlt2Conf/options/hlt2_ganga.py
@@ -26,6 +26,7 @@ options.simulation = True
 # Must still define input data parameters
 options.input_type = 'ROOT'
 options.input_raw_format = 4.3
+options.persistency_locations_version = '1.0'
 options.data_type = 'Upgrade'
 options.dddb_tag = 'dddb-20171126'
 options.conddb_tag = 'sim-20171127-vc-md100'
diff --git a/Hlt/Hlt2Conf/options/hlt2_persistreco_fromfile.py b/Hlt/Hlt2Conf/options/hlt2_persistreco_fromfile.py
index d89ca53ae04..3a50a03901a 100644
--- a/Hlt/Hlt2Conf/options/hlt2_persistreco_fromfile.py
+++ b/Hlt/Hlt2Conf/options/hlt2_persistreco_fromfile.py
@@ -112,6 +112,7 @@ input_files = [
 options.input_files = input_files
 options.input_type = 'ROOT'
 options.input_raw_format = 4.3
+options.persistency_locations_version = '1.0'
 # When running from Upgrade MC, must use the post-juggling locations of the raw
 # event
 make_digits.global_bind(calo_raw_bank=False)
diff --git a/Hlt/Hlt2Conf/options/hlt2_persistreco_rawbanksp.py b/Hlt/Hlt2Conf/options/hlt2_persistreco_rawbanksp.py
index c91af6ae42f..17766190752 100644
--- a/Hlt/Hlt2Conf/options/hlt2_persistreco_rawbanksp.py
+++ b/Hlt/Hlt2Conf/options/hlt2_persistreco_rawbanksp.py
@@ -44,6 +44,7 @@ input_files = [
 options.input_files = input_files
 options.input_type = 'ROOT'
 options.input_raw_format = 4.3
+options.persistency_locations_version = '1.0'
 # When running from Upgrade MC, must use the post-juggling locations of the raw
 # event
 make_digits.global_bind(calo_raw_bank=False)
diff --git a/Hlt/Hlt2Conf/options/hlt2_persistreco_realtime.py b/Hlt/Hlt2Conf/options/hlt2_persistreco_realtime.py
index 0b3cb1a2de3..fe62598d572 100644
--- a/Hlt/Hlt2Conf/options/hlt2_persistreco_realtime.py
+++ b/Hlt/Hlt2Conf/options/hlt2_persistreco_realtime.py
@@ -109,6 +109,7 @@ input_files = [
 options.input_files = input_files
 options.input_type = 'ROOT'
 options.input_raw_format = 4.3
+options.persistency_locations_version = '1.0'
 # When running from Upgrade MC, must use the post-juggling locations of the raw
 # event
 
diff --git a/Hlt/Hlt2Conf/options/run_hlt2_line_example.py b/Hlt/Hlt2Conf/options/run_hlt2_line_example.py
index 3f6ffc70881..a19d7b6fef8 100644
--- a/Hlt/Hlt2Conf/options/run_hlt2_line_example.py
+++ b/Hlt/Hlt2Conf/options/run_hlt2_line_example.py
@@ -23,6 +23,7 @@ public_tools = [stateProvider_with_simplified_geom()]
 
 options.set_input_and_conds_from_testfiledb('Upgrade_MinBias_LDST')
 options.input_raw_format = 4.3
+options.persistency_locations_version = '1.0'
 options.evt_max = 100
 options.control_flow_file = 'control_flow.gv'
 options.data_flow_file = 'data_flow.gv'
diff --git a/Hlt/Hlt2Conf/options/sprucing/lbexec_yamls/excl_spruce_2022_data.yaml b/Hlt/Hlt2Conf/options/sprucing/lbexec_yamls/excl_spruce_2022_data.yaml
index e26e3408e94..8761e8c6a9d 100644
--- a/Hlt/Hlt2Conf/options/sprucing/lbexec_yamls/excl_spruce_2022_data.yaml
+++ b/Hlt/Hlt2Conf/options/sprucing/lbexec_yamls/excl_spruce_2022_data.yaml
@@ -1,6 +1,7 @@
 process: Spruce
 input_raw_format : 0.5
 input_type : 'RAW'
+persistency_locations_version : '1.0'
 
 input_files : [
   'mdf:root://eoslhcb.cern.ch//eos/lhcb/wg/dpa/wp1/data/2022_FULL_255620_00150001_0005.raw'
@@ -18,4 +19,4 @@ histo_file : 'spruce_all_lines_histos.root'
 output_file : 'spruce_all_lines_production.{stream}.dst'
 output_type : 'ROOT'
 output_manifest_file : "spruce_all_lines_production.tck.json"
-input_process: Hlt2
\ No newline at end of file
+input_process: Hlt2
diff --git a/Hlt/Hlt2Conf/python/Hlt2Conf/standard_particles.py b/Hlt/Hlt2Conf/python/Hlt2Conf/standard_particles.py
index f1a360c5623..28daf8506ee 100644
--- a/Hlt/Hlt2Conf/python/Hlt2Conf/standard_particles.py
+++ b/Hlt/Hlt2Conf/python/Hlt2Conf/standard_particles.py
@@ -143,13 +143,16 @@ def _make_particles(species,
 def _make_ChargedBasics(
         species,
         make_protoparticles=_make_charged_protoparticles,
-        track_type='Long',
+        track_type='Charged',
         get_track_selector=get_all_track_selector,
         make_protoparticle_filter=standard_protoparticle_filter):
     """ creates LHCb::v2::ChargedBasics from LHCb::ProtoParticles """
+    pp_maker = make_protoparticles(
+        track_type=track_type
+    ) if track_type != 'Charged' else make_protoparticles()
     particles = Proto2ChargedBasic(
         InputUniqueIDGenerator=make_unique_id_generator(),
-        InputProtoParticles=make_protoparticles(track_type),
+        InputProtoParticles=pp_maker,
         ParticleID=species,
         TrackPredicate=get_track_selector(),
         ProtoParticlePredicate=make_protoparticle_filter(),
@@ -161,7 +164,7 @@ def _make_ChargedBasics(
 def _make_all_ChargedBasics(species):
     return _make_ChargedBasics(
         species=species,
-        track_type=None,
+        track_type='Charged',
         make_protoparticle_filter=standard_protoparticle_filter)
 
 
diff --git a/Hlt/Hlt2Conf/python/Hlt2Conf/tests/test_algorithms_thor.py b/Hlt/Hlt2Conf/python/Hlt2Conf/tests/test_algorithms_thor.py
index 5ca096ea8b9..3bd934fbe2c 100644
--- a/Hlt/Hlt2Conf/python/Hlt2Conf/tests/test_algorithms_thor.py
+++ b/Hlt/Hlt2Conf/python/Hlt2Conf/tests/test_algorithms_thor.py
@@ -16,6 +16,9 @@ import Functors as F
 from .. import algorithms_thor as thor
 from ..standard_particles import make_long_cb_pions
 
+from PyConf.packing import persistency_locations_version
+persistency_locations_version.global_bind(version='1.0')
+
 
 def test_v1_filter_v2_inputs():
     """A v1 filter cannot be instantiated with v2 input."""
diff --git a/Hlt/Moore/python/Moore/persistence/truth_matching.py b/Hlt/Moore/python/Moore/persistence/truth_matching.py
index 2faf309bc24..8cb28f4bfc2 100644
--- a/Hlt/Moore/python/Moore/persistence/truth_matching.py
+++ b/Hlt/Moore/python/Moore/persistence/truth_matching.py
@@ -61,7 +61,7 @@ CALOHYPO_V1_T = "KeyedContainer<LHCb::CaloHypo,Containers::KeyedObjectManager<Co
 
 
 @cache
-def _collect_dependencies(root, type_name):
+def _collect_dependencies(root, type_name, check_outputs=False):
     """Return inputs to `root` with the given type name.
 
     The algorithm performs a depth-first search on the data dependency tree
@@ -74,6 +74,7 @@ def _collect_dependencies(root, type_name):
     matches = set()
     # Depth-first search from the root
     to_list = lambda x: x if isinstance(x, list) else [x]
+    # first check inputs
     for input_list in map(to_list, root.inputs.values()):
         for input_handle in input_list:
             if input_handle.type == type_name:
@@ -81,6 +82,17 @@ def _collect_dependencies(root, type_name):
                 continue
             matches.update(
                 _collect_dependencies(input_handle.producer, type_name))
+    if check_outputs and len(matches) == 0:
+        # if not in inputs, it maybe in accompanying outputs
+        # looking specific for copier algorithm 'ChargedProtoParticleFilteredCopyAlg'
+        # used in converting persistency locations versions
+        for input_list in map(to_list, root.outputs.values()):
+            for input_handle in input_list:
+                if input_handle.type == type_name and 'Rec/Track' in input_handle.location:
+                    matches.add(input_handle)
+                    continue
+                matches.update(
+                    _collect_dependencies(input_handle.producer, type_name))
     return matches
 
 
@@ -127,10 +139,10 @@ def _find_protoparticles(candidates):
 
             # We happen to know that Brunel outputs charged and neutral protos
             # to so-named locations
-            if "Charged" in prop.location:
-                charged_brunel.add(dh)
-            else:
+            if "Neutral" in prop.location:
                 neutral_brunel.add(dh)
+            else:
+                charged_brunel.add(dh)
         else:
             # Assume charged ProtoParticle container if the maker has CALO
             # clusters in its dependencies
@@ -162,7 +174,8 @@ def _match_charged(charged, charged_brunel, mc_particles):
 
     # Track association from raw
     for dh in charged:
-        tracks = _collect_dependencies(dh.producer, TRACK_CONTAINER_T)
+        tracks = _collect_dependencies(
+            dh.producer, TRACK_CONTAINER_T, check_outputs=True)
         assert len(
             tracks
         ) == 1, "Unexpected number of track dependencies - expected 1, got " + str(
diff --git a/Hlt/Moore/python/Moore/tests/test_lines.py b/Hlt/Moore/python/Moore/tests/test_lines.py
index 1a990fcd76a..cd3c451e824 100644
--- a/Hlt/Moore/python/Moore/tests/test_lines.py
+++ b/Hlt/Moore/python/Moore/tests/test_lines.py
@@ -18,6 +18,9 @@ from Moore.persistence.particle_moving import particle_output
 # to grab a preconfigured LHCb::Particle producer for the tests here
 from Hlt2Conf.standard_particles import make_long_pions, make_dimuon_base
 
+from PyConf.packing import persistency_locations_version
+persistency_locations_version.global_bind(version='1.0')
+
 
 def test_unknown_producer(caplog):
     """Hlt2Line construction with an unknown output type should produce a warning.
diff --git a/Hlt/Moore/tests/options/mdf_input_and_conds_hlt2.py b/Hlt/Moore/tests/options/mdf_input_and_conds_hlt2.py
index 89f6a2ccc84..7d6b088304c 100644
--- a/Hlt/Moore/tests/options/mdf_input_and_conds_hlt2.py
+++ b/Hlt/Moore/tests/options/mdf_input_and_conds_hlt2.py
@@ -29,7 +29,7 @@ options.set_input_and_conds_from_testfiledb(
     'upgrade_Sept2022_minbias_0fb_md_mdf')
 
 options.input_files = list(set(options.input_files))  # remove dups
-options.persistency_version = 'v0'
+options.persistency_locations_version = '1.0'
 options.evt_max = 300
 
 options.use_iosvc = True
diff --git a/Hlt/RecoConf/options/hlt1_hlt2_comparison.py b/Hlt/RecoConf/options/hlt1_hlt2_comparison.py
index 14ea104b9b9..08d15e06d08 100644
--- a/Hlt/RecoConf/options/hlt1_hlt2_comparison.py
+++ b/Hlt/RecoConf/options/hlt1_hlt2_comparison.py
@@ -30,7 +30,7 @@ def reco():
 
     pvs = make_all_pvs()["v1"]
 
-    tracks = reconstruction()["Tracks"]
+    tracks = reconstruction()["LongTracks"]
     Velotracks = reconstruction()["VeloTracks"]
 
     checker = checker_trigger_objects(
diff --git a/Hlt/RecoConf/options/run_two_hlt2_recos.py b/Hlt/RecoConf/options/run_two_hlt2_recos.py
index 9533fbafd4d..1de3ce15729 100644
--- a/Hlt/RecoConf/options/run_two_hlt2_recos.py
+++ b/Hlt/RecoConf/options/run_two_hlt2_recos.py
@@ -14,13 +14,16 @@ from RecoConf.hlt2_global_reco import reconstruction
 from PyConf.Algorithms import PrForwardTrackingVelo
 from PyConf.packing import persisted_location
 
+from RecoConf.hlt2_global_reco import make_light_reco_pr_kf
+reconstruction.global_bind(make_reconstruction=make_light_reco_pr_kf)
+
 
 def make_two_reconstructions():
-    charged_protos_1 = reconstruction()["ChargedProtos"]
+    charged_protos_1 = reconstruction()["LongProtos"]
     neutral_protos_1 = reconstruction()["NeutralProtos"]
     with PrForwardTrackingVelo.bind(MinPT=1000.), persisted_location.bind(
             force=False):
-        charged_protos_2 = reconstruction()["ChargedProtos"]
+        charged_protos_2 = reconstruction()["LongProtos"]
         neutral_protos_2 = reconstruction()["NeutralProtos"]
     data = [
         charged_protos_1, neutral_protos_1, charged_protos_2, neutral_protos_2
diff --git a/Hlt/RecoConf/python/RecoConf/data_from_file.py b/Hlt/RecoConf/python/RecoConf/data_from_file.py
index bcfd10b3fd2..c388d232614 100644
--- a/Hlt/RecoConf/python/RecoConf/data_from_file.py
+++ b/Hlt/RecoConf/python/RecoConf/data_from_file.py
@@ -45,7 +45,7 @@ from Configurables import (UnpackMuonPIDs, UnpackRichPIDs, UnpackCaloHypo,
                            MCMuonHitUnpacker, MCRichDigitSummaryUnpacker)
 
 from PyConf.components import Algorithm, force_location
-from PyConf.packing import persisted_location, persistency_version
+from PyConf.packing import persisted_location, persistency_locations_version
 from PyConf.application import make_data_with_FetchDataFromFile
 from PyConf.Tools import (ChargedProtoParticleAddRichInfo,
                           ChargedProtoParticleAddMuonInfo,
@@ -132,7 +132,8 @@ def unpacked_mc_locations():
     }
 
 
-def postprocess_unpacked_data(data, persistency_version=persistency_version):
+def postprocess_unpacked_data(
+        data, persistency_locations_version=persistency_locations_version):
     """ Needed to unpack older persistency versions into latest persistency style:
          - for PVs only in v1 format
          - for merged 'Tracks' and 'ChargedProtos' containers (to split them per track type)
@@ -144,8 +145,8 @@ def postprocess_unpacked_data(data, persistency_version=persistency_version):
     data["PVs"] = RecV1ToPVConverter(
         InputVertices=data["PVs_v1"]).OutputVertices
 
-    # per track type splitter (to convert 'v0' persistency to latest)
-    if persistency_version() == "v0":
+    # per track type splitter (to convert '1.0' persistency to latest)
+    if persistency_locations_version() == "1.0":
         split_containers = {}
         track_predicates = {
             'Long': F.TRACKISLONG,
diff --git a/Hlt/RecoConf/python/RecoConf/hlt2_global_reco.py b/Hlt/RecoConf/python/RecoConf/hlt2_global_reco.py
index b908a70858b..272d91ee6bc 100644
--- a/Hlt/RecoConf/python/RecoConf/hlt2_global_reco.py
+++ b/Hlt/RecoConf/python/RecoConf/hlt2_global_reco.py
@@ -15,9 +15,9 @@ The 'global' reconstruction is that which produces the final output of the
 """
 from .hlt1_tracking import make_reco_pvs, make_FTRawBankDecoder_clusters
 from .hlt2_tracking import make_hlt2_tracks, make_hlt2_tracks_without_UT, convert_tracks_to_v3_from_v1, get_persisted_tracks_per_type
-from .rich_reconstruction import make_rich_pids, default_rich_reco_options, make_merged_rich_pids
+from .rich_reconstruction import make_rich_pids, default_rich_reco_options
 from .calorimeter_reconstruction import make_calo
-from .muon_reconstruction import make_all_muon_pids, make_merged_muon_pids, make_conv_muon_pids
+from .muon_reconstruction import make_all_muon_pids, make_conv_muon_pids
 
 from .protoparticles import (
     make_charged_protoparticles as make_charged_protoparticles_from,
@@ -26,10 +26,9 @@ from .protoparticles import (
 
 from PyConf import configurable
 from PyConf.packing import persisted_location
-from PyConf.Algorithms import (
-    RecSummaryMaker, TracksEmptyProducer, RichPIDsEmptyProducer,
-    TrackContainersSharedMerger, PVsEmptyProducer, RecVertexEmptyProducer,
-    ProtoContainersSharedMerger)
+from PyConf.Algorithms import (RecSummaryMaker, TracksEmptyProducer,
+                               RichPIDsEmptyProducer, PVsEmptyProducer,
+                               RecVertexEmptyProducer)
 
 
 def make_reconstruction(light_reco=True,
@@ -51,17 +50,12 @@ def make_reconstruction(light_reco=True,
         light_reco=light_reco, fast_reco=fastReco, use_pr_kf=use_pr_kf)
 
     persisted_tracks = get_persisted_tracks_per_type(hlt2_tracks, persist=True)
-    velo_tracks = hlt2_tracks['Velo']
-
-    best_tracks = TrackContainersSharedMerger(
-        name="CreateBestTrackContainer_{hash}",
-        InputLocations=list(persisted_tracks.values())).OutputLocation
 
     # track conversion to v3 for muon / calo
     tracks_v3, tracks_rels = convert_tracks_to_v3_from_v1(persisted_tracks)
 
     # PVs
-    pvs = make_reco_pvs(velo_tracks, persisted_location('PVs'))
+    pvs = make_reco_pvs(hlt2_tracks['Velo'], persisted_location('PVs'))
 
     # calorimeter
     calo_pids = make_calo(
@@ -78,11 +72,6 @@ def make_reconstruction(light_reco=True,
             persisted_tracks,
             track_types=rich_and_charged_proto_track_types,
             use_persisted_locations=True)
-        # merged versions
-        muon_tracks['Merged'] = TrackContainersSharedMerger(
-            name="CreateMuonPIDTrackContainer_{hash}",
-            InputLocations=list(muon_tracks.values())).OutputLocation
-        muon_pids['Merged'] = make_merged_muon_pids(muon_pids)
 
     # RICH
     rich_pids = {}
@@ -102,10 +91,6 @@ def make_reconstruction(light_reco=True,
                     outputs={
                         'Output': persisted_location(f'{track_type}RichPIDs')
                     }).Output
-        # merged versions
-        rich_pids['Merged'] = make_merged_rich_pids(
-            rich_pids, rich_and_charged_proto_track_types,
-            location=None) if not skipRich else None
 
     # split-per-track-type protoparticles
     charged_protos = {}
@@ -119,11 +104,6 @@ def make_reconstruction(light_reco=True,
             track_types=[track_type],
             location=persisted_location(f'{track_type}Protos'))
 
-    # merged access to all (split) protos (sharedobjectscontainer)
-    charged_protos['Merged'] = ProtoContainersSharedMerger(
-        name="CreateChargedProtosContainer_{hash}",
-        InputLocations=list(charged_protos.values())).OutputLocation
-
     # neutral protoparticles
     neutral_protos = make_neutral_protoparticles_from(
         calo_pids=calo_pids, location=persisted_location('NeutralProtos'))
@@ -133,15 +113,10 @@ def make_reconstruction(light_reco=True,
     ####
     output = {
         "AllTrackHandles": hlt2_tracks,
-        "Tracks": best_tracks,
-        "VeloTracks": velo_tracks["v1"],
+        "VeloTracks": persisted_tracks['UnfittedVelo'],
         "Ttracks": persisted_tracks['UnfittedTtrack'],
         "PVs": pvs["v3"],
         "PVs_v1": pvs["v1"],
-        "RichPIDs": rich_pids.get('Merged', None),
-        "MuonPIDs": muon_pids.get('Merged', None),
-        "MuonPIDTracks": muon_tracks.get('Merged', None),
-        "ChargedProtos": charged_protos['Merged'],
         "NeutralProtos": neutral_protos['ProtoParticleLocation'],
         "IsPhoton": neutral_protos['IsPhoton'],
         "IsNotH": neutral_protos['IsNotH'],
@@ -192,7 +167,7 @@ def make_calo_only_reconstruction():
 
     return {
         "NeutralProtos": neutral_protos['ProtoParticleLocation'],
-        "Tracks": tracks,
+        "LongTracks": tracks,
         "PVs": pvs,
         "PVs_v1": pvs_v1,
         # The full data flow is functional, we only keep this for compatibility with reco from file.
@@ -276,7 +251,8 @@ def make_fastest_reconstruction(skipUT=False):
 @configurable
 def make_rec_summary(reco_output):
     summary = RecSummaryMaker(
-        Tracks=reco_output["Tracks"],
+        # TODO temporarily set to just Long, new MR adapting RecSummary needed to fix this
+        Tracks=reco_output["LongTracks"],
         PVs=reco_output["PVs_v1"],
         SciFiClusters=make_FTRawBankDecoder_clusters(),
         outputs={"Output": persisted_location('RecSummary')})
@@ -338,7 +314,7 @@ def make_pvs():
     return reconstruction()["PVs"]
 
 
-def make_tracks():
-    """Return a DataHandle to the container of all tracks
+def make_tracks(track_type="Long"):
+    """Return a DataHandle to the container of certain tracks
     """
-    return reconstruction()["Tracks"]
+    return reconstruction()[f"{track_type}Tracks"]
diff --git a/Hlt/RecoConf/python/RecoConf/hlt2_tracking.py b/Hlt/RecoConf/python/RecoConf/hlt2_tracking.py
index 58a15ad7a9f..b50c166ff34 100644
--- a/Hlt/RecoConf/python/RecoConf/hlt2_tracking.py
+++ b/Hlt/RecoConf/python/RecoConf/hlt2_tracking.py
@@ -1511,13 +1511,17 @@ def get_persisted_tracks_per_type(hlt2_tracks, persist=True):
             'key': 'SeedDecloned',
             'location': 'Ttracks'
         },
+        'UnfittedVelo': {
+            'key': 'Velo',
+            'location': 'VeloTracks'
+        },
     }
 
     tracks = {}
     for track_type, config in persisted_tracks_config.items():
         if config['key'] in hlt2_tracks:
-            # TODO preferably this should be at the moment of producing
-            # or algorithm that just copies something to other location
+            # TODO preferably this should be an algorithm that makes SharedObjectsContainers
+            # of them (but needs this type to be persistable) or set at moment of producing
             in_tracks = hlt2_tracks[config['key']]['v1']
             tracks[track_type] = TrackContainersMerger(
                 name=f"CreateBest{track_type}Container" + "_{hash}",
diff --git a/Hlt/RecoConf/python/RecoConf/standalone.py b/Hlt/RecoConf/python/RecoConf/standalone.py
index 936e9cbab23..5be52c7e9d3 100644
--- a/Hlt/RecoConf/python/RecoConf/standalone.py
+++ b/Hlt/RecoConf/python/RecoConf/standalone.py
@@ -202,9 +202,9 @@ def phoenix_data_dump_hlt2():
 
     # Add proto particles
     charged_protos = make_charged_protoparticles(
-        tracks=[hlt2_tracks["BestLong"], hlt2_tracks["BestSeed"]],
+        tracks=hlt2_tracks["BestLong"]['v1'],
         rich_pids=rich_reco["rich_pids"],
-        track_types=["Long", "Downstream", "Upstream", "Ttrack"],
+        track_types=["Long"],
         calo_pids=calo,
         muon_pids=muon_pids)
 
@@ -258,12 +258,12 @@ def phoenix_data_dump_hlt2_protoparticles():
     ''' Dump the protoparticle information ONLY '''
     reco = reconstruction()
     odin = make_odin()
-    charged_protos = reco["ChargedProtos"]
+    long_protos = reco["LongProtos"]
     neutral_protos = reco["NeutralProtos"]
 
     print_charged = PrintProtoParticles(
-        name="PrintChargedProtos",
-        Input=charged_protos,
+        name="PrintLongProtos",
+        Input=long_protos,
     )
     print_neutral = PrintProtoParticles(
         name="PrintNeutralProtos",
@@ -271,7 +271,7 @@ def phoenix_data_dump_hlt2_protoparticles():
     )
 
     particles_dumper = LHCb__Phoenix__DumpProtoParticlesEvent(
-        ChargedProtoParticles=charged_protos,
+        ChargedProtoParticles=long_protos,
         NeutralProtoParticles=neutral_protos,
         ODIN=odin)
 
@@ -490,11 +490,11 @@ def standalone_hlt2_reco(do_mc_checking=False, do_data_monitoring=False):
 
     # Add proto particles
     charged_protos = make_charged_protoparticles(
-        tracks=best_tracks,
+        tracks=best_tracks['v1'],
         rich_pids=rich_reco["rich_pids"],
         calo_pids=calo,
         muon_pids=muon_pids,
-        location=persisted_location('ChargedProtos'))
+        location=None)
     data += [charged_protos]
 
     neutral_protos = make_neutral_protoparticles(
@@ -604,7 +604,9 @@ def standalone_hlt2_light_reco(fast_reco=False,
     muonRecConfs = make_all_muon_pids(
         tracks=tracks_v3, track_types=list(tracks4rich.keys()))
     muon_conv, muon_tracks = make_conv_muon_pids(
-        muonRecConfs, tracks4rich, light_reco=True)
+        muonRecConfs, {k: v['v1']
+                       for k, v in tracks4rich.items()},
+        light_reco=True)
     muon_pids = make_merged_muon_pids(muon_conv)
     data += [muon_pids]
 
@@ -630,12 +632,12 @@ def standalone_hlt2_light_reco(fast_reco=False,
     charged_protos = {}
     for key in sorted(tracks4rich):
         charged_protos[key] = make_charged_protoparticles(
-            tracks=tracks4rich[key],
+            tracks=tracks4rich[key]['v1'],
             rich_pids=rich_reco["rich_pids"][key],
             calo_pids=calo,
             muon_pids=muon_pids,
             track_types=[key],
-            location=persisted_location('ChargedProtos')
+            location=persisted_location('LongProtos')
             if key == 'Long' else None)
         data += [charged_protos[key]]
 
@@ -795,8 +797,8 @@ def standalone_hlt2_light_reco_without_UT(fast_reco=False,
         muonRecConfs = make_all_muon_pids(
             tracks=tracks_v3, track_types=tracktypes_formuon)
         muon_conv, muon_tracks = make_conv_muon_pids(
-            muonRecConfs,
-            tracks4rich,
+            muonRecConfs, {k: v['v1']
+                           for k, v in tracks4rich.items()},
             light_reco=True,
             track_types=tracktypes_formuon)
         muon_pids = make_merged_muon_pids(muon_conv)
@@ -836,12 +838,12 @@ def standalone_hlt2_light_reco_without_UT(fast_reco=False,
         charged_protos = {}
         for key in sorted(tracks4rich):
             charged_protos[key] = make_charged_protoparticles(
-                tracks=tracks4rich[key],
+                tracks=tracks4rich[key]['v1'],
                 rich_pids=rich_reco["rich_pids"][key],
                 calo_pids=calo,
                 muon_pids=muon_pids,
                 track_types=[key],
-                location=persisted_location('ChargedProtos')
+                location=persisted_location('LongProtos')
                 if key == 'Long' else None,
             )
             data += [charged_protos[key]]
@@ -973,14 +975,17 @@ def standalone_hlt2_light_reco_ion(fast_reco=False,
 
     muonRecConfs = make_all_muon_pids(
         tracks=tracks_v3, track_types=list(tracks4rich.keys()))
-    muon_pids = make_conv_muon_pids(muonRecConfs, tracks4rich, light_reco=True)
+    muon_pids = make_conv_muon_pids(
+        muonRecConfs, {k: v['v1']
+                       for k, v in tracks4rich.items()},
+        light_reco=True)
     data += [muon_pids]
 
     # proto particles
     charged_protos = {}
     for key in sorted(tracks4rich):
         charged_protos[key] = make_charged_protoparticles(
-            tracks=tracks4rich[key],
+            tracks=tracks4rich[key]['v1'],
             rich_pids=rich_reco["rich_pids"][key],
             calo_pids=calo,
             muon_pids=muon_pids[key],
@@ -1137,7 +1142,7 @@ def standalone_hlt2_light_reco_ion_without_UT(fast_reco=False,
     charged_protos = {}
     for key in sorted(tracks4rich):
         charged_protos[key] = make_charged_protoparticles(
-            tracks=tracks4rich[key],
+            tracks=tracks4rich[key]['v1'],
             rich_pids=rich_reco["rich_pids"][key],
             calo_pids=calo,
             muon_pids=muon_pids,
-- 
GitLab