27 declareProperty(
"layers",
m_layers = { 0, 1, 2, 3 });
41 if (m_SGKey_photons.empty() and m_SGKey_electrons.empty()) {
42 ATH_MSG_FATAL(
"No e-gamma collection provided for thinning. At least one "
43 "egamma collection (photons/electrons) must be provided!");
44 return StatusCode::FAILURE;
47 ATH_CHECK(m_caloFillRectangularTool.retrieve());
53 &(*m_caloFillRectangularTool));
54 if (m_tool==
nullptr) {
55 ATH_MSG_ERROR(
"Pointer to CaloFillRectantularCluster tool is invalid");
56 return StatusCode::FAILURE;
59 ATH_CHECK(m_SGKey_caloCells.initialize());
61 if (!m_SGKey_electrons.key().empty()) {
62 ATH_MSG_DEBUG(
"Using " << m_SGKey_electrons <<
" for electrons");
63 ATH_CHECK(m_SGKey_electrons.initialize());
65 const char* containerKey = m_SGKey_electrons.key().c_str();
66 for (
int layer : m_layers) {
67 m_SGKey_electrons_decorations.emplace_back(
68 Form(
"%s.E%dx%d_Lr%d", containerKey, m_eta_size, m_phi_size,
layer));
70 ATH_CHECK(m_SGKey_electrons_decorations.initialize());
73 if (!m_SGKey_photons.key().empty()) {
77 const char* containerKey = m_SGKey_photons.key().c_str();
78 for (
int layer : m_layers) {
79 m_SGKey_photons_decorations.emplace_back(
80 Form(
"%s.E%dx%d_Lr%d", containerKey, m_eta_size, m_phi_size,
layer));
82 ATH_CHECK(m_SGKey_photons_decorations.initialize());
85 return StatusCode::SUCCESS;
92 return StatusCode::SUCCESS;
99 const EventContext& ctx = Gaudi::Hive::currentContext();
108 if (!m_SGKey_photons.key().empty()) {
115 std::vector<SG::WriteDecorHandle<xAOD::EgammaContainer, float>> decorations;
116 for (
unsigned int i = 0;
i < m_layers.size();
i++) {
117 decorations.emplace_back(
119 m_SGKey_photons_decorations[
i], ctx);
123 for (
const auto*
photon : *importedPhotons) {
124 std::vector<float>
result = decorateObject(ctx,
photon, cellCont);
125 for (
unsigned int i = 0;
i < m_layers.size();
i++) {
126 decorations[
i](*photon) =
result[
i];
133 if (!m_SGKey_electrons.key().empty()) {
141 std::vector<SG::WriteDecorHandle<xAOD::EgammaContainer, float>> decorations;
142 for (
unsigned int i = 0;
i < m_layers.size();
i++) {
143 decorations.emplace_back(
145 m_SGKey_electrons_decorations[
i], ctx);
149 for (
const auto*
electron : *importedElectrons) {
150 std::vector<float>
result = decorateObject(ctx,
electron, cellCont);
151 for (
unsigned int i = 0;
i < m_layers.size();
i++) {
152 decorations[
i](*electron) =
result[
i];
157 return StatusCode::SUCCESS;
162 const EventContext& ctx,
166 std::vector<float>
result;
171 std::unique_ptr<xAOD::CaloCluster> egcClone;
175 egamma->caloCluster()->eta0(),
176 egamma->caloCluster()->phi0(),
177 egamma->caloCluster()->clusterSize());
178 m_tool->makeCorrection(ctx, egcClone.get());
181 for (
unsigned int layer : m_layers) {