ATLAS Offline Software
Loading...
Searching...
No Matches
DetectorAlignCondAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
5
8#include "GeoModelHelpers/TransformToStringConverter.h"
9
10#include "GeoModelKernel/GeoClearAbsPosAction.h"
11
12using namespace ActsTrk;
13
15
17 ATH_CHECK(m_inputKey.initialize());
18 ATH_CHECK(m_outputKey.initialize());
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 }
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
37StatusCode 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);
50 auto newAlignment = std::make_unique<DetectorAlignStore>(m_Type);
51 newAlignment->geoModelAlignment = std::make_unique<GeoAlignmentStore>(**readHandle);
52 newAlignment->geoModelAlignment->clearPosCache();
55 if(!m_trackingGeoSvc->populateAlignmentStore(*newAlignment)) {
56 ATH_MSG_WARNING("No detector elements of " << to_string(m_Type) << " are part of the tracking geometry");
57 }
59 newAlignment->geoModelAlignment.reset();
60 }
61 ATH_CHECK(writeHandle.record(std::move(newAlignment)));
62 return StatusCode::SUCCESS;
63}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
SG::WriteCondHandleKey< DetectorAlignStore > m_outputKey
Key to the alignment transformations written by the alg.
DetectorType m_Type
Static cast of >DetectorType< property.
StatusCode execute(const EventContext &ctx) const override final
StatusCode initialize() override final
Gaudi::Property< int > m_detType
Flag determining the subdetector. Needs to be static castable to DetectorType.
ServiceHandle< ActsTrk::ITrackingGeometrySvc > m_trackingGeoSvc
ServiceHandle to the ActsTrackingGeometry.
Gaudi::Property< bool > m_fillAlignStoreCache
Flag toggling whether the alignment store shall be filled with the transforms or not.
SG::ReadCondHandleKey< GeoAlignmentStore > m_inputKey
Key to the alignment transformations for the detector volumes.
void addDependency(const EventIDRange &range)
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
std::string to_string(const DetectorType &type)
DetectorType
Simple enum to Identify the Type of the ACTS sub detector.
@ UnDefined
Small Thing Gap chambers (NSW)