ATLAS Offline Software
Loading...
Searching...
No Matches
LArAlignCondAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "LArAlignCondAlg.h"
6
7#include "GeoModelKernel/GeoAlignableTransform.h"
9
10#include <memory>
11
13{
14 ATH_MSG_DEBUG("initialize " << name());
15
16 ATH_CHECK(m_readLArAlignKey.initialize());
17 ATH_CHECK(m_writeGeoAlignKey.initialize());
18
19 return StatusCode::SUCCESS;
20}
21
22StatusCode LArAlignCondAlg::execute(const EventContext& ctx) const
23{
24 // ____________ Construct Write Cond Handle and check its validity ____________
26 if (writeGeoAlignHandle.isValid()) {
27 ATH_MSG_DEBUG("Found valid write handle");
28 return StatusCode::SUCCESS;
29 }
30
31 // ____________ Get Read Cond Object ____________
33 ATH_CHECK(readLArAlignHandle.isValid());
34 ATH_MSG_DEBUG("Retrieved DetCondKeyTrans object form the Condition Store");
35 writeGeoAlignHandle.addDependency(readLArAlignHandle);
36
37 // ____________ Construct new Write Cond Object and apply alignments ____________
38 std::unique_ptr<GeoAlignmentStore> writeCdo = std::make_unique<GeoAlignmentStore>();
39 if(m_alignHelper.applyAlignments(detStore(),*readLArAlignHandle,writeCdo.get()).isFailure()) {
40 ATH_MSG_ERROR("Failed to apply LAr alignments");
41 return StatusCode::FAILURE;
42 }
43 writeCdo->lockDelta();
44 writeCdo->lockPosCache();
45
46 ATH_CHECK(writeGeoAlignHandle.record(std::move(writeCdo)));
47 ATH_MSG_INFO("recorded new GeoAlignmentStore object for LAr with key " << writeGeoAlignHandle.key()
48 << " and range " << writeGeoAlignHandle.getRange());
49
50 return StatusCode::SUCCESS;
51}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
const ServiceHandle< StoreGateSvc > & detStore() const
SG::WriteCondHandleKey< GeoAlignmentStore > m_writeGeoAlignKey
SG::ReadCondHandleKey< DetCondKeyTrans > m_readLArAlignKey
virtual StatusCode execute(const EventContext &ctx) const override
LArAlignHelper m_alignHelper
virtual StatusCode initialize() override
const std::string & key() const
void addDependency(const EventIDRange &range)
const EventIDRange & getRange() const
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED