27 declareProperty(
"decoration_pattern",
29 declareProperty(
"gain_names",
33 declareProperty(
"layers",
m_layers = { 0, 1, 2, 3 });
40 std::string(
"{layer}").size(),
43 name.find(
"{gain}"), std::string(
"{gain}").size(), kv.second);
44 std::string name_E(
name), name_rnoW(
name), name_nCells(
name);
45 name_E.replace(name_E.find(
"{info}"), std::string(
"{info}").size(),
"E");
46 name_rnoW.replace(name_rnoW.find(
"{info}"), std::string(
"{info}").size(),
"rnoW");
48 name_nCells.find(
"{info}"), std::string(
"{info}").size(),
"nCells");
50 std::pair<int, int>
key(kv.first,
layer);
57 ATH_MSG_DEBUG(
"Decorating (layer, gain): " << kv.first <<
" " << kv.second);
60 ATH_MSG_DEBUG(
"Decorating (layer, gain): " << kv.first <<
" " << kv.second);
73 if (m_SGKey_photons.key().empty() && m_SGKey_electrons.key().empty()) {
74 ATH_MSG_FATAL(
"No e-gamma collection provided for thinning. At least one "
75 "egamma collection (photons/electrons) must be provided!");
76 return StatusCode::FAILURE;
79 if (!m_SGKey_electrons.key().empty()) {
80 ATH_MSG_DEBUG(
"Using " << m_SGKey_electrons <<
" for electrons");
81 ATH_CHECK(m_SGKey_electrons.initialize());
83 const std::string containerKey = m_SGKey_electrons.key();
84 for (
const auto& kv : m_gainNames) {
85 for (
const auto layer : m_layers) {
86 std::pair<int, int>
key(kv.first,
layer);
87 m_SGKey_electrons_decorations.emplace_back(containerKey +
"." +
89 m_SGKey_electrons_decorations.emplace_back(containerKey +
"." +
91 m_SGKey_electrons_decorations.emplace_back(containerKey +
"." +
95 ATH_CHECK(m_SGKey_electrons_decorations.initialize());
98 if (!m_SGKey_photons.key().empty()) {
102 const std::string containerKey = m_SGKey_photons.key();
103 for (
const auto& kv : m_gainNames) {
104 for (
const auto layer : m_layers) {
105 std::pair<int, int>
key(kv.first,
layer);
106 m_SGKey_photons_decorations.emplace_back(containerKey +
"." +
108 m_SGKey_photons_decorations.emplace_back(containerKey +
"." +
110 m_SGKey_photons_decorations.emplace_back(containerKey +
"." +
111 m_names_nCells[
key]);
114 ATH_CHECK(m_SGKey_photons_decorations.initialize());
117 return StatusCode::SUCCESS;
124 return StatusCode::SUCCESS;
134 if (!m_SGKey_photons.key().empty()) {
141 std::vector<SG::WriteDecorHandle<xAOD::EgammaContainer, float>>
143 std::vector<SG::WriteDecorHandle<xAOD::EgammaContainer, float>>
145 std::vector<SG::WriteDecorHandle<xAOD::EgammaContainer, char>>
148 for (
const auto& kv : m_gainNames) {
149 for (
const auto layer : m_layers) {
150 std::pair<int, int>
key(kv.first,
layer);
151 decorations_E.emplace_back(
153 m_SGKey_photons_decorations[
i * 3], ctx);
154 decorations_rnoW.emplace_back(
156 m_SGKey_photons_decorations[
i * 3 + 1], ctx);
157 decorations_nCells.emplace_back(
159 m_SGKey_photons_decorations[
i * 3 + 2], ctx);
165 for (
const auto*
photon : *importedPhotons) {
169 for (
const auto& kv : m_gainNames) {
170 for (
const auto layer : m_layers) {
171 std::pair<int, int>
key(kv.first,
layer);
172 decorations_E[
i](*photon) =
res.E[
key];
173 decorations_rnoW[
i](*photon) =
175 decorations_nCells[
i](*photon) =
res.nCells[
key];
184 if (!m_SGKey_electrons.key().empty()) {
192 std::vector<SG::WriteDecorHandle<xAOD::EgammaContainer, float>>
194 std::vector<SG::WriteDecorHandle<xAOD::EgammaContainer, float>>
196 std::vector<SG::WriteDecorHandle<xAOD::EgammaContainer, char>>
199 for (
const auto& kv : m_gainNames) {
200 for (
const auto layer : m_layers) {
201 std::pair<int, int>
key(kv.first,
layer);
202 decorations_E.emplace_back(
204 m_SGKey_electrons_decorations[
i * 3], ctx);
205 decorations_rnoW.emplace_back(
207 m_SGKey_electrons_decorations[
i * 3 + 1], ctx);
208 decorations_nCells.emplace_back(
210 m_SGKey_electrons_decorations[
i * 3 + 2], ctx);
216 for (
const auto*
electron : *importedElectrons) {
220 for (
const auto& kv : m_gainNames) {
221 for (
const auto layer : m_layers) {
222 std::pair<int, int>
key(kv.first,
layer);
223 decorations_E[
i](*electron) =
res.E[
key];
224 decorations_rnoW[
i](*electron) =
226 decorations_nCells[
i](*electron) =
res.nCells[
key];
233 return StatusCode::SUCCESS;
244 for (
const auto& kv : m_names_E) {
246 result.EnoW[kv.first] = 0.;
247 result.nCells[kv.first] = 0;
253 egamma->caloCluster() ?
egamma->caloCluster()->getCellLinks() :
nullptr;
278 (
cell &&
cell->caloDDE() ?
cell->caloDDE()->getSampling() : -1);