ATLAS Offline Software
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>
16 namespace 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()) {
45  CHECK(m_caloCellEnergyByLayerKey.initialize());
46  }
47  if (!m_caloCellETByLayerKey.empty()) {
48  CHECK(m_caloCellETByLayerKey.initialize());
49  }
52  }
53  if (!m_caloCellETByLayerByReceiverKey.empty()) {
55  }
56  }
57 
58  // Return gracefully:
59  return StatusCode::SUCCESS;
60 }
61 
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 }
LVL1::L1CaloTriggerTowerDecoratorAlg::m_caloCellEnergyByLayerByReceiverKey
SG::WriteDecorHandleKey< xAOD::TriggerTowerContainer > m_caloCellEnergyByLayerByReceiverKey
Definition: L1CaloTriggerTowerDecoratorAlg.h:48
LVL1::L1CaloTriggerTowerDecoratorAlg::m_ttTools
ToolHandle< LVL1::IL1CaloxAODOfflineTriggerTowerTools > m_ttTools
Definition: L1CaloTriggerTowerDecoratorAlg.h:39
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
L1CaloTriggerTowerDecoratorAlg.h
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
LVL1::L1CaloTriggerTowerDecoratorAlg::m_caloCellETByLayerByReceiverKey
SG::WriteDecorHandleKey< xAOD::TriggerTowerContainer > m_caloCellETByLayerByReceiverKey
Definition: L1CaloTriggerTowerDecoratorAlg.h:49
TriggerTowerContainer.h
LVL1::L1CaloTriggerTowerDecoratorAlg::m_triggerTowerContainerKey
SG::ReadHandleKey< xAOD::TriggerTowerContainer > m_triggerTowerContainerKey
Definition: L1CaloTriggerTowerDecoratorAlg.h:36
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition: ICMMCPHitsCnvTool.h:18
x
#define x
LVL1::L1CaloTriggerTowerDecoratorAlg::m_caloCellEnergyByLayerKey
SG::WriteDecorHandleKey< xAOD::TriggerTowerContainer > m_caloCellEnergyByLayerKey
Definition: L1CaloTriggerTowerDecoratorAlg.h:45
LVL1::L1CaloTriggerTowerDecoratorAlg::m_caloCellEnergyKey
SG::WriteDecorHandleKey< xAOD::TriggerTowerContainer > m_caloCellEnergyKey
Definition: L1CaloTriggerTowerDecoratorAlg.h:41
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition: AthCommonDataStore.h:145
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:100
LVL1::L1CaloTriggerTowerDecoratorAlg::initialize
virtual StatusCode initialize() override
Function initialising the algorithm.
Definition: L1CaloTriggerTowerDecoratorAlg.cxx:26
LVL1::L1CaloTriggerTowerDecoratorAlg::L1CaloTriggerTowerDecoratorAlg
L1CaloTriggerTowerDecoratorAlg(const std::string &name, ISvcLocator *svcLoc)
Definition: L1CaloTriggerTowerDecoratorAlg.cxx:18
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
AthAlgorithm
Definition: AthAlgorithm.h:47
TrigConf::name
Definition: HLTChainList.h:35
LVL1::L1CaloTriggerTowerDecoratorAlg::m_caloCellETKey
SG::WriteDecorHandleKey< xAOD::TriggerTowerContainer > m_caloCellETKey
Definition: L1CaloTriggerTowerDecoratorAlg.h:42
LVL1::L1CaloTriggerTowerDecoratorAlg::m_caloCellETByLayerKey
SG::WriteDecorHandleKey< xAOD::TriggerTowerContainer > m_caloCellETByLayerKey
Definition: L1CaloTriggerTowerDecoratorAlg.h:46
TrigT1CaloDefs.h
LVL1::L1CaloTriggerTowerDecoratorAlg::m_caloCellsQualityKey
SG::WriteDecorHandleKey< xAOD::TriggerTowerContainer > m_caloCellsQualityKey
Definition: L1CaloTriggerTowerDecoratorAlg.h:44
SG::AllowEmpty
@ AllowEmpty
Definition: StoreGate/StoreGate/VarHandleKey.h:27
LVL1::L1CaloTriggerTowerDecoratorAlg::execute
virtual StatusCode execute() override
Function executing the algorithm.
Definition: L1CaloTriggerTowerDecoratorAlg.cxx:63