ATLAS Offline Software
FwdAFPJetMonitoringAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
10 
11 #include <algorithm>
12 
13 #include "Utils.h"
14 
15 FwdAFPJetMonitoringAlg::FwdAFPJetMonitoringAlg(const std::string& name, ISvcLocator* pSvcLocator)
16  : AthMonitorAlgorithm(name, pSvcLocator) {}
17 
19  ATH_CHECK(m_jetKey.initialize());
20 
22 }
23 
24 StatusCode FwdAFPJetMonitoringAlg::fillHistograms(const EventContext& context) const {
25  using namespace Monitored;
26 
27  const auto& trigDecTool = getTrigDecisionTool();
28  SG::ReadHandle<xAOD::JetContainer> jetsHandle(m_jetKey, context);
29 
30  ATH_MSG_DEBUG("Using: " << m_jetKey.key() << ", handle state: " << jetsHandle.isValid());
31  if (not jetsHandle.isValid()) {
32  return StatusCode::SUCCESS;
33  }
34 
35  for (const auto& chain : m_chains) {
36  ATH_MSG_DEBUG("Chain: " << chain << " - Checking...");
37  if (not trigDecTool->isPassed(chain, TrigDefs::requireDecision)) {
38  ATH_MSG_DEBUG("Chain: " << chain << " - Failed");
39  continue;
40  }
41  ATH_MSG_DEBUG("Chain: " << chain << " - Passed");
42 
43  auto jetPt = Collection("jetPt", *jetsHandle, [](const auto& jet) { return jet->pt() * 1.e-3; });
44  auto jetEta = Collection("jetEta", *jetsHandle, &xAOD::Jet::eta);
45  auto jetPhi = Collection("jetPhi", *jetsHandle, &xAOD::Jet::phi);
46 
47  const auto leadingJet = Utils::findLeadingJet(jetsHandle);
48  if (leadingJet == nullptr) {
49  fill(chain + "_" + m_jetKey.key(), jetPt, jetEta, jetPhi);
50  continue;
51  }
52 
53  auto leadingJetPt = Scalar("leadingJetPt", leadingJet->pt() * 1.e-3);
54  auto leadingJetEta = Scalar("leadingJetEta", leadingJet->eta());
55  auto leadingJetPhi = Scalar("leadingJetPhi", leadingJet->phi());
56 
57  fill(chain + "_" + m_jetKey.key(), jetPt, jetEta, jetPhi, leadingJetPt, leadingJetEta, leadingJetPhi);
58  }
59 
60  return StatusCode::SUCCESS;
61 }
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
FwdAFPJetMonitoringAlg::fillHistograms
virtual StatusCode fillHistograms(const EventContext &context) const override
adds event to the monitoring histograms
Definition: FwdAFPJetMonitoringAlg.cxx:24
runLayerRecalibration.chain
chain
Definition: runLayerRecalibration.py:175
AthMsgStreamMacros.h
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
AthMonitorAlgorithm::getTrigDecisionTool
const ToolHandle< Trig::TrigDecisionTool > & getTrigDecisionTool() const
Get the trigger decision tool member.
Definition: AthMonitorAlgorithm.cxx:194
xAOD::Jet_v1::phi
virtual double phi() const
The azimuthal angle ( ) of the particle.
Definition: Jet_v1.cxx:54
TrigDecisionTool.h
FwdAFPJetMonitoringAlg::m_chains
Gaudi::Property< std::vector< std::string > > m_chains
Definition: FwdAFPJetMonitoringAlg.h:24
Monitored::Collection
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
Definition: MonitoredCollection.h:38
Utils::findLeadingJet
const xAOD::Jet * findLeadingJet(SG::ReadHandle< xAOD::JetContainer > &container)
Find leading jet.
Definition: Trigger/TrigMonitoring/TrigMinBiasMonitoring/src/Utils.cxx:26
AthMonitorAlgorithm
Base class for Athena Monitoring Algorithms.
Definition: AthMonitorAlgorithm.h:36
FwdAFPJetMonitoringAlg::initialize
virtual StatusCode initialize() override
initialize
Definition: FwdAFPJetMonitoringAlg.cxx:18
MonitoredCollection.h
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
Monitored
Generic monitoring tool for athena components.
Definition: GenericMonitoringTool.h:28
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
Utils.h
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthMonitorAlgorithm::fill
void fill(const ToolHandle< GenericMonitoringTool > &groupHandle, std::vector< std::reference_wrapper< Monitored::IMonitoredVariable >> &&variables) const
Fills a vector of variables to a group by reference.
FwdAFPJetMonitoringAlg::FwdAFPJetMonitoringAlg
FwdAFPJetMonitoringAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: FwdAFPJetMonitoringAlg.cxx:15
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
xAOD::Jet_v1::eta
virtual double eta() const
The pseudorapidity ( ) of the particle.
Definition: Jet_v1.cxx:49
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
AthMonitorAlgorithm::initialize
virtual StatusCode initialize() override
initialize
Definition: AthMonitorAlgorithm.cxx:18
FwdAFPJetMonitoringAlg::m_jetKey
Gaudi::Property< SG::ReadHandleKey< xAOD::JetContainer > > m_jetKey
Definition: FwdAFPJetMonitoringAlg.h:25
Monitored::Scalar
Declare a monitored scalar variable.
Definition: MonitoredScalar.h:34
FwdAFPJetMonitoringAlg.h