diff --git a/LArCalorimeter/LArCafJobs/LArCafJobs/LArHECNoise.h b/LArCalorimeter/LArCafJobs/LArCafJobs/LArHECNoise.h index 23327fad49da8b7e544343f5077ace0b37880366..2e265461eded6751bb3259c281438da6750e436b 100644 --- a/LArCalorimeter/LArCafJobs/LArCafJobs/LArHECNoise.h +++ b/LArCalorimeter/LArCafJobs/LArCafJobs/LArHECNoise.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 LArHECNoise_H @@ -19,8 +19,6 @@ #include "Identifier/Range.h" #include "Identifier/IdentifierHash.h" #include "LArRecConditions/ILArBadChannelMasker.h" -#include "CaloInterface/ICaloNoiseTool.h" -#include "CaloInterface/ICalorimeterNoiseTool.h" #include "TrigAnalysisInterfaces/IBunchCrossingTool.h" #include "LArCabling/LArOnOffIdMapping.h" #include "StoreGate/ReadCondHandleKey.h" @@ -66,7 +64,6 @@ class LArHECNoise : public AthAlgorithm { SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey{this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"}; /*Tools*/ - ToolHandle<ICaloNoiseTool> m_calo_noise_tool; ToolHandle<Trig::IBunchCrossingTool> m_bc_tool; ToolHandle< Trig::TrigDecisionTool > m_trigDec; diff --git a/LArCalorimeter/LArCafJobs/LArCafJobs/LArNoiseBursts.h b/LArCalorimeter/LArCafJobs/LArCafJobs/LArNoiseBursts.h index 471f149605cba1d45490e8d779ab121c64c22990..ddf52af9e1e98382eca2e5fb792606a056da855f 100644 --- a/LArCalorimeter/LArCafJobs/LArCafJobs/LArNoiseBursts.h +++ b/LArCalorimeter/LArCafJobs/LArCafJobs/LArNoiseBursts.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 LArNoiseBursts_H @@ -11,7 +11,6 @@ #include "GaudiKernel/AlgTool.h" #include "CLHEP/Units/SystemOfUnits.h" -#include "StoreGate/StoreGateSvc.h" #include "GaudiKernel/ITHistSvc.h" #include "AnalysisTools/AnalysisTools.h" #include "StoreGate/ReadCondHandleKey.h" @@ -20,7 +19,6 @@ #include "Identifier/Range.h" #include "Identifier/IdentifierHash.h" #include "LArRecConditions/LArBadChannelCont.h" -#include "CaloInterface/ICaloNoiseTool.h" #include "CaloInterface/ICalorimeterNoiseTool.h" #include "TrigAnalysisInterfaces/IBunchCrossingTool.h" #include "LArCabling/LArOnOffIdMapping.h" @@ -47,6 +45,7 @@ class LArOnlineIDStrHelper; class LArEM_ID; class LArHEC_ID; class LArFCAL_ID; +class CaloNoise; //class CaloDetDescrManager; class TileTBID; @@ -61,12 +60,12 @@ class LArNoiseBursts : public AthAlgorithm { public: LArNoiseBursts(const std::string& name, ISvcLocator* pSvcLocator); - ~LArNoiseBursts(); + virtual ~LArNoiseBursts(); //virtual StatusCode initializeBeforeEventLoop(); - virtual StatusCode initialize(); - virtual StatusCode finalize(); - virtual StatusCode execute(); + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; + virtual StatusCode execute() override; virtual StatusCode clear(); private: @@ -80,7 +79,8 @@ class LArNoiseBursts : public AthAlgorithm { //functions int GetPartitionLayerIndex(const Identifier& id); - StatusCode fillCell(HWIdentifier onlID, float eCalo, float qfactor, CaloGain::CaloGain gain, const LArOnOffIdMapping* cabling, const LArBadChannelCont* bcCont); + StatusCode fillCell(HWIdentifier onlID, float eCalo, float qfactor, CaloGain::CaloGain gain, const LArOnOffIdMapping* cabling, const LArBadChannelCont* bcCont, + const CaloNoise& totalNoise); private: @@ -90,10 +90,10 @@ class LArNoiseBursts : public AthAlgorithm { SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey { this, "CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"}; SG::ReadCondHandleKey<LArBadChannelCont> m_BCKey { this, "BadChanKey","LArBadChannel","SG Key of LArBadChannelCont object"}; + SG::ReadCondHandleKey<CaloNoise> m_totalNoiseKey + { this, "TotalNoiseKey", "totalNoise", "SG key for total noise" }; /*Tools*/ - ToolHandle<ICaloNoiseTool> m_calo_noise_tool; ToolHandle<Trig::IBunchCrossingTool> m_bc_tool; - ToolHandle< Trig::TrigDecisionTool > m_trigDec; /*services*/ diff --git a/LArCalorimeter/LArCafJobs/share/LArNoiseBursts_prodJO.py b/LArCalorimeter/LArCafJobs/share/LArNoiseBursts_prodJO.py index d46404b6c9b3d39a306b39669b7e76ce7f940e11..956a5d2c579592b8006a1d378678f71eda18fedc 100644 --- a/LArCalorimeter/LArCafJobs/share/LArNoiseBursts_prodJO.py +++ b/LArCalorimeter/LArCafJobs/share/LArNoiseBursts_prodJO.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration from AthenaCommon.AthenaCommonFlags import athenaCommonFlags from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr,ToolSvc) @@ -44,10 +44,9 @@ cfg = TriggerConfigGetter("ReadPool") from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool ToolSvc += Trig__TrigDecisionTool( "TrigDecisionTool" ) -# --- CaloNoiseTool configuration --- -from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault -theCaloNoiseTool = CaloNoiseToolDefault() -ToolSvc += theCaloNoiseTool +# --- CaloNoise configuration --- +from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg +CaloNoiseCondAlg ('totalNoise') # --- BunchCrossing Tool configuration --- from TrigBunchCrossingTool.BunchCrossingTool import BunchCrossingTool @@ -73,7 +72,6 @@ include.block("LArCellRec/LArCollisionTime_jobOptions.py") from LArCellRec.LArCellRecConf import LArCollisionTimeAlg topSequence += LArCollisionTimeAlg("LArCollisionTimeAlg") -topSequence.LArCollisionTimeAlg.NoiseTool = theCaloNoiseTool from AthenaCommon.GlobalFlags import globalflags if globalflags.DataSource()=='data' : @@ -114,7 +112,6 @@ if not hasattr(condSeq, "InDetSiElementPropertiesTableCondAlg"): from LArCafJobs.LArCafJobsConf import LArNoiseBursts topSequence += LArNoiseBursts( "LArNoiseBursts" ) -topSequence.LArNoiseBursts.ICaloNoiseTool = theCaloNoiseTool topSequence.LArNoiseBursts.BCTool = theBCTool topSequence.LArNoiseBursts.SCTClusteringTool = InDetSCT_ClusteringTool topSequence.LArNoiseBursts.SigmaCut = 3.0 diff --git a/LArCalorimeter/LArCafJobs/share/LArNoiseBursts_topOptions.py b/LArCalorimeter/LArCafJobs/share/LArNoiseBursts_topOptions.py index a3d32796257cea3baf16b072439f55538fed7ee8..7ff2b16e4907289b444629678dcaa252e7f57ddf 100644 --- a/LArCalorimeter/LArCafJobs/share/LArNoiseBursts_topOptions.py +++ b/LArCalorimeter/LArCafJobs/share/LArNoiseBursts_topOptions.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration from AthenaCommon.AthenaCommonFlags import athenaCommonFlags from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr,ToolSvc) @@ -58,10 +58,9 @@ cfg = TriggerConfigGetter("ReadPool") from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool ToolSvc += Trig__TrigDecisionTool( "TrigDecisionTool" ) -# --- CaloNoiseTool configuration --- -from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault -theCaloNoiseTool = CaloNoiseToolDefault() -ToolSvc += theCaloNoiseTool +# --- CaloNoise configuration --- +from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg +CaloNoiseCondAlg ('totalNoise') # --- BunchCrossing Tool configuration --- from TrigBunchCrossingTool.BunchCrossingTool import BunchCrossingTool @@ -82,7 +81,6 @@ include.block("LArCellRec/LArCollisionTime_jobOptions.py") from LArCellRec.LArCellRecConf import LArCollisionTimeAlg topSequence += LArCollisionTimeAlg("LArCollisionTimeAlg") -topSequence.LArCollisionTimeAlg.NoiseTool = theCaloNoiseTool from AthenaCommon.GlobalFlags import globalflags if globalflags.DataSource()=='data' : @@ -97,7 +95,6 @@ topSequence.LArCollisionTimeAlg.OutputLevel = INFO from LArCafJobs.LArCafJobsConf import LArNoiseBursts topSequence += LArNoiseBursts( "LArNoiseBursts" ) -topSequence.LArNoiseBursts.ICaloNoiseTool = theCaloNoiseTool topSequence.LArNoiseBursts.BCTool = theBCTool topSequence.LArNoiseBursts.SigmaCut = 3.0 topSequence.LArNoiseBursts.NumberOfBunchesInFront = 30 diff --git a/LArCalorimeter/LArCafJobs/share/skeleton.LArNoise.py b/LArCalorimeter/LArCafJobs/share/skeleton.LArNoise.py index 40918c4f5cc84038899159176f232822a97f9fee..5de554d34f09194b53bd22c1d1e95836c75d8e00 100644 --- a/LArCalorimeter/LArCafJobs/share/skeleton.LArNoise.py +++ b/LArCalorimeter/LArCafJobs/share/skeleton.LArNoise.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration import sys from AthenaCommon.Logging import logging @@ -152,9 +152,8 @@ triggerGetter = T0TriggerGetter() #from TrigDecisionMaker.TrigDecisionMakerConfig import WriteTrigDecision #trigDecWriter = WriteTrigDecision() -from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault -theCaloNoiseTool = CaloNoiseToolDefault() -ToolSvc+=theCaloNoiseTool +from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg +CaloNoiseCondAlg ('totalNoise') # --- BunchCrossing Tool configuration --- from TrigBunchCrossingTool.BunchCrossingTool import BunchCrossingTool @@ -169,7 +168,6 @@ include("LArCellRec//LArCollisionTime_jobOptions.py") from LArCafJobs.LArCafJobsConf import LArNoiseBursts topSequence += LArNoiseBursts( "LArNoiseBursts" ) -topSequence.LArNoiseBursts.ICaloNoiseTool = theCaloNoiseTool topSequence.LArNoiseBursts.BCTool = theBCTool topSequence.LArNoiseBursts.SigmaCut = 3.0 topSequence.LArNoiseBursts.NumberOfBunchesInFront = 30 diff --git a/LArCalorimeter/LArCafJobs/share/skeleton.LArNoise_fromraw.py b/LArCalorimeter/LArCafJobs/share/skeleton.LArNoise_fromraw.py index 32d73f95cece6691cb5f92cca064ea220f905a6b..1596d22779202e2a2f600648b1e769bacd968997 100644 --- a/LArCalorimeter/LArCafJobs/share/skeleton.LArNoise_fromraw.py +++ b/LArCalorimeter/LArCafJobs/share/skeleton.LArNoise_fromraw.py @@ -261,9 +261,9 @@ if hasattr(runArgs,"outputNTUP_LARNOISEFile") or hasattr(runArgs,"outputNTUP_HEC # ##################### -from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault -theCaloNoiseTool = CaloNoiseToolDefault() -ToolSvc+=theCaloNoiseTool +from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg +CaloNoiseCondAlg ('totalNoise') + from LArBadChannelTool.LArBadChannelToolConf import LArBadChanTool theLArBadChannelTool=LArBadChanTool() ToolSvc+=theLArBadChannelTool @@ -274,7 +274,6 @@ if hasattr(runArgs,"outputNTUP_LARNOISEFile"): #include("LArCellRec//LArCollisionTime_jobOptions.py") from LArCafJobs.LArCafJobsConf import LArNoiseBursts topSequence += LArNoiseBursts( "LArNoiseBursts" ) - topSequence.LArNoiseBursts.ICaloNoiseTool = theCaloNoiseTool topSequence.LArNoiseBursts.BCTool = theBCTool topSequence.LArNoiseBursts.SigmaCut = 3.0 topSequence.LArNoiseBursts.NumberOfBunchesInFront = 30 diff --git a/LArCalorimeter/LArCafJobs/src/LArNoiseBursts.cxx b/LArCalorimeter/LArCafJobs/src/LArNoiseBursts.cxx index 2e524377abae8afc1e13af8eca1ad5f28c4b3bc7..4f3f4ade306e77ca0458d496191a2fd13792ce9c 100644 --- a/LArCalorimeter/LArCafJobs/src/LArNoiseBursts.cxx +++ b/LArCalorimeter/LArCafJobs/src/LArNoiseBursts.cxx @@ -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 */ /// LArNoiseBursts @@ -8,10 +8,8 @@ /// Modified by Hideki Okawa /// BNL, June, 2012 -#include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/IToolSvc.h" - -#include "StoreGate/StoreGateSvc.h" +#include "GaudiKernel/ThreadLocalContext.h" +#include "StoreGate/ReadCondHandle.h" #include "CaloIdentifier/CaloCell_ID.h" #include "CaloIdentifier/CaloDM_ID.h" @@ -22,10 +20,6 @@ #include "CaloIdentifier/LArMiniFCAL_ID.h" #include "CaloIdentifier/LArID_Exception.h" - -#include "CaloInterface/ICaloNoiseTool.h" -#include "CaloInterface/ICalorimeterNoiseTool.h" - #include "AthenaPoolUtilities/AthenaAttributeList.h" #include "Identifier/Range.h" @@ -42,6 +36,7 @@ #include "LArRawEvent/LArRawChannelContainer.h" #include "LArRecEvent/LArNoisyROSummary.h" #include "LArRecEvent/LArCollisionTime.h" +#include "CaloConditions/CaloNoise.h" #include "NavFourMom/IParticleContainer.h" #include "NavFourMom/INavigable4MomentumCollection.h" @@ -93,7 +88,6 @@ LArNoiseBursts::LArNoiseBursts(const std::string& name, : AthAlgorithm(name, pSvcLocator), m_thistSvc(0), m_tree(0), - m_calo_noise_tool("CaloNoiseTool/CaloNoiseToolDefault"), m_bc_tool("Trig::TrigConfBunchCrossingTool/BunchCrossingTool"), m_trigDec( "Trig::TrigDecisionTool/TrigDecisionTool" ), m_LArOnlineIDHelper(0), @@ -218,7 +212,6 @@ LArNoiseBursts::LArNoiseBursts(const std::string& name, // NEW - declareProperty( "ICaloNoiseTool", m_calo_noise_tool ); declareProperty( "BCTool", m_bc_tool ); // declareProperty( "SCTClusteringTool",m_sctclustering_tool); @@ -276,6 +269,7 @@ StatusCode LArNoiseBursts::initialize() { ATH_CHECK( m_cablingKey.initialize() ); ATH_CHECK( m_BCKey.initialize() ); + ATH_CHECK( m_totalNoiseKey.initialize() ); // Retrieve online ID helper const LArOnlineID* LArOnlineIDHelper = nullptr; @@ -304,13 +298,6 @@ StatusCode LArNoiseBursts::initialize() { m_LArHEC_IDHelper = idHelper->hec_idHelper(); m_LArFCAL_IDHelper = idHelper->fcal_idHelper(); - if ( m_calo_noise_tool.retrieve().isFailure() ) { - ATH_MSG_WARNING ( "Failed to retrieve tool " << m_calo_noise_tool ); - }else{ - ATH_MSG_INFO ( "Retrieved tool " << m_calo_noise_tool ); - } - - /** get a handle on the NTuple and histogramming service */ ATH_CHECK( service("THistSvc", m_thistSvc) ); @@ -952,15 +939,16 @@ StatusCode LArNoiseBursts::doEventProperties(){ ////////////////////////////////////////////////////////////////////////////////////// StatusCode LArNoiseBursts::doLArNoiseBursts(){ ATH_MSG_DEBUG ( "in doLarCellInfo " ); + const EventContext& ctx = Gaudi::Hive::currentContext(); - SG::ReadCondHandle<LArOnOffIdMapping> larCablingHdl(m_cablingKey); + SG::ReadCondHandle<LArOnOffIdMapping> larCablingHdl (m_cablingKey, ctx); const LArOnOffIdMapping* cabling=*larCablingHdl; if(!cabling) { ATH_MSG_WARNING("Do not have cabling info, not storing LarCellInfo "); return StatusCode::SUCCESS; } - SG::ReadCondHandle<LArBadChannelCont> bcHdl(m_BCKey); + SG::ReadCondHandle<LArBadChannelCont> bcHdl (m_BCKey, ctx); const LArBadChannelCont* bcCont=*bcHdl; if(!bcCont) { ATH_MSG_WARNING("Do not have bad chan info, not storing LarCellInfo "); @@ -1002,6 +990,8 @@ StatusCode LArNoiseBursts::doLArNoiseBursts(){ float qfactor; CaloGain::CaloGain gain; + SG::ReadCondHandle<CaloNoise> totalNoise (m_totalNoiseKey, ctx); + if(caloTES) { CaloCellContainer::const_iterator caloItr; for(caloItr=caloTES->begin();caloItr!=caloTES->end();caloItr++){ @@ -1021,7 +1011,7 @@ StatusCode LArNoiseBursts::doLArNoiseBursts(){ qfactor = (*caloItr)->quality(); gain = (*caloItr)->gain(); //if(qfactor > 0. || (*caloItr)->ID() == Identifier((IDENTIFIER_TYPE)0x33c9500000000000) ) ATH_MSG_DEBUG((*caloItr)->ID()<<" : "<<eCalo<<" "<<qfactor<<" "<<gain<<" prov.: "<<(*caloItr)->provenance()); - ATH_CHECK(fillCell(onlID, eCalo, qfactor, gain, cabling, bcCont)); + ATH_CHECK(fillCell(onlID, eCalo, qfactor, gain, cabling, bcCont, **totalNoise)); }//loop over cells ATH_MSG_DEBUG("Done cells "<<nlarcell); } else { @@ -1036,7 +1026,7 @@ StatusCode LArNoiseBursts::doLArNoiseBursts(){ qfactor = caloItr->quality(); gain = caloItr->gain(); //if(qfactor>0 || cabling->cnvToIdentifier((*caloItr).identify()) == Identifier((IDENTIFIER_TYPE)0x33c9500000000000) ) ATH_MSG_DEBUG(cabling->cnvToIdentifier((*caloItr).identify())<<" : "<<eCalo<<" "<<qfactor<<" "<<gain); - ATH_CHECK(fillCell(onlID, eCalo, qfactor, gain, cabling, bcCont)); + ATH_CHECK(fillCell(onlID, eCalo, qfactor, gain, cabling, bcCont, **totalNoise)); chdone.push_back(onlID); }//loop over raw channels } @@ -1053,7 +1043,7 @@ StatusCode LArNoiseBursts::doLArNoiseBursts(){ qfactor = caloItr->quality(); gain = caloItr->gain(); //if(qfactor>0 || cabling->cnvToIdentifier((*caloItr).identify()) == Identifier((IDENTIFIER_TYPE)0x33c9500000000000) ) ATH_MSG_DEBUG(cabling->cnvToIdentifier((*caloItr).identify())<<" : "<<eCalo<<" "<<qfactor<<" "<<gain); - ATH_CHECK(fillCell(onlID, eCalo, qfactor, gain, cabling, bcCont)); + ATH_CHECK(fillCell(onlID, eCalo, qfactor, gain, cabling, bcCont, **totalNoise)); }//loop over raw channels } ATH_MSG_DEBUG("Done raw chan. "<<nlarcell); @@ -1178,7 +1168,9 @@ StatusCode LArNoiseBursts::doLArNoiseBursts(){ } -StatusCode LArNoiseBursts::fillCell(HWIdentifier onlID, float eCalo, float qfactor, CaloGain::CaloGain gain, const LArOnOffIdMapping* cabling, const LArBadChannelCont* bcCont){ +StatusCode LArNoiseBursts::fillCell(HWIdentifier onlID, float eCalo, float qfactor, CaloGain::CaloGain gain, const LArOnOffIdMapping* cabling, const LArBadChannelCont* bcCont, + const CaloNoise& totalNoise) +{ const Identifier idd = cabling->cnvToIdentifier(onlID); nlarcell++; IdentifierHash channelHash = m_LArOnlineIDHelper->channel_Hash(onlID); @@ -1186,10 +1178,7 @@ StatusCode LArNoiseBursts::fillCell(HWIdentifier onlID, float eCalo, float qfact int layer = caloDDE->getLayer(); // CaloCell_ID::CaloSample sampling = (*caloItr)->caloDDE()->getSampling(); float phi = caloDDE->phi(); - //float noise = m_calo_noise_tool->getNoise( (*caloItr), ICaloNoiseTool::TOTALNOISE ); - float noise = m_calo_noise_tool->totalNoiseRMS( caloDDE, gain); - //float noise = m_calo_noise_tool->elecNoiseRMS( (*caloItr), (*caloItr)->gain(),-1); - //float noise = m_calo_noise_tool->elecNoiseRMS( caloDDE, gain, -1); + float noise = totalNoise.getNoise (idd, gain); float significance = eCalo / noise ; float eta = caloDDE->eta(); bool badcell = ! (bcCont->status(onlID)).good(); diff --git a/LArCalorimeter/LArCafJobs/src/LArShapeDumper.cxx b/LArCalorimeter/LArCafJobs/src/LArShapeDumper.cxx index 8496228849160918ff6a99500998fb74737a243d..660a5cd1ba4877a8427dfca8cd9575996743f698 100755 --- a/LArCalorimeter/LArCafJobs/src/LArShapeDumper.cxx +++ b/LArCalorimeter/LArCafJobs/src/LArShapeDumper.cxx @@ -22,7 +22,6 @@ #include "CaloDetDescr/CaloDetDescrManager.h" #include "CaloDetDescr/CaloDetDescriptor.h" #include "CaloDetDescr/CaloDetDescrElement.h" -#include "CaloInterface/ICaloNoiseTool.h" #include "xAODEventInfo/EventInfo.h" #include "LArRecConditions/LArBadChannel.h" #include "LArCafJobs/DataContainer.h"