From c69b60bf1eef446d6640bc592f34595cb2e13d02 Mon Sep 17 00:00:00 2001
From: Maarten Van Veghel <maarten.vanveghel@cern.ch>
Date: Wed, 28 Jun 2023 01:34:11 +0200
Subject: [PATCH] adapt to new persistency locations

---
 .../FEST_November_2021_dst_newPacking.yaml    |  1 +
 .../example_data/Spruce_Run251342.yaml        |  1 +
 .../example_data/Spruce_all_lines_dst.yaml    |  1 +
 .../example_data/Spruce_all_lines_olddst.yaml |  1 +
 .../Upgrade_Bd2KstarMuMu_ldst.yaml            |  1 +
 .../example_data/Upgrade_LbToLcmunu.yaml      |  1 +
 .../example_data/Upgrade_genFSR_ldst.yaml     |  1 +
 .../test_hlt1_trigger_decisions.yaml          |  1 +
 .../test_passthrough_thor_lines.yaml          |  1 +
 .../example_data/test_spruce_MCtools.yaml     |  1 +
 DaVinciExamples/example_data/test_tistos.yaml |  1 +
 .../tupling.qms/test_davinci_tupling_All.qmt  |  1 +
 .../options/option_davinci_funtuple_array.py  |  1 +
 .../davinci.qms/configure_dst_py-opts.qmt     |  1 +
 .../davinci.qms/configure_dst_yaml-opts.qmt   |  1 +
 .../functors.qms/test_thor_functors.qmt       |  1 +
 .../tests/qmtest/io.qms/test_read_mc_ldst.qmt |  1 +
 .../qmtest/io.qms/test_read_moore_dst.qmt     |  1 +
 DaVinciTutorials/options.yaml                 |  1 +
 Phys/DaVinci/python/DaVinci/LbExec.py         |  4 +++
 .../python/DaVinci/common_particles.py        | 31 +++++++------------
 21 files changed, 35 insertions(+), 19 deletions(-)

diff --git a/DaVinciExamples/example_data/FEST_November_2021_dst_newPacking.yaml b/DaVinciExamples/example_data/FEST_November_2021_dst_newPacking.yaml
index 3b23cd075..eb04c1e4b 100644
--- a/DaVinciExamples/example_data/FEST_November_2021_dst_newPacking.yaml
+++ b/DaVinciExamples/example_data/FEST_November_2021_dst_newPacking.yaml
@@ -14,3 +14,4 @@ input_process: Hlt2
 input_stream: default
 print_freq: 1000
 input_raw_format: 0.5
+persistency_locations_version: '1.0'
diff --git a/DaVinciExamples/example_data/Spruce_Run251342.yaml b/DaVinciExamples/example_data/Spruce_Run251342.yaml
index fde082111..18dd7d1f0 100644
--- a/DaVinciExamples/example_data/Spruce_Run251342.yaml
+++ b/DaVinciExamples/example_data/Spruce_Run251342.yaml
@@ -16,3 +16,4 @@ geometry_version: trunk
 python_logging_level: 3
 output_level: 3
 print_freq: 100
+persistency_locations_version: '1.0'
diff --git a/DaVinciExamples/example_data/Spruce_all_lines_dst.yaml b/DaVinciExamples/example_data/Spruce_all_lines_dst.yaml
index 62c714144..59a43be17 100644
--- a/DaVinciExamples/example_data/Spruce_all_lines_dst.yaml
+++ b/DaVinciExamples/example_data/Spruce_all_lines_dst.yaml
@@ -12,3 +12,4 @@ histo_file: sprucing_histos.root
 ntuple_file: sprucing_tuple.root
 input_raw_format: 0.5
 input_process: Spruce
+persistency_locations_version: '1.0'
diff --git a/DaVinciExamples/example_data/Spruce_all_lines_olddst.yaml b/DaVinciExamples/example_data/Spruce_all_lines_olddst.yaml
index 3ccde120c..21a2958dd 100644
--- a/DaVinciExamples/example_data/Spruce_all_lines_olddst.yaml
+++ b/DaVinciExamples/example_data/Spruce_all_lines_olddst.yaml
@@ -10,3 +10,4 @@ histo_file: sprucing_histos_olddst.root
 ntuple_file: sprucing_tuple_olddst.root
 input_raw_format: 0.3
 input_process: Spruce
