ATLAS Offline Software
Loading...
Searching...
No Matches
FwdAFPJetEffMonitoringAlg.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#include <iterator>
13
14#include "Utils.h"
15
16FwdAFPJetEffMonitoringAlg::FwdAFPJetEffMonitoringAlg(const std::string& name, ISvcLocator* pSvcLocator)
17 : AthMonitorAlgorithm(name, pSvcLocator) {}
18
24
25StatusCode FwdAFPJetEffMonitoringAlg::fillHistograms(const EventContext& context) const {
26 using namespace Monitored;
27
28 const auto& trigDecTool = getTrigDecisionTool();
30
31 ATH_MSG_DEBUG("Using: " << m_jetKey.key() << ", handle state: " << jetsHandle.isValid());
32 if (not jetsHandle.isValid()) {
33 return StatusCode::SUCCESS;
34 }
35
36 auto passedL1 = [](unsigned int bits) { return (bits & TrigDefs::L1_isPassedBeforePrescale) != 0; };
37 auto passedHLT = [](unsigned int bits) { return (bits & TrigDefs::EF_passedRaw) != 0; };
38 auto activeHLT = [](unsigned int bits) { return (bits & TrigDefs::EF_prescaled) == 0; };
39 auto isL1 = [](const std::string& name) { return name.compare(0, 3, "L1_") == 0; };
40 auto isHLT = [](const std::string& name) { return name.compare(0, 4, "HLT_") == 0; };
41
42 for (size_t index = 0; index < m_references.size(); ++index) {
43 const auto& trig = m_chains[index];
44 const auto& ref = m_references[index];
45
46 ATH_MSG_VERBOSE("Check: " << trig << " vs " << ref << "...");
47
48 if (trigDecTool->isPassed(ref, TrigDefs::requireDecision)) {
49 ATH_MSG_VERBOSE("Reference: " << ref << " - Passed!");
50
51 const unsigned int passBits = trigDecTool->isPassedBits(trig);
52 const bool wasRun = isL1(trig) or (isHLT(trig) and activeHLT(passBits));
53
54 if (wasRun) {
55 const auto decision = (isL1(trig) and passedL1(passBits)) or (isHLT(trig) and passedHLT(passBits));
56 ATH_MSG_DEBUG("Chain " << trig << " vs " << ref << " - " << (decision ? "Passed!" : "Failed!"));
57
58 auto leadingJet = Utils::findLeadingJet(jetsHandle);
59 auto leadingJetPt = Scalar<float>("leadingJetPt", leadingJet ? leadingJet->pt() * 1e-3 : -1);
60 auto effPassed = Scalar<int>("effPassed", decision);
61 fill(trig + "_" + ref, effPassed, leadingJetPt);
62 }
63 }
64 }
65
66 return StatusCode::SUCCESS;
67}
const boost::regex ref(r_ef)
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#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.
virtual StatusCode initialize() override
initialize
Gaudi::Property< SG::ReadHandleKey< xAOD::JetContainer > > m_jetKey
Gaudi::Property< std::vector< std::string > > m_chains
FwdAFPJetEffMonitoringAlg(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode fillHistograms(const EventContext &context) const override
adds event to the monitoring histograms
Gaudi::Property< std::vector< std::string > > m_references
Declare a monitored scalar variable.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
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.
const xAOD::Jet * findLeadingJet(SG::ReadHandle< xAOD::JetContainer > &container)
Find leading jet.
Definition index.py:1