From c608b6d951724a473dadb8c8fb43311e2586a939 Mon Sep 17 00:00:00 2001
From: sesen <sevda.esen@cern.ch>
Date: Wed, 10 Aug 2022 18:20:25 +0200
Subject: [PATCH] add tests to use new metainfo

---
 .../example_data/FEST_November_2021_dst_newPacking.yaml  | 5 +++--
 DaVinciExamples/example_data/Spruce_all_lines_dst.yaml   | 5 +++--
 .../python/DaVinciExamples/tupling/AllFunctors.py        | 1 +
 .../tupling/option_davinci_tupling_from_hlt2.py          | 2 +-
 .../qmtest/tupling.qms/test_davinci_tupling_All.qmt      | 5 +++--
 Phys/DaVinci/python/DaVinci/Configuration.py             | 9 ++++++++-
 Phys/DaVinci/python/DaVinci/LbExec.py                    | 1 +
 7 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/DaVinciExamples/example_data/FEST_November_2021_dst_newPacking.yaml b/DaVinciExamples/example_data/FEST_November_2021_dst_newPacking.yaml
index 069139e37..f98a342c3 100644
--- a/DaVinciExamples/example_data/FEST_November_2021_dst_newPacking.yaml
+++ b/DaVinciExamples/example_data/FEST_November_2021_dst_newPacking.yaml
@@ -1,6 +1,6 @@
 input_files:
-   - root://eoslhcb.cern.ch//eos/lhcb/wg/dpa/wp3/NovemberFEST/hlt2_D0_Kpi_10evts_newPacking.dst
-annsvc_config: root://eoslhcb.cern.ch//eos/lhcb/wg/dpa/wp3/NovemberFEST/hlt2_D0_Kpi_10evts_newPacking.tck.json
+   - root://eoslhcb.cern.ch//eos/lhcb/wg/dpa/wp3/NovemberFEST/hlt2_D0_Kpi_100evts_newPacking_newDst.dst
+input_manifest_file: root://eoslhcb.cern.ch//eos/lhcb/wg/dpa/wp3/NovemberFEST/hlt2_D0_Kpi_100evts_newPacking_newDst.tck.json
 data_type: Upgrade
 input_type: ROOT
 simulation: true
@@ -12,3 +12,4 @@ process: Hlt2
 stream: default
 print_freq: 1000
 input_raw_format: 0.5
+metainfo_repos: ['key-b5250c79','key-0ef72bf3']
diff --git a/DaVinciExamples/example_data/Spruce_all_lines_dst.yaml b/DaVinciExamples/example_data/Spruce_all_lines_dst.yaml
index f7b6926f6..c78b1ac6b 100644
--- a/DaVinciExamples/example_data/Spruce_all_lines_dst.yaml
+++ b/DaVinciExamples/example_data/Spruce_all_lines_dst.yaml
@@ -1,6 +1,6 @@
 input_files:
-- root://eoslhcb.cern.ch//eos/lhcb/wg/dpa/wp3/tests/spruce_all_lines_realtimereco_newPacking.dst
-annsvc_config: root://eoslhcb.cern.ch//eos/lhcb/wg/dpa/wp3/tests/spruce_all_lines_realtime_newPacking.tck.json
+- root://eoslhcb.cern.ch//eos/lhcb/wg/dpa/wp3/tests/spruce_all_lines_realtimereco_newPacking_newDst.dst
+input_manifest_file: root://eoslhcb.cern.ch//eos/lhcb/wg/dpa/wp3/tests/spruce_all_lines_realtime_newPacking_newDst.tck.json
 data_type: Upgrade
 input_type: ROOT
 simulation: true
@@ -10,3 +10,4 @@ histo_file: sprucing_histos.root
 ntuple_file: sprucing_tuple.root
 input_raw_format: 0.5
 process: Spruce
+metainfo_repos: ['key-b04d6708', 'key-43a25419']
\ No newline at end of file
diff --git a/DaVinciExamples/python/DaVinciExamples/tupling/AllFunctors.py b/DaVinciExamples/python/DaVinciExamples/tupling/AllFunctors.py
index b42df9fcf..4e04e053d 100644
--- a/DaVinciExamples/python/DaVinciExamples/tupling/AllFunctors.py
+++ b/DaVinciExamples/python/DaVinciExamples/tupling/AllFunctors.py
@@ -324,6 +324,7 @@ def alg_config(options: Options):
         loki_preamble=[],
         inputs=bd2dsk_data)
 
