Skip to content
Snippets Groups Projects
Commit 1e41df77 authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

Merge branch 'master-caloaligncondalg' into 'master'

CaloAlignCondAlg updates

See merge request atlas/athena!47033
parents df8cc2dc 6f0290a6
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,7 @@
#include "CaloDetDescrUtils/CaloDetDescrBuilder.h"
#include "AthenaKernel/getMessageSvc.h"
#include "AthenaKernel/IOVInfiniteRange.h"
#include <memory>
......@@ -14,8 +15,8 @@ StatusCode CaloAlignCondAlg::initialize()
ATH_MSG_DEBUG("initialize " << name());
ATH_CHECK(m_condSvc.retrieve());
ATH_CHECK(m_readKeyGeoAlign.initialize());
ATH_CHECK(m_readKeyCellPosShift.initialize());
ATH_CHECK(m_readKeyGeoAlign.initialize(SG::AllowEmpty));
ATH_CHECK(m_readKeyCellPosShift.initialize(SG::AllowEmpty));
ATH_CHECK(m_writeCaloMgrKey.initialize());
// Register Write Cond Handle
......@@ -27,10 +28,10 @@ StatusCode CaloAlignCondAlg::initialize()
return StatusCode::SUCCESS;
}
StatusCode CaloAlignCondAlg::execute(const EventContext& ctx) const
StatusCode CaloAlignCondAlg::execute()
{
// ____________ Construct Write Cond Handle and check its validity ____________
SG::WriteCondHandle<CaloDetDescrManager> writeCaloMgrHandle{m_writeCaloMgrKey,ctx};
SG::WriteCondHandle<CaloDetDescrManager> writeCaloMgrHandle{m_writeCaloMgrKey};
if (writeCaloMgrHandle.isValid()) {
ATH_MSG_DEBUG("Found valid write handle");
return StatusCode::SUCCESS;
......@@ -38,22 +39,34 @@ StatusCode CaloAlignCondAlg::execute(const EventContext& ctx) const
// ____________ Get Read Cond Objects ____________
// 1. GeoAlignmentStore
SG::ReadCondHandle<GeoAlignmentStore> readHandleGeoAlign{m_readKeyGeoAlign,ctx};
ATH_CHECK(readHandleGeoAlign.isValid());
ATH_MSG_DEBUG("Retrieved GeoAlignmentStore object form the Condition Store");
writeCaloMgrHandle.addDependency(readHandleGeoAlign);
const GeoAlignmentStore* geoAlign{nullptr};
if(!m_readKeyGeoAlign.empty()) {
SG::ReadCondHandle<GeoAlignmentStore> readHandleGeoAlign{m_readKeyGeoAlign};
ATH_CHECK(readHandleGeoAlign.isValid());
ATH_MSG_DEBUG("Retrieved GeoAlignmentStore object form the Condition Store");
writeCaloMgrHandle.addDependency(readHandleGeoAlign);
geoAlign = *readHandleGeoAlign;
}
// 2. CaloCellPositionShift
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);
const CaloRec::CaloCellPositionShift* cellPosShift{nullptr};
if(!m_readKeyCellPosShift.empty()) {
SG::ReadCondHandle<CaloRec::CaloCellPositionShift> readHandleCellPosShift{m_readKeyCellPosShift};
ATH_CHECK(readHandleCellPosShift.isValid());
ATH_MSG_DEBUG("Retrieved CaloRec::CaloCellPositionShift object form the Condition Store");
writeCaloMgrHandle.addDependency(readHandleCellPosShift);
cellPosShift = *readHandleCellPosShift;
}
if(m_readKeyGeoAlign.empty() && m_readKeyCellPosShift.empty()) {
writeCaloMgrHandle.addDependency(EventIDRange(IOVInfiniteRange::infiniteRunLB()));
}
// ____________ Build new CaloDetDescrManager _________________
std::unique_ptr<CaloDetDescrManager> caloMgr = buildCaloDetDescr(serviceLocator()
, Athena::getMessageSvc()
, *readHandleGeoAlign
, *readHandleCellPosShift);
, geoAlign
, cellPosShift);
ATH_CHECK(writeCaloMgrHandle.record(std::move(caloMgr)));
ATH_MSG_INFO("recorded new CaloDetDescr Manager condition object with key " << writeCaloMgrHandle.key()
......
......@@ -5,7 +5,7 @@
#ifndef CALOALIGNMENTALGS_CALOALIGNCONDALG_H
#define CALOALIGNMENTALGS_CALOALIGNCONDALG_H
#include "AthenaBaseComps/AthReentrantAlgorithm.h"
#include "AthenaBaseComps/AthAlgorithm.h"
#include "StoreGate/ReadCondHandleKey.h"
#include "StoreGate/WriteCondHandleKey.h"
#include "GaudiKernel/ICondSvc.h"
......@@ -21,14 +21,14 @@
*
**/
class CaloAlignCondAlg final : public AthReentrantAlgorithm
class CaloAlignCondAlg final : public AthAlgorithm
{
public:
using AthReentrantAlgorithm::AthReentrantAlgorithm;
using AthAlgorithm::AthAlgorithm;
virtual ~CaloAlignCondAlg() = default;
virtual StatusCode initialize() override;
virtual StatusCode execute(const EventContext& ctx) const override;
virtual StatusCode execute() override;
virtual StatusCode finalize() override {return StatusCode::SUCCESS;};
private:
......
......@@ -35,6 +35,10 @@ def LArGMCfg(configFlags):
if configFlags.Common.Project != 'AthSimulation':
result.addCondAlgo(CompFactory.LArAlignCondAlg())
result.addCondAlgo(CompFactory.CaloAlignCondAlg())
else:
# Build unalinged CaloDetDescrManager instance in the Condition Store
if configFlags.Common.Project != 'AthSimulation':
result.addCondAlgo(CompFactory.CaloAlignCondAlg(LArAlignmentStore="",CaloCellPositionShiftFolder=""))
return result
......
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