diff --git a/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorCondAlg.h b/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorCondAlg.h index 78c837f4c1ddbcf5109caf4824e301e491239883..f37dc8c2243b3a815e40c75bde87bba2c4f68b22 100755 --- a/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorCondAlg.h +++ b/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorCondAlg.h @@ -5,7 +5,7 @@ #ifndef MUONGEOMODEL_MUONDETECTORCONDALG_H #define MUONGEOMODEL_MUONDETECTORCONDALG_H -#include "AthenaBaseComps/AthAlgorithm.h" +#include "AthenaBaseComps/AthReentrantAlgorithm.h" #include "StoreGate/WriteCondHandleKey.h" #include "StoreGate/ReadCondHandleKey.h" #include "GaudiKernel/ICondSvc.h" @@ -14,7 +14,7 @@ #include "GaudiKernel/ToolHandle.h" #include "MuonGeoModel/MuonDetectorTool.h" -class MuonDetectorCondAlg : public AthAlgorithm { +class MuonDetectorCondAlg : public AthReentrantAlgorithm { public: @@ -25,7 +25,7 @@ public: virtual ~MuonDetectorCondAlg() = default; virtual StatusCode initialize() override final; - virtual StatusCode execute() override final; + virtual StatusCode execute(const EventContext& ctx) const override final; virtual StatusCode finalize() override final; diff --git a/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorTool.h b/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorTool.h index f996f5e7e21901f0673bfff3b62b255aa81a1016..add78c6b2ff6f18f77d8a33430a8bfa74d64def9 100755 --- a/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorTool.h +++ b/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorTool.h @@ -29,7 +29,7 @@ public: // build the geometry virtual StatusCode create() override final; - StatusCode createFactory(MuonGM::MuonDetectorFactory001& theFactory); + StatusCode createFactory(MuonGM::MuonDetectorFactory001& theFactory) const; // Dereference tree tops and drop readout objects virtual StatusCode clear() override final; diff --git a/MuonSpectrometer/MuonGeoModel/src/MuonDetectorCondAlg.cxx b/MuonSpectrometer/MuonGeoModel/src/MuonDetectorCondAlg.cxx index 3012ee2731ba4fd4ef1b4cb567e218c4ff4f77af..7ca722f6ecd565655ad57cc784ef299c8a2ecd96 100755 --- a/MuonSpectrometer/MuonGeoModel/src/MuonDetectorCondAlg.cxx +++ b/MuonSpectrometer/MuonGeoModel/src/MuonDetectorCondAlg.cxx @@ -14,7 +14,7 @@ #include "AthenaKernel/CondCont.h" MuonDetectorCondAlg::MuonDetectorCondAlg( const std::string& name, ISvcLocator* pSvcLocator) - : AthAlgorithm(name, pSvcLocator), + : AthReentrantAlgorithm(name, pSvcLocator), m_condSvc{"CondSvc", name} { } @@ -55,14 +55,14 @@ MuonDetectorCondAlg::initialize() return StatusCode::SUCCESS; } -StatusCode MuonDetectorCondAlg::execute() +StatusCode MuonDetectorCondAlg::execute(const EventContext& ctx) const { ATH_MSG_DEBUG( "execute " << name() ); // ======================= // Write ILine Cond Handle // ======================= - SG::WriteCondHandle<MuonGM::MuonDetectorManager> writeHandle{m_writeDetectorManagerKey}; + SG::WriteCondHandle<MuonGM::MuonDetectorManager> writeHandle{m_writeDetectorManagerKey, ctx}; if (writeHandle.isValid()) { ATH_MSG_DEBUG("CondHandle " << writeHandle.fullKey() << " is already valid." << ". In theory this should not be called, but may happen" @@ -73,7 +73,7 @@ StatusCode MuonDetectorCondAlg::execute() // ======================= // Create the MuonDetectorManager by calling the MuonDetectorFactory001 // ======================= - MuonDetectorTool* MuDetTool = m_iGeoModelTool.get(); + const MuonDetectorTool* MuDetTool = m_iGeoModelTool.get(); MuonGM::MuonDetectorFactory001 theFactory(detStore().operator->()); if(MuDetTool->createFactory(theFactory).isFailure()){ ATH_MSG_FATAL("unable to create MuonDetectorFactory001 "); @@ -88,7 +88,7 @@ StatusCode MuonDetectorCondAlg::execute() // ======================= if (MuonMgrData->applyCscIntAlignment()) { - SG::ReadCondHandle<CscInternalAlignmentMapContainer> readILinesHandle{m_readILineKey}; + SG::ReadCondHandle<CscInternalAlignmentMapContainer> readILinesHandle{m_readILineKey, ctx}; const CscInternalAlignmentMapContainer* readILinesCdo{*readILinesHandle}; writeHandle.addDependency( readILinesHandle ); @@ -101,7 +101,7 @@ StatusCode MuonDetectorCondAlg::execute() // Update MdtAsBuiltMapContainer if requested BEFORE updating ALINES and BLINES // ======================= if (MuonMgrData->applyMdtAsBuiltParams()) { - SG::ReadCondHandle<MdtAsBuiltMapContainer> readAsBuiltHandle{m_readAsBuiltKey}; + SG::ReadCondHandle<MdtAsBuiltMapContainer> readAsBuiltHandle{m_readAsBuiltKey, ctx}; const MdtAsBuiltMapContainer* readAsBuiltCdo{*readAsBuiltHandle}; writeHandle.addDependency( readAsBuiltHandle ); @@ -114,7 +114,7 @@ StatusCode MuonDetectorCondAlg::execute() // Update Alignment, ALINES // ======================= - SG::ReadCondHandle<ALineMapContainer> readALinesHandle{m_readALineKey}; + SG::ReadCondHandle<ALineMapContainer> readALinesHandle{m_readALineKey, ctx}; if (MuonMgrData->updateAlignment(**readALinesHandle).isFailure()) ATH_MSG_ERROR("Unable to update Alignment" ); else ATH_MSG_DEBUG("update Alignment DONE" ); @@ -122,7 +122,7 @@ StatusCode MuonDetectorCondAlg::execute() // Update Deformations, BLINES // ======================= - SG::ReadCondHandle<BLineMapContainer> readBLinesHandle{m_readBLineKey}; + SG::ReadCondHandle<BLineMapContainer> readBLinesHandle{m_readBLineKey, ctx}; writeHandle.addDependency( readALinesHandle, readBLinesHandle ); diff --git a/MuonSpectrometer/MuonGeoModel/src/MuonDetectorTool.cxx b/MuonSpectrometer/MuonGeoModel/src/MuonDetectorTool.cxx index cd0d59d0b4d796b67f0555f2f11bce62e2b7a2f7..5e5cfb4812433f8752d4e842a53d8c1c14fc4bd6 100755 --- a/MuonSpectrometer/MuonGeoModel/src/MuonDetectorTool.cxx +++ b/MuonSpectrometer/MuonGeoModel/src/MuonDetectorTool.cxx @@ -155,7 +155,8 @@ MuonDetectorTool::create() GeoModelExperiment* theExpt = nullptr; ATH_CHECK( detStore()->retrieve( theExpt, "ATLAS" ) ); theExpt->addManager(theFactory.getDetectorManager()); - + + m_manager = theFactory.getDetectorManager(); } if (m_dumpMemoryBreakDown) @@ -182,7 +183,7 @@ MuonDetectorTool::create() } StatusCode -MuonDetectorTool::createFactory(MuonDetectorFactory001& theFactory) +MuonDetectorTool::createFactory(MuonDetectorFactory001& theFactory) const { std::ofstream geoModelStats; @@ -226,6 +227,7 @@ MuonDetectorTool::createFactory(MuonDetectorFactory001& theFactory) std::string detectorNode = MuonVersion.empty() ? "ATLAS" : "MuonSpectrometer"; ATH_MSG_INFO("Keys for Muon Switches are (key) " << detectorKey << " (node) " << detectorNode ); + std::string tempLayout = m_layout; std::map<std::string,std::string> altAsciiDBMap = std::map<std::string,std::string>(); if ( MuonVersion == "CUSTOM" ) ATH_MSG_WARNING("Detector Information coming from a custom configuration !!" ); @@ -238,7 +240,8 @@ MuonDetectorTool::createFactory(MuonDetectorFactory001& theFactory) if ((*switchSet).size()==0) return StatusCode::FAILURE; const IRDBRecord *switches = (*switchSet)[0]; - m_layout = switches->getString("LAYOUTNAME"); + // m_layout = switches->getString("LAYOUTNAME"); + tempLayout = switches->getString("LAYOUTNAME"); // m_includeInertMaterials = switches->getInt("BUILDINERTMATERIALS"); // m_minimalgeo = switches->getInt("MINIMALGEO"); if (MuonVersion == "") { @@ -262,10 +265,12 @@ MuonDetectorTool::createFactory(MuonDetectorFactory001& theFactory) // GeoModelExperiment* theExpt = nullptr; ATH_CHECK( detStore()->retrieve( theExpt, "ATLAS" ) ); - - if (!m_useCscIntAlines) m_controlCscIntAlines = 0; + + int tempControlCscIntAlines= m_controlCscIntAlines; + if (!m_useCscIntAlines) tempControlCscIntAlines = 0; ATH_MSG_INFO("Properties have been set as follows: " <<endmsg - <<" LayoutName "<< m_layout.substr(0,1) <<endmsg + // <<" LayoutName "<< m_layout.substr(0,1) <<endmsg + <<" LayoutName "<< tempLayout.substr(0,1) <<endmsg <<" IncludeCutouts "<< m_includeCutouts <<endmsg <<" IncludeCutoutsBog "<< m_includeCutoutsBog <<endmsg <<" IncludeCtbBis "<< m_includeCtbBis <<endmsg @@ -273,8 +278,8 @@ MuonDetectorTool::createFactory(MuonDetectorFactory001& theFactory) <<" MinimalGeoFlag "<< m_minimalGeoFlag <<endmsg <<" EnableCscIntAlignment "<< m_useCscIntAlines <<endmsg <<" EnableCscIntAlignmentFromGM "<< m_useCscIntAlinesFromGM ); - if (m_useCscIntAlines) ATH_MSG_INFO(" ControlCscIntAlines "<< m_controlCscIntAlines ); - else ATH_MSG_INFO(" ControlCscIntAlines reset to "<< m_controlCscIntAlines ); + if (m_useCscIntAlines) ATH_MSG_INFO(" ControlCscIntAlines "<< tempControlCscIntAlines ); + else ATH_MSG_INFO(" ControlCscIntAlines reset to "<< tempControlCscIntAlines ); ATH_MSG_INFO(" EnableMdtDeformations "<< m_enableMdtDeformations ); ATH_MSG_INFO(" EnableMdtAsBuiltParameters "<< m_enableMdtAsBuiltParameters ); @@ -326,7 +331,8 @@ MuonDetectorTool::createFactory(MuonDetectorFactory001& theFactory) theFactory.setABLinesAsciiSideA(m_NSWABLinesAsciiSideA); theFactory.setABLinesAsciiSideC(m_NSWABLinesAsciiSideC); - theFactory.setLayout(m_layout); + // theFactory.setLayout(m_layout); + theFactory.setLayout(tempLayout); //theFactory.setIncludeInertMats(m_includeInertMaterials); //theFactory.setIdhFromCnv(m_idhfromconverters); //theFactory.setMinimalGeoFlag(m_minimalgeo); @@ -335,8 +341,8 @@ MuonDetectorTool::createFactory(MuonDetectorFactory001& theFactory) theFactory.setCtbBisFlag(m_includeCtbBis); theFactory.setControlAlines(m_controlAlines); theFactory.setMinimalGeoFlag(m_minimalGeoFlag); - if (!m_useCscIntAlines) m_controlCscIntAlines = 0; - theFactory.setControlCscIntAlines(m_controlCscIntAlines); + if (!m_useCscIntAlines) tempControlCscIntAlines = 0; + theFactory.setControlCscIntAlines(tempControlCscIntAlines); theFactory.setDumpMemoryBreakDown(m_dumpMemoryBreakDown); theFactory.setCachingFlag(m_cachingFlag); theFactory.setCacheFillingFlag(m_fillCache_initTime); @@ -375,20 +381,20 @@ MuonDetectorTool::createFactory(MuonDetectorFactory001& theFactory) cpu = ucpu; } // Register the MuonDetectorNode instance with the Transient Detector Store - m_manager = theFactory.getDetectorManager(); + MuonGM::MuonDetectorManager* theManager = theFactory.getDetectorManager(); //Init ABline historical container --- will write there A/B lines from ORACLE / ascii file if any - m_manager->initABlineContainers(); - if ((m_manager->initCSCInternalAlignmentMap()).isFailure()) return StatusCode::FAILURE; // does nothing other then checking the size (map is built while reading data from the primary source) + theManager->initABlineContainers(); + if ((theManager->initCSCInternalAlignmentMap()).isFailure()) return StatusCode::FAILURE; // does nothing other then checking the size (map is built while reading data from the primary source) if (m_fillCache_initTime) { - m_manager->fillCache(); + theManager->fillCache(); } else { // cache for RPC / TGC / CSC must be filled once forever - m_manager->fillRpcCache(); - m_manager->fillTgcCache(); - m_manager->fillCscCache(); + theManager->fillRpcCache(); + theManager->fillTgcCache(); + theManager->fillCscCache(); }