From 33f92f9894da09e39663b552d458ef0316c846d1 Mon Sep 17 00:00:00 2001
From: Maarten Van Veghel <maarten.vanveghel@cern.ch>
Date: Tue, 18 Jul 2023 16:47:22 +0200
Subject: [PATCH] use Selections when only reading, added option for it

---
 .../tests/options/hlt2_persistreco_check.py     |  2 +-
 .../test_persistreco_mdf_output_fromfile.qmt    |  1 -
 .../qmtest/test_persistreco_output_fromfile.qmt |  1 -
 .../python/RecoConf/reco_objects_for_spruce.py  |  4 ++--
 .../python/RecoConf/reco_objects_from_file.py   |  4 ++--
 Hlt/RecoConf/python/RecoConf/standalone.py      | 17 ++++++++++-------
 6 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/Hlt/Hlt2Conf/tests/options/hlt2_persistreco_check.py b/Hlt/Hlt2Conf/tests/options/hlt2_persistreco_check.py
index 93f6aea71ac..29edbf06195 100644
--- a/Hlt/Hlt2Conf/tests/options/hlt2_persistreco_check.py
+++ b/Hlt/Hlt2Conf/tests/options/hlt2_persistreco_check.py
@@ -127,7 +127,7 @@ for ii in range(nevents):
         TES.dump()
 
     locations = default_persistable_locations(stream="/Event/HLT2")
-    check_persistreco(TES, locations.values(), 20, unexpected_locs)
+    check_persistreco(TES, locations.values(), 10, unexpected_locs)
 
     # We should still be persisting the HLT2 line candidates
     check_particlesandrelations(TES, "/Event/HLT2/" + line, 2)
diff --git a/Hlt/Hlt2Conf/tests/qmtest/test_persistreco_mdf_output_fromfile.qmt b/Hlt/Hlt2Conf/tests/qmtest/test_persistreco_mdf_output_fromfile.qmt
index 5dd81b34cb4..784db35b860 100644
--- a/Hlt/Hlt2Conf/tests/qmtest/test_persistreco_mdf_output_fromfile.qmt
+++ b/Hlt/Hlt2Conf/tests/qmtest/test_persistreco_mdf_output_fromfile.qmt
@@ -20,7 +20,6 @@ Test persistreco using reco from file. Runs over hlt2_persistreco_fromfile.mdf f
 <argument name="timeout"><integer>300</integer></argument>
 <argument name="args"><set>
   <text>$HLT2CONFROOT/tests/options/hlt2_persistreco_check.py</text>
-  <text>$MOOREROOT/options/muon_geometry_v2.py</text>
   <text>hlt2_test_persistreco_fromfile.mdf</text>
   <text>hlt2_persistreco_fromfile_mdf_output.tck.json</text>
 </set></argument>
diff --git a/Hlt/Hlt2Conf/tests/qmtest/test_persistreco_output_fromfile.qmt b/Hlt/Hlt2Conf/tests/qmtest/test_persistreco_output_fromfile.qmt
index 03e5a7de354..6c0958ecec2 100644
--- a/Hlt/Hlt2Conf/tests/qmtest/test_persistreco_output_fromfile.qmt
+++ b/Hlt/Hlt2Conf/tests/qmtest/test_persistreco_output_fromfile.qmt
@@ -22,7 +22,6 @@ Runs over hlt2_persistreco_fromfile.dst from test_persistreco_fromfile.py.
 <argument name="timeout"><integer>300</integer></argument>
 <argument name="args"><set>
   <text>$HLT2CONFROOT/tests/options/hlt2_persistreco_check.py</text>
-  <text>$MOOREROOT/options/muon_geometry_v2.py</text>
   <text>hlt2_test_persistreco_fromfile.dst</text>
   <text>hlt2_persistreco_fromfile_root_output.tck.json</text>
 </set></argument>
