diff --git a/Calorimeter/CaloCnv/CaloAthenaPool/src/CaloTopoTowerContainerCnv.cxx b/Calorimeter/CaloCnv/CaloAthenaPool/src/CaloTopoTowerContainerCnv.cxx index 886867e422d8517849805510543d6ca64722cdbc..e8970d9d061a40865d7981ce228ea83127ebe960 100644 --- a/Calorimeter/CaloCnv/CaloAthenaPool/src/CaloTopoTowerContainerCnv.cxx +++ b/Calorimeter/CaloCnv/CaloAthenaPool/src/CaloTopoTowerContainerCnv.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "CaloTopoTowerContainerCnv.h" @@ -10,6 +10,7 @@ // Gaudi #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/IToolSvc.h" +#include "GaudiKernel/ThreadLocalContext.h" // Athena #include "CaloUtils/CaloTopoTowerBuilderToolBase.h" @@ -70,6 +71,7 @@ CaloTopoTowerContainer* CaloTopoTowerContainerCnv::createTransient() { Cont->init(); // rebuild the CaloTopoTowers in the container. + const EventContext& ctx = Gaudi::Hive::currentContext(); m_TopoTowerBldr= getTool("CaloTopoTowerBuilderTool","TopoTowerTwrBldr"); if(!m_TopoTowerBldr){ @@ -77,7 +79,7 @@ CaloTopoTowerContainer* CaloTopoTowerContainerCnv::createTransient() { return 0; } if (log.level() <= MSG::DEBUG) log << MSG::DEBUG << "creating CaloTopoTowerContainerCnv::PoolToDataObject" << endmsg; - StatusCode scfcal = m_TopoTowerBldr->execute(Cont); + StatusCode scfcal = m_TopoTowerBldr->execute(ctx, Cont); if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<" TopoTowers rebuild m_TopoTowerBldr->execute(Cont); Successful "<<endmsg; if (scfcal.isFailure()) { log<<MSG::ERROR<<" TopoTowers rebuild failed "<<endmsg; diff --git a/Calorimeter/CaloCnv/CaloAthenaPool/src/CaloTowerContainerCnv.cxx b/Calorimeter/CaloCnv/CaloAthenaPool/src/CaloTowerContainerCnv.cxx index 709367333d77e1b2b5d094799293eaac3e226c18..ba46efa930bf64b24de495c3ef77fe977f97d615 100644 --- a/Calorimeter/CaloCnv/CaloAthenaPool/src/CaloTowerContainerCnv.cxx +++ b/Calorimeter/CaloCnv/CaloAthenaPool/src/CaloTowerContainerCnv.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "CaloTowerContainerCnv.h" @@ -10,6 +10,7 @@ // Gaudi #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/IToolSvc.h" +#include "GaudiKernel/ThreadLocalContext.h" // Athena #include "CaloUtils/CaloTowerBuilderToolBase.h" @@ -48,6 +49,7 @@ CaloTowerContainerCnv::~CaloTowerContainerCnv() //StatusCode CaloTowerContainerCnv::PoolToDataObject(DataObject*& pObj,const std::string &token) CaloTowerContainer* CaloTowerContainerCnv::createTransient() { + const EventContext& ctx = Gaudi::Hive::currentContext(); MsgStream log(msgSvc(), "CaloTowerContainerCnv::createTransient" ); CaloTowerContainer* Cont = 0; @@ -106,7 +108,7 @@ CaloTowerContainer* CaloTowerContainerCnv::createTransient() { } } if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<" Towers rebuild for FCAL "<<endmsg; - StatusCode scfcal = m_fcalTowerBldr->execute(Cont); + StatusCode scfcal = m_fcalTowerBldr->execute(ctx, Cont); if (scfcal.isFailure()) { log<<MSG::ERROR<<" Towers rebuild for FCAL failed "<<endmsg; } @@ -122,7 +124,7 @@ CaloTowerContainer* CaloTowerContainerCnv::createTransient() { } } if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<" Towers rebuild for Tile "<<endmsg; - StatusCode sctile=m_tileTowerBldr->execute(Cont); + StatusCode sctile=m_tileTowerBldr->execute(ctx, Cont); if (sctile.isFailure()) { log<<MSG::ERROR<<" Towers rebuild for Tile failed "<<endmsg; } @@ -142,7 +144,7 @@ CaloTowerContainer* CaloTowerContainerCnv::createTransient() { } if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<" Towers rebuild for EM and/or HEC "<<endmsg; m_emHecTowerBldr->setCalos(EmHec); - StatusCode scemHec=m_emHecTowerBldr->execute(Cont); + StatusCode scemHec=m_emHecTowerBldr->execute(ctx, Cont); if (scemHec.isFailure()) { log<<MSG::ERROR<<" Towers rebuild for EM and/or HEC failed "<<endmsg; } diff --git a/Calorimeter/CaloInterface/CaloInterface/ICaloTopoTowerBuilderToolBase.h b/Calorimeter/CaloInterface/CaloInterface/ICaloTopoTowerBuilderToolBase.h index 25721560e25c08c83ae0f73489c35aa28b35d2d0..aec068c24f6aa73253d459ef29a378501f43ac9c 100755 --- a/Calorimeter/CaloInterface/CaloInterface/ICaloTopoTowerBuilderToolBase.h +++ b/Calorimeter/CaloInterface/CaloInterface/ICaloTopoTowerBuilderToolBase.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef CALOINTERFACE_ICALOTOPOTOWERBUILDERTOOLBASE_H @@ -27,6 +27,7 @@ class CaloTopoTowerContainer; class CaloTowerSeg; class CaloCellContainer; class CaloClusterContainer; +class EventContext; // Declaration of the interface ID ( interface id, major version, minor version) static const InterfaceID IID_ICaloTopoTowerBuilderToolBase("ICaloTopoTowerBuilderToolBase", 1 , 0); @@ -41,7 +42,8 @@ class ICaloTopoTowerBuilderToolBase : virtual public IAlgTool /// common initialization /// execute is abstract - virtual StatusCode execute(CaloTopoTowerContainer* theContainer,const CaloCellContainer* theCell=0) const = 0; + virtual StatusCode execute(const EventContext& ctx, + CaloTopoTowerContainer* theContainer,const CaloCellContainer* theCell=0) const = 0; virtual StatusCode initialize() =0; virtual StatusCode initializeTool() = 0; diff --git a/Calorimeter/CaloInterface/CaloInterface/ICaloTowerBuilderToolBase.h b/Calorimeter/CaloInterface/CaloInterface/ICaloTowerBuilderToolBase.h index 360c09a7cae7c5370e4f8aadecae9b601cbac680..1e50309edfc50caee7d300a48a34c312d2c2c459 100755 --- a/Calorimeter/CaloInterface/CaloInterface/ICaloTowerBuilderToolBase.h +++ b/Calorimeter/CaloInterface/CaloInterface/ICaloTowerBuilderToolBase.h @@ -28,6 +28,7 @@ class CaloTowerContainer; class CaloTowerSeg; class CaloCellContainer; +class EventContext; // Declaration of the interface ID ( interface id, major version, minor version) @@ -51,12 +52,14 @@ class ICaloTowerBuilderToolBase : virtual public IAlgTool * The segmentation of the tower container must match * the region over which we're running the tower building. * + * @param ctx The current event context. * @param theContainer The tower container to fill. * @param theCell The cell container to read. If null, we fetch from SG. * @param subseg If provided, run tower building only within this window. * The tower container segmentation must match. */ - virtual StatusCode execute(CaloTowerContainer* theContainer, + virtual StatusCode execute(const EventContext& ctx, + CaloTowerContainer* theContainer, const CaloCellContainer* theCell=0, const CaloTowerSeg::SubSeg* subseg = 0) const = 0; virtual StatusCode initialize ATLAS_NOT_THREAD_SAFE () =0; @@ -71,9 +74,5 @@ class ICaloTowerBuilderToolBase : virtual public IAlgTool static const InterfaceID IID("ICaloTowerBuilderToolBase", 1 , 0); return IID; } - - protected: - - }; #endif diff --git a/Calorimeter/CaloRec/src/CaloTopoTowerAlgorithm.cxx b/Calorimeter/CaloRec/src/CaloTopoTowerAlgorithm.cxx index 48e1cc0604cdb0242b98483a4e2eb648c10b556f..5671f8a97799b46214e428a286e9d6141603515a 100644 --- a/Calorimeter/CaloRec/src/CaloTopoTowerAlgorithm.cxx +++ b/Calorimeter/CaloRec/src/CaloTopoTowerAlgorithm.cxx @@ -312,7 +312,7 @@ StatusCode CaloTopoTowerAlgorithm::execute (const EventContext& ctx) const ATH_MSG_INFO( "this is theTowers: " << theTowers ); */ - processStatus = (*firstITool)->execute(theTowers.ptr()); + processStatus = (*firstITool)->execute(ctx, theTowers.ptr()); // ATH_MSG_INFO( "processStatus is: " << processStatus ); diff --git a/Calorimeter/CaloRec/src/CaloTowerAlgorithm.cxx b/Calorimeter/CaloRec/src/CaloTowerAlgorithm.cxx index d55dd10d0fbe1ac716a9f3f873a37d42935e3a97..1bdcf21a17dafea02cbdfae8203b4729cc727652 100644 --- a/Calorimeter/CaloRec/src/CaloTowerAlgorithm.cxx +++ b/Calorimeter/CaloRec/src/CaloTowerAlgorithm.cxx @@ -149,7 +149,7 @@ StatusCode CaloTowerAlgorithm::execute (const EventContext& ctx) const theTicker->chronoStart((*firstITool)->name()); } - processStatus = (*firstITool)->execute(theTowers.ptr()); + processStatus = (*firstITool)->execute(ctx, theTowers.ptr()); if (theTicker != nullptr) { theTicker->chronoStop((*firstITool)->name()); diff --git a/Calorimeter/CaloUtils/CaloUtils/CaloTopoTowerBuilderTool.h b/Calorimeter/CaloUtils/CaloUtils/CaloTopoTowerBuilderTool.h index 5e94644fd212960b3a91ed7aa8380dfd6036c73e..9470bd88566c9daba821ce1d53f8354dcf8d5e47 100644 --- a/Calorimeter/CaloUtils/CaloUtils/CaloTopoTowerBuilderTool.h +++ b/Calorimeter/CaloUtils/CaloUtils/CaloTopoTowerBuilderTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef CALOREC_CALOTOPOTOWERBUILDERTOOL_H @@ -46,7 +46,8 @@ class CaloTopoTowerBuilderTool : public CaloTopoTowerBuilderToolBase virtual ~CaloTopoTowerBuilderTool(); /// execute - virtual StatusCode execute(CaloTopoTowerContainer* theContainer,const CaloCellContainer* theCell=0) const override; + virtual StatusCode execute(const EventContext& ctx, + CaloTopoTowerContainer* theContainer,const CaloCellContainer* theCell=0) const override; //virtual StatusCode initialize(); virtual StatusCode initializeTool() override; diff --git a/Calorimeter/CaloUtils/CaloUtils/CaloTopoTowerBuilderToolBase.h b/Calorimeter/CaloUtils/CaloUtils/CaloTopoTowerBuilderToolBase.h index 82b8f718e4bc247a9cb0075d924ab5d8cbaffa79..f18af55896ba09fe1c186568b23b78890e994551 100644 --- a/Calorimeter/CaloUtils/CaloUtils/CaloTopoTowerBuilderToolBase.h +++ b/Calorimeter/CaloUtils/CaloUtils/CaloTopoTowerBuilderToolBase.h @@ -45,7 +45,8 @@ class CaloTopoTowerBuilderToolBase : public AthAlgTool, virtual StatusCode LoadCalibration(IOVSVC_CALLBACK_ARGS) override; /// execute is abstract - virtual StatusCode execute(CaloTopoTowerContainer* theContainer,const CaloCellContainer* theCell=0) const override = 0; + virtual StatusCode execute(const EventContext& ctx, + CaloTopoTowerContainer* theContainer,const CaloCellContainer* theCell=0) const override = 0; virtual StatusCode initializeTool() override = 0; diff --git a/Calorimeter/CaloUtils/CaloUtils/CaloTowerBuilderTool.h b/Calorimeter/CaloUtils/CaloUtils/CaloTowerBuilderTool.h index bd361a2b4b8826fde4566cffa6ea74dbe0026105..5baef7c97969a1ae005b8fc98291023cc68fe429 100644 --- a/Calorimeter/CaloUtils/CaloUtils/CaloTowerBuilderTool.h +++ b/Calorimeter/CaloUtils/CaloUtils/CaloTowerBuilderTool.h @@ -49,24 +49,28 @@ public: * The segmentation of the tower container must match * the region over which we're running the tower building. * + * @param ctx The current event context. * @param theContainer The tower container to fill. * @param theCell The cell container to read. If null, we fetch from SG. * @param subseg If provided, run tower building only within this window. * The tower container segmentation must match. */ - virtual StatusCode execute(CaloTowerContainer* theContainer, + virtual StatusCode execute(const EventContext& ctx, + CaloTowerContainer* theContainer, const CaloCellContainer* theCell=0, const CaloTowerSeg::SubSeg* subseg = 0) const override; /** * @brief Run tower building and add results to the tower container. + * @param ctx The current event context. * @param theContainer The tower container to fill. * * If the segmentation hasn't been set, take it from the tower container. * This is for use by converters. */ - virtual StatusCode execute (CaloTowerContainer* theContainer) override; + virtual StatusCode execute (const EventContext& ctx, + CaloTowerContainer* theContainer) override; virtual void setCalos( const std::vector<CaloCell_ID::SUBCALO>& v); diff --git a/Calorimeter/CaloUtils/CaloUtils/CaloTowerBuilderToolBase.h b/Calorimeter/CaloUtils/CaloUtils/CaloTowerBuilderToolBase.h index ddc4732fd41ee1a5ec06826f998f4eaa3c03c035..cbc7a66cc2265c80f972d6491ea4c7db8d1e392a 100644 --- a/Calorimeter/CaloUtils/CaloUtils/CaloTowerBuilderToolBase.h +++ b/Calorimeter/CaloUtils/CaloUtils/CaloTowerBuilderToolBase.h @@ -57,23 +57,27 @@ class CaloTowerBuilderToolBase: public AthAlgTool, * The segmentation of the tower container must match * the region over which we're running the tower building. * + * @param ctx The current event context. * @param theContainer The tower container to fill. * @param theCell The cell container to read. If null, we fetch from SG. * @param subseg If provided, run tower building only within this window. * The tower container segmentation must match. */ - virtual StatusCode execute(CaloTowerContainer* theContainer, + virtual StatusCode execute(const EventContext& ctx, + CaloTowerContainer* theContainer, const CaloCellContainer* theCell = nullptr, const CaloTowerSeg::SubSeg* subseg = nullptr) const override = 0; /** * @brief Run tower building and add results to the tower container. + * @param ctx The current event context. * @param theContainer The tower container to fill. * * If the segmentation hasn't been set, take it from the tower container. * This is for use by converters. */ - virtual StatusCode execute (CaloTowerContainer* theContainer) = 0; + virtual StatusCode execute (const EventContext& ctx, + CaloTowerContainer* theContainer) = 0; virtual StatusCode initializeTool() override = 0; diff --git a/Calorimeter/CaloUtils/src/CaloTopoTowerBuilderTool.cxx b/Calorimeter/CaloUtils/src/CaloTopoTowerBuilderTool.cxx index 9ba135cf120ca0dc3de18fbc3a13767dc7d5132b..30121eb400727a59f70865f48b9cd0d0125c229f 100644 --- a/Calorimeter/CaloUtils/src/CaloTopoTowerBuilderTool.cxx +++ b/Calorimeter/CaloUtils/src/CaloTopoTowerBuilderTool.cxx @@ -67,7 +67,8 @@ StatusCode CaloTopoTowerBuilderTool::initializeTool() // Tower Builder // /////////////////// -StatusCode CaloTopoTowerBuilderTool::execute(CaloTopoTowerContainer* theTowers, const CaloCellContainer* /*theCells*/) const +StatusCode CaloTopoTowerBuilderTool::execute(const EventContext& ctx, + CaloTopoTowerContainer* theTowers, const CaloCellContainer* /*theCells*/) const { ////////////////////////////////////////////////////////////////////////////// //Starting loading variables from CaloTopoTowerContainer @@ -86,7 +87,7 @@ StatusCode CaloTopoTowerBuilderTool::execute(CaloTopoTowerContainer* theTowers, return StatusCode::SUCCESS; } - const ElementLink<CaloCellContainer> CellsEL (*Cells, 0); + const ElementLink<CaloCellContainer> CellsEL (*Cells, 0, ctx); const CaloCell2ClusterMap* cellToClusterMap=theTowers->GetCellToClusterMap(); bool delete_cellToClusterMap=false; diff --git a/Calorimeter/CaloUtils/src/CaloTowerBuilderTool.cxx b/Calorimeter/CaloUtils/src/CaloTowerBuilderTool.cxx index 60a6ff739993c89b4e513898f98d4b85d13b1c1c..979dfa451fbd87ae72099d3a530e3c158827b87c 100644 --- a/Calorimeter/CaloUtils/src/CaloTowerBuilderTool.cxx +++ b/Calorimeter/CaloUtils/src/CaloTowerBuilderTool.cxx @@ -156,13 +156,15 @@ CaloTowerBuilderTool::iterateSubSeg (CaloTowerContainer* towers, * The segmentation of the tower container must match * the region over which we're running the tower building. * + * @param ctx The current event context. * @param theContainer The tower container to fill. * @param theCell The cell container to read. If null, we fetch from SG. * @param subseg If provided, run tower building only within this window. * The tower container segmentation must match. */ StatusCode -CaloTowerBuilderTool::execute(CaloTowerContainer* theTowers, +CaloTowerBuilderTool::execute(const EventContext& ctx, + CaloTowerContainer* theTowers, const CaloCellContainer* theCells /*= 0*/, const CaloTowerSeg::SubSeg* subseg /*= 0*/) const { @@ -179,7 +181,7 @@ CaloTowerBuilderTool::execute(CaloTowerContainer* theTowers, } } - const ElementLink<CaloCellContainer> cellsEL (*theCells, 0); + const ElementLink<CaloCellContainer> cellsEL (*theCells, 0, ctx); if (subseg) iterateSubSeg (theTowers, cellsEL, subseg); else @@ -209,19 +211,21 @@ CaloTowerBuilderTool::execute(CaloTowerContainer* theTowers, /** * @brief Run tower building and add results to the tower container. + * @param ctx The current event context. * @param theContainer The tower container to fill. * * If the segmentation hasn't been set, take it from the tower container. * This is for use by converters. */ -StatusCode CaloTowerBuilderTool::execute (CaloTowerContainer* theContainer) +StatusCode CaloTowerBuilderTool::execute (const EventContext& ctx, + CaloTowerContainer* theContainer) { if (m_cellStore.size() == 0) { setTowerSeg (theContainer->towerseg()); ATH_CHECK( rebuildLookup() ); } - return execute (theContainer, nullptr, nullptr); + return execute (ctx, theContainer, nullptr, nullptr); } diff --git a/Calorimeter/CaloUtils/src/CaloTowerBuilderToolTestAlg.cxx b/Calorimeter/CaloUtils/src/CaloTowerBuilderToolTestAlg.cxx index d2365b7d6fc7566b23f1db738b4eb108b9f3e94e..e03037dcba8798522b6b8ba270dddd9227033015 100644 --- a/Calorimeter/CaloUtils/src/CaloTowerBuilderToolTestAlg.cxx +++ b/Calorimeter/CaloUtils/src/CaloTowerBuilderToolTestAlg.cxx @@ -94,12 +94,13 @@ CaloTowerBuilderToolTestAlg::make_cells() StatusCode -CaloTowerBuilderToolTestAlg::test_subseg (const CaloTowerSeg::SubSeg& subseg, +CaloTowerBuilderToolTestAlg::test_subseg (const EventContext& ctx, + const CaloTowerSeg::SubSeg& subseg, const CaloCellContainer* cells, const CaloTowerContainer* tow0) { CaloTowerContainer* tow = new CaloTowerContainer (subseg.segmentation()); - CHECK( m_builder->execute (tow, cells, &subseg) ); + CHECK( m_builder->execute (ctx, tow, cells, &subseg) ); for (size_t i = 0; i < tow->size(); i++) { using index_t = CaloTowerContainer::index_t; @@ -159,10 +160,12 @@ StatusCode CaloTowerBuilderToolTestAlg::test1() { std::cout << "test1\n"; + const EventContext& ctx = Gaudi::Hive::currentContext(); + const CaloCellContainer* cells = make_cells(); CHECK( evtStore()->record (cells, "cells") ); CaloTowerContainer* tow1 = new CaloTowerContainer (m_seg); - CHECK( m_builder->execute (tow1, cells) ); + CHECK( m_builder->execute (ctx, tow1, cells) ); for (size_t i = 0; i < tow1->size(); i++) { const CaloTower* t = (*tow1)[i]; @@ -179,8 +182,8 @@ StatusCode CaloTowerBuilderToolTestAlg::test1() std::cout << "\n"; } - CHECK( test_subseg (m_seg.subseg (0.7, 0.3, -0.2, 0.4), cells, tow1) ); - CHECK( test_subseg (m_seg.subseg (0.7, 0.3, 3.1, 0.4), cells, tow1) ); + CHECK( test_subseg (ctx, m_seg.subseg (0.7, 0.3, -0.2, 0.4), cells, tow1) ); + CHECK( test_subseg (ctx, m_seg.subseg (0.7, 0.3, 3.1, 0.4), cells, tow1) ); delete tow1; return StatusCode::SUCCESS; diff --git a/Calorimeter/CaloUtils/src/CaloTowerBuilderToolTestAlg.h b/Calorimeter/CaloUtils/src/CaloTowerBuilderToolTestAlg.h index 59d909b11bd8eb0c02ccb3073d14420e23987f5f..9fb75f7de52761aacfd59e0c8ac74f126a838df2 100644 --- a/Calorimeter/CaloUtils/src/CaloTowerBuilderToolTestAlg.h +++ b/Calorimeter/CaloUtils/src/CaloTowerBuilderToolTestAlg.h @@ -51,7 +51,8 @@ public: private: CaloCellContainer* make_cells(); - StatusCode test_subseg (const CaloTowerSeg::SubSeg& subseg, + StatusCode test_subseg (const EventContext& ctx, + const CaloTowerSeg::SubSeg& subseg, const CaloCellContainer* cells, const CaloTowerContainer* tow0); StatusCode test1(); diff --git a/LArCalorimeter/LArRecUtils/src/LArFCalTowerBuilderTool.cxx b/LArCalorimeter/LArRecUtils/src/LArFCalTowerBuilderTool.cxx index 60a29da2467c82125fb97944a3d382fe3ada9469..448818ce0161cc2bc081afff3f82aa3bd9b95e0d 100644 --- a/LArCalorimeter/LArRecUtils/src/LArFCalTowerBuilderTool.cxx +++ b/LArCalorimeter/LArRecUtils/src/LArFCalTowerBuilderTool.cxx @@ -125,7 +125,8 @@ LArFCalTowerBuilderTool::iterateSubSeg (CaloTowerContainer* towers, ///////////////////////// StatusCode -LArFCalTowerBuilderTool::execute(CaloTowerContainer* theTowers, +LArFCalTowerBuilderTool::execute(const EventContext& ctx, + CaloTowerContainer* theTowers, const CaloCellContainer* theCells, const CaloTowerSeg::SubSeg* subseg) const { @@ -155,7 +156,7 @@ LArFCalTowerBuilderTool::execute(CaloTowerContainer* theTowers, // register this calorimeter theTowers->setCalo(m_caloIndex); - const ElementLink<CaloCellContainer> cellsEL (*theCells, 0); + const ElementLink<CaloCellContainer> cellsEL (*theCells, 0, ctx); if (subseg) iterateSubSeg (theTowers, cellsEL, subseg); else @@ -167,19 +168,21 @@ LArFCalTowerBuilderTool::execute(CaloTowerContainer* theTowers, /** * @brief Run tower building and add results to the tower container. + * @param ctx The current event context. * @param theContainer The tower container to fill. * * If the segmentation hasn't been set, take it from the tower container. * This is for use by converters. */ -StatusCode LArFCalTowerBuilderTool::execute (CaloTowerContainer* theContainer) +StatusCode LArFCalTowerBuilderTool::execute (const EventContext& ctx, + CaloTowerContainer* theContainer) { if (m_cellStore.size() == 0) { setTowerSeg (theContainer->towerseg()); ATH_CHECK( rebuildLookup() ); } - return execute (theContainer, nullptr, nullptr); + return execute (ctx, theContainer, nullptr, nullptr); } diff --git a/LArCalorimeter/LArRecUtils/src/LArFCalTowerBuilderTool.h b/LArCalorimeter/LArRecUtils/src/LArFCalTowerBuilderTool.h index 306a3f0bd7307ce7ceb1cdfef0e0de8d89c63265..c4e8f353b7298ece6f23ce663eacda4b6f67d953 100644 --- a/LArCalorimeter/LArRecUtils/src/LArFCalTowerBuilderTool.h +++ b/LArCalorimeter/LArRecUtils/src/LArFCalTowerBuilderTool.h @@ -46,19 +46,22 @@ class LArFCalTowerBuilderTool : public CaloTowerBuilderToolBase virtual ~LArFCalTowerBuilderTool(); - virtual StatusCode execute(CaloTowerContainer* theContainer, + virtual StatusCode execute(const EventContext& ctx, + CaloTowerContainer* theContainer, const CaloCellContainer* theCell=0, const CaloTowerSeg::SubSeg* subseg = 0) const override; /** * @brief Run tower building and add results to the tower container. + * @param ctx The current event context. * @param theContainer The tower container to fill. * * If the segmentation hasn't been set, take it from the tower container. * This is for use by converters. */ - virtual StatusCode execute (CaloTowerContainer* theContainer) override; + virtual StatusCode execute (const EventContext& ctx, + CaloTowerContainer* theContainer) override; virtual void handle(const Incident&) override; diff --git a/LArCalorimeter/LArRecUtils/src/LArFCalTowerBuilderToolTestAlg.cxx b/LArCalorimeter/LArRecUtils/src/LArFCalTowerBuilderToolTestAlg.cxx index 9bc94d23cda84604c5e8a9ccd189bf7e8b93a0ea..3c50703aeca1581e55a57bb9e29bfc2da654784d 100644 --- a/LArCalorimeter/LArRecUtils/src/LArFCalTowerBuilderToolTestAlg.cxx +++ b/LArCalorimeter/LArRecUtils/src/LArFCalTowerBuilderToolTestAlg.cxx @@ -18,6 +18,7 @@ #include "AthenaKernel/errorcheck.h" #include "TestTools/random.h" #include "CLHEP/Units/SystemOfUnits.h" +#include "GaudiKernel/ThreadLocalContext.h" #include <cstdlib> #include <iostream> #include <cmath> @@ -91,12 +92,13 @@ LArFCalTowerBuilderToolTestAlg::make_cells() StatusCode -LArFCalTowerBuilderToolTestAlg::test_subseg (const CaloTowerSeg::SubSeg& subseg, +LArFCalTowerBuilderToolTestAlg::test_subseg (const EventContext& ctx, + const CaloTowerSeg::SubSeg& subseg, const CaloCellContainer* cells, const CaloTowerContainer* tow0) { CaloTowerContainer* tow = new CaloTowerContainer (subseg.segmentation()); - CHECK( m_builder->execute (tow, cells, &subseg) ); + CHECK( m_builder->execute (ctx, tow, cells, &subseg) ); for (size_t i = 0; i < tow->size(); i++) { typedef CaloTowerContainer::index_t index_t; @@ -155,10 +157,11 @@ LArFCalTowerBuilderToolTestAlg::test_subseg (const CaloTowerSeg::SubSeg& subseg, StatusCode LArFCalTowerBuilderToolTestAlg::test1() { std::cout << "test1\n"; + const EventContext& ctx = Gaudi::Hive::currentContext(); const CaloCellContainer* cells = make_cells(); CaloTowerContainer* tow1 = new CaloTowerContainer (m_seg); - CHECK( m_builder->execute (tow1, cells) ); + CHECK( m_builder->execute (ctx, tow1, cells) ); #if 0 std::cout << "cells\n"; @@ -186,8 +189,8 @@ StatusCode LArFCalTowerBuilderToolTestAlg::test1() std::cout << "\n"; } - CHECK( test_subseg (m_seg.subseg ( 4.5, 0.3, -0.2, 0.4), cells, tow1) ); - CHECK( test_subseg (m_seg.subseg (-4.5, 0.3, 3.1, 0.4), cells, tow1) ); + CHECK( test_subseg (ctx, m_seg.subseg ( 4.5, 0.3, -0.2, 0.4), cells, tow1) ); + CHECK( test_subseg (ctx, m_seg.subseg (-4.5, 0.3, 3.1, 0.4), cells, tow1) ); delete cells; delete tow1; diff --git a/LArCalorimeter/LArRecUtils/src/LArFCalTowerBuilderToolTestAlg.h b/LArCalorimeter/LArRecUtils/src/LArFCalTowerBuilderToolTestAlg.h index 97dd8dfabd4bdfb5802757de7708c60336e615f0..10b7d21de7818736d9c88d206425eb936aaad7d0 100644 --- a/LArCalorimeter/LArRecUtils/src/LArFCalTowerBuilderToolTestAlg.h +++ b/LArCalorimeter/LArRecUtils/src/LArFCalTowerBuilderToolTestAlg.h @@ -51,7 +51,8 @@ public: private: CaloCellContainer* make_cells(); - StatusCode test_subseg (const CaloTowerSeg::SubSeg& subseg, + StatusCode test_subseg (const EventContext& ctx, + const CaloTowerSeg::SubSeg& subseg, const CaloCellContainer* cells, const CaloTowerContainer* tow0); StatusCode test1(); diff --git a/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloTopoTowerAlgorithm.cxx b/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloTopoTowerAlgorithm.cxx index 295ec5287447d3ff84405ef36aa51a4a9b590b0d..41811c0c24543246991a1ee1b7cbbd94584a88b0 100644 --- a/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloTopoTowerAlgorithm.cxx +++ b/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloTopoTowerAlgorithm.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // ******************************************************************** @@ -16,6 +16,7 @@ #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/IToolSvc.h" #include "GaudiKernel/ListItem.h" +#include "GaudiKernel/ThreadLocalContext.h" #include "Gaudi/Property.h" @@ -208,6 +209,7 @@ HLT::ErrorCode TrigCaloTopoTowerAlgorithm::hltExecute(const HLT::TriggerElement* { ATH_MSG_DEBUG("in execute(): outputTE->getId() ="<<outputTE->getId()); + const EventContext& ctx = Gaudi::Hive::currentContext(); ////////////////////// //////CaloCluster Container @@ -271,7 +273,7 @@ HLT::ErrorCode TrigCaloTopoTowerAlgorithm::hltExecute(const HLT::TriggerElement* { // m_toolInvoke[(*firstITool)->name()]++; - processStatus = (*firstITool)->execute(newTowers); + processStatus = (*firstITool)->execute(ctx, newTowers); // if(msgLvl() <= MSG::DEBUG) msg() << MSG::DEBUG << << MSG::INFO << "processStatus is: " << processStatus << endmsg; diff --git a/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloTowerMaker.cxx b/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloTowerMaker.cxx index e7e8b0c2b18d958fe688b808251f5977b1c99fbf..51f7f239867e904bce559a70613c818591848241 100755 --- a/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloTowerMaker.cxx +++ b/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloTowerMaker.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // ******************************************************************** @@ -20,6 +20,7 @@ #include "GaudiKernel/IToolSvc.h" #include "GaudiKernel/StatusCode.h" #include "GaudiKernel/ListItem.h" +#include "GaudiKernel/ThreadLocalContext.h" // #include "TrigT1Interfaces/TrigT1Interfaces_ClassDEF.h" #include "TrigSteeringEvent/TrigRoiDescriptor.h" @@ -266,6 +267,7 @@ HLT::ErrorCode TrigCaloTowerMaker::hltExecute(const HLT::TriggerElement* inputTE // Now Build the towers ----------------------------------------------------------------- + const EventContext& ctx = Gaudi::Hive::currentContext(); if(!m_towerMakerNames.empty()) { //CaloTowerSeg theTowerSeg(m_nEtaTowers,m_nPhiTowers,m_minEta,m_maxEta); @@ -288,14 +290,14 @@ HLT::ErrorCode TrigCaloTowerMaker::hltExecute(const HLT::TriggerElement* inputTE //return HLT::TOOL_FAILURE; //} if ( m_includeFcal ) { - if ( (*itrtwr)->execute(m_pCaloTowerContainer, theCellCont).isFailure() ) { + if ( (*itrtwr)->execute(ctx, m_pCaloTowerContainer, theCellCont).isFailure() ) { msg() << MSG::ERROR << "Error executing tool " << m_towerMakerNames[index] << endmsg; } else { if(msgLvl() <= MSG::DEBUG) msg() << MSG::DEBUG << "Executed tool " << m_towerMakerNames[index] << endmsg; } } else { - if ( (*itrtwr)->execute(m_pCaloTowerContainer,theCellCont, &subseg).isFailure() ) { + if ( (*itrtwr)->execute(ctx, m_pCaloTowerContainer,theCellCont, &subseg).isFailure() ) { msg() << MSG::ERROR << "Error executing tool " << m_towerMakerNames[index] << endmsg; } else { if(msgLvl() <= MSG::DEBUG) diff --git a/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloTowerMakerMT.cxx b/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloTowerMakerMT.cxx index ad86ebed85f3134f3767b0e80f0e64a0eadc6db1..28480a9074ebd40316cfcfa2ecfbe61813480de5 100644 --- a/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloTowerMakerMT.cxx +++ b/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloTowerMakerMT.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // ******************************************************************** @@ -261,13 +261,13 @@ StatusCode TrigCaloTowerMakerMT::execute() //return HLT::TOOL_FAILURE; //} if ( m_includeFcal ) { - if ( (*itrtwr)->execute(pCaloTowerContainer, theCellCont).isFailure() ) { + if ( (*itrtwr)->execute(ctx, pCaloTowerContainer, theCellCont).isFailure() ) { ATH_MSG_ERROR("Error executing tool " << m_towerMakerNames[index]); } else { ATH_MSG_DEBUG("Executed tool " << m_towerMakerNames[index]); } } else { - if ( (*itrtwr)->execute(pCaloTowerContainer,theCellCont, &subseg).isFailure() ) { + if ( (*itrtwr)->execute(ctx, pCaloTowerContainer,theCellCont, &subseg).isFailure() ) { ATH_MSG_ERROR("Error executing tool " << m_towerMakerNames[index]); } else { ATH_MSG_DEBUG("Executed tool " << m_towerMakerNames[index]);