diff --git a/Hlt/RecoConf/CMakeLists.txt b/Hlt/RecoConf/CMakeLists.txt index 9e79e74947ae70c30ba481ba0e725bef863f0d54..7b9b9ea90f0d48390a5f283bb82addb7b17f23d6 100644 --- a/Hlt/RecoConf/CMakeLists.txt +++ b/Hlt/RecoConf/CMakeLists.txt @@ -46,7 +46,7 @@ if(BUILD_TESTING AND NOT USE_DD4HEP) set_property( TEST RecoConf.phoenix_event_data_dump - RecoConf.hlt1_pvs_with_beamspotmoni_2023 + RecoConf.hlt1_pvs_with_beamspotmoni_2025 RecoConf.decoding.compare_hlt1_hlt2_muon_decoding_v3geometry_data_2023 PROPERTY DISABLED TRUE diff --git a/Hlt/RecoConf/options/hlt1_pvs_with_beamspotmoni_2023.py b/Hlt/RecoConf/options/hlt1_pvs_with_beamspotmoni_2025.py similarity index 56% rename from Hlt/RecoConf/options/hlt1_pvs_with_beamspotmoni_2023.py rename to Hlt/RecoConf/options/hlt1_pvs_with_beamspotmoni_2025.py index 8ee14270e947568a3b9b8591864c828f98163a55..86e0d5991343ee2a4a6649327074f30b13897b8d 100644 --- a/Hlt/RecoConf/options/hlt1_pvs_with_beamspotmoni_2023.py +++ b/Hlt/RecoConf/options/hlt1_pvs_with_beamspotmoni_2025.py @@ -11,6 +11,7 @@ from GaudiKernel.SystemOfUnits import mm, mm2 from PyConf.Algorithms import BeamSpotMonitor from PyConf.application import make_odin +from PyConf.control_flow import CompositeNode, NodeLogic from RecoConf.config import Reconstruction, run_reconstruction from RecoConf.decoders import default_VeloCluster_source from RecoConf.legacy_rec_hlt1_tracking import ( @@ -45,32 +46,86 @@ def run_hlt1_pvs_with_beamspotmoni(): ).OutputLocation } - beam_spot_moni = BeamSpotMonitor( - name="BeamSpotMonitor", + # Test various modes and configurations for BeamSpotMonitor. + # 1. FromDBFile mode, update triggered by small changes in x + beam_spot_moni_dbfile = BeamSpotMonitor( + name="BeamSpotMonitor_FromDBFile", ODINLocation=make_odin(), PVContainer=selected_pvs["v1"], + IRCondInitStrategy="FromDBFile", + MinPVsForCalib=200, + LogConditions=True, + MakeDBRunFile=True, + conditionsDbPath=".", + MaxAbsDeltaMap={ + "x": 0.002 * mm, + }, + ) + + # 2. Autonomous mode, updates triggered by a change in any quantity + beam_spot_moni_auto = BeamSpotMonitor( + name="BeamSpotMonitor_Autonomous", + ODINLocation=make_odin(), + PVContainer=selected_pvs["v1"], + IRCondInitStrategy="Autonomous", MinPVsForCalib=200, LogConditions=True, MakeDBRunFile=True, conditionsDbPath=".", - VeloOpenUpdates=True, MaxAbsDeltaMap={ "x": 0.0 * mm, "y": 0.0 * mm, + "z": 0.0 * mm, "xx": 0.0 * mm2, "xy": 0.0 * mm2, + "yx": 0.0 * mm2, "yy": 0.0 * mm2, + "zx": 0.0 * mm2, + "xz": 0.0 * mm2, + "yz": 0.0 * mm2, + "zy": 0.0 * mm2, + "zz": 0.0 * mm2, + "rho": 0.0 * mm, + "rho_at_z1": 0.0 * mm, + "rho_at_z2": 0.0 * mm, }, ) - data = [pvs["v1"], selected_pvs["v1"], beam_spot_moni] + + # 3. FromCond mode, updates triggered by difference in x but suppressed + # if difference is 'inconceivably large' + beam_spot_moni_cond = BeamSpotMonitor( + name="BeamSpotMonitor_FromCond", + ODINLocation=make_odin(), + PVContainer=selected_pvs["v1"], + IRCondInitStrategy="FromCond", + MinPVsForCalib=200, + LogConditions=True, + MakeDBRunFile=True, + conditionsDbPath=".", + MaxAbsDeltaMap={ + "x": 0.0 * mm, + }, + InconceivableHandling="WarnSkip", + InconceivableAbsDeltaMap={ + "x": 0.002 * mm, + }, + ) + + bsm_modes = CompositeNode( + "bsm_modes", + [beam_spot_moni_dbfile, beam_spot_moni_auto, beam_spot_moni_cond], + combine_logic=NodeLogic.NONLAZY_AND, + force_order=True, + ) + + data = [pvs["v1"], selected_pvs["v1"], bsm_modes] return Reconstruction("pvs_reco", data, reco_prefilters(skipUT=True)) -options.histo_file = "hlt1_pvs_with_beamspotmoni_2023.root" +options.histo_file = "hlt1_pvs_with_beamspotmoni_2025.root" with ( - default_VeloCluster_source.bind(bank_type="VPRetinaCluster"), make_VeloClusterTrackingSIMD.bind(SkipForward=4), make_PatPV3DFuture_pvs.bind( velo_open=True, use_3D_seeding=True, use_beam_spot_cut=False diff --git a/Hlt/RecoConf/tests/qmtest/hlt1_pvs_with_beamspotmoni_2023.qmt b/Hlt/RecoConf/tests/qmtest/hlt1_pvs_with_beamspotmoni_2025.qmt similarity index 62% rename from Hlt/RecoConf/tests/qmtest/hlt1_pvs_with_beamspotmoni_2023.qmt rename to Hlt/RecoConf/tests/qmtest/hlt1_pvs_with_beamspotmoni_2025.qmt index 5f020bf5760c40cf063627edf3befb8a00783f87..2ac84301b84b512724603d89c9f9972062bae16d 100644 --- a/Hlt/RecoConf/tests/qmtest/hlt1_pvs_with_beamspotmoni_2023.qmt +++ b/Hlt/RecoConf/tests/qmtest/hlt1_pvs_with_beamspotmoni_2025.qmt @@ -12,11 +12,11 @@ gaudirun.py - $MOOREROOT/tests/options/mdf_input_and_conds_data_2023.py - $RECOCONFROOT/options/hlt1_pvs_with_beamspotmoni_2023.py + $MOOREROOT/tests/options/default_input_and_conds_hlt2_2025_data.py + $RECOCONFROOT/options/hlt1_pvs_with_beamspotmoni_2025.py true -../refs/hlt1_pvs_with_beamspotmoni_2023.ref +../refs/hlt1_pvs_with_beamspotmoni_2025.ref ../refs/empty.ref from Moore.qmtest.exclusions import ref_preprocessor, counter_preprocessor, sensitivities @@ -25,30 +25,49 @@ validateWithReference( counter_preproc=counter_preprocessor, sensitivities=sensitivities) +# Expect two kinds of warnings, by design +warn_txt_dbinit = 'Attempt to initialize cached reference conditions from DB file failed' +warn_txt_incon = 'Provisional IR Conditions update beyond conceivable thresholds' + +from GaudiConf.QMTest.BaseTest import LineSkipper from Moore.qmtest.exclusions import remove_known_warnings +remove_my_known_warnings = (LineSkipper( + strings=[warn_txt_dbinit, warn_txt_incon]) + remove_known_warnings) countErrorLines({ "FATAL": 0, "ERROR": 0, "WARNING": 0 }, - stdout=remove_known_warnings(stdout)) + stdout=remove_my_known_warnings(stdout)) # Parse pathname of YAML files from stdout # Verify that at least one YAML file has been written +# Also check for occurrences of expected warnings import re from os.path import isfile pattern = re.compile( - r'BeamSpotMonitor\s+INFO Writing new conditions file (.+)') + r'BeamSpotMonitor_Autonomous\s+INFO Writing new conditions file (.+)') written = 0 found = 0 +warn_txt_dbinit_ctr = 0 +warn_txt_incon_ctr = 0 for line in stdout.split('\n'): + if line.find(warn_txt_dbinit) >= 0: warn_txt_dbinit_ctr += 1 + if line.find(warn_txt_incon) >= 0: warn_txt_incon_ctr += 1 m = re.match(pattern, line) if m: written += 1 yfile = m.group(1) if isfile(yfile): found += 1 +if warn_txt_dbinit_ctr != 1: + causes.append( + "Missing/too many DB init warnings (%d/1)" % (warn_txt_dbinit_ctr)) + +if warn_txt_incon_ctr == 0: + causes.append("Missing inconceivable warning") + if written == 0: causes.append('No output YAML file written') diff --git a/Hlt/RecoConf/tests/refs/hlt1_pvs_with_beamspotmoni_2023.ref b/Hlt/RecoConf/tests/refs/hlt1_pvs_with_beamspotmoni_2025.ref similarity index 100% rename from Hlt/RecoConf/tests/refs/hlt1_pvs_with_beamspotmoni_2023.ref rename to Hlt/RecoConf/tests/refs/hlt1_pvs_with_beamspotmoni_2025.ref diff --git a/Hlt/RecoConf/tests/refs/hlt1_pvs_with_beamspotmoni_2023.ref.armv8.1_a b/Hlt/RecoConf/tests/refs/hlt1_pvs_with_beamspotmoni_2025.ref.armv8.1_a similarity index 100% rename from Hlt/RecoConf/tests/refs/hlt1_pvs_with_beamspotmoni_2023.ref.armv8.1_a rename to Hlt/RecoConf/tests/refs/hlt1_pvs_with_beamspotmoni_2025.ref.armv8.1_a diff --git a/Hlt/RecoConf/tests/refs/hlt1_pvs_with_beamspotmoni_2023.ref.x86_64_v3-opt b/Hlt/RecoConf/tests/refs/hlt1_pvs_with_beamspotmoni_2025.ref.x86_64_v3-opt similarity index 100% rename from Hlt/RecoConf/tests/refs/hlt1_pvs_with_beamspotmoni_2023.ref.x86_64_v3-opt rename to Hlt/RecoConf/tests/refs/hlt1_pvs_with_beamspotmoni_2025.ref.x86_64_v3-opt