diff --git a/HLT/Trigger/TrigControl/TrigServices/TrigServices/TrigISHelper.h b/HLT/Trigger/TrigControl/TrigServices/TrigServices/TrigISHelper.h deleted file mode 100644 index 2ea5990bc6d35ba5559f63788364da159926cf10..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigControl/TrigServices/TrigServices/TrigISHelper.h +++ /dev/null @@ -1,209 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TRIGSERVICES_TRIGISHELPER_H -#define TRIGSERVICES_TRIGISHELPER_H - -/** - * @file TrigISHelper.h - * @brief Helper tool for IS access - * @author Frank Winklmeier, Werner Wiedenmann - * - * $Id: TrigISHelper.h 5 2013-05-14 10:33:04Z ricab $ - */ - -// STL includes -#include <string> -#include <vector> -#include <map> -#include <utility> - -// Framework includes -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/StatusCode.h" - -// To avoid compiler warnings about redefinition through omni includes -#undef PACKAGE_VERSION -// TDAQ includes -#include "is/info.h" -#include "is/infodictionary.h" -#include "is/infodynany.h" -#include "ipc/partition.h" - - -/** - * @brief Helper tool for IS access - * - * This tool wraps some of the IS methods. Mainly to allow for configurable - * partition and IS names. Use the properties (e.g. RunParams) to specify - * them: - * - * Example: TrigISHelper.MyISInfo = initial/MyISServer.ISInfoName - * - * This will read the IS value from partition initial. If no partition is - * explicitly specified use the value of the PartitionName property. - */ -class TrigISHelper : public AthAlgTool { - -public: - /// Aliases for IS objects this tool can read - enum ISObject { - RunParams, - LumiBlock, - SolenoidCurrent, - ToroidCurrent - }; - -public: - - TrigISHelper(const std::string &type, const std::string &name, const IInterface *parent); - virtual ~TrigISHelper(); - - static const InterfaceID& interfaceID(); - virtual StatusCode initialize(); - - /** - * @brief Wrapper for ISInfoDictionary::findValue - * - * Main difference to the IS method is that it returns immediatelly - * if running without a partition. - * - * @param name Name of IS value - * @param value Filled with IS value - * - * @return SUCCESS Value retrieved or running without partition - * FAILURE Could not retrieve value from IS - */ - StatusCode findValue(ISObject obj, ISInfo& value); - - /** - * @brief Get attributes of a given type for IS objects - * - * This method retrieves all attributes of type T from the - * given IS object. This can be used in case there is no IS type - * definition available. - * - * @param name Name of IS value - * @param values Vector to be filled with attributes of type T - * - * @return SUCCESS Value retrieved or running without partition - * FAILURE Could not retrieve value from IS - */ - template <class T> - StatusCode getAttributes(ISObject obj, std::vector<T>& values); - - /** - * @brief Read attribute of an ISNamedInfo object - * - * T is the type of the ISNamedInfo object, R the value type and - * G is a function object that reads the attribute of T. - * - * @param name Name of IS value - * @param value Filled with value of attribute - * @param getter Functor of type 'void (const T& t, R& r)' that fills r - * with the value of an attribute of t. - * - * @return SUCCESS Value retrieved or running without partition - * FAILURE Could not retrieve value from IS - */ - template <class T, class R, class G> - StatusCode findValue(ISObject obj, R& value, G getter); - - /* - * Check if partition for ISObject obj is valid (!= 'none') - */ - bool validPartition(ISObject obj); - - const std::string& partition(ISObject obj) const; - const std::string& isName(ISObject obj) const; - -private: - // Properties - StringProperty m_partitionName; ///< Default partition name - bool m_ignoreIfMissing; - std::map<ISObject, std::string> m_isprop; ///< Names of IS objects - - /// Property handler - void initPartitionName(Property& prop); - - /// Map ISObject -> (partition, IS name) - typedef std::map<ISObject, std::pair<std::string, std::string> > ISObjectMap_t; - ISObjectMap_t m_isid; ///< partition and IS name for each ISObject - - /// Return (partition, IS) name pair from isid property - std::pair<std::string,std::string> split(const std::string& isid); -}; - - -//-------------------------------------------------------------------------------- -// Inline -//-------------------------------------------------------------------------------- -inline bool TrigISHelper::validPartition(ISObject obj) -{ - const std::string& name = m_isid[obj].first; - return (name!="None" && name!="NONE"); -} - - -inline const InterfaceID& TrigISHelper::interfaceID() -{ - static const InterfaceID IID("TrigISHelper", 1, 0); - return IID; -} - -//-------------------------------------------------------------------------------- -// Templates -//-------------------------------------------------------------------------------- -template <class T, class R, class G> -StatusCode TrigISHelper::findValue(ISObject obj, R& value, G getter) -{ - const std::string& partName = m_isid[obj].first; - const std::string& isName = m_isid[obj].second; - - try { - IPCPartition part(partName); - T namedInfo(part, isName); - namedInfo.checkout(); - getter(namedInfo, value); // set 'value' - } - catch (daq::is::Exception& e) { - ATH_MSG_WARNING("IS Exception reading " << isName << " from partition " - << partName << ". Exception was: " << e.what()); - - return m_ignoreIfMissing ? StatusCode::SUCCESS : StatusCode::FAILURE; - } - - ATH_MSG_DEBUG("Successfully read " << isName << " from IS: " << value); - return StatusCode::SUCCESS; -} - - -template <class T> -StatusCode TrigISHelper::getAttributes(ISObject obj, std::vector<T>& values) -{ - const std::string& partName = m_isid[obj].first; - const std::string& isName = m_isid[obj].second; - - ISInfoDynAny ida; - try { - IPCPartition part(partName); - ISInfoDictionary isInfoDict(part); - isInfoDict.findValue(isName, ida); - } - catch (daq::is::Exception& e) { - ATH_MSG_WARNING("IS Exception reading " << isName << " from partition " - << partName << ". Exception was: " << e.what()); - - return m_ignoreIfMissing ? StatusCode::SUCCESS : StatusCode::FAILURE; - } - - for (size_t i=0; i<ida.getAttributesNumber(); ++i) { - if ( is::type2id<T>::id == ida.getAttributeType(i) ) { - values.push_back(ida.getAttributeValue<T>(i)); - } - } - return StatusCode::SUCCESS; -} - -#endif diff --git a/HLT/Trigger/TrigControl/TrigServices/python/TriggerUnixStandardSetup.py b/HLT/Trigger/TrigControl/TrigServices/python/TriggerUnixStandardSetup.py index 9829367063c546023f1863e763f2db0c29390c08..b491fd18f40a7b2f47d4dec74333e72971c5ba83 100644 --- a/HLT/Trigger/TrigControl/TrigServices/python/TriggerUnixStandardSetup.py +++ b/HLT/Trigger/TrigControl/TrigServices/python/TriggerUnixStandardSetup.py @@ -77,10 +77,6 @@ def _setupCommonServices(): # Configuration of Interval of Validity Service svcMgr += CfgMgr.IOVSvc() - # Configure TrigISHelper - from TrigServices.TrigServicesConf import TrigISHelper - ToolSvc += TrigISHelper("TrigISHelper") - # Configure CoreDumpSvc if not hasattr(svcMgr,"CoreDumpSvc"): from AthenaServices.Configurables import CoreDumpSvc diff --git a/HLT/Trigger/TrigControl/TrigServices/src/TrigISHelper.cxx b/HLT/Trigger/TrigControl/TrigServices/src/TrigISHelper.cxx deleted file mode 100644 index 0989cadcfa6d73cfe8b5a9ce860c5d9d2dbbee5b..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigControl/TrigServices/src/TrigISHelper.cxx +++ /dev/null @@ -1,136 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/** - * @file TrigISHelper.cxx - * @brief Helper tool for IS access - * @author Frank Winklmeier, Werner Wiedenmann - * - * $Id: TrigISHelper.cxx 5 2013-05-14 10:33:04Z ricab $ - */ - -#include "TrigServices/TrigISHelper.h" - - -using namespace std; - -//========================================================================= -// Standard methods -//========================================================================= -TrigISHelper::TrigISHelper(const std::string &type, - const std::string &name, - const IInterface *parent) - : AthAlgTool(type, name, parent) -{ - // No abstract interface due to templates - declareInterface<TrigISHelper>(this); - - declareProperty("PartitionName", m_partitionName = "NONE", - "Default partition name if not explicitly specified in IS identifier properties"); - m_partitionName.declareUpdateHandler(&TrigISHelper::initPartitionName, this); - - declareProperty("ignoreIfMissing", m_ignoreIfMissing = false, - "Return SUCCESS if IS object is missing (for testing only)"); - - const string& help = "IS identifier: [Partition/]ISServer.ISInfoName"; - - declareProperty("RunParams", - m_isprop[RunParams] = "RunParams.RunParams", - help); - - declareProperty("LumiBlock", - m_isprop[LumiBlock] = "RunParams.LumiBlock", - help); - - declareProperty("SolenoidCurrent", - m_isprop[SolenoidCurrent] = "initial/DCS_GENERAL.MagnetSolenoidCurrent.value", - help); - - declareProperty("ToroidCurrent", - m_isprop[ToroidCurrent] = "initial/DCS_GENERAL.MagnetToroidsCurrent.value", - help); -} - - -TrigISHelper::~TrigISHelper() -{} - - -StatusCode TrigISHelper::initialize() -{ - if (m_ignoreIfMissing ) { - ATH_MSG_WARNING("Will ignore any missing IS objects and return SUCCESS"); - } - - return StatusCode::SUCCESS; -} - - - -void TrigISHelper::initPartitionName(Property& /*prop*/) -{ - m_isid.clear(); - - ATH_MSG_DEBUG("Configured ISInfo objects (partition : name):"); - - // Fill map with partition and IS names - map<ISObject, string>::const_iterator iter = m_isprop.begin(); - for (; iter != m_isprop.end(); ++iter ) { - m_isid[iter->first] = split(iter->second); - - ATH_MSG_DEBUG(" " << m_isid[iter->first].first - << " : " << m_isid[iter->first].second); - } -} - -//========================================================================= -// Read IS value -//========================================================================= -StatusCode TrigISHelper::findValue(ISObject obj, ISInfo& value) -{ - const string& partName = m_isid[obj].first; - const string& isName = m_isid[obj].second; - - // read values from IS - try { - IPCPartition part(partName); - ISInfoDictionary isInfoDict(part); - isInfoDict.findValue(isName, value); - } - catch (daq::is::Exception& e) { - ATH_MSG_WARNING("IS Exception reading " << isName << " from partition " - << partName << ". Exception was: " << e); - - return m_ignoreIfMissing ? StatusCode::SUCCESS : StatusCode::FAILURE; - } - - ATH_MSG_DEBUG("Successfully read " << isName << " from IS: " << value); - - return StatusCode::SUCCESS; -} - - -const std::string& TrigISHelper::partition(ISObject obj) const -{ - return m_isid.find(obj)->second.first; -} - - -const std::string& TrigISHelper::isName(ISObject obj) const -{ - return m_isid.find(obj)->second.second; -} - - - -//========================================================================= -// Helper to split ISObject property string -//========================================================================= -pair<string,string> TrigISHelper::split(const std::string& isid) -{ - size_t i = isid.find("/"); - if (i==string::npos) return make_pair(m_partitionName.value(), isid); - - return make_pair(isid.substr(0, i), isid.substr(i+1, isid.length()-i)); -} diff --git a/HLT/Trigger/TrigControl/TrigServices/src/components/TrigServices_entries.cxx b/HLT/Trigger/TrigControl/TrigServices/src/components/TrigServices_entries.cxx index 221ac565dcb49ff5fd414c3b687e7770a0ff5e78..aaedffec5f8bd73e638346e493c55e40c03364dc 100644 --- a/HLT/Trigger/TrigControl/TrigServices/src/components/TrigServices_entries.cxx +++ b/HLT/Trigger/TrigControl/TrigServices/src/components/TrigServices_entries.cxx @@ -2,13 +2,11 @@ #include "../TrigMonTHistSvc.h" #include "TrigServices/HltEventLoopMgr.h" #include "TrigServices/HltROBDataProviderSvc.h" -#include "TrigServices/TrigISHelper.h" #include "../TrigCOOLUpdateHelper.h" DECLARE_COMPONENT( TrigMessageSvc ) DECLARE_COMPONENT( TrigMonTHistSvc ) DECLARE_COMPONENT( HltEventLoopMgr ) DECLARE_COMPONENT( HltROBDataProviderSvc ) -DECLARE_COMPONENT( TrigISHelper ) DECLARE_COMPONENT( TrigCOOLUpdateHelper ) DECLARE_COMPONENT( THistSvcHLT )