ATLAS Offline Software
Loading...
Searching...
No Matches
L1CaloTriggerTowerDecoratorAlg.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
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()) {
69 const EventContext& ctx = Gaudi::Hive::currentContext();
71 ctx);
72 CHECK(m_ttTools->initCaloCells());
73
74 // We have optional Write Decor handles outside the loop
75 // And bools to check outside/inside the loop.
76 const bool doCellEnergy = !m_caloCellEnergyKey.empty();
77 const bool doCellET = !m_caloCellETKey.empty();
78 const bool doCellsQuality = !m_caloCellsQualityKey.empty();
79 const bool doCellEnergyByLayer = !m_caloCellEnergyByLayerKey.empty();
80 const bool doCellETByLayer = !m_caloCellETByLayerKey.empty();
81 const bool doCellEnergyByLayerByReceiver = !m_caloCellEnergyByLayerByReceiverKey.empty();
82 const bool doCellETByLayerByReceiver = !m_caloCellETByLayerByReceiverKey.empty();
83 std::optional<SG::WriteDecorHandle<xAOD::TriggerTowerContainer, float>>
84 caloCellEnergyDecorator;
85 std::optional<SG::WriteDecorHandle<xAOD::TriggerTowerContainer, float>>
86 caloCellETDecorator;
87 std::optional<SG::WriteDecorHandle<xAOD::TriggerTowerContainer, float>>
88 caloCellsQualityDecorator;
89 std::optional<
91 caloCellEnergyByLayerDecorator;
92 std::optional<
94 caloCellETByLayerDecorator;
95 std::optional<
97 caloCellEnergyByLayerByReceiverDecorator;
98 std::optional<
100 caloCellETByLayerByReceiverDecorator;
101
102 if (doCellEnergy) {
103 caloCellEnergyDecorator.emplace(m_caloCellEnergyKey, ctx);
104 }
105 if (doCellET) {
106 caloCellETDecorator.emplace(m_caloCellETKey, ctx);
107 }
108 if (doCellsQuality) {
109 caloCellsQualityDecorator.emplace(m_caloCellsQualityKey, ctx);
110 }
111 if (doCellEnergyByLayer) {
112 caloCellEnergyByLayerDecorator.emplace(m_caloCellEnergyByLayerKey, ctx);
113 }
114 if (doCellETByLayer) {
115 caloCellETByLayerDecorator.emplace(m_caloCellETByLayerKey, ctx);
116 }
117 if (doCellEnergyByLayerByReceiver) {
118 caloCellEnergyByLayerByReceiverDecorator.emplace(m_caloCellEnergyByLayerByReceiverKey, ctx);
119 }
120 if (doCellETByLayerByReceiver) {
121 caloCellETByLayerByReceiverDecorator.emplace(m_caloCellETByLayerByReceiverKey, ctx);
122 }
123 //Loop filling the decorations
124 for (const auto* x : *tts) {
125 if (doCellEnergy) {
126 caloCellEnergyDecorator.value()(*x) = m_ttTools->caloCellsEnergy(*x);
127 }
128 if (doCellET) {
129 caloCellETDecorator.value()(*x) = m_ttTools->caloCellsET(*x);
130 }
131 if (doCellEnergyByLayer) {
132 caloCellEnergyByLayerDecorator.value()(*x) = m_ttTools->caloCellsEnergyByLayer(*x);
133 }
134 if (doCellETByLayer) {
135 caloCellETByLayerDecorator.value()(*x) = m_ttTools->caloCellsETByLayer(*x);
136 }
137 if (doCellsQuality) {
138 caloCellsQualityDecorator.value()(*x) = m_ttTools->caloCellsQuality(*x);
139 }
140 if (doCellEnergyByLayerByReceiver) {
141 caloCellEnergyByLayerByReceiverDecorator.value()(*x) = m_ttTools->caloCellsEnergyByLayerByReceiver(*x);
142 }
143 if (doCellETByLayerByReceiver) {
144 caloCellETByLayerByReceiverDecorator.value()(*x) = m_ttTools->caloCellsETByLayerByReceiver(*x);
145 }
146 } //end of decoration loop
147 } // Trigger towers present in Storegate
148
149 // Return gracefully:
150 return StatusCode::SUCCESS;
151}
152}
#define ATH_MSG_INFO(x)
#define CHECK(...)
Evaluate an expression and check for errors.
#define x
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
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
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
virtual StatusCode execute() override
Function executing the algorithm.
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...