From 9874f9ebbcd9a1ac5fe4458f07b6a5d416993601 Mon Sep 17 00:00:00 2001
From: Titus Mombaecher <titus.mombacher@cern.ch>
Date: Wed, 2 Apr 2025 12:10:01 +0200
Subject: [PATCH 1/7] monitoring task for detector correlations

---
 MooreOnlineConf/options/correlations.py       | 121 ++++++++++++++++++
 MooreScripts/job/runCorrelMon.sh              |  30 +++++
 MooreScripts/tests/options/CorrelMon/Arch.xml |  49 +++++++
 .../tests/options/CorrelMon/OnlineEnv.opts    |   8 ++
 .../tests/options/CorrelMon/OnlineEnvBase.py  |   1 +
 5 files changed, 209 insertions(+)
 create mode 100644 MooreOnlineConf/options/correlations.py
 create mode 100755 MooreScripts/job/runCorrelMon.sh
 create mode 100644 MooreScripts/tests/options/CorrelMon/Arch.xml
 create mode 100644 MooreScripts/tests/options/CorrelMon/OnlineEnv.opts
 create mode 120000 MooreScripts/tests/options/CorrelMon/OnlineEnvBase.py

diff --git a/MooreOnlineConf/options/correlations.py b/MooreOnlineConf/options/correlations.py
new file mode 100644
index 000000000..301f21d99
--- /dev/null
+++ b/MooreOnlineConf/options/correlations.py
@@ -0,0 +1,121 @@
+###############################################################################
+# (c) Copyright 2021 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.                                       #
+###############################################################################
+import os
+from Moore import options
+from RecoConf.config import Reconstruction, run_reconstruction
+from RecoConf.standalone import reco_prefilters
+from Hlt2Conf.settings.hlt2_binds import config_pp_2025
+
+from MooreOnlineConf.utils import update_and_reset, if_then, run_all, common_monitors_node
+
+from RecoConf.legacy_rec_hlt1_tracking import make_VeloClusterTrackingSIMD_hits
+from RecoConf.hlt2_tracking import (
+    make_PrStoreSciFiHits_hits,
+    make_PrStoreUTHit_hits,
+)
+from RecoConf.muonid import make_muon_hits
+from RecoConf.rich_reconstruction import default_rich_reco_options, make_rich_pixels
+from RecoConf.calorimeter_reconstruction import make_digits, make_clusters
+
+from PyConf.Algorithms import LHCb__IOVReset as IOVReset, OdinTypesFilter, HltRoutingBitsFilter, MonitorDetectorCorrelations
+from PyConf.application import make_odin
+
+
+def corrmon_reco(suffix):
+
+    velohits = make_VeloClusterTrackingSIMD_hits()
+    scifihits = make_PrStoreSciFiHits_hits()
+    muonhits = make_muon_hits()
+    rich_pixels = make_rich_pixels(default_rich_reco_options())
+    uthits = make_PrStoreUTHit_hits()
+    digits = make_digits(calo_raw_bank=True)
+    ecalClusters = make_clusters(digits["digitsEcal"])
+    calo_objects = digits | {
+        "ecalClusters": ecalClusters,
+    }
+
+    data = [
+        MonitorDetectorCorrelations(
+            name="MonitorDetectorCorrelations_"+suffix,
+            allow_duplicate_instances_with_distinct_names=True,
+            VeloHits=velohits,
+            SciFiHits=scifihits,
+            UTHits=uthits,
+            MuonHits=muonhits,
+            ECALClusters=calo_objects["ecalClusters"],
+            ECALDigits=calo_objects["digitsEcal"],
+            HCALDigits=calo_objects["digitsHcal"],
+            RichPixels=rich_pixels["RichDecodedData"],
+            CollisionType="pp",
+        ),  # set pp for pp, PbPb for PbPb
+        MonitorDetectorCorrelations(
+            name="MonitorDetectorCorrelations_coarse_"+suffix,
+            allow_duplicate_instances_with_distinct_names=True,
+            VeloHits=velohits,
+            SciFiHits=scifihits,
+            UTHits=uthits,
+            MuonHits=muonhits,
+            ECALClusters=calo_objects["ecalClusters"],
+            ECALDigits=calo_objects["digitsEcal"],
+            HCALDigits=calo_objects["digitsHcal"],
+            RichPixels=rich_pixels["RichDecodedData"],
+            CollisionType="PbPb",
+        ),  # set pp for pp, PbPb for PbPb
+    ]
+
+    return Reconstruction(
+        "corrmon_reco_"+suffix,
+        data,
+    )
+
+
+task_type = os.getenv("TASK_TYPE", "GenericTask")
+
+## Global event cut specifications:
+# If a GEC is applied (as is set explicitly in the bind below)
+# prefer to make explicit so it's clear which a GEC is applied
+GEC_cut = 10_000
+
+
+def with_update_and_reset():
+
+    # reco = corrmon_reco()
+
+    if options.input_type.lower() == 'online':
+        odin_bb_filter = OdinTypesFilter(
+            ODIN=make_odin(), BXTypes=['BeamCrossing'])
+        odin_be_filter = OdinTypesFilter(
+            ODIN=make_odin(), BXTypes=[
+                'Beam1'
+            ])  # only filter on SMOG collisions that fly into LHCb
+
+        top_node = run_all(
+            "top",
+            [
+                common_monitors_node(),  # common monitoring to all tasks
+                if_then("IfBB", odin_bb_filter, corrmon_reco(suffix="bb").node),
+                if_then("IfBE", odin_be_filter, corrmon_reco(suffix="be").node),
+            ])
+
+        return Reconstruction(
+            "with_update_and_reset", [top_node],
+            filters=[IOVReset(ODIN=make_odin()),
+                update_and_reset()])
+    return reco
+
+
+# NOTE the switch to retina clusters is done in vp_retina_clusters.py
+# the global event cut is added for the PbPb run case, in doubt remove for pp
+with config_pp_2025(), reco_prefilters.bind(
+        gec=False,
+        gec_cut=1e11,
+):
+    run_reconstruction(options, with_update_and_reset)
diff --git a/MooreScripts/job/runCorrelMon.sh b/MooreScripts/job/runCorrelMon.sh
new file mode 100755
index 000000000..573ea43e4
--- /dev/null
+++ b/MooreScripts/job/runCorrelMon.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+###############################################################################
+# (c) Copyright 2000-2021 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.                                       #
+###############################################################################
+set -euo pipefail
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
+source "$DIR/setupTask.sh"
+
+setup_options_path MONITORING
+settings=$(python -c 'import OnlineEnvBase; print(OnlineEnvBase.HLTType)')
+
+vp_options=$MOOREONLINECONFROOT/options/vp_retina_clusters.py
+if [[ $settings == *"veloSP" ]]; then
+    echo "RecoMon: configuring VELO SP algorithms based on current trigger config $settings"
+    vp_options=$MOOREONLINECONFROOT/options/vp_veloSP.py
+fi
+
+exec_gaudirun \
+    $MOOREONLINECONFROOT/options/tags-master.py \
+    $MOOREONLINECONFROOT/options/verbosity.py \
+    $vp_options \
+    $MOOREONLINECONFROOT/options/correlations.py \
+    $MOOREONLINECONFROOT/options/online.py
diff --git a/MooreScripts/tests/options/CorrelMon/Arch.xml b/MooreScripts/tests/options/CorrelMon/Arch.xml
new file mode 100644
index 000000000..1f6cad4d4
--- /dev/null
+++ b/MooreScripts/tests/options/CorrelMon/Arch.xml
@@ -0,0 +1,49 @@
+<!--
+    (c) Copyright 2021-2022 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.
+-->
+<tasks_inventory>
+
+  <task name="MBM" user="${USER}" group="${GROUP}">
+    <command>${MOORESCRIPTSROOT}/scripts/runDFTask.sh</command>
+    <argument name="-type" value="${NAME}" />
+    <argument name="-runinfo" value="${RUNINFO}" />
+    <argument name="-options" value="${MOORESCRIPTSROOT}/options/MonMBM.opts" />
+    <argument name="-class" value="Class0" />
+    <fmcparam name="utgid" value="${PARTITION}_${NODE}_${NAME}_${INSTANCE}" />
+    <fmcparam name="define" value="BINARY_TAG=${BINARY_TAG}" />
+    <fmcparam name="define" value="WORKING_DIR=${WORKING_DIR}" />
+    <timeout action="Any" value="20" />
+  </task>
+
+  <task name="MDFProd" user="${USER}" group="${GROUP}">
+    <command>${MOORESCRIPTSROOT}/scripts/runDFTask.sh</command>
+    <argument name="-type" value="${NAME}" />
+    <argument name="-runinfo" value="${RUNINFO}" />
+    <argument name="-options" value="${MOORESCRIPTSROOT}/options/MDFProd.opts" />
+    <argument name="-class" value="Class2" />
+    <fmcparam name="utgid" value="${PARTITION}_${NODE}_${NAME}_${INSTANCE}" />
+    <fmcparam name="define" value="BINARY_TAG=${BINARY_TAG}" />
+    <fmcparam name="define" value="WORKING_DIR=${WORKING_DIR}" />
+    <timeout action="Any" value="30" />
+  </task>
+
+  <task name="CorrelMon" user="${USER}" group="${GROUP}" instances="NUMBER_OF_INSTANCES">
+    <command>${MOORESCRIPTSROOT}/job/runCorrelMon.sh</command>
+    <argument name="-type" value="${NAME}" />
+    <argument name="-runinfo" value="${RUNINFO}" />
+    <argument name="-class" value="Class1" />
+    <fmcparam name="utgid" value="${PARTITION}_${NODE}_${NAME}_${INSTANCE}" />
+    <fmcparam name="define" value="BINARY_TAG=${BINARY_TAG}" />
+    <fmcparam name="define" value="WORKING_DIR=${WORKING_DIR}" />
+    <timeout action="Any" value="120" />
+    <timeout action="load" value="20" />
+  </task>
+
+</tasks_inventory>
diff --git a/MooreScripts/tests/options/CorrelMon/OnlineEnv.opts b/MooreScripts/tests/options/CorrelMon/OnlineEnv.opts
new file mode 100644
index 000000000..cb8763439
--- /dev/null
+++ b/MooreScripts/tests/options/CorrelMon/OnlineEnv.opts
@@ -0,0 +1,8 @@
+OnlineEnv.PartitionID         = 65535;
+OnlineEnv.PartitionName       = "TESTBEAMGUI";
+OnlineEnv.Activity            = "PHYSICS";
+OnlineEnv.OutputLevel         = 3;
+//
+OnlineEnv.Reader_Rescan       = 0;
+OnlineEnv.Reader_Directories  = {"/hlt2/objects/LHCb/0000255983"};
+OnlineEnv.Reader_FilePrefix   = "Run_0000255983_HLT22610_20230204";
\ No newline at end of file
diff --git a/MooreScripts/tests/options/CorrelMon/OnlineEnvBase.py b/MooreScripts/tests/options/CorrelMon/OnlineEnvBase.py
new file mode 120000
index 000000000..210ce4c03
--- /dev/null
+++ b/MooreScripts/tests/options/CorrelMon/OnlineEnvBase.py
@@ -0,0 +1 @@
+../OnlineEnvBase.py
\ No newline at end of file
-- 
GitLab


