From c903e209dfee2b50ace0d6ffe54c8952cb345f21 Mon Sep 17 00:00:00 2001 From: christos <christos@cern.ch> Date: Tue, 15 Dec 2020 20:12:32 +0100 Subject: [PATCH] topoEgammaBuilder pass EventContext to the ElementLinks ctors --- .../egammaAlgs/src/topoEgammaBuilder.cxx | 16 +++++++++------- .../egamma/egammaAlgs/src/topoEgammaBuilder.h | 18 +++++++++--------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/Reconstruction/egamma/egammaAlgs/src/topoEgammaBuilder.cxx b/Reconstruction/egamma/egammaAlgs/src/topoEgammaBuilder.cxx index 1351748fb9d..eb7ffa5166f 100644 --- a/Reconstruction/egamma/egammaAlgs/src/topoEgammaBuilder.cxx +++ b/Reconstruction/egamma/egammaAlgs/src/topoEgammaBuilder.cxx @@ -60,7 +60,7 @@ topoEgammaBuilder::initialize() m_egammaOQTool.disable(); } - //do we actually do ambiguity + //do we actually do ambiguity m_doAmbiguity = !m_ambiguityTool.empty(); if (m_doElectrons && m_doPhotons && m_doAmbiguity) { ATH_CHECK(m_ambiguityTool.retrieve()); @@ -100,15 +100,15 @@ topoEgammaBuilder::execute(const EventContext& ctx) const } SG::WriteHandle<xAOD::ElectronContainer> electronContainer(m_electronOutputKey, ctx); - + ATH_CHECK(electronContainer.record(std::make_unique<xAOD::ElectronContainer>(), std::make_unique<xAOD::ElectronAuxContainer>())); SG::WriteHandle<xAOD::PhotonContainer> photonContainer(m_photonOutputKey,ctx); - + ATH_CHECK(photonContainer.record(std::make_unique<xAOD::PhotonContainer>(), std::make_unique<xAOD::PhotonAuxContainer>())); - + electrons = electronContainer.ptr(); photons = photonContainer.ptr(); @@ -248,7 +248,7 @@ topoEgammaBuilder::execute(const EventContext& ctx) const } // Do the ambiguity Links if (m_doElectrons && m_doPhotons) { - ATH_CHECK(doAmbiguityLinks(electrons, photons)); + ATH_CHECK(doAmbiguityLinks(ctx,electrons, photons)); } return StatusCode::SUCCESS; @@ -256,6 +256,7 @@ topoEgammaBuilder::execute(const EventContext& ctx) const StatusCode topoEgammaBuilder::doAmbiguityLinks( + const EventContext& ctx, xAOD::ElectronContainer* electronContainer, xAOD::PhotonContainer* photonContainer) const { @@ -287,7 +288,7 @@ topoEgammaBuilder::doAmbiguityLinks( if (caloClusterLinks(*(electron->caloCluster())).at(0) == caloClusterLinks(*(photon->caloCluster())).at(0)) { ElementLink<xAOD::EgammaContainer> link(*electronContainer, - electronIndex); + electronIndex,ctx); ELink(*photon) = link; break; } @@ -309,7 +310,8 @@ topoEgammaBuilder::doAmbiguityLinks( if (caloClusterLinks(*(electron->caloCluster())).at(0) == caloClusterLinks(*(photon->caloCluster())).at(0)) { - ElementLink<xAOD::EgammaContainer> link(*photonContainer, photonIndex); + ElementLink<xAOD::EgammaContainer> link( + *photonContainer, photonIndex, ctx); ELink(*electron) = link; break; } diff --git a/Reconstruction/egamma/egammaAlgs/src/topoEgammaBuilder.h b/Reconstruction/egamma/egammaAlgs/src/topoEgammaBuilder.h index 658b1ae97e1..e086726d232 100644 --- a/Reconstruction/egamma/egammaAlgs/src/topoEgammaBuilder.h +++ b/Reconstruction/egamma/egammaAlgs/src/topoEgammaBuilder.h @@ -65,17 +65,17 @@ private: bool getPhoton(const egammaRec* egRec, xAOD::PhotonContainer *photonContainer, const unsigned int author, uint8_t type) const; + /** @brief Do the final ambiguity **/ + StatusCode doAmbiguityLinks(const EventContext& ctx, + xAOD::ElectronContainer* electronContainer, + xAOD::PhotonContainer* photonContainer) const; - /** @brief Do the final ambiguity **/ - StatusCode doAmbiguityLinks(xAOD::ElectronContainer *electronContainer, - xAOD::PhotonContainer *photonContainer) const ; - - /** @brief Call a tool using contExecute and electrons, photon containers if given **/ + /** @brief Call a tool using contExecute and electrons, photon containers if + * given **/ StatusCode CallTool(const EventContext& ctx, - const ToolHandle<IegammaBaseTool>& tool, - xAOD::ElectronContainer *electronContainer = nullptr, - xAOD::PhotonContainer *photonContainer = nullptr) const; - + const ToolHandle<IegammaBaseTool>& tool, + xAOD::ElectronContainer* electronContainer = nullptr, + xAOD::PhotonContainer* photonContainer = nullptr) const; /** @brief Vector of tools for dressing electrons and photons **/ ToolHandleArray<IegammaBaseTool> m_egammaTools {this, -- GitLab