ATLAS Offline Software
Loading...
Searching...
No Matches
DeviceTripletSeedingAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
5
10
11// traccc EDM
12#include "traccc/edm/silicon_cell_collection.hpp"
13#include "traccc/edm/measurement_collection.hpp"
14
15// vecmem
16#include "vecmem/memory/memory_resource.hpp"
17
18
19namespace ActsTrk {
20
21// -----------------------------------------------------------------------
23{
24 ATH_MSG_DEBUG("Initializing " << name());
25
27 ATH_CHECK(m_inputPixelSPKey.initialize());
28 ATH_CHECK(m_outputPixelSeedsKey.initialize());
29 ATH_CHECK(m_beamSpotKey.initialize());
31
33
34 ATH_MSG_DEBUG("Successfully initialized");
35 return StatusCode::SUCCESS;
36}
37
39{
40
41 ATH_MSG_INFO("Setting up configs");
49 m_seedfinder.cotThetaMax = m_cotThetaMax;
54 m_seedfinder.sigmaScattering = m_sigmaScattering;
56 m_seedfinder.radLengthPerSeed = m_radLengthPerSeed;
57 m_seedfinder.maxSeedsPerSpM = m_maxSeedsPerSpM;
58 m_seedfinder.phiBinDeflectionCoverage = m_phiBinDeflectionCoverage;
59 m_seedfinder.setup();
60
62 m_seedfilter.impactWeightFactor = m_impactWeightFactor;
63 m_seedfilter.compatSeedWeight = m_compatSeedWeight;
65 m_seedfilter.compatSeedLimit = m_compatSeedLimit;
67 m_seedfilter.good_spB_weight_increase = m_goodSpBWeightIncrease;
69 m_seedfilter.good_spT_weight_increase = m_goodSpTWeightIncrease;
70 m_seedfilter.good_spB_min_weight = m_goodSpBMinWeight;
71 m_seedfilter.seed_min_weight = m_seedMinWeight;
73
74 return StatusCode::SUCCESS;
75
76}
77
78StatusCode DeviceTripletSeedingAlg::execute(const EventContext& ctx) const
79{
80 ATH_MSG_DEBUG("Executing device triplet seeding.");
81
82 // ---- 1. Read input traccc spacepoints from StoreGate --------------------------------
83 auto inputTracccPixelSpacepoints = SG::makeHandle(m_inputPixelSPKey, ctx);
84 ATH_CHECK(inputTracccPixelSpacepoints.isValid());
85 ATH_MSG_DEBUG("Read traccc spacepoints from '"
86 << inputTracccPixelSpacepoints.key() << "'");
87
88 // ---- 2. Read the beam spot and the magnetic field at the beam spot -------------------
89 const InDet::BeamSpotData* beamSpotData{nullptr};
90 ATH_CHECK(SG::get(beamSpotData, m_beamSpotKey, ctx));
91 const Amg::Vector3D beamPos = beamSpotData->beamPos();
92
93 const AtlasFieldCacheCondObj* fieldCondObj{nullptr};
94 ATH_CHECK(SG::get(fieldCondObj, m_fieldCondObjInputKey, ctx));
96 fieldCondObj->getInitializedCache(fieldCache);
97 double bField[3]{0., 0., 0.};
98 const double position[3]{beamPos.x(), beamPos.y(), 0.};
99 fieldCache.getField(position, bField);
100
101 // The field cache returns the field in kT
102 traccc::seedfinder_config seedfinder = m_seedfinder;
103 seedfinder.bFieldInZ = static_cast<float>(bField[2] * 1000. * unit<traccc::scalar>::T);
104 seedfinder.beamPos = {static_cast<float>(beamPos.x() * unit<traccc::scalar>::mm),
105 static_cast<float>(beamPos.y() * unit<traccc::scalar>::mm)};
106 seedfinder.setup();
107
108 traccc::spacepoint_grid_config grid{seedfinder};
109 if (m_gridDeltaRMax > 0.f) {
110 grid.deltaRMax = m_gridDeltaRMax * unit<traccc::scalar>::mm;
111 }
112
113 // ---- 3. Get traccc seeding alg ---------------------------------------------
114 auto seeding_alg = m_seedingAlgProviderTool->getTripletSeedingAlgorithm(ctx, seedfinder, grid, m_seedfilter);
115
116 // ---- 4. Run traccc seed formation ---------------------------------------------
117 traccc::edm::seed_collection::buffer pixel_seeds_gpu_buffer = (*seeding_alg)(*inputTracccPixelSpacepoints);
118
119 ATH_MSG_DEBUG("Reconstructed " << seeding_alg.copy().get_size(pixel_seeds_gpu_buffer) << " seeds.");
120
121 // ---- 5. Write output traccc seeds to StoreGate -------------------------
122 auto outputTracccPixelSeeds = SG::makeHandle(m_outputPixelSeedsKey, ctx);
123 ATH_CHECK(outputTracccPixelSeeds.record(
124 std::make_unique<traccc::edm::seed_collection::buffer>(
125 std::move(pixel_seeds_gpu_buffer))));
126 ATH_MSG_DEBUG("Wrote seeds buffer to '" << m_outputPixelSeedsKey.key() << "'");
127
128 return StatusCode::SUCCESS;
129}
130
131
132
133} // 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.
ToolHandle< IDeviceSeedingAlgProviderTool > m_seedingAlgProviderTool
Gaudi::Property< int > m_phiBinDeflectionCoverage
Gaudi::Property< float > m_goodSpTWeightIncrease
SG::ReadHandleKey< traccc::edm::spacepoint_collection::const_view > m_inputPixelSPKey
Gaudi::Property< float > m_deltaInvHelixDiameter
SG::WriteHandleKey< traccc::edm::seed_collection::buffer > m_outputPixelSeedsKey
Gaudi::Property< float > m_goodSpBMinWeight
Gaudi::Property< unsigned int > m_compatSeedLimit
Gaudi::Property< float > m_goodSpBMinRadius
virtual StatusCode execute(const EventContext &ctx) const override
Function executing the algorithm.
virtual StatusCode initialize() override
Function initializing the algorithm.
Gaudi::Property< unsigned int > m_maxSeedsPerSpM
Gaudi::Property< float > m_goodSpBWeightIncrease
Gaudi::Property< float > m_radLengthPerSeed
Gaudi::Property< float > m_goodSpTMaxRadius
Gaudi::Property< float > m_compatSeedWeight
Gaudi::Property< float > m_collisionRegionMax
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCondObjInputKey
Gaudi::Property< float > m_impactWeightFactor
Gaudi::Property< float > m_collisionRegionMin
void getInitializedCache(MagField::AtlasFieldCache &cache) const
get B field cache for evaluation as a function of 2-d or 3-d position.
const Amg::Vector3D & beamPos() const noexcept
Local cache for magnetic field (based on MagFieldServices/AtlasFieldSvcTLS.h).
void getField(const double *ATH_RESTRICT xyz, double *ATH_RESTRICT bxyz, double *ATH_RESTRICT deriv=nullptr)
get B field value at given position xyz[3] is in mm, bxyz[3] is in kT if deriv[9] is given,...
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Eigen::Matrix< double, 3, 1 > Vector3D
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())