From 3a3ceba4151b11965e2c1cf5693fd907a2cbb47e Mon Sep 17 00:00:00 2001
From: Gitlab CI <noreply@cern.ch>
Date: Wed, 2 Apr 2025 10:22:52 +0000
Subject: [PATCH 2/7] Fixed formatting

patch generated by https://gitlab.cern.ch/lhcb/MooreOnline/-/jobs/54048713
---
 MooreOnlineConf/options/correlations.py | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/MooreOnlineConf/options/correlations.py b/MooreOnlineConf/options/correlations.py
index 301f21d99..636fb7094 100644
--- a/MooreOnlineConf/options/correlations.py
+++ b/MooreOnlineConf/options/correlations.py
@@ -44,7 +44,7 @@ def corrmon_reco(suffix):
 
     data = [
         MonitorDetectorCorrelations(
-            name="MonitorDetectorCorrelations_"+suffix,
+            name="MonitorDetectorCorrelations_" + suffix,
             allow_duplicate_instances_with_distinct_names=True,
             VeloHits=velohits,
             SciFiHits=scifihits,
@@ -57,7 +57,7 @@ def corrmon_reco(suffix):
             CollisionType="pp",
         ),  # set pp for pp, PbPb for PbPb
         MonitorDetectorCorrelations(
-            name="MonitorDetectorCorrelations_coarse_"+suffix,
+            name="MonitorDetectorCorrelations_coarse_" + suffix,
             allow_duplicate_instances_with_distinct_names=True,
             VeloHits=velohits,
             SciFiHits=scifihits,
@@ -72,7 +72,7 @@ def corrmon_reco(suffix):
     ]
 
     return Reconstruction(
-        "corrmon_reco_"+suffix,
+        "corrmon_reco_" + suffix,
         data,
     )
 
@@ -101,14 +101,16 @@ def with_update_and_reset():
             "top",
             [
                 common_monitors_node(),  # common monitoring to all tasks
-                if_then("IfBB", odin_bb_filter, corrmon_reco(suffix="bb").node),
-                if_then("IfBE", odin_be_filter, corrmon_reco(suffix="be").node),
+                if_then("IfBB", odin_bb_filter,
+                        corrmon_reco(suffix="bb").node),
+                if_then("IfBE", odin_be_filter,
+                        corrmon_reco(suffix="be").node),
             ])
 
         return Reconstruction(
             "with_update_and_reset", [top_node],
             filters=[IOVReset(ODIN=make_odin()),
-                update_and_reset()])
+                     update_and_reset()])
     return reco
 
 
