diff --git a/Phys/DaVinci/python/DaVinci/LbExec.py b/Phys/DaVinci/python/DaVinci/LbExec.py index 15f02a202934aaa39d85c6914f81888871523c4b..0e190922a192cede19c52fc6fd916d9f1d545859 100644 --- a/Phys/DaVinci/python/DaVinci/LbExec.py +++ b/Phys/DaVinci/python/DaVinci/LbExec.py @@ -12,9 +12,8 @@ from contextlib import contextmanager from typing import Optional from GaudiConf.LbExec import Options as DefaultOptions, InputProcessTypes 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, default_raw_banks, make_odin +from PyConf.reading import (upfront_decoder, reconstruction, get_tes_root) +from PyConf.application import default_raw_event class Options(DefaultOptions): @@ -74,23 +73,13 @@ class Options(DefaultOptions): - upfont_decoder - reconstruction - get_tes_root - - get_odin - - get_hlt_reports - - get_mc_track_info This way users do not have to manually configure these functions themselves. """ - default_raw_event.global_bind(raw_event_format=self.input_raw_format) - default_raw_banks.global_bind(stream=self.input_stream) + default_raw_event.global_bind( + raw_event_format=self.input_raw_format, stream=self.input_stream) upfront_decoder.global_bind( - input_process=self.input_process, stream=self.input_stream) + source=InputProcessTypes(self.input_process).sourceID()) reconstruction.global_bind(input_process=self.input_process) get_tes_root.global_bind(input_process=self.input_process) - get_odin.global_bind( - input_process=self.input_process, stream=self.input_stream) - make_odin.global_bind(stream=self.input_stream) - - get_hlt_reports.global_bind( - input_process=self.input_process, stream=self.input_stream) - get_mc_track_info.global_bind(input_process=self.input_process) with super().apply_binds(): yield diff --git a/Phys/DaVinci/python/DaVinci/algorithms.py b/Phys/DaVinci/python/DaVinci/algorithms.py index a1018b98db6d286cf9e1de1d20f856736c916dd1..8580f03d2a037b524265e3c56f13444e1ca99474 100644 --- a/Phys/DaVinci/python/DaVinci/algorithms.py +++ b/Phys/DaVinci/python/DaVinci/algorithms.py @@ -139,7 +139,7 @@ def apply_filters(options, algs_dict): # This filter will skip events with empty DstData but a positive line decision. # It will only be applied to the input_process where DstData bank is produced (Hlt2, Turbo, Spruce). if options.input_process in {"TurboPass", "Spruce", "Hlt2"}: - algs_list += [dstdata_filter(options.input_stream)] + algs_list += [dstdata_filter(source=options.input_process)] if options.evt_pre_filters: evt_pre_filters = [] diff --git a/Phys/DaVinci/tests/config/test_algorithms.py b/Phys/DaVinci/tests/config/test_algorithms.py index 32be042f15f7127fc3c3276a95446c611b278b2a..8494e78f20d7e70bd5dd0b12b25e4c99e28f71b8 100644 --- a/Phys/DaVinci/tests/config/test_algorithms.py +++ b/Phys/DaVinci/tests/config/test_algorithms.py @@ -15,6 +15,7 @@ from DaVinci.algorithms import (make_fsr_algs, create_lines_filter, add_filter, apply_filters, configured_FunTuple) from PyConf.reading import get_odin, get_decreports, get_hlt_reports, upfront_decoder from PyConf.application import default_raw_event +from GaudiConf.LbExec import InputProcessTypes import re @@ -51,8 +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 default_raw_event.bind(raw_event_format=options.input_raw_format),\ - get_hlt_reports.bind(input_process=options.input_process, stream=options.input_stream): + with default_raw_event.bind(raw_event_format=options.input_raw_format,stream=options.input_stream),\ + get_hlt_reports.bind(source = InputProcessTypes(options.input_process).sourceID()): test_filter = create_lines_filter( "test_filter_{hash}", lines=['Hlt2TESTLine']) assert test_filter.fullname.startswith("VoidFilter/test_filter") @@ -70,8 +71,8 @@ def test_add_spruce_filter(): input_process="Spruce", input_stream="default", ) - with default_raw_event.bind(raw_event_format=options.input_raw_format),\ - get_hlt_reports.bind(input_process=options.input_process, stream=options.input_stream): + with default_raw_event.bind(raw_event_format=options.input_raw_format, stream=options.input_stream),\ + get_hlt_reports.bind(source =InputProcessTypes(options.input_process).sourceID()): test_filter = create_lines_filter( "test_filter_{hash}", lines=["SpruceTESTLine"]) assert test_filter.fullname.startswith("VoidFilter/test_filter") @@ -82,15 +83,13 @@ def test_add_void_filter(): Check if DaVinci is able to implement correcty a Void filter if 'HLT_PASS' string is not found in the filter code." """ - options = Options( - data_type="Upgrade", - input_process="Gen", - evt_max=1, - simulation=True, - ) - with get_hlt_reports.bind( - input_process=options.input_process, stream=options.input_stream): - test_filter = add_filter("test_filter_{hash}", "VOIDTEST_Filter") + #options = Options( + # data_type="Upgrade", + # input_process=InputProcessTypes("Gen"), + # evt_max=1, + # simulation=True, + #) + test_filter = add_filter("test_filter_{hash}", "VOIDTEST_Filter") assert "VoidFilter" in test_filter.fullname @@ -140,11 +139,9 @@ def test_configured_funtuple(): input_raw_format=0.5, simulation=True, ) - with default_raw_event.bind(raw_event_format=options.input_raw_format),\ - upfront_decoder.bind(input_process=options.input_process, stream=options.input_stream),\ - get_hlt_reports.bind(input_process=options.input_process, stream=options.input_stream),\ - get_odin.bind(input_process=options.input_process, - stream=options.input_stream): + with default_raw_event.bind(raw_event_format=options.input_raw_format, stream=options.input_stream),\ + upfront_decoder.bind(source=InputProcessTypes(options.input_process).sourceID() ),\ + get_hlt_reports.bind(source=InputProcessTypes(options.input_process).sourceID()): test_dict = configured_FunTuple(config) assert any("FunTupleBase_Particles/Tuple_TestTuple" in alg.fullname for alg in test_dict["TestTuple"]) @@ -161,9 +158,10 @@ def test_get_odin(): input_raw_format=0.5, simulation=True, ) - with default_raw_event.bind(raw_event_format=options.input_raw_format): - odin = get_odin( - input_process=options.input_process, stream=options.input_stream) + with default_raw_event.bind( + raw_event_format=options.input_raw_format, + stream=options.input_stream): + odin = get_odin() assert re.fullmatch("/Event/createODIN_[0-9a-f]*/ODIN", odin.location) is not None @@ -180,7 +178,7 @@ def test_get_decreports(): input_process="TurboPass", input_stream="TurboSP", ) - with default_raw_event.bind(raw_event_format=options.input_raw_format),\ - get_hlt_reports.bind(input_process=options.input_process, stream=options.input_stream): + with default_raw_event.bind(raw_event_format=options.input_raw_format, stream=options.input_stream),\ + get_hlt_reports.bind(source = InputProcessTypes(options.input_process).sourceID()): decreports = get_decreports("Hlt2") assert decreports.location == "/Event/Hlt2/DecReports"