ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
Acts
ActsAlignmentAlgs
src
DetectorAlignCondAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
#include "
DetectorAlignCondAlg.h
"
5
6
#include "
StoreGate/ReadCondHandle.h
"
7
#include "
StoreGate/WriteCondHandle.h
"
8
#include "GeoModelHelpers/TransformToStringConverter.h"
9
10
#include "GeoModelKernel/GeoClearAbsPosAction.h"
11
12
using namespace
ActsTrk
;
13
14
DetectorAlignCondAlg::~DetectorAlignCondAlg
() =
default
;
15
16
StatusCode
DetectorAlignCondAlg::initialize
() {
17
ATH_CHECK
(
m_inputKey
.initialize());
18
ATH_CHECK
(
m_outputKey
.initialize());
20
if
(
m_fillAlignStoreCache
) {
21
ATH_CHECK
(
m_trackingGeoSvc
.retrieve());
22
}
23
24
try
{
25
m_Type
=
static_cast<
DetectorType
>
(
m_detType
.value());
26
}
catch
(
const
std::exception& what) {
27
ATH_MSG_FATAL
(
"Invalid detType is configured "
<<
m_detType
);
28
return
StatusCode::FAILURE;
29
}
30
if
(
m_Type
==
DetectorType::UnDefined
) {
31
ATH_MSG_FATAL
(
"Please configure the deType "
<<
m_detType
<<
" to be something not undefined"
);
32
return
StatusCode::FAILURE;
33
}
34
return
StatusCode::SUCCESS;
35
}
36
37
StatusCode
DetectorAlignCondAlg::execute
(
const
EventContext& ctx)
const
{
38
SG::WriteCondHandle
writeHandle{
m_outputKey
, ctx};
39
if
(writeHandle.
isValid
()) {
40
ATH_MSG_DEBUG
(
"Nothing needs to be done for "
<< ctx.eventID().event_number());
41
return
StatusCode::SUCCESS;
42
}
43
SG::ReadCondHandle
readHandle{
m_inputKey
, ctx};
44
if
(!readHandle.
isValid
()) {
45
ATH_MSG_FATAL
(
"Failed to retrieve "
<<
m_inputKey
.fullKey());
46
return
StatusCode::FAILURE;
47
}
48
writeHandle.
addDependency
(readHandle);
49
50
DetectorAlignStore::Mode
mode{
m_fillAlignStoreCache
? DetectorAlignStore::Mode::Block
51
: DetectorAlignStore::Mode::LazyFill};
53
auto
newAlignment = std::make_unique<DetectorAlignStore>(
m_Type
, mode);
54
newAlignment->geoModelAlignment = std::make_unique<GeoAlignmentStore>(**readHandle);
55
newAlignment->geoModelAlignment->clearPosCache();
57
if
(
m_fillAlignStoreCache
) {
58
if
(!
m_trackingGeoSvc
->populateAlignmentStore(*newAlignment)) {
59
ATH_MSG_WARNING
(
"No detector elements of "
<<
m_Type
<<
" are part of the tracking geometry"
);
60
}
62
newAlignment->geoModelAlignment.reset();
63
}
64
ATH_CHECK
(writeHandle.
record
(std::move(newAlignment)));
65
return
StatusCode::SUCCESS;
66
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
DetectorAlignCondAlg.h
ReadCondHandle.h
WriteCondHandle.h
ActsTrk::DetectorAlignCondAlg::m_outputKey
SG::WriteCondHandleKey< DetectorAlignStore > m_outputKey
Key to the alignment transformations written by the alg.
Definition
DetectorAlignCondAlg.h:36
ActsTrk::DetectorAlignCondAlg::~DetectorAlignCondAlg
virtual ~DetectorAlignCondAlg()
ActsTrk::DetectorAlignCondAlg::m_Type
DetectorType m_Type
Static cast of >DetectorType< property.
Definition
DetectorAlignCondAlg.h:44
ActsTrk::DetectorAlignCondAlg::execute
StatusCode execute(const EventContext &ctx) const override final
Definition
DetectorAlignCondAlg.cxx:37
ActsTrk::DetectorAlignCondAlg::initialize
StatusCode initialize() override final
Definition
DetectorAlignCondAlg.cxx:16
ActsTrk::DetectorAlignCondAlg::m_detType
Gaudi::Property< int > m_detType
Flag determining the subdetector. Needs to be static castable to DetectorType.
Definition
DetectorAlignCondAlg.h:40
ActsTrk::DetectorAlignCondAlg::m_trackingGeoSvc
ServiceHandle< ActsTrk::ITrackingGeometrySvc > m_trackingGeoSvc
ServiceHandle to the ActsTrackingGeometry.
Definition
DetectorAlignCondAlg.h:38
ActsTrk::DetectorAlignCondAlg::m_fillAlignStoreCache
Gaudi::Property< bool > m_fillAlignStoreCache
Flag toggling whether the alignment store shall be filled with the transforms or not.
Definition
DetectorAlignCondAlg.h:42
ActsTrk::DetectorAlignCondAlg::m_inputKey
SG::ReadCondHandleKey< GeoAlignmentStore > m_inputKey
Key to the alignment transformations for the detector volumes.
Definition
DetectorAlignCondAlg.h:34
ActsTrk::DetectorAlignStore::Mode
detail::TransformStore::Mode Mode
Definition
DetectorAlignStore.h:40
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
SG::ReadCondHandle::isValid
bool isValid()
Definition
ReadCondHandle.h:205
SG::WriteCondHandle
Definition
WriteCondHandle.h:26
SG::WriteCondHandle::addDependency
void addDependency(const EventIDRange &range)
Definition
WriteCondHandle.h:279
SG::WriteCondHandle::record
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
Definition
WriteCondHandle.h:161
SG::WriteCondHandle::isValid
bool isValid() const
Definition
WriteCondHandle.h:252
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition
MdtCalibInput.h:31
ActsTrk::DetectorType
DetectorType
Simple enum to Identify the Type of the ACTS sub detector.
Definition
GeometryDefs.h:25
ActsTrk::DetectorType::UnDefined
@ UnDefined
Small Thing Gap chambers (NSW).
Definition
GeometryDefs.h:38
Generated on
for ATLAS Offline Software by
1.17.0