-- 
GitLab


From fea592cad0c5ee890857833ad0831b66e050d8b6 Mon Sep 17 00:00:00 2001
From: Titus Mombaecher <titus.mombacher@cern.ch>
Date: Wed, 2 Apr 2025 12:10:01 +0200
Subject: [PATCH 3/7] monitoring task for detector correlations

---
 MooreOnlineConf/options/correlations.py       | 121 ++++++++++++++++++
 MooreScripts/job/runCorrelMon.sh              |  30 +++++
 MooreScripts/tests/options/CorrelMon/Arch.xml |  49 +++++++
 .../tests/options/CorrelMon/OnlineEnv.opts    |   8 ++
 .../tests/options/CorrelMon/OnlineEnvBase.py  |   1 +
 5 files changed, 209 insertions(+)
 create mode 100644 MooreOnlineConf/options/correlations.py
 create mode 100755 MooreScripts/job/runCorrelMon.sh
 create mode 100644 MooreScripts/tests/options/CorrelMon/Arch.xml
 create mode 100644 MooreScripts/tests/options/CorrelMon/OnlineEnv.opts
 create mode 120000 MooreScripts/tests/options/CorrelMon/OnlineEnvBase.py

diff --git a/MooreOnlineConf/options/correlations.py b/MooreOnlineConf/options/correlations.py
new file mode 100644
index 000000000..301f21d99
--- /dev/null
+++ b/MooreOnlineConf/options/correlations.py
@@ -0,0 +1,121 @@
+###############################################################################
+# (c) Copyright 2021 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.                                       #
+###############################################################################
+import os
+from Moore import options
+from RecoConf.config import Reconstruction, run_reconstruction
+from RecoConf.standalone import reco_prefilters
+from Hlt2Conf.settings.hlt2_binds import config_pp_2025
+
+from MooreOnlineConf.utils import update_and_reset, if_then, run_all, common_monitors_node
+
+from RecoConf.legacy_rec_hlt1_tracking import make_VeloClusterTrackingSIMD_hits
+from RecoConf.hlt2_tracking import (
+    make_PrStoreSciFiHits_hits,
+    make_PrStoreUTHit_hits,
+)
+from RecoConf.muonid import make_muon_hits
+from RecoConf.rich_reconstruction import default_rich_reco_options, make_rich_pixels
+from RecoConf.calorimeter_reconstruction import make_digits, make_clusters
+
+from PyConf.Algorithms import LHCb__IOVReset as IOVReset, OdinTypesFilter, HltRoutingBitsFilter, MonitorDetectorCorrelations
+from PyConf.application import make_odin
+
+
+def corrmon_reco(suffix):
+
+    velohits = make_VeloClusterTrackingSIMD_hits()
+    scifihits = make_PrStoreSciFiHits_hits()
+    muonhits = make_muon_hits()
+    rich_pixels = make_rich_pixels(default_rich_reco_options())
+    uthits = make_PrStoreUTHit_hits()
+    digits = make_digits(calo_raw_bank=True)
+    ecalClusters = make_clusters(digits["digitsEcal"])
+    calo_objects = digits | {
+        "ecalClusters": ecalClusters,
+    }
+
+    data = [
+        MonitorDetectorCorrelations(
+            name="MonitorDetectorCorrelations_"+suffix,
+            allow_duplicate_instances_with_distinct_names=True,
+            VeloHits=velohits,
+            SciFiHits=scifihits,
+            UTHits=uthits,
+            MuonHits=muonhits,
+            ECALClusters=calo_objects["ecalClusters"],
+            ECALDigits=calo_objects["digitsEcal"],
+            HCALDigits=calo_objects["digitsHcal"],
+            RichPixels=rich_pixels["RichDecodedData"],
+            CollisionType="pp",
+        ),  # set pp for pp, PbPb for PbPb
+        MonitorDetectorCorrelations(
+            name="MonitorDetectorCorrelations_coarse_"+suffix,
+            allow_duplicate_instances_with_distinct_names=True,
+            VeloHits=velohits,
+            SciFiHits=scifihits,
+            UTHits=uthits,
+            MuonHits=muonhits,
+            ECALClusters=calo_objects["ecalClusters"],
+            ECALDigits=calo_objects["digitsEcal"],
+            HCALDigits=calo_objects["digitsHcal"],
+            RichPixels=rich_pixels["RichDecodedData"],
+            CollisionType="PbPb",
+        ),  # set pp for pp, PbPb for PbPb
+    ]
+
+    return Reconstruction(
+        "corrmon_reco_"+suffix,
+        data,
+    )
+
+
+task_type = os.getenv("TASK_TYPE", "GenericTask")
+
+## Global event cut specifications:
+# If a GEC is applied (as is set explicitly in the bind below)
+# prefer to make explicit so it's clear which a GEC is applied
+GEC_cut = 10_000
+
+
+def with_update_and_reset():
+
+    # reco = corrmon_reco()
+
+    if options.input_type.lower() == 'online':
+        odin_bb_filter = OdinTypesFilter(
+            ODIN=make_odin(), BXTypes=['BeamCrossing'])
+        odin_be_filter = OdinTypesFilter(
+            ODIN=make_odin(), BXTypes=[
+                'Beam1'
+            ])  # only filter on SMOG collisions that fly into LHCb
+
+        top_node = run_all(
+            "top",
+            [
+                common_monitors_node(),  # common monitoring to all tasks
+                if_then("IfBB", odin_bb_filter, corrmon_reco(suffix="bb").node),
+                if_then("IfBE", odin_be_filter, corrmon_reco(suffix="be").node),
+            ])
+
+        return Reconstruction(
+            "with_update_and_reset", [top_node],
+            filters=[IOVReset(ODIN=make_odin()),
+                update_and_reset()])
+    return reco
+
+
+# NOTE the switch to retina clusters is done in vp_retina_clusters.py
+# the global event cut is added for the PbPb run case, in doubt remove for pp
+with config_pp_2025(), reco_prefilters.bind(
+        gec=False,
+        gec_cut=1e11,
+):
+    run_reconstruction(options, with_update_and_reset)
diff --git a/MooreScripts/job/runCorrelMon.sh b/MooreScripts/job/runCorrelMon.sh
new file mode 100755
index 000000000..573ea43e4
--- /dev/null
+++ b/MooreScripts/job/runCorrelMon.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+###############################################################################
+# (c) Copyright 2000-2021 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.                                       #
+###############################################################################
+set -euo pipefail
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
+source "$DIR/setupTask.sh"
+
+setup_options_path MONITORING
+settings=$(python -c 'import OnlineEnvBase; print(OnlineEnvBase.HLTType)')
+
+vp_options=$MOOREONLINECONFROOT/options/vp_retina_clusters.py
+if [[ $settings == *"veloSP" ]]; then
+    echo "RecoMon: configuring VELO SP algorithms based on current trigger config $settings"
+    vp_options=$MOOREONLINECONFROOT/options/vp_veloSP.py
+fi
+
+exec_gaudirun \
+    $MOOREONLINECONFROOT/options/tags-master.py \
+    $MOOREONLINECONFROOT/options/verbosity.py \
+    $vp_options \
+    $MOOREONLINECONFROOT/options/correlations.py \
+    $MOOREONLINECONFROOT/options/online.py
diff --git a/MooreScripts/tests/options/CorrelMon/Arch.xml b/MooreScripts/tests/options/CorrelMon/Arch.xml
new file mode 100644
index 000000000..1f6cad4d4
--- /dev/null
+++ b/MooreScripts/tests/options/CorrelMon/Arch.xml
@@ -0,0 +1,49 @@
+<!--
+    (c) Copyright 2021-2022 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.
+-->
+<tasks_inventory>
+
+  <task name="MBM" user="${USER}" group="${GROUP}">
+    <command>${MOORESCRIPTSROOT}/scripts/runDFTask.sh</command>
+    <argument name="-type" value="${NAME}" />
+    <argument name="-runinfo" value="${RUNINFO}" />
+    <argument name="-options" value="${MOORESCRIPTSROOT}/options/MonMBM.opts" />
+    <argument name="-class" value="Class0" />
+    <fmcparam name="utgid" value="${PARTITION}_${NODE}_${NAME}_${INSTANCE}" />
+    <fmcparam name="define" value="BINARY_TAG=${BINARY_TAG}" />
+    <fmcparam name="define" value="WORKING_DIR=${WORKING_DIR}" />
+    <timeout action="Any" value="20" />
+  </task>
+
+  <task name="MDFProd" user="${USER}" group="${GROUP}">
+    <command>${MOORESCRIPTSROOT}/scripts/runDFTask.sh</command>
+    <argument name="-type" value="${NAME}" />
+    <argument name="-runinfo" value="${RUNINFO}" />
+    <argument name="-options" value="${MOORESCRIPTSROOT}/options/MDFProd.opts" />
+    <argument name="-class" value="Class2" />
+    <fmcparam name="utgid" value="${PARTITION}_${NODE}_${NAME}_${INSTANCE}" />
+    <fmcparam name="define" value="BINARY_TAG=${BINARY_TAG}" />
+    <fmcparam name="define" value="WORKING_DIR=${WORKING_DIR}" />
+    <timeout action="Any" value="30" />
+  </task>
+
+  <task name="CorrelMon" user="${USER}" group="${GROUP}" instances="NUMBER_OF_INSTANCES">
+    <command>${MOORESCRIPTSROOT}/job/runCorrelMon.sh</command>
+    <argument name="-type" value="${NAME}" />
+    <argument name="-runinfo" value="${RUNINFO}" />
+    <argument name="-class" value="Class1" />
+    <fmcparam name="utgid" value="${PARTITION}_${NODE}_${NAME}_${INSTANCE}" />
+    <fmcparam name="define" value="BINARY_TAG=${BINARY_TAG}" />
+    <fmcparam name="define" value="WORKING_DIR=${WORKING_DIR}" />
+    <timeout action="Any" value="120" />
+    <timeout action="load" value="20" />
+  </task>
+
+</tasks_inventory>
diff --git a/MooreScripts/tests/options/CorrelMon/OnlineEnv.opts b/MooreScripts/tests/options/CorrelMon/OnlineEnv.opts
new file mode 100644
index 000000000..cb8763439
--- /dev/null
+++ b/MooreScripts/tests/options/CorrelMon/OnlineEnv.opts
@@ -0,0 +1,8 @@
+OnlineEnv.PartitionID         = 65535;
+OnlineEnv.PartitionName       = "TESTBEAMGUI";
+OnlineEnv.Activity            = "PHYSICS";
+OnlineEnv.OutputLevel         = 3;
+//
+OnlineEnv.Reader_Rescan       = 0;
+OnlineEnv.Reader_Directories  = {"/hlt2/objects/LHCb/0000255983"};
+OnlineEnv.Reader_FilePrefix   = "Run_0000255983_HLT22610_20230204";
\ No newline at end of file
diff --git a/MooreScripts/tests/options/CorrelMon/OnlineEnvBase.py b/MooreScripts/tests/options/CorrelMon/OnlineEnvBase.py
new file mode 120000
index 000000000..210ce4c03
--- /dev/null
+++ b/MooreScripts/tests/options/CorrelMon/OnlineEnvBase.py
@@ -0,0 +1 @@
+../OnlineEnvBase.py
\ No newline at end of file
-- 
GitLab