diff --git a/Hlt/RecoConf/python/RecoConf/reco_objects_for_spruce.py b/Hlt/RecoConf/python/RecoConf/reco_objects_for_spruce.py
index 99f4a639bfc..d8002132924 100644
--- a/Hlt/RecoConf/python/RecoConf/reco_objects_for_spruce.py
+++ b/Hlt/RecoConf/python/RecoConf/reco_objects_for_spruce.py
@@ -77,7 +77,7 @@ def reconstruction(simulation=False):
             ) and v.OutputName.location == value[0]:
                 data[key] = v.OutputName
 
-    # v0 postprocessing (how to check version?)
-    postprocess_unpacked_data(data)
+    # FIXME 'packable' set to true while 'SharedObjectsContainer`s are not persistable
+    postprocess_unpacked_data(data, packable=True)
 
     return data
diff --git a/Hlt/RecoConf/python/RecoConf/reco_objects_from_file.py b/Hlt/RecoConf/python/RecoConf/reco_objects_from_file.py
index 6f04580c50e..e542354be0d 100644
--- a/Hlt/RecoConf/python/RecoConf/reco_objects_from_file.py
+++ b/Hlt/RecoConf/python/RecoConf/reco_objects_from_file.py
@@ -29,8 +29,8 @@ def reconstruction():
     ### Temporary: as long as we persist v1, we need to insert a converter for the new PVs
     data = {k: v.OutputName for k, v in reco_unpackers().items()}
 
-    # v0 persistency postprocessing (how to check version?)
-    postprocess_unpacked_data(data)
+    # FIXME 'packable' set to true while 'SharedObjectsContainer`s are not persistable
+    postprocess_unpacked_data(data, packable=True)
 
     return data
 
diff --git a/Hlt/RecoConf/python/RecoConf/standalone.py b/Hlt/RecoConf/python/RecoConf/standalone.py
index a9562e2a4e7..95ac04e6049 100644
--- a/Hlt/RecoConf/python/RecoConf/standalone.py
+++ b/Hlt/RecoConf/python/RecoConf/standalone.py
@@ -201,10 +201,10 @@ def phoenix_data_dump_hlt2():
 
     # Add proto particles
     charged_protos = make_charged_protoparticles(
-        name="ChargedProtoParticleMakerLong_{hash}",
-        tracks=hlt2_tracks["BestLong"]['v1'],
+        name="ChargedProtoParticleMaker_{hash}",
+        tracks=[hlt2_tracks["BestLong"], hlt2_tracks["BestSeed"]],
         rich_pids=rich_reco["rich_pids"],
-        track_types=["Long"],
+        track_types=["Long", "Ttrack"],
         calo_pids=calo,
         muon_pids=muon_pids)
 
@@ -248,12 +248,15 @@ def phoenix_data_dump_hlt2_protoparticles():
     ''' Dump the protoparticle information ONLY '''
     reco = reconstruction()
     odin = make_odin()
-    long_protos = reco["LongProtos"]
+
+    from PyConf.Algorithms import ProtoContainersSharedMerger
+    charged_protos = ProtoContainersSharedMerger(
+        InputLocations=[reco["LongProtos"], reco["DownstreamProtos"]])
     neutral_protos = reco["NeutralProtos"]
 
     print_charged = PrintProtoParticles(
-        name="PrintLongProtos",
-        Input=long_protos,
+        name="PrintChargedProtos",
+        Input=charged_protos,
     )
     print_neutral = PrintProtoParticles(
         name="PrintNeutralProtos",
@@ -261,7 +264,7 @@ def phoenix_data_dump_hlt2_protoparticles():
     )
 
     particles_dumper = LHCb__Phoenix__DumpProtoParticlesEvent(
-        ChargedProtoParticles=long_protos,
+        ChargedProtoParticles=charged_protos,
         NeutralProtoParticles=neutral_protos,
         ODIN=odin)
 
-- 
GitLab