ATLAS Offline Software
TrigAFPSidHypoMonitoringAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
8 #include "xAODForward/AFPTrack.h"
9 
10 TrigAFPSidHypoMonitoringAlg::TrigAFPSidHypoMonitoringAlg(const std::string& name, ISvcLocator* pSvcLocator) :
11  AthMonitorAlgorithm (name, pSvcLocator)
12 {
13 }
14 
16 {
17 }
18 
20 {
22 
23  ATH_CHECK(m_AFPtrackKey.initialize());
24  ATH_CHECK(m_AFPtrackOffKey.initialize());
25  return StatusCode::SUCCESS;
26 }
27 
29 {
30  return StatusCode::SUCCESS;
31 }
32 
33 StatusCode TrigAFPSidHypoMonitoringAlg::fillHistograms(const EventContext& context) const
34 {
35 
37 
39 
40  ATH_MSG_DEBUG("AFP track size online/offline:"<<tracksAFP.get()->size()<<"/"<<tracksAFPoff.get()->size());
41 
42  auto xDiff = Monitored::Scalar("xDiff",-999.);
43  auto yDiff = Monitored::Scalar("yDiff",-999.);
44 
45  float dR = -999.;
46  float dRmin = 9e9;
47 
48  // Match online track to offline
49  for(const auto track: *tracksAFP){
50  for(const auto off_track: *tracksAFPoff){
51 
52  xDiff = track->xLocal()-off_track->xLocal();
53  yDiff = track->yLocal()-off_track->yLocal();
54 
55  dR = TMath::Sqrt(TMath::Power(xDiff,2)+TMath::Power(yDiff,2));
56 
57  if(dR<dRmin){
58  dRmin = dR;
59  }
60  } // End of loop over offline tracks
61 
62  fill("AFPCoarse", xDiff, yDiff);
63 
64  }// End of loop over online tracks
65 
66  // in future should be split into many smaller methods called from here
67  std::vector<std::string> passedAFPChains = {"all"}; // also includes ALL events counter
68  for (auto chainName: m_chains) {
69  if ( getTrigDecisionTool()->isPassed(chainName) ){
70  passedAFPChains.emplace_back(chainName);
71  }
72 
73  }
74  if ( passedAFPChains.size() > 1) passedAFPChains.emplace_back("AFP");
75  auto whichTrigger = Monitored::Collection("TrigCounts", passedAFPChains);
76  fill("AFPCoarse", whichTrigger);
77 
78  return StatusCode::SUCCESS;
79 }
80 
AFPTrackContainer.h
TrigAFPSidHypoMonitoringAlg::~TrigAFPSidHypoMonitoringAlg
virtual ~TrigAFPSidHypoMonitoringAlg() override
Definition: TrigAFPSidHypoMonitoringAlg.cxx:15
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthMonitorAlgorithm::getTrigDecisionTool
const ToolHandle< Trig::TrigDecisionTool > & getTrigDecisionTool() const
Get the trigger decision tool member.
Definition: AthMonitorAlgorithm.cxx:189
TrigAFPSidHypoMonitoringAlg::finalize
virtual StatusCode finalize() override
Definition: TrigAFPSidHypoMonitoringAlg.cxx:28
Monitored::Collection
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
Definition: MonitoredCollection.h:38
TrigAFPSidHypoMonitoringAlg::fillHistograms
virtual StatusCode fillHistograms(const EventContext &context) const override
adds event to the monitoring histograms
Definition: TrigAFPSidHypoMonitoringAlg.cxx:33
AthMonitorAlgorithm
Base class for Athena Monitoring Algorithms.
Definition: AthMonitorAlgorithm.h:36
TrigAFPSidHypoMonitoringAlg::TrigAFPSidHypoMonitoringAlg
TrigAFPSidHypoMonitoringAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: TrigAFPSidHypoMonitoringAlg.cxx:10
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SG::ReadHandle::get
const_pointer_type get() const
Dereference the pointer, but don't cache anything.
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
TrigAFPSidHypoMonitoringAlg.h
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.
TrigAFPSidHypoMonitoringAlg::m_AFPtrackKey
SG::ReadHandleKey< xAOD::AFPTrackContainer > m_AFPtrackKey
Definition: TrigAFPSidHypoMonitoringAlg.h:33
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
AFPTrack.h
AthMonitorAlgorithm::initialize
virtual StatusCode initialize() override
initialize
Definition: AthMonitorAlgorithm.cxx:18
TrigAFPSidHypoMonitoringAlg::m_AFPtrackOffKey
SG::ReadHandleKey< xAOD::AFPTrackContainer > m_AFPtrackOffKey
Definition: TrigAFPSidHypoMonitoringAlg.h:34
python.TriggerAPI.TriggerAPISession.chainName
chainName
Definition: TriggerAPISession.py:426
TrigAFPSidHypoMonitoringAlg::initialize
virtual StatusCode initialize() override
initialize
Definition: TrigAFPSidHypoMonitoringAlg.cxx:19
TrigAFPSidHypoMonitoringAlg::m_chains
Gaudi::Property< std::vector< std::string > > m_chains
Definition: TrigAFPSidHypoMonitoringAlg.h:31
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
Monitored::Scalar
Declare a monitored scalar variable.
Definition: MonitoredScalar.h:34
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.