Commit acea5513 authored by Robert Langenberg's avatar Robert Langenberg
Browse files

reduce IOV Range for SiDetElements to match TrackingGeometry

parent a70faa12
......@@ -11,7 +11,7 @@ find_package( CORAL COMPONENTS CoralBase )
atlas_add_component( PixelConditionsAlgorithms
src/*.h src/*.cxx src/components/*.cxx
INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS}
LINK_LIBRARIES ${CLHEP_LIBRARIES} ${CORAL_LIBRARIES} AthenaBaseComps AthenaKernel AthenaPoolUtilities CommissionEvent DetDescrConditions GaudiKernel GeoModelUtilities GeoPrimitives Identifier InDetCondTools InDetIdentifier InDetReadoutGeometry PathResolver PixelConditionsData PixelReadoutGeometry StoreGateLib TrkGeometry TrkSurfaces )
LINK_LIBRARIES ${CLHEP_LIBRARIES} ${CORAL_LIBRARIES} AthenaBaseComps AthenaKernel AthenaPoolUtilities CommissionEvent DetDescrConditions GaudiKernel GeoModelUtilities GeoPrimitives Identifier InDetCondTools InDetIdentifier InDetReadoutGeometry PathResolver PixelConditionsData PixelReadoutGeometry StoreGateLib TrkGeometry TrkSurfaces MuonReadoutGeometry TRT_ReadoutGeometry)
# Install files from the package:
atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
......@@ -36,6 +36,10 @@ StatusCode PixelDetectorElementCondAlg::initialize()
// We need the detector manager
ATH_CHECK(detStore()->retrieve(m_detManager, m_detManagerName));
// used only if they exist
ATH_CHECK(m_trtDetElContKey.initialize());
ATH_CHECK(m_muonManagerKey.initialize());
return StatusCode::SUCCESS;
}
......@@ -62,7 +66,6 @@ StatusCode PixelDetectorElementCondAlg::execute(const EventContext& ctx) const
// ____________ Construct new Write Cond Object ____________
std::unique_ptr<InDetDD::SiDetectorElementCollection> writeCdo{std::make_unique<InDetDD::SiDetectorElementCollection>()};
EventIDRange rangeW;
// ____________ Get Read Cond Object ____________
SG::ReadCondHandle<GeoAlignmentStore> readHandle{m_readKey, ctx};
......@@ -72,10 +75,20 @@ StatusCode PixelDetectorElementCondAlg::execute(const EventContext& ctx) const
return StatusCode::FAILURE;
}
// Define validity of the output cond object and record it
if (not readHandle.range(rangeW)) {
ATH_MSG_FATAL("Failed to retrieve validity range for " << readHandle.key());
return StatusCode::FAILURE;
// Add dependency for IOV range
writeHandle.addDependency(readHandle);
// Additional dependencies for IOV range to limit lifetime to TrackingGeometry lifetime
SG::ReadCondHandle<MuonGM::MuonDetectorManager> muonDependency{m_muonManagerKey, ctx};
if(*muonDependency != nullptr){
writeHandle.addDependency(muonDependency);
} else{
ATH_MSG_INFO("MuonManager not found, ignoring Muons for PixelDetElement lifetime");
}
SG::ReadCondHandle<InDetDD::TRT_DetElementContainer> trtDependency{m_trtDetElContKey, ctx};
if(*trtDependency != nullptr){
writeHandle.addDependency(trtDependency);
} else{
ATH_MSG_INFO("TRT DetEls not found, ignoring TRT for PixelDetElement lifetime");
}
// ____________ Update writeCdo using readCdo ____________
......@@ -120,15 +133,14 @@ StatusCode PixelDetectorElementCondAlg::execute(const EventContext& ctx) const
// Record WriteCondHandle
const std::size_t size{writeCdo->size()};
if (writeHandle.record(rangeW, std::move(writeCdo)).isFailure()) {
if (writeHandle.record(std::move(writeCdo)).isFailure()) {
ATH_MSG_FATAL("Could not record " << writeHandle.key()
<< " with EventRange " << rangeW
<< " with EventRange " << writeHandle.getRange()
<< " into Conditions Store");
return StatusCode::FAILURE;
}
ATH_MSG_INFO("recorded new CDO " << writeHandle.key() << " with range " << rangeW
ATH_MSG_INFO("recorded new CDO " << writeHandle.key() << " with range " << writeHandle.getRange()
<< " with size of " << size << " into Conditions Store");
return StatusCode::SUCCESS;
}
......@@ -17,6 +17,10 @@
#include "GaudiKernel/ICondSvc.h"
//dependencies to limit lifetime of SiDetElColl for TrackingGeometry
#include "MuonReadoutGeometry/MuonDetectorManager.h"
#include "TRT_ReadoutGeometry/TRT_DetElementContainer.h"
namespace InDetDD {
class PixelDetectorManager;
}
......@@ -39,6 +43,13 @@ class PixelDetectorElementCondAlg : public AthReentrantAlgorithm
SG::WriteCondHandleKey<InDetDD::SiDetectorElementCollection> m_writeKey
{this, "WriteKey", "PixelDetectorElementCollection", "Key of output SiDetectorElementCollection for Pixel"};
// The DetElement Collection must have a life time <= the Tracking Geometry due to DetElt-> Surface -> Layer connection,
// which is why we intersect with the IOV Ranges from the TG's dependencies.
SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_muonManagerKey
{this, "MuonManagerKey", "MuonDetectorManager", "MuonManager for IOV Range intersection"};
SG::ReadCondHandleKey<InDetDD::TRT_DetElementContainer> m_trtDetElContKey
{this, "TRT_DetEltContKey", "TRT_DetElementContainer", "Key of output to store detector element structures for TRT"};
ServiceHandle<ICondSvc> m_condSvc{this, "CondSvc", "CondSvc"};
StringProperty m_detManagerName{this, "DetManagerName", "Pixel", "Name of the DeterctorManager to retrieve"};
......
......@@ -11,7 +11,7 @@ atlas_add_component( SCT_ConditionsAlgorithms
src/*.cxx
src/components/*.cxx
INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
LINK_LIBRARIES ${Boost_LIBRARIES} AthenaBaseComps StoreGateLib Identifier DetDescrConditions GeoModelUtilities GeoPrimitives GaudiKernel SCT_ConditionsData SCT_CablingLib AthenaPoolUtilities InDetConditionsSummaryService InDetIdentifier InDetReadoutGeometry SCT_ReadoutGeometry TrkGeometry TrkSurfaces SCT_ConditionsToolsLib )
LINK_LIBRARIES ${Boost_LIBRARIES} AthenaBaseComps StoreGateLib Identifier DetDescrConditions GeoModelUtilities GeoPrimitives GaudiKernel SCT_ConditionsData SCT_CablingLib AthenaPoolUtilities InDetConditionsSummaryService InDetIdentifier InDetReadoutGeometry SCT_ReadoutGeometry TrkGeometry TrkSurfaces SCT_ConditionsToolsLib MuonReadoutGeometry TRT_ReadoutGeometry)
atlas_add_test( TestCalibChipRead
SCRIPT athena.py --threads=5 SCT_ConditionsAlgorithms/testCalibChipRead.py
......
......@@ -35,6 +35,10 @@ StatusCode SCT_DetectorElementCondAlg::initialize()
ATH_CHECK(m_condSvc->regHandle(this, m_writeKey));
ATH_CHECK(detStore()->retrieve(m_detManager, m_detManagerName));
// used only if they exist
ATH_CHECK(m_trtDetElContKey.initialize());
ATH_CHECK(m_muonManagerKey.initialize());
return StatusCode::SUCCESS;
}
......@@ -72,6 +76,19 @@ StatusCode SCT_DetectorElementCondAlg::execute(const EventContext& ctx) const
// Add dependency
writeHandle.addDependency(readHandle);
// Additional dependencies for IOV range to limit lifetime to TrackingGeometry lifetime
SG::ReadCondHandle<MuonGM::MuonDetectorManager> muonDependency{m_muonManagerKey, ctx};
if(*muonDependency != nullptr){
writeHandle.addDependency(muonDependency);
} else{
ATH_MSG_INFO("MuonManager not found, ignoring Muons for PixelDetElement lifetime");
}
SG::ReadCondHandle<InDetDD::TRT_DetElementContainer> trtDependency{m_trtDetElContKey, ctx};
if(*trtDependency != nullptr){
writeHandle.addDependency(trtDependency);
} else{
ATH_MSG_INFO("TRT DetEls not found, ignoring TRT for PixelDetElement lifetime");
}
// ____________ Update writeCdo using readCdo ____________
std::map<const InDetDD::SiDetectorElement*, const InDetDD::SiDetectorElement*> oldToNewMap;
......
......@@ -17,6 +17,10 @@
#include "GaudiKernel/ICondSvc.h"
//dependencies to limit lifetime of SiDetElColl for TrackingGeometry
#include "MuonReadoutGeometry/MuonDetectorManager.h"
#include "TRT_ReadoutGeometry/TRT_DetElementContainer.h"
namespace InDetDD {
class SCT_DetectorManager;
}
......@@ -37,6 +41,13 @@ class SCT_DetectorElementCondAlg : public AthReentrantAlgorithm
SG::ReadCondHandleKey<GeoAlignmentStore> m_readKey;
SG::WriteCondHandleKey<InDetDD::SiDetectorElementCollection> m_writeKey{this, "WriteKey", "SCT_DetectorElementCollection", "Key of output SiDetectorElementCollection for SCT"};
// The DetElement Collection must have a life time <= the Tracking Geometry due to DetElt-> Surface -> Layer connection,
// which is why we intersect with the IOV Ranges from the TG's dependencies.
SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_muonManagerKey
{this, "MuonManagerKey", "MuonDetectorManager", "MuonManager for IOV Range intersection"};
SG::ReadCondHandleKey<InDetDD::TRT_DetElementContainer> m_trtDetElContKey
{this, "TRT_DetEltContKey", "TRT_DetElementContainer", "Key of output to store detector element structures for TRT"};
ServiceHandle<ICondSvc> m_condSvc{this, "CondSvc", "CondSvc"};
std::string m_detManagerName;
const InDetDD::SCT_DetectorManager* m_detManager{nullptr};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment