From cfb1e74d1a26026c2e18c568d5a43e5296000e87 Mon Sep 17 00:00:00 2001 From: Gerhard Raven <gerhard.raven@nikhef.nl> Date: Wed, 28 Feb 2024 10:49:47 +0100 Subject: [PATCH] remove obsolete `context()` --- .../include/Kernel/Particle2MCLinker.h | 2 -- .../include/Kernel/Particle2MCLinker.icpp | 14 +---------- Event/RecEvent/include/Event/ProtoParticle.h | 8 +++--- GaudiAlg/include/GaudiAlg/GaudiCommon.h | 20 ++------------- GaudiAlg/src/lib/GaudiCommon.icpp | 25 ------------------- GaudiAlg/src/lib/GaudiSequencer.cpp | 6 +---- GaudiAlg/tests/qmtest/refs/Aida2Root.ref | 1 - .../tests/qmtest/refs/EvtColsEx/Write.ref | 1 - .../tests/qmtest/refs/GaudiCommonTests.ref | 4 --- .../tests/qmtest/refs/Histograms_opts.ref | 1 - GaudiAlg/tests/qmtest/refs/Histograms_py.ref | 1 - .../refs/gaudiconfig2/Histograms_wg.ref | 1 - Phys/LoKiCore/src/AlgFunctors.cpp | 2 -- .../RichInterfaces/IRichToolRegistry.h | 10 -------- .../include/RichKernel/RichCommonBase.h | 6 ----- .../src/component/RichToolRegistry.cpp | 4 --- .../src/component/RichToolRegistry.h | 3 --- Rich/RichKernel/src/lib/RichCommonBase.icpp | 12 --------- 18 files changed, 7 insertions(+), 114 deletions(-) diff --git a/Associators/MCAssociators/include/Kernel/Particle2MCLinker.h b/Associators/MCAssociators/include/Kernel/Particle2MCLinker.h index 3a4f2fb599a..4c6255eb389 100644 --- a/Associators/MCAssociators/include/Kernel/Particle2MCLinker.h +++ b/Associators/MCAssociators/include/Kernel/Particle2MCLinker.h @@ -93,7 +93,6 @@ public: private: const std::string& name() const { return m_parent->name(); } - const std::string& context() const { return m_parent->context(); } protected: MsgStream& debug() { return m_parent->debug(); } @@ -125,7 +124,6 @@ private: mutable Gaudi::Accumulators::MsgCounter<MSG::ERROR> m_noAlgTypeErr{m_parent, "No alg type given", 10}; mutable Gaudi::Accumulators::MsgCounter<MSG::ERROR> m_noIAlgMgrErr{m_parent, "Could not locate IAlgManager", 10}; mutable Gaudi::Accumulators::MsgCounter<MSG::ERROR> m_algoCreationErr{m_parent, "Could not create algorithm", 10}; - mutable Gaudi::Accumulators::MsgCounter<MSG::ERROR> m_setContextErr{m_parent, "Unable to set Property Context", 10}; mutable Gaudi::Accumulators::MsgCounter<MSG::ERROR> m_algInitErr{m_parent, "Error in algorithm initialization!", 10}; mutable Gaudi::Accumulators::MsgCounter<MSG::ERROR> m_setOutTableErr{m_parent, "Unable to set Property OutputTable", 10}; diff --git a/Associators/MCAssociators/include/Kernel/Particle2MCLinker.icpp b/Associators/MCAssociators/include/Kernel/Particle2MCLinker.icpp index 9692bb4a84c..65c82d9a8fb 100644 --- a/Associators/MCAssociators/include/Kernel/Particle2MCLinker.icpp +++ b/Associators/MCAssociators/include/Kernel/Particle2MCLinker.icpp @@ -84,12 +84,6 @@ StatusCode Object2MCLinker<SOURCE, PARENT>::locateAlgorithm( const std::string& ++m_algoCreationErr; return sc; } - IProperty* prop = dynamic_cast<IProperty*>( alg ); - sc = prop->setProperty( "Context", this->context() ); - if ( !sc.isSuccess() ) { - ++m_setContextErr; - return sc; - } // add the reference to the new algorithm alg->addRef(); @@ -122,15 +116,9 @@ StatusCode Object2MCLinker<SOURCE, PARENT>::setAlgInputData( IAlgorithm*& ++m_ipropWarn; return StatusCode::SUCCESS; } - // Context property is contagious (from myMother) - auto sc = prop->setProperty( "Context", context() ); - if ( !sc.isSuccess() ) { - ++m_setContextErr; - return sc; - } // Set OutputTable property to "" avoiding Relations table - sc = prop->setProperty( "OutputTable", "" ); + auto sc = prop->setProperty( "OutputTable", "" ); if ( !sc.isSuccess() ) { ++m_setOutTableErr; return sc; diff --git a/Event/RecEvent/include/Event/ProtoParticle.h b/Event/RecEvent/include/Event/ProtoParticle.h index 335711bdab5..1d27d994c0e 100644 --- a/Event/RecEvent/include/Event/ProtoParticle.h +++ b/Event/RecEvent/include/Event/ProtoParticle.h @@ -50,11 +50,9 @@ namespace LHCb { // Namespace for locations in TDS namespace ProtoParticleLocation { - inline const std::string Charged = "Rec/ProtoP/Charged"; - inline const std::string Upstream = "Rec/ProtoP/Upstream"; - inline const std::string Neutrals = "Rec/ProtoP/Neutrals"; - inline const std::string HltCharged = "Hlt/ProtoP/Charged"; - inline const std::string HltNeutrals = "Hlt/ProtoP/Neutrals"; + inline const std::string Charged = "Rec/ProtoP/Charged"; + inline const std::string Upstream = "Rec/ProtoP/Upstream"; + inline const std::string Neutrals = "Rec/ProtoP/Neutrals"; } // namespace ProtoParticleLocation /** @class ProtoParticle ProtoParticle.h diff --git a/GaudiAlg/include/GaudiAlg/GaudiCommon.h b/GaudiAlg/include/GaudiAlg/GaudiCommon.h index d0f2f4fe5c0..b3d7723cd13 100644 --- a/GaudiAlg/include/GaudiAlg/GaudiCommon.h +++ b/GaudiAlg/include/GaudiAlg/GaudiCommon.h @@ -606,19 +606,8 @@ public: StatusCode runUpdate() { return updMgrSvc()->update( this ); } public: - /// Algorithm constructor - the SFINAE constraint below ensures that this is - /// constructor is only defined if PBASE derives from Algorithm - template <typename U = PBASE, typename = std::enable_if_t<std::is_base_of_v<Gaudi::Algorithm, PBASE>, U>> - GaudiCommon( std::string name, ISvcLocator* pSvcLocator ) : base_class( std::move( name ), pSvcLocator ) { - initGaudiCommonConstructor(); - } - /// Tool constructor - SFINAE-ed to insure this constructor is only defined - /// if PBASE derives from AlgTool. - template <typename U = PBASE, typename = std::enable_if_t<std::is_base_of_v<AlgTool, PBASE>, U>> - GaudiCommon( std::string type, std::string name, const IInterface* ancestor ) - : base_class( std::move( type ), std::move( name ), ancestor ) { - initGaudiCommonConstructor( this->parent() ); - } + /// constructor + using base_class::base_class; public: /** standard initialization method @@ -670,10 +659,6 @@ public: /// get the list of aquired services const Services& services() const { return m_services; } // get all services // ========================================================================== -public: - // ========================================================================== - /// Returns the "context" string. Used to identify different processing states. - const std::string& context() const { return m_context; } private: // ========================================================================== @@ -731,7 +716,6 @@ protected: "print the properties of the component"}; Gaudi::Property<bool> m_typePrint{this, "TypePrint", true, "add the actual C++ component type into the messages"}; - Gaudi::Property<std::string> m_context{this, "Context", {}, "note: overridden by parent settings"}; Gaudi::Property<std::vector<std::string>> m_counterList{ this, "CounterList", {".*"}, "RegEx list, of simple integer counters for CounterSummary"}; }; diff --git a/GaudiAlg/src/lib/GaudiCommon.icpp b/GaudiAlg/src/lib/GaudiCommon.icpp index 747a49ef7ec..a32b9f02db6 100644 --- a/GaudiAlg/src/lib/GaudiCommon.icpp +++ b/GaudiAlg/src/lib/GaudiCommon.icpp @@ -45,30 +45,6 @@ #include <fmt/format.h> #include <numeric> -// ============================================================================ -// constructor initialisation -// ============================================================================ -template <class PBASE> -void GaudiCommon<PBASE>::initGaudiCommonConstructor( const IInterface* parent ) { - // setup context from parent if available - if ( parent ) { - if ( const GaudiAlgorithm* gAlg = dynamic_cast<const GaudiAlgorithm*>( parent ) ) { - m_context = gAlg->context(); - } else if ( const GaudiTool* gTool = dynamic_cast<const GaudiTool*>( parent ) ) { - m_context = gTool->context(); - } - } - - // Get options values from IOptionsSvc - // \fixme this part is not needed because this method is called in the constructor, - // and properties are, anyway, set during the initialize... except for Context - // which might be set in the contructor by GaudiSequencer. - const auto& optsSvc = this->serviceLocator()->getOptsSvc(); - const std::string key = this->name() + ".Context"; - if ( optsSvc.has( key ) ) { this->setPropertyRepr( "Context", optsSvc.get( key ) ).ignore(); } -} -//============================================================================= - //============================================================================= // Initialise the common functionality //============================================================================= @@ -82,7 +58,6 @@ StatusCode GaudiCommon<PBASE>::initialize() { // some debug printout if ( this->msgLevel( MSG::DEBUG ) ) { this->debug() << "Initialize base class GaudiCommon<" << System::typeinfoName( typeid( PBASE ) ) << ">" << endmsg; - if ( !context().empty() ) this->debug() << "Created with context = '" << context() << "'" << endmsg; } // Set up the CounterSummarySvc May need to be changed diff --git a/GaudiAlg/src/lib/GaudiSequencer.cpp b/GaudiAlg/src/lib/GaudiSequencer.cpp index fa45cbca856..7cef8e3b0ba 100644 --- a/GaudiAlg/src/lib/GaudiSequencer.cpp +++ b/GaudiAlg/src/lib/GaudiSequencer.cpp @@ -152,11 +152,8 @@ StatusCode GaudiSequencer::decodeNames() { Gaudi::Algorithm* myAlg = nullptr; result = createSubAlgorithm( theType, theName, myAlg ); if ( myAlg ) { - // Override the default values of the special properties Context and RootInTES, + // Override the default values of the special property RootInTES, // which will be superseded by the explicit value in options (if present). - if ( !isDefault( context() ) && myAlg->hasProperty( "Context" ) ) { - myAlg->setProperty( "Context", context() ).ignore(); - } if ( !isDefault( rootInTES() ) && myAlg->hasProperty( "RootInTES" ) ) { myAlg->setProperty( "RootInTES", rootInTES() ).ignore(); } @@ -216,7 +213,6 @@ StatusCode GaudiSequencer::decodeNames() { if ( alg->name() != typ ) os << "/" << alg->name(); return os; } ); - if ( !isDefault( context() ) ) msg << ", with context '" << context() << "'"; if ( !isDefault( rootInTES() ) ) msg << ", with rootInTES '" << rootInTES() << "'"; msg << endmsg; diff --git a/GaudiAlg/tests/qmtest/refs/Aida2Root.ref b/GaudiAlg/tests/qmtest/refs/Aida2Root.ref index 130b49e80a1..3174eea3b41 100644 --- a/GaudiAlg/tests/qmtest/refs/Aida2Root.ref +++ b/GaudiAlg/tests/qmtest/refs/Aida2Root.ref @@ -43,7 +43,6 @@ SimpleHistos DEBUG Property ['Name': Value] = 'HistoProduce':True SimpleHistos DEBUG Property ['Name': Value] = 'RequireObjects':[ ] SimpleHistos DEBUG Property ['Name': Value] = 'VetoObjects':[ ] SimpleHistos DEBUG Property ['Name': Value] = 'CounterList':[ '.*' ] -SimpleHistos DEBUG Property ['Name': Value] = 'Context':'' SimpleHistos DEBUG Property ['Name': Value] = 'TypePrint':True SimpleHistos DEBUG Property ['Name': Value] = 'PropertiesPrint':False SimpleHistos DEBUG Property ['Name': Value] = 'ErrorsPrint':True diff --git a/GaudiAlg/tests/qmtest/refs/EvtColsEx/Write.ref b/GaudiAlg/tests/qmtest/refs/EvtColsEx/Write.ref index 0d132d15e62..ea611ea9e26 100644 --- a/GaudiAlg/tests/qmtest/refs/EvtColsEx/Write.ref +++ b/GaudiAlg/tests/qmtest/refs/EvtColsEx/Write.ref @@ -64,7 +64,6 @@ Fill SUCCESS Property ['Name': Value] = 'HistoProduce':True Fill SUCCESS Property ['Name': Value] = 'RequireObjects':[ ] Fill SUCCESS Property ['Name': Value] = 'VetoObjects':[ ] Fill SUCCESS Property ['Name': Value] = 'CounterList':[ '.*' ] -Fill SUCCESS Property ['Name': Value] = 'Context':'' Fill SUCCESS Property ['Name': Value] = 'TypePrint':False Fill SUCCESS Property ['Name': Value] = 'PropertiesPrint':True Fill SUCCESS Property ['Name': Value] = 'ErrorsPrint':True diff --git a/GaudiAlg/tests/qmtest/refs/GaudiCommonTests.ref b/GaudiAlg/tests/qmtest/refs/GaudiCommonTests.ref index f51b1b55f56..3a4b156b1a0 100644 --- a/GaudiAlg/tests/qmtest/refs/GaudiCommonTests.ref +++ b/GaudiAlg/tests/qmtest/refs/GaudiCommonTests.ref @@ -38,7 +38,6 @@ Test1 DEBUG List of ALL properties of GaudiCommonTests/Test1 #pro Test1 DEBUG Property ['Name': Value] = 'RequireObjects':[ ] Test1 DEBUG Property ['Name': Value] = 'VetoObjects':[ ] Test1 DEBUG Property ['Name': Value] = 'CounterList':[ '.*' ] -Test1 DEBUG Property ['Name': Value] = 'Context':'' Test1 DEBUG Property ['Name': Value] = 'TypePrint':True Test1 DEBUG Property ['Name': Value] = 'PropertiesPrint':False Test1 DEBUG Property ['Name': Value] = 'ErrorsPrint':True @@ -73,7 +72,6 @@ Test2 DEBUG List of ALL properties of GaudiCommonTests/Test2 #pro Test2 DEBUG Property ['Name': Value] = 'RequireObjects':[ ] Test2 DEBUG Property ['Name': Value] = 'VetoObjects':[ ] Test2 DEBUG Property ['Name': Value] = 'CounterList':[ '.*' ] -Test2 DEBUG Property ['Name': Value] = 'Context':'' Test2 DEBUG Property ['Name': Value] = 'TypePrint':True Test2 DEBUG Property ['Name': Value] = 'PropertiesPrint':False Test2 DEBUG Property ['Name': Value] = 'ErrorsPrint':True @@ -113,7 +111,6 @@ Test3 DEBUG List of ALL properties of GaudiCommonTests/Test3 #pro Test3 DEBUG Property ['Name': Value] = 'RequireObjects':[ ] Test3 DEBUG Property ['Name': Value] = 'VetoObjects':[ ] Test3 DEBUG Property ['Name': Value] = 'CounterList':[ '.*' ] -Test3 DEBUG Property ['Name': Value] = 'Context':'' Test3 DEBUG Property ['Name': Value] = 'TypePrint':True Test3 DEBUG Property ['Name': Value] = 'PropertiesPrint':False Test3 DEBUG Property ['Name': Value] = 'ErrorsPrint':True @@ -149,7 +146,6 @@ Test4 DEBUG List of ALL properties of GaudiCommonTests/Test4 #pro Test4 DEBUG Property ['Name': Value] = 'RequireObjects':[ ] Test4 DEBUG Property ['Name': Value] = 'VetoObjects':[ ] Test4 DEBUG Property ['Name': Value] = 'CounterList':[ '.*' ] -Test4 DEBUG Property ['Name': Value] = 'Context':'' Test4 DEBUG Property ['Name': Value] = 'TypePrint':True Test4 DEBUG Property ['Name': Value] = 'PropertiesPrint':False Test4 DEBUG Property ['Name': Value] = 'ErrorsPrint':True diff --git a/GaudiAlg/tests/qmtest/refs/Histograms_opts.ref b/GaudiAlg/tests/qmtest/refs/Histograms_opts.ref index 32bebafaa1a..42d2b72730b 100644 --- a/GaudiAlg/tests/qmtest/refs/Histograms_opts.ref +++ b/GaudiAlg/tests/qmtest/refs/Histograms_opts.ref @@ -39,7 +39,6 @@ SimpleHistos DEBUG Property ['Name': Value] = 'HistoProduce':True SimpleHistos DEBUG Property ['Name': Value] = 'RequireObjects':[ ] SimpleHistos DEBUG Property ['Name': Value] = 'VetoObjects':[ ] SimpleHistos DEBUG Property ['Name': Value] = 'CounterList':[ '.*' ] -SimpleHistos DEBUG Property ['Name': Value] = 'Context':'' SimpleHistos DEBUG Property ['Name': Value] = 'TypePrint':True SimpleHistos DEBUG Property ['Name': Value] = 'PropertiesPrint':False SimpleHistos DEBUG Property ['Name': Value] = 'ErrorsPrint':True diff --git a/GaudiAlg/tests/qmtest/refs/Histograms_py.ref b/GaudiAlg/tests/qmtest/refs/Histograms_py.ref index 9615aa42076..9a4cb816045 100644 --- a/GaudiAlg/tests/qmtest/refs/Histograms_py.ref +++ b/GaudiAlg/tests/qmtest/refs/Histograms_py.ref @@ -30,7 +30,6 @@ SimpleHistos DEBUG Property ['Name': Value] = 'HistoProduce':True SimpleHistos DEBUG Property ['Name': Value] = 'RequireObjects':[ ] SimpleHistos DEBUG Property ['Name': Value] = 'VetoObjects':[ ] SimpleHistos DEBUG Property ['Name': Value] = 'CounterList':[ '.*' ] -SimpleHistos DEBUG Property ['Name': Value] = 'Context':'' SimpleHistos DEBUG Property ['Name': Value] = 'TypePrint':True SimpleHistos DEBUG Property ['Name': Value] = 'PropertiesPrint':False SimpleHistos DEBUG Property ['Name': Value] = 'ErrorsPrint':True diff --git a/GaudiAlg/tests/qmtest/refs/gaudiconfig2/Histograms_wg.ref b/GaudiAlg/tests/qmtest/refs/gaudiconfig2/Histograms_wg.ref index 2df1de70409..e1bf0aae5d7 100644 --- a/GaudiAlg/tests/qmtest/refs/gaudiconfig2/Histograms_wg.ref +++ b/GaudiAlg/tests/qmtest/refs/gaudiconfig2/Histograms_wg.ref @@ -29,7 +29,6 @@ SimpleHistos DEBUG Property ['Name': Value] = 'HistoProduce':True SimpleHistos DEBUG Property ['Name': Value] = 'RequireObjects':[ ] SimpleHistos DEBUG Property ['Name': Value] = 'VetoObjects':[ ] SimpleHistos DEBUG Property ['Name': Value] = 'CounterList':[ '.*' ] -SimpleHistos DEBUG Property ['Name': Value] = 'Context':'' SimpleHistos DEBUG Property ['Name': Value] = 'TypePrint':True SimpleHistos DEBUG Property ['Name': Value] = 'PropertiesPrint':False SimpleHistos DEBUG Property ['Name': Value] = 'ErrorsPrint':True diff --git a/Phys/LoKiCore/src/AlgFunctors.cpp b/Phys/LoKiCore/src/AlgFunctors.cpp index ef8388f1844..ebe7b080d16 100644 --- a/Phys/LoKiCore/src/AlgFunctors.cpp +++ b/Phys/LoKiCore/src/AlgFunctors.cpp @@ -111,8 +111,6 @@ namespace { // ensure some magic properties are set while we create the subalgorithm so // that it effectively inherites 'our' settings -- if they have non-default // values... and are not set explicitly already. - if ( !optsSvc.isSet( typeName.name() + ".Context" ) ) - optsSvc.set( typeName.name() + ".Context", parent->context() ); if ( !optsSvc.isSet( typeName.name() + ".RootInTES" ) ) optsSvc.set( typeName.name() + ".RootInTES", parent->rootInTES() ); myIAlg = iam->algorithm( typeName, true ); diff --git a/Rich/RichInterfaces/include/RichInterfaces/IRichToolRegistry.h b/Rich/RichInterfaces/include/RichInterfaces/IRichToolRegistry.h index 3394301cf9a..9ae7ee20319 100644 --- a/Rich/RichInterfaces/include/RichInterfaces/IRichToolRegistry.h +++ b/Rich/RichInterfaces/include/RichInterfaces/IRichToolRegistry.h @@ -49,16 +49,6 @@ namespace Rich { * @return The class name of the tool associated to the given "nickname" */ virtual const std::string& toolType( const std::string& nickname ) const = 0; - - /** Converts a tool "nickname" into a particular instance name - * - * Takes into account the Context of the tool. - * - * @param nickname The tool nickname for which the class name is requested - * - * @return The instance name of the tool associated to the given "nickname" - */ - virtual const std::string toolName( const std::string& nickname ) const = 0; }; } // namespace Rich diff --git a/Rich/RichKernel/include/RichKernel/RichCommonBase.h b/Rich/RichKernel/include/RichKernel/RichCommonBase.h index 4e8807fe895..574b7ddac17 100644 --- a/Rich/RichKernel/include/RichKernel/RichCommonBase.h +++ b/Rich/RichKernel/include/RichKernel/RichCommonBase.h @@ -81,12 +81,6 @@ namespace Rich { /// Pointer to Job Options Service inline Gaudi::Interfaces::IOptionsSvc& optsSvc() const noexcept { return this->serviceLocator()->getOptsSvc(); } - /** Generate a context specific TES location for the given Default location - * @param loc The Default TES location - * @return The context specific TES location for the input location - */ - std::string contextSpecificTES( const std::string& loc ) const; - /** Propagate a list oj job options from one object to another * @param from_name The name of the object to get the options from * @param to_name The name of the oject to copy the options to diff --git a/Rich/RichKernel/src/component/RichToolRegistry.cpp b/Rich/RichKernel/src/component/RichToolRegistry.cpp index ed2c9e3830a..b13baf72d74 100644 --- a/Rich/RichKernel/src/component/RichToolRegistry.cpp +++ b/Rich/RichKernel/src/component/RichToolRegistry.cpp @@ -131,10 +131,6 @@ const std::string& Rich::ToolRegistry::toolType( const std::string& nickname ) c return m_myTools[nickname]; } -const std::string Rich::ToolRegistry::toolName( const std::string& nickname ) const { - return ( context().empty() ? nickname : context() + "_" + nickname ); -} - void Rich::ToolRegistry::addEntry( const std::string& nickname, const std::string& type ) const { if ( !m_myTools[nickname].empty() && type != m_myTools[nickname] ) { std::ostringstream mess; diff --git a/Rich/RichKernel/src/component/RichToolRegistry.h b/Rich/RichKernel/src/component/RichToolRegistry.h index c6a6b0e3e8d..1cc814a2ff1 100644 --- a/Rich/RichKernel/src/component/RichToolRegistry.h +++ b/Rich/RichKernel/src/component/RichToolRegistry.h @@ -65,9 +65,6 @@ namespace Rich { // Converts a tool nickname into a particular class name const std::string& toolType( const std::string& nickname ) const override final; - // Converts a tool "nickname" into a particular instance name - const std::string toolName( const std::string& nickname ) const override final; - private: // methods /// Set up the tool mappings void setUpTools( const ToolList& toolList ); diff --git a/Rich/RichKernel/src/lib/RichCommonBase.icpp b/Rich/RichKernel/src/lib/RichCommonBase.icpp index 2f7533c03ca..0a6a36628a8 100644 --- a/Rich/RichKernel/src/lib/RichCommonBase.icpp +++ b/Rich/RichKernel/src/lib/RichCommonBase.icpp @@ -32,18 +32,6 @@ // Gaudi #include <Gaudi/Interfaces/IOptionsSvc.h> -//============================================================================= -// Generate a context specific TES location for the given Default location -//============================================================================= -template <class PBASE> -std::string Rich::CommonBase<PBASE>::contextSpecificTES( const std::string& loc ) const { - const auto slash = loc.find_last_of( "/" ); - return ( slash > 0 && !this->context().empty() - ? loc.substr( 0, slash ) + "/" + this->context() + "/" + loc.substr( slash + 1 ) - : loc ); -} -//============================================================================= - //============================================================================= // Propagate a list oj job options from one object to another //============================================================================= -- GitLab