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;
121 if (!m_SGKey_photons.key().empty()) {
126 m_SGKey_photons_decorations[0], ctx);
128 m_SGKey_photons_decorations[1], ctx);
130 m_SGKey_photons_decorations[2], ctx);
132 m_SGKey_photons_decorations[3], ctx);
134 m_SGKey_photons_decorations[4], ctx);
136 m_SGKey_photons_decorations[5], ctx);
138 m_SGKey_photons_decorations[6], ctx);
141 for (
const auto*
egamma : *importedPhotons) {
144 decorateObject(cluster, ctx);
145 decorationPh0(*
egamma) =
res.maxEcell_time;
146 decorationPh1(*
egamma) =
res.maxEcell_energy;
147 decorationPh2(*
egamma) =
res.maxEcell_gain;
148 decorationPh3(*
egamma) =
res.maxEcell_onlId;
155 if (!m_SGKey_electrons.key().empty()) {
161 std::optional<SG::WriteDecorHandle<xAOD::EgammaContainer, float>> odecorationEl7;
163 if (!m_SGKey_egammaClusters.key().empty()) {
165 m_SGKey_egammaClusters, ctx);
166 egClContainer = egClContainerRH.
ptr();
167 odecorationEl7.
emplace(m_SGKey_electrons_decorations[7], ctx);
172 m_SGKey_electrons_decorations[0], ctx);
174 m_SGKey_electrons_decorations[1], ctx);
176 m_SGKey_electrons_decorations[2], ctx);
178 m_SGKey_electrons_decorations[3], ctx);
180 m_SGKey_electrons_decorations[4], ctx);
182 m_SGKey_electrons_decorations[5], ctx);
184 m_SGKey_electrons_decorations[6], ctx);
187 for (
const auto*
egamma : *importedElectrons) {
189 if (!m_SGKey_egammaClusters.key().empty()) {
192 for (
const auto *clus : *egClContainer) {
193 double dR = clus->p4().DeltaR(cluster->
p4());
194 if (dR < dRMin && dR < m_dRLRTegClusegClusMax) {
196 matchedCluster = clus;
199 cluster = matchedCluster;
200 odecorationEl7.value()(*egamma) = dRMin;
203 decorateObject(cluster, ctx);
204 decorationEl0(*
egamma) =
res.maxEcell_time;
205 decorationEl1(*
egamma) =
res.maxEcell_energy;
206 decorationEl2(*
egamma) =
res.maxEcell_gain;
207 decorationEl3(*
egamma) =
res.maxEcell_onlId;
214 if (!m_SGKey_taus.key().empty()) {
219 m_SGKey_taus_decorations[0], ctx);
221 m_SGKey_taus_decorations[1], ctx);
223 m_SGKey_taus_decorations[2], ctx);
225 m_SGKey_taus_decorations[3], ctx);
227 m_SGKey_taus_decorations[4], ctx);
229 m_SGKey_taus_decorations[5], ctx);
231 m_SGKey_taus_decorations[6], ctx);
234 for (
const auto* tau : *importedTaus) {
236 res.maxEcell_energy = -9999.;
237 for (
size_t i = 0;
i<tau->nClusters();++
i) {
252 decorateObject(cluster, ctx);
258 decorationTau0(*tau) =
res.maxEcell_time;
259 decorationTau1(*tau) =
res.maxEcell_energy;
260 decorationTau2(*tau) =
res.maxEcell_gain;
261 decorationTau3(*tau) =
res.maxEcell_onlId;
262 decorationTau4(*tau) =
res.maxEcell_x;
263 decorationTau5(*tau) =
res.maxEcell_y;
264 decorationTau6(*tau) =
res.maxEcell_z;
268 if (!m_SGKey_jets.key().empty()) {
273 m_SGKey_jets_decorations[0], ctx);
275 m_SGKey_jets_decorations[1], ctx);
277 m_SGKey_jets_decorations[2], ctx);
279 m_SGKey_jets_decorations[3], ctx);
281 m_SGKey_jets_decorations[4], ctx);
283 m_SGKey_jets_decorations[5], ctx);
285 m_SGKey_jets_decorations[6], ctx);
288 for (
const auto*
jet : *importedJets) {
289 if (
jet->numConstituents() == 0)
continue;
292 res.maxEcell_energy = -9999.;
293 std::vector<const xAOD::CaloCluster*> clusterList;
300 for (
size_t i=0;
i<
jet->numConstituents();++
i) {
302 ATH_MSG_WARNING(
"Tried to call fillEperSamplingFE with a jet constituent that is not a FlowElement!");
309 auto originalFE =
dynamic_cast<const xAOD::FlowElement*
>(*originalObject(*constit));
310 if(originalFE && !originalFE->isCharged()){
313 clusterList.push_back(cluster);
320 for (
size_t i=0;
i<
jet->numConstituents();++
i) {
322 ATH_MSG_WARNING(
"Tried to call fillEperSamplingCluster with a jet constituent that is not a cluster!");
328 clusterList.push_back(cluster);
333 for (
size_t i=0;
i<
jet->numConstituents();++
i) {
339 for (
unsigned int cidx=0;cidx<iPFO->
nCaloCluster();++cidx) {
341 clusterList.push_back(iPFO->
cluster(cidx));
348 for (
auto cluster : clusterList) {
350 decorateObject(cluster, ctx);
356 decorationJet0(*
jet) =
res.maxEcell_time;
357 decorationJet1(*
jet) =
res.maxEcell_energy;
358 decorationJet2(*
jet) =
res.maxEcell_gain;
359 decorationJet3(*
jet) =
res.maxEcell_onlId;
360 decorationJet4(*
jet) =
res.maxEcell_x;
361 decorationJet5(*
jet) =
res.maxEcell_y;
362 decorationJet6(*
jet) =
res.maxEcell_z;
366 return StatusCode::SUCCESS;
372 const EventContext& ctx)
const
386 ATH_MSG_ERROR(
"Do not have mapping object " << m_cablingKey.key());
392 const CaloCell* cell_maxE =
nullptr;
394 int sampling =
cell->caloDDE()->getSampling();
396 if ((
cell->provenance() & 0x2000)) {
397 if (
cell->energy() > emax) {
398 emax =
cell->energy();
413 result.maxEcell_x = caloDDEl->
x();
414 result.maxEcell_y = caloDDEl->
y();
415 result.maxEcell_z = caloDDEl->
z();