From 0af5e50dd19b8fd5e04a5386e2df98620796b97c Mon Sep 17 00:00:00 2001 From: Jonathan Bossio <jonathan.bossio@cern.ch> Date: Fri, 19 Jun 2020 13:14:18 +0200 Subject: [PATCH] Monitor HLT jet multiplicity and basic kinematics --- Reconstruction/Jet/JetRec/CMakeLists.txt | 5 +++-- Reconstruction/Jet/JetRec/JetRec/JetRecTool.h | 5 +++++ Reconstruction/Jet/JetRec/Root/JetRecTool.cxx | 13 +++++++++++++ Reconstruction/Jet/JetRec/python/JetOnlineMon.py | 13 +++++++++++++ .../Jet/JetRecConfig/python/JetRecConfig.py | 3 ++- .../python/HLTMenuConfig/Jet/JetRecoSequences.py | 6 +++++- 6 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 Reconstruction/Jet/JetRec/python/JetOnlineMon.py diff --git a/Reconstruction/Jet/JetRec/CMakeLists.txt b/Reconstruction/Jet/JetRec/CMakeLists.txt index 9ddd74e891a..a9d0b6e43a3 100644 --- a/Reconstruction/Jet/JetRec/CMakeLists.txt +++ b/Reconstruction/Jet/JetRec/CMakeLists.txt @@ -17,6 +17,7 @@ atlas_depends_on_subdirs( PUBLIC Control/AthLinks Control/AthContainers + Control/AthenaMonitoringKernel Control/AthToolSupport/AsgTools Event/xAOD/xAODCaloEvent Event/xAOD/xAODJet @@ -49,12 +50,12 @@ atlas_add_library( JetRecLib xAODCaloEvent xAODJet xAODMuon EventShapeInterface JetEDM JetInterface PRIVATE_LINK_LIBRARIES ${FASTJETCONTRIB_LIBRARIES} CxxUtils xAODBase xAODCore - xAODEventInfo xAODTracking ) + xAODEventInfo xAODTracking AthenaMonitoringKernelLib) if( NOT XAOD_STANDALONE ) atlas_add_component( JetRec src/*.h src/*.cxx src/components/*.cxx - LINK_LIBRARIES GaudiKernel AthenaBaseComps JetInterface JetRecLib ) + LINK_LIBRARIES GaudiKernel AthenaBaseComps JetInterface JetRecLib AthenaMonitoringKernelLib ) endif() atlas_add_dictionary( JetRecDict diff --git a/Reconstruction/Jet/JetRec/JetRec/JetRecTool.h b/Reconstruction/Jet/JetRec/JetRec/JetRecTool.h index dfa046763bc..3f2928b9d12 100644 --- a/Reconstruction/Jet/JetRec/JetRec/JetRecTool.h +++ b/Reconstruction/Jet/JetRec/JetRec/JetRecTool.h @@ -61,6 +61,7 @@ #include "StoreGate/ReadHandleKeyArray.h" #include "JetEDM/PseudoJetVector.h" #include "JetRec/PseudoJetContainer.h" +#include "AthenaMonitoringKernel/GenericMonitoringTool.h" class JetRecTool : public asg::AsgTool, @@ -157,6 +158,10 @@ private: mutable std::vector<TStopwatch> m_modclocks; mutable std::vector<TStopwatch> m_conclocks; + ToolHandle<GenericMonitoringTool> m_monTool{this,"MonTool","","Monitoring tool"}; + + const double m_mevtogev = 0.001; + }; #endif diff --git a/Reconstruction/Jet/JetRec/Root/JetRecTool.cxx b/Reconstruction/Jet/JetRec/Root/JetRecTool.cxx index b7ebd872e4a..38c961f07dd 100644 --- a/Reconstruction/Jet/JetRec/Root/JetRecTool.cxx +++ b/Reconstruction/Jet/JetRec/Root/JetRecTool.cxx @@ -22,6 +22,8 @@ #include "StoreGate/ReadHandle.h" +#include "AthenaMonitoringKernel/Monitored.h" + typedef ToolHandleArray<IJetModifier> ModifierArray; typedef ToolHandleArray<IJetConsumer> ConsumerArray; @@ -221,6 +223,8 @@ StatusCode JetRecTool::initialize() { m_conclock.Reset(); m_nevt = 0; + if (!m_monTool.empty()) ATH_CHECK(m_monTool.retrieve()); + ATH_MSG_INFO("Timing detail: " << m_timer); return rstat; } @@ -403,6 +407,15 @@ const JetContainer* JetRecTool::build() const { m_conclock.Stop(); } + // monitor jet multiplicity and basic jet kinematics + auto njets = Monitored::Scalar<int>("nJets"); + auto pt = Monitored::Collection("pt", *jetsHandle, [c=m_mevtogev]( const xAOD::Jet* jet ) { return jet->pt()*c; }); + auto et = Monitored::Collection("et", *jetsHandle, [c=m_mevtogev]( const xAOD::Jet* jet ) { return jet->p4().Et()*c; }); + auto eta = Monitored::Collection("eta", *jetsHandle, []( const xAOD::Jet* jet ) { return jet->eta(); }); + auto phi = Monitored::Collection("phi", *jetsHandle, []( const xAOD::Jet* jet ) { return jet->phi(); }); + auto mon = Monitored::Group(m_monTool,njets,pt,et,eta,phi); + njets = jetsHandle->size(); + m_totclock.Stop(); return jetsHandle.isValid() ? &(*jetsHandle) : 0; diff --git a/Reconstruction/Jet/JetRec/python/JetOnlineMon.py b/Reconstruction/Jet/JetRec/python/JetOnlineMon.py new file mode 100644 index 00000000000..6c634f1cf50 --- /dev/null +++ b/Reconstruction/Jet/JetRec/python/JetOnlineMon.py @@ -0,0 +1,13 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +# define histograms for monitoring of HLT jets +def getMonTool_TrigJetAlgorithm(path): + from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool + monTool = GenericMonitoringTool('MonTool') + monTool.HistPath = path + monTool.defineHistogram( 'nJets', path='EXPERT', type='TH1F', title='Counts', xbins=100, xmin=0, xmax=100 ) + monTool.defineHistogram( 'pt', path='EXPERT', type='TH1F', title='Counts', xbins=100, xmin=0, xmax=500 ) + monTool.defineHistogram( 'et', path='EXPERT', type='TH1F', title='Counts', xbins=100, xmin=0, xmax=500 ) + monTool.defineHistogram( 'eta', path='EXPERT', type='TH1F', title='Counts', xbins=50, xmin=-5, xmax=5 ) + monTool.defineHistogram( 'phi', path='EXPERT', type='TH1F', title='Counts', xbins=50, xmin=-3, xmax=3 ) + return monTool diff --git a/Reconstruction/Jet/JetRecConfig/python/JetRecConfig.py b/Reconstruction/Jet/JetRecConfig/python/JetRecConfig.py index 0c4d4ae3659..a660b656524 100644 --- a/Reconstruction/Jet/JetRecConfig/python/JetRecConfig.py +++ b/Reconstruction/Jet/JetRecConfig/python/JetRecConfig.py @@ -416,7 +416,7 @@ def getGhostPJGAlg(ghostdef): # Function for configuring the jet algorithm and builders, given the # set of dependencies # -def getJetAlgorithm(jetname, jetdef, pjs, modlist): +def getJetAlgorithm(jetname, jetdef, pjs, modlist, monTool = None): jetlog.debug("Configuring JetAlgorithm \"jetalg_{0}\"".format(jetname)) builder = getJetBuilder() @@ -431,6 +431,7 @@ def getJetAlgorithm(jetname, jetdef, pjs, modlist): mods.append(mod) rectool = getJetRecTool(jetname,finder,pjs,mods) + if monTool: rectool.MonTool = monTool jetalg = CompFactory.JetAlgorithm("jetalg_"+jetname) jetalg.Tools = [rectool] diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoSequences.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoSequences.py index 085a0dc22a5..bed06937ac7 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoSequences.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoSequences.py @@ -181,9 +181,13 @@ def jetRecoSequence( dummyFlags, dataSource, RoIs = 'FSJETRoI', **jetRecoDict): calibMods = JetRecoConfiguration.defineCalibFilterMods(jetRecoDict,dataSource, rhoKey) jetModList += calibMods + # Get online monitoring tool + from JetRec import JetOnlineMon + monTool = JetOnlineMon.getMonTool_TrigJetAlgorithm("HLTJets/"+jetsFullName+"/") + # Generate a JetAlgorithm to run the jet finding and modifiers # (via a JetRecTool instance). - jetRecAlg = JetRecConfig.getJetAlgorithm(jetsFullName, jetDef, pjs, jetModList) + jetRecAlg = JetRecConfig.getJetAlgorithm(jetsFullName, jetDef, pjs, jetModList, monTool) recoSeq += conf2toConfigurable( jetRecAlg ) # End of basic jet reco pass -- GitLab