Skip to content
Snippets Groups Projects
Commit c7b6c8b3 authored by Gerhard Raven's avatar Gerhard Raven Committed by Sebastien Ponce
Browse files

Follow changes in LHCb!4110

parent 9a4d7484
No related branches found
No related tags found
2 merge requests!1103Draft: Add AnalysisHelpers to DaVinci Stack,!898Follow changes in LHCb!4110
......@@ -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
......@@ -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 = []
......
......@@ -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"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment