Skip to content
Snippets Groups Projects
Commit 34c20bee authored by Vakhtang Tsulaia's avatar Vakhtang Tsulaia
Browse files

Fixes in alignment condition algorithms

1. Pixel and SCT algorithms turned into AthAlgorithms to address ATLASRECTS-6553

2. TRT, LAr and Calo algorithms fixed by adding event context to the constructors
of condition handles
parent 9c40f09e
No related branches found
No related tags found
No related merge requests found
......@@ -30,8 +30,9 @@ StatusCode CaloAlignCondAlg::initialize()
StatusCode CaloAlignCondAlg::execute()
{
const EventContext& ctx = Gaudi::Hive::currentContext();
// ____________ Construct Write Cond Handle and check its validity ____________
SG::WriteCondHandle<CaloDetDescrManager> writeCaloMgrHandle{m_writeCaloMgrKey};
SG::WriteCondHandle<CaloDetDescrManager> writeCaloMgrHandle{m_writeCaloMgrKey,ctx};
if (writeCaloMgrHandle.isValid()) {
ATH_MSG_DEBUG("Found valid write handle");
return StatusCode::SUCCESS;
......@@ -41,7 +42,7 @@ StatusCode CaloAlignCondAlg::execute()
// 1. GeoAlignmentStore
const GeoAlignmentStore* geoAlign{nullptr};
if(!m_readKeyGeoAlign.empty()) {
SG::ReadCondHandle<GeoAlignmentStore> readHandleGeoAlign{m_readKeyGeoAlign};
SG::ReadCondHandle<GeoAlignmentStore> readHandleGeoAlign{m_readKeyGeoAlign,ctx};
ATH_CHECK(readHandleGeoAlign.isValid());
ATH_MSG_DEBUG("Retrieved GeoAlignmentStore object form the Condition Store");
writeCaloMgrHandle.addDependency(readHandleGeoAlign);
......@@ -51,7 +52,7 @@ StatusCode CaloAlignCondAlg::execute()
// 2. CaloCellPositionShift
const CaloRec::CaloCellPositionShift* cellPosShift{nullptr};
if(!m_readKeyCellPosShift.empty()) {
SG::ReadCondHandle<CaloRec::CaloCellPositionShift> readHandleCellPosShift{m_readKeyCellPosShift};
SG::ReadCondHandle<CaloRec::CaloCellPositionShift> readHandleCellPosShift{m_readKeyCellPosShift,ctx};
ATH_CHECK(readHandleCellPosShift.isValid());
ATH_MSG_DEBUG("Retrieved CaloRec::CaloCellPositionShift object form the Condition Store");
writeCaloMgrHandle.addDependency(readHandleCellPosShift);
......
......@@ -10,7 +10,7 @@
#include <memory>
PixelAlignCondAlg::PixelAlignCondAlg(const std::string& name, ISvcLocator* pSvcLocator)
: ::AthReentrantAlgorithm(name, pSvcLocator)
: ::AthAlgorithm(name, pSvcLocator)
{
}
......@@ -41,10 +41,11 @@ StatusCode PixelAlignCondAlg::initialize()
return StatusCode::SUCCESS;
}
StatusCode PixelAlignCondAlg::execute(const EventContext& ctx) const
StatusCode PixelAlignCondAlg::execute()
{
ATH_MSG_DEBUG("execute " << name());
const EventContext& ctx = Gaudi::Hive::currentContext();
// ____________ Construct Write Cond Handle and check its validity ____________
SG::WriteCondHandle<GeoAlignmentStore> writeHandle{m_writeKey, ctx};
......
......@@ -7,7 +7,7 @@
#ifndef PIXELCONDITIONSALGORITHMS_PIXELALIGNCONDALG_H
#define PIXELCONDITIONSALGORITHMS_PIXELALIGNCONDALG_H
#include "AthenaBaseComps/AthReentrantAlgorithm.h"
#include "AthenaBaseComps/AthAlgorithm.h"
#include "StoreGate/ReadCondHandleKey.h"
#include "StoreGate/WriteCondHandleKey.h"
......@@ -21,14 +21,14 @@ namespace InDetDD {
class PixelDetectorManager;
}
class PixelAlignCondAlg : public AthReentrantAlgorithm
class PixelAlignCondAlg : public AthAlgorithm
{
public:
PixelAlignCondAlg(const std::string& name, ISvcLocator* pSvcLocator);
virtual ~PixelAlignCondAlg() override = default;
virtual StatusCode initialize() override;
virtual StatusCode execute(const EventContext& ctx) const override;
virtual StatusCode execute() override;
private:
BooleanProperty m_useDynamicAlignFolders{
......
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#include "SCT_AlignCondAlg.h"
......@@ -10,7 +10,7 @@
#include <memory>
SCT_AlignCondAlg::SCT_AlignCondAlg(const std::string& name, ISvcLocator* pSvcLocator)
: ::AthReentrantAlgorithm(name, pSvcLocator)
: ::AthAlgorithm(name, pSvcLocator)
, m_writeKey{"SCTAlignmentStore", "SCTAlignmentStore"}
, m_DetManagerName("SCT")
{
......@@ -44,10 +44,11 @@ StatusCode SCT_AlignCondAlg::initialize()
return StatusCode::SUCCESS;
}
StatusCode SCT_AlignCondAlg::execute(const EventContext& ctx) const
StatusCode SCT_AlignCondAlg::execute()
{
ATH_MSG_DEBUG("execute " << name());
const EventContext& ctx = Gaudi::Hive::currentContext();
// ____________ Construct Write Cond Handle and check its validity ____________
SG::WriteCondHandle<GeoAlignmentStore> writeHandle{m_writeKey, ctx};
......
// -*- C++ -*-
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#ifndef SCT_CONDITIONSALGORITHMS_SCT_ALIGNCONDALG_H
#define SCT_CONDITIONSALGORITHMS_SCT_ALIGNCONDALG_H
#include "AthenaBaseComps/AthReentrantAlgorithm.h"
#include "AthenaBaseComps/AthAlgorithm.h"
#include "StoreGate/ReadCondHandleKey.h"
#include "StoreGate/WriteCondHandleKey.h"
......@@ -36,14 +36,14 @@ namespace InDetDD {
// However, we cannot give non-const pointer for SiDetectorElement
// in SCT_DetectorManager in the above chain.
class SCT_AlignCondAlg : public AthReentrantAlgorithm
class SCT_AlignCondAlg : public AthAlgorithm
{
public:
SCT_AlignCondAlg(const std::string& name, ISvcLocator* pSvcLocator);
virtual ~SCT_AlignCondAlg() override = default;
virtual StatusCode initialize() override;
virtual StatusCode execute(const EventContext& ctx) const override;
virtual StatusCode execute() override;
virtual StatusCode finalize() override;
private:
......
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
......@@ -58,9 +58,10 @@ StatusCode TRTAlignCondAlg::execute()
{
ATH_MSG_DEBUG("execute " << name());
const EventContext& ctx = Gaudi::Hive::currentContext();
// ____________ Construct Write Cond Handles and check their validity ____________
SG::WriteCondHandle<GeoAlignmentStore> writeHandle{m_writeKeyAlignStore};
SG::WriteCondHandle<InDetDD::TRT_DetElementContainer> writeHandleDetElCont{m_writeKeyDetElCont};
SG::WriteCondHandle<GeoAlignmentStore> writeHandle{m_writeKeyAlignStore,ctx};
SG::WriteCondHandle<InDetDD::TRT_DetElementContainer> writeHandleDetElCont{m_writeKeyDetElCont,ctx};
if (writeHandleDetElCont.isValid()) {
ATH_MSG_DEBUG("CondHandle " << writeHandleDetElCont.fullKey() << " is already valid."
......@@ -95,7 +96,7 @@ StatusCode TRTAlignCondAlg::execute()
// 1. Dynamic folders
// ** Global
SG::ReadCondHandle<CondAttrListCollection> readHandleDynamicGlobal{m_readKeyDynamicGlobal};
SG::ReadCondHandle<CondAttrListCollection> readHandleDynamicGlobal{m_readKeyDynamicGlobal,ctx};
// Get CDO and store it into container
const CondAttrListCollection* readCdoDynamicGlobal{*readHandleDynamicGlobal};
if(readCdoDynamicGlobal==nullptr) {
......@@ -111,7 +112,7 @@ StatusCode TRTAlignCondAlg::execute()
}
// ** Regular
SG::ReadCondHandle<AlignableTransformContainer> readHandleDynamicRegular{m_readKeyDynamicRegular};
SG::ReadCondHandle<AlignableTransformContainer> readHandleDynamicRegular{m_readKeyDynamicRegular,ctx};
// Get CDO and store it into container
const AlignableTransformContainer* readCdoDynamicRegular{*readHandleDynamicRegular};
if(readCdoDynamicRegular==nullptr) {
......@@ -131,7 +132,7 @@ StatusCode TRTAlignCondAlg::execute()
}
else {
// 2. Regular folder
SG::ReadCondHandle<AlignableTransformContainer> readHandleRegular{m_readKeyRegular};
SG::ReadCondHandle<AlignableTransformContainer> readHandleRegular{m_readKeyRegular,ctx};
// Get CDO and store it into container
const AlignableTransformContainer* readCdoRegular{*readHandleRegular};
if(readCdoRegular==nullptr) {
......
......@@ -28,15 +28,16 @@ StatusCode LArAlignCondAlg::initialize()
StatusCode LArAlignCondAlg::execute()
{
const EventContext& ctx = Gaudi::Hive::currentContext();
// ____________ Construct Write Cond Handle and check its validity ____________
SG::WriteCondHandle<GeoAlignmentStore> writeGeoAlignHandle{m_writeGeoAlignKey};
SG::WriteCondHandle<GeoAlignmentStore> writeGeoAlignHandle{m_writeGeoAlignKey,ctx};
if (writeGeoAlignHandle.isValid()) {
ATH_MSG_DEBUG("Found valid write handle");
return StatusCode::SUCCESS;
}
// ____________ Get Read Cond Object ____________
SG::ReadCondHandle<DetCondKeyTrans> readLArAlignHandle{m_readLArAlignKey};
SG::ReadCondHandle<DetCondKeyTrans> readLArAlignHandle{m_readLArAlignKey,ctx};
ATH_CHECK(readLArAlignHandle.isValid());
ATH_MSG_DEBUG("Retrieved DetCondKeyTrans object form the Condition Store");
writeGeoAlignHandle.addDependency(readLArAlignHandle);
......
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