ATLAS Offline Software
Loading...
Searching...
No Matches
DeviceTrackFindingAlg.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/track_parameters.hpp"
11#include "traccc/edm/track_container.hpp"
12
13// vecmem
14#include "vecmem/memory/memory_resource.hpp"
15
16template <typename scalar_t>
17using unit = detray::unit<scalar_t>;
18
19namespace ActsTrk {
20
21// -----------------------------------------------------------------------
23{
24 ATH_MSG_DEBUG("Initializing " << name());
25
27
28 ATH_CHECK(m_inputMeasKey.initialize());
29 ATH_CHECK(m_inputTrkParamKey.initialize());
30 ATH_CHECK(m_outputTracksKey.initialize());
31
34
36
37 ATH_MSG_DEBUG("Successfully initialized");
38 return StatusCode::SUCCESS;
39}
40
42{
43
44 ATH_MSG_INFO("Setting up configs");
45
46 m_finding_cfg.max_num_branches_per_seed = m_maxNumBranchesPerSeed;
47 m_finding_cfg.max_num_branches_per_surface = m_maxNumBranchesPerSurface;
48 m_finding_cfg.min_track_candidates_per_track = m_minTrackCandidatesPerTrack;
49 m_finding_cfg.max_track_candidates_per_track = m_maxTrackCandidatesPerTrack;
50 m_finding_cfg.min_step_length_for_next_surface =
52 m_finding_cfg.max_step_counts_for_next_surface = m_maxStepCountsForNextSurface;
53 m_finding_cfg.chi2_max = m_chi2Max;
54 m_finding_cfg.max_num_skipping_per_cand = m_maxNumSkippingPerCand;
55 m_finding_cfg.max_num_consecutive_skipped = m_maxNumConsecutiveSkipped;
58
59 m_finding_cfg.propagation.stepping.min_stepsize = 1e-4f * unit<float>::mm;
60 m_finding_cfg.propagation.stepping.rk_error_tol = 1e-4f * unit<float>::mm;
61 m_finding_cfg.propagation.stepping.step_constraint =
62 std::numeric_limits<float>::max();
63 m_finding_cfg.propagation.stepping.path_limit = 5.f * unit<float>::m;
64 m_finding_cfg.propagation.stepping.max_rk_updates = 10000u;
65 m_finding_cfg.propagation.stepping.use_mean_loss = true;
66 m_finding_cfg.propagation.stepping.use_eloss_gradient = false;
67 m_finding_cfg.propagation.stepping.use_field_gradient = false;
68 m_finding_cfg.propagation.stepping.do_covariance_transport = true;
69 m_finding_cfg.propagation.navigation.intersection.overstep_tolerance =
70 -300.f * unit<float>::um;
71
72 m_finding_cfg.max_num_tracks_per_measurement = m_maxNumTracksPerMeasurement;
73 m_finding_cfg.initial_links_per_seed = m_initialLinksPerSeed;
74
75 return StatusCode::SUCCESS;
76
77}
78
79StatusCode DeviceTrackFindingAlg::execute(const EventContext& ctx) const
80{
81 ATH_MSG_DEBUG("Executing device track finding.");
82
83 // ---- 1. Read traccc input from StoreGate --------------------------------
84 auto inputTracccMeasurements = SG::makeHandle(m_inputMeasKey, ctx);
85 ATH_CHECK(inputTracccMeasurements.isValid());
86 ATH_MSG_DEBUG("Read traccc measurements from '"
87 << inputTracccMeasurements.key() << "'");
88
89 auto inputTracccTrkParam = SG::makeHandle(m_inputTrkParamKey, ctx);
90 ATH_CHECK(inputTracccTrkParam.isValid());
91 ATH_MSG_DEBUG("Read traccc trk param from '"
92 << inputTracccTrkParam.key() << "'");
93
94 // ---- 2. Get traccc track finding alg ---------------------------------------------
95 auto trkfinding_alg = m_trkFindingAlgProviderTool->getAlgorithm(ctx, m_finding_cfg);
96
97 // ---- 3. Run traccc track finding ---------------------------------------------
98 auto tracks_container_buffer = (*trkfinding_alg)(*m_deviceDetector, *m_deviceMagField, *inputTracccMeasurements, *inputTracccTrkParam);
99 ATH_MSG_DEBUG("Reconstructed " << trkfinding_alg.copy().get_size(tracks_container_buffer.tracks) << " track parameters.");
100
101 // ---- 4. Write output traccc tracks and track states to StoreGate -------------------------
102 auto outputTracccTracks = SG::makeHandle(m_outputTracksKey, ctx);
103 ATH_CHECK(outputTracccTracks.record(
104 std::make_unique<traccc_track_container::buffer>(
105 std::move(tracks_container_buffer))));
106 ATH_MSG_DEBUG("Wrote tracks buffer to '" << m_outputTracksKey.key() << "'");
107
108 return StatusCode::SUCCESS;
109}
110
111
112
113} // namespace ActsTrk
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_INFO(x,...)
detray::unit< scalar_t > unit
Handle class for reading from StoreGate.
Handle class for recording to StoreGate.
SG::ReadHandleKey< traccc::edm::measurement_collection::const_view > m_inputMeasKey
Gaudi::Property< unsigned int > m_maxNumBranchesPerSeed
const traccc::magnetic_field * m_deviceMagField
Gaudi::Property< unsigned int > m_maxStepCountsForNextSurface
Gaudi::Property< unsigned int > m_maxNumSkippingPerCand
Gaudi::Property< unsigned int > m_maxNumBranchesPerSurface
SG::ReadHandleKey< traccc::bound_track_parameters_collection_types::buffer > m_inputTrkParamKey
const traccc::detector_buffer * m_deviceDetector
Gaudi::Property< std::string > m_deviceDetectorObjectName
Gaudi::Property< unsigned int > m_initialLinksPerSeed
virtual StatusCode execute(const EventContext &ctx) const override
Function executing the algorithm.
ToolHandle< IDeviceTrackFindingAlgProviderTool > m_trkFindingAlgProviderTool
Gaudi::Property< unsigned int > m_maxNumTracksPerMeasurement
virtual StatusCode initialize() override
Function initializing the algorithm.
SG::WriteHandleKey< traccc_track_container::buffer > m_outputTracksKey
Gaudi::Property< float > m_chi2Max
Gaudi::Property< unsigned int > m_maxNumConsecutiveSkipped
Gaudi::Property< float > m_minStepLengthForNextSurface
Gaudi::Property< unsigned int > m_maxTrackCandidatesPerTrack
Gaudi::Property< std::string > m_inputMagFieldKey
Gaudi::Property< unsigned int > m_minTrackCandidatesPerTrack
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())