From 682ff951b156eff796e86d798c8a45d9fbacb49e Mon Sep 17 00:00:00 2001 From: sutt <sutt@cern.ch> Date: Mon, 4 Nov 2019 12:42:47 +0100 Subject: [PATCH] Add suggested modifications from Frank Mostly adjustments to comments, but also changing hashid and robid access methods to be const (they should have been in any case, a huge oversight on my part) --- .../IRegionSelector/IRegSelTool.h | 62 +++---------------- .../RegionSelector/src/RegSelTool.cxx | 29 +++------ .../RegionSelector/src/RegSelTool.h | 31 ++++------ 3 files changed, 29 insertions(+), 93 deletions(-) diff --git a/DetectorDescription/IRegionSelector/IRegionSelector/IRegSelTool.h b/DetectorDescription/IRegionSelector/IRegionSelector/IRegSelTool.h index 8267ed9c1a1..984a9dbcb67 100644 --- a/DetectorDescription/IRegionSelector/IRegionSelector/IRegSelTool.h +++ b/DetectorDescription/IRegionSelector/IRegionSelector/IRegSelTool.h @@ -17,11 +17,11 @@ #include "Identifier/IdentifierHash.h" #include <vector> #include <stdint.h> + #include "IRegionSelector/IRoiDescriptor.h" #include "GaudiKernel/IAlgTool.h" -// static const InterfaceID IID_IRegSelTool("IRegSelTool", , ); /** * @class IRegSelTool @@ -33,7 +33,7 @@ class IRegSelTool : virtual public IAlgTool { public: /// InterfaceID - DeclareInterfaceID( IRegSelTool, 1, 0 ); /// ???? + DeclareInterfaceID( IRegSelTool, 1, 0 ); /// IdentifierHash methods @@ -45,7 +45,7 @@ public: \param IRoiDescriptor \c \b roi, the IRoiDescriptor for the roi, all enabled elements in the roi are found. \return std::vector<IdentifierHash> which is a list of non-repeated %Identifier %Hash numbers. */ - virtual void HashIDList( const IRoiDescriptor& roi, std::vector<IdentifierHash>& idlist ) = 0; + virtual void HashIDList( const IRoiDescriptor& roi, std::vector<IdentifierHash>& idlist ) const = 0; //! HashIDList interface declaration. %return list of non-repeated IdentifierHash @@ -54,7 +54,7 @@ public: \param IRoiDescriptor \c \b roi, the IRoiDescriptor for the roi, all enabled elements in the roi are found. \return std::vector<IdentifierHash> which is a list of non-repeated Offline %Identifier %Hash numbers. */ - virtual void HashIDList( long layer, const IRoiDescriptor& roi, std::vector<IdentifierHash>& idlist ) = 0; + virtual void HashIDList( long layer, const IRoiDescriptor& roi, std::vector<IdentifierHash>& idlist ) const = 0; /// Rob identifier methods methods @@ -65,7 +65,7 @@ public: \return std::vector<uint32_t> which is a list of non-repeated ROBID numbers. */ - virtual void ROBIDList( const IRoiDescriptor& roi, std::vector<uint32_t>& roblist ) = 0; + virtual void ROBIDList( const IRoiDescriptor& roi, std::vector<uint32_t>& roblist ) const = 0; //! ROBIDList interface declaration. This interface can be used by the ID subdetectors. %A list of non-repeated ROBIDs (uint_32_t) is returned by a reference. @@ -75,56 +75,8 @@ public: \return std::vector<uint32_t> which is a list of non-repeated ROBID numbers. */ - virtual void ROBIDList( long layer, const IRoiDescriptor& roi, std::vector<uint32_t>& roblist ) = 0; - - - -// since these methods are all protected, they shouldn;t be in the interface, since -// folk will not be able to use them - but will leve them im for the time being -// -// protected: - -// /// Fullscan methods - when not specifying RoI -// /// These are protected, since the roidescriptor now has a Fullscan flag, -// /// so the normal RoI descriptors should be used to flag this, and then -// /// call the full scan methods internally - -// //! HashIDList interface declaration. %return list of non-repeated IdentifierHash -// /*! -// \return std::vector<IdentifierHash> which is a list of non-repeated Offline %Identifier %Hash numbers for the complete subdetector. -// */ -// virtual void HashIDList( std::vector<IdentifierHash>& idlist ) = 0; - - -// //! HashIDList interface declaration. %return list of non-repeated IdentifierHash -// /*! -// \param long \c \b layer, long int to decide which layer within the detector. -// \return std::vector<IdentifierHash> which is a list of non-repeated Offline %Identifier %Hash numbers for the complete subdetector. -// */ -// virtual void HashIDList( long layer, std::vector<IdentifierHash>& idlist ) = 0; - - -// /// Again, fullscan methods that return the list for the entire detector sub component -// /// These are protected, since the RoiDescriptor contains the fullscan flag, and so -// /// a full scan instance is accessed by passing in a fullscan RoiDescriptor and we want -// /// to discourage any other use pattern - -// //! ROBIDList interface declaration. This interface can be used by the ID subdetectors. %A list of non-repeated ROBIDs (uint_32_t) is returned by a reference. -// /*! -// \return std::vector<uint32_t> which is a list of non-repeated ROBID numbers for the complete subdetector. -// */ - -// virtual void ROBIDList( std::vector<uint32_t>& roblist ) = 0; - - -// //! ROBIDList interface declaration. This interface can be used by the ID subdetectors. %A list of non-repeated ROBIDs (uint_32_t) is returned by a reference. -// /*! -// \param long \c \b layer, long int to decide which layer within the detector. -// \return std::vector<uint32_t> which is a list of non-repeated ROBID numbers. -// */ - -// virtual void ROBIDList( long layer, std::vector<uint32_t>& roblist ) = 0; - + virtual void ROBIDList( long layer, const IRoiDescriptor& roi, std::vector<uint32_t>& roblist ) const = 0; + }; diff --git a/DetectorDescription/RegionSelector/src/RegSelTool.cxx b/DetectorDescription/RegionSelector/src/RegSelTool.cxx index 1d2529af906..c86fcd1304d 100644 --- a/DetectorDescription/RegionSelector/src/RegSelTool.cxx +++ b/DetectorDescription/RegionSelector/src/RegSelTool.cxx @@ -18,15 +18,11 @@ #include "GaudiKernel/ToolHandle.h" -// ?? // ??? #include "RegionSelector/StoreGateRS_ClassDEF.h" #include "RegSelLUT/StoreGateIDRS_ClassDEF.h" -//#include <pthread.h> -//static pthread_mutex_t regselsvcmutex = PTHREAD_MUTEX_INITIALIZER; - //! Constructor RegSelTool::RegSelTool( const std::string& type, const std::string& name, const IInterface* parent ) @@ -44,18 +40,13 @@ RegSelTool::~RegSelTool() { } StatusCode RegSelTool::initialize() { - - // ATH_CHECK( AthService::initialize() ); - - ATH_MSG_INFO( "Initializing " << name() << " - package version " << PACKAGE_VERSION ); - + ATH_MSG_INFO( "Initializing " << name() ); return StatusCode::SUCCESS; } StatusCode RegSelTool::finalize() { ATH_MSG_INFO( "Finalizing " << name() ); - // return AthService::finalize(); return StatusCode::SUCCESS; } @@ -68,7 +59,7 @@ bool RegSelTool::handle() { // new RegionSelector interface for the Innner Detector -void RegSelTool::getRoIData( const IRoiDescriptor& roi, std::vector<const RegSelModule*>& modules ) { +void RegSelTool::getRoIData( const IRoiDescriptor& roi, std::vector<const RegSelModule*>& modules ) const { modules.clear(); RegSelRoI roitmp( roi.zedMinus(), roi.zedPlus(), roi.phiMinus(), roi.phiPlus(), roi.etaMinus(), roi.etaPlus() ); if ( m_lookuptable ) m_lookuptable->getRoIData( roitmp, modules ); @@ -83,7 +74,7 @@ void RegSelTool::getRoIData( const IRoiDescriptor& roi, std::vector<const RegSel /// standard roi -void RegSelTool::HashIDList( const IRoiDescriptor& roi, std::vector<IdentifierHash>& idlist ) { +void RegSelTool::HashIDList( const IRoiDescriptor& roi, std::vector<IdentifierHash>& idlist ) const { if ( roi.composite() ) { idlist.clear(); @@ -102,7 +93,7 @@ void RegSelTool::HashIDList( const IRoiDescriptor& roi, std::vector<IdentifierHa /// standard roi for specific layer -void RegSelTool::HashIDList( long layer, const IRoiDescriptor& roi, std::vector<IdentifierHash>& idlist ) { +void RegSelTool::HashIDList( long layer, const IRoiDescriptor& roi, std::vector<IdentifierHash>& idlist ) const { if ( roi.composite() ) { idlist.clear(); @@ -128,7 +119,7 @@ void RegSelTool::HashIDList( long layer, const IRoiDescriptor& roi, std::vector< /// standard roi -void RegSelTool::ROBIDList( const IRoiDescriptor& roi, std::vector<uint32_t>& roblist ) { +void RegSelTool::ROBIDList( const IRoiDescriptor& roi, std::vector<uint32_t>& roblist ) const { if ( roi.composite() ) { roblist.clear(); @@ -145,7 +136,7 @@ void RegSelTool::ROBIDList( const IRoiDescriptor& roi, std::vector<uint32_t>& ro /// standard roi for specific layer -void RegSelTool::ROBIDList( long layer, const IRoiDescriptor& roi, std::vector<uint32_t>& roblist ) { +void RegSelTool::ROBIDList( long layer, const IRoiDescriptor& roi, std::vector<uint32_t>& roblist ) const { if ( roi.composite() ) { roblist.clear(); @@ -168,25 +159,25 @@ void RegSelTool::ROBIDList( long layer, const IRoiDescriptor& roi, std::vector<u /// full scan hashid -void RegSelTool::HashIDList( std::vector<IdentifierHash>& idlist ) { +void RegSelTool::HashIDList( std::vector<IdentifierHash>& idlist ) const { if ( m_lookuptable ) m_lookuptable->getHashList( idlist ); } /// fullscan hashid for specific layer -void RegSelTool::HashIDList( long layer, std::vector<IdentifierHash>& idlist ) { +void RegSelTool::HashIDList( long layer, std::vector<IdentifierHash>& idlist ) const { if ( m_lookuptable ) m_lookuptable->getHashList( layer, idlist ); } /// full scan robid -void RegSelTool::ROBIDList( std::vector<uint32_t>& roblist ) { +void RegSelTool::ROBIDList( std::vector<uint32_t>& roblist ) const { if ( m_lookuptable ) m_lookuptable->getRobList( roblist ); } /// fullscan robid for specific layer -void RegSelTool::ROBIDList( long layer, std::vector<uint32_t>& roblist ) { +void RegSelTool::ROBIDList( long layer, std::vector<uint32_t>& roblist ) const { if ( m_lookuptable ) m_lookuptable->getRobList( layer, roblist ); } diff --git a/DetectorDescription/RegionSelector/src/RegSelTool.h b/DetectorDescription/RegionSelector/src/RegSelTool.h index 9e1040c22d3..7241112e183 100644 --- a/DetectorDescription/RegionSelector/src/RegSelTool.h +++ b/DetectorDescription/RegionSelector/src/RegSelTool.h @@ -38,66 +38,59 @@ class RegSelTool : public extends<AthAlgTool, IRegSelTool> { public: - /** @c Standard constructor for tool ???. + /** @c Standard constructor for tool (obviously). */ RegSelTool( const std::string& type, const std::string& name, const IInterface* parent ); //! Destructor. virtual ~RegSelTool() override; - /** @c queryInterface only needed for Gaudi services ???? - */ - // virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvIF); // ??? - //! @method initialize, loads lookup tables for retrieve %Identifier %Hash and ROBID - StatusCode initialize() override; + virtual StatusCode initialize() override; //! @method finalize, deletes lookup table from memory - StatusCode finalize() override; + virtual StatusCode finalize() override; //! @method handle, handles the actual lookup table bool handle(); - //! @method reinitialise, reinitialise everything if needed - bool reinitialise(); - /// IRegSlTool interface ... // Interface inherited from IRegSelTool service - void HashIDList( const IRoiDescriptor& roi, std::vector<IdentifierHash>& idlist ); + void HashIDList( const IRoiDescriptor& roi, std::vector<IdentifierHash>& idlist ) const; - void HashIDList( long layer, const IRoiDescriptor& roi, std::vector<IdentifierHash>& idlist); + void HashIDList( long layer, const IRoiDescriptor& roi, std::vector<IdentifierHash>& idlist) const; - void ROBIDList( const IRoiDescriptor& roi, std::vector<uint32_t>& roblist ); + void ROBIDList( const IRoiDescriptor& roi, std::vector<uint32_t>& roblist ) const; - void ROBIDList( long layer, const IRoiDescriptor& roi, std::vector<uint32_t>& roblist ); + void ROBIDList( long layer, const IRoiDescriptor& roi, std::vector<uint32_t>& roblist ) const; protected: // full scan - void HashIDList( std::vector<IdentifierHash>& idlist ); + void HashIDList( std::vector<IdentifierHash>& idlist ) const; // full scan for a specific layer - void HashIDList( long layer, std::vector<IdentifierHash>& idlist ); + void HashIDList( long layer, std::vector<IdentifierHash>& idlist ) const; // Methods to obtain the rob id list // full scan - void ROBIDList( std::vector<uint32_t>& roblist ); + void ROBIDList( std::vector<uint32_t>& roblist ) const; // full scan by layer - void ROBIDList( long layer, std::vector<uint32_t>& roblist ); + void ROBIDList( long layer, std::vector<uint32_t>& roblist ) const; // get list of modules - void getRoIData( const IRoiDescriptor& roi, std::vector<const RegSelModule*>& modulelist ); + void getRoIData( const IRoiDescriptor& roi, std::vector<const RegSelModule*>& modulelist ) const; private: -- GitLab