Skip to content
Snippets Groups Projects
Commit 15c97d73 authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

Merge branch 'jgeisen_PortOnlineJetMonitoringToJetRecAlg' into 'master'

Porting online monitoring tool to use JetRecAlg

See merge request atlas/athena!38976
parents 161c48ba 93e4dbb0
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,9 @@
#include "JetInterface/IJetExecuteTool.h"
#include "xAODJet/JetAuxContainer.h"
#if !defined (GENERATIONBASE) && !defined (XAOD_STANDALONE)
#include "AthenaMonitoringKernel/Monitored.h"
#endif
using std::string;
......@@ -32,6 +35,12 @@ StatusCode JetRecAlg::initialize() {
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;
}
......@@ -50,9 +59,47 @@ StatusCode JetRecAlg::execute(const EventContext& ctx) const {
// needn't know the type of the jet aux container
// We can subsequently access the jets from the handle and don't have to
// 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);
auto t_jpv = Monitored::Timer<std::chrono::microseconds>( "TIME_jetprovider" );
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("Applying jet modifiers to " << m_output.key());
......@@ -63,6 +110,8 @@ StatusCode JetRecAlg::execute(const EventContext& ctx) const {
ATH_CHECK(t->modify(*jetContHandle));
}
#endif
return StatusCode::SUCCESS;
}
......
// 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 @@
#include "JetInterface/IJetProvider.h"
#include "JetInterface/IJetModifier.h"
#if !defined(GENERATIONBASE) && !defined(XAOD_ANALYSIS)
#include "AthenaMonitoringKernel/GenericMonitoringTool.h"
#endif
class IJetExecuteTool;
......@@ -43,7 +46,10 @@ private:
ToolHandle<IJetProvider> m_jetprovider ={this , "Provider" , {} , "Tool providing the jets (fastjet, copy, grooming...)"};
ToolHandleArray<IJetModifier> m_modifiers = {this , "Modifiers", {}, "moment calculators" };
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
......
......@@ -292,7 +292,7 @@ def getJetAlgorithm(jetname, jetdef, pjContNames, monTool = None):
# New JetRecAlgorithm to replace JetRecTool
# This call is for a JRA that runs jet-finding
#
def getJetRecAlg( jetdef):
def getJetRecAlg( jetdef, monTool = None):
""" """
pjContNames = jetdef._internalAtt['finalPJContainer']
jclust = CompFactory.JetClusterer(
......@@ -312,7 +312,8 @@ def getJetRecAlg( jetdef):
"jetrecalg_"+jetname,
Provider = jclust,
Modifiers = mods,
OutputContainer = jetname)
OutputContainer = jetname,
MonTool = monTool)
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