ATLAS Offline Software
Loading...
Searching...
No Matches
TrigAFPSidHypoMonitoringAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6
10#include <cmath>
11
12TrigAFPSidHypoMonitoringAlg::TrigAFPSidHypoMonitoringAlg(const std::string& name, ISvcLocator* pSvcLocator) :
13 AthMonitorAlgorithm (name, pSvcLocator)
14{
15}
16
20
22{
24
25 ATH_CHECK(m_AFPtrackKey.initialize());
26 ATH_CHECK(m_AFPtrackOffKey.initialize());
27 return StatusCode::SUCCESS;
28}
29
31{
32 return StatusCode::SUCCESS;
33}
34
35StatusCode TrigAFPSidHypoMonitoringAlg::fillHistograms(const EventContext& context) const
36{
37
39
41
42 ATH_MSG_DEBUG("AFP track size online/offline:"<<tracksAFP.get()->size()<<"/"<<tracksAFPoff.get()->size());
43
44 auto xDiff = Monitored::Scalar("xDiff",-999.);
45 auto yDiff = Monitored::Scalar("yDiff",-999.);
46
47 const std::string hName{"AFPCoarse"};
48 // Match online track to offline
49 for(const auto* track: *tracksAFP){
50 float dRmin = 9e9;
51 for(const auto* off_track: *tracksAFPoff){
52
53 float dx = track->xLocal()-off_track->xLocal();
54 float dy = track->yLocal()-off_track->yLocal();
55 float dR = std::hypot(dx, dy);
56
57 if(dR<dRmin){
58 dRmin = dR;
59 xDiff = dx;
60 yDiff = dy;
61 }
62 } // End of loop over offline tracks
63
64 fill(hName, xDiff, yDiff);
65
66 }// End of loop over online tracks
67
68 // in future should be split into many smaller methods called from here
69 std::vector<std::string> passedAFPChains = {"all"}; // also includes ALL events counter
70 for (const auto& chainName: m_chains) {
71 if ( getTrigDecisionTool()->isPassed(chainName) ){
72 passedAFPChains.emplace_back(chainName);
73 }
74
75 }
76 if ( passedAFPChains.size() > 1) passedAFPChains.emplace_back("AFP");
77 auto whichTrigger = Monitored::Collection("TrigCounts", passedAFPChains);
78 fill(hName, whichTrigger);
79
80 return StatusCode::SUCCESS;
81}
82
#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.
Declare a monitored scalar variable.
const_pointer_type get() const
Dereference the pointer, but don't cache anything.
virtual StatusCode initialize() override
initialize
SG::ReadHandleKey< xAOD::AFPTrackContainer > m_AFPtrackOffKey
Gaudi::Property< std::vector< std::string > > m_chains
virtual StatusCode fillHistograms(const EventContext &context) const override
adds event to the monitoring histograms
TrigAFPSidHypoMonitoringAlg(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode finalize() override
SG::ReadHandleKey< xAOD::AFPTrackContainer > m_AFPtrackKey
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.
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.