diff --git a/DaVinciExamples/python/DaVinciExamples/debugging.py b/DaVinciExamples/python/DaVinciExamples/debugging.py index af129acfde062e71068e1014942c6316cc593cb2..8ba031463bb32b18b75b6d26da9822b345c9bfe9 100644 --- a/DaVinciExamples/python/DaVinciExamples/debugging.py +++ b/DaVinciExamples/python/DaVinciExamples/debugging.py @@ -12,7 +12,7 @@ Example of a DaVinci job printing decay trees via `PrintDecayTree`. """ from PyConf.application import configure, configure_input -from PyConf.application import default_raw_event, make_odin +from PyConf.application import make_odin from PyConf.control_flow import CompositeNode, NodeLogic from PyConf.Algorithms import PrintDecayTree, PrintHeader @@ -40,8 +40,7 @@ def print_decay_tree(options: Options): def print_header(options: Options): - with default_raw_event.bind(raw_event_format=options.input_raw_format): - ph = PrintHeader(ODINLocation=make_odin()) + ph = PrintHeader(ODINLocation=make_odin()) node = CompositeNode("PHNode", children=[ph]) diff --git a/Phys/DaVinci/python/DaVinci/LbExec.py b/Phys/DaVinci/python/DaVinci/LbExec.py index 16e7abbae7154a54e1c5cae10ce47660d191789e..e51cdeb3eb5603261c02421163716c39507dfddd 100644 --- a/Phys/DaVinci/python/DaVinci/LbExec.py +++ b/Phys/DaVinci/python/DaVinci/LbExec.py @@ -14,6 +14,7 @@ from GaudiConf.LbExec import Options as DefaultOptions, ProcessTypes from pydantic import root_validator from PyConf.reading import (upfront_decoder, reconstruction, get_tes_root, get_odin, get_hlt_reports, get_mc_track_info) +from PyConf.application import default_raw_event class Options(DefaultOptions): @@ -85,14 +86,12 @@ class Options(DefaultOptions): - get_hlt_reports - get_mc_track_info """ - upfront_decoder.global_bind(process=self.process) + default_raw_event.global_bind(raw_event_format=self.input_raw_format) + upfront_decoder.global_bind(process=self.process, stream=self.stream) reconstruction.global_bind(process=self.process) get_mc_track_info.global_bind(process=self.process) get_tes_root.global_bind(process=self.process) - get_odin.global_bind( - process=self.process, - stream=self.stream, - input_raw_format=self.input_raw_format) + get_odin.global_bind(process=self.process, stream=self.stream) get_hlt_reports.global_bind(process=self.process, stream=self.stream) with super().apply_binds(): yield diff --git a/Phys/DaVinci/tests/config/test_algorithms.py b/Phys/DaVinci/tests/config/test_algorithms.py index e058addfb6b1aaec5eef880027c2545f8b6a580d..d22fdea8a6640326270395fd4be603d790dc310e 100644 --- a/Phys/DaVinci/tests/config/test_algorithms.py +++ b/Phys/DaVinci/tests/config/test_algorithms.py @@ -17,6 +17,7 @@ from DaVinci.algorithms import ( apply_filters_and_unpacking, configured_FunTuple) from PyConf.reading import get_odin, get_decreports, get_hlt_reports, upfront_decoder +from PyConf.application import default_raw_event def test_define_write_fsr(): @@ -41,6 +42,7 @@ def test_add_hlt2_filter(): """ options = Options( data_type="Upgrade", + input_raw_format=0.5, evt_max=1, simulation=True, process="Hlt2", @@ -50,7 +52,8 @@ def test_add_hlt2_filter(): # as they are not automatically configured in the pytests. # When running DV, the PyConf functions are globally configured and one must avoid # "binding" as much as possible. - with get_hlt_reports.bind(process=options.process, stream=options.stream): + with default_raw_event.bind(raw_event_format=options.input_raw_format),\ + get_hlt_reports.bind(process=options.process, stream=options.stream): test_filter = add_filter("test_filter", "HLT_PASS('Hlt2TESTLineDecision')") assert "HDRFilter" in test_filter.fullname @@ -62,12 +65,14 @@ def test_add_spruce_filter(): """ options = Options( data_type="Upgrade", + input_raw_format=0.5, evt_max=1, simulation=True, process="Spruce", stream="default", ) - with get_hlt_reports.bind(process=options.process, stream=options.stream): + with default_raw_event.bind(raw_event_format=options.input_raw_format),\ + get_hlt_reports.bind(process=options.process, stream=options.stream): test_filter = add_filter("test_filter", "HLT_PASS('SpruceTESTLineDecision')") assert "HDRFilter" in test_filter.fullname @@ -95,6 +100,7 @@ def test_apply_filters_and_unpack(): """ options = Options( data_type="Upgrade", + input_raw_format=0.5, process="Turbo", evt_max=1, evt_pre_filters={"test_filter": "EVT_PREFILTER"}, @@ -134,8 +140,9 @@ def test_configured_funtuple(): input_raw_format=0.5, simulation=True, ) - with upfront_decoder.bind(process=options.process), get_hlt_reports.bind( - process=options.process, stream=options.stream): + with default_raw_event.bind(raw_event_format=options.input_raw_format),\ + upfront_decoder.bind(process=options.process, stream=options.stream),\ + get_hlt_reports.bind(process=options.process, stream=options.stream): test_dict = configured_FunTuple(config) assert any("FunTupleBase_Particles/Tuple_TestTuple" in alg.fullname for alg in test_dict["TestTuple"]) @@ -152,10 +159,8 @@ def test_get_odin(): input_raw_format=0.5, simulation=True, ) - odin = get_odin( - process=options.process, - stream=options.stream, - input_raw_format=options.input_raw_format) + with default_raw_event.bind(raw_event_format=options.input_raw_format): + odin = get_odin(process=options.process, stream=options.stream) assert odin.location == "/Event/createODIN#1/ODIN" @@ -165,12 +170,14 @@ def test_get_decreports(): """ options = Options( data_type="Upgrade", + input_raw_format=0.5, evt_max=1, simulation=True, process="Turbo", stream="TurboSP", ) - with get_hlt_reports.bind(process=options.process, stream=options.stream): + with default_raw_event.bind(raw_event_format=options.input_raw_format),\ + get_hlt_reports.bind(process=options.process, stream=options.stream): decreports = get_decreports("Hlt2") assert decreports.location == "/Event/Hlt2/DecReports"