ATLAS Offline Software
Loading...
Searching...
No Matches
TrigAFPSidHypoMonitoringAlg.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#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 // Match online track to offline
48 for(const auto* track: *tracksAFP){
49 float dRmin = 9e9;
50 for(const auto* off_track: *tracksAFPoff){
51
52 float dx = track->xLocal()-off_track->xLocal();
53 float dy = track->yLocal()-off_track->yLocal();
54 float dR = std::hypot(dx, dy);
55
56 if(dR<dRmin){
57 dRmin = dR;
58 xDiff = dx;
59 yDiff = dy;
60 }
61 } // End of loop over offline tracks
62
63 fill("AFPCoarse", xDiff, yDiff);
64
65 }// End of loop over online tracks
66
67 // in future should be split into many smaller methods called from here
68 std::vector<std::string> passedAFPChains = {"all"}; // also includes ALL events counter
69 for (const auto& chainName: m_chains) {
70 if ( getTrigDecisionTool()->isPassed(chainName) ){
71 passedAFPChains.emplace_back(chainName);
72 }
73
74 }
75 if ( passedAFPChains.size() > 1) passedAFPChains.emplace_back("AFP");
76 auto whichTrigger = Monitored::Collection("TrigCounts", passedAFPChains);
77 fill("AFPCoarse", whichTrigger);
78
79 return StatusCode::SUCCESS;
80}
81
#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.