ATLAS Offline Software
HLTHeavyIonMonAlg.cxx
Go to the documentation of this file.
1 /*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "HLTHeavyIonMonAlg.h"
6 
9 
10 HLTHeavyIonMonAlg::HLTHeavyIonMonAlg(const std::string& name, ISvcLocator* pSvcLocator)
11  : AthMonitorAlgorithm(name, pSvcLocator) {}
12 
14  // for monitorSumEt:
15  ATH_CHECK(m_lvl1EnergySumROIKey.initialize());
16  ATH_CHECK(m_jFexSumETRoIKey.initialize());
17  ATH_CHECK(m_HIEventShapeKey.initialize());
18 
20 }
21 
22 StatusCode HLTHeavyIonMonAlg::fillHistograms(const EventContext& context) const {
23  ATH_CHECK(monitorSumEt(context));
24 
25  return StatusCode::SUCCESS;
26 }
27 
28 StatusCode HLTHeavyIonMonAlg::monitorSumEt(const EventContext& context) const {
29  // Legacy L1 stuff – left for HLT developer reprocessings
30  float lvl1_sumET = 0.f;
31  auto lvl1EnergySumHandle = SG::makeHandle(m_lvl1EnergySumROIKey, context);
32  ATH_MSG_DEBUG("LVL1 EnergySum handle: " << lvl1EnergySumHandle.isValid());
33  if (lvl1EnergySumHandle.isValid()) { lvl1_sumET = 1e-3 * lvl1EnergySumHandle->energyT(); /* MeV -> GeV */ }
34 
35  auto jFexSumETHandle = SG::makeHandle(m_jFexSumETRoIKey, context);
36  ATH_MSG_DEBUG("jFeX EnergySum handle: " << jFexSumETHandle.isValid());
37  if (not jFexSumETHandle.isValid()) {
38  ATH_MSG_DEBUG("Could not retrieve jFexSumETHandle");
39  return StatusCode::SUCCESS;
40  }
41 
42  auto HIEventShapeHandle = SG::makeHandle(m_HIEventShapeKey, context);
43  ATH_MSG_DEBUG("HI event shape handle: " << HIEventShapeHandle.isValid());
44  if (not HIEventShapeHandle.isValid()) {
45  ATH_MSG_DEBUG("Could not retrieve HIEventShapeHandle");
46  return StatusCode::SUCCESS;
47  }
48 
49  // Calculate total and forward TE from jFEX
50  float sum_jTE = 0.f;
51  float sum_fwdA_jTE = 0.f;
52  float sum_fwdC_jTE = 0.f;
53 
54  for (const xAOD::jFexSumETRoI* jFexRoI : *jFexSumETHandle) {
55  sum_jTE += jFexRoI->Et_lower() + jFexRoI->Et_upper();
56  if (jFexRoI->jFexNumber() == 0) { sum_fwdC_jTE += jFexRoI->Et_upper(); }
57  if (jFexRoI->jFexNumber() == 5) { sum_fwdA_jTE += jFexRoI->Et_upper(); }
58  }
59  sum_jTE *= 0.001; // MeV -> GeV
60  sum_fwdA_jTE *= 0.001;
61  sum_fwdC_jTE *= 0.001;
62 
63  // Calculate FCal ET from HIEventShape
64  float totalFCalEtSideA = 0.;
65  float totalFCalEtSideC = 0.;
66  for (const xAOD::HIEventShape* es : *HIEventShapeHandle) {
67  const int layer = es->layer();
68  if (layer < 21 or layer > 23) { continue; }
69 
70  const float et = es->et();
71  if (std::abs(et) < 0.1) { continue; }
72 
73  const float eta = 0.5 * (es->etaMin() + es->etaMax());
74  if (eta > 0.) {
75  totalFCalEtSideA += et;
76  } else {
77  totalFCalEtSideC += et;
78  }
79  }
80  totalFCalEtSideA *= 0.001; // MeV -> GeV
81  totalFCalEtSideC *= 0.001;
82 
83  auto sum_L1TE = Monitored::Scalar("sum_L1TE", lvl1_sumET);
84  auto sum_L1jTE = Monitored::Scalar("sum_L1jTE", sum_jTE);
85  auto sum_L1FWDAjTE = Monitored::Scalar("sum_L1FWDAjTE", sum_fwdA_jTE);
86  auto sum_L1FWDCjTE = Monitored::Scalar("sum_L1FWDCjTE", sum_fwdC_jTE);
87  auto sum_FCalAEt = Monitored::Scalar("sum_FCalAEt", totalFCalEtSideA);
88  auto sum_FCalCEt = Monitored::Scalar("sum_FCalCEt", totalFCalEtSideC);
89 
90  const auto& trigDecTool = getTrigDecisionTool();
91  for (const auto& chain : m_triggerListMon) {
92  if (not trigDecTool->isPassed(chain, TrigDefs::requireDecision)) { continue; }
93 
94  fill(chain + "_sumEt", sum_L1TE, sum_L1jTE, sum_L1FWDAjTE, sum_L1FWDCjTE, sum_FCalAEt, sum_FCalCEt);
95  }
96 
97  return StatusCode::SUCCESS;
98 }
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:13
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:189
HLTHeavyIonMonAlg::monitorSumEt
StatusCode monitorSumEt(const EventContext &context) const
Definition: HLTHeavyIonMonAlg.cxx:28
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:270
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:31
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:221
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:22
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:10
Monitored::Scalar
Declare a monitored scalar variable.
Definition: MonitoredScalar.h:34