diff --git a/Control/xAODRootAccess/Root/TAuxBranchManager.cxx b/Control/xAODRootAccess/Root/TAuxBranchManager.cxx index 6d31f7e13996f210a3effd658f047814cacbd95e..97ac4dffdb7ba05fe7612c895983bea6036509b5 100644 --- a/Control/xAODRootAccess/Root/TAuxBranchManager.cxx +++ b/Control/xAODRootAccess/Root/TAuxBranchManager.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration // ROOT include(s): #include <TBranch.h> @@ -122,11 +122,7 @@ namespace xAOD { return; } - ::Bool_t TAuxBranchManager::isSet( ::Bool_t forceSet ) const { - - // If we can't use default objects, let's just return the - // actual state that the object is in: - if( ! forceSet ) return m_isSet; + ::Bool_t TAuxBranchManager::create() { // If we already have it set, let's stop here: if( m_isSet ) return kTRUE; @@ -147,6 +143,10 @@ namespace xAOD { return kTRUE; } + ::Bool_t TAuxBranchManager::isSet() const { + return m_isSet; + } + void TAuxBranchManager::reset() { m_isSet = kFALSE; diff --git a/Control/xAODRootAccess/Root/TAuxManager.cxx b/Control/xAODRootAccess/Root/TAuxManager.cxx index 66ab7053893fba2ffdb61ba548bfc37f7cca1683..7288a773375fea0ec6905ffae928a19659a5731c 100644 --- a/Control/xAODRootAccess/Root/TAuxManager.cxx +++ b/Control/xAODRootAccess/Root/TAuxManager.cxx @@ -1,8 +1,7 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ -// $Id: TAuxManager.cxx 607344 2014-07-18 13:27:49Z krasznaa $ // ROOT include(s): #include <TError.h> @@ -61,14 +60,18 @@ namespace xAOD { return; } + /// There is no need for a default object. + /// + ::Bool_t TAuxManager::create() { + + return kTRUE; + } + /// The state of a TAuxStore object is always "set". So this /// interface unfortunately doesn't make much sense for this /// manager class... /// - /// @param forceSet Ignored as it does not apply - /// @returns <code>kTRUE</code> - /// - ::Bool_t TAuxManager::isSet( ::Bool_t /*forceSet*/ ) const { + ::Bool_t TAuxManager::isSet() const { return kTRUE; } diff --git a/Control/xAODRootAccess/Root/TEvent.cxx b/Control/xAODRootAccess/Root/TEvent.cxx index 2c060b4bb4fd3831dfd80cab1f57e5603f91a86a..d69af37fa9871baeb646b53eceb46108265af70a 100644 --- a/Control/xAODRootAccess/Root/TEvent.cxx +++ b/Control/xAODRootAccess/Root/TEvent.cxx @@ -1438,7 +1438,7 @@ namespace xAOD { Object_t outputObjectsCopy = m_outputObjects; for( auto& itr : outputObjectsCopy ) { // Check that a new object was provided in the event: - if( ! itr.second->isSet() ) { + if( ! itr.second->create() ) { // We are now going to fail. But let's collect the names of // all the unset objects: if( unsetObjects.size() ) { @@ -1982,7 +1982,7 @@ namespace xAOD { } // If the object is not set in this event yet, we can't continue: - if( ! itr->second->isSet( false ) ) { + if( ! itr->second->isSet() ) { return 0; } diff --git a/Control/xAODRootAccess/Root/TObjectManager.cxx b/Control/xAODRootAccess/Root/TObjectManager.cxx index 93362ab4dd4909b4ece692f9b40a327584817d23..ad69ffa6fe17b97698cfa6f9fedcc60dbafb0091 100644 --- a/Control/xAODRootAccess/Root/TObjectManager.cxx +++ b/Control/xAODRootAccess/Root/TObjectManager.cxx @@ -1,8 +1,7 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ -// $Id: TObjectManager.cxx 731792 2016-03-23 10:27:41Z krasznaa $ // ROOT include(s): #include <TBranch.h> @@ -155,12 +154,17 @@ namespace xAOD { return; } - /// @param forceSet Ignored, as full objects can't be missing + /// Dummy implementation as full objects can't be missing /// + ::Bool_t TObjectManager::create() { + + return m_isSet; + } + /// @returns <code>kTRUE</code> if the object for this event was set, /// <code>kFALSE</code> otherwise /// - ::Bool_t TObjectManager::isSet( Bool_t /*forceSet*/ ) const { + ::Bool_t TObjectManager::isSet() const { return m_isSet; } diff --git a/Control/xAODRootAccess/Root/TPrimitiveAuxBranchManager.cxx b/Control/xAODRootAccess/Root/TPrimitiveAuxBranchManager.cxx index 36d989e33a7bd0dc5afc7c6e8bc1126c3233381e..d267283f5acdccff24812d31c655850900c2ca4a 100644 --- a/Control/xAODRootAccess/Root/TPrimitiveAuxBranchManager.cxx +++ b/Control/xAODRootAccess/Root/TPrimitiveAuxBranchManager.cxx @@ -1,8 +1,7 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ -// $Id: TPrimitiveAuxBranchManager.cxx 783066 2016-11-08 19:39:32Z ssnyder $ // ROOT include(s): #include <TBranch.h> @@ -133,11 +132,7 @@ namespace xAOD { return; } - ::Bool_t TPrimitiveAuxBranchManager::isSet( ::Bool_t forceSet ) const { - - // If we can't use default objects, let's just return the - // actual state that the object is in: - if( ! forceSet ) return m_isSet; + ::Bool_t TPrimitiveAuxBranchManager::create() { // If we already have it set, let's stop here: if( m_isSet ) return kTRUE; @@ -159,6 +154,11 @@ namespace xAOD { return kTRUE; } + ::Bool_t TPrimitiveAuxBranchManager::isSet() const { + + return m_isSet; + } + void TPrimitiveAuxBranchManager::reset() { m_isSet = kFALSE; diff --git a/Control/xAODRootAccess/Root/TStore.cxx b/Control/xAODRootAccess/Root/TStore.cxx index 74e3af9b78cb6ad6b27cefa004e27c9827f145f1..0a105cc1ffe6fd7d4f02a2e19b34f61e3187b96f 100644 --- a/Control/xAODRootAccess/Root/TStore.cxx +++ b/Control/xAODRootAccess/Root/TStore.cxx @@ -8,6 +8,9 @@ // EDM include(s): #include "AthContainers/normalizedTypeinfoName.h" +#include "CxxUtils/checker_macros.h" +#include "CxxUtils/ConcurrentStrMap.h" +#include "CxxUtils/SimpleUpdater.h" // Local include(s): #include "xAODRootAccess/TStore.h" @@ -223,8 +226,11 @@ namespace xAOD { const std::string& classname, ::Bool_t isOwner ) { + // Cache + using clCache_t = CxxUtils::ConcurrentStrMap<::TClass*, CxxUtils::SimpleUpdater>; + static clCache_t clMap ATLAS_THREAD_SAFE {clCache_t::Updater_t()}; + // First check if we have this dictionary cached already: - static std::map< std::string, ::TClass* > clMap; ::TClass* cl = 0; auto clItr = clMap.find( classname ); if( clItr != clMap.end() ) { @@ -239,7 +245,7 @@ namespace xAOD { // If it's not cached, ask ROOT for it: if( ! cl ) { cl = ::TClass::GetClass( classname.c_str(), kTRUE, kTRUE ); - clMap[ classname ] = cl; + clMap.emplace( classname, cl ); } if( ( ! cl ) || ( ! cl->IsLoaded() ) ) { return StatusCode::RECOVERABLE; diff --git a/Control/xAODRootAccess/xAODRootAccess/tools/TAuxBranchManager.h b/Control/xAODRootAccess/xAODRootAccess/tools/TAuxBranchManager.h index f106bd232d878c829f3e26224cc7919fe1a5e7a7..8b8b8aba1d520c896da34d34f6faf0cd05f34234 100644 --- a/Control/xAODRootAccess/xAODRootAccess/tools/TAuxBranchManager.h +++ b/Control/xAODRootAccess/xAODRootAccess/tools/TAuxBranchManager.h @@ -1,10 +1,9 @@ // Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ -// $Id: TAuxBranchManager.h 595278 2014-05-03 09:31:05Z krasznaa $ #ifndef XAODROOTACCESS_TOOLS_TAUXBRANCHMANAGER_H #define XAODROOTACCESS_TOOLS_TAUXBRANCHMANAGER_H @@ -31,8 +30,6 @@ namespace xAOD { /// /// @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> /// - /// $Revision: 595278 $ - /// $Date: 2014-05-03 11:31:05 +0200 (Sat, 03 May 2014) $ /// class TAuxBranchManager : public TVirtualManager { @@ -68,8 +65,10 @@ namespace xAOD { /// Function replacing the object being handled virtual void setObject( void* obj ); + /// Create the object for the current event + virtual ::Bool_t create(); /// Check if the object was set for the current event - virtual ::Bool_t isSet( ::Bool_t forceSet = kTRUE ) const; + virtual ::Bool_t isSet() const; /// Reset the object at the end of processing of an event virtual void reset(); @@ -81,12 +80,12 @@ namespace xAOD { /// The last entry that was loaded for this branch ::Long64_t m_entry; /// Was the object set for the current event? - mutable ::Bool_t m_isSet; + ::Bool_t m_isSet; /// Auxiliary variable type auxid_t m_auxId; /// Dummy auxiliary variable for the empty events - mutable SG::IAuxTypeVector* m_vector; + SG::IAuxTypeVector* m_vector; }; // class TAuxBranchManager diff --git a/Control/xAODRootAccess/xAODRootAccess/tools/TAuxManager.h b/Control/xAODRootAccess/xAODRootAccess/tools/TAuxManager.h index 0c8ab2c6b4761323f5a19bcf9d76edb0d52446e0..fffda4df420a35c66b41c85e1a6b8ab52b39e639 100644 --- a/Control/xAODRootAccess/xAODRootAccess/tools/TAuxManager.h +++ b/Control/xAODRootAccess/xAODRootAccess/tools/TAuxManager.h @@ -1,10 +1,9 @@ // Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ -// $Id: TAuxManager.h 607344 2014-07-18 13:27:49Z krasznaa $ #ifndef XAODROOTACCESS_TOOLS_TAUXMANAGER_H #define XAODROOTACCESS_TOOLS_TAUXMANAGER_H @@ -31,9 +30,6 @@ namespace xAOD { /// /// @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> /// - /// $Revision: 607344 $ - /// $Date: 2014-07-18 15:27:49 +0200 (Fri, 18 Jul 2014) $ - /// class TAuxManager : public TVirtualManager { public: @@ -53,8 +49,10 @@ namespace xAOD { /// Function replacing the object being handled virtual void setObject( void* obj ); + /// Create the object for the current event + virtual ::Bool_t create(); /// Check if the object was set for the current event - virtual ::Bool_t isSet( ::Bool_t forceSet = kTRUE ) const; + virtual ::Bool_t isSet() const; /// Reset the object at the end of processing of an event virtual void reset(); diff --git a/Control/xAODRootAccess/xAODRootAccess/tools/TObjectManager.h b/Control/xAODRootAccess/xAODRootAccess/tools/TObjectManager.h index a831882d78eb02ceeaf2243eb570adfc31df9b01..c35f2030a1151166a95948464c03dc82fe05ac31 100644 --- a/Control/xAODRootAccess/xAODRootAccess/tools/TObjectManager.h +++ b/Control/xAODRootAccess/xAODRootAccess/tools/TObjectManager.h @@ -1,10 +1,9 @@ // Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ -// $Id: TObjectManager.h 725531 2016-02-22 16:14:25Z krasznaa $ #ifndef XAODROOTACCESS_TOOLS_TOBJECTMANAGER_H #define XAODROOTACCESS_TOOLS_TOBJECTMANAGER_H @@ -27,9 +26,6 @@ namespace xAOD { /// /// @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> /// - /// $Revision: 725531 $ - /// $Date: 2016-02-22 17:14:25 +0100 (Mon, 22 Feb 2016) $ - /// class TObjectManager : public TVirtualManager { public: @@ -61,8 +57,10 @@ namespace xAOD { /// Function replacing the object being handled virtual void setObject( void* obj ); + /// Create the object for the current event + virtual ::Bool_t create(); /// Check if the object was set for the current event - virtual ::Bool_t isSet( ::Bool_t forceSet = kTRUE ) const; + virtual ::Bool_t isSet() const; /// Reset the object at the end of processing of an event virtual void reset(); diff --git a/Control/xAODRootAccess/xAODRootAccess/tools/TPrimitiveAuxBranchManager.h b/Control/xAODRootAccess/xAODRootAccess/tools/TPrimitiveAuxBranchManager.h index 6d16e21e59712d58fb4e0789bbc909d76ab9ff71..9defc1d607c6ec934a5b66ce90a957410b6f3413 100644 --- a/Control/xAODRootAccess/xAODRootAccess/tools/TPrimitiveAuxBranchManager.h +++ b/Control/xAODRootAccess/xAODRootAccess/tools/TPrimitiveAuxBranchManager.h @@ -1,10 +1,9 @@ // Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ -// $Id: TPrimitiveAuxBranchManager.h 595278 2014-05-03 09:31:05Z krasznaa $ #ifndef XAODROOTACCESS_TOOLS_TPRIMITIVEAUXBRANCHMANAGER_H #define XAODROOTACCESS_TOOLS_TPRIMITIVEAUXBRANCHMANAGER_H @@ -33,9 +32,6 @@ namespace xAOD { /// /// @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> /// - /// $Revision: 595278 $ - /// $Date: 2014-05-03 11:31:05 +0200 (Sat, 03 May 2014) $ - /// class TPrimitiveAuxBranchManager : public TVirtualManager { public: @@ -72,8 +68,10 @@ namespace xAOD { /// Function replacing the object being handled virtual void setObject( void* obj ); + /// Create the object for the current event + virtual ::Bool_t create(); /// Check if the object was set for the current event - virtual ::Bool_t isSet( ::Bool_t forceSet = kTRUE ) const; + virtual ::Bool_t isSet() const; /// Reset the object at the end of processing of an event virtual void reset(); @@ -85,12 +83,12 @@ namespace xAOD { /// The last entry that was loaded for this branch ::Long64_t m_entry; /// Was the variable set for the current event? - mutable ::Bool_t m_isSet; + ::Bool_t m_isSet; /// Auxiliary variable type auxid_t m_auxId; /// Dummy auxiliary variable for the empty events - mutable SG::IAuxTypeVector* m_vector; + SG::IAuxTypeVector* m_vector; }; // class TPrimitiveAuxBranchManager diff --git a/Control/xAODRootAccess/xAODRootAccess/tools/TVirtualManager.h b/Control/xAODRootAccess/xAODRootAccess/tools/TVirtualManager.h index f08287890eb4bece527bfd0242a04e523bcdc7f1..3074531c9b403556dbc838e727998f4f0bcf1d7e 100644 --- a/Control/xAODRootAccess/xAODRootAccess/tools/TVirtualManager.h +++ b/Control/xAODRootAccess/xAODRootAccess/tools/TVirtualManager.h @@ -1,10 +1,9 @@ // Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ -// $Id: TVirtualManager.h 595278 2014-05-03 09:31:05Z krasznaa $ #ifndef XAODROOTACCESS_TOOLS_TVIRTUALMANAGER_H #define XAODROOTACCESS_TOOLS_TVIRTUALMANAGER_H @@ -22,9 +21,6 @@ namespace xAOD { /// /// @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> /// - /// $Revision: 595278 $ - /// $Date: 2014-05-03 11:31:05 +0200 (Sat, 03 May 2014) $ - /// class TVirtualManager { public: @@ -39,8 +35,10 @@ namespace xAOD { /// Function replacing the object being handled virtual void setObject( void* obj ) = 0; + /// Create the object for the current event + virtual ::Bool_t create() = 0; /// Check if the object was set for the current event - virtual ::Bool_t isSet( ::Bool_t forceSet = kTRUE ) const = 0; + virtual ::Bool_t isSet() const = 0; /// Reset the object at the end of processing of an event virtual void reset() = 0;