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_alg = m_clusteringAlgProviderTool->getClusterizationAlgorithm(ctx);
48
49 // ---- 2.5 Retrieve the sorting algorithm ---------------------------------------------
50 auto sorting_alg = m_clusteringAlgProviderTool->getSortingAlgorithm(ctx);
51
52 // ---- 3. Run traccc clusterization ---------------------------------------------
53 traccc::edm::silicon_cluster_collection::buffer cluster_gpu_buffer;
54 traccc::edm::measurement_collection::buffer measurements_gpu_buffer;
55
57 ATH_MSG_DEBUG("Running clusterization with returning cell info");
58 std::tie(measurements_gpu_buffer, cluster_gpu_buffer) =
59 (*clustering_alg)(
60 *inputTracccCells, *m_deviceDesign, *m_deviceCond,
61 traccc::device::clustering_keep_disjoint_set{});
62 } else {
63 ATH_MSG_DEBUG("Running clusterization without returning cell info");
64 measurements_gpu_buffer = (*clustering_alg)(*inputTracccCells, *m_deviceDesign, *m_deviceCond);
65 }
66
67 // ---- 3.5 Run measurement sorting ---------------------------------------------
68 auto sortedTracccMeasurements =
69 (*sorting_alg)(measurements_gpu_buffer);
70
71 ATH_MSG_DEBUG("Reconstructed " << clustering_alg.copy().get_size(measurements_gpu_buffer) << " measurements.");
72
73 // ---- 4. Write output traccc measurements to StoreGate -------------------------
74 auto outputTracccMeas = SG::makeHandle(m_outputMeasKey, ctx);
75 ATH_CHECK(outputTracccMeas.record(
76 std::make_unique<traccc::edm::measurement_collection::buffer>(
77 std::move(sortedTracccMeasurements))));
78 ATH_MSG_DEBUG("Wrote measurement buffer to '" << m_outputMeasKey.key() << "'");
79
80 auto outputTracccClusters = SG::makeHandle(m_outputClusterKey, ctx);
81 ATH_CHECK(outputTracccClusters.record(
82 std::make_unique<traccc::edm::silicon_cluster_collection::buffer>(
83 std::move(cluster_gpu_buffer))));
84 ATH_MSG_DEBUG("Wrote cluster buffer to '" << m_outputClusterKey.key() << "'");
85
86 return StatusCode::SUCCESS;
87}
88
89} // 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())