From c7a78456a9a89dfaeff71400139100ade01b4af4 Mon Sep 17 00:00:00 2001
From: Gitlab CI <noreply@cern.ch>
Date: Wed, 2 Apr 2025 10:22:52 +0000
Subject: [PATCH 4/7] Fixed formatting

patch generated by https://gitlab.cern.ch/lhcb/MooreOnline/-/jobs/54048713
---
 MooreOnlineConf/options/correlations.py | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/MooreOnlineConf/options/correlations.py b/MooreOnlineConf/options/correlations.py
index 301f21d99..636fb7094 100644
--- a/MooreOnlineConf/options/correlations.py
+++ b/MooreOnlineConf/options/correlations.py
@@ -44,7 +44,7 @@ def corrmon_reco(suffix):
 
     data = [
         MonitorDetectorCorrelations(
-            name="MonitorDetectorCorrelations_"+suffix,
+            name="MonitorDetectorCorrelations_" + suffix,
             allow_duplicate_instances_with_distinct_names=True,
             VeloHits=velohits,
             SciFiHits=scifihits,
@@ -57,7 +57,7 @@ def corrmon_reco(suffix):
             CollisionType="pp",
         ),  # set pp for pp, PbPb for PbPb
         MonitorDetectorCorrelations(
-            name="MonitorDetectorCorrelations_coarse_"+suffix,
+            name="MonitorDetectorCorrelations_coarse_" + suffix,
             allow_duplicate_instances_with_distinct_names=True,
             VeloHits=velohits,
             SciFiHits=scifihits,
@@ -72,7 +72,7 @@ def corrmon_reco(suffix):
     ]
 
     return Reconstruction(
-        "corrmon_reco_"+suffix,
+        "corrmon_reco_" + suffix,
         data,
     )
 
@@ -101,14 +101,16 @@ def with_update_and_reset():
             "top",
             [
                 common_monitors_node(),  # common monitoring to all tasks
-                if_then("IfBB", odin_bb_filter, corrmon_reco(suffix="bb").node),
-                if_then("IfBE", odin_be_filter, corrmon_reco(suffix="be").node),
+                if_then("IfBB", odin_bb_filter,
+                        corrmon_reco(suffix="bb").node),
+                if_then("IfBE", odin_be_filter,
+                        corrmon_reco(suffix="be").node),
             ])
 
         return Reconstruction(
             "with_update_and_reset", [top_node],
             filters=[IOVReset(ODIN=make_odin()),
-                update_and_reset()])
+                     update_and_reset()])
     return reco
 
 