+
     #
     # Algorithms to be run
     #
diff --git a/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_hlt2.py b/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_hlt2.py
index 910c56acf..13d497f1f 100644
--- a/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_hlt2.py
+++ b/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_hlt2.py
@@ -65,7 +65,7 @@ def main(options: Options):
         "piplus": daughter_variables
     }
 
-    line_name = 'Hlt2CharmD0ToKmPipLine'
+    line_name = 'Hlt2Charm_D0ToKmPip_Line'
     d02kpi_data = force_location(f"/Event/HLT2/{line_name}/Particles")
 
     my_filter = add_filter(options, "HDRFilter_D0Kpi",
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 b52679cec..327f7820a 100755
--- a/DaVinciExamples/tests/qmtest/tupling.qms/test_davinci_tupling_All.qmt
+++ b/DaVinciExamples/tests/qmtest/tupling.qms/test_davinci_tupling_All.qmt
@@ -26,8 +26,8 @@
   <!-- Minimum bias dst processed using topo {2,3} hlt2 lines and all sprucing lines -->
   <argument name="extra_options_yaml"><text>
     input_files:
-      - root://eoslhcb.cern.ch//eos/lhcb/wg/dpa/wp3/tests/spruce_all_lines_realtimereco_newPacking.dst'
-    annsvc_config: 'root://eoslhcb.cern.ch//eos/lhcb/wg/dpa/wp3/tests/spruce_all_lines_realtime_newPacking.tck.json'
+      - root://eoslhcb.cern.ch//eos/lhcb/wg/dpa/wp3/tests/spruce_all_lines_realtimereco_newPacking_newDst.dst'
+    input_manifest_file: 'root://eoslhcb.cern.ch//eos/lhcb/wg/dpa/wp3/tests/spruce_all_lines_realtime_newPacking_newDst.tck.json'
     data_type: Upgrade
     input_type: ROOT
     simulation: true
@@ -39,6 +39,7 @@
     print_freq: 1
     process: 'Spruce'
     stream: 'default'
+    metainfo_repos: ['key-b04d6708', 'key-43a25419']
   </text></argument>
   <argument name="timeout"><integer>1000</integer></argument>
   <argument name="args"><set>
diff --git a/Phys/DaVinci/python/DaVinci/Configuration.py b/Phys/DaVinci/python/DaVinci/Configuration.py
index 931532432..404ff18f6 100644
--- a/Phys/DaVinci/python/DaVinci/Configuration.py
+++ b/Phys/DaVinci/python/DaVinci/Configuration.py
@@ -16,6 +16,8 @@ from PyConf.Algorithms import EventAccounting
 from DaVinci.algorithms import (define_fsr_writer, apply_filters_and_unpacking)
 from DaVinci.config import davinci_control_flow, prepare_davinci_nodes
 from .utils import load_file
+from PyConf.application import metainfo_repos
+from Configurables import ApplicationMgr
 
 
 def add_davinci_configurables(options, user_algorithms, public_tools):
@@ -37,7 +39,12 @@ def add_davinci_configurables(options, user_algorithms, public_tools):
 
     config = configure_input(options)
 
-    if options.annsvc_config:  # this should be renamed to input_manifest_file
+    if options.input_manifest_file:
+            metainfo_repos.global_bind( extra_central_tags =   options.metainfo_repos  )
+
+            ApplicationMgr().ExtSvc += [configured_ann_svc()]
+            
+    elif  options.annsvc_config:  # this should be renamed to input_manifest_file
         # distinguish between configuring the ANNSvc for decoding, and getting
         # the manifest to configure the unpacking (the latter has _NOTHING_ to
         # do with the ANNSvc)
diff --git a/Phys/DaVinci/python/DaVinci/LbExec.py b/Phys/DaVinci/python/DaVinci/LbExec.py
index 6368e941d..bb2d5d9d6 100644
--- a/Phys/DaVinci/python/DaVinci/LbExec.py
+++ b/Phys/DaVinci/python/DaVinci/LbExec.py
@@ -22,6 +22,7 @@ class ProcessTypes(str, Enum):
 
 class Options(DefaultOptions):
     input_manifest_file: Optional[str]
+    metainfo_repos: Optional[list]
     annsvc_config: Optional[str]
     process: ProcessTypes = ProcessTypes.Turbo
     stream: str = "default"
-- 
GitLab