25 declareInterface<DerivationFramework::IAugmentationTool>(
this);
42 if (m_SGKey_photons.empty() and m_SGKey_electrons.empty()) {
43 ATH_MSG_FATAL(
"No e-gamma collection provided for thinning. At least one "
44 "egamma collection (photons/electrons) must be provided!");
45 return StatusCode::FAILURE;
48 ATH_CHECK(m_caloFillRectangularTool.retrieve());
54 &(*m_caloFillRectangularTool));
55 if (m_tool==
nullptr) {
56 ATH_MSG_ERROR(
"Pointer to CaloFillRectantularCluster tool is invalid");
57 return StatusCode::FAILURE;
60 ATH_CHECK(m_SGKey_caloCells.initialize());
62 if (!m_SGKey_electrons.key().empty()) {
63 ATH_MSG_DEBUG(
"Using " << m_SGKey_electrons <<
" for electrons");
64 ATH_CHECK(m_SGKey_electrons.initialize());
66 const char* containerKey = m_SGKey_electrons.key().c_str();
67 for (
int layer : m_layers) {
68 m_SGKey_electrons_decorations.emplace_back(
69 Form(
"%s.E%dx%d_Lr%d", containerKey, m_eta_size, m_phi_size,
layer));
71 ATH_CHECK(m_SGKey_electrons_decorations.initialize());
74 if (!m_SGKey_photons.key().empty()) {
78 const char* containerKey = m_SGKey_photons.key().c_str();
79 for (
int layer : m_layers) {
80 m_SGKey_photons_decorations.emplace_back(
81 Form(
"%s.E%dx%d_Lr%d", containerKey, m_eta_size, m_phi_size,
layer));
83 ATH_CHECK(m_SGKey_photons_decorations.initialize());
86 return StatusCode::SUCCESS;
93 return StatusCode::SUCCESS;
100 const EventContext& ctx = Gaudi::Hive::currentContext();
109 if (!m_SGKey_photons.key().empty()) {
116 std::vector<SG::WriteDecorHandle<xAOD::EgammaContainer, float>> decorations;
117 for (
unsigned int i = 0;
i < m_layers.size();
i++) {
118 decorations.emplace_back(
120 m_SGKey_photons_decorations[
i], ctx);
124 for (
const auto*
photon : *importedPhotons) {
125 std::vector<float>
result = decorateObject(ctx,
photon, cellCont);
126 for (
unsigned int i = 0;
i < m_layers.size();
i++) {
127 decorations[
i](*photon) =
result[
i];
134 if (!m_SGKey_electrons.key().empty()) {
142 std::vector<SG::WriteDecorHandle<xAOD::EgammaContainer, float>> decorations;
143 for (
unsigned int i = 0;
i < m_layers.size();
i++) {
144 decorations.emplace_back(
146 m_SGKey_electrons_decorations[
i], ctx);
150 for (
const auto*
electron : *importedElectrons) {
151 std::vector<float>
result = decorateObject(ctx,
electron, cellCont);
152 for (
unsigned int i = 0;
i < m_layers.size();
i++) {
153 decorations[
i](*electron) =
result[
i];
158 return StatusCode::SUCCESS;
163 const EventContext& ctx,
167 std::vector<float>
result;
172 std::unique_ptr<xAOD::CaloCluster> egcClone;
176 egamma->caloCluster()->eta0(),
177 egamma->caloCluster()->phi0(),
178 egamma->caloCluster()->clusterSize());
179 m_tool->makeCorrection(ctx, egcClone.get());
182 for (
unsigned int layer : m_layers) {