36 if (!m_SGKey_electrons.key().empty()) {
37 const std::string
key = m_SGKey_electrons.key();
39 ATH_CHECK(m_SGKey_electrons.initialize());
42 m_SGKey_electrons_decorations.emplace_back(
key +
".maxEcell_time");
43 m_SGKey_electrons_decorations.emplace_back(
key +
".maxEcell_energy");
44 m_SGKey_electrons_decorations.emplace_back(
key +
".maxEcell_gain");
45 m_SGKey_electrons_decorations.emplace_back(
key +
".maxEcell_onlId");
46 m_SGKey_electrons_decorations.emplace_back(
key +
".maxEcell_x");
47 m_SGKey_electrons_decorations.emplace_back(
key +
".maxEcell_y");
48 m_SGKey_electrons_decorations.emplace_back(
key +
".maxEcell_z");
50 if (!m_SGKey_egammaClusters.key().empty()) {
51 ATH_MSG_INFO(
"Using " << m_SGKey_egammaClusters.key() <<
" to try to match a cluster to the LRT egamma cluster");
52 ATH_CHECK(m_SGKey_egammaClusters.initialize());
53 m_SGKey_electrons_decorations.emplace_back(
key +
".dR");
56 ATH_CHECK(m_SGKey_electrons_decorations.initialize());
59 if (!m_SGKey_photons.key().empty()) {
60 const std::string
key = m_SGKey_photons.key();
65 m_SGKey_photons_decorations.emplace_back(
key +
".maxEcell_time");
66 m_SGKey_photons_decorations.emplace_back(
key +
".maxEcell_energy");
67 m_SGKey_photons_decorations.emplace_back(
key +
".maxEcell_gain");
68 m_SGKey_photons_decorations.emplace_back(
key +
".maxEcell_onlId");
69 m_SGKey_photons_decorations.emplace_back(
key +
".maxEcell_x");
70 m_SGKey_photons_decorations.emplace_back(
key +
".maxEcell_y");
71 m_SGKey_photons_decorations.emplace_back(
key +
".maxEcell_z");
72 ATH_CHECK(m_SGKey_photons_decorations.initialize());
75 if (!m_SGKey_taus.key().empty()) {
76 const std::string
key = m_SGKey_taus.key();
81 m_SGKey_taus_decorations.emplace_back(
key +
".maxEcell_time");
82 m_SGKey_taus_decorations.emplace_back(
key +
".maxEcell_energy");
83 m_SGKey_taus_decorations.emplace_back(
key +
".maxEcell_gain");
84 m_SGKey_taus_decorations.emplace_back(
key +
".maxEcell_onlId");
85 m_SGKey_taus_decorations.emplace_back(
key +
".maxEcell_x");
86 m_SGKey_taus_decorations.emplace_back(
key +
".maxEcell_y");
87 m_SGKey_taus_decorations.emplace_back(
key +
".maxEcell_z");
88 ATH_CHECK(m_SGKey_taus_decorations.initialize());
91 if (!m_SGKey_jets.key().empty()) {
92 const std::string
key = m_SGKey_jets.key();
97 m_SGKey_jets_decorations.emplace_back(
key +
".maxEcell_time");
98 m_SGKey_jets_decorations.emplace_back(
key +
".maxEcell_energy");
99 m_SGKey_jets_decorations.emplace_back(
key +
".maxEcell_gain");
100 m_SGKey_jets_decorations.emplace_back(
key +
".maxEcell_onlId");
101 m_SGKey_jets_decorations.emplace_back(
key +
".maxEcell_x");
102 m_SGKey_jets_decorations.emplace_back(
key +
".maxEcell_y");
103 m_SGKey_jets_decorations.emplace_back(
key +
".maxEcell_z");
104 ATH_CHECK(m_SGKey_jets_decorations.initialize());
107 return StatusCode::SUCCESS;
113 return StatusCode::SUCCESS;
120 const EventContext& ctx = Gaudi::Hive::currentContext();
122 if (!m_SGKey_photons.key().empty()) {
127 m_SGKey_photons_decorations[0], ctx);
129 m_SGKey_photons_decorations[1], ctx);
131 m_SGKey_photons_decorations[2], ctx);
133 m_SGKey_photons_decorations[3], ctx);
135 m_SGKey_photons_decorations[4], ctx);
137 m_SGKey_photons_decorations[5], ctx);
139 m_SGKey_photons_decorations[6], ctx);
142 for (
const auto*
egamma : *importedPhotons) {
145 decorateObject(cluster, ctx);
146 decorationPh0(*
egamma) =
res.maxEcell_time;
147 decorationPh1(*
egamma) =
res.maxEcell_energy;
148 decorationPh2(*
egamma) =
res.maxEcell_gain;
149 decorationPh3(*
egamma) =
res.maxEcell_onlId;
156 if (!m_SGKey_electrons.key().empty()) {
162 std::optional<SG::WriteDecorHandle<xAOD::EgammaContainer, float>> odecorationEl7;
164 if (!m_SGKey_egammaClusters.key().empty()) {
166 m_SGKey_egammaClusters, ctx);
167 egClContainer = egClContainerRH.
ptr();
168 odecorationEl7.
emplace(m_SGKey_electrons_decorations[7], ctx);
173 m_SGKey_electrons_decorations[0], ctx);
175 m_SGKey_electrons_decorations[1], ctx);
177 m_SGKey_electrons_decorations[2], ctx);
179 m_SGKey_electrons_decorations[3], ctx);
181 m_SGKey_electrons_decorations[4], ctx);
183 m_SGKey_electrons_decorations[5], ctx);
185 m_SGKey_electrons_decorations[6], ctx);
188 for (
const auto*
egamma : *importedElectrons) {
190 if (!m_SGKey_egammaClusters.key().empty()) {
193 for (
const auto *clus : *egClContainer) {
194 double dR = clus->p4().DeltaR(cluster->
p4());
195 if (dR < dRMin && dR < m_dRLRTegClusegClusMax) {
197 matchedCluster = clus;
200 cluster = matchedCluster;
201 odecorationEl7.value()(*egamma) = dRMin;
204 decorateObject(cluster, ctx);
205 decorationEl0(*
egamma) =
res.maxEcell_time;
206 decorationEl1(*
egamma) =
res.maxEcell_energy;
207 decorationEl2(*
egamma) =
res.maxEcell_gain;
208 decorationEl3(*
egamma) =
res.maxEcell_onlId;
215 if (!m_SGKey_taus.key().empty()) {
220 m_SGKey_taus_decorations[0], ctx);
222 m_SGKey_taus_decorations[1], ctx);
224 m_SGKey_taus_decorations[2], ctx);
226 m_SGKey_taus_decorations[3], ctx);
228 m_SGKey_taus_decorations[4], ctx);
230 m_SGKey_taus_decorations[5], ctx);
232 m_SGKey_taus_decorations[6], ctx);
235 for (
const auto* tau : *importedTaus) {
237 res.maxEcell_energy = -9999.;
238 for (
size_t i = 0;
i<tau->nClusters();++
i) {
253 decorateObject(cluster, ctx);
259 decorationTau0(*tau) =
res.maxEcell_time;
260 decorationTau1(*tau) =
res.maxEcell_energy;
261 decorationTau2(*tau) =
res.maxEcell_gain;
262 decorationTau3(*tau) =
res.maxEcell_onlId;
263 decorationTau4(*tau) =
res.maxEcell_x;
264 decorationTau5(*tau) =
res.maxEcell_y;
265 decorationTau6(*tau) =
res.maxEcell_z;
269 if (!m_SGKey_jets.key().empty()) {
274 m_SGKey_jets_decorations[0], ctx);
276 m_SGKey_jets_decorations[1], ctx);
278 m_SGKey_jets_decorations[2], ctx);
280 m_SGKey_jets_decorations[3], ctx);
282 m_SGKey_jets_decorations[4], ctx);
284 m_SGKey_jets_decorations[5], ctx);
286 m_SGKey_jets_decorations[6], ctx);
289 for (
const auto*
jet : *importedJets) {
290 if (
jet->numConstituents() == 0)
continue;
293 res.maxEcell_energy = -9999.;
294 std::vector<const xAOD::CaloCluster*> clusterList;
301 for (
size_t i=0;
i<
jet->numConstituents();++
i) {
303 ATH_MSG_WARNING(
"Tried to call fillEperSamplingFE with a jet constituent that is not a FlowElement!");
310 auto originalFE =
dynamic_cast<const xAOD::FlowElement*
>(*originalObject(*constit));
311 if(originalFE && !originalFE->isCharged()){
314 clusterList.push_back(cluster);
321 for (
size_t i=0;
i<
jet->numConstituents();++
i) {
323 ATH_MSG_WARNING(
"Tried to call fillEperSamplingCluster with a jet constituent that is not a cluster!");
329 clusterList.push_back(cluster);
334 for (
size_t i=0;
i<
jet->numConstituents();++
i) {
340 for (
unsigned int cidx=0;cidx<iPFO->
nCaloCluster();++cidx) {
342 clusterList.push_back(iPFO->
cluster(cidx));
349 for (
auto cluster : clusterList) {
351 decorateObject(cluster, ctx);
357 decorationJet0(*
jet) =
res.maxEcell_time;
358 decorationJet1(*
jet) =
res.maxEcell_energy;
359 decorationJet2(*
jet) =
res.maxEcell_gain;
360 decorationJet3(*
jet) =
res.maxEcell_onlId;
361 decorationJet4(*
jet) =
res.maxEcell_x;
362 decorationJet5(*
jet) =
res.maxEcell_y;
363 decorationJet6(*
jet) =
res.maxEcell_z;
367 return StatusCode::SUCCESS;
373 const EventContext& ctx)
const
387 ATH_MSG_ERROR(
"Do not have mapping object " << m_cablingKey.key());
393 const CaloCell* cell_maxE =
nullptr;
395 int sampling =
cell->caloDDE()->getSampling();
397 if ((
cell->provenance() & 0x2000)) {
398 if (
cell->energy() > emax) {
399 emax =
cell->energy();
414 result.maxEcell_x = caloDDEl->
x();
415 result.maxEcell_y = caloDDEl->
y();
416 result.maxEcell_z = caloDDEl->
z();