+persistency_locations_version: '1.0'
diff --git a/DaVinciExamples/example_data/Upgrade_Bd2KstarMuMu_ldst.yaml b/DaVinciExamples/example_data/Upgrade_Bd2KstarMuMu_ldst.yaml
index f4038399e..f63b7ede2 100644
--- a/DaVinciExamples/example_data/Upgrade_Bd2KstarMuMu_ldst.yaml
+++ b/DaVinciExamples/example_data/Upgrade_Bd2KstarMuMu_ldst.yaml
@@ -8,3 +8,4 @@ dddb_tag: dddb-20171126
 conditions_version: master
 geometry_version: trunk
 input_process: Brunel
+persistency_locations_version: '1.0'
diff --git a/DaVinciExamples/example_data/Upgrade_LbToLcmunu.yaml b/DaVinciExamples/example_data/Upgrade_LbToLcmunu.yaml
index ddc7dc62d..9a33deefc 100644
--- a/DaVinciExamples/example_data/Upgrade_LbToLcmunu.yaml
+++ b/DaVinciExamples/example_data/Upgrade_LbToLcmunu.yaml
@@ -15,3 +15,4 @@ print_freq: 1
 input_process: Hlt2
 input_stream: default
 evt_max: -1
+persistency_locations_version: '1.0'
diff --git a/DaVinciExamples/example_data/Upgrade_genFSR_ldst.yaml b/DaVinciExamples/example_data/Upgrade_genFSR_ldst.yaml
index c42b4cb1c..c2f8eb11f 100644
--- a/DaVinciExamples/example_data/Upgrade_genFSR_ldst.yaml
+++ b/DaVinciExamples/example_data/Upgrade_genFSR_ldst.yaml
@@ -5,3 +5,4 @@ simulation: true
 conddb_tag: sim-20171127-vc-md100
 dddb_tag: dddb-20171126
 input_process: Brunel
+persistency_locations_version: '1.0'
diff --git a/DaVinciExamples/example_data/test_hlt1_trigger_decisions.yaml b/DaVinciExamples/example_data/test_hlt1_trigger_decisions.yaml
index f0e73da42..520faeda4 100644
--- a/DaVinciExamples/example_data/test_hlt1_trigger_decisions.yaml
+++ b/DaVinciExamples/example_data/test_hlt1_trigger_decisions.yaml
@@ -13,3 +13,4 @@ histo_file: hlt2_B0_test_histo.root
 lumi: false
 ntuple_file: hlt2_B0_test_ntuple.root
 input_process: Hlt2
+persistency_locations_version: '1.0'
diff --git a/DaVinciExamples/example_data/test_passthrough_thor_lines.yaml b/DaVinciExamples/example_data/test_passthrough_thor_lines.yaml
index 5f0c14f16..3871813b8 100644
--- a/DaVinciExamples/example_data/test_passthrough_thor_lines.yaml
+++ b/DaVinciExamples/example_data/test_passthrough_thor_lines.yaml
@@ -12,3 +12,4 @@ histo_file: passthrough_histos.root
 ntuple_file: passthrough_tuple.root
 input_process: TurboPass
 print_freq: 1000
+persistency_locations_version: '1.0'
diff --git a/DaVinciExamples/example_data/test_spruce_MCtools.yaml b/DaVinciExamples/example_data/test_spruce_MCtools.yaml
index fdaac9c8d..b888fac7f 100644
--- a/DaVinciExamples/example_data/test_spruce_MCtools.yaml
+++ b/DaVinciExamples/example_data/test_spruce_MCtools.yaml
@@ -12,3 +12,4 @@ histo_file: sprucing_mc_histos.root
 ntuple_file: sprucing_mc_tuple.root
 input_raw_format: 0.5
 input_process: Spruce
