ATLAS Offline Software
TrigL1FexJetMonitorAlgorithm.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "./DataStructs.h"
8 
9 #include <vector>
10 
11 TrigL1FexJetMonitorAlgorithm::TrigL1FexJetMonitorAlgorithm( const std::string& name, ISvcLocator* pSvcLocator )
12  : AthMonitorAlgorithm(name,pSvcLocator){
13 }
14 
16 
18 
19  // verify that the tool handle is pointing to an accessible tool
20  if ( m_filler.retrieve().isFailure() ) {
21  ATH_MSG_FATAL ("Failed to retrieve " << m_filler);
22  return StatusCode::FAILURE;
23  }
24 
26 }
27 
28 
30 
31  std::vector<JetData> jetData;
32 
33  auto sc = m_filler->getData(ctx, jetData);
34  if (sc.isFailure()) {
35  return sc;
36  }
37 
38  auto groupTool = getGroup(m_groupName);
39 
40  for (const auto& jd : jetData) {
41  Monitored::Scalar<float> et{jd.m_et_label, jd.m_et};
42  Monitored::Scalar<float> eta{"eta", jd.m_eta};
43  Monitored::Scalar<float> phi{"phi", jd.m_phi};
44 
45  // fill does not return a StatusCode object
46  fill(groupTool, et, eta, phi);
47  }
48 
49  std::vector<JetMatchData> jetMatchData;
50  sc = m_filler->getMatchData(ctx,
52  jetMatchData);
53  if (sc.isFailure()) {
54  return sc;
55  }
56 
57  for (const auto& jd : jetMatchData) {
58  auto dPt = Monitored::Scalar("hltptdiff", jd.m_dPt);
59  auto dEnergy = Monitored::Scalar("hltenergydiff", jd.m_dEnergy);
60  auto dMass = Monitored::Scalar("hltmassdiff", jd.m_dMass);
61  auto rPt = Monitored::Scalar("hltptresp", jd.m_rPt);
62  auto rEnergy = Monitored::Scalar("hltenergyresp", jd.m_rEnergy);
63  auto rMass = Monitored::Scalar("hltmassresp", jd.m_rMass);
64  auto ptRef = Monitored::Scalar("hltptref", jd.m_ptRef);
65  auto etaRef = Monitored::Scalar("hltetaref", jd.m_etaRef);
66 
67  // fill does not return a StatusCode object
68  fill(groupTool, dPt, dEnergy, dMass, rPt, rEnergy, rMass, ptRef, etaRef);
69  }
70 
71 
72 
73  jetMatchData.clear();
74  sc = m_filler->getMatchData(ctx,
76  jetMatchData);
77  if (sc.isFailure()) {
78  return sc;
79  }
80 
81  for (const auto& jd : jetMatchData) {
82  auto dPt = Monitored::Scalar("offptdiff", jd.m_dPt);
83  auto dEnergy = Monitored::Scalar("offenergydiff", jd.m_dEnergy);
84  auto dMass = Monitored::Scalar("offmassdiff", jd.m_dMass);
85  auto rPt = Monitored::Scalar("offptresp", jd.m_rPt);
86  auto rEnergy = Monitored::Scalar("offenergyresp", jd.m_rEnergy);
87  auto rMass = Monitored::Scalar("offmassresp", jd.m_rMass);
88  auto ptRef = Monitored::Scalar("offptref", jd.m_ptRef);
89  auto etaRef = Monitored::Scalar("offetaref", jd.m_etaRef);
90 
91  // fill does not return a StatusCode object
92  fill(groupTool, dPt, dEnergy, dMass, rPt, rEnergy, rMass, ptRef, etaRef);
93  }
94 
95  return StatusCode::SUCCESS;
96 }
97 
et
Extra patterns decribing particle interation process.
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
MatchToEnum::offline
@ offline
MatchToEnum::hlt
@ hlt
TrigL1FexJetMonitorAlgorithm::~TrigL1FexJetMonitorAlgorithm
virtual ~TrigL1FexJetMonitorAlgorithm()
Definition: TrigL1FexJetMonitorAlgorithm.cxx:15
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
TrigL1FexJetMonitorAlgorithm::fillHistograms
virtual StatusCode fillHistograms(const EventContext &ctx) const override
adds event to the monitoring histograms
Definition: TrigL1FexJetMonitorAlgorithm.cxx:29
AthMonitorAlgorithm
Base class for Athena Monitoring Algorithms.
Definition: AthMonitorAlgorithm.h:36
TrigL1FexJetMonitorAlgorithm::m_groupName
Gaudi::Property< std::string > m_groupName
Definition: TrigL1FexJetMonitorAlgorithm.h:37
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TrigL1FexJetMonitorAlgorithm.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.
TrigL1FexJetMonitorAlgorithm::initialize
virtual StatusCode initialize() override
initialize
Definition: TrigL1FexJetMonitorAlgorithm.cxx:17
TrigL1FexJetMonitorAlgorithm::m_filler
ToolHandle< ITrigJetMonitorTool > m_filler
Definition: TrigL1FexJetMonitorAlgorithm.h:34
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TrigL1FexJetMonitorAlgorithm::TrigL1FexJetMonitorAlgorithm
TrigL1FexJetMonitorAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Definition: TrigL1FexJetMonitorAlgorithm.cxx:11
AthMonitorAlgorithm::initialize
virtual StatusCode initialize() override
initialize
Definition: AthMonitorAlgorithm.cxx:18
ReadDecorHandle.h
Handle class for reading a decoration on an object.
DataStructs.h
Monitored::Scalar
Declare a monitored scalar variable.
Definition: MonitoredScalar.h:34
AthMonitorAlgorithm::getGroup
const ToolHandle< GenericMonitoringTool > & getGroup(const std::string &name) const
Get a specific monitoring tool from the tool handle array.
Definition: AthMonitorAlgorithm.cxx:164