27 declareInterface<DerivationFramework::IAugmentationTool>(
this);
41 std::string(
"{layer}").size(),
44 name.find(
"{gain}"), std::string(
"{gain}").size(), kv.second);
45 std::string name_E(
name), name_rnoW(
name), name_nCells(
name);
46 name_E.replace(name_E.find(
"{info}"), std::string(
"{info}").size(),
"E");
47 name_rnoW.replace(name_rnoW.find(
"{info}"), std::string(
"{info}").size(),
"rnoW");
49 name_nCells.find(
"{info}"), std::string(
"{info}").size(),
"nCells");
51 std::pair<int, int>
key(kv.first,
layer);
58 ATH_MSG_DEBUG(
"Decorating (layer, gain): " << kv.first <<
" " << kv.second);
61 ATH_MSG_DEBUG(
"Decorating (layer, gain): " << kv.first <<
" " << kv.second);
74 if (m_SGKey_photons.key().empty() && m_SGKey_electrons.key().empty()) {
75 ATH_MSG_FATAL(
"No e-gamma collection provided for thinning. At least one "
76 "egamma collection (photons/electrons) must be provided!");
77 return StatusCode::FAILURE;
80 if (!m_SGKey_electrons.key().empty()) {
81 ATH_MSG_DEBUG(
"Using " << m_SGKey_electrons <<
" for electrons");
82 ATH_CHECK(m_SGKey_electrons.initialize());
84 const std::string containerKey = m_SGKey_electrons.key();
85 for (
const auto& kv : m_gainNames) {
86 for (
const auto layer : m_layers) {
87 std::pair<int, int>
key(kv.first,
layer);
88 m_SGKey_electrons_decorations.emplace_back(containerKey +
"." +
90 m_SGKey_electrons_decorations.emplace_back(containerKey +
"." +
92 m_SGKey_electrons_decorations.emplace_back(containerKey +
"." +
96 ATH_CHECK(m_SGKey_electrons_decorations.initialize());
99 if (!m_SGKey_photons.key().empty()) {
100 ATH_MSG_DEBUG(
"Using " << m_SGKey_photons <<
" for photons");
103 const std::string containerKey = m_SGKey_photons.key();
104 for (
const auto& kv : m_gainNames) {
105 for (
const auto layer : m_layers) {
106 std::pair<int, int>
key(kv.first,
layer);
107 m_SGKey_photons_decorations.emplace_back(containerKey +
"." +
109 m_SGKey_photons_decorations.emplace_back(containerKey +
"." +
111 m_SGKey_photons_decorations.emplace_back(containerKey +
"." +
112 m_names_nCells[
key]);
115 ATH_CHECK(m_SGKey_photons_decorations.initialize());
118 return StatusCode::SUCCESS;
125 return StatusCode::SUCCESS;
132 const EventContext& ctx = Gaudi::Hive::currentContext();
136 if (!m_SGKey_photons.key().empty()) {
143 std::vector<SG::WriteDecorHandle<xAOD::EgammaContainer, float>>
145 std::vector<SG::WriteDecorHandle<xAOD::EgammaContainer, float>>
147 std::vector<SG::WriteDecorHandle<xAOD::EgammaContainer, char>>
150 for (
const auto& kv : m_gainNames) {
151 for (
const auto layer : m_layers) {
152 std::pair<int, int>
key(kv.first,
layer);
153 decorations_E.emplace_back(
155 m_SGKey_photons_decorations[
i * 3], ctx);
156 decorations_rnoW.emplace_back(
158 m_SGKey_photons_decorations[
i * 3 + 1], ctx);
159 decorations_nCells.emplace_back(
161 m_SGKey_photons_decorations[
i * 3 + 2], ctx);
167 for (
const auto*
photon : *importedPhotons) {
171 for (
const auto& kv : m_gainNames) {
172 for (
const auto layer : m_layers) {
173 std::pair<int, int>
key(kv.first,
layer);
174 decorations_E[
i](*photon) =
res.E[
key];
175 decorations_rnoW[
i](*photon) =
177 decorations_nCells[
i](*photon) =
res.nCells[
key];
186 if (!m_SGKey_electrons.key().empty()) {
194 std::vector<SG::WriteDecorHandle<xAOD::EgammaContainer, float>>
196 std::vector<SG::WriteDecorHandle<xAOD::EgammaContainer, float>>
198 std::vector<SG::WriteDecorHandle<xAOD::EgammaContainer, char>>
201 for (
const auto& kv : m_gainNames) {
202 for (
const auto layer : m_layers) {
203 std::pair<int, int>
key(kv.first,
layer);
204 decorations_E.emplace_back(
206 m_SGKey_electrons_decorations[
i * 3], ctx);
207 decorations_rnoW.emplace_back(
209 m_SGKey_electrons_decorations[
i * 3 + 1], ctx);
210 decorations_nCells.emplace_back(
212 m_SGKey_electrons_decorations[
i * 3 + 2], ctx);
218 for (
const auto*
electron : *importedElectrons) {
222 for (
const auto& kv : m_gainNames) {
223 for (
const auto layer : m_layers) {
224 std::pair<int, int>
key(kv.first,
layer);
225 decorations_E[
i](*electron) =
res.E[
key];
226 decorations_rnoW[
i](*electron) =
228 decorations_nCells[
i](*electron) =
res.nCells[
key];
235 return StatusCode::SUCCESS;
246 for (
const auto& kv : m_names_E) {
248 result.EnoW[kv.first] = 0.;
249 result.nCells[kv.first] = 0;
255 egamma->caloCluster() ?
egamma->caloCluster()->getCellLinks() :
nullptr;
280 (
cell &&
cell->caloDDE() ?
cell->caloDDE()->getSampling() : -1);