diff --git a/LArCalorimeter/LArMonTools/share/LArCoverage_jobOptions.py b/LArCalorimeter/LArMonTools/share/LArCoverage_jobOptions.py index 26539badd6804ada9a2f32fd2c4b2bc8fa3c7567..988ef6ed877407ad2bfc381684db8ac3a6f4f819 100755 --- a/LArCalorimeter/LArMonTools/share/LArCoverage_jobOptions.py +++ b/LArCalorimeter/LArMonTools/share/LArCoverage_jobOptions.py @@ -2,20 +2,19 @@ if 'EventBlockSize' not in dir(): EventBlockSize=0 + +from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg +CaloNoiseCondAlg(noisetype="electronicNoise") + ###### LAr Coverage Tool Configuration ############### from LArMonTools.LArMonToolsConf import LArCoverage theLArCoverage = LArCoverage(name="LArCoverage", ProcessNEvents = EventBlockSize, - LArDigitContainerKey = LArMonFlags.LArDigitKey(), LArBadChannelMask = theLArBadChannelsMasker, Nevents = 40 ) -#ToolSvc += theLArCoverage LArMon.AthenaMonTools+=[ theLArCoverage ] -# CaloNoiseTool configuration -from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault -theLArCoverageCaloNoiseTool=CaloNoiseToolDefault() -ToolSvc+=theLArCoverageCaloNoiseTool -LArCoverage.LArCaloNoiseTool=theLArCoverageCaloNoiseTool + + diff --git a/LArCalorimeter/LArMonTools/src/LArCoverage.cxx b/LArCalorimeter/LArMonTools/src/LArCoverage.cxx index 2b382e9fac381dc9a91895fde930af7d485a72b9..ec3557509fd00c53e8de16721a6471727210f9ae 100644 --- a/LArCalorimeter/LArMonTools/src/LArCoverage.cxx +++ b/LArCalorimeter/LArMonTools/src/LArCoverage.cxx @@ -35,6 +35,8 @@ #include <map> #include <utility> +#include "StoreGate/ReadHandle.h" + using namespace std; /*---------------------------------------------------------*/ @@ -64,15 +66,11 @@ LArCoverage::LArCoverage(const std::string& type, m_hCaloNoiseToolHEC(), m_hCaloNoiseToolFCAL() { - declareProperty("LArDigitContainerKey",m_LArDigitContainerKey = "FREE"); - declareProperty("LArRawChannelKey",m_channelKey="LArRawChannels"); + declareProperty("LArRawChannelKey",m_rawChannelsKey="LArRawChannels"); declareProperty("LArBadChannelMask",m_badChannelMask); - declareProperty("LArCaloNoiseTool",m_caloNoiseTool); declareProperty("Nevents",m_nevents = 50); - declareProperty("Nsigma",m_nsigma = 3); m_eventsCounter = 0; - m_noisycells.clear(); m_LArOnlineIDHelper = NULL; m_LArEM_IDHelper = NULL; @@ -143,15 +141,9 @@ LArCoverage::initialize() // LArOnlineIDStrHelper m_strHelper = new LArOnlineIDStrHelper(m_LArOnlineIDHelper); m_strHelper->setDefaultNameType(LArOnlineIDStrHelper::LARONLINEID); - - // Get CaloNoiseTool - if ( m_caloNoiseTool.retrieve().isFailure() ) { - ATH_MSG_FATAL( "Failed to retrieve tool " << m_caloNoiseTool ); - return StatusCode::FAILURE; - } else { - ATH_MSG_DEBUG( "Retrieved tool " << m_caloNoiseTool ); - } - + + ATH_CHECK( m_noiseCDOKey.initialize() ); + ATH_CHECK( m_rawChannelsKey.initialize() ); // End Initialize ManagedMonitorToolBase::initialize().ignore(); ATH_MSG_DEBUG( "Successful Initialize LArCoverage " ); @@ -590,20 +582,21 @@ LArCoverage::fillHistograms() if(m_eventsCounter > m_nevents ) return StatusCode::SUCCESS; // Retrieve Raw Channels Container - const LArRawChannelContainer* pRawChannelsContainer; - StatusCode sc = evtStore()->retrieve(pRawChannelsContainer, m_channelKey); - if(sc.isFailure()) { - ATH_MSG_WARNING( "Can\'t retrieve LArRawChannelContainer with key " << m_channelKey ); - return StatusCode::SUCCESS; - } + + SG::ReadHandle<LArRawChannelContainer> pRawChannelsContainer(m_rawChannelsKey); + if(!pRawChannelsContainer.isValid()) { + ATH_MSG_ERROR( " Can not retrieve LArRawChannelContainer: " + << m_rawChannelsKey.key() ); + return StatusCode::FAILURE; + } + + SG::ReadCondHandle<CaloNoise> noiseHdl{m_noiseCDOKey}; + const CaloNoise* noiseCDO=*noiseHdl; - // Loop over LArRawChannels - SelectAllLArRawChannels AllRaw(pRawChannelsContainer); - for (SelectAllLArRawChannels::const_iterator itRaw = AllRaw.begin(); itRaw != AllRaw.end(); ++itRaw) { - const LArRawChannel* pRawChannel = (*itRaw) ; - int provenanceChan = pRawChannel->provenance(); - float energyChan = pRawChannel->energy(); - HWIdentifier id = pRawChannel->hardwareID(); + for (const LArRawChannel& pRawChannel : *pRawChannelsContainer) { + int provenanceChan = pRawChannel.provenance(); + float energyChan = pRawChannel.energy(); + HWIdentifier id = pRawChannel.hardwareID(); //CaloGain::CaloGain gain = pRawChannel->gain(); Identifier offlineID = m_larCablingService->cnvToIdentifier(id); @@ -632,7 +625,8 @@ LArCoverage::fillHistograms() if (m_LArOnlineIDHelper->isHECchannel(id)) phiChan = CaloPhiRange::fix(phiChan); // Retrieve expected noise - float noise = m_caloNoiseTool->getNoise(caloDetElement,ICalorimeterNoiseTool::ELECTRONICNOISE); + float noise = noiseCDO->getNoise(offlineID,m_highestGain[caloDetElement->getSubCalo()]); + //->getNoise(caloDetElement,ICalorimeterNoiseTool::ELECTRONICNOISE); if(m_eventsCounter == 1){ diff --git a/LArCalorimeter/LArMonTools/src/LArCoverage.h b/LArCalorimeter/LArMonTools/src/LArCoverage.h index 2c613e5b31032bc58d8d173e4fe76173e5246b99..ada669d77e3dbf5edcc34b90de39fccbcc2e0da8 100644 --- a/LArCalorimeter/LArMonTools/src/LArCoverage.h +++ b/LArCalorimeter/LArMonTools/src/LArCoverage.h @@ -1,3 +1,4 @@ +//Dear emacs, this is -*-c++-*- /* Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ @@ -11,7 +12,6 @@ #ifndef LARMONTOOLS_LARCOVERAGE_H #define LARMONTOOLS_LARCOVERAGE_H -#include "SelectAllLArRawChannels.h" #include "LArOnlineIDStrHelper.h" #include "AthenaMonitoring/ManagedMonitorToolBase.h" @@ -22,19 +22,15 @@ #include "CaloDetDescr/CaloDetDescriptor.h" #include "CaloDetDescr/CaloDetDescrElement.h" #include "CaloGeoHelpers/CaloPhiRange.h" -#include "CaloInterface/ICaloNoiseTool.h" -#include "CaloInterface/ICalorimeterNoiseTool.h" #include "Identifier/HWIdentifier.h" #include "LArIdentifier/LArOnlineID.h" -#include "LArRawEvent/LArRawChannel.h" #include "LArRawEvent/LArRawChannelContainer.h" -#include "EventContainers/SelectAllObject.h" #include "LArCabling/LArCablingLegacyService.h" #include "LArRecConditions/ILArBadChannelMasker.h" #include "StoreGate/ReadCondHandleKey.h" #include "LArRecConditions/LArBadChannelCont.h" - +#include "CaloConditions/CaloNoise.h" #include <string> #include <map> @@ -74,7 +70,7 @@ class LArCoverage: public ManagedMonitorToolBase * Overwrite dummy method from MonitorToolBase */ StatusCode procHistograms(); - protected: +private: // services const LArOnlineID* m_LArOnlineIDHelper; @@ -90,14 +86,11 @@ class LArCoverage: public ManagedMonitorToolBase ToolHandle<LArCablingLegacyService> m_larCablingService; /** Handle to bad-channel tools */ ToolHandle<ILArBadChannelMasker> m_badChannelMask; - /** Handle to caloNoiseTool */ - ToolHandle < ICaloNoiseTool > m_caloNoiseTool ; + SG::ReadHandleKey<LArRawChannelContainer> m_rawChannelsKey; SG::ReadCondHandleKey<LArBadChannelCont> m_BCKey{this, "BadChanKey", "LArBadChannel", "SG bad channels key"}; SG::ReadCondHandleKey<LArBadFebCont> m_BFKey{this, "MFKey", "LArBadFeb", "SG missing FEBs key"}; - - - private: + SG::ReadCondHandleKey<CaloNoise> m_noiseCDOKey{this,"CaloNoiseKey","electronicNoise","SG Key of CaloNoise data object"}; // To retrieve bad channel DB keywords int DBflag(HWIdentifier onID); @@ -114,14 +107,10 @@ class LArCoverage: public ManagedMonitorToolBase void FixEmptyBins(); // Properties - std::string m_LArDigitContainerKey; - std::string m_channelKey; - int m_nsigma; int m_nevents; // Other things int m_eventsCounter; - std::map<HWIdentifier,int> m_noisycells; // Coverage Maps TH2I_LW* m_hCoverageEMBA[4]; TH2I_LW* m_hCoverageEMBC[4]; @@ -145,6 +134,16 @@ class LArCoverage: public ManagedMonitorToolBase TH2I_LW* m_hBadChannelsEndcapA; TH2I_LW* m_hBadChannelsEndcapC; + + const std::array<CaloGain::CaloGain,CaloCell_Base_ID::NSUBCALO> m_highestGain{ + CaloGain::LARHIGHGAIN, //LAREM + CaloGain::LARMEDIUMGAIN, //LARHEC + CaloGain::LARHIGHGAIN, //LARFCAL + CaloGain::TILEHIGHHIGH, //TILE + CaloGain::LARHIGHGAIN //LARMINIFCAL + }; + + }; #endif