diff --git a/TileCalorimeter/TileConditions/TileConditions/ITileCondProxy.h b/TileCalorimeter/TileConditions/TileConditions/ITileCondProxy.h index 6929b4ef621baefca1491dbdaf4564a651cdd8a1..1cc8437ae197de2757f8143108a8c4357c86486f 100644 --- a/TileCalorimeter/TileConditions/TileConditions/ITileCondProxy.h +++ b/TileCalorimeter/TileConditions/TileConditions/ITileCondProxy.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration */ #ifndef TILECONDITIONS_ITILECONDPROXY_H @@ -26,8 +26,6 @@ class ITileCondProxy : virtual public IAlgTool { return IID_ITileCondProxy; } - virtual const T* getCalibDrawer(unsigned int drawerIdx) const = 0; - /** * @brief Fill TileCalibData with Tile conditions data from source (file, DB) * @param[out] calibData TileCalibData to fill with Tile conditions data diff --git a/TileCalorimeter/TileConditions/TileConditions/TileBadChanLegacyTool.h b/TileCalorimeter/TileConditions/TileConditions/TileBadChanLegacyTool.h deleted file mode 100644 index ef68d379dc626cbbd4899585a54fe2b5a496758d..0000000000000000000000000000000000000000 --- a/TileCalorimeter/TileConditions/TileConditions/TileBadChanLegacyTool.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TILECONDITIONS_TILEBADCHANLEGACYTOOL_H -#define TILECONDITIONS_TILEBADCHANLEGACYTOOL_H - -// Gaudi includes -#include "GaudiKernel/ToolHandle.h" - -// Athena includes -#include "AthenaBaseComps/AthAlgTool.h" -#include "AthenaKernel/IOVSvcDefs.h" -#include "Identifier/HWIdentifier.h" -#include "Identifier/IdentifierHash.h" - -// Calo includes -#include "CaloConditions/ICaloBadChanTool.h" -#include "CaloConditions/CaloBadChannel.h" - -// Tile includes -#include "TileConditions/ITileBadChanTool.h" -#include "TileConditions/ITileCondProxy.h" -#include "TileConditions/TileCondIdTransforms.h" -#include "TileCalibBlobObjs/TileBchStatus.h" -#include "TileCalibBlobObjs/TileCalibUtils.h" - -#include <map> -#include <vector> -#include <string> - -class TileHWID; -class TileDetDescrManager; -class IdContext; -class TileBchDecoder; -class TileCalibDrawerBch; - -class TileBadChanLegacyTool: public AthAlgTool - , virtual public ITileBadChanTool - , virtual public ICaloBadChanTool { - public: - - TileBadChanLegacyTool(const std::string& type, const std::string& name, const IInterface* parent); - virtual ~TileBadChanLegacyTool(); - - StatusCode initialize(); - StatusCode finalize(); - static const InterfaceID& interfaceID(); - - //=============================================================== - //=== ICaloBadChanTool methods - //=============================================================== - - /** @brief ICaloBadChanTool interface. - @param id Calo cell identifier */ - CaloBadChannel caloStatus(Identifier id) const; - - //=============================================================== - //=== ITileBadChanTool methods - //=============================================================== - const TileBchStatus& getAdcStatus(const HWIdentifier& adc_id) const; - const TileBchStatus& getAdcStatus(IdentifierHash hash_id, unsigned int adc) const; - const TileBchStatus& getAdcStatus(unsigned int drawerIdx - , unsigned int channel - , unsigned int adc) const; - - const TileBchStatus& getChannelStatus(IdentifierHash hash_id) const; - const TileBchStatus& getChannelStatus(const HWIdentifier& channel_id) const; - const TileBchStatus& getChannelStatus(unsigned int drawerIdx, unsigned int channel) const; - - uint32_t encodeStatus(const TileBchStatus& status) const; - - const std::vector<float>& getTripsProbabilities(unsigned int ros) const { return m_tripsProbs[ros - 1]; }; - - private: - StatusCode recache(IOVSVC_CALLBACK_ARGS); - - const TileDetDescrManager* m_tileMgr; - const IdContext* m_channel_context; - ToolHandle<TileCondIdTransforms> m_tileIdTrans; - - ToolHandle<ITileCondProxy<TileCalibDrawerBch> > m_pryOnlBch; - ToolHandle<ITileCondProxy<TileCalibDrawerBch> > m_pryOflBch; - - std::vector<const TileBchDecoder*> m_tileBchDecoder; - std::map<HWIdentifier, TileBchStatus> m_statusMapAdc; - std::map<HWIdentifier, TileBchStatus> m_statusMapChn; - - TileBchStatus m_defaultStatus; - - // dummy declarations just to make new gccreflex happy - TileBadChanLegacyTool& operator=(const TileBadChanLegacyTool&); - - std::vector<std::vector<float> > m_tripsProbs; - bool m_useOflBch; - - const TileHWID* m_tileHWID; - std::vector<unsigned int> m_roses; - std::vector<unsigned int> m_drawers; -}; - - -#endif diff --git a/TileCalorimeter/TileConditions/TileConditions/TileCondProxyCool.h b/TileCalorimeter/TileConditions/TileConditions/TileCondProxyCool.h index 0a80cc53b24f5e0f6f9d506421cd95d3a88fed0f..b38182a23838f801a7226ed287986f7e8b7968b7 100644 --- a/TileCalorimeter/TileConditions/TileConditions/TileCondProxyCool.h +++ b/TileCalorimeter/TileConditions/TileConditions/TileCondProxyCool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration */ #ifndef TILECONDITIONS_TILECONDPROXYCOOL_H @@ -9,19 +9,12 @@ #include "TileConditions/ITileCondProxy.h" #include "TileConditions/Exception.h" - // Athena includes #include "AthenaBaseComps/AthAlgTool.h" -#include "AthenaKernel/IOVSvcDefs.h" -#include "StoreGate/DataHandle.h" - #include "StoreGate/ReadCondHandleKey.h" #include "AthenaPoolUtilities/CondAttrListCollection.h" - #include <string> -#include <vector> - /** * @class TileCondProxyCool @@ -43,20 +36,9 @@ class TileCondProxyCool: public AthAlgTool, virtual public ITileCondProxy<T> { * @param[out] eventRange EventIDRange during wich Tile conditions data are valid */ virtual StatusCode fillCalibData(TileCalibData<T>& calibData, EventIDRange& eventRange) const override; - virtual const T* getCalibDrawer(unsigned int drawerIdx) const override; - - /** @brief Callback function, called if folder changed IOV */ - StatusCode callback( IOVSVC_CALLBACK_ARGS); private: - /** CalibDrawer vector to keep updated */ - std::unique_ptr<TileCalibData<T>> m_calibData; - - /** Data handle */ - const DataHandle<CondAttrListCollection> m_dataHandle; - - SG::ReadCondHandleKey<CondAttrListCollection> m_sourceKey{this, "Source", "", "The COOL folder name"}; }; diff --git a/TileCalorimeter/TileConditions/TileConditions/TileCondProxyFile.h b/TileCalorimeter/TileConditions/TileConditions/TileCondProxyFile.h index 0b1526ae3e526224a8ed5ffd0e55f0b92bd017d8..d3b6c67696d03d8e44a363e7e6035e52e2d4addd 100644 --- a/TileCalorimeter/TileConditions/TileConditions/TileCondProxyFile.h +++ b/TileCalorimeter/TileConditions/TileConditions/TileCondProxyFile.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration */ #ifndef TILECONDITIONS_TILECONDPROXYFILE_H @@ -40,7 +40,6 @@ class TileCondProxyFile: public AthAlgTool, virtual public ITileCondProxy<T> { * @param[out] eventRange EventIDRange during wich Tile conditions data are valid */ virtual StatusCode fillCalibData(TileCalibData<T>& calibData, EventIDRange& eventRange) const override; - virtual const T* getCalibDrawer(unsigned int drawerIdx) const override; private: @@ -54,9 +53,6 @@ class TileCondProxyFile: public AthAlgTool, virtual public ITileCondProxy<T> { /** Source = COOL folder */ std::string m_source; - /** CalibDrawer vector to keep updated */ - std::unique_ptr<TileCalibData<T>> m_calibData; - }; #endif // TILECONDITIONS_TILECONDPROXYFILE_H diff --git a/TileCalorimeter/TileConditions/python/TileCondToolConf.py b/TileCalorimeter/TileConditions/python/TileCondToolConf.py index e12e809fa7cea9a422340cdb54292ca7bb69b6cb..326edff521265d1179d3e58621f3f8deaa67004a 100644 --- a/TileCalorimeter/TileConditions/python/TileCondToolConf.py +++ b/TileCalorimeter/TileConditions/python/TileCondToolConf.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration #file: TileCondToolConf.py #author: nils.gollub@cern.ch @@ -476,44 +476,6 @@ def getTileBadChanTool(source = 'FILE', name = 'TileBadChanTool', **kwargs): setattr(tool, n, v) return tool - -# -#____________________________________________________________________________ -def getTileBadChanLegacyTool(source = 'FILE', name = 'TileBadChanLegacyTool', **kwargs): - - if not source in validSources: raise(Exception("Invalid source: %s"%source)) - from TileConditions.TileConditionsConf import TileBadChanLegacyTool - - #do some check for global flag here: if source='' and flag set, adopt flag - - tool = None - if source=='COOL': - #==================================================== - #=== Connect COOL TileCondProxies to the tool - #==================================================== - if isOnline and isUsedDataBaseRun2: oflBchProxy = None - else: oflBchProxy = getTileCondProxy('COOL','Bch','oflStatAdc','TileCondProxyCool_OflBch') - - tool = TileBadChanLegacyTool(name - , ProxyOnlBch = getTileCondProxy('COOL','Bch','onlStatAdc','TileCondProxyCool_OnlBch') - , ProxyOflBch = oflBchProxy) - - - else: - #======================================================== - #=== Connect FILE TileCondProxies to the tool (default) - #======================================================== - tool = TileBadChanLegacyTool(name - , ProxyOnlBch = getTileCondProxy('FILE','Bch','TileDefault.onlBch','TileCondProxyFile_OnlBch') - , ProxyOflBch = getTileCondProxy('FILE','Bch','TileDefault.oflBch','TileCondProxyFile_OflBch')) - - - #=== set the arguments passed and return tool - for n,v in kwargs.items(): - setattr(tool, n, v) - - return tool - # #____________________________________________________________________________ def getTileCondToolNoiseSample(source = 'FILE', name = 'TileCondToolNoiseSample', **kwargs): diff --git a/TileCalorimeter/TileConditions/python/TileConditionsConfig.py b/TileCalorimeter/TileConditions/python/TileConditionsConfig.py index 5827bd78724277b019a5266547e9b20b2d4320a3..ea9bb98111716d3d11a2fb86953db7c3dc973aad 100644 --- a/TileCalorimeter/TileConditions/python/TileConditionsConfig.py +++ b/TileCalorimeter/TileConditions/python/TileConditionsConfig.py @@ -98,15 +98,6 @@ def tileCondCfg( flags ): badChanTool = TileBadChanTool(name = 'TileBadChanTool', TileBadChannels = badChannels) acc.addPublicTool( badChanTool ) - from TileConditions.TileConditionsConf import TileBadChanLegacyTool - from AthenaCommon.Constants import DEBUG - badChanLegacyTool = TileBadChanLegacyTool( 'TileBadChanLegacyTool' ) - badChanLegacyTool.ProxyOflBch = TileCondProxyCoolBch('TileCondProxyCool_OflBchLegacy', Source = '/TILE/OFL02/STATUS/ADC' ) - badChanLegacyTool.ProxyOnlBch = TileCondProxyCoolBch('TileCondProxyCool_OnlBchLegacy', Source = '/TILE/ONL01/STATUS/ADC', OutputLevel=DEBUG ) - acc.addPublicTool( badChanLegacyTool ) - - - acc.merge( addFolders(flags, ['/LAR/BadChannelsOfl/BadChannels <key>/LAR/BadChannels/BadChannels</key>', '/LAR/BadChannelsOfl/MissingFEBs<key>/LAR/BadChannels/MissingFEBs</key>'], 'LAR_OFL')) diff --git a/TileCalorimeter/TileConditions/python/TileInfoConfigurator.py b/TileCalorimeter/TileConditions/python/TileInfoConfigurator.py index 884160686ac1affb7a97e7d7f99cd6e394d7f497..499fb26ba9e9955e5250a5d87bdac11d8374503b 100644 --- a/TileCalorimeter/TileConditions/python/TileInfoConfigurator.py +++ b/TileCalorimeter/TileConditions/python/TileInfoConfigurator.py @@ -84,10 +84,6 @@ class _TileInfoConfigurator( TileInfoLoader ): from .TileCondToolConf import getTileBadChanTool ToolSvc += getTileBadChanTool('COOL') - self._msg.info("Changing default TileBadChanLegacyTool configuration to COOL source") - from .TileCondToolConf import getTileBadChanLegacyTool - ToolSvc += getTileBadChanLegacyTool('COOL') - self._msg.info("Changing default TileCondToolEmscale configuration to COOL source") from .TileCondToolConf import getTileCondToolEmscale ToolSvc += getTileCondToolEmscale('COOL') diff --git a/TileCalorimeter/TileConditions/src/TileBadChanLegacyTool.cxx b/TileCalorimeter/TileConditions/src/TileBadChanLegacyTool.cxx deleted file mode 100644 index e765f7b18d2b1a5743f003391e8fe73f44cbcb80..0000000000000000000000000000000000000000 --- a/TileCalorimeter/TileConditions/src/TileBadChanLegacyTool.cxx +++ /dev/null @@ -1,449 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// Tile includes -#include "TileConditions/TileBadChanLegacyTool.h" -#include "TileConditions/TileCondProxyWrapper.h" -#include "TileCalibBlobObjs/TileCalibDrawerBch.h" -#include "TileCalibBlobObjs/TileBchDecoder.h" -#include "TileCalibBlobObjs/TileBchPrbs.h" -#include "TileIdentifier/TileHWID.h" -#include "TileDetDescr/TileDetDescrManager.h" - -// Calo includes -#include "CaloDetDescr/CaloDetDescrElement.h" - -// Athena incldues -#include "Identifier/IdContext.h" -#include "StoreGate/StoreGateSvc.h" -#include "AthenaKernel/errorcheck.h" - -// Gaudi includes -#include "GaudiKernel/ServiceHandle.h" - -#include <string> - -// -//____________________________________________________________________ -const InterfaceID& -TileBadChanLegacyTool::interfaceID() { - return ITileBadChanTool::interfaceID(); -} - -// -//____________________________________________________________________ -TileBadChanLegacyTool::TileBadChanLegacyTool(const std::string& type, const std::string& name, const IInterface* parent) - : AthAlgTool(type, name, parent) - , m_tileMgr(0) - , m_channel_context(0) - , m_tileIdTrans("TileCondIdTransforms") - , m_pryOnlBch("TileCondProxyFile_TileCalibDrawerBch_/TileCondProxyDefault_onlBch", this) - , m_pryOflBch("TileCondProxyFile_TileCalibDrawerBch_/TileCondProxyDefault_oflBch", this) - , m_defaultStatus(TileBchStatus()) - , m_tripsProbs(TileCalibUtils::MAX_ROS - 1, std::vector<float>(TileCalibUtils::MAX_DRAWER, 0)) - , m_useOflBch(true) - , m_tileHWID(nullptr) -{ - declareInterface<ITileBadChanTool>(this); - declareInterface<TileBadChanLegacyTool>(this); - declareInterface<ICaloBadChanTool>(this); - declareProperty("ProxyOnlBch", m_pryOnlBch); - declareProperty("ProxyOflBch", m_pryOflBch); - -} - -// -//____________________________________________________________________ -TileBadChanLegacyTool::~TileBadChanLegacyTool() { - for (std::vector<const TileBchDecoder*>::iterator i = m_tileBchDecoder.begin(); - i != m_tileBchDecoder.end(); ++i) { - delete *i; - } -} - - -// -//____________________________________________________________________ -StatusCode TileBadChanLegacyTool::initialize() { - ATH_MSG_DEBUG( "in initialize()" ); - - //=== TileDetDescrManager - CHECK( detStore()->retrieve(m_tileMgr) ); - - //=== initialize bit pattern decoders for all possible versions - m_tileBchDecoder.resize(TileBchDecoder::MaxVersion); - for (unsigned int i = 0; i < TileBchDecoder::MaxVersion; ++i) { - ATH_MSG_DEBUG( "Creating TileBchDecoder(" << i << ")" ); - m_tileBchDecoder[i] = new TileBchDecoder(static_cast<TileBchDecoder::BitPatVer>(i)); - } - - //=== TileCondIdTransforms - CHECK( m_tileIdTrans.retrieve() ); - - //=== initialize channel context - m_channel_context = new IdContext(m_tileIdTrans->getTileHWID()->channel_context()); - - //=== retrieve online proxy - CHECK( m_pryOnlBch.retrieve() ); - - m_useOflBch = !(m_pryOflBch.empty()); - if (m_useOflBch) { - //=== retrieve offline proxy - CHECK( m_pryOflBch.retrieve() ); - ATH_MSG_INFO("ProxyOnlBch and ProxyOflBch will be used for bad channel status"); - } else { - ATH_MSG_INFO("Only ProxyOnlBch will be used for bad channel status"); - } - - //=== recache function needs to be bound to IOV updates only for COOL proxies - const TileCondProxyCoolBch* ptrPryOnlBch = dynamic_cast<const TileCondProxyCoolBch*>(&(*m_pryOnlBch)); - const TileCondProxyCoolBch* ptrPryOflBch(0); - if (m_useOflBch) { - ptrPryOflBch = dynamic_cast<const TileCondProxyCoolBch*>(&(*m_pryOflBch)); - } - - //=== call recache if both proxies are FILE proxies - if (!ptrPryOnlBch && !ptrPryOflBch) { - int idx = 0; - std::list<std::string> keys; - keys.push_back("ASCII files"); - CHECK( recache(idx, keys) ); - } - - //=== if at least one COOL proxy is loaded, then the linked callback will take care of recaching - else { - if (ptrPryOnlBch) { - CHECK( detStore()->regFcn(&TileCondProxyCoolBch::callback - , ptrPryOnlBch - , &TileBadChanLegacyTool::recache - , this, true) ); - - } - - if (m_useOflBch && ptrPryOflBch) { - CHECK( detStore()->regFcn(&TileCondProxyCoolBch::callback - , ptrPryOflBch - , &TileBadChanLegacyTool::recache - , this, true) ); - } - } - - - m_roses.resize(TileCalibUtils::MAX_DRAWERIDX); - m_drawers.resize(TileCalibUtils::MAX_DRAWERIDX); - - for (unsigned int ros = 0; ros < TileCalibUtils::MAX_ROS; ++ros) { - for (unsigned int drawer = 0; drawer < TileCalibUtils::getMaxDrawer(ros); ++drawer) { - unsigned int drawerIdx = TileCalibUtils::getDrawerIdx(ros, drawer); - m_roses[drawerIdx] = ros; - m_drawers[drawerIdx] = drawer; - } - } - - - return StatusCode::SUCCESS; -} - -// -//____________________________________________________________________ -StatusCode TileBadChanLegacyTool::finalize() { - ATH_MSG_DEBUG( "finalize called" ); - - if (m_channel_context) delete m_channel_context; - m_channel_context = 0; - - return StatusCode::SUCCESS; -} - -// -//____________________________________________________________________ -StatusCode TileBadChanLegacyTool::recache(IOVSVC_CALLBACK_ARGS_K(keys)) { - msg(MSG::INFO) << "TileBadChanLegacyTool::recache() has been triggered by: "; - std::list<std::string>::const_iterator itr; - for (itr = keys.begin(); itr != keys.end(); ++itr) { - msg(MSG::INFO) << "\'" << *itr << "' "; - } - msg(MSG::INFO) << endmsg; - - //=== clear old hash maps - m_statusMapAdc.clear(); - m_statusMapChn.clear(); - - try { - - //=== loop over the whole detector, hash affected ADCs - uint32_t adcBits(0), channelBits(0); - - m_tileHWID = m_tileIdTrans->getTileHWID(); - - IdContext adcContext = m_tileHWID->adc_context(); - unsigned int maxAdcHash = m_tileHWID->adc_hash_max(); - - unsigned int drawerIdx(0); - unsigned int channel(0); - unsigned int adc(0); - - for (IdentifierHash adcHash = 0; adcHash < maxAdcHash; adcHash += 1) { - HWIdentifier adcId; - if (m_tileHWID->get_id(adcHash, adcId, &adcContext) == 0) { - // ATH_MSG_ALWAYS(m_tileHWID->to_string(adcId)); - if (m_tileHWID->ros(adcId) == 0) continue; - - m_tileIdTrans->getIndices(adcId, drawerIdx, channel, adc); - - //=== online status ... - const TileCalibDrawerBch* calibDrawer = m_pryOnlBch->getCalibDrawer(drawerIdx); - TileBchDecoder::BitPatVer bitPatVer = calibDrawer->getBitPatternVersion(); - calibDrawer->getStatusWords(channel, adc, adcBits, channelBits); - TileBchStatus adcStatus(m_tileBchDecoder[bitPatVer]->decode(channelBits, adcBits)); - - if (m_useOflBch) { - //=== ... add offline status - calibDrawer = m_pryOflBch->getCalibDrawer(drawerIdx); - bitPatVer = calibDrawer->getBitPatternVersion(); - calibDrawer->getStatusWords(channel, adc, adcBits, channelBits); - adcStatus += m_tileBchDecoder[bitPatVer]->decode(channelBits, adcBits); - } - - if (!adcStatus.isGood()) { - //=== only add problematic adcs to map - m_statusMapAdc[adcId] = adcStatus; - HWIdentifier channelId = m_tileHWID->channel_id(adcId); - m_statusMapChn[channelId] += adcStatus; - } - } - } - - - //============================================================ - //=== Set definition of bad and noisy channel if specified. - //--- These definitions are stored in drawerIdx=1, since - //--- drawers 1,...,3 are not used in the default chain. - //--- - //--- drawerIdx=1, channel=0: definition of bad channel - //--- drawerIdx=1, channel=1: definition of noisy channel - //--- drawerIdx=1, channel=2: definition of NoGainLevel1 channel - //--- drawerIdx=1, channel=3: definition of bad timing channel - //--- .... (this list could be extended if needed) - //============================================================ - //=== Reset defintion to hard-coded defaults - TileBchStatus::initClassifierDefinitions(); - - const TileCalibDrawerBch* definitionsCalibDrawer; - if (m_useOflBch) definitionsCalibDrawer = m_pryOflBch->getCalibDrawer(TileCalibUtils::DEFINITIONS_DRAWERIDX); - else definitionsCalibDrawer = m_pryOnlBch->getCalibDrawer(TileCalibUtils::DEFINITIONS_DRAWERIDX); - - TileBchDecoder::BitPatVer bitPatVer = definitionsCalibDrawer->getBitPatternVersion(); - - //=== TileBchStatus.isBad() definition - definitionsCalibDrawer->getStatusWords(TileCalibUtils::BAD_DEFINITION_CHAN, 0, adcBits, channelBits); - TileBchStatus chnStatus(m_tileBchDecoder[bitPatVer]->decode(channelBits, adcBits)); - if (chnStatus.isAffected()) { - ATH_MSG_INFO( "Updating TileBchStatus::isBad() definition from DB" ); - TileBchStatus::defineBad(chnStatus); - } else { - ATH_MSG_INFO( "No TileBchStatus::isBad() definition found in DB, using defaults" ); - } - - //=== TileBchStatus.isNoisy() definition - definitionsCalibDrawer->getStatusWords(TileCalibUtils::NOISY_DEFINITION_CHAN, 0, adcBits, channelBits); - chnStatus = m_tileBchDecoder[bitPatVer]->decode(channelBits, adcBits); - if (chnStatus.isAffected()) { - ATH_MSG_INFO( "Updating TileBchStatus::isNoisy() definition from DB" ); - TileBchStatus::defineNoisy(chnStatus); - } else { - ATH_MSG_INFO( "No TileBchStatus::isNoisy() definition found in DB, using defaults" ); - } - - //=== TileBchStatus.isNoGainL1() definition - definitionsCalibDrawer->getStatusWords(TileCalibUtils::NOGAINL1_DEFINITION_CHAN, 0, adcBits, channelBits); - chnStatus = m_tileBchDecoder[bitPatVer]->decode(channelBits, adcBits); - if (chnStatus.isAffected()) { - ATH_MSG_INFO( "Updating TileBchStatus::isNoGainL1() definition from DB" ); - TileBchStatus::defineNoGainL1(chnStatus); - } else { - ATH_MSG_INFO( "No TileBchStatus::isNoGainL1() definition found in DB, using defaults" ); - } - - - //=== TileBchStatus.isBadTiming() definition - definitionsCalibDrawer->getStatusWords(TileCalibUtils::BADTIMING_DEFINITION_CHAN, 0, adcBits, channelBits); - chnStatus = m_tileBchDecoder[bitPatVer]->decode(channelBits, adcBits); - if (chnStatus.isAffected()) { - ATH_MSG_INFO( "Updating TileBchStatus::isBadTiming() definition from DB" ); - TileBchStatus::defineBadTiming(chnStatus); - } else { - ATH_MSG_INFO( "No TileBchStatus::isBadTiming() definition found in DB, using defaults" ); - } - - - //=== report current definitions - ATH_MSG_INFO( "TileBchStatus::isBad() is defined by: " - << TileBchStatus::getDefinitionBad().getString() ); - ATH_MSG_INFO( "TileBchStatus::isNoisy() is defined by: " - << TileBchStatus::getDefinitionNoisy().getString() ); - ATH_MSG_INFO( "TileBchStatus::isNoGainL1() is defined by: " - << TileBchStatus::getDefinitionNoGainL1().getString() ); - ATH_MSG_INFO( "TileBchStatus::isBadTiming() is defined by: " - << TileBchStatus::getDefinitionBadTiming().getString() ); - - - // Check if drawer trips probabilities for simulation are exist in DB. - // By special convention trips probabilities are stored in drawer number: 2 - // like integers number plus one denominator per ros - //--- drawerIdx=2, channel=1: 64 integers + denominator for LBA - //--- drawerIdx=2, channel=2: 64 integers + denominator for LBC - //--- drawerIdx=2, channel=3: 64 integers + denominator for EBA - //--- drawerIdx=2, channel=4: 64 integers + denominator for EBC - //============================================================ - if (m_useOflBch) { - const TileCalibDrawerBch* tripsCalibDrawer = m_pryOflBch->getCalibDrawer(TileCalibUtils::TRIPS_DRAWERIDX); - - if (tripsCalibDrawer->getObjSizeUint32() == TileCalibUtils::MAX_DRAWER + 1 - && tripsCalibDrawer->getNChans() == TileCalibUtils::MAX_ROS) { - - ATH_MSG_INFO("Found drawer trips probabilities in DB"); - - // Fill up arrays with trips probabilities for simulation purposes - // Trips probabilities are cached like floats: number / denominator. - - for (unsigned int ros = 1; ros < TileCalibUtils::MAX_ROS; ++ros) { - const float denominator = (float) tripsCalibDrawer->getData(ros, 0, TileCalibUtils::MAX_DRAWER); - const float inv_denominator = 1. / denominator; - for (unsigned int mod = 0; mod < TileCalibUtils::MAX_DRAWER; ++mod) { - m_tripsProbs[ros - 1][mod] = ((float) tripsCalibDrawer->getData(ros, 0, mod)) * inv_denominator; - } - } - - } else { - ATH_MSG_INFO("No drawer trips probabilities found in DB"); - } - } - } catch (TileCalib::Exception& e) { - ATH_MSG_ERROR( "Caught exception: " << e.what() ); - return StatusCode::FAILURE; - } - - return StatusCode::SUCCESS; -} - -// -//____________________________________________________________________ -CaloBadChannel TileBadChanLegacyTool::caloStatus(Identifier id) const { - CaloBadChannel::BitWord res = 0; - - //=== get the TileHWIDs of the two channels connected to the caloCell id - const CaloDetDescrElement* elem = m_tileMgr->get_cell_element(id); - - if (!elem) { - //=== this should never happen - ATH_MSG_ERROR( "CaloMgr returns NULL CaloDetDescrElement" ); - std::abort(); - } - - //=== status of 1. connected channel - TileBchStatus chn1Stat(getChannelStatus(elem->onl1())); - - //=== status of 2. connected channel - TileBchStatus chn2Stat(getChannelStatus(elem->onl2())); - - //=== set cell status depending on channel status - if (chn1Stat.isBad() && chn2Stat.isBad()) { - CaloBadChannel::setBit(CaloBadChannel::deadBit, res); - } else if (chn1Stat.isAffected() || chn2Stat.isAffected()) { - CaloBadChannel::setBit(CaloBadChannel::affectedBit, res); - } - - return CaloBadChannel(res); -} - -// -//____________________________________________________________________ -const TileBchStatus& -TileBadChanLegacyTool::getAdcStatus(const HWIdentifier& adc_id) const { - - std::map<HWIdentifier, TileBchStatus>::const_iterator iStatusMap = m_statusMapAdc.find(adc_id); - if (iStatusMap == m_statusMapAdc.end()) { - return m_defaultStatus; - } else { - return iStatusMap->second; - } - -} - -// -//____________________________________________________________________ -const TileBchStatus& -TileBadChanLegacyTool::getAdcStatus(IdentifierHash hash_id, unsigned int adc) const { - if (hash_id != TileHWID::NOT_VALID_HASH) { - HWIdentifier adc_id = m_tileHWID->adc_id(hash_id, adc); - return getAdcStatus(adc_id); - } else { - return m_defaultStatus; - } -} - -// -//____________________________________________________________________ -const TileBchStatus& -TileBadChanLegacyTool::getChannelStatus(IdentifierHash hash_id) const { - if (hash_id != TileHWID::NOT_VALID_HASH) { - HWIdentifier channel_id = m_tileHWID->channel_id(hash_id); - return getChannelStatus(channel_id); - } else { - return m_defaultStatus; - } -} - -// -//____________________________________________________________________ -const TileBchStatus& -TileBadChanLegacyTool::getChannelStatus(const HWIdentifier& channel_id) const { - - std::map<HWIdentifier, TileBchStatus>::const_iterator iStatusMap = m_statusMapChn.find(channel_id); - if (iStatusMap == m_statusMapChn.end()) { - return m_defaultStatus; - } else { - return iStatusMap->second; - } - -} - -// -//____________________________________________________________________ -const TileBchStatus& -TileBadChanLegacyTool::getChannelStatus(unsigned int drawerIdx, unsigned int channel) const { - - HWIdentifier channel_id = m_tileHWID->channel_id(m_roses[drawerIdx], m_drawers[drawerIdx], channel); - return getChannelStatus(channel_id); - -} - -// -//____________________________________________________________________ -const TileBchStatus& -TileBadChanLegacyTool::getAdcStatus(unsigned int drawerIdx, unsigned int channel, unsigned int adc) const { - - HWIdentifier adc_id = m_tileHWID->adc_id(m_roses[drawerIdx], m_drawers[drawerIdx], channel, adc); - return getAdcStatus(adc_id); - -} - - -uint32_t TileBadChanLegacyTool::encodeStatus(const TileBchStatus& status) const { - uint32_t bad; - - if (status.isGood()) - bad = 0; - else if (status.isBad()) - bad = 3; - else if (status.isNoisy()) - bad = 1; - else if (status.isAffected()) - bad = 2; - else - bad = 4; - - return bad; -} diff --git a/TileCalorimeter/TileConditions/src/TileCondProxyCool.icc b/TileCalorimeter/TileConditions/src/TileCondProxyCool.icc index e8939bcc6e7809390bac3e3484a3591054644f5d..0ecf29334e78bfb0608c9a7215a7039e73ecd7ca 100644 --- a/TileCalorimeter/TileConditions/src/TileCondProxyCool.icc +++ b/TileCalorimeter/TileConditions/src/TileCondProxyCool.icc @@ -1,7 +1,7 @@ //Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration */ // Tile includes @@ -14,7 +14,6 @@ // Athena includes #include "AthenaKernel/errorcheck.h" #include "StoreGate/ReadCondHandle.h" -#include "StoreGate/WriteCondHandle.h" // @@ -37,24 +36,7 @@ StatusCode TileCondProxyCool<T>::initialize() { ATH_MSG_INFO( "Creating TileCondProxyCool(" << name() << ") for folder: \"" << m_sourceKey.key() << "\"" ); - const INamedInterface* owner = dynamic_cast<const INamedInterface*>(parent()); - std::string parentName = (owner) ? owner->name() : ""; - std::string condAlgSuffix("CondAlg"); - if (parentName.size() < condAlgSuffix.size() - || parentName.compare(parentName.size() - condAlgSuffix.size(), - condAlgSuffix.size(), condAlgSuffix) != 0) { - - //=== Register callback for this data handle - CHECK( detStore()->regFcn(&TileCondProxyCool<T>::callback, this, m_dataHandle, m_sourceKey.key(), true) ); - - ATH_MSG_DEBUG("It seems that parent [" << parentName << "] is not condition algorithm." << endmsg - << "Callback function has been registered for " << m_sourceKey.key() << "."); - } else { - ATH_CHECK( m_sourceKey.initialize() ); - ATH_MSG_DEBUG("It seems that parent [" << parentName << "] is condition algorithm." << endmsg - << "No callback functions have been registered for " << m_sourceKey.key() << "."); - } - + ATH_CHECK( m_sourceKey.initialize() ); return StatusCode::SUCCESS; } @@ -125,62 +107,3 @@ StatusCode TileCondProxyCool<T>::fillCalibData(TileCalibData<T>& calibData, return StatusCode::SUCCESS; } - - -// -//_____________________________________________________________________________ -template<typename T> -StatusCode TileCondProxyCool<T>::callback( IOVSVC_CALLBACK_ARGS_K(keys)) { - //=== Status message - msg(MSG::INFO) << name() << ": callback has been triggered by: "; - std::list<std::string>::const_iterator itr; - for (itr = keys.begin(); itr != keys.end(); ++itr) { - msg(MSG::INFO) << *itr << " "; - } - msg(MSG::INFO) << endmsg; - - m_calibData = std::make_unique<TileCalibData<T>>(); - - //=== Loop over collection by increasing channel number (defaults first!) - for (unsigned int drawerIdx = 0; drawerIdx < TileCalibUtils::MAX_DRAWERIDX; ++drawerIdx) { - - //=== get the BLOB - CondAttrListCollection::const_iterator attrListPair = m_dataHandle->chanAttrListPair(drawerIdx); - const coral::Blob& blob = (attrListPair->second)[0].data<coral::Blob>(); - - if (blob.size()) { - - //=== Get new TileCalibDrawer instance, interpreting current blob - std::unique_ptr<const T> calibDrawer(T::getInstance(blob)); - m_calibData->setCalibDrawer(drawerIdx, calibDrawer.release()); - - } else { - //=== Default policy - if (drawerIdx == 0) { - ATH_MSG_ERROR( "No default available!?" ); - return StatusCode::FAILURE; - } - - //=== Determine default index - unsigned int defaultDrawerIdx = TileCalibUtils::getDefaultDrawerIdx(drawerIdx); - m_calibData->setCalibDrawer(drawerIdx, m_calibData->getCalibDrawer(defaultDrawerIdx)); - - ATH_MSG_VERBOSE( "Using default drawer " << defaultDrawerIdx - << " for drawerIdx=" << drawerIdx << endmsg - << "... i.e. TileCalibDrawer @ " << m_calibData->getCalibDrawer(drawerIdx)); - - } - - } // End drawerIdx - - return StatusCode::SUCCESS; -} - -// -//_____________________________________________________________________________ -template<typename T> const T* -TileCondProxyCool<T>::getCalibDrawer(unsigned int drawerIdx) const { - - return (m_calibData) ? m_calibData->getCalibDrawer(drawerIdx) : nullptr; - -} diff --git a/TileCalorimeter/TileConditions/src/TileCondProxyFile.icc b/TileCalorimeter/TileConditions/src/TileCondProxyFile.icc index b587c229b56f473274b47bdb9419c519e3048253..e2bb7dcceebaa018526195c0ece27c6291ebf29b 100644 --- a/TileCalorimeter/TileConditions/src/TileCondProxyFile.icc +++ b/TileCalorimeter/TileConditions/src/TileCondProxyFile.icc @@ -1,7 +1,7 @@ // Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration */ @@ -36,24 +36,6 @@ TileCondProxyFile<T>::TileCondProxyFile(const std::string& type, const std::stri template<typename T> StatusCode TileCondProxyFile<T>::initialize() { - const INamedInterface* owner = dynamic_cast<const INamedInterface*>(parent()); - std::string parentName = (owner) ? owner->name() : ""; - std::string condAlgSuffix("CondAlg"); - if (parentName.size() < condAlgSuffix.size() - || parentName.compare(parentName.size() - condAlgSuffix.size(), - condAlgSuffix.size(), condAlgSuffix) != 0) { - - EventIDRange eventRange; - m_calibData = std::make_unique<TileCalibData<T>>(); - ATH_CHECK(fillCalibData(*m_calibData, eventRange)); - - ATH_MSG_DEBUG("It seems that parent [" << parentName << "] is not condition algorithm." << endmsg - << "Tile calibration drawers have been prepared in advance."); - } else { - ATH_MSG_DEBUG("It seems that parent [" << parentName << "] is condition algorithm." << endmsg - << "Tile calibration drawers have not been prepared in advance." ); - } - return StatusCode::SUCCESS; } @@ -312,12 +294,3 @@ StatusCode TileCondProxyFile<T>::finalize() { ATH_MSG_DEBUG( "finalize called for " << name() ); return StatusCode::SUCCESS; } - -// -//_____________________________________________________________________________ -template<typename T> -const T* TileCondProxyFile<T>::getCalibDrawer(unsigned int drawerIdx) const { - - return (m_calibData) ? m_calibData->getCalibDrawer(drawerIdx) : nullptr; - -} diff --git a/TileCalorimeter/TileConditions/src/TileInfoLoader.cxx b/TileCalorimeter/TileConditions/src/TileInfoLoader.cxx index d645b7bc453957b2809a1d4f2d8aeea511cb049c..9c1a7547a538320598bbc4d29797bafbdc321e1c 100644 --- a/TileCalorimeter/TileConditions/src/TileInfoLoader.cxx +++ b/TileCalorimeter/TileConditions/src/TileInfoLoader.cxx @@ -41,7 +41,6 @@ #include "TileConditions/TileCablingService.h" #include "TileConditions/TilePulseShapes.h" #include "TileConditions/TileOptFilterWeights.h" -#include "TileConditions/TileBadChanLegacyTool.h" #include "TMatrixD.h" #include "cstdio" @@ -377,12 +376,6 @@ StatusCode TileInfoLoader::initialize() { m_eorCalled = false; - - // This retrieval of TileBadChanLegacyTool is needed to avoid crash in trigger-related jobs, - // when TileByteStream wants to use bad channel tool at start of run - ToolHandle<ITileBadChanTool> tileBadChanTool("TileBadChanLegacyTool"); - CHECK( tileBadChanTool.retrieve() ); - // Listen for end of run ServiceHandle<IIncidentSvc> incSvc("IncidentSvc", this->name()); CHECK(incSvc.retrieve()); diff --git a/TileCalorimeter/TileConditions/src/components/TileConditions_entries.cxx b/TileCalorimeter/TileConditions/src/components/TileConditions_entries.cxx index d01cd28ba62d6c786bf39787a76c0fcb6eecdabb..8b3393f48f8d509a5aac9917aef642ec9a0dacf0 100644 --- a/TileCalorimeter/TileConditions/src/components/TileConditions_entries.cxx +++ b/TileCalorimeter/TileConditions/src/components/TileConditions_entries.cxx @@ -6,7 +6,6 @@ #include "TileConditions/TileCablingSvc.h" #include "TileConditions/TileCondIdTransforms.h" #include "TileConditions/TileBadChanTool.h" -#include "TileConditions/TileBadChanLegacyTool.h" #include "TileConditions/TileCondToolOfc.h" #include "TileConditions/TileCondToolOfcCool.h" #include "TileConditions/TileCellNoiseTool.h" @@ -35,7 +34,6 @@ DECLARE_COMPONENT( TileCablingSvc ) DECLARE_COMPONENT( TileDCSSvc ) DECLARE_COMPONENT( TileCondIdTransforms ) DECLARE_COMPONENT( TileBadChanTool ) -DECLARE_COMPONENT( TileBadChanLegacyTool ) DECLARE_COMPONENT( TileCondToolOfc ) DECLARE_COMPONENT( TileCondToolOfcCool ) DECLARE_COMPONENT( TileCellNoiseTool ) diff --git a/TileCalorimeter/TileConditions/test/TileEMScaleComponents_test.cxx b/TileCalorimeter/TileConditions/test/TileEMScaleComponents_test.cxx index 8faafa14955738ed767a057bb81d71bf7f1ce654..97194b492dec86c054cc6daeaad0f826c10db75a 100644 --- a/TileCalorimeter/TileConditions/test/TileEMScaleComponents_test.cxx +++ b/TileCalorimeter/TileConditions/test/TileEMScaleComponents_test.cxx @@ -211,10 +211,6 @@ class TileCondProxyMock: public AthAlgTool, virtual public ITileCondProxy<T> { return StatusCode::SUCCESS; }; - virtual const T* getCalibDrawer(unsigned int /*drawerIdx*/ ) const override { - return nullptr; - }; - };