ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
Acts
ActsGPUDataPreparation
src
DeviceClusterizationAlg.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 "
DeviceClusterizationAlg.h
"
5
6
#include "
StoreGate/ReadHandle.h
"
7
#include "
StoreGate/WriteHandle.h
"
8
9
// traccc EDM
10
#include "traccc/edm/silicon_cell_collection.hpp"
11
#include "traccc/edm/measurement_collection.hpp"
12
13
// vecmem
14
#include "vecmem/memory/memory_resource.hpp"
15
16
namespace
ActsTrk
{
17
18
// -----------------------------------------------------------------------
19
StatusCode
DeviceClusterizationAlg::initialize
()
20
{
21
ATH_MSG_DEBUG
(
"Initializing "
<< name());
22
23
ATH_CHECK
(
m_clusteringAlgProviderTool
.retrieve());
24
ATH_CHECK
(
m_deviceMR
.retrieve());
25
ATH_CHECK
(
m_inputCellsKey
.initialize());
26
ATH_CHECK
(
m_outputMeasKey
.initialize());
27
ATH_CHECK
(
m_outputClusterKey
.initialize());
28
29
ATH_CHECK
(
detStore
()->retrieve(
m_deviceDesign
,
m_deviceDesignObjectName
.value()));
30
ATH_CHECK
(
detStore
()->retrieve(
m_deviceCond
,
m_deviceCondObjectName
.value()));
31
32
ATH_MSG_DEBUG
(
"Successfully initialized"
);
33
return
StatusCode::SUCCESS;
34
}
35
36
StatusCode
DeviceClusterizationAlg::execute
(
const
EventContext& ctx)
const
37
{
38
ATH_MSG_DEBUG
(
"Executing device clusterization."
);
39
40
// ---- 1. Read input traccc cells from StoreGate --------------------------------
41
auto
inputTracccCells =
SG::makeHandle
(
m_inputCellsKey
, ctx);
42
ATH_CHECK
(inputTracccCells.isValid());
43
ATH_MSG_DEBUG
(
"Read traccc cells from '"
44
<<
m_inputCellsKey
.key() <<
"'"
);
45
46
// ---- 2. Get traccc clusterization alg ---------------------------------------------
47
auto
clustering_pair =
m_clusteringAlgProviderTool
->getClusterizationAlgorithm(ctx);
48
std::shared_ptr<const traccc::device::clusterization_algorithm> clustering_alg = clustering_pair.second;
49
50
// ---- 2.5 Retrieve the sorting algorithm ---------------------------------------------
51
auto
sorting_pair =
m_clusteringAlgProviderTool
->getSortingAlgorithm(ctx);
52
std::shared_ptr<const IDeviceClusterizationAlgProviderTool::sorting_algorithm_type> sorting_alg = sorting_pair.second;
53
54
// ---- 3. Run traccc clusterization ---------------------------------------------
55
traccc::edm::silicon_cluster_collection::buffer cluster_gpu_buffer;
56
traccc::edm::measurement_collection::buffer measurements_gpu_buffer;
57
58
if
(
m_retrieveClusterCells
){
59
ATH_MSG_DEBUG
(
"Running clusterization with returning cell info"
);
60
std::tie(measurements_gpu_buffer, cluster_gpu_buffer) =
61
(*clustering_alg)(
62
*inputTracccCells, *
m_deviceDesign
, *
m_deviceCond
,
63
traccc::device::clustering_keep_disjoint_set{});
64
}
else
{
65
ATH_MSG_DEBUG
(
"Running clusterization without returning cell info"
);
66
measurements_gpu_buffer = (*clustering_alg)(*inputTracccCells, *
m_deviceDesign
, *
m_deviceCond
);
67
}
68
69
// ---- 3.5 Run measurement sorting ---------------------------------------------
70
auto
sortedTracccMeasurements =
71
(*sorting_alg)(measurements_gpu_buffer);
72
73
ATH_MSG_DEBUG
(
"Reconstructed "
<< (clustering_pair.first)->get_size(measurements_gpu_buffer) <<
" measurements."
);
74
75
// ---- 4. Write output traccc measurements to StoreGate -------------------------
76
auto
outputTracccMeas =
SG::makeHandle
(
m_outputMeasKey
, ctx);
77
ATH_CHECK
(outputTracccMeas.record(
78
std::make_unique<traccc::edm::measurement_collection::buffer>(
79
std::move(sortedTracccMeasurements))));
80
ATH_MSG_DEBUG
(
"Wrote measurement buffer to '"
<<
m_outputMeasKey
.key() <<
"'"
);
81
82
auto
outputTracccClusters =
SG::makeHandle
(
m_outputClusterKey
, ctx);
83
ATH_CHECK
(outputTracccClusters.record(
84
std::make_unique<traccc::edm::silicon_cluster_collection::buffer>(
85
std::move(cluster_gpu_buffer))));
86
ATH_MSG_DEBUG
(
"Wrote cluster buffer to '"
<<
m_outputClusterKey
.key() <<
"'"
);
87
88
return
StatusCode::SUCCESS;
89
}
90
91
}
// 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:29
DeviceClusterizationAlg.h
ReadHandle.h
Handle class for reading from StoreGate.
WriteHandle.h
Handle class for recording to StoreGate.
ActsTrk::DeviceClusterizationAlg::m_deviceCondObjectName
Gaudi::Property< std::string > m_deviceCondObjectName
Definition
DeviceClusterizationAlg.h:67
ActsTrk::DeviceClusterizationAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Function executing the algorithm.
Definition
DeviceClusterizationAlg.cxx:36
ActsTrk::DeviceClusterizationAlg::m_outputMeasKey
SG::WriteHandleKey< traccc::edm::measurement_collection::buffer > m_outputMeasKey
Definition
DeviceClusterizationAlg.h:88
ActsTrk::DeviceClusterizationAlg::m_outputClusterKey
SG::WriteHandleKey< traccc::edm::silicon_cluster_collection::buffer > m_outputClusterKey
Definition
DeviceClusterizationAlg.h:91
ActsTrk::DeviceClusterizationAlg::initialize
virtual StatusCode initialize() override
Function initializing the algorithm.
Definition
DeviceClusterizationAlg.cxx:19
ActsTrk::DeviceClusterizationAlg::m_deviceDesign
const traccc::detector_design_description::const_view * m_deviceDesign
Definition
DeviceClusterizationAlg.h:97
ActsTrk::DeviceClusterizationAlg::m_clusteringAlgProviderTool
ToolHandle< IDeviceClusterizationAlgProviderTool > m_clusteringAlgProviderTool
Definition
DeviceClusterizationAlg.h:73
ActsTrk::DeviceClusterizationAlg::m_deviceCond
const traccc::detector_conditions_description::const_view * m_deviceCond
Definition
DeviceClusterizationAlg.h:98
ActsTrk::DeviceClusterizationAlg::m_deviceDesignObjectName
Gaudi::Property< std::string > m_deviceDesignObjectName
Definition
DeviceClusterizationAlg.h:64
ActsTrk::DeviceClusterizationAlg::m_retrieveClusterCells
Gaudi::Property< bool > m_retrieveClusterCells
Definition
DeviceClusterizationAlg.h:59
ActsTrk::DeviceClusterizationAlg::m_inputCellsKey
SG::ReadHandleKey< traccc::edm::silicon_cell_collection::const_view > m_inputCellsKey
Definition
DeviceClusterizationAlg.h:82
ActsTrk::DeviceClusterizationAlg::m_deviceMR
ToolHandle< AthDevice::IMemoryResourceTool > m_deviceMR
Definition
DeviceClusterizationAlg.h:77
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition
MdtCalibInput.h:31
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition
ReadCondHandle.h:269
Generated on
for ATLAS Offline Software by
1.17.0