From 93415b7286e14a6ef7c1ec07532e3db7b189d7da Mon Sep 17 00:00:00 2001 From: Rosen Matev Date: Wed, 29 Jan 2020 18:16:23 +0100 Subject: [PATCH 1/7] Introduce a decision name for lines Introduce a decision name for lines (which is always name + "Decision") and used that to configure the `ANNSvc`, (implcitly the DecReports writer `ExecutionReportsWriter`) and the `SelReportsMaker`. See lhcb/Moore#130 for motivation. Depends on LHCb!X and Phys!Y --- Hlt/Moore/python/Moore/config.py | 16 ++++++++++++++-- Hlt/Moore/python/Moore/selreports.py | 6 +++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Hlt/Moore/python/Moore/config.py b/Hlt/Moore/python/Moore/config.py index fe06dc72c28..a95c528f042 100644 --- a/Hlt/Moore/python/Moore/config.py +++ b/Hlt/Moore/python/Moore/config.py @@ -53,7 +53,12 @@ class HltLine(namedtuple('HltLine', ['node'])): # noqa name (str): name of the line algs: iterable of algorithms prescale (float): accept fraction of the prescaler + """ + # Line names ending with "Decision" would be confusing, so forbid it + if name.endswith("Decision"): + raise ValueError( + "line name ({}) should not end with Decision".format(name)) # TODO prescalers should get an explicit seed, see #74 prescaler = DeterministicPrescaler( AcceptFraction=prescale, ODINLocation=make_odin()) @@ -68,6 +73,11 @@ class HltLine(namedtuple('HltLine', ['node'])): # noqa """Line name""" return self.node.name + @property + def decision_name(self): + """Decision name""" + return self.name + "Decision" + @property def output_producer(self): """Return the producer that defines the output of this line. @@ -169,8 +179,10 @@ def report_writers_node(lines, hlt_ann_svc = setup_component( "HltANNSvc", # Zero is an invalid DecReport ID, so start from 1 - Hlt1SelectionID={line.name: n - for n, line in enumerate(lines, 1)}) + Hlt1SelectionID={ + line.decision_name: n + for n, line in enumerate(lines, 1) + }) lines_with_output = [l for l in lines if l.produces_output()] lumi_lines = [ diff --git a/Hlt/Moore/python/Moore/selreports.py b/Hlt/Moore/python/Moore/selreports.py index 7918f7c317a..c9df0d47cb8 100644 --- a/Hlt/Moore/python/Moore/selreports.py +++ b/Hlt/Moore/python/Moore/selreports.py @@ -203,8 +203,8 @@ def make_selreports(lines, decreports, **kwargs): decreports: DecReports data used as input to the SelReports maker. kwargs: Passed to the SelReportsMaker. """ - # Gather all outputs along with their type and line names - info = [(line.name, output, output.type) for line in lines + # Gather all outputs along with their type and decision names + info = [(line.decision_name, output, output.type) for line in lines for output in line_outputs_for_selreports(line)] if info: # Configurable properties expect list types, not tuples @@ -219,7 +219,7 @@ def make_selreports(lines, decreports, **kwargs): return SelReportsMaker( DecReports=decreports, - LineNames=names, + SelectionNames=names, CandidateTypes=types, Inputs=outputs, **kwargs) -- GitLab From 1f3578a6611851565e2c485f519535e947ef82d6 Mon Sep 17 00:00:00 2001 From: Ross Hunter Date: Wed, 5 Feb 2020 15:48:20 +0100 Subject: [PATCH 2/7] Add function to fetch MCTrackInfo --- Hlt/Hlt2Conf/python/Hlt2Conf/data_from_file.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Hlt/Hlt2Conf/python/Hlt2Conf/data_from_file.py b/Hlt/Hlt2Conf/python/Hlt2Conf/data_from_file.py index 9729cfb84a1..2fa0dc4c97d 100644 --- a/Hlt/Hlt2Conf/python/Hlt2Conf/data_from_file.py +++ b/Hlt/Hlt2Conf/python/Hlt2Conf/data_from_file.py @@ -134,6 +134,8 @@ def mc_unpacker(key, configurable, name, **kwargs): **kwargs) return alg +def make_mc_track_info(): + return make_data_with_FetchDataFromFile('/Event/MC/TrackInfo') def reco_unpackers(): # Ordered so that dependents are unpacked first -- GitLab From 922a37dc7ac6618309e5b05c744b875e74137d75 Mon Sep 17 00:00:00 2001 From: Gitlab CI Date: Wed, 5 Feb 2020 14:57:54 +0000 Subject: [PATCH 3/7] Fixed formatting patch generated by https://gitlab.cern.ch/lhcb/Moore/-/jobs/7067219 --- Hlt/Hlt2Conf/python/Hlt2Conf/data_from_file.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Hlt/Hlt2Conf/python/Hlt2Conf/data_from_file.py b/Hlt/Hlt2Conf/python/Hlt2Conf/data_from_file.py index 2fa0dc4c97d..1cb5b387d58 100644 --- a/Hlt/Hlt2Conf/python/Hlt2Conf/data_from_file.py +++ b/Hlt/Hlt2Conf/python/Hlt2Conf/data_from_file.py @@ -134,9 +134,11 @@ def mc_unpacker(key, configurable, name, **kwargs): **kwargs) return alg + def make_mc_track_info(): return make_data_with_FetchDataFromFile('/Event/MC/TrackInfo') + def reco_unpackers(): # Ordered so that dependents are unpacked first d = collections.OrderedDict([ -- GitLab From 399ca58b3e180251d12aa72fc1c32c4b46c8e2fc Mon Sep 17 00:00:00 2001 From: Rosen Matev Date: Wed, 29 Jan 2020 18:16:23 +0100 Subject: [PATCH 4/7] Introduce a decision name for lines Introduce a decision name for lines (which is always name + "Decision") and used that to configure the `ANNSvc`, (implcitly the DecReports writer `ExecutionReportsWriter`) and the `SelReportsMaker`. See lhcb/Moore#130 for motivation. Depends on LHCb!X and Phys!Y --- Hlt/Moore/python/Moore/config.py | 16 ++++++++++++++-- Hlt/Moore/python/Moore/selreports.py | 6 +++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Hlt/Moore/python/Moore/config.py b/Hlt/Moore/python/Moore/config.py index fe06dc72c28..a95c528f042 100644 --- a/Hlt/Moore/python/Moore/config.py +++ b/Hlt/Moore/python/Moore/config.py @@ -53,7 +53,12 @@ class HltLine(namedtuple('HltLine', ['node'])): # noqa name (str): name of the line algs: iterable of algorithms prescale (float): accept fraction of the prescaler + """ + # Line names ending with "Decision" would be confusing, so forbid it + if name.endswith("Decision"): + raise ValueError( + "line name ({}) should not end with Decision".format(name)) # TODO prescalers should get an explicit seed, see #74 prescaler = DeterministicPrescaler( AcceptFraction=prescale, ODINLocation=make_odin()) @@ -68,6 +73,11 @@ class HltLine(namedtuple('HltLine', ['node'])): # noqa """Line name""" return self.node.name + @property + def decision_name(self): + """Decision name""" + return self.name + "Decision" + @property def output_producer(self): """Return the producer that defines the output of this line. @@ -169,8 +179,10 @@ def report_writers_node(lines, hlt_ann_svc = setup_component( "HltANNSvc", # Zero is an invalid DecReport ID, so start from 1 - Hlt1SelectionID={line.name: n - for n, line in enumerate(lines, 1)}) + Hlt1SelectionID={ + line.decision_name: n + for n, line in enumerate(lines, 1) + }) lines_with_output = [l for l in lines if l.produces_output()] lumi_lines = [ diff --git a/Hlt/Moore/python/Moore/selreports.py b/Hlt/Moore/python/Moore/selreports.py index 7918f7c317a..c9df0d47cb8 100644 --- a/Hlt/Moore/python/Moore/selreports.py +++ b/Hlt/Moore/python/Moore/selreports.py @@ -203,8 +203,8 @@ def make_selreports(lines, decreports, **kwargs): decreports: DecReports data used as input to the SelReports maker. kwargs: Passed to the SelReportsMaker. """ - # Gather all outputs along with their type and line names - info = [(line.name, output, output.type) for line in lines + # Gather all outputs along with their type and decision names + info = [(line.decision_name, output, output.type) for line in lines for output in line_outputs_for_selreports(line)] if info: # Configurable properties expect list types, not tuples @@ -219,7 +219,7 @@ def make_selreports(lines, decreports, **kwargs): return SelReportsMaker( DecReports=decreports, - LineNames=names, + SelectionNames=names, CandidateTypes=types, Inputs=outputs, **kwargs) -- GitLab From e807a5a5a27e4681e3a412d0b1cc30b44536600d Mon Sep 17 00:00:00 2001 From: Ross Hunter Date: Wed, 5 Feb 2020 15:48:20 +0100 Subject: [PATCH 5/7] Add function to fetch MCTrackInfo --- Hlt/Hlt2Conf/python/Hlt2Conf/data_from_file.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Hlt/Hlt2Conf/python/Hlt2Conf/data_from_file.py b/Hlt/Hlt2Conf/python/Hlt2Conf/data_from_file.py index 9729cfb84a1..1cb5b387d58 100644 --- a/Hlt/Hlt2Conf/python/Hlt2Conf/data_from_file.py +++ b/Hlt/Hlt2Conf/python/Hlt2Conf/data_from_file.py @@ -135,6 +135,10 @@ def mc_unpacker(key, configurable, name, **kwargs): return alg +def make_mc_track_info(): + return make_data_with_FetchDataFromFile('/Event/MC/TrackInfo') + + def reco_unpackers(): # Ordered so that dependents are unpacked first d = collections.OrderedDict([ -- GitLab From 625fe60adc554d5e4979b04d9747e84ce7e10082 Mon Sep 17 00:00:00 2001 From: Ross Hunter Date: Fri, 7 Feb 2020 14:50:57 +0100 Subject: [PATCH 6/7] Fix sel report filtering --- Hlt/Hlt1Conf/options/hlt1_selreports_filtering.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Hlt/Hlt1Conf/options/hlt1_selreports_filtering.py b/Hlt/Hlt1Conf/options/hlt1_selreports_filtering.py index b47cd162823..4ea3cc782d3 100644 --- a/Hlt/Hlt1Conf/options/hlt1_selreports_filtering.py +++ b/Hlt/Hlt1Conf/options/hlt1_selreports_filtering.py @@ -116,7 +116,7 @@ def all_lines(): tos_filter = cls( InputContainer=v1_objects, SelReports=reports_maker.OutputHltSelReportsLocation, - DecisionPattern=line.name, + DecisionPattern=line.decision_name, ) lines_to_run.append( HltLine( -- GitLab From 152d30840750d2c613d88965230633d2e05decfa Mon Sep 17 00:00:00 2001 From: Ross Hunter Date: Fri, 7 Feb 2020 15:58:07 +0100 Subject: [PATCH 7/7] Fix routing bits writer with decision names --- Hlt/Moore/python/Moore/config.py | 2 +- Hlt/Moore/python/Moore/routingbits.py | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Hlt/Moore/python/Moore/config.py b/Hlt/Moore/python/Moore/config.py index a95c528f042..2083a2dfa0d 100644 --- a/Hlt/Moore/python/Moore/config.py +++ b/Hlt/Moore/python/Moore/config.py @@ -212,7 +212,7 @@ def report_writers_node(lines, algs.append(lumi_encoder) rbw = Hlt__RoutingBitsWriter( - RoutingBits=get_routing_bits(lines), + RoutingBits=get_routing_bits([line.decision_name for line in lines]), DecReports=erw.DecReportsLocation, RawEventLocation=routing_bits_raw_event, ODIN=make_odin(), diff --git a/Hlt/Moore/python/Moore/routingbits.py b/Hlt/Moore/python/Moore/routingbits.py index 65825714448..059f800c840 100644 --- a/Hlt/Moore/python/Moore/routingbits.py +++ b/Hlt/Moore/python/Moore/routingbits.py @@ -16,21 +16,21 @@ Each bit is set according to trigger line decisions. """ -def get_default_routing_bits(lines): +def get_default_routing_bits(decision_names): """ Define default routing bits via regular expressions. This is currently a placeholder to test the functionality.""" import re routingBits_regex = { - 33: r"Hlt1TrackMVALine", - 35: r"Hlt1TrackMuonMVALine", - 36: r"Hlt1TwoTrackMVALine", - 37: r".*TrackMVA.*Line", + 33: r"Hlt1TrackMVALineDecision", + 35: r"Hlt1TrackMuonMVALineDecision", + 36: r"Hlt1TwoTrackMVALineDecision", + 37: r".*TrackMVA.*LineDecision", } routingBits = {} for bit in routingBits_regex: matches = [] - for line in lines: - if re.match(routingBits_regex[bit], line.name): - matches.append(line.name) + for name in decision_names: + if re.match(routingBits_regex[bit], name): + matches.append(name) routingBits[bit] = matches return routingBits -- GitLab