+persistency_locations_version: '1.0'
diff --git a/DaVinciExamples/example_data/test_tistos.yaml b/DaVinciExamples/example_data/test_tistos.yaml
index 3a1bb8c75..2c373c19a 100644
--- a/DaVinciExamples/example_data/test_tistos.yaml
+++ b/DaVinciExamples/example_data/test_tistos.yaml
@@ -13,3 +13,4 @@ evt_max: -1
 write_fsr: False
 print_freq: 1000
 input_process: Hlt2
+persistency_locations_version: '1.0'
diff --git a/DaVinciExamples/tests/qmtest/tupling.qms/test_davinci_tupling_All.qmt b/DaVinciExamples/tests/qmtest/tupling.qms/test_davinci_tupling_All.qmt
index b4f23b359..6bbfe6ccc 100755
--- a/DaVinciExamples/tests/qmtest/tupling.qms/test_davinci_tupling_All.qmt
+++ b/DaVinciExamples/tests/qmtest/tupling.qms/test_davinci_tupling_All.qmt
@@ -37,6 +37,7 @@
     conditions_version: master
     geometry_version: trunk
     input_raw_format: 0.3
+    persistency_locations_version: '1.0'
     lumi: false
     ntuple_file: 'DV_example_allFunctors_ntp.root'
     print_freq: 1
diff --git a/DaVinciTests/tests/options/option_davinci_funtuple_array.py b/DaVinciTests/tests/options/option_davinci_funtuple_array.py
index bb2b405c5..579440b9a 100644
--- a/DaVinciTests/tests/options/option_davinci_funtuple_array.py
+++ b/DaVinciTests/tests/options/option_davinci_funtuple_array.py
@@ -29,6 +29,7 @@ options.evt_max = 100
 options.histo_file = "DV-test-array-his.root"
 options.ntuple_file = "DV-test-array-ntp.root"
 options.input_process = "Spruce"
+options.persistency_locations_version = "1.0"
 
 bd2dsk_line = "SpruceB2OC_BdToDsmK_DsmToHHH_FEST_Line"
 bd2dsk_data = get_particles(f"/Event/Spruce/{bd2dsk_line}/Particles")
diff --git a/DaVinciTests/tests/qmtest/davinci.qms/configure_dst_py-opts.qmt b/DaVinciTests/tests/qmtest/davinci.qms/configure_dst_py-opts.qmt
index 5e849bc8a..e4860f18e 100644
--- a/DaVinciTests/tests/qmtest/davinci.qms/configure_dst_py-opts.qmt
+++ b/DaVinciTests/tests/qmtest/davinci.qms/configure_dst_py-opts.qmt
@@ -22,6 +22,7 @@
     histo_file: DV-Histos_py-opts.root
     lumi: False
     input_process: Brunel
+    persistency_locations_version: '1.0'
   </text></argument>
   <argument name="use_temp_dir"><enumeral>true</enumeral></argument>
   <argument name="validator"><text>
diff --git a/DaVinciTests/tests/qmtest/davinci.qms/configure_dst_yaml-opts.qmt b/DaVinciTests/tests/qmtest/davinci.qms/configure_dst_yaml-opts.qmt
index d9cb57c5d..f5c78ee7b 100644
--- a/DaVinciTests/tests/qmtest/davinci.qms/configure_dst_yaml-opts.qmt
+++ b/DaVinciTests/tests/qmtest/davinci.qms/configure_dst_yaml-opts.qmt
@@ -22,6 +22,7 @@
     histo_file: DV-Histos_yaml-opts.root
     lumi: False
     input_process: Brunel
+    persistency_locations_version: '1.0'
     evt_max: 10
   </text></argument>
   <argument name="use_temp_dir"><enumeral>true</enumeral></argument>
