diff --git a/TileCalorimeter/TileCalib/TileCalibAlgs/CMakeLists.txt b/TileCalorimeter/TileCalib/TileCalibAlgs/CMakeLists.txt index b18cc3ddeacebd93835bb0f42f1c68a69819451c..5f99812d08b8af47aaeb690614d2f3b9601f7481 100644 --- a/TileCalorimeter/TileCalib/TileCalibAlgs/CMakeLists.txt +++ b/TileCalorimeter/TileCalib/TileCalibAlgs/CMakeLists.txt @@ -15,7 +15,7 @@ atlas_add_component( TileCalibAlgs src/Tile*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} ${CLHEP_LIBRARIES} CaloDetDescrLib CaloIdentifier AthenaBaseComps Identifier GaudiKernel TileConditionsLib TileIdentifier TrigT1CaloCalibToolInterfaces CaloEvent AthenaKernel StoreGateLib SGtests AthenaPoolUtilities ByteStreamCnvSvcBaseLib xAODEventInfo xAODTrigL1Calo TileCalibBlobObjs TileEvent TileRecUtilsLib TileByteStreamLib TileMonitoringLib RegistrationServicesLib ) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} ${CLHEP_LIBRARIES} CaloDetDescrLib CaloIdentifier AthenaBaseComps Identifier GaudiKernel TileConditionsLib TileIdentifier TrigT1CaloCalibToolInterfaces CaloEvent AthenaKernel StoreGateLib SGtests AthenaPoolUtilities ByteStreamCnvSvcBaseLib xAODEventInfo xAODTrigL1Calo TileCalibBlobObjs TileEvent TileRecUtilsLib TileByteStreamLib TileMonitoringLib RegistrationServicesLib CaloConditions ) # Install files from the package: atlas_install_headers( TileCalibAlgs ) diff --git a/TileCalorimeter/TileCalib/TileCalibAlgs/TileCalibAlgs/TileMuId2DBAlg.h b/TileCalorimeter/TileCalib/TileCalibAlgs/TileCalibAlgs/TileMuId2DBAlg.h index c93412d8159f9c2405bec2115a78ed93888a0a9f..4f256322c502ec5089d4855cc9f9b0ce851dce03 100644 --- a/TileCalorimeter/TileCalib/TileCalibAlgs/TileCalibAlgs/TileMuId2DBAlg.h +++ b/TileCalorimeter/TileCalib/TileCalibAlgs/TileCalibAlgs/TileMuId2DBAlg.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 */ //**************************************************************************** @@ -24,8 +24,8 @@ #include "CaloDetDescr/CaloDetDescrManager.h" #include "CaloIdentifier/CaloIdManager.h" #include "CaloIdentifier/CaloCell_ID.h" -#include "CaloInterface/ICaloNoiseTool.h" -#include "TileConditions/TileCellNoiseTool.h" +#include "CaloConditions/CaloNoise.h" +#include "StoreGate/ReadCondHandleKey.h" class TileMuId2DBAlg: public AthAlgorithm { @@ -33,26 +33,18 @@ class TileMuId2DBAlg: public AthAlgorithm { TileMuId2DBAlg(const std::string& name, ISvcLocator* pSvcLocator); - ~TileMuId2DBAlg(); + virtual ~TileMuId2DBAlg(); - StatusCode initialize(); - StatusCode execute(); - StatusCode finalize(); + virtual StatusCode initialize() override; + virtual StatusCode execute() override; + virtual StatusCode finalize() override; private: const CaloCell_ID* m_calo_id; - const DataHandle<CaloIdManager> m_caloIdMgr; - const DataHandle<CaloDetDescrManager> m_calodetdescrmgr; - - PublicToolHandle<ICaloNoiseTool> m_noiseTool{this, - "noiseTool", "CaloNoiseToolDB/calonoisetooldb", "Calo noise tool"}; - - //float m_eta; - //float m_phi; - float m_noise; - int m_module; + SG::ReadCondHandleKey<CaloNoise> m_totalNoiseKey + { this, "TotalNoiseKey", "totalNoise", "SG key for total noise" }; }; #endif // TileCalibAlgs_TileMuId2DBAlg_h diff --git a/TileCalorimeter/TileCalib/TileCalibAlgs/share/jobOptions_TileMuId2DBTest.py b/TileCalorimeter/TileCalib/TileCalibAlgs/share/jobOptions_TileMuId2DBTest.py index 20bd71ea2bc2105e36c6a3a92d1c9e3d52d39eb9..0f2c465cdb3f6c6d489be8a97b15578b1b5197e4 100644 --- a/TileCalorimeter/TileCalib/TileCalibAlgs/share/jobOptions_TileMuId2DBTest.py +++ b/TileCalorimeter/TileCalib/TileCalibAlgs/share/jobOptions_TileMuId2DBTest.py @@ -55,18 +55,16 @@ include( "TileConditions/TileConditions_jobOptions.py" ) include( "LArConditionsCommon/LArConditionsCommon_comm_jobOptions.py") #============================================================= -# Add CaloNoiseToolDefault +# Add CaloNoise #============================================================= -from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault -theCaloNoiseTool = CaloNoiseToolDefault() -ToolSvc += theCaloNoiseTool +from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg +CaloNoiseCondAlg ('totalNoise') #============================================================ # Add TileMuId2DBAlg #============================================================ from TileCalibAlgs.TileCalibAlgsConf import TileMuId2DBAlg theTileMuId2DBAlg = TileMuId2DBAlg("TileMuId2DBAlg") -theTileMuId2DBAlg.noiseTool = theCaloNoiseTool topSequence += theTileMuId2DBAlg #============================================================ diff --git a/TileCalorimeter/TileCalib/TileCalibAlgs/src/TileMuId2DBAlg.cxx b/TileCalorimeter/TileCalib/TileCalibAlgs/src/TileMuId2DBAlg.cxx index 07c3b06f144759ae100b583ad2c994b947add529..ec369b32df15e87d051f2fa44340a31278e04fed 100644 --- a/TileCalorimeter/TileCalib/TileCalibAlgs/src/TileMuId2DBAlg.cxx +++ b/TileCalorimeter/TileCalib/TileCalibAlgs/src/TileMuId2DBAlg.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 */ //***************************************************************************** @@ -11,7 +11,6 @@ // // Individual lower energy thresholds for each cell are computed as three // times the noise RMS value of the cell when the two PMTs are in High Gain -// using CaloNoiseToolDB tool. // // For DSP usage, thresholds in MeV are multiply by 2 and round off in order // to compare them with reconstructed energies at the DSP which have a 0.5 MeV @@ -25,6 +24,8 @@ //***************************************************************************** #include "TileCalibAlgs/TileMuId2DBAlg.h" +#include "CaloIdentifier/CaloGain.h" +#include "StoreGate/ReadCondHandle.h" #include <fstream> @@ -33,9 +34,7 @@ using namespace std; TileMuId2DBAlg::TileMuId2DBAlg(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name,pSvcLocator), - m_calo_id(0), - m_noise(0.0), - m_module(0) + m_calo_id(0) { } @@ -49,11 +48,11 @@ TileMuId2DBAlg::~TileMuId2DBAlg() StatusCode TileMuId2DBAlg::initialize() { - ATH_CHECK( detStore()->retrieve( m_caloIdMgr ) ); - m_calo_id = m_caloIdMgr->getCaloCell_ID(); + const CaloIdManager* caloIdMgr = nullptr; + ATH_CHECK( detStore()->retrieve( caloIdMgr ) ); + m_calo_id = caloIdMgr->getCaloCell_ID(); - ATH_CHECK( detStore()->retrieve(m_calodetdescrmgr) ); - ATH_CHECK( m_noiseTool.retrieve() ); + ATH_CHECK( m_totalNoiseKey.initialize() ); return StatusCode::SUCCESS; } @@ -91,29 +90,28 @@ StatusCode TileMuId2DBAlg::execute() ATH_MSG_INFO ( "caloCellMax: " << caloCellMax ); ATH_MSG_INFO ( "Start loop over TileCal cells " << caloCellMax-caloCellMin ); + SG::ReadCondHandle<CaloNoise> totalNoise (m_totalNoiseKey); + for (unsigned int i=caloCellMin;i<caloCellMax;i++) { IdentifierHash idHash = i; Identifier id = m_calo_id->cell_id(idHash); - const CaloDetDescrElement* calodde = m_calodetdescrmgr->get_element(id); int subCalo; IdentifierHash idSubHash = m_calo_id->subcalo_cell_hash (idHash, subCalo); - //m_eta = calodde->eta(); - //m_phi = calodde->phi(); - m_module = m_calo_id->module(id); + int module = m_calo_id->module(id); CaloGain::CaloGain gain=CaloGain::TILEHIGHHIGH; - m_noise = m_noiseTool->totalNoiseRMS(calodde,gain); + float cell_noise = totalNoise->getNoise(id,gain); - if( m_calo_id->is_tile_barrel(id) && m_calo_id->is_tile_negative(id) ) noise[1][m_module][idSubHash-22*m_module] = 3*m_noise; + if( m_calo_id->is_tile_barrel(id) && m_calo_id->is_tile_negative(id) ) noise[1][module][idSubHash-22*module] = 3*cell_noise; - if( m_calo_id->is_tile_barrel(id) && m_calo_id->is_tile_positive(id) ) noise[0][m_module][idSubHash-(23*m_module+22*64)] = 3*m_noise; + if( m_calo_id->is_tile_barrel(id) && m_calo_id->is_tile_positive(id) ) noise[0][module][idSubHash-(23*module+22*64)] = 3*cell_noise; - if( m_calo_id->is_tile_extbarrel(id) && m_calo_id->is_tile_negative(id) ) noise[3][m_module][idSubHash-(12*m_module+23*64+22*64)] = 3*m_noise; + if( m_calo_id->is_tile_extbarrel(id) && m_calo_id->is_tile_negative(id) ) noise[3][module][idSubHash-(12*module+23*64+22*64)] = 3*cell_noise; - if( m_calo_id->is_tile_extbarrel(id) && m_calo_id->is_tile_positive(id) ) noise[2][m_module][idSubHash-(12*m_module+12*64+23*64+22*64)] = 3*m_noise; + if( m_calo_id->is_tile_extbarrel(id) && m_calo_id->is_tile_positive(id) ) noise[2][module][idSubHash-(12*module+12*64+23*64+22*64)] = 3*cell_noise; }