diff --git a/LArCalorimeter/LArExample/TestLArDetDescr/TestLArDetDescr/TestLArTT.h b/LArCalorimeter/LArExample/TestLArDetDescr/TestLArDetDescr/TestLArTT.h deleted file mode 100755 index 140e66caa340dc8f82954778e4489930cad564fc..0000000000000000000000000000000000000000 --- a/LArCalorimeter/LArExample/TestLArDetDescr/TestLArDetDescr/TestLArTT.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TESTLARDETDESCR_TESTLARTT_H -#define TESTLARDETDESCR_TESTLARTT_H - -/******************************************************************** - -NAME: TestLArTT.h -PACKAGE: offline/LArCalorimeter/LArExample/TestLArDetDescr - -AUTHORS: Claire Adam-Bourdarios -CREATED: Feb 2003 - -PURPOSE: provide example to retreive CaloTTDetDescr manager and - TTregions from StoreGate and test them. - -********************************************************************/ -// INCLUDE HEADER FILES: -#include "AthenaBaseComps/AthAlgorithm.h" - -class CaloTTDescrManager; - -class TestLArTT : public AthAlgorithm -{ - public: - - // constructor - TestLArTT(const std::string& name, ISvcLocator* pSvcLocator); - // destructor - virtual ~TestLArTT(); - - virtual StatusCode initialize(); - virtual StatusCode finalize(); - virtual StatusCode execute(); - - void print_reg(bool em, bool hec, bool fcal, bool tile); - - protected: - const CaloTTDescrManager* m_tt_man; -}; - -#endif - -//end of TESTLARDETDESCR_TESTLARTT - - - - - - - diff --git a/LArCalorimeter/LArExample/TestLArDetDescr/src/TestCaloGeom.cxx b/LArCalorimeter/LArExample/TestLArDetDescr/src/TestCaloGeom.cxx index 8b723c03765324368c4ddce2e43561f8b201c3c9..39ca07d806981e0a332d857bf78ddf5e75f97d1a 100755 --- a/LArCalorimeter/LArExample/TestLArDetDescr/src/TestCaloGeom.cxx +++ b/LArCalorimeter/LArExample/TestLArDetDescr/src/TestCaloGeom.cxx @@ -1,9 +1,9 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // INCLUDE HEADER FILES: -#include "TestLArDetDescr/TestCaloGeom.h" +#include "TestCaloGeom.h" // Athena related #include "GaudiKernel/MsgStream.h" @@ -20,7 +20,6 @@ // specific : #include "CaloIdentifier/CaloCell_ID.h" -#include "CaloDetDescr/CaloDetDescrManager.h" #include "CaloDetDescr/CaloDetDescrElement.h" #include "CaloGeoHelpers/CaloPhiRange.h" #include "CaloDetDescr/ICaloCoordinateTool.h" @@ -31,9 +30,8 @@ // Constructor // ------------------------------------------------------------- TestCaloGeom::TestCaloGeom(const std::string& name, - ISvcLocator* pSvcLocator): + ISvcLocator* pSvcLocator): AthAlgorithm(name, pSvcLocator), - m_calo_dd_man(0), m_coord("TBCaloCoordinate") {} @@ -44,7 +42,6 @@ TestCaloGeom::~TestCaloGeom() // INITIALIZE: StatusCode TestCaloGeom::initialize() { - m_calo_dd_man = CaloDetDescrManager::instance(); ATH_CHECK( m_coord.retrieve() ); return StatusCode::SUCCESS; } @@ -69,164 +66,6 @@ StatusCode TestCaloGeom::execute() return StatusCode::SUCCESS; } -void -TestCaloGeom::print_elt(bool em, bool hec, bool fcal, bool tile) -{ - boost::io::ios_base_all_saver coutsave (std::cout); - - ATH_MSG_INFO ( " printing CaloDDE characteristics " ); - - IdentifierHash idcalohash,hash_min,hash_max ; - Identifier id; - - const CaloCell_ID* help_all = m_calo_dd_man->getCaloCell_ID(); - - // - // Now loop on CaloCell: - // - - int phi_num = 1; - - help_all->calo_cell_hash_range( (int) CaloCell_ID::LAREM , - hash_min, hash_max); - - std::cout << " ---- EM hash range is " << hash_min << " to " - << hash_max << std::endl; - - for ( unsigned int i = (unsigned int) hash_min ; - i < (unsigned int) hash_max ; i++ ) - { - idcalohash = (IdentifierHash) i; - id = help_all->cell_id(idcalohash); - - const CaloDetDescrElement* newelt = m_calo_dd_man->get_element(idcalohash); - if ( !newelt ) std::cout << "missing em element" - << i << std::endl; - - else if ( em && help_all->phi(id) == phi_num && newelt->eta() >=0) { - double x_local = newelt->x(); - double y_local = newelt->y(); - double z_local = newelt->z(); - double x,y,z; - std::cout << std::setw(9) << std::setprecision(4) - << "calo-hash=" << i << " region: " - << help_all->sampling(id)<< " " - << help_all->region(id)<< " " - << " ieta= " << help_all->eta(id) - << " " << newelt->eta() - << " phi= " << newelt->phi() - << " r= " << newelt->r() - << std::endl; - - m_coord->local_to_ctb(x_local,y_local,z_local,x,y,z); - double r = sqrt ( x*x+y*y); - double bigr = sqrt ( x*x+y*y+z*z); - double eta_ctb = -std::log((bigr-z)/r); - std::cout << std::setw(9) << std::setprecision(4) - << "new cell eta_ctb=" << eta_ctb - << std::endl; - } - } - - - help_all->calo_cell_hash_range( (int) CaloCell_ID::LARHEC , - hash_min, hash_max); - - std::cout << " ---- HEC hash range is " << hash_min << " to " - << hash_max << std::endl; - - for ( unsigned int i = (unsigned int) hash_min ; - i < (unsigned int) hash_max ; i++ ) - { - idcalohash = (IdentifierHash) i; - id = help_all->cell_id(idcalohash); - - const CaloDetDescrElement* newelt = m_calo_dd_man->get_element(idcalohash); - if ( !newelt ) - std::cout << "missing hec element" - << i << std::endl; - - else if ( hec && help_all->phi(id) == phi_num && newelt->eta() >=0) { - std::cout << std::setw(9) << std::setprecision(4) - << "calo-hash=" << i << " region: " - << help_all->sampling(id)<< " " - << help_all->region(id)<< " " - << " ieta= " << help_all->eta(id) - << " elt: " << newelt->eta() - << " phi= " << newelt->phi() - << " r= " << newelt->r() - << std::endl; - } - } - - help_all->calo_cell_hash_range( (int) CaloCell_ID::LARFCAL , - hash_min, hash_max); - - std::cout << " ---- FCAL hash range is " << hash_min << " to " - << hash_max << std::endl; - - for ( unsigned int i = (unsigned int) hash_min ; - i < (unsigned int) hash_max ; i++ ) - { - idcalohash = (IdentifierHash) i; - id = help_all->cell_id(idcalohash); - - const CaloDetDescrElement* newelt = m_calo_dd_man->get_element(idcalohash); - if ( !newelt ) std::cout << "missing fcal element" - << i << std::endl; - - else if (fcal && help_all->phi(id) == phi_num && - help_all->pos_neg(id) >=0) { - - std::cout << std::setw(9) << std::setprecision(4) - << "calo-hash=" << i << " region: " - << help_all-> module(id)<< " " - << " ieta= " << help_all->eta(id) - << " " << newelt->eta() - << " phi= " << newelt->phi() - << " x,y,z " << newelt->x()<< " " << newelt->y() - << " " << newelt->z() - << std::endl; - - } - - } - - if (tile) { - - help_all->calo_cell_hash_range( (int) CaloCell_ID::TILE , - hash_min, hash_max); - - std::cout << " ---- Tile hash range is " << hash_min << " to " - << hash_max << std::endl; - - for ( unsigned int i = (unsigned int) hash_min ; - i < (unsigned int) hash_max ; i++ ) - { - idcalohash = (IdentifierHash) i; - id = help_all->cell_id(idcalohash); - - const CaloDetDescrElement* newelt = m_calo_dd_man->get_element(idcalohash); - if ( !newelt ) std::cout << "missing Tile element" - << i << std::endl; - - else if (tile && help_all->phi(id) == phi_num && - help_all->pos_neg(id) >=0) { - - std::cout << std::setw(9) << std::setprecision(4) - << "calo-hash=" << i - << " ieta= " << help_all->eta(id) - << " " << newelt->eta() - << " phi= " << newelt->phi() - << " x,y,z " << newelt->x()<< " " << newelt->y() - << " " << newelt->z() - << std::endl; - - } - } - } -} - void TestCaloGeom::print_beam() { diff --git a/LArCalorimeter/LArExample/TestLArDetDescr/TestLArDetDescr/TestCaloGeom.h b/LArCalorimeter/LArExample/TestLArDetDescr/src/TestCaloGeom.h similarity index 50% rename from LArCalorimeter/LArExample/TestLArDetDescr/TestLArDetDescr/TestCaloGeom.h rename to LArCalorimeter/LArExample/TestLArDetDescr/src/TestCaloGeom.h index 1999eaa75edc6d0b5da0c8ab2388f63a90b33e97..120d1bac7036f255f52e6080a17028b50564d9e2 100755 --- a/LArCalorimeter/LArExample/TestLArDetDescr/TestLArDetDescr/TestCaloGeom.h +++ b/LArCalorimeter/LArExample/TestLArDetDescr/src/TestCaloGeom.h @@ -1,26 +1,24 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #ifndef TESTLARDETDESCR_TESTCALOGEOM_H #define TESTLARDETDESCR_TESTCALOGEOM_H -/******************************************************************** +/** + * + * @file TestCaloGeom.h + * @author Claire Adam-Bourdarios + * @date Sept 2004 + * + * @brief provide example to play with the H8 CTB geometry. + * + */ -NAME: TestCaloGeom.h -PACKAGE: offline/LArCalorimeter/LArExample/TestLArDetDescr - -AUTHORS: Claire Adam-Bourdarios -CREATED: Sept 2004 - -PURPOSE: provide example to play with the H8 CTB geometry. - -********************************************************************/ // INCLUDE HEADER FILES: #include "AthenaBaseComps/AthAlgorithm.h" #include "GaudiKernel/ToolHandle.h" -class CaloDetDescrManager; class ICaloCoordinateTool; class TestCaloGeom : public AthAlgorithm @@ -32,15 +30,14 @@ class TestCaloGeom : public AthAlgorithm // destructor virtual ~TestCaloGeom(); - virtual StatusCode initialize(); - virtual StatusCode finalize(); - virtual StatusCode execute(); + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; + virtual StatusCode execute() override; void print_elt(bool em, bool hec, bool fcal, bool tile); void print_beam(); protected: - const CaloDetDescrManager* m_calo_dd_man; ToolHandle<ICaloCoordinateTool> m_coord; }; diff --git a/LArCalorimeter/LArExample/TestLArDetDescr/src/TestLArMaterial.cxx b/LArCalorimeter/LArExample/TestLArDetDescr/src/TestLArMaterial.cxx index 65184a941833533212a0cf2e407d8a5924bc13cb..82bc38193bccf7f0df4f10ce0eb8322be3ba9015 100755 --- a/LArCalorimeter/LArExample/TestLArDetDescr/src/TestLArMaterial.cxx +++ b/LArCalorimeter/LArExample/TestLArDetDescr/src/TestLArMaterial.cxx @@ -3,7 +3,7 @@ */ // INCLUDE HEADER FILES: -#include "TestLArDetDescr/TestLArMaterial.h" +#include "TestLArMaterial.h" // Athena related #include "Gaudi/Property.h" @@ -19,7 +19,6 @@ // specific : #include "CaloIdentifier/CaloCell_ID.h" -#include "CaloDetDescr/CaloDetDescrManager.h" #include "CaloDetDescr/CaloDetDescrElement.h" #include "CaloGeoHelpers/CaloPhiRange.h" #include "CaloDetDescr/ICaloRecoMaterialTool.h" @@ -35,7 +34,6 @@ TestLArMaterial::TestLArMaterial(const std::string& name, ISvcLocator* pSvcLocator): AthAlgorithm(name, pSvcLocator), - m_calo_dd_man(0), m_surfbuild(0), m_lar_names(0), m_lar_mat(0) @@ -48,7 +46,7 @@ TestLArMaterial::~TestLArMaterial() // INITIALIZE: StatusCode TestLArMaterial::initialize() { - m_calo_dd_man = CaloDetDescrManager::instance(); + ATH_CHECK(m_readCondKey.initialize()); return StatusCode::SUCCESS; } @@ -99,10 +97,17 @@ TestLArMaterial::print_elt(bool em, bool hec, bool fcal, bool tile) ATH_MSG_INFO ( " printing CaloDDE characteristics " ); + SG::ReadCondHandle<CaloDetDescrManager> readCondHandle{m_readCondKey}; + const CaloDetDescrManager* caloMgr = *readCondHandle; + if(!caloMgr) { + ATH_MSG_FATAL("Failed to get CaloDetDescrManager from Condition Store"); + return; + } + IdentifierHash idcalohash,hash_min,hash_max ; Identifier id; - const CaloCell_ID* help_all = m_calo_dd_man->getCaloCell_ID(); + const CaloCell_ID* help_all = caloMgr->getCaloCell_ID(); // // Now loop on CaloCell: @@ -122,7 +127,7 @@ TestLArMaterial::print_elt(bool em, bool hec, bool fcal, bool tile) idcalohash = (IdentifierHash) i; id = help_all->cell_id(idcalohash); - const CaloDetDescrElement* newelt = m_calo_dd_man->get_element(idcalohash); + const CaloDetDescrElement* newelt = caloMgr->get_element(idcalohash); if ( !newelt ) std::cout << "missing em element" << i << std::endl; @@ -156,7 +161,7 @@ TestLArMaterial::print_elt(bool em, bool hec, bool fcal, bool tile) idcalohash = (IdentifierHash) i; id = help_all->cell_id(idcalohash); - const CaloDetDescrElement* newelt = m_calo_dd_man->get_element(idcalohash); + const CaloDetDescrElement* newelt = caloMgr->get_element(idcalohash); if ( !newelt ) std::cout << "missing hec element" << i << std::endl; @@ -186,7 +191,7 @@ TestLArMaterial::print_elt(bool em, bool hec, bool fcal, bool tile) idcalohash = (IdentifierHash) i; id = help_all->cell_id(idcalohash); - const CaloDetDescrElement* newelt = m_calo_dd_man->get_element(idcalohash); + const CaloDetDescrElement* newelt = caloMgr->get_element(idcalohash); if ( !newelt ) std::cout << "missing fcal element" << i << std::endl; @@ -221,7 +226,7 @@ TestLArMaterial::print_elt(bool em, bool hec, bool fcal, bool tile) idcalohash = (IdentifierHash) i; id = help_all->cell_id(idcalohash); - const CaloDetDescrElement* newelt = m_calo_dd_man->get_element(idcalohash); + const CaloDetDescrElement* newelt = caloMgr->get_element(idcalohash); if ( !newelt ) std::cout << "missing Tile element" << i << std::endl; diff --git a/LArCalorimeter/LArExample/TestLArDetDescr/TestLArDetDescr/TestLArMaterial.h b/LArCalorimeter/LArExample/TestLArDetDescr/src/TestLArMaterial.h similarity index 53% rename from LArCalorimeter/LArExample/TestLArDetDescr/TestLArDetDescr/TestLArMaterial.h rename to LArCalorimeter/LArExample/TestLArDetDescr/src/TestLArMaterial.h index 5c6692245ab92add145dd3843e78ae7ee1011454..a110da9c7b00f86e7cb1c38f7de7d2c8a8815c08 100755 --- a/LArCalorimeter/LArExample/TestLArDetDescr/TestLArDetDescr/TestLArMaterial.h +++ b/LArCalorimeter/LArExample/TestLArDetDescr/src/TestLArMaterial.h @@ -1,26 +1,24 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #ifndef TESTLARDETDESCR_TESTLARMATERIAL_H #define TESTLARDETDESCR_TESTLARMATERIAL_H -/******************************************************************** +/** + * @file TestLArMaterial.h + * @author Claire Adam-Bourdarios + * @date Sept 2004 + * + * @brief provide example to play with the H8 CTB geometry. + */ -NAME: TestLArMaterial.h -PACKAGE: offline/LArCalorimeter/LArExample/TestLArDetDescr - -AUTHORS: Claire Adam-Bourdarios -CREATED: Sept 2004 - -PURPOSE: provide example to play with the H8 CTB geometry. - -********************************************************************/ // INCLUDE HEADER FILES: #include "AthenaBaseComps/AthAlgorithm.h" #include "CaloDetDescr/CaloSubdetNames.h" +#include "CaloDetDescr/CaloDetDescrManager.h" +#include "StoreGate/ReadCondHandleKey.h" -class CaloDetDescrManager; class ICaloRecoMaterialTool; class ICaloSurfaceBuilder; @@ -33,16 +31,20 @@ class TestLArMaterial : public AthAlgorithm // destructor virtual ~TestLArMaterial(); - virtual StatusCode initialize(); - virtual StatusCode finalize(); - virtual StatusCode execute(); + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; + virtual StatusCode execute() override; void print_elt(bool em, bool hec, bool fcal, bool tile); void print_Layers(); protected: - const CaloDetDescrManager* m_calo_dd_man; + SG::ReadCondHandleKey<CaloDetDescrManager> m_readCondKey { this + , "CaloDetDescrManager" + , "CaloDetDescrManager" + , "SG Key for CaloDetDescrManager in the Condition Store" }; + ICaloSurfaceBuilder* m_surfbuild; CaloSubdetNames* m_lar_names; ICaloRecoMaterialTool* m_lar_mat; diff --git a/LArCalorimeter/LArExample/TestLArDetDescr/src/TestLArTT.cxx b/LArCalorimeter/LArExample/TestLArDetDescr/src/TestLArTT.cxx index 07eda3a9d188e921992f37eb1d49eba5d499da10..6b175dca08bc91798dd30e594ab508a37a8117ce 100755 --- a/LArCalorimeter/LArExample/TestLArDetDescr/src/TestLArTT.cxx +++ b/LArCalorimeter/LArExample/TestLArDetDescr/src/TestLArTT.cxx @@ -1,9 +1,9 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-20211 CERN for the benefit of the ATLAS collaboration */ // INCLUDE HEADER FILES: -#include "TestLArDetDescr/TestLArTT.h" +#include "TestLArTT.h" // Athena related #include "GaudiKernel/MsgStream.h" @@ -13,21 +13,16 @@ #include "CLHEP/Units/SystemOfUnits.h" // specific : -#include "CaloDetDescr/CaloDetDescrManager.h" #include "CaloTTDetDescr/CaloTTDescrManager.h" #include "CaloTTDetDescr/CaloTTDescriptor.h" -// looking for Volumes : -//#include "LArDetDescr/ILArVolumeTool.h" -//#include "GaudiKernel/IToolSvc.h" - // ------------------------------------------------------------- // Constructor // ------------------------------------------------------------- TestLArTT::TestLArTT(const std::string& name, ISvcLocator* pSvcLocator): AthAlgorithm(name, pSvcLocator), - m_tt_man(0) + m_tt_man(nullptr) {} // DESTRUCTOR: @@ -51,13 +46,13 @@ StatusCode TestLArTT::finalize() // EXECUTE: StatusCode TestLArTT::execute() { - print_reg( false, true, true, false ); + print_reg(); return StatusCode::SUCCESS; } void -TestLArTT::print_reg(bool /*em*/, bool /*hec*/, bool /*fcal*/, bool /*tiles*/) +TestLArTT::print_reg() { ATH_MSG_INFO ( "Executing TestLArTT" ); diff --git a/LArCalorimeter/LArExample/TestLArDetDescr/src/TestLArTT.h b/LArCalorimeter/LArExample/TestLArDetDescr/src/TestLArTT.h new file mode 100755 index 0000000000000000000000000000000000000000..4e22ff5fdd2b9bc3c1c376cf845dcd85871f7213 --- /dev/null +++ b/LArCalorimeter/LArExample/TestLArDetDescr/src/TestLArTT.h @@ -0,0 +1,49 @@ +/* + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TESTLARDETDESCR_TESTLARTT_H +#define TESTLARDETDESCR_TESTLARTT_H + +/** + * @file TestLArTT.h + * @author Claire Adam-Bourdarios + * @date Feb 2003 + * @brief provide example to retreive CaloTTDetDescr manager and + * TTregions from StoreGate and test them. + */ + +// INCLUDE HEADER FILES: +#include "AthenaBaseComps/AthAlgorithm.h" + +class CaloTTDescrManager; + +class TestLArTT : public AthAlgorithm +{ + public: + + // constructor + TestLArTT(const std::string& name, ISvcLocator* pSvcLocator); + // destructor + virtual ~TestLArTT(); + + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; + virtual StatusCode execute() override; + + void print_reg(); + + protected: + const CaloTTDescrManager* m_tt_man; +}; + +#endif + +//end of TESTLARDETDESCR_TESTLARTT + + + + + + + diff --git a/LArCalorimeter/LArExample/TestLArDetDescr/src/components/TestLArDetDescr_entries.cxx b/LArCalorimeter/LArExample/TestLArDetDescr/src/components/TestLArDetDescr_entries.cxx index c58a60e36827256e5e7e80376030b495f75468db..c5aff032da7b9be14ea27a520db41af5ad9c50fe 100644 --- a/LArCalorimeter/LArExample/TestLArDetDescr/src/components/TestLArDetDescr_entries.cxx +++ b/LArCalorimeter/LArExample/TestLArDetDescr/src/components/TestLArDetDescr_entries.cxx @@ -1,7 +1,7 @@ #include "../TestCaloDDE.h" -#include "TestLArDetDescr/TestCaloGeom.h" -#include "TestLArDetDescr/TestLArTT.h" -#include "TestLArDetDescr/TestLArMaterial.h" +#include "../TestCaloGeom.h" +#include "../TestLArTT.h" +#include "../TestLArMaterial.h" DECLARE_COMPONENT( TestCaloDDE ) DECLARE_COMPONENT( TestCaloGeom )