diff --git a/DaVinciTests/tests/qmtest/functors.qms/test_thor_functors.qmt b/DaVinciTests/tests/qmtest/functors.qms/test_thor_functors.qmt
index c8ed9be8c..2a7672da7 100755
--- a/DaVinciTests/tests/qmtest/functors.qms/test_thor_functors.qmt
+++ b/DaVinciTests/tests/qmtest/functors.qms/test_thor_functors.qmt
@@ -23,6 +23,7 @@
   print_freq: 1
   msg_svc_format: "% F%60W%S%7W%R%T %0W%M"
   input_process: TurboPass
+  persistency_locations_version: '1.0'
 </text></argument>
 <argument name="timeout"><integer>3600</integer></argument>
 <argument name="args"><set>
diff --git a/DaVinciTests/tests/qmtest/io.qms/test_read_mc_ldst.qmt b/DaVinciTests/tests/qmtest/io.qms/test_read_mc_ldst.qmt
index 90f244542..d338fce63 100644
--- a/DaVinciTests/tests/qmtest/io.qms/test_read_mc_ldst.qmt
+++ b/DaVinciTests/tests/qmtest/io.qms/test_read_mc_ldst.qmt
@@ -20,6 +20,7 @@
   <argument name="extra_options_yaml"><text>
     evt_max: 200
     input_process: Brunel
+    persistency_locations_version: '1.0'
     write_decoding_keys_to_git: false
   </text></argument>
   <argument name="reference"><text>../refs/test_davinci_read_mc_ldst.ref</text></argument>
diff --git a/DaVinciTests/tests/qmtest/io.qms/test_read_moore_dst.qmt b/DaVinciTests/tests/qmtest/io.qms/test_read_moore_dst.qmt
index c085d1129..61f1b6ab0 100755
--- a/DaVinciTests/tests/qmtest/io.qms/test_read_moore_dst.qmt
+++ b/DaVinciTests/tests/qmtest/io.qms/test_read_moore_dst.qmt
@@ -24,6 +24,7 @@
     print_freq: 1
     msg_svc_format: "% F%60W%S%7W%R%T %0W%M"
     input_process: Brunel
