diff --git a/MooreOnlineConf/options/correlations.py b/MooreOnlineConf/options/correlations.py new file mode 100644 index 0000000000000000000000000000000000000000..dd1f53324819e7b37d1aeb2fca8a2ba72d41e88f --- /dev/null +++ b/MooreOnlineConf/options/correlations.py @@ -0,0 +1,124 @@ +############################################################################### +# (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, passes_rb, RoutingBit + +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(): + + 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(), + passes_rb(RoutingBit.LUMI) + ]) + 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 0000000000000000000000000000000000000000..573ea43e47f12d34cb4afe468edd74f70f5ec308 --- /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 0000000000000000000000000000000000000000..1f6cad4d4565c7c48a9fe46ced3be1c16dc2cfe1 --- /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 0000000000000000000000000000000000000000..cb8763439c62b088f8e048d4a5050ff487c3aabe --- /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 0000000000000000000000000000000000000000..210ce4c03ef0fdf2323ceaa0df4494c599b143b6 --- /dev/null +++ b/MooreScripts/tests/options/CorrelMon/OnlineEnvBase.py @@ -0,0 +1 @@ +../OnlineEnvBase.py \ No newline at end of file diff --git a/MooreScripts/tests/qmtest/correlmon.qmt b/MooreScripts/tests/qmtest/correlmon.qmt new file mode 100644 index 0000000000000000000000000000000000000000..238145e94e9901dbc0478a9ae001f0a61369bd05 --- /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>