ATLAS Offline Software
HLTHeavyIonMonAlg.cxx
Go to the documentation of this file.
1 /*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "HLTHeavyIonMonAlg.h"
6 
10 
11 HLTHeavyIonMonAlg::HLTHeavyIonMonAlg(const std::string& name, ISvcLocator* pSvcLocator)
12  : AthMonitorAlgorithm(name, pSvcLocator) {}
13 
15  // for monitorSumEt:
16  ATH_CHECK(m_lvl1EnergySumROIKey.initialize());
17  ATH_CHECK(m_jFexSumETRoIKey.initialize());
18  ATH_CHECK(m_HIEventShapeKey.initialize());
19 
21 }
22 
23 StatusCode HLTHeavyIonMonAlg::fillHistograms(const EventContext& context) const {
24  ATH_CHECK(monitorSumEt(context));
25 
26  return StatusCode::SUCCESS;
27 }
28 
29 StatusCode HLTHeavyIonMonAlg::monitorSumEt(const EventContext& context) const {
30  // Legacy L1 stuff – left for HLT developer reprocessings
31  float lvl1_sumET = 0.f;
32  auto lvl1EnergySumHandle = SG::makeHandle(m_lvl1EnergySumROIKey, context);
33  ATH_MSG_DEBUG("LVL1 EnergySum handle: " << lvl1EnergySumHandle.isValid());
34  if (lvl1EnergySumHandle.isValid()) { lvl1_sumET = 1e-3 * lvl1EnergySumHandle->energyT(); /* MeV -> GeV */ }
35 
36  auto jFexSumETHandle = SG::makeHandle(m_jFexSumETRoIKey, context);
37  ATH_MSG_DEBUG("jFeX EnergySum handle: " << jFexSumETHandle.isValid());
38  if (not jFexSumETHandle.isValid()) {
39  ATH_MSG_DEBUG("Could not retrieve jFexSumETHandle");
40  return StatusCode::SUCCESS;
41  }
42 
43  auto HIEventShapeHandle = SG::makeHandle(m_HIEventShapeKey, context);
44  ATH_MSG_DEBUG("HI event shape handle: " << HIEventShapeHandle.isValid());
45  if (not HIEventShapeHandle.isValid()) {
46  ATH_MSG_DEBUG("Could not retrieve HIEventShapeHandle");
47  return StatusCode::SUCCESS;
48  }
49 
50  // Calculate total and forward TE from jFEX
51  float sum_jTE = 0.f;
52  float sum_fwdA_jTE = 0.f;
53  float sum_fwdC_jTE = 0.f;
54 
55  for (const xAOD::jFexSumETRoI* jFexRoI : *jFexSumETHandle) {
56  sum_jTE += jFexRoI->Et_lower() + jFexRoI->Et_upper();
57  if (jFexRoI->jFexNumber() == 0) { sum_fwdC_jTE += jFexRoI->Et_upper(); }
58  if (jFexRoI->jFexNumber() == 5) { sum_fwdA_jTE += jFexRoI->Et_upper(); }
59  }
60  sum_jTE *= 0.001; // MeV -> GeV
61  sum_fwdA_jTE *= 0.001;
62  sum_fwdC_jTE *= 0.001;
63 
64  // Calculate FCal ET from HIEventShape
65  float totalFCalEtSideA = 0.;
66  float totalFCalEtSideC = 0.;
67  for (const xAOD::HIEventShape* es : *HIEventShapeHandle) {
68  const int layer = es->layer();
69  if (layer < 21 or layer > 23) { continue; }
70 
71  const float et = es->et();
72  if (std::abs(et) < 0.1) { continue; }
73 
74  const float eta = 0.5 * (es->etaMin() + es->etaMax());
75  if (eta > 0.) {
76  totalFCalEtSideA += et;
77  } else {
78  totalFCalEtSideC += et;
79  }
80  }
81  totalFCalEtSideA *= 0.001; // MeV -> GeV
82  totalFCalEtSideC *= 0.001;
83 
84  auto sum_L1TE = Monitored::Scalar("sum_L1TE", lvl1_sumET);
85  auto sum_L1jTE = Monitored::Scalar("sum_L1jTE", sum_jTE);
86  auto sum_L1FWDAjTE = Monitored::Scalar("sum_L1FWDAjTE", sum_fwdA_jTE);
87  auto sum_L1FWDCjTE = Monitored::Scalar("sum_L1FWDCjTE", sum_fwdC_jTE);
88  auto sum_FCalAEt = Monitored::Scalar("sum_FCalAEt", totalFCalEtSideA);
89  auto sum_FCalCEt = Monitored::Scalar("sum_FCalCEt", totalFCalEtSideC);
90 
91  const auto& trigDecTool = getTrigDecisionTool();
92  for (const auto& chain : m_triggerListMon) {
93  if (not trigDecTool->isPassed(chain, TrigDefs::requireDecision)) { continue; }
94 
95  fill(chain + "_sumEt", sum_L1TE, sum_L1jTE, sum_L1FWDAjTE, sum_L1FWDCjTE, sum_FCalAEt, sum_FCalCEt);
96  }
97 
98  return StatusCode::SUCCESS;
99 }
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
et
Extra patterns decribing particle interation process.
runLayerRecalibration.chain
chain
Definition: runLayerRecalibration.py:175
AthCheckMacros.h
AthMsgStreamMacros.h
HLTHeavyIonMonAlg::initialize
virtual StatusCode initialize() override
initialize
Definition: HLTHeavyIonMonAlg.cxx:14
xAOD::et
et
Definition: TrigEMCluster_v1.cxx:25
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
AthMonitorAlgorithm::getTrigDecisionTool
const ToolHandle< Trig::TrigDecisionTool > & getTrigDecisionTool() const
Get the trigger decision tool member.
Definition: AthMonitorAlgorithm.cxx:194
HLTHeavyIonMonAlg::monitorSumEt
StatusCode monitorSumEt(const EventContext &context) const
Definition: HLTHeavyIonMonAlg.cxx:29
TrigDecisionTool.h
HLTHeavyIonMonAlg::m_triggerListMon
Gaudi::Property< std::vector< std::string > > m_triggerListMon
Definition: HLTHeavyIonMonAlg.h:37
AthMonitorAlgorithm
Base class for Athena Monitoring Algorithms.
Definition: AthMonitorAlgorithm.h:36
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:274
HLTHeavyIonMonAlg::m_HIEventShapeKey
SG::ReadHandleKey< xAOD::HIEventShapeContainer > m_HIEventShapeKey
Definition: HLTHeavyIonMonAlg.h:34
xAOD::HIEventShape_v2
Interface class for the HI reconstruction EDM.
Definition: HIEventShape_v2.h:32
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
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.
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
xAOD::jFexSumETRoI_v1
Class describing properties of a LVL1 jFEX global Trigger Object (TOB) in the xAOD format.
Definition: jFexSumETRoI_v1.h:22
HLTHeavyIonMonAlg::fillHistograms
virtual StatusCode fillHistograms(const EventContext &context) const override
adds event to the monitoring histograms
Definition: HLTHeavyIonMonAlg.cxx:23
HLTHeavyIonMonAlg.h
AthMonitorAlgorithm::initialize
virtual StatusCode initialize() override
initialize
Definition: AthMonitorAlgorithm.cxx:18
HLTHeavyIonMonAlg::m_jFexSumETRoIKey
SG::ReadHandleKey< xAOD::jFexSumETRoIContainer > m_jFexSumETRoIKey
Definition: HLTHeavyIonMonAlg.h:31
HLTHeavyIonMonAlg::m_lvl1EnergySumROIKey
SG::ReadHandleKey< xAOD::EnergySumRoI > m_lvl1EnergySumROIKey
Definition: HLTHeavyIonMonAlg.h:28
HLTHeavyIonMonAlg::HLTHeavyIonMonAlg
HLTHeavyIonMonAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: HLTHeavyIonMonAlg.cxx:11
Monitored::Scalar
Declare a monitored scalar variable.
Definition: MonitoredScalar.h:34