ATLAS Offline Software
Loading...
Searching...
No Matches
DeviceSPFormationAlg.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_inputMeasKey.initialize());
26 ATH_CHECK(m_outputPixelSPKey.initialize());
27
29
30 ATH_MSG_DEBUG("Successfully initialized");
31 return StatusCode::SUCCESS;
32}
33
34StatusCode DeviceSPFormationAlg::execute(const EventContext& ctx) const
35{
36 ATH_MSG_DEBUG("Executing device SP formation.");
37
38 // ---- 1. Read input traccc measurements from StoreGate --------------------------------
39 auto inputTracccMeas = SG::makeHandle(m_inputMeasKey, ctx);
40 ATH_CHECK(inputTracccMeas.isValid());
41 ATH_MSG_DEBUG("Read traccc measurements from '"
42 << m_inputMeasKey.key() << "'");
43
44 // ---- 2. Get traccc spacepoint formation alg ---------------------------------------------
45 auto sp_pair = m_spAlgProviderTool->getPixelSPFormationAlgorithm(ctx);
46 std::shared_ptr<const traccc::device::silicon_pixel_spacepoint_formation_algorithm> sp_alg = sp_pair.second;
47
48 // ---- 3. Run traccc pixel spacepoint formation ---------------------------------------------
49
50 traccc::edm::spacepoint_collection::buffer pixel_spacepoints_gpu_buffer = (*sp_alg)(*m_deviceDetector, *inputTracccMeas);
51
52 ATH_MSG_DEBUG("Reconstructed " << (sp_pair.first)->get_size(pixel_spacepoints_gpu_buffer) << " pixel spacepoints.");
53
54 // ---- 4. Write output traccc spacepoints to StoreGate -------------------------
55 auto outputTracccPixelSP = SG::makeHandle(m_outputPixelSPKey, ctx);
56 ATH_CHECK(outputTracccPixelSP.record(
57 std::make_unique<traccc::edm::spacepoint_collection::buffer>(
58 std::move(pixel_spacepoints_gpu_buffer))));
59 ATH_MSG_DEBUG("Wrote spacepoint buffer to '" << m_outputPixelSPKey.key() << "'");
60
61 return StatusCode::SUCCESS;
62}
63
64} // 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.
virtual StatusCode initialize() override
Function initializing the algorithm.
const traccc::detector_buffer * m_deviceDetector
ToolHandle< AthDevice::IMemoryResourceTool > m_deviceMR
ToolHandle< IDeviceSPFormationAlgProviderTool > m_spAlgProviderTool
Gaudi::Property< std::string > m_deviceDetectorName
SG::WriteHandleKey< traccc::edm::spacepoint_collection::buffer > m_outputPixelSPKey
virtual StatusCode execute(const EventContext &ctx) const override
Function executing the algorithm.
SG::ReadHandleKey< traccc::edm::measurement_collection::const_view > m_inputMeasKey
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())