+    persistency_locations_version: '1.0'
   </text></argument>
 <argument name="validator"><text>
 findReferenceBlock("""StdLooseD02KK                                                  INFO Number of counters : 7
diff --git a/DaVinciTutorials/options.yaml b/DaVinciTutorials/options.yaml
index 876d99711..8d8b03b2b 100644
--- a/DaVinciTutorials/options.yaml
+++ b/DaVinciTutorials/options.yaml
@@ -12,3 +12,4 @@ conddb_tag: sim-20180530-vc-md100
 dddb_tag: dddb-20180815
 conditions_version: master
 geometry_version: trunk
+persistency_locations_version: '1.0'
diff --git a/Phys/DaVinci/python/DaVinci/LbExec.py b/Phys/DaVinci/python/DaVinci/LbExec.py
index 21a0f972e..8f7c88bca 100644
--- a/Phys/DaVinci/python/DaVinci/LbExec.py
+++ b/Phys/DaVinci/python/DaVinci/LbExec.py
@@ -15,6 +15,7 @@ from pydantic import root_validator  # type: ignore[import]
 from PyConf.reading import upfront_decoder, reconstruction  # type: ignore[import]
 from PyConf.reading import get_tes_root  # type: ignore[import]
 from PyConf.application import default_raw_event  # type: ignore[import]
+from PyConf.packing import persistency_locations_version  # type: ignore[import]
 import logging
 
 
@@ -91,5 +92,8 @@ class Options(DefaultOptions):
         )
         reconstruction.global_bind(input_process=self.input_process)
         get_tes_root.global_bind(input_process=self.input_process)
+        persistency_locations_version.global_bind(
+            version=self.persistency_locations_version
+        )
         with super().apply_binds():
             yield
diff --git a/Phys/DaVinci/python/DaVinci/common_particles.py b/Phys/DaVinci/python/DaVinci/common_particles.py
index c8a594c6b..2ade69596 100644
--- a/Phys/DaVinci/python/DaVinci/common_particles.py
+++ b/Phys/DaVinci/python/DaVinci/common_particles.py
@@ -17,15 +17,12 @@ from Functors.math import in_range  # type: ignore[import]
 from PyConf.tonic import configurable  # type: ignore[import]
 from PyConf.Algorithms import FunctionalParticleMaker  # type: ignore[import]
 from Hlt2Conf.standard_particles import (  # type: ignore[import]
-    make_long_kaons,
-    make_long_muons,
-    standard_protoparticle_filter,
+    make_long_kaons, make_long_muons, standard_protoparticle_filter,
     get_long_track_selector,
 )
 from Hlt2Conf.algorithms_thor import ParticleFilter, ParticleCombiner  # type: ignore[import]
 from PyConf.reading import (  # type: ignore[import]
-    get_charged_protoparticles as _make_charged_protoparticles,
-)
+    get_charged_protoparticles as _make_charged_protoparticles, )
 from RecoConf.reco_objects_from_file import make_pvs as _make_pvs_v2  # type: ignore[import]
 from DaVinci.filter_selectors import default_particle_cuts
 
@@ -36,22 +33,19 @@ from DaVinci.filter_selectors import default_particle_cuts
 
 def _make_std_loose_particles(particles, pvs, name):
     return ParticleFilter(
-        Input=particles, name=name, Cut=F.FILTER(default_particle_cuts(pvs))
-    )
+        Input=particles, name=name, Cut=F.FILTER(default_particle_cuts(pvs)))
 
 
 @configurable
 def make_std_loose_kaons():
     with standard_protoparticle_filter.bind(Code=F.PPHASRICH):
         return _make_std_loose_particles(
-            make_long_kaons(), _make_pvs_v2(), name="StdLooseKaons"
-        )
+            make_long_kaons(), _make_pvs_v2(), name="StdLooseKaons")
 
 
 def make_std_loose_muons():
     return _make_std_loose_particles(
-        make_long_muons(), _make_pvs_v2(), name="StdLooseMuons"
-    )
+        make_long_muons(), _make_pvs_v2(), name="StdLooseMuons")
 
 
 @configurable
@@ -59,9 +53,9 @@ def make_std_loose_jpsi2mumu():
     M_Jpsi = 3096.9 * MeV
     muons = make_std_loose_muons()
     descriptor = "J/psi(1S) -> mu+ mu-"
-    combination_code = (
-        in_range(M_Jpsi - 100.0 * MeV, F.MASS, M_Jpsi + 100.0 * MeV)
-    ) & F.MAXDOCACHI2CUT(30.0)
+    combination_code = (in_range(
+        M_Jpsi - 100.0 * MeV, F.MASS,
+        M_Jpsi + 100.0 * MeV)) & F.MAXDOCACHI2CUT(30.0)
     vertex_code = F.CHI2 < 5.0
 
     return ParticleCombiner(
@@ -78,9 +72,8 @@ def make_std_loose_d2kk():
     D0_M = 1864.84 * MeV  # +/- 0.05
     kaons = make_std_loose_kaons()
     descriptor = "D0 -> K+ K-"
-    combination_code = (
-        in_range(D0_M - 100.0 * MeV, F.MASS, D0_M + 100.0 * MeV)
-    ) & F.MAXDOCACHI2CUT(30.0)
+    combination_code = (in_range(D0_M - 100.0 * MeV, F.MASS,
+                                 D0_M + 100.0 * MeV)) & F.MAXDOCACHI2CUT(30.0)
     vertex_code = F.CHI2 < 25.0
 
     return ParticleCombiner(
@@ -100,9 +93,9 @@ def make_std_loose_d2kk():
 # IT'S REDESIGNED SPECIFICALLY FOR DAVINCI.
 @configurable
 def make_long_pions():
-    charged_protos = _make_charged_protoparticles()
+    long_protos = _make_charged_protoparticles(track_type='Long')
     particles = FunctionalParticleMaker(
-        InputProtoParticles=charged_protos,
+        InputProtoParticles=long_protos,
         ParticleID="pion",
         TrackPredicate=get_long_track_selector(),
         ProtoParticlePredicate=standard_protoparticle_filter(),
-- 
GitLab