diff --git a/LArCalorimeter/LArOnlDbPrep/LArOnlDbPrep/LArDSPThresholdFillInline.h b/LArCalorimeter/LArOnlDbPrep/LArOnlDbPrep/LArDSPThresholdFillInline.h index f90b7bb8448eaca0c3e27088fddbe8de11ba1a78..f0977f698fbcc5728806ce67103a885b0880b9bf 100644 --- a/LArCalorimeter/LArOnlDbPrep/LArOnlDbPrep/LArDSPThresholdFillInline.h +++ b/LArCalorimeter/LArOnlDbPrep/LArOnlDbPrep/LArDSPThresholdFillInline.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #ifndef LARDSPTHRESHOLDSFILLINGINLINE_H @@ -11,18 +11,18 @@ #include "LArRecConditions/ILArBadChannelMasker.h" #include "LArCabling/LArOnOffIdMapping.h" #include "StoreGate/ReadCondHandleKey.h" +#include "CaloConditions/CaloNoise.h" class LArOnlineID; -class ICaloNoiseTool; class ILArBadChannelMasker; class LArDSPThresholdFillInline:public AthAlgorithm { public: LArDSPThresholdFillInline(const std::string& name, ISvcLocator* pSvcLocator); - ~LArDSPThresholdFillInline(); - StatusCode initialize(); - StatusCode execute() {return StatusCode::SUCCESS;} - StatusCode stop(); + virtual ~LArDSPThresholdFillInline(); + virtual StatusCode initialize() override; + virtual StatusCode execute() override {return StatusCode::SUCCESS;} + virtual StatusCode stop() override; private: SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey{this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"}; @@ -40,7 +40,11 @@ class LArDSPThresholdFillInline:public AthAlgorithm { std::string m_outFileName, m_inFileName; bool m_fill; - ToolHandle < ICaloNoiseTool > m_noisetool; + SG::ReadCondHandleKey<CaloNoise> m_totalNoiseKey + { this, "TotalNoiseKey", "totalNoise", "SG key for total noise" }; + SG::ReadCondHandleKey<CaloNoise> m_elecNoiseKey + { this, "ElecNoiseKey", "electronicNoise", "SG key for electronic noise" }; + ToolHandle < ILArBadChannelMasker > m_badChannelMasker; enum mode_t{ diff --git a/LArCalorimeter/LArOnlDbPrep/share/LArDSPGeoWeightsFill.py b/LArCalorimeter/LArOnlDbPrep/share/LArDSPGeoWeightsFill.py index 8cbf7f6e73972b00b1c620836d624b994c2ae4a0..ba2bf94a2ab71e5119599d9dd3e8c868770fcad9 100644 --- a/LArCalorimeter/LArOnlDbPrep/share/LArDSPGeoWeightsFill.py +++ b/LArCalorimeter/LArOnlDbPrep/share/LArDSPGeoWeightsFill.py @@ -46,11 +46,6 @@ fileName="DSPGeoWeigths" from CaloTools.CaloNoiseFlags import jobproperties jobproperties.CaloNoiseFlags.FixedLuminosity.set_Value_and_Lock(1.45*30/8) -from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault -theCaloNoiseTool = CaloNoiseToolDefault() -theCaloNoiseTool.OutputLevel=INFO -ToolSvc+=theCaloNoiseTool - from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker theLArBadChannelMasker=LArBadChannelMasker("LArBadChannelMasker") theLArBadChannelMasker.DoMasking=True diff --git a/LArCalorimeter/LArOnlDbPrep/share/LArDSPThresholdFillAlg.py b/LArCalorimeter/LArOnlDbPrep/share/LArDSPThresholdFillAlg.py index 2af738b8b8d3aca3717496e6534601bbae961cc9..8d6cc37a6e687d43d53e1d433bcd3b432cbad197 100644 --- a/LArCalorimeter/LArOnlDbPrep/share/LArDSPThresholdFillAlg.py +++ b/LArCalorimeter/LArOnlDbPrep/share/LArDSPThresholdFillAlg.py @@ -54,15 +54,14 @@ from CaloTools.CaloNoiseFlags import jobproperties #jobproperties.CaloNoiseFlags.FixedLuminosity.set_Value_and_Lock(1.45*30/8) jobproperties.CaloNoiseFlags.FixedLuminosity.set_Value_and_Lock(-1.) -from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault -theCaloNoiseTool = CaloNoiseToolDefault() -theCaloNoiseTool.OutputLevel=INFO -theCaloNoiseTool.RescaleForHV=False -ToolSvc+=theCaloNoiseTool - +# Turn this off before configuring CaloNoiseCondAlg. from CaloRec.CaloCellFlags import jobproperties jobproperties.CaloCellFlags.doLArHVCorr = False +from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg +CaloNoiseCondAlg ('totalNoise') +CaloNoiseCondAlg ('electronicNoise') + conddb.addOverride("/CALO/Ofl/Noise/PileUpNoiseLumi","CALOOflNoisePileUpNoiseLumi-RUN2-UPD1-00") if 'pileupsqlite' in dir(): conddb.addMarkup("/CALO/Ofl/Noise/PileUpNoiseLumi","<db>sqlite://;schema="+pileupsqlite+";dbname=CONDBR2</db>") @@ -110,7 +109,6 @@ if ModeType=="noise": theLArDSPThresholdFillAlg.sigmaNoiseQt=Qtval theLArDSPThresholdFillAlg.usePileupNoiseSamples=Samppileup theLArDSPThresholdFillAlg.usePileupNoiseQt=Qtpileup - theLArDSPThresholdFillAlg.NoiseTool=theCaloNoiseTool if fill: diff --git a/LArCalorimeter/LArOnlDbPrep/src/LArDSPThresholdFillInline.cxx b/LArCalorimeter/LArOnlDbPrep/src/LArDSPThresholdFillInline.cxx index dc1db1d3c489f2e662b44d692c01612423efb57f..5a0fe4d2a032b725299ee8c3bda64c4444b7cdd7 100644 --- a/LArCalorimeter/LArOnlDbPrep/src/LArDSPThresholdFillInline.cxx +++ b/LArCalorimeter/LArOnlDbPrep/src/LArDSPThresholdFillInline.cxx @@ -1,14 +1,15 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #include "LArOnlDbPrep/LArDSPThresholdFillInline.h" #include "LArIdentifier/LArOnlineID.h" #include "CaloIdentifier/CaloCell_ID.h" #include "CaloIdentifier/CaloGain.h" -#include "CaloInterface/ICaloNoiseTool.h" #include "CaloDetDescr/CaloDetDescrManager.h" #include "CaloDetDescr/CaloDetDescrElement.h" +#include "CaloConditions/CaloNoise.h" +#include "GaudiKernel/ThreadLocalContext.h" #include <fstream> @@ -25,7 +26,6 @@ LArDSPThresholdFillInline::LArDSPThresholdFillInline(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name,pSvcLocator), m_onlineID(0), - m_noisetool("CaloNoiseToolDefault"), m_badChannelMasker("LArBadChannelMasker"), m_workmode (FIXED) { @@ -48,7 +48,6 @@ LArDSPThresholdFillInline::LArDSPThresholdFillInline(const std::string& name, IS declareProperty("sigmaNoiseQt",m_sigmaNoiseQt); declareProperty("usePileupNoiseSamples",m_usePileupNoiseSamples); declareProperty("usePileupNoiseQt",m_usePileupNoiseQt); - declareProperty("NoiseTool",m_noisetool); //For channel masking declareProperty("MaskBadChannels",m_maskBadChannels=false); @@ -109,9 +108,11 @@ StatusCode LArDSPThresholdFillInline::initialize() { else ATH_MSG_INFO ( "ICaloCellTool::elecNoiseRMS times " << name() << ".sigmaNoiseQt for DSP thresholds" ); - ATH_CHECK( m_noisetool.retrieve() ); } + ATH_CHECK( m_totalNoiseKey.initialize (m_workmode == NOISE) ); + ATH_CHECK( m_elecNoiseKey.initialize (m_workmode == NOISE) ); + return StatusCode::SUCCESS; } @@ -119,6 +120,8 @@ StatusCode LArDSPThresholdFillInline::stop() { ATH_MSG_DEBUG ( "start stop()" ); + const EventContext& ctx = Gaudi::Hive::currentContext(); + if (m_fill) { ATH_MSG_INFO ( "Filling database" ); @@ -157,13 +160,22 @@ StatusCode LArDSPThresholdFillInline::stop() { } ATH_MSG_INFO ( "theCaloDDM retrieved" ); - SG::ReadCondHandle<LArOnOffIdMapping> cablingHdl{m_cablingKey}; + SG::ReadCondHandle<LArOnOffIdMapping> cablingHdl (m_cablingKey, ctx); const LArOnOffIdMapping* cabling{*cablingHdl}; if(!cabling) { ATH_MSG_ERROR("Do not have mapping object " << m_cablingKey.key()); return StatusCode::FAILURE; } + const CaloNoise* totalNoise = nullptr; + const CaloNoise* elecNoise = nullptr; + if (m_workmode == NOISE) { + SG::ReadCondHandle<CaloNoise> totalNoiseH (m_totalNoiseKey, ctx); + totalNoise = totalNoiseH.cptr(); + SG::ReadCondHandle<CaloNoise> elecNoiseH (m_elecNoiseKey, ctx); + elecNoise = elecNoiseH.cptr(); + } + for (unsigned hs=0;hs<hashMax;++hs) { const HWIdentifier chid=m_onlineID->channel_Id(hs); const Identifier id=cabling->cnvToIdentifier(chid); @@ -225,27 +237,26 @@ StatusCode LArDSPThresholdFillInline::stop() { else igain = CaloGain::LARHIGHGAIN; - ATH_MSG_DEBUG ( "hash, eta, phi: " << caloDDE->calo_hash() << ", " << caloDDE->eta() << ", " << caloDDE->phi() << "; noise: " << m_noisetool->totalNoiseRMS(caloDDE,igain) ); + ATH_MSG_DEBUG ( "hash, eta, phi: " << caloDDE->calo_hash() << ", " << caloDDE->eta() << ", " << caloDDE->phi() << "; noise: " << totalNoise->getNoise(id,igain) ); float samplesThr = 0.; float QtThr = 0.; if(m_usePileupNoiseSamples) - samplesThr = m_noisetool->totalNoiseRMS(caloDDE,igain); + samplesThr = totalNoise->getNoise(id,igain); else - samplesThr = m_noisetool->elecNoiseRMS(caloDDE,igain,-1); + samplesThr = elecNoise->getNoise(id,igain); if(m_usePileupNoiseQt) - QtThr = m_noisetool->totalNoiseRMS(caloDDE,igain); + QtThr = totalNoise->getNoise(id,igain); else - QtThr = m_noisetool->elecNoiseRMS(caloDDE,igain,-1); + QtThr = elecNoise->getNoise(id,igain); //cont->set(chid,QtThr*m_sigmaNoiseQt,samplesThr*m_sigmaNoiseSamples,QtThr*m_sigmaNoiseQt); ptQThrBlob[hs]=QtThr*m_sigmaNoiseQt; psamplesBlob[hs]=samplesThr*m_sigmaNoiseSamples; ptrigSumBlob[hs]=QtThr*m_sigmaNoiseQt; - //cont->set(chid,(m_noisetool->totalNoiseRMS(caloDDE,CaloGain::LARHIGHGAIN))*m_sigmaNoiseQt,(m_noisetool->totalNoiseRMS(caloDDE,CaloGain::LARHIGHGAIN))*m_sigmaNoiseSamples,(m_noisetool->totalNoiseRMS(caloDDE,CaloGain::LARHIGHGAIN))*m_sigmaNoiseQt); }// end if NOISE }//end loop over cells }//end if FILL