ATLAS Offline Software
Loading...
Searching...
No Matches
L1CaloTriggerTowerDecoratorAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5
6// TrigT1 common definitions
8
9// Local include(s):
11
12// EDM include(s):
14
15#include <optional>
16namespace LVL1 {
17
19 const std::string& name, ISvcLocator* svcLoc)
20 : AthAlgorithm(name, svcLoc),
21 m_ttTools(this)
22{
23 declareProperty("TriggerTowerTools", m_ttTools);
24}
25
28 "TrigT1CaloCalibTools/L1CaloTriggerTowerDecoratorAlg::initialize()");
29 CHECK(m_ttTools.retrieve());
31
32 const std::string baseName = m_triggerTowerContainerKey.key();
33
34 if (!baseName.empty()) {
35 if (!m_caloCellEnergyKey.empty()) {
36 CHECK(m_caloCellEnergyKey.initialize());
37 }
38 if (!m_caloCellETKey.empty()) {
39 CHECK(m_caloCellETKey.initialize());
40 }
41 if (!m_caloCellsQualityKey.empty()) {
42 CHECK(m_caloCellsQualityKey.initialize());
43 }
44 if (!m_caloCellEnergyByLayerKey.empty()) {
46 }
47 if (!m_caloCellETByLayerKey.empty()) {
48 CHECK(m_caloCellETByLayerKey.initialize());
49 }
52 }
55 }
56 }
57
58 // Return gracefully:
59 return StatusCode::SUCCESS;
60}
61
62StatusCode
64{
65 // use decorators to avoid the costly name -> auxid lookup
66
67 // Shall I proceed?
68 if (!m_triggerTowerContainerKey.empty()) {
70 ctx);
71 CHECK(m_ttTools->initCaloCells());
72
73 // We have optional Write Decor handles outside the loop
74 // And bools to check outside/inside the loop.
75 const bool doCellEnergy = !m_caloCellEnergyKey.empty();
76 const bool doCellET = !m_caloCellETKey.empty();
77 const bool doCellsQuality = !m_caloCellsQualityKey.empty();
78 const bool doCellEnergyByLayer = !m_caloCellEnergyByLayerKey.empty();
79 const bool doCellETByLayer = !m_caloCellETByLayerKey.empty();
80 const bool doCellEnergyByLayerByReceiver = !m_caloCellEnergyByLayerByReceiverKey.empty();
81 const bool doCellETByLayerByReceiver = !m_caloCellETByLayerByReceiverKey.empty();
82 std::optional<SG::WriteDecorHandle<xAOD::TriggerTowerContainer, float>>
83 caloCellEnergyDecorator;
84 std::optional<SG::WriteDecorHandle<xAOD::TriggerTowerContainer, float>>
85 caloCellETDecorator;
86 std::optional<SG::WriteDecorHandle<xAOD::TriggerTowerContainer, float>>
87 caloCellsQualityDecorator;
88 std::optional<
90 caloCellEnergyByLayerDecorator;
91 std::optional<
93 caloCellETByLayerDecorator;
94 std::optional<
96 caloCellEnergyByLayerByReceiverDecorator;
97 std::optional<
99 caloCellETByLayerByReceiverDecorator;
100
101 if (doCellEnergy) {
102 caloCellEnergyDecorator.emplace(m_caloCellEnergyKey, ctx);
103 }
104 if (doCellET) {
105 caloCellETDecorator.emplace(m_caloCellETKey, ctx);
106 }
107 if (doCellsQuality) {
108 caloCellsQualityDecorator.emplace(m_caloCellsQualityKey, ctx);
109 }
110 if (doCellEnergyByLayer) {
111 caloCellEnergyByLayerDecorator.emplace(m_caloCellEnergyByLayerKey, ctx);
112 }
113 if (doCellETByLayer) {
114 caloCellETByLayerDecorator.emplace(m_caloCellETByLayerKey, ctx);
115 }
116 if (doCellEnergyByLayerByReceiver) {
117 caloCellEnergyByLayerByReceiverDecorator.emplace(m_caloCellEnergyByLayerByReceiverKey, ctx);
118 }
119 if (doCellETByLayerByReceiver) {
120 caloCellETByLayerByReceiverDecorator.emplace(m_caloCellETByLayerByReceiverKey, ctx);
121 }
122 //Loop filling the decorations
123 for (const auto* x : *tts) {
124 if (doCellEnergy) {
125 caloCellEnergyDecorator.value()(*x) = m_ttTools->caloCellsEnergy(*x);
126 }
127 if (doCellET) {
128 caloCellETDecorator.value()(*x) = m_ttTools->caloCellsET(*x);
129 }
130 if (doCellEnergyByLayer) {
131 caloCellEnergyByLayerDecorator.value()(*x) = m_ttTools->caloCellsEnergyByLayer(*x);
132 }
133 if (doCellETByLayer) {
134 caloCellETByLayerDecorator.value()(*x) = m_ttTools->caloCellsETByLayer(*x);
135 }
136 if (doCellsQuality) {
137 caloCellsQualityDecorator.value()(*x) = m_ttTools->caloCellsQuality(*x);
138 }
139 if (doCellEnergyByLayerByReceiver) {
140 caloCellEnergyByLayerByReceiverDecorator.value()(*x) = m_ttTools->caloCellsEnergyByLayerByReceiver(*x);
141 }
142 if (doCellETByLayerByReceiver) {
143 caloCellETByLayerByReceiverDecorator.value()(*x) = m_ttTools->caloCellsETByLayerByReceiver(*x);
144 }
145 } //end of decoration loop
146 } // Trigger towers present in Storegate
147
148 // Return gracefully:
149 return StatusCode::SUCCESS;
150}
151}
#define ATH_MSG_INFO(x)
#define CHECK(...)
Evaluate an expression and check for errors.
#define x
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
SG::WriteDecorHandleKey< xAOD::TriggerTowerContainer > m_caloCellETByLayerKey
SG::WriteDecorHandleKey< xAOD::TriggerTowerContainer > m_caloCellEnergyKey
ToolHandle< LVL1::IL1CaloxAODOfflineTriggerTowerTools > m_ttTools
virtual StatusCode execute(const EventContext &ctx) override
Function executing the algorithm.
SG::WriteDecorHandleKey< xAOD::TriggerTowerContainer > m_caloCellsQualityKey
virtual StatusCode initialize() override
Function initialising the algorithm.
SG::ReadHandleKey< xAOD::TriggerTowerContainer > m_triggerTowerContainerKey
L1CaloTriggerTowerDecoratorAlg(const std::string &name, ISvcLocator *svcLoc)
SG::WriteDecorHandleKey< xAOD::TriggerTowerContainer > m_caloCellEnergyByLayerByReceiverKey
SG::WriteDecorHandleKey< xAOD::TriggerTowerContainer > m_caloCellETKey
SG::WriteDecorHandleKey< xAOD::TriggerTowerContainer > m_caloCellETByLayerByReceiverKey
SG::WriteDecorHandleKey< xAOD::TriggerTowerContainer > m_caloCellEnergyByLayerKey
Handle class for adding a decoration to an object.
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...