Skip to content
Snippets Groups Projects
Commit 93e4dbb0 authored by Jannik Geisen's avatar Jannik Geisen Committed by Frank Winklmeier
Browse files

Porting online monitoring tool to use JetRecAlg

parent 198c1e90
No related branches found
No related tags found
5 merge requests!58791DataQualityConfigurations: Modify L1Calo config for web display,!46784MuonCondInterface: Enable thread-safety checking.,!46776Updated LArMonitoring config file for WD to match new files produced using MT,!45405updated ART test cron job,!42417Draft: DIRE and VINCIA Base Fragments for Pythia 8.3
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
#include "JetInterface/IJetExecuteTool.h" #include "JetInterface/IJetExecuteTool.h"
#include "xAODJet/JetAuxContainer.h" #include "xAODJet/JetAuxContainer.h"
#if !defined (GENERATIONBASE) && !defined (XAOD_STANDALONE)
#include "AthenaMonitoringKernel/Monitored.h"
#endif
using std::string; using std::string;
...@@ -32,6 +35,12 @@ StatusCode JetRecAlg::initialize() { ...@@ -32,6 +35,12 @@ StatusCode JetRecAlg::initialize() {
ATH_MSG_INFO(" --> : "<< t->name()); ATH_MSG_INFO(" --> : "<< t->name());
} }
ATH_CHECK(m_output.initialize());
#if !defined (GENERATIONBASE) && !defined (XAOD_STANDALONE)
if (!m_monTool.empty()) ATH_CHECK(m_monTool.retrieve());
#endif
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
...@@ -50,9 +59,47 @@ StatusCode JetRecAlg::execute(const EventContext& ctx) const { ...@@ -50,9 +59,47 @@ StatusCode JetRecAlg::execute(const EventContext& ctx) const {
// needn't know the type of the jet aux container // needn't know the type of the jet aux container
// We can subsequently access the jets from the handle and don't have to // We can subsequently access the jets from the handle and don't have to
// worry about memory management. // worry about memory management.
#if !defined (GENERATIONBASE) && !defined (XAOD_STANDALONE)
auto t_total = Monitored::Timer<std::chrono::milliseconds>( "TIME_total" );
SG::WriteHandle<xAOD::JetContainer> jetContHandle(m_output,ctx); SG::WriteHandle<xAOD::JetContainer> jetContHandle(m_output,ctx);
auto t_jpv = Monitored::Timer<std::chrono::microseconds>( "TIME_jetprovider" );
ATH_CHECK( m_jetprovider->getAndRecordJets(jetContHandle) ); ATH_CHECK( m_jetprovider->getAndRecordJets(jetContHandle) );
auto mon_jpv = Monitored::Group(m_monTool, t_jpv);
ATH_MSG_DEBUG("Created jet container of size "<< jetContHandle->size() << " | writing to "<< m_output.key() );
ATH_MSG_DEBUG("Applying jet modifiers to " << m_output.key());
// Calculate moments, calibrate, sort, filter... -----------
auto t_mod = Monitored::Timer<std::chrono::milliseconds>( "TIME_modifiers_total" );
for(const ToolHandle<IJetModifier>& t : m_modifiers){
std::string modname = t.name();
auto t_mods = Monitored::Timer<std::chrono::microseconds>( Form("TIME_modifier_%s",modname.c_str()) );
ATH_MSG_DEBUG("Running " << modname);
ATH_CHECK(t->modify(*jetContHandle));
auto mon_mods = Monitored::Group(m_monTool, t_mods);
}
auto mon_mod_total = Monitored::Group(m_monTool, t_mod);
// monitor jet multiplicity and basic jet kinematics
auto njets = Monitored::Scalar<int>("nJets");
auto pt = Monitored::Collection("pt", *jetContHandle, [c=0.001]( const xAOD::Jet* jet ) { return jet->pt()*c; });
auto et = Monitored::Collection("et", *jetContHandle, [c=0.001]( const xAOD::Jet* jet ) { return jet->p4().Et()*c; });
auto eta = Monitored::Collection("eta", *jetContHandle, []( const xAOD::Jet* jet ) { return jet->eta(); });
auto phi = Monitored::Collection("phi", *jetContHandle, []( const xAOD::Jet* jet ) { return jet->phi(); });
auto mon = Monitored::Group(m_monTool,njets,pt,et,eta,phi);
njets = jetContHandle->size();
auto mon_total = Monitored::Group(m_monTool, t_total);
#else
SG::WriteHandle<xAOD::JetContainer> jetContHandle(m_output,ctx);
ATH_CHECK( m_jetprovider->getAndRecordJets(jetContHandle) );
ATH_MSG_DEBUG("Created jet container of size "<< jetContHandle->size() << " | writing to "<< m_output.key() ); ATH_MSG_DEBUG("Created jet container of size "<< jetContHandle->size() << " | writing to "<< m_output.key() );
ATH_MSG_DEBUG("Applying jet modifiers to " << m_output.key()); ATH_MSG_DEBUG("Applying jet modifiers to " << m_output.key());
...@@ -63,6 +110,8 @@ StatusCode JetRecAlg::execute(const EventContext& ctx) const { ...@@ -63,6 +110,8 @@ StatusCode JetRecAlg::execute(const EventContext& ctx) const {
ATH_CHECK(t->modify(*jetContHandle)); ATH_CHECK(t->modify(*jetContHandle));
} }
#endif
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
......
// this is a -*- C++ -*- file // this is a -*- C++ -*- file
/* /*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/ */
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
...@@ -23,6 +23,9 @@ ...@@ -23,6 +23,9 @@
#include "JetInterface/IJetProvider.h" #include "JetInterface/IJetProvider.h"
#include "JetInterface/IJetModifier.h" #include "JetInterface/IJetModifier.h"
#if !defined(GENERATIONBASE) && !defined(XAOD_ANALYSIS)
#include "AthenaMonitoringKernel/GenericMonitoringTool.h"
#endif
class IJetExecuteTool; class IJetExecuteTool;
...@@ -43,7 +46,10 @@ private: ...@@ -43,7 +46,10 @@ private:
ToolHandle<IJetProvider> m_jetprovider ={this , "Provider" , {} , "Tool providing the jets (fastjet, copy, grooming...)"}; ToolHandle<IJetProvider> m_jetprovider ={this , "Provider" , {} , "Tool providing the jets (fastjet, copy, grooming...)"};
ToolHandleArray<IJetModifier> m_modifiers = {this , "Modifiers", {}, "moment calculators" }; ToolHandleArray<IJetModifier> m_modifiers = {this , "Modifiers", {}, "moment calculators" };
SG::WriteHandleKey<xAOD::JetContainer> m_output= {this, "OutputContainer", "AntiKt4LCtopoJets", "The output jet container name"}; SG::WriteHandleKey<xAOD::JetContainer> m_output= {this, "OutputContainer", "AntiKt4LCtopoJets", "The output jet container name"};
#if !defined (GENERATIONBASE) && !defined (XAOD_STANDALONE)
ToolHandle<GenericMonitoringTool> m_monTool{this,"MonTool","","Monitoring tool"};
#endif
}; };
#endif #endif
......
...@@ -292,7 +292,7 @@ def getJetAlgorithm(jetname, jetdef, pjContNames, monTool = None): ...@@ -292,7 +292,7 @@ def getJetAlgorithm(jetname, jetdef, pjContNames, monTool = None):
# New JetRecAlgorithm to replace JetRecTool # New JetRecAlgorithm to replace JetRecTool
# This call is for a JRA that runs jet-finding # This call is for a JRA that runs jet-finding
# #
def getJetRecAlg( jetdef): def getJetRecAlg( jetdef, monTool = None):
""" """ """ """
pjContNames = jetdef._internalAtt['finalPJContainer'] pjContNames = jetdef._internalAtt['finalPJContainer']
jclust = CompFactory.JetClusterer( jclust = CompFactory.JetClusterer(
...@@ -312,7 +312,8 @@ def getJetRecAlg( jetdef): ...@@ -312,7 +312,8 @@ def getJetRecAlg( jetdef):
"jetrecalg_"+jetname, "jetrecalg_"+jetname,
Provider = jclust, Provider = jclust,
Modifiers = mods, Modifiers = mods,
OutputContainer = jetname) OutputContainer = jetname,
MonTool = monTool)
autoconfigureModifiers(jra.Modifiers, jetname) autoconfigureModifiers(jra.Modifiers, jetname)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment