ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
Acts
ActsGPUGeometry
src
DeviceDetectorDescriptionCondAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
#include "
DeviceDetectorDescriptionCondAlg.h
"
5
#include "
AthenaKernel/IOVInfiniteRange.h
"
6
#include "
StoreGate/WriteCondHandle.h
"
7
8
namespace
ActsTrk
{
9
10
StatusCode
DeviceDetectorDescriptionCondAlg::initialize
()
11
{
12
ATH_MSG_DEBUG
(
"Initializing device detector conditions description algorithm "
);
13
14
ATH_CHECK
(
m_MRs
.retrieve());
15
ATH_CHECK
(
m_copy
.retrieve());
16
17
ATH_CHECK
(
detStore
()->retrieve(
m_pixelID
,
m_pixelIdHelperName
) );
18
ATH_CHECK
(
detStore
()->retrieve(
m_stripID
,
m_stripIdHelperName
));
19
20
ATH_CHECK
(
m_writeHostCondKey
.initialize());
21
ATH_CHECK
(
m_writeDeviceCondKey
.initialize());
22
23
ATH_CHECK
(
m_stripLorentzAngleTool
.retrieve());
24
ATH_CHECK
(
m_pixelLorentzAngleTool
.retrieve());
25
26
// The static part of the detector description (id maps, module designs,
27
// device detector) is built by the service during its initialization.
28
ATH_CHECK
(
m_detDescSvc
.retrieve());
29
30
return
StatusCode::SUCCESS;
31
}
32
33
StatusCode
DeviceDetectorDescriptionCondAlg::execute
(
const
EventContext& ctx)
const
34
{
35
SG::WriteCondHandle<traccc::detector_conditions_description::host>
writeHostHandle{
m_writeHostCondKey
, ctx};
36
SG::WriteCondHandle<traccc::detector_conditions_description::buffer>
writeDeviceHandle{
m_writeDeviceCondKey
, ctx};
37
38
if
(writeHostHandle.
isValid
() && writeDeviceHandle.
isValid
()) {
39
ATH_MSG_DEBUG
(
"CondHandles "
<< writeHostHandle.
fullKey
() <<
" and "
40
<< writeDeviceHandle.
fullKey
() <<
" are already valid."
);
41
return
StatusCode::SUCCESS;
42
}
43
44
const
std::vector<StaticCondEntry>& staticCondEntries =
m_detDescSvc
->staticCondEntries();
45
46
auto
hostCond = std::make_unique<traccc::detector_conditions_description::host>(*
m_MRs
->hostMR());
47
hostCond->resize(staticCondEntries.size());
48
49
// ---- 5. Write detector conditions object ----
50
// This object basically stores any information that we need per-module
51
// like: detray id, acts id, index to module design, lorentz shift etc.
52
// since lorentz shift is conditional, we need a valid event context
53
// all the static info (like the id maps) have been pre-filled by the service,
54
// here we just populate anything that might be conditions dependant
55
56
for
(std::size_t condIndex = 0; condIndex < staticCondEntries.size(); ++condIndex) {
57
const
auto
& entry = staticCondEntries[condIndex];
58
59
hostCond->module_to_design_id()[condIndex] = entry.designId;
60
hostCond->geometry_id()[condIndex] = entry.detrayGeometryId;
61
hostCond->acts_geometry_id()[condIndex] = entry.actsGeometryId;
62
63
float
shiftX = 0.f, shiftY = 0.f;
64
if
(entry.hasAthenaModule) {
65
if
(entry.isPixel) {
66
const
IdentifierHash
pixelHash =
m_pixelID
->wafer_hash(entry.athenaId);
67
shiftX =
m_pixelLorentzAngleTool
->getLorentzShift(pixelHash, ctx);
68
}
else
{
69
const
IdentifierHash
waferHash =
m_stripID
->wafer_hash(entry.athenaId);
70
shiftX =
m_stripLorentzAngleTool
->getLorentzShift(waferHash, ctx);
71
}
72
}
73
74
hostCond->measurement_translation()[condIndex] =
75
traccc::vector2{
static_cast<
traccc::scalar
>
(shiftX),
static_cast<
traccc::scalar
>
(shiftY)};
76
}
77
78
auto
copy =
m_copy
->copy(ctx);
79
auto
deviceCond = std::make_unique<traccc::detector_conditions_description::buffer>(
80
static_cast<
traccc::detector_conditions_description::buffer::size_type
>
(hostCond->size()),
81
m_MRs
->mainMR());
82
(*copy).setup(*deviceCond)->wait();
83
(*copy)(vecmem::get_data(*hostCond), *deviceCond)->wait();
84
85
// PLACEHOLDER: no real conditions dependency yet (e.g. alignment tag),
86
// so mark this object as valid for all run/lumi. Replace with a proper
87
// addDependency(ReadCondHandle<...>&) once this depends on something
88
// that actually changes over the run.
89
90
writeHostHandle.
addDependency
(
IOVInfiniteRange::infiniteRunLB
());
91
writeDeviceHandle.
addDependency
(
IOVInfiniteRange::infiniteRunLB
());
92
93
ATH_CHECK
(writeHostHandle.
record
(std::move(hostCond)));
94
ATH_CHECK
(writeDeviceHandle.
record
(std::move(deviceCond)));
95
96
ATH_MSG_DEBUG
(
"Recorded host and device detector conditions description: "
<<
m_writeHostCondKey
.key() <<
", "
<<
m_writeDeviceCondKey
.key());
97
98
return
StatusCode::SUCCESS;
99
}
100
101
}
// namespace ActsTrk
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
DeviceDetectorDescriptionCondAlg.h
IOVInfiniteRange.h
WriteCondHandle.h
ActsTrk::DeviceDetectorDescriptionCondAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
DeviceDetectorDescriptionCondAlg.cxx:33
ActsTrk::DeviceDetectorDescriptionCondAlg::m_writeHostCondKey
SG::WriteCondHandleKey< traccc::detector_conditions_description::host > m_writeHostCondKey
Definition
DeviceDetectorDescriptionCondAlg.h:73
ActsTrk::DeviceDetectorDescriptionCondAlg::m_writeDeviceCondKey
SG::WriteCondHandleKey< traccc::detector_conditions_description::buffer > m_writeDeviceCondKey
Definition
DeviceDetectorDescriptionCondAlg.h:77
ActsTrk::DeviceDetectorDescriptionCondAlg::m_pixelLorentzAngleTool
ToolHandle< ISiLorentzAngleTool > m_pixelLorentzAngleTool
Definition
DeviceDetectorDescriptionCondAlg.h:95
ActsTrk::DeviceDetectorDescriptionCondAlg::m_MRs
ToolHandle< AthDevice::IMemoryResourcesTool > m_MRs
Definition
DeviceDetectorDescriptionCondAlg.h:64
ActsTrk::DeviceDetectorDescriptionCondAlg::m_stripIdHelperName
Gaudi::Property< std::string > m_stripIdHelperName
Definition
DeviceDetectorDescriptionCondAlg.h:87
ActsTrk::DeviceDetectorDescriptionCondAlg::m_stripID
const SCT_ID * m_stripID
Definition
DeviceDetectorDescriptionCondAlg.h:84
ActsTrk::DeviceDetectorDescriptionCondAlg::m_detDescSvc
ServiceHandle< ActsTrk::IDeviceDetectorDescriptionSvc > m_detDescSvc
The service providing the static part of the detector description.
Definition
DeviceDetectorDescriptionCondAlg.h:58
ActsTrk::DeviceDetectorDescriptionCondAlg::initialize
virtual StatusCode initialize() override
Definition
DeviceDetectorDescriptionCondAlg.cxx:10
ActsTrk::DeviceDetectorDescriptionCondAlg::m_copy
ToolHandle< AthDevice::ICopyTool > m_copy
The copy tool used for copying data to device.
Definition
DeviceDetectorDescriptionCondAlg.h:70
ActsTrk::DeviceDetectorDescriptionCondAlg::m_pixelID
const PixelID * m_pixelID
Conversion helpers (to retrieve module design, hash, etc.) {.
Definition
DeviceDetectorDescriptionCondAlg.h:83
ActsTrk::DeviceDetectorDescriptionCondAlg::m_pixelIdHelperName
Gaudi::Property< std::string > m_pixelIdHelperName
Definition
DeviceDetectorDescriptionCondAlg.h:85
ActsTrk::DeviceDetectorDescriptionCondAlg::m_stripLorentzAngleTool
ToolHandle< ISiLorentzAngleTool > m_stripLorentzAngleTool
Definition
DeviceDetectorDescriptionCondAlg.h:92
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
IOVInfiniteRange::infiniteRunLB
static EventIDRange infiniteRunLB()
Produces an EventIDRange that is infinite in RunLumi and invalid in Time.
Definition
IOVInfiniteRange.h:39
IdentifierHash
This is a "hash" representation of an Identifier.
Definition
IdentifierHash.h:25
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
SG::WriteCondHandle::fullKey
const DataObjID & fullKey() const
Definition
WriteCondHandle.h:45
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition
MdtCalibInput.h:31
Generated on
for ATLAS Offline Software by
1.17.0