ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonPhaseII
MuonG4
MuonG4TrfCache
src
GeoModelTrfCacheAlg.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 "
GeoModelTrfCacheAlg.h
"
5
6
#include "
StoreGate/WriteCondHandle.h
"
7
#include "
AthenaKernel/IOVInfiniteRange.h
"
8
9
namespace
MuonG4
{
10
StatusCode
GeoModelTrfCacheAlg::initialize
(){
11
ATH_CHECK
(
detStore
()->retrieve(
m_detMgr
));
12
ATH_CHECK
(
m_writeKey
.initialize());
13
try
{
14
m_type
=
static_cast<
ActsTrk::DetectorType
>
(
m_detType
.value());
15
}
catch
(
const
std::exception& what) {
16
ATH_MSG_FATAL
(
"Invalid detType is configured "
<<
m_detType
);
17
return
StatusCode::FAILURE;
18
}
19
if
(
m_type
==
ActsTrk::DetectorType::UnDefined
) {
20
ATH_MSG_FATAL
(
"Please configure the detType "
<<
m_detType
21
<<
" to be something not undefined"
);
22
return
StatusCode::FAILURE;
23
}
24
return
StatusCode::SUCCESS;
25
}
26
StatusCode
GeoModelTrfCacheAlg::execute
(
const
EventContext& ctx)
const
{
27
SG::WriteCondHandle
writeHandle{
m_writeKey
, ctx};
28
if
(writeHandle.
isValid
()) {
29
ATH_MSG_DEBUG
(
"Nothing needs to be done for "
<< ctx.eventID().event_number());
30
return
StatusCode::SUCCESS;
31
}
32
writeHandle.
addDependency
(EventIDRange(
IOVInfiniteRange::infiniteTime
()));
33
34
auto
trfCache = std::make_unique<ActsTrk::DetectorAlignStore>(
m_type
,
35
ActsTrk::DetectorAlignStore::Mode::Block);
36
std::ranges::for_each(
m_detMgr
->getAllReadoutElements(
m_type
),
37
[&](
const
MuonGMR4::MuonReadoutElement
*
re
){
38
re->storeAlignedTransforms(*trfCache);
39
re->getMaterialGeom()->getAbsoluteTransform(trfCache->geoModelAlignment.get());
40
re->getMaterialGeom()->clearPositionInfo();
41
re->storeAlignedTransforms(*trfCache);
42
});
43
ATH_CHECK
(writeHandle.
record
(std::move(trfCache)));
44
return
StatusCode::SUCCESS;
45
}
46
}
re
const std::regex re(r_e)
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x,...)
Definition
AthMsgStreamMacros.h:43
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x,...)
Definition
AthMsgStreamMacros.h:48
GeoModelTrfCacheAlg.h
IOVInfiniteRange.h
WriteCondHandle.h
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
IOVInfiniteRange::infiniteTime
static EventIDRange infiniteTime()
Produces an EventIDRange that is inifinite in Time and invalid in RunLumi.
Definition
IOVInfiniteRange.h:47
MuonG4::GeoModelTrfCacheAlg::m_detType
Gaudi::Property< int > m_detType
Flag determining the subdetector. Needs to be static castable to DetectorType.
Definition
GeoModelTrfCacheAlg.h:22
MuonG4::GeoModelTrfCacheAlg::m_type
ActsTrk::DetectorType m_type
Definition
GeoModelTrfCacheAlg.h:26
MuonG4::GeoModelTrfCacheAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override final
Definition
GeoModelTrfCacheAlg.cxx:26
MuonG4::GeoModelTrfCacheAlg::m_detMgr
const MuonGMR4::MuonDetectorManager * m_detMgr
Definition
GeoModelTrfCacheAlg.h:24
MuonG4::GeoModelTrfCacheAlg::m_writeKey
SG::WriteCondHandleKey< ActsTrk::DetectorAlignStore > m_writeKey
Definition
GeoModelTrfCacheAlg.h:20
MuonG4::GeoModelTrfCacheAlg::initialize
virtual StatusCode initialize() override final
Definition
GeoModelTrfCacheAlg.cxx:10
MuonGMR4::MuonReadoutElement
MuonReadoutElement is an abstract class representing the geometry of a muon detector.
Definition
MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonReadoutElement.h:35
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::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
MuonG4
Definition
MuonSpectrometer/MuonPhaseII/MuonG4/MuonG4TrfCache/src/AlignStoreProviderAlg.cxx:7
Generated on
for ATLAS Offline Software by
1.17.0