ATLAS Offline Software
Loading...
Searching...
No Matches
DeviceClusterizationAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
5
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
16namespace ActsTrk {
17
18// -----------------------------------------------------------------------
20{
21 ATH_MSG_DEBUG("Initializing " << name());
22
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
31
32 ATH_MSG_DEBUG("Successfully initialized");
33 return StatusCode::SUCCESS;
34}
35
36StatusCode 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
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
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
Handle class for reading from StoreGate.
Handle class for recording to StoreGate.
Gaudi::Property< std::string > m_deviceCondObjectName
virtual StatusCode execute(const EventContext &ctx) const override
Function executing the algorithm.
SG::WriteHandleKey< traccc::edm::measurement_collection::buffer > m_outputMeasKey
SG::WriteHandleKey< traccc::edm::silicon_cluster_collection::buffer > m_outputClusterKey
virtual StatusCode initialize() override
Function initializing the algorithm.
const traccc::detector_design_description::const_view * m_deviceDesign
ToolHandle< IDeviceClusterizationAlgProviderTool > m_clusteringAlgProviderTool
const traccc::detector_conditions_description::const_view * m_deviceCond
Gaudi::Property< std::string > m_deviceDesignObjectName
Gaudi::Property< bool > m_retrieveClusterCells
SG::ReadHandleKey< traccc::edm::silicon_cell_collection::const_view > m_inputCellsKey
ToolHandle< AthDevice::IMemoryResourceTool > m_deviceMR
const ServiceHandle< StoreGateSvc > & detStore() const
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())