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;
131 const EventContext& ctx = Gaudi::Hive::currentContext();
135 if (!m_SGKey_photons.key().empty()) {
142 std::vector<SG::WriteDecorHandle<xAOD::EgammaContainer, float>>
144 std::vector<SG::WriteDecorHandle<xAOD::EgammaContainer, float>>
146 std::vector<SG::WriteDecorHandle<xAOD::EgammaContainer, char>>
149 for (
const auto& kv : m_gainNames) {
150 for (
const auto layer : m_layers) {
151 std::pair<int, int>
key(kv.first,
layer);
152 decorations_E.emplace_back(
154 m_SGKey_photons_decorations[
i * 3], ctx);
155 decorations_rnoW.emplace_back(
157 m_SGKey_photons_decorations[
i * 3 + 1], ctx);
158 decorations_nCells.emplace_back(
160 m_SGKey_photons_decorations[
i * 3 + 2], ctx);
166 for (
const auto*
photon : *importedPhotons) {
170 for (
const auto& kv : m_gainNames) {
171 for (
const auto layer : m_layers) {
172 std::pair<int, int>
key(kv.first,
layer);
173 decorations_E[
i](*photon) =
res.E[
key];
174 decorations_rnoW[
i](*photon) =
176 decorations_nCells[
i](*photon) =
res.nCells[
key];
185 if (!m_SGKey_electrons.key().empty()) {
193 std::vector<SG::WriteDecorHandle<xAOD::EgammaContainer, float>>
195 std::vector<SG::WriteDecorHandle<xAOD::EgammaContainer, float>>
197 std::vector<SG::WriteDecorHandle<xAOD::EgammaContainer, char>>
200 for (
const auto& kv : m_gainNames) {
201 for (
const auto layer : m_layers) {
202 std::pair<int, int>
key(kv.first,
layer);
203 decorations_E.emplace_back(
205 m_SGKey_electrons_decorations[
i * 3], ctx);
206 decorations_rnoW.emplace_back(
208 m_SGKey_electrons_decorations[
i * 3 + 1], ctx);
209 decorations_nCells.emplace_back(
211 m_SGKey_electrons_decorations[
i * 3 + 2], ctx);
217 for (
const auto*
electron : *importedElectrons) {
221 for (
const auto& kv : m_gainNames) {
222 for (
const auto layer : m_layers) {
223 std::pair<int, int>
key(kv.first,
layer);
224 decorations_E[
i](*electron) =
res.E[
key];
225 decorations_rnoW[
i](*electron) =
227 decorations_nCells[
i](*electron) =
res.nCells[
key];
234 return StatusCode::SUCCESS;
245 for (
const auto& kv : m_names_E) {
247 result.EnoW[kv.first] = 0.;
248 result.nCells[kv.first] = 0;
254 egamma->caloCluster() ?
egamma->caloCluster()->getCellLinks() :
nullptr;
279 (
cell &&
cell->caloDDE() ?
cell->caloDDE()->getSampling() : -1);