-- 
GitLab


From ae887999c71c9d983e54c79065c727a9dcab5fc1 Mon Sep 17 00:00:00 2001
From: Pawel Kopciewicz <Pawel.Kopciewicz@cern.ch>
Date: Thu, 3 Apr 2025 19:17:04 +0200
Subject: [PATCH 5/7] Add correlmon.qmt test

---
 MooreScripts/tests/qmtest/correlmon.qmt | 27 +++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 MooreScripts/tests/qmtest/correlmon.qmt

diff --git a/MooreScripts/tests/qmtest/correlmon.qmt b/MooreScripts/tests/qmtest/correlmon.qmt
new file mode 100644
index 000000000..238145e94
--- /dev/null
+++ b/MooreScripts/tests/qmtest/correlmon.qmt
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE extension  PUBLIC '-//QM/2.3/Extension//EN'  'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'>
+<!--
+    (c) Copyright 2025 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.
+-->
+<!--
+Run a CorrelMon job in the Online testbench
+-->
+<extension class="GaudiTest.GaudiExeTest" kind="test">
+<argument name="program"><text>$MOORESCRIPTSROOT/scripts/testbench.py</text></argument>
+<argument name="args"><set>
+  <text>$MOORESCRIPTSROOT/tests/options/CorrelMon/Arch.xml</text>
+  <text>--working-dir=correlmon</text>
+  <text>--partition=TESTCORRRELMON</text>
+  <text>--test-file-db-key=2024_data_for_monitoring</text>
+</set></argument>
+<argument name="timeout"><integer>1200</integer></argument>
+<argument name="use_temp_dir"><enumeral>true</enumeral></argument>
+<argument name="validator"><text>
+</text></argument>
+</extension>
-- 
GitLab


