diff --git a/Reconstruction/Jet/JetRec/CMakeLists.txt b/Reconstruction/Jet/JetRec/CMakeLists.txt index 9ddd74e891a8006f5849c64f7633cfe2bb842e22..a9d0b6e43a32f2d16a695f2983aa33a9d53b71ec 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 dfa046763bc9954ea2d1a38e62b6930f7eb4268b..3f2928b9d12c20a80d60767a77cb17d4e9d5f8be 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 b7ebd872e4a478efc24a19ec1b4592b91d87aa55..38c961f07ddf872d35f405a9764bd36f00b052e2 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 0000000000000000000000000000000000000000..6c634f1cf5011260fa76acd35d44414c622eaa0d --- /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 0c4d4ae3659c59f894e5c84d21e0dcf8d4fb8d0c..a660b656524281c606d7677be65f411c0159de9a 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 085a0dc22a553240b21dea255500d771a0fe94fa..bed06937ac70fdf526d51bf84f326da05947231d 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