ATLAS Offline Software
Loading...
Searching...
No Matches
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
15FwdAFPJetMonitoringAlg::FwdAFPJetMonitoringAlg(const std::string& name, ISvcLocator* pSvcLocator)
16 : AthMonitorAlgorithm(name, pSvcLocator) {}
17
19 ATH_CHECK(m_jetKey.initialize());
20
22}
23
24StatusCode FwdAFPJetMonitoringAlg::fillHistograms(const EventContext& context) const {
25 using namespace Monitored;
26
27 const auto& trigDecTool = getTrigDecisionTool();
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}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
virtual StatusCode initialize() override
initialize
const ToolHandle< Trig::TrigDecisionTool > & getTrigDecisionTool() const
Get the trigger decision tool member.
AthMonitorAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Gaudi::Property< std::vector< std::string > > m_chains
virtual StatusCode initialize() override
initialize
FwdAFPJetMonitoringAlg(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode fillHistograms(const EventContext &context) const override
adds event to the monitoring histograms
Gaudi::Property< SG::ReadHandleKey< xAOD::JetContainer > > m_jetKey
Declare a monitored scalar variable.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
virtual double phi() const
The azimuthal angle ( ) of the particle.
Definition Jet_v1.cxx:54
virtual double eta() const
The pseudorapidity ( ) of the particle.
Definition Jet_v1.cxx:49
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.
Generic monitoring tool for athena components.
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
const xAOD::Jet * findLeadingJet(SG::ReadHandle< xAOD::JetContainer > &container)
Find leading jet.