From 87872f969d77c3e9dd521288e19622916daa94c0 Mon Sep 17 00:00:00 2001
From: Titus Mombaecher <titus.mombacher@cern.ch>
Date: Mon, 7 Apr 2025 11:15:20 +0200
Subject: [PATCH 6/7] add lumi routing bit

---
 MooreOnlineConf/options/correlations.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/MooreOnlineConf/options/correlations.py b/MooreOnlineConf/options/correlations.py
index 636fb7094..db810af97 100644
--- a/MooreOnlineConf/options/correlations.py
+++ b/MooreOnlineConf/options/correlations.py
@@ -14,7 +14,7 @@ from RecoConf.config import Reconstruction, run_reconstruction
 from RecoConf.standalone import reco_prefilters
 from Hlt2Conf.settings.hlt2_binds import config_pp_2025
 
-from MooreOnlineConf.utils import update_and_reset, if_then, run_all, common_monitors_node
+from MooreOnlineConf.utils import update_and_reset, if_then, run_all, common_monitors_node, passes_rb, RoutingBit
 
 from RecoConf.legacy_rec_hlt1_tracking import make_VeloClusterTrackingSIMD_hits
 from RecoConf.hlt2_tracking import (
@@ -87,8 +87,6 @@ GEC_cut = 10_000
 
 def with_update_and_reset():
 
-    # reco = corrmon_reco()
-
     if options.input_type.lower() == 'online':
         odin_bb_filter = OdinTypesFilter(
             ODIN=make_odin(), BXTypes=['BeamCrossing'])
@@ -110,7 +108,7 @@ def with_update_and_reset():
         return Reconstruction(
             "with_update_and_reset", [top_node],
             filters=[IOVReset(ODIN=make_odin()),
-                     update_and_reset()])
+                     update_and_reset(), passes_rb(RoutingBit.LUMI)])
     return reco
 
 
-- 
GitLab


From 2555d246a200dffcf7a78e9fa3795f5d44a56b02 Mon Sep 17 00:00:00 2001
From: Gitlab CI <noreply@cern.ch>
Date: Mon, 7 Apr 2025 09:16:07 +0000
Subject: [PATCH 7/7] Fixed formatting

patch generated by https://gitlab.cern.ch/lhcb/MooreOnline/-/jobs/54276455
---
 MooreOnlineConf/options/correlations.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/MooreOnlineConf/options/correlations.py b/MooreOnlineConf/options/correlations.py
index db810af97..dd1f53324 100644
--- a/MooreOnlineConf/options/correlations.py
+++ b/MooreOnlineConf/options/correlations.py
@@ -107,8 +107,11 @@ def with_update_and_reset():
 
         return Reconstruction(
             "with_update_and_reset", [top_node],
-            filters=[IOVReset(ODIN=make_odin()),
-                     update_and_reset(), passes_rb(RoutingBit.LUMI)])
+            filters=[
+                IOVReset(ODIN=make_odin()),
+                update_and_reset(),
+                passes_rb(RoutingBit.LUMI)
+            ])
     return reco
 
 
-- 
GitLab