diff --git a/InnerDetector/InDetConditions/PixelConditionsServices/test/PixelDCSTestSvc.cxx b/InnerDetector/InDetConditions/PixelConditionsServices/test/PixelDCSTestSvc.cxx index a9027bde27783f00731345f3a7c35443e7505d7b..b1b1b94fd9f870f676127a7b312ed4dd3e106885 100644 --- a/InnerDetector/InDetConditions/PixelConditionsServices/test/PixelDCSTestSvc.cxx +++ b/InnerDetector/InDetConditions/PixelConditionsServices/test/PixelDCSTestSvc.cxx @@ -1,13 +1,10 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "PixelDCSTestSvc.h" #include "Identifier/Identifier.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" -#include "InDetReadoutGeometry/SiDetectorElement.h" -#include "InDetReadoutGeometry/SiDetectorElementCollection.h" #include "InDetIdentifier/PixelID.h" #include "PixelConditionsData/PixelDCSData.h" @@ -17,7 +14,6 @@ PixelDCSTestSvc::PixelDCSTestSvc(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator), m_pixid(nullptr), - m_pixman(nullptr), m_pixelDCSSvc("PixelDCSSvc", name), m_pixelSvc("PixelConditionsSummaryTool", this) { @@ -38,12 +34,6 @@ StatusCode PixelDCSTestSvc::initialize() msg(MSG::INFO) << "Entering PixelDCSTestReadWrite::initialize()" << endmsg; - if(StatusCode::SUCCESS !=detStore()->retrieve(m_pixman, "Pixel") || m_pixman==0){ - msg(MSG::FATAL) << "Could not find Pixel manager "<<endmsg; - return StatusCode::FAILURE; - } - msg(MSG::INFO) << "Pixel manager retrieved" << endmsg; - if( StatusCode::SUCCESS != detStore()->retrieve( m_pixid,"PixelID") ){ ATH_MSG_FATAL( "Unable to retrieve pixel ID helper" ); return StatusCode::FAILURE; @@ -84,36 +74,28 @@ StatusCode PixelDCSTestSvc::execute(){ return(StatusCode::FAILURE); } - InDetDD::SiDetectorElementCollection::const_iterator iter, itermin, itermax; - - itermin = m_pixman->getDetectorElementBegin(); - itermax = m_pixman->getDetectorElementEnd(); - - for( iter=itermin; iter !=itermax; ++iter){ - const InDetDD::SiDetectorElement* element = *iter; - if(element !=0){ - Identifier ident = element->identify(); - if(m_pixid->is_pixel(ident)){ + for (PixelID::const_id_iterator wafer_it=m_pixid->wafer_begin(); wafer_it!=m_pixid->wafer_end(); ++wafer_it) { + Identifier ident = *wafer_it; + if(m_pixid->is_pixel(ident)){ - IdentifierHash id_hash = m_pixid->wafer_hash(ident); + IdentifierHash id_hash = m_pixid->wafer_hash(ident); - msg(MSG::ALWAYS) << "Identifier: " << ident.get_compact() << endmsg - << " temperature: " << m_pixelDCSSvc->getTemperature(ident) << endmsg - << " HV : " << m_pixelDCSSvc->getHV(ident) << endmsg - << " FSMStatus : " << m_pixelDCSSvc->getFSMStatus(ident) << endmsg - << " FSMState : " << m_pixelDCSSvc->getFSMState(ident) << endmsg; + msg(MSG::ALWAYS) << "Identifier: " << ident.get_compact() << endmsg + << " temperature: " << m_pixelDCSSvc->getTemperature(ident) << endmsg + << " HV : " << m_pixelDCSSvc->getHV(ident) << endmsg + << " FSMStatus : " << m_pixelDCSSvc->getFSMStatus(ident) << endmsg + << " FSMState : " << m_pixelDCSSvc->getFSMState(ident) << endmsg; - msg(MSG::ALWAYS) << "IdentifierHash: " <<(unsigned int)id_hash << endmsg - << " temperature: " << m_pixelDCSSvc->getTemperature(id_hash) << endmsg - << " HV : " << m_pixelDCSSvc->getHV(id_hash) << endmsg - << " FSMStatus : " << m_pixelDCSSvc->getFSMStatus(id_hash) << endmsg - << " FSMState : " << m_pixelDCSSvc->getFSMState(id_hash) << endmsg; + msg(MSG::ALWAYS) << "IdentifierHash: " <<(unsigned int)id_hash << endmsg + << " temperature: " << m_pixelDCSSvc->getTemperature(id_hash) << endmsg + << " HV : " << m_pixelDCSSvc->getHV(id_hash) << endmsg + << " FSMStatus : " << m_pixelDCSSvc->getFSMStatus(id_hash) << endmsg + << " FSMState : " << m_pixelDCSSvc->getFSMState(id_hash) << endmsg; - msg(MSG::ALWAYS) << "isActive " << m_pixelSvc->isActive(id_hash) << endmsg; - msg(MSG::ALWAYS) << "isGood " << m_pixelSvc->isGood(id_hash) << endmsg; + msg(MSG::ALWAYS) << "isActive " << m_pixelSvc->isActive(id_hash) << endmsg; + msg(MSG::ALWAYS) << "isGood " << m_pixelSvc->isGood(id_hash) << endmsg; - } } } diff --git a/InnerDetector/InDetConditions/PixelConditionsServices/test/PixelDCSTestSvc.h b/InnerDetector/InDetConditions/PixelConditionsServices/test/PixelDCSTestSvc.h index 1da6d6eaa2d730ff8ed15dfa295834c9cdd3c3a7..7d03d5dbe18d69c2472524b8c3b6dc3e07a05e36 100644 --- a/InnerDetector/InDetConditions/PixelConditionsServices/test/PixelDCSTestSvc.h +++ b/InnerDetector/InDetConditions/PixelConditionsServices/test/PixelDCSTestSvc.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //**************************************************************************** @@ -25,9 +25,6 @@ class IPixelDCSSvc; class PixelConditionsSummaryTool; class PixelID; -namespace InDetDD{ - class PixelDetectorManager; -} class PixelDCSTestSvc: public AthAlgorithm{ @@ -44,8 +41,6 @@ class PixelDCSTestSvc: public AthAlgorithm{ private: const PixelID* m_pixid; - const InDetDD::PixelDetectorManager* m_pixman; - ServiceHandle< IPixelDCSSvc > m_pixelDCSSvc; ToolHandle<PixelConditionsSummaryTool> m_pixelSvc; diff --git a/InnerDetector/InDetConditions/PixelConditionsServices/test/PixelMapTestAlg.cxx b/InnerDetector/InDetConditions/PixelConditionsServices/test/PixelMapTestAlg.cxx index aa1e4911ede04d16da2db3490d8fd5d8c8b623aa..c7900d63531d0b377b794eba2c8210fb453c964b 100755 --- a/InnerDetector/InDetConditions/PixelConditionsServices/test/PixelMapTestAlg.cxx +++ b/InnerDetector/InDetConditions/PixelConditionsServices/test/PixelMapTestAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "PixelMapTestAlg.h" @@ -14,10 +14,8 @@ // geometry #include "InDetIdentifier/PixelID.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" #include "InDetReadoutGeometry/SiDetectorElement.h" #include "InDetReadoutGeometry/PixelModuleDesign.h" -#include "InDetReadoutGeometry/SiDetectorElementCollection.h" // CoralDB #include "CoralDB/CoralDB.h" @@ -42,8 +40,7 @@ PixelMapTestAlg::PixelMapTestAlg(const std::string& name, ISvcLocator* pSvcLocat m_writeTextfile(false), m_dummy(false), m_overlay(false), - m_pixelID(0), - m_pixman(0) + m_pixelID(0) { declareProperty("UseSummarySvc", m_useSummarySvc, "switch for use of PixelConditionsSummarySvc"); declareProperty("SpecialPixelMapSvc", m_specialPixelMapSvc); @@ -72,12 +69,8 @@ StatusCode PixelMapTestAlg::initialize(){ return StatusCode::FAILURE; } } - sc = detStore()->retrieve( m_pixman, "Pixel" ); - if( !sc.isSuccess() ){ - ATH_MSG_FATAL( "Unable to retrieve pixel manager" ); - return StatusCode::FAILURE; - } + ATH_CHECK(m_pixelDetEleCollKey.initialize()); sc = detStore()->retrieve( m_pixelID, "PixelID" ); if( !sc.isSuccess() ){ @@ -86,13 +79,17 @@ StatusCode PixelMapTestAlg::initialize(){ } if(m_pixelID->wafer_hash_max()>1744)isIBL = true; if(m_pixelID->wafer_hash_max()>3000)isITK = true; - InDetDD::SiDetectorElementCollection::const_iterator iter, itermin, itermax; - itermin = m_pixman->getDetectorElementBegin(); - itermax = m_pixman->getDetectorElementEnd(); + + SG::ReadCondHandle<InDetDD::SiDetectorElementCollection> pixelDetEleHandle(m_pixelDetEleCollKey); + const InDetDD::SiDetectorElementCollection* elements(*pixelDetEleHandle); + if (not pixelDetEleHandle.isValid() or elements==nullptr) { + ATH_MSG_FATAL(m_pixelDetEleCollKey.fullKey() << " is not available."); + return StatusCode::FAILURE; + } + // if(m_dummy&&isITK){ - for( iter=itermin; iter !=itermax; ++iter){ - const InDetDD::SiDetectorElement* element = *iter; + for (const InDetDD::SiDetectorElement* element: *elements) { if(element !=0){ const Identifier ident = element->identify(); if(m_pixelID->is_pixel(ident)){ // OK this Element is included diff --git a/InnerDetector/InDetConditions/PixelConditionsServices/test/PixelMapTestAlg.h b/InnerDetector/InDetConditions/PixelConditionsServices/test/PixelMapTestAlg.h index 2dc18f9c3abb885a74f114c0bdf39125419d8c3a..5d5ff505db20a81c79ffcfc24d9cf98227f62f6f 100755 --- a/InnerDetector/InDetConditions/PixelConditionsServices/test/PixelMapTestAlg.h +++ b/InnerDetector/InDetConditions/PixelConditionsServices/test/PixelMapTestAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef PIXELCONDITIONSSERVICES_PIXELMAPTESTALG_H @@ -7,7 +7,8 @@ #include "AthenaBaseComps/AthAlgorithm.h" - +#include "InDetReadoutGeometry/SiDetectorElementCollection.h" +#include "StoreGate/ReadCondHandleKey.h" #include "GaudiKernel/ServiceHandle.h" @@ -15,10 +16,6 @@ class ISpecialPixelMapSvc; class IInDetConditionsTool; class PixelID; -namespace InDetDD{ - class PixelDetectorManager; -} - /** * Illustrates the usage of the SpecialPixelMapSvc. * @@ -51,7 +48,7 @@ class PixelMapTestAlg: public AthAlgorithm{ bool m_overlay; const PixelID* m_pixelID; - const InDetDD::PixelDetectorManager* m_pixman; + SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> m_pixelDetEleCollKey{this, "PixelDetEleCollKey", "PixelDetectorElementCollection", "Key of SiDetectorElementCollection for Pixel"}; };