Skip to content
Snippets Groups Projects
Commit 27ccd209 authored by Adam Edward Barton's avatar Adam Edward Barton
Browse files

Merge branch 'noisetool.TileCalibAlgs-20210324' into 'master'

TileCalibAlgs: Migrate from CaloNoiseTool to CaloNoise.

See merge request !41949
parents 0aca983c ece4923e
No related branches found
No related tags found
6 merge requests!58791DataQualityConfigurations: Modify L1Calo config for web display,!46784MuonCondInterface: Enable thread-safety checking.,!46776Updated LArMonitoring config file for WD to match new files produced using MT,!45405updated ART test cron job,!42417Draft: DIRE and VINCIA Base Fragments for Pythia 8.3,!41949TileCalibAlgs: Migrate from CaloNoiseTool to CaloNoise.
...@@ -15,7 +15,7 @@ atlas_add_component( TileCalibAlgs ...@@ -15,7 +15,7 @@ atlas_add_component( TileCalibAlgs
src/Tile*.cxx src/Tile*.cxx
src/components/*.cxx src/components/*.cxx
INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} 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: # Install files from the package:
atlas_install_headers( TileCalibAlgs ) atlas_install_headers( TileCalibAlgs )
......
/* /*
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 @@ ...@@ -24,8 +24,8 @@
#include "CaloDetDescr/CaloDetDescrManager.h" #include "CaloDetDescr/CaloDetDescrManager.h"
#include "CaloIdentifier/CaloIdManager.h" #include "CaloIdentifier/CaloIdManager.h"
#include "CaloIdentifier/CaloCell_ID.h" #include "CaloIdentifier/CaloCell_ID.h"
#include "CaloInterface/ICaloNoiseTool.h" #include "CaloConditions/CaloNoise.h"
#include "TileConditions/TileCellNoiseTool.h" #include "StoreGate/ReadCondHandleKey.h"
class TileMuId2DBAlg: public AthAlgorithm { class TileMuId2DBAlg: public AthAlgorithm {
...@@ -33,26 +33,18 @@ class TileMuId2DBAlg: public AthAlgorithm { ...@@ -33,26 +33,18 @@ class TileMuId2DBAlg: public AthAlgorithm {
TileMuId2DBAlg(const std::string& name, ISvcLocator* pSvcLocator); TileMuId2DBAlg(const std::string& name, ISvcLocator* pSvcLocator);
~TileMuId2DBAlg(); virtual ~TileMuId2DBAlg();
StatusCode initialize(); virtual StatusCode initialize() override;
StatusCode execute(); virtual StatusCode execute() override;
StatusCode finalize(); virtual StatusCode finalize() override;
private: private:
const CaloCell_ID* m_calo_id; const CaloCell_ID* m_calo_id;
const DataHandle<CaloIdManager> m_caloIdMgr; SG::ReadCondHandleKey<CaloNoise> m_totalNoiseKey
const DataHandle<CaloDetDescrManager> m_calodetdescrmgr; { this, "TotalNoiseKey", "totalNoise", "SG key for total noise" };
PublicToolHandle<ICaloNoiseTool> m_noiseTool{this,
"noiseTool", "CaloNoiseToolDB/calonoisetooldb", "Calo noise tool"};
//float m_eta;
//float m_phi;
float m_noise;
int m_module;
}; };
#endif // TileCalibAlgs_TileMuId2DBAlg_h #endif // TileCalibAlgs_TileMuId2DBAlg_h
...@@ -55,18 +55,16 @@ include( "TileConditions/TileConditions_jobOptions.py" ) ...@@ -55,18 +55,16 @@ include( "TileConditions/TileConditions_jobOptions.py" )
include( "LArConditionsCommon/LArConditionsCommon_comm_jobOptions.py") include( "LArConditionsCommon/LArConditionsCommon_comm_jobOptions.py")
#============================================================= #=============================================================
# Add CaloNoiseToolDefault # Add CaloNoise
#============================================================= #=============================================================
from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg
theCaloNoiseTool = CaloNoiseToolDefault() CaloNoiseCondAlg ('totalNoise')
ToolSvc += theCaloNoiseTool
#============================================================ #============================================================
# Add TileMuId2DBAlg # Add TileMuId2DBAlg
#============================================================ #============================================================
from TileCalibAlgs.TileCalibAlgsConf import TileMuId2DBAlg from TileCalibAlgs.TileCalibAlgsConf import TileMuId2DBAlg
theTileMuId2DBAlg = TileMuId2DBAlg("TileMuId2DBAlg") theTileMuId2DBAlg = TileMuId2DBAlg("TileMuId2DBAlg")
theTileMuId2DBAlg.noiseTool = theCaloNoiseTool
topSequence += theTileMuId2DBAlg topSequence += theTileMuId2DBAlg
#============================================================ #============================================================
......
/* /*
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 @@ ...@@ -11,7 +11,6 @@
// //
// Individual lower energy thresholds for each cell are computed as three // 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 // 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 // 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 // to compare them with reconstructed energies at the DSP which have a 0.5 MeV
...@@ -25,6 +24,8 @@ ...@@ -25,6 +24,8 @@
//***************************************************************************** //*****************************************************************************
#include "TileCalibAlgs/TileMuId2DBAlg.h" #include "TileCalibAlgs/TileMuId2DBAlg.h"
#include "CaloIdentifier/CaloGain.h"
#include "StoreGate/ReadCondHandle.h"
#include <fstream> #include <fstream>
...@@ -33,9 +34,7 @@ using namespace std; ...@@ -33,9 +34,7 @@ using namespace std;
TileMuId2DBAlg::TileMuId2DBAlg(const std::string& name, ISvcLocator* pSvcLocator) : TileMuId2DBAlg::TileMuId2DBAlg(const std::string& name, ISvcLocator* pSvcLocator) :
AthAlgorithm(name,pSvcLocator), AthAlgorithm(name,pSvcLocator),
m_calo_id(0), m_calo_id(0)
m_noise(0.0),
m_module(0)
{ {
} }
...@@ -49,11 +48,11 @@ TileMuId2DBAlg::~TileMuId2DBAlg() ...@@ -49,11 +48,11 @@ TileMuId2DBAlg::~TileMuId2DBAlg()
StatusCode TileMuId2DBAlg::initialize() StatusCode TileMuId2DBAlg::initialize()
{ {
ATH_CHECK( detStore()->retrieve( m_caloIdMgr ) ); const CaloIdManager* caloIdMgr = nullptr;
m_calo_id = m_caloIdMgr->getCaloCell_ID(); ATH_CHECK( detStore()->retrieve( caloIdMgr ) );
m_calo_id = caloIdMgr->getCaloCell_ID();
ATH_CHECK( detStore()->retrieve(m_calodetdescrmgr) ); ATH_CHECK( m_totalNoiseKey.initialize() );
ATH_CHECK( m_noiseTool.retrieve() );
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
...@@ -91,29 +90,28 @@ StatusCode TileMuId2DBAlg::execute() ...@@ -91,29 +90,28 @@ StatusCode TileMuId2DBAlg::execute()
ATH_MSG_INFO ( "caloCellMax: " << caloCellMax ); ATH_MSG_INFO ( "caloCellMax: " << caloCellMax );
ATH_MSG_INFO ( "Start loop over TileCal cells " << caloCellMax-caloCellMin ); ATH_MSG_INFO ( "Start loop over TileCal cells " << caloCellMax-caloCellMin );
SG::ReadCondHandle<CaloNoise> totalNoise (m_totalNoiseKey);
for (unsigned int i=caloCellMin;i<caloCellMax;i++) { for (unsigned int i=caloCellMin;i<caloCellMax;i++) {
IdentifierHash idHash = i; IdentifierHash idHash = i;
Identifier id = m_calo_id->cell_id(idHash); Identifier id = m_calo_id->cell_id(idHash);
const CaloDetDescrElement* calodde = m_calodetdescrmgr->get_element(id);
int subCalo; int subCalo;
IdentifierHash idSubHash = m_calo_id->subcalo_cell_hash (idHash, subCalo); IdentifierHash idSubHash = m_calo_id->subcalo_cell_hash (idHash, subCalo);
//m_eta = calodde->eta(); int module = m_calo_id->module(id);
//m_phi = calodde->phi();
m_module = m_calo_id->module(id);
CaloGain::CaloGain gain=CaloGain::TILEHIGHHIGH; 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;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment