Skip to content
Snippets Groups Projects
Commit 02aaade7 authored by Vladislav Balagura's avatar Vladislav Balagura Committed by Rosen Matev
Browse files

Remove CPU HLT1 luminosity line

parent 25e3013a
No related branches found
No related tags found
1 merge request!1761Remove CPU HLT1 luminosity line
......@@ -14,11 +14,13 @@ The emulator deterministically samples Lumi and NoBias event type bits and
creates a new ODIN bank from them. This allows us to test the accept rate of
the technical lines on simulated data, for which the Lumi and NoBias ODIN bits
are never set.
The luminosity line has been removed
"""
from Moore import options, run_moore
from PyConf.application import default_raw_banks, make_odin
from PyConf.Algorithms import createODIN, ODINEmulator
from Hlt1Conf.settings import luminosity_lines, minimum_bias_lines
from Hlt1Conf.settings import minimum_bias_lines
LUMI_FRACTION = 0.5
NOBIAS_FRACTION = 0.25
......@@ -40,7 +42,7 @@ def make_emulated_odin(make_raw=default_raw_banks):
def all_lines():
return luminosity_lines() + minimum_bias_lines()
return minimum_bias_lines()
# Run Moore, substituting the usual ODIN maker with our emulation
......
###############################################################################
# (c) Copyright 2019 CERN for the benefit of the LHCb Collaboration #
# #
# This software is distributed under the terms of the GNU General Public #
# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". #
# #
# In applying this licence, CERN does not waive the privileges and immunities #
# granted to it by virtue of its status as an Intergovernmental Organization #
# or submit itself to any jurisdiction. #
###############################################################################
"""Lines that running luminosity counters on a fraction of all events."""
import cppyy
from PyConf.Algorithms import (
LumiCounterFromContainer__PrVeloTracks,
LumiCounterFromContainer__PrimaryVertices,
LumiCounterMerger,
VoidFilter,
)
from PyConf.application import make_odin
from Moore.lines import HltLuminosityLine
from RecoConf.hlt1_tracking import (
make_hlt1_tracks,
make_reco_pvs,
)
from Functors import EVENTTYPE
from Functors import math as fmath
def odin_lumi_filter(make_odin=make_odin):
lumi_bit = cppyy.gbl.LHCb.ODIN.EventTypes.Lumi
odin = make_odin()
return VoidFilter(Cut=fmath.test_bit(EVENTTYPE(odin), lumi_bit))
def luminosity_line(name="Hlt1Luminosity", prescale=1):
"""Fills lumi counters for all crossings marked with the Lumi ODIN bit."""
lumi = odin_lumi_filter()
velo_tracks = make_hlt1_tracks()["Velo"]
velo_summary = LumiCounterFromContainer__PrVeloTracks(
CounterName="RZVelo", InputContainer=velo_tracks["Pr"])
pvs = make_reco_pvs(velo_tracks)
pv_summary = LumiCounterFromContainer__PrimaryVertices(
CounterName="PV3D", InputContainer=pvs["v3"])
merged_summary = LumiCounterMerger(
InputSummaries=[velo_summary, pv_summary])
return HltLuminosityLine(
name=name, algs=[lumi, merged_summary], prescale=prescale)
......@@ -21,7 +21,6 @@ from Hlt1Conf.lines.minimum_bias import (
low_multiplicity_velo_line,
no_bias_line,
)
from Hlt1Conf.lines.luminosity import luminosity_line
def track_mva_lines():
......@@ -51,15 +50,8 @@ def minimum_bias_lines():
]
def luminosity_lines():
return [
luminosity_line(),
]
def all_lines():
return track_mva_lines() + muon_lines() + minimum_bias_lines(
) + luminosity_lines()
return track_mva_lines() + muon_lines() + minimum_bias_lines()
def comparison_lines():
......@@ -79,7 +71,6 @@ def comparison_lines():
high_mass_dimuon_line(),
low_multiplicity_velo_line(),
no_bias_line(),
luminosity_line(),
one_track_muon_highpt_line(),
#gec_passthrough_line()
]
......@@ -12,6 +12,8 @@
<!--
Make sure the HLT1 luminosity and minimum bias lines accept the same number of
events as there are respective bits set by the ODIN emulator.
For a moment, HLT1 luminosity line is excluded, so its test is removed
-->
<extension class="GaudiTest.GaudiExeTest" kind="test">
<argument name="program"><text>gaudirun.py</text></argument>
......@@ -27,20 +29,14 @@ countErrorLines({"FATAL": 0, "ERROR": 0, "WARNING": 0},
stdout=remove_known_warnings(stdout))
# Find expected counts, i.e. the number of events with the bit set by the ODIN emulator
m = re.search(r'ODINEmulator .* #accept\(8,3\): .* Sum=(\d+)', stdout)
nlumi_exp = m.group(1) if m else 0
m = re.search(r'ODINEmulator .* #accept\(4,3\): .* Sum=(\d+)', stdout)
nnobias_exp = m.group(1) if m else 0
# Find actual counts, i.e. the number of events selected by lines
m = re.search(r'\s+LAZY_AND: Hlt1Luminosity .* Sum=(\d+)', stdout)
nlumi = m.group(1) if m else 0
m = re.search(r'\s+LAZY_AND: Hlt1NoBias .* Sum=(\d+)', stdout)
nnobias = m.group(1) if m else 0
# Compare expected to actual
if nlumi != nlumi_exp or nlumi == 0:
causes.append('expected {} Lumi decisions, found {}'.format(nlumi_exp, nlumi))
if nnobias != nnobias_exp or nnobias == 0:
causes.append('expected {} NoBias decisions, found {}'.format(nnobias_exp, nnobias))
......
......@@ -15,7 +15,7 @@ from collections import namedtuple
from PyConf import configurable
from PyConf.Algorithms import (
ExecutionReportsWriter, HltDecReportsWriter, HltSelReportsWriter,
Hlt__RoutingBitsWriter, HltLumiWriter, Gaudi__Hive__FetchLeavesFromFile,
Hlt__RoutingBitsWriter, Gaudi__Hive__FetchLeavesFromFile,
CombineRawBankViewsToRawEvent, RawEventCombiner, RawEventSimpleCombiner,
AddressKillerAlg, VoidFilter, HltDecReportsMonitor, DeterministicPrescaler)
import Functors as F
......@@ -50,7 +50,7 @@ ONLINE = 'Online'
# "forward" some useful functions from PyConf.application
from PyConf.application import configure_input, configure
from .lines import HltLine, SpruceLine, HltLuminosityLine # noqa: forward import
from .lines import HltLine, SpruceLine # noqa: forward import
from .persistence import persist_line_outputs
from .selreports import make_selreports
......@@ -143,20 +143,9 @@ def report_writers_nodes(streams,
algs = []
lines = streams_dict_to_lines_list(streams)
lines_with_output = [l for l in lines if l.produces_output]
lumi_lines = [
l for l in lines_with_output if isinstance(l, HltLuminosityLine)
]
lumi_lines = []
physics_lines = [l for l in lines_with_output if l not in lumi_lines]
# We can handle multiple lines by using a LumiCounterMerger algorithm, but
# for now simplify the logic by assuming there's a single line
assert len(lumi_lines) <= 1, 'Found multiple lumi lines'
if len(lumi_lines) == 1:
lumi_line, = lumi_lines
lumi_encoder = HltLumiWriter(InputBank=lumi_line.output_producer)
algs.append(lumi_encoder)
new_hlt_banks['HltLumiSummary'] = lumi_encoder.RawEventLocation
# We will write the reports to raw banks at these locations
source_id = {
"hlt1": "Hlt1",
......
......@@ -14,8 +14,6 @@ import logging
from functools import lru_cache
import Functors as F
from Configurables import LumiCounterMerger
from PyConf.Algorithms import (DeterministicPrescaler, VoidFilter,
HltDecReportsDecoder)
from PyConf.application import make_odin
......@@ -147,27 +145,6 @@ class DecisionLine(object):
return last if last.outputs else None
class HltLuminosityLine(DecisionLine):
"""Object fully qualifying an HLT luminosity line.
A luminosity line collects information from luminometers, sub-detectors
which provide time-stable measurements of quantities correlated to the
instantaneous luminosity delivered to the experiment.
A luminosity line will rate-limit itself by filtering on the value of the
`LHCb::ODIN::Lumi` bit in the event type field of the ODIN raw bank.
The counters computed by the algorithms of this line must be in a format
that can be consumed by the creator the luminosity raw bank. To ensure
this, the constructor asserts that the output producer of the line is of
type `LumiCounterMerger`.
"""
def __init__(self, name, algs, prescale=1.):
super(HltLuminosityLine, self).__init__(name, algs, prescale)
assert self.output_producer.type == LumiCounterMerger
class Hlt1Line(DecisionLine):
"""Object fully qualifying an HLT1 line.
......
......@@ -27,10 +27,7 @@ DETECTOR_RAW_BANK_TYPES = {
'Muon',
}
HLT1_REPORT_RAW_BANK_TYPES = {
'HltDecReports',
'HltSelReports',
'HltRoutingBits',
'HltLumiSummary',
'HltDecReports', 'HltSelReports', 'HltRoutingBits', 'HltLumiSummary'
}
HLT2_REPORT_RAW_BANK_TYPES = {
'HltDecReports', 'HltRoutingBits', 'HltLumiSummary', 'DstData'
......
......@@ -2,7 +2,7 @@ Lines
=====
.. automodule:: Moore.lines
:members: DecisionLine, HltLuminosityLine, Hlt2Line, HltLine
:members: DecisionLine, Hlt2Line, HltLine
.. automodule:: Moore.config
:members: register_line_builder
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