ATLAS Offline Software
AlignStoreProviderAlg.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 
9 using namespace ActsTrk;
10 
12 
14  ATH_CHECK(m_inputKey.initialize(!m_inputKey.empty()));
15  ATH_CHECK(m_outputKey.initialize());
18  if(m_loadTrkGeoSvc) {
19  ATH_CHECK(m_trackingGeoSvc.retrieve());
20  }
21  if (m_loadDetVolSvc) {
22  ATH_CHECK(m_detVolSvc.retrieve());
23  }
24  }
27  if (!m_inputKey.empty()) {
28  return StatusCode::SUCCESS;
29  }
30 
31  try {
32  m_Type = static_cast<DetectorType>(m_detType.value());
33  } catch (const std::exception& what) {
34  ATH_MSG_FATAL("Invalid detType is configured " << m_detType);
35  return StatusCode::FAILURE;
36  }
38  ATH_MSG_FATAL("Please configure the detType " << m_detType << " to be something not undefined");
39  return StatusCode::FAILURE;
40  }
41  return StatusCode::SUCCESS;
42 }
43 
44 StatusCode AlignStoreProviderAlg::execute(const EventContext& ctx) const {
45 
46  std::unique_ptr<DetectorAlignStore> newAlignment{};
47 
48  if (!m_inputKey.empty()) {
49  const DetectorAlignStore* inStore{};
50  ATH_CHECK(SG::get(inStore, m_inputKey, ctx));
51  newAlignment = std::make_unique<DetectorAlignStore>(*inStore);
53  if (m_splitPhysVolCache) {
54  if (newAlignment->geoModelAlignment) {
55  newAlignment->geoModelAlignment = std::make_unique<GeoAlignmentStore>(*newAlignment->geoModelAlignment);
56  newAlignment->geoModelAlignment->clearPosCache();
57  }
58  }
59  if (m_splitActsTrfCache) {
60  using TrackingStore = DetectorAlignStore::TrackingAlignStore;
61  newAlignment->trackingAlignment = std::make_unique<TrackingStore>(newAlignment->detType);
62  }
63  } else {
64  newAlignment = std::make_unique<DetectorAlignStore>(m_Type);
65  }
69  if (m_fillAlignStoreCache && newAlignment->geoModelAlignment) {
70  if(m_loadTrkGeoSvc && !m_trackingGeoSvc->populateAlignmentStore(*newAlignment)) {
71  ATH_MSG_WARNING("No detector elements of " << to_string(m_Type) << " are part of the tracking geometry");
72  }
73  if (m_loadDetVolSvc && !m_detVolSvc->populateAlignmentStore(*newAlignment)) {
74  ATH_MSG_WARNING("No detector elements of " << to_string(m_Type) << " are part of the detector tracking volumes");
75  }
77  newAlignment->geoModelAlignment.reset();
78  }
79  SG::WriteHandle writeHandle{m_outputKey, ctx};
80  ATH_MSG_DEBUG("Record alignment store for detector technology "<<to_string(newAlignment->detType)
81  <<" with a capacity of "<<DetectorAlignStore::TrackingAlignStore::distributedTickets(newAlignment->detType)<<".");
82  ATH_CHECK(writeHandle.record(std::move(newAlignment)));
83  return StatusCode::SUCCESS;
84 }
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
ActsTrk::AlignStoreProviderAlg::m_splitActsTrfCache
Gaudi::Property< bool > m_splitActsTrfCache
Flag toggline whether the final transforms of the ActsDet volumes shall be split per event.
Definition: AlignStoreProviderAlg.h:48
ActsTrk::DetectorType
DetectorType
Simple enum to Identify the Type of the ACTS sub detector.
Definition: GeometryDefs.h:17
ActsTrk::AlignStoreProviderAlg::m_inputKey
SG::ReadCondHandleKey< DetectorAlignStore > m_inputKey
Key to the alignment transformations for the detector volumes.
Definition: AlignStoreProviderAlg.h:35
ActsTrk::DetectorAlignStore::TrackingAlignStore
Store holding the transfomations used by the Acts algorithms.
Definition: DetectorAlignStore.h:33
ActsTrk::DetectorAlignStore
Definition: DetectorAlignStore.h:20
ActsTrk::AlignStoreProviderAlg::execute
StatusCode execute(const EventContext &ctx) const override final
Definition: AlignStoreProviderAlg.cxx:44
ActsTrk::DetectorType::UnDefined
@ UnDefined
Small Thing Gap chambers (NSW)
ActsTrk::AlignStoreProviderAlg::m_loadTrkGeoSvc
Gaudi::Property< bool > m_loadTrkGeoSvc
Definition: AlignStoreProviderAlg.h:54
ActsTrk::AlignStoreProviderAlg::m_Type
DetectorType m_Type
Static cast of >DetectorType< property.
Definition: AlignStoreProviderAlg.h:52
ReadCondHandle.h
WriteHandle.h
Handle class for recording to StoreGate.
SG::get
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
Definition: ReadCondHandle.h:287
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
calibdata.exception
exception
Definition: calibdata.py:495
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
ActsTrk::AlignStoreProviderAlg::~AlignStoreProviderAlg
virtual ~AlignStoreProviderAlg()
ActsTrk::AlignStoreProviderAlg::m_detVolSvc
ServiceHandle< ActsTrk::IDetectorVolumeSvc > m_detVolSvc
ServiceHandle to the IDetectorVolumeSvc.
Definition: AlignStoreProviderAlg.h:41
ActsTrk::AlignStoreProviderAlg::m_outputKey
SG::WriteHandleKey< DetectorAlignStore > m_outputKey
Key to the alignment transformations written by the alg.
Definition: AlignStoreProviderAlg.h:37
python.ExitCodes.what
def what(code)
Definition: ExitCodes.py:73
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
ActsTrk::DetectorAlignStore::TrackingAlignStore::distributedTickets
static unsigned int distributedTickets(const DetectorType detType)
Returns the number of all distributed tickets.
Definition: DetectorAlignStore.cxx:57
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:73
ActsTrk::AlignStoreProviderAlg::m_fillAlignStoreCache
Gaudi::Property< bool > m_fillAlignStoreCache
Flag toggling whether the alignment store shall be filled with the transforms or not.
Definition: AlignStoreProviderAlg.h:50
ActsTrk::AlignStoreProviderAlg::m_trackingGeoSvc
ServiceHandle< IActsTrackingGeometrySvc > m_trackingGeoSvc
ServiceHandle to the ActsTrackingGeometry.
Definition: AlignStoreProviderAlg.h:39
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
ActsTrk::AlignStoreProviderAlg::initialize
StatusCode initialize() override final
Definition: AlignStoreProviderAlg.cxx:13
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MSTrackingVolumeBuilder.cxx:25
ActsTrk::AlignStoreProviderAlg::m_detType
Gaudi::Property< int > m_detType
Flag determining the subdetector. Needs to be static castable to DetectorType.
Definition: AlignStoreProviderAlg.h:43
AlignStoreProviderAlg.h
ActsTrk::AlignStoreProviderAlg::m_splitPhysVolCache
Gaudi::Property< bool > m_splitPhysVolCache
Flag toggling whether the full GeoAlignmentStore shall be written to store gate or whether the absolu...
Definition: AlignStoreProviderAlg.h:46
ActsTrk::AlignStoreProviderAlg::m_loadDetVolSvc
Gaudi::Property< bool > m_loadDetVolSvc
Definition: AlignStoreProviderAlg.h:57