Fix FT decoding and make it agree with Rec
This MR should go before !998 (closed) as it contains the minimal, essential fixes.
The current (v7 and v8) decoding has few issues:
- a segfault when large clusters are taken into account;
- asserts failing on dbg builds:
Invalid cluster condition. Usually empty slot due to counting/decoding mismatch.
- not 100% matching between Allen and Rec clusters. This was due to a misunderstanding about how to read the results of TestFTClusters.
Bug fixes
- now protect against mats that do not come in one block. The decoding in Allen used to assume that a given mat always came in one go, which is not always the case. This resulted in CalculateClusterCount reserving some space but PreDecode never fully filling the container, and writing above the first clusters;
- related: only sort the containers in PreDecode when it is filled;
Test code:
options.evt_max = 99000
options.input_type = 'MDF'
options.output_type = 'ROOT'
options.dddb_tag = 'upgrade/master'
options.conddb_tag = 'upgrade/master'
options.simulation = True
options.use_iosvc = True
options.event_store = 'EvtStoreSvc'
options.input_files = ["./Run_0000240925_20220804-120746-154_SAEB06.mdf"]
options.input_files = ["/eos/lhcb/user/l/lohenry/Run_0000243038_20220817-133349-471_SCEB11_0014.mdf"]
from PyConf.Algorithms import TestFTClusters
from PyConf.application import (configure_input, configure)
from PyConf.control_flow import (CompositeNode, NodeLogic)
from Allen.config import setup_allen_non_event_data_service
from AllenConf.scifi_reconstruction import decode_scifi
from RecoConf.hlt1_tracking import make_FTRawBankDecoder_clusters
from Moore import options
config = configure_input(options)
non_event_data_node = setup_allen_non_event_data_service()
allen_decoded_scifi = decode_scifi()
ft_lite_clusters = make_FTRawBankDecoder_clusters()
test_clusters = TestFTClusters(
scifi_offsets=allen_decoded_scifi["dev_scifi_hit_offsets"],
scifi_hits=allen_decoded_scifi["dev_scifi_hits"],
FTClusterLocation=ft_lite_clusters)
cf_node = CompositeNode(
'compare_ft_clusters',
combine_logic=NodeLogic.NONLAZY_OR,
children=[non_event_data_node, test_clusters],
force_order=True)
config.update(configure(options, cf_node))
- Results on master: assert is failing
- Results on master without the assert:
TestFTClusters INFO Number of counters : 3
| Counter | # | sum | mean/eff^* | rms/err^* | min | max |
| "matched hits" | 50327495 |
| "onlyAllen hits" | 44761 |
| "onlyRec hits" | 44761 |
- Results when storing hits from cache (11f985dd):
TestFTClusters INFO Number of counters : 3
| Counter | # | sum | mean/eff^* | rms/err^* | min | max |
| "matched hits" | 50369054 |
| "onlyAllen hits" | 3202 |
| "onlyRec hits" | 3202 |
- Results when storing hits and only sort when container is filled (661ea71e):
TestFTClusters INFO Number of counters : 1
| Counter | # | sum | mean/eff^* | rms/err^* | min | max |
| "matched hits" | 50372256 |
and assert
now passes.
Edited by Louis Henry