ATLAS Offline Software
Loading...
Searching...
No Matches
ActsTrk::TracccTrackConverterAlg Class Reference

Algorithm converting traccc tracks ( tracks + track states sdevice buffer) to ACTS tracks (host container). More...

#include <TracccTrackConverterAlg.h>

Inheritance diagram for ActsTrk::TracccTrackConverterAlg:

Public Member Functions

virtual StatusCode initialize () override
 Function initializing the algorithm.
virtual StatusCode execute (const EventContext &ctx) const override
 Function executing the algorithm.
virtual StatusCode finalize () override
 Function finalizing the algorthm.
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual bool isClonable () const override
 Specify if the algorithm is clonable.
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
virtual bool filterPassed (const EventContext &ctx) const
 Get filter decision:
virtual void setFilterPassed (bool state, const EventContext &ctx) const
 Set filter decision:
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvc > StoreGateSvc_t

Private Member Functions

const xAOD::UncalibratedMeasurement & makeSourceLink (const unsigned int &meas_index, std::span< const unsigned int > pixelMap, std::span< const unsigned int > stripMap, const xAOD::PixelClusterContainer &pixel_clusters, const xAOD::StripClusterContainer &strip_clusters) const
const Acts::Surface & findActsSurface (const Acts::GeometryIdentifier &actsID) const
std::optional< Acts::BoundTrackParameters > convertGlobalToActsParameters (traccc::bound_track_parameters< traccc::default_algebra > const &trkParams) const
template<typename state_t>
std::optional< Acts::BoundTrackParameters > convertSmoothedToActsParameters (traccc::edm::track_state< state_t > const &state) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

DataObjIDColl m_extendedExtraObjects
 Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default).
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default).
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared
The input device resident cluster, measurement and cell collection names

{@

SG::ReadHandleKey< xAOD::PixelClusterContainer > m_inputPixelClustersKey
SG::ReadHandleKey< xAOD::StripClusterContainer > m_inputStripClustersKey
SG::ReadHandleKey< std::vector< unsigned int > > m_inputMeasToPixelSPKey
SG::ReadHandleKey< std::vector< unsigned int > > m_inputMeasToStripClKey
SG::ReadHandleKey< traccc_track_container::buffer > m_inputTracksKey
The output host resident track container name

{@

SG::WriteHandleKey< ActsTrk::TrackContainer > m_outputTracksKey
The host memory resource tool to use for memory allocations
ToolHandle< AthDevice::IMemoryResourceTool > m_hostMR
The copy tool used for copying data from device
ToolHandle< AthDevice::ICopyTool > m_copy
std::shared_ptr< const Acts::TrackingGeometry > m_trackingGeometry
ServiceHandle< ActsTrk::ITrackingGeometrySvc > m_trackingGeometrySvc {this, "TrackingGeometrySvc", "ActsTrackingGeometrySvc"}
std::map< Acts::GeometryIdentifier, const Acts::Surface * > m_actsSurfaceMap
ActsTrk::MutableTrackContainerHandlesHelper m_tracksBackendHandlesHelper
Gaudi::Property< std::string > m_hostDetectorObjectName
const traccc::host_detector * m_hostDetector = nullptr
std::atomic< int > m_nTracksIn = 0
 The object counters for debug prints in finalize method {.
std::atomic< int > m_nTracksOut = 0
std::atomic< int > m_nExcludedFitOutcome = 0
std::atomic< int > m_nExcludedNoState = 0
std::atomic< int > m_nExcludedBadNdf = 0
std::atomic< int > m_nExcludedWeirdState = 0
std::atomic< int > m_nExcludedWeirdGlobal = 0

Detailed Description

Algorithm converting traccc tracks ( tracks + track states sdevice buffer) to ACTS tracks (host container).

This algorithm retrieves the input device resident traccc track and track states collection from the event store, copies the data to host buffer and converts the traccc tracks to ActsTrk::Track. It works under the assumption that the other relevant traccc objects have already been converted to xAOD and are available on host in the event store and that the indices between the HOST and DEVICE resident containers have been recorded in a index map.

Author
Neža Ribarič neza..nosp@m.riba.nosp@m.ric@c.nosp@m.ern..nosp@m.ch

Definition at line 45 of file TracccTrackConverterAlg.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 376 of file AthCommonDataStore.h.

Member Function Documentation

◆ convertGlobalToActsParameters()

std::optional< Acts::BoundTrackParameters > ActsTrk::TracccTrackConverterAlg::convertGlobalToActsParameters ( traccc::bound_track_parameters< traccc::default_algebra > const & trkParams) const
private

Definition at line 125 of file TracccTrackConverterAlg.cxx.

128{
129 if (trkParams.bound_local()[0] == 0 && trkParams.bound_local()[1] == 0 &&
130 trkParams.phi() == 0 && trkParams.theta() == 0 &&
131 trkParams.qop() == 0 && trkParams.time() == 0) {
132 // traccc reports degenerate states like this; treat as "no
133 // parameters" rather than as a real (but zeroed-out) track.
134 return std::nullopt;
135 }
136
137 const auto& detrayDetector = m_hostDetector->as<traccc::itk_detector>();
138 const detray::tracking_surface detray_surface{detrayDetector, trkParams.surface_link()};
139 const auto geo_id = detray_surface.source();
140 const Acts::GeometryIdentifier acts_geom_id{geo_id};
141
142 const Acts::Surface& surface = findActsSurface(acts_geom_id);
143
144 Acts::BoundVector params;
145 params << trkParams.bound_local()[0], trkParams.bound_local()[1],
146 trkParams.phi(), trkParams.theta(), trkParams.qop(), trkParams.time();
147
148 // ---- sanity-check units ----
149 const double qop = trkParams.qop();
150 const double p = (qop != 0) ? 1.0 / std::abs(qop) : 0.0;
151 const double pT = p * std::sin(trkParams.theta());
152 ATH_MSG_DEBUG("Global params: d0=" << trkParams.bound_local()[0]
153 << " z0=" << trkParams.bound_local()[1]
154 << " phi=" << trkParams.phi()
155 << " theta=" << trkParams.theta()
156 << " qop=" << qop
157 << " -> |p|=" << p << " pT=" << pT
158 << " charge=" << (qop > 0 ? +1 : -1)
159 << " time=" << trkParams.time());
160
161 // Traccc covariance has no time uncertainty; Acts::BoundMatrix does
162 // (it's eBoundSize x eBoundSize == 6x6). For now leave the time row/column at the
163 // Identity() values set above and only fill the spatial+qop values.
164 static constexpr unsigned int kAtlasCovSize = 5; // d0, z0, phi, theta, qop (no time)
165
166 Acts::BoundMatrix cov = Acts::BoundMatrix::Identity();
167 const auto& atlasCov = trkParams.covariance();
168 for (unsigned i = 0; i < kAtlasCovSize; ++i) {
169 for (unsigned j = 0; j < kAtlasCovSize; ++j) {
170 cov(i, j) = atlasCov[i][j];
171 }
172 }
173
174 return Acts::BoundTrackParameters(surface.getSharedPtr(), params, cov,
175 Acts::ParticleHypothesis::pion());
176}
#define ATH_MSG_DEBUG(x,...)
const Acts::Surface & findActsSurface(const Acts::GeometryIdentifier &actsID) const
const traccc::host_detector * m_hostDetector
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)

◆ convertSmoothedToActsParameters()

template<typename state_t>
std::optional< Acts::BoundTrackParameters > ActsTrk::TracccTrackConverterAlg::convertSmoothedToActsParameters ( traccc::edm::track_state< state_t > const & state) const
private

Definition at line 180 of file TracccTrackConverterAlg.cxx.

182{
183 const auto& atlasParam = state.smoothed_params();
184
185 if (atlasParam.bound_local()[0] == 0 && atlasParam.bound_local()[1] == 0 &&
186 atlasParam.phi() == 0 && atlasParam.theta() == 0 &&
187 atlasParam.qop() == 0 && atlasParam.time() == 0) {
188 // traccc reports degenerate states like this; treat as "no
189 // parameters" rather than as a real (but zeroed-out) state.
190 return std::nullopt;
191 }
192
193 const auto& detrayDetector = m_hostDetector->as<traccc::itk_detector>();
194 const detray::tracking_surface detray_surface{detrayDetector, atlasParam.surface_link()};
195 const auto geo_id = detray_surface.source();
196 const Acts::GeometryIdentifier acts_geom_id{geo_id};
197
198 const Acts::Surface& surface = findActsSurface(acts_geom_id);
199
200 // d0/z0 come from the measurement's local position; the remaining bound
201 // parameters come from the smoothed track state.
202 Acts::BoundVector params;
203 params << atlasParam.bound_local()[0], atlasParam.bound_local()[1],
204 atlasParam.phi(), atlasParam.theta(), atlasParam.qop(),
205 atlasParam.time();
206
207 // ---- per-state momentum check for sanity ----
208 const double qop = atlasParam.qop();
209 const double p = (qop != 0) ? 1.0 / std::abs(qop) : 0.0;
210 const double pT = p * std::sin(atlasParam.theta());
211 ATH_MSG_DEBUG("Smoothed state: d0=" << atlasParam.bound_local()[0]
212 << " z0=" << atlasParam.bound_local()[1]
213 << " phi=" << atlasParam.phi()
214 << " theta=" << atlasParam.theta()
215 << " qop=" << qop
216 << " -> |p|=" << p << " pT=" << pT);
217
218 // Traccc covariance has no time uncertainty; Acts::BoundMatrix does
219 // (it's eBoundSize x eBoundSize == 6x6). For now leave the time row/column at the
220 // Identity() values set above and only fill the spatial+qop values.
221 static constexpr unsigned int kAtlasCovSize = 5; // d0, z0, phi, theta, qop (no time)
222
223 Acts::BoundMatrix cov = Acts::BoundMatrix::Identity();
224 const auto& atlasCov = atlasParam.covariance();
225 for (unsigned i = 0; i < kAtlasCovSize; ++i) {
226 for (unsigned j = 0; j < kAtlasCovSize; ++j) {
227 cov(i, j) = atlasCov[i][j];
228 }
229 }
230
231 return Acts::BoundTrackParameters(surface.getSharedPtr(), params, cov,
232 Acts::ParticleHypothesis::pion());
233}

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode ActsTrk::TracccTrackConverterAlg::execute ( const EventContext & ctx) const
overridevirtual

Function executing the algorithm.

Definition at line 235 of file TracccTrackConverterAlg.cxx.

236{
237 // ---- Retrieve HOST RESIDENT clusters (always needed) ----
238 // These are made during the TracccMeasurementConverterAlg
239 auto pixel_clusters = SG::makeHandle(m_inputPixelClustersKey, ctx);
240 ATH_CHECK(pixel_clusters.isValid());
241
242 auto strip_clusters = SG::makeHandle(m_inputStripClustersKey, ctx);
243 ATH_CHECK(strip_clusters.isValid());
244
245 // ---- Retrieve mapping from traccc measurement index to pixel cluster/spacepoint index (always needed) ----
246 // Because the SPs were created from xAOD pixel clusters on the host, the same traccc measurement index
247 // points to the xAOD pixel cluster and xAOD spacepoint in their respective containers
248 auto pixelMeasMap = SG::makeHandle(m_inputMeasToPixelSPKey, ctx);
249 ATH_CHECK(pixelMeasMap.isValid());
250
251 auto stripMeasMap = SG::makeHandle(m_inputMeasToStripClKey, ctx);
252 ATH_CHECK(stripMeasMap.isValid());
253
254 if(stripMeasMap->size() == 0 || pixelMeasMap->size() == 0){
255 ATH_MSG_FATAL("Maps relating traccc measurements to xAOD cluster containers are empty!!");
256 return StatusCode::FAILURE;
257 }
258
259 // ---- Retrieve DEVICE resident traccc tracks and track states ----
260 auto tracks = SG::makeHandle(m_inputTracksKey, ctx);
261 ATH_CHECK(tracks.isValid());
262
263 auto copy = m_copy->copy(ctx);
264
265 traccc_track_container::buffer traccc_tracks_buffer;
266 traccc_tracks_buffer.tracks =
267 copy->to(tracks->tracks, m_hostMR->mr(),
268 nullptr, vecmem::copy::type::device_to_host);
269 traccc_tracks_buffer.states =
270 copy->to(tracks->states, m_hostMR->mr(),
271 nullptr, vecmem::copy::type::device_to_host);
272
273 traccc_track_container::const_device traccc_tracks(
274 traccc_tracks_buffer);
275
276 ATH_MSG_DEBUG("Read " << traccc_tracks.tracks.size() << " tracks from device.");
277 m_nTracksIn += traccc_tracks.tracks.size();
278
279 // -- Write HOST resident ACTS track container ----
280 Acts::VectorTrackContainer trackBackend;
281 Acts::VectorMultiTrajectory trackStateBackend;
282 ActsTrk::MutableTrackContainer trackContainer(std::move(trackBackend),
283 std::move(trackStateBackend));
284
285 // Bookkeeping for debug summary
286 unsigned nExcludedFitOutcome = 0;
287 unsigned nExcludedNoState = 0;
288 unsigned nExcludedBadNdf = 0;
289 unsigned nExcludedWeirdState = 0;
290 unsigned nExcludedWeirdGlobal = 0;
291
292 for (std::size_t i = 0; i < traccc_tracks.tracks.size(); ++i) {
293
294 const traccc::edm::track track = traccc_tracks.tracks.at(i);
295
296 const auto fitOutcome = track.fit_outcome();
297 if (fitOutcome == traccc::track_fit_outcome::FAILURE_NON_POSITIVE_NDF ||
298 fitOutcome == traccc::track_fit_outcome::FAILURE_NOT_ALL_SMOOTHED ||
299 fitOutcome == traccc::track_fit_outcome::UNKNOWN) {
300 ATH_MSG_DEBUG("Skipping track " << i << ": fit outcome "
301 << static_cast<int>(fitOutcome));
302 ++nExcludedFitOutcome;
303 continue;
304 }
305
306 if (track.constituent_links().empty()) {
307 ++nExcludedNoState;
308 continue;
309 }
310
311 if (track.ndf() >
312 static_cast<float>(std::numeric_limits<unsigned int>::max()) ||
313 track.ndf() <
314 static_cast<float>(std::numeric_limits<unsigned int>::min())) {
315 ++nExcludedBadNdf;
316 continue;
317 }
318
319 TrackValidity track_validity = kValid;
320
321 auto actsTrack = trackContainer.makeTrack();
322 actsTrack.chi2() = track.chi2();
323 actsTrack.nDoF() = track.ndf();
324
325 Acts::TrackStatePropMask const state_mask =
326 Acts::TrackStatePropMask::Smoothed;
327
328 bool firstState = true;
329
330 for (const auto [linkType, stateIdx] : track.constituent_links()) {
331
332 assert(linkType == traccc::edm::track_constituent_link::track_state);
333
334 const auto& state = traccc_tracks.states.at(stateIdx);
335 const auto& meas_index = state.measurement_index();
336
337 auto trackState = actsTrack.appendTrackState(state_mask);
338 trackState.typeFlags().setIsMeasurement();
339
340 const std::optional<Acts::BoundTrackParameters> smoothed =
342
343 if (!smoothed) {
344 ATH_MSG_DEBUG("Track " << i << ": degenerate smoothed state, "
345 "dropping track");
346 track_validity = TrackValidity::kInvalidState;
347 break;
348 }
349
350 const xAOD::UncalibratedMeasurement* sourceLink =
351 &makeSourceLink(meas_index, *pixelMeasMap, *stripMeasMap, *pixel_clusters, *strip_clusters);
352
353 trackState.setUncalibratedSourceLink(ActsTrk::detail::xAODUncalibMeasCalibrator::pack(sourceLink));
354
355 // traccc does not yet do backpropagation, so there is no true
356 // reference surface (perigee) for the track. We use the surface
357 // of the first measurement instead and rely on back-propagation
358 // during the later Acts -> xAOD conversion step to find the real
359 // perigee.
360 if (firstState) {
361 const std::optional<Acts::BoundTrackParameters> global =
363 if (!global) {
364 ATH_MSG_DEBUG("Track "
365 << i
366 << ": degenerate global parameters, "
367 "dropping track");
369 break;
370 }
371 actsTrack.parameters() = global->parameters();
372 actsTrack.covariance() = *global->covariance();
373 actsTrack.setReferenceSurface(
374 global->referenceSurface().getSharedPtr());
375 firstState = false;
376 }
377
378 try {
379 trackState.setReferenceSurface(
380 smoothed->referenceSurface().getSharedPtr());
381 trackState.smoothed() = smoothed->parameters();
382 trackState.smoothedCovariance() = *smoothed->covariance();
383 } catch (const std::exception& e) {
384 ATH_MSG_ERROR("Track " << i << ": failed to set track state ("
385 << e.what() << ")");
386 }
387
388 }
389
390 if (track_validity == TrackValidity::kInvalidState) {
391 ++nExcludedWeirdState;
392 trackContainer.removeTrack(actsTrack.index());
393 } else if (track_validity == TrackValidity::kInvalidGlobalParams) {
394 ++nExcludedWeirdGlobal;
395 trackContainer.removeTrack(actsTrack.index());
396 } else {
397 // sanity checks
398 const auto& pars = actsTrack.parameters();
399 const double qop = pars[Acts::eBoundQOverP];
400 const double p = (qop != 0) ? 1.0 / std::abs(qop) : 0.0;
401 const double pT = p * std::sin(pars[Acts::eBoundTheta]);
402 ATH_MSG_DEBUG("Track " << i << " ACCEPTED: nHits="
403 << track.constituent_links().size()
404 << " chi2=" << track.chi2()
405 << " ndf=" << track.ndf()
406 << " |p|=" << p << " GeV pT=" << pT << " GeV");
407 }
408
409 }
410
411 ATH_MSG_DEBUG("Converted " << trackContainer.size() << " tracks to " << m_outputTracksKey.key() );
412 ATH_MSG_DEBUG("excluded: "
413 << nExcludedFitOutcome << " (fit outcome), "
414 << nExcludedNoState << " (no state), "
415 << nExcludedBadNdf << " (bad ndf), "
416 << nExcludedWeirdState << " (weird state), "
417 << nExcludedWeirdGlobal << " (weird global params)");
418
419 m_nExcludedFitOutcome += nExcludedFitOutcome;
420 m_nExcludedNoState += nExcludedNoState;
421 m_nExcludedBadNdf += nExcludedBadNdf;
422 m_nExcludedWeirdState += nExcludedWeirdState;
423 m_nExcludedWeirdGlobal += nExcludedWeirdGlobal;
424
425 m_nTracksOut += trackContainer.size();
426
427 Acts::ConstVectorTrackContainer constTrackBackend(
428 std::move(trackContainer.container()));
429 Acts::ConstVectorMultiTrajectory constTrackStateBackend(
430 std::move(trackContainer.trackStateContainer()));
431 auto constTrackContainer = std::make_unique<ActsTrk::TrackContainer>(
432 std::move(constTrackBackend), std::move(constTrackStateBackend));
433
434 SG::WriteHandle<ActsTrk::TrackContainer> outputHandle(
435 m_outputTracksKey, ctx);
436 ATH_CHECK(outputHandle.record(std::move(constTrackContainer)));
437
438 return StatusCode::SUCCESS;
439}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_FATAL(x,...)
@ kInvalidGlobalParams
std::optional< Acts::BoundTrackParameters > convertGlobalToActsParameters(traccc::bound_track_parameters< traccc::default_algebra > const &trkParams) const
SG::ReadHandleKey< xAOD::StripClusterContainer > m_inputStripClustersKey
const xAOD::UncalibratedMeasurement & makeSourceLink(const unsigned int &meas_index, std::span< const unsigned int > pixelMap, std::span< const unsigned int > stripMap, const xAOD::PixelClusterContainer &pixel_clusters, const xAOD::StripClusterContainer &strip_clusters) const
ToolHandle< AthDevice::ICopyTool > m_copy
SG::ReadHandleKey< xAOD::PixelClusterContainer > m_inputPixelClustersKey
SG::ReadHandleKey< std::vector< unsigned int > > m_inputMeasToStripClKey
std::atomic< int > m_nTracksIn
The object counters for debug prints in finalize method {.
SG::ReadHandleKey< traccc_track_container::buffer > m_inputTracksKey
SG::WriteHandleKey< ActsTrk::TrackContainer > m_outputTracksKey
ToolHandle< AthDevice::IMemoryResourceTool > m_hostMR
SG::ReadHandleKey< std::vector< unsigned int > > m_inputMeasToPixelSPKey
std::optional< Acts::BoundTrackParameters > convertSmoothedToActsParameters(traccc::edm::track_state< state_t > const &state) const
static Acts::SourceLink pack(const Ptr_t &measurement)
Pack the measurement type pointer to an Acts::SourceLink including the intermediate conversion into a...
Acts::TrackContainer< MutableTrackBackend, MutableTrackStateBackend, Acts::detail::ValueHolder > MutableTrackContainer
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
bool copy
Definition calibdata.py:26
UncalibratedMeasurement_v1 UncalibratedMeasurement
Define the version of the uncalibrated measurement class.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthCommonAlgorithm< Gaudi::Algorithm >::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 89 of file AthCommonAlgorithm.cxx.

54{
55 // If we didn't find any symlinks to add, just return the collection
56 // from the base class. Otherwise, return the extended collection.
57 if (!m_extendedExtraObjects.empty()) {
59 }
61}
Common base class for algorithms.

◆ filterPassed()

virtual bool AthCommonAlgorithm< Gaudi::Algorithm >::filterPassed ( const EventContext & ctx) const
inlinevirtualinherited

Get filter decision:

Definition at line 93 of file AthCommonAlgorithm.h.

93 {
94 return execState( ctx ).filterPassed();
95 }
virtual bool filterPassed(const EventContext &ctx) const
Get filter decision:

◆ finalize()

StatusCode ActsTrk::TracccTrackConverterAlg::finalize ( )
overridevirtual

Function finalizing the algorthm.

Definition at line 441 of file TracccTrackConverterAlg.cxx.

442{
443 ATH_MSG_DEBUG("Finalizing.");
444
445 ATH_MSG_DEBUG("Received " << m_nTracksIn << " tracks, wrote " << m_nTracksOut);
446 ATH_MSG_DEBUG("Excluded: "
447 << m_nExcludedFitOutcome << " (fit outcome), "
448 << m_nExcludedNoState << " (no state), "
449 << m_nExcludedBadNdf << " (bad ndf), "
450 << m_nExcludedWeirdState << " (weird state), "
451 << m_nExcludedWeirdGlobal << " (weird global params)");
452
453 ATH_MSG_DEBUG("Successfully finalized");
454 return StatusCode::SUCCESS;
455}

◆ findActsSurface()

const Acts::Surface & ActsTrk::TracccTrackConverterAlg::findActsSurface ( const Acts::GeometryIdentifier & actsID) const
private

Definition at line 112 of file TracccTrackConverterAlg.cxx.

114{
115 const auto surfaceIt = m_actsSurfaceMap.find(actsID);
116 if (surfaceIt == m_actsSurfaceMap.end()) {
117 ATH_MSG_ERROR("No Acts surface known for Acts geometry id "
118 << actsID);
119 throw std::domain_error("No Acts surface for this geometry id");
120 }
121 return *surfaceIt->second;
122}
std::map< Acts::GeometryIdentifier, const Acts::Surface * > m_actsSurfaceMap

◆ initialize()

StatusCode ActsTrk::TracccTrackConverterAlg::initialize ( )
overridevirtual

Function initializing the algorithm.

Definition at line 19 of file TracccTrackConverterAlg.cxx.

20{
21 ATH_MSG_DEBUG("Initializing.");
22
23 ATH_CHECK(m_hostMR.retrieve());
24 ATH_CHECK(m_copy.retrieve());
25
30
31 ATH_CHECK(m_inputTracksKey.initialize());
32 ATH_CHECK(m_outputTracksKey.initialize());
33
35
36 // Build the ACTS-surface <-> ACTS-id lookup map once,
37 // up front, rather than re-deriving them per event.
38 // Possibly this will be built during ACTS->Detray conversion
39 // Possibly this is an issue when the tracking geometry changes between events
40 if (!m_trackingGeometrySvc.empty()) {
42 m_trackingGeometry = m_trackingGeometrySvc->trackingGeometry();
43 m_trackingGeometry->visitSurfaces([&](const Acts::Surface* surface) {
44 if (!surface) return;
45 // m_allsurfaces.push_back(surface->getSharedPtr());
46 const auto *actsElement = getActsDetectorElement(surface);
47 if (!actsElement){
48 ATH_MSG_DEBUG("Could not find matching Acts detector element for surface with geometryId " << surface->geometryId());
49 return;
50 }
51 if(dynamic_cast<const InDetDD::HGTD_DetectorElement*>(actsElement->upstreamDetectorElement()) != nullptr) {
52 // skip HGTD surfaces for now
53 // currently no time info is being used in traccc
54 ATH_MSG_VERBOSE("Found HGTD surface with geometryId " << surface->geometryId());
55 return;
56 }
57 const auto *geoElement = actsElement->upstreamDetectorElement();
58 const auto *detElem = dynamic_cast<const InDetDD::SiDetectorElement*>(geoElement);
59 if (!geoElement || !detElem) {
60 ATH_MSG_DEBUG("Could not find matching Athena silicon detector element for surface with geometryId " << surface->geometryId());
61 return;
62 }
63
64 const Acts::GeometryIdentifier actsID = surface->geometryId();
65 const auto [it, inserted] = m_actsSurfaceMap.insert({actsID, surface});
66 if (!inserted) {
67 ATH_MSG_WARNING("ACTS id " << actsID
68 << " maps to two Acts surfaces: "
69 << it->second->geometryId() << " and "
70 << surface->geometryId());
71 }
72
73 });
74
75 }else {
76 ATH_MSG_FATAL("TrackingGeometrySvc is not configured, cannot translate Traccc tracks to ACTS tracks");
77 return StatusCode::FAILURE;
78 }
79
82 m_outputTracksKey.key())));
83
84 ATH_MSG_DEBUG("Successfully initialized");
85 return StatusCode::SUCCESS;
86}
const ActsDetectorElement * getActsDetectorElement(const Acts::Surface &surf)
Attempts to retrieve the ActsDetectorElement associated to the passed ActsSurface.
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_VERBOSE(x,...)
Gaudi::Property< std::string > m_hostDetectorObjectName
std::shared_ptr< const Acts::TrackingGeometry > m_trackingGeometry
ServiceHandle< ActsTrk::ITrackingGeometrySvc > m_trackingGeometrySvc
ActsTrk::MutableTrackContainerHandlesHelper m_tracksBackendHandlesHelper
const ServiceHandle< StoreGateSvc > & detStore() const
std::string prefixFromTrackContainerName(const std::string &tracks)
Parse TrackContainer name to get the prefix for backends The name has to contain XYZTracks,...

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ isClonable()

virtual bool AthCommonAlgorithm< Gaudi::Algorithm >::isClonable ( ) const
inlineoverridevirtualinherited

Specify if the algorithm is clonable.

Only relevant for non-reentrant algorithms. Actual number of clones needs to be set via the "Cardinality" property.

Reimplemented in AFP_DigiTop, AlgB, AlgT, BCM_Digitization, CscDigitBuilder, CscDigitToCscRDO, G4AtlasAlg, G4RunAlg, HGTD_Digitization, HiveAlgBase, InDet::GNNSeedingTrackMaker, InDet::SCT_Clusterization, InDet::SiSPGNNTrackMaker, InDet::SiSPSeededTrackFinder, InDet::SiTrackerSpacePointFinder, ISF::SimKernelMT, ITk::StripDigitization, ITkPixelCablingAlg, ITkStripCablingAlg, LArHitEMapMaker, LArTTL1Maker, LUCID_DigiTop, LVL1::L1TopoSimulation, MergeCalibHits, MergeGenericMuonSimHitColl, MergeHijingPars, MergeMcEventCollection, MergeTrackRecordCollection, MergeTruthJets, MergeTruthParticles, MuonDigitizer, PileUpMTAlg, PixelDigitization, RoIBResultToxAOD, SCT_ByteStreamErrorsTestAlg, SCT_CablingCondAlgFromCoraCool, SCT_CablingCondAlgFromText, SCT_ConditionsParameterTestAlg, SCT_ConditionsSummaryTestAlg, SCT_ConfigurationConditionsTestAlg, SCT_Digitization, SCT_FlaggedConditionTestAlg, SCT_LinkMaskingTestAlg, SCT_MajorityConditionsTestAlg, SCT_ModuleVetoTestAlg, SCT_MonitorConditionsTestAlg, SCT_PrepDataToxAOD, SCT_RawDataToxAOD, SCT_ReadCalibChipDataTestAlg, SCT_ReadCalibDataTestAlg, SCT_RODVetoTestAlg, SCT_SensorsTestAlg, SCT_SiliconConditionsTestAlg, SCT_StripVetoTestAlg, SCT_TdaqEnabledTestAlg, SCT_TestCablingAlg, SCTEventFlagWriter, SCTRawDataProvider, SCTSiLorentzAngleTestAlg, SCTSiPropertiesTestAlg, SGInputLoader, Simulation::BeamEffectsAlg, TileHitVecToCnt, TileMuonFitter, TilePulseForTileMuonReceiver, TileRawChannelMaker, TRTDigitization, and ZDC_DigiTop.

Definition at line 68 of file AthCommonAlgorithm.h.

68 {
69 return true;
70 }

◆ makeSourceLink()

const xAOD::UncalibratedMeasurement & ActsTrk::TracccTrackConverterAlg::makeSourceLink ( const unsigned int & meas_index,
std::span< const unsigned int > pixelMap,
std::span< const unsigned int > stripMap,
const xAOD::PixelClusterContainer & pixel_clusters,
const xAOD::StripClusterContainer & strip_clusters ) const
private

Definition at line 89 of file TracccTrackConverterAlg.cxx.

95{
96 const unsigned int pixel_index = (pixelMap)[meas_index];
97 if(pixel_index != std::numeric_limits<unsigned int>::max()){
98
99 return *pixel_clusters.at(pixel_index);
100 }
101
102 const unsigned int strip_index = (stripMap)[meas_index];
103 if(strip_index != std::numeric_limits<unsigned int>::max()){
104 return *strip_clusters.at(strip_index);
105 }
106
107 ATH_MSG_FATAL("Measurement index could not be found!!!");
108 throw std::domain_error("No measurement index match found in xAOD map");
109
110}
const T * at(size_type n) const
Access an element, as an rvalue.

◆ msg()

MsgStream & AthCommonMsg< Gaudi::Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Gaudi::Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 368 of file AthCommonDataStore.h.

369 {
370 h.renounce();
372 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 352 of file AthCommonDataStore.h.

352 {
354 }

◆ setFilterPassed()

virtual void AthCommonAlgorithm< Gaudi::Algorithm >::setFilterPassed ( bool state,
const EventContext & ctx ) const
inlinevirtualinherited

Set filter decision:

Definition at line 99 of file AthCommonAlgorithm.h.

99 {
101 }
virtual void setFilterPassed(bool state, const EventContext &ctx) const
Set filter decision:

◆ sysExecute()

StatusCode AthCommonAlgorithm< Gaudi::Algorithm >::sysExecute ( const EventContext & ctx)
overridevirtualinherited

Execute an algorithm.

We override this in order to work around an issue with the Algorithm base class storing the event context in a member variable that can cause crashes in MT jobs.

Reimplemented in AthAnalysisAlgorithm.

Definition at line 80 of file AthCommonAlgorithm.cxx.

41{
42 return BaseAlg::sysExecute (ctx);
43}

◆ sysInitialize()

StatusCode AthCommonAlgorithm< Gaudi::Algorithm >::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthHistogramAlgorithm, HypoBase, InputMakerBase, and PyAthena::Alg.

Definition at line 60 of file AthCommonAlgorithm.cxx.

71 {
73
74 if (sc.isFailure()) {
75 return sc;
76 }
77
78 ServiceHandle<ICondSvc> cs("CondSvc",name());
79 for (auto h : outputHandles()) {
80 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
81 // do this inside the loop so we don't create the CondSvc until needed
82 if ( cs.retrieve().isFailure() ) {
83 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
85 }
86 if (cs->regHandle(this,*h).isFailure()) {
88 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
89 << " with CondSvc");
90 }
91 }
92 }
93 return sc;
94}
virtual StatusCode sysInitialize() override
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 298 of file AthCommonDataStore.h.

298 {
299 for (auto &a : m_vhka) {
301 for (auto k : keys) {
302 k->setOwner(this);
303 }
304 }
305 }

Member Data Documentation

◆ m_actsSurfaceMap

std::map<Acts::GeometryIdentifier, const Acts::Surface*> ActsTrk::TracccTrackConverterAlg::m_actsSurfaceMap
private

Definition at line 110 of file TracccTrackConverterAlg.h.

◆ m_copy

ToolHandle<AthDevice::ICopyTool> ActsTrk::TracccTrackConverterAlg::m_copy
private
Initial value:
{
this, "CopyProviderTool", "", "Vecmem copy provider tool"}

Definition at line 105 of file TracccTrackConverterAlg.h.

105 {
106 this, "CopyProviderTool", "", "Vecmem copy provider tool"};

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default).

Definition at line 381 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default).

Definition at line 378 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthCommonAlgorithm< Gaudi::Algorithm >::m_extendedExtraObjects
privateinherited

Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.

Empty if no symlinks were found.

Definition at line 108 of file AthCommonAlgorithm.h.

◆ m_hostDetector

const traccc::host_detector* ActsTrk::TracccTrackConverterAlg::m_hostDetector = nullptr
private

Definition at line 118 of file TracccTrackConverterAlg.h.

◆ m_hostDetectorObjectName

Gaudi::Property<std::string> ActsTrk::TracccTrackConverterAlg::m_hostDetectorObjectName
private
Initial value:
{
this, "HostDetectorName", "",
"Detray host detector object"}

Definition at line 115 of file TracccTrackConverterAlg.h.

115 {
116 this, "HostDetectorName", "",
117 "Detray host detector object"};

◆ m_hostMR

ToolHandle<AthDevice::IMemoryResourceTool> ActsTrk::TracccTrackConverterAlg::m_hostMR
private
Initial value:
{
this, "HostMR", "", "Host memory resource tool"}

Definition at line 102 of file TracccTrackConverterAlg.h.

102 {
103 this, "HostMR", "", "Host memory resource tool"};

◆ m_inputMeasToPixelSPKey

SG::ReadHandleKey<std::vector<unsigned int> > ActsTrk::TracccTrackConverterAlg::m_inputMeasToPixelSPKey
private
Initial value:
{
this, "InputMeasToPixelSP", "",
"Input mapping from traccc measurement index to pixel spacepoint index"}

Definition at line 83 of file TracccTrackConverterAlg.h.

83 {
84 this, "InputMeasToPixelSP", "",
85 "Input mapping from traccc measurement index to pixel spacepoint index"};

◆ m_inputMeasToStripClKey

SG::ReadHandleKey<std::vector<unsigned int> > ActsTrk::TracccTrackConverterAlg::m_inputMeasToStripClKey
private
Initial value:
{
this, "InputMeasToStripCl", "",
"Input mapping from traccc measurement index to strip cluster index"}

Definition at line 86 of file TracccTrackConverterAlg.h.

86 {
87 this, "InputMeasToStripCl", "",
88 "Input mapping from traccc measurement index to strip cluster index"};

◆ m_inputPixelClustersKey

SG::ReadHandleKey<xAOD::PixelClusterContainer> ActsTrk::TracccTrackConverterAlg::m_inputPixelClustersKey
private
Initial value:
{
this, "InputPixelClusters", "",
"Input xAOD pixel clusters converted from Traccc"}

Definition at line 77 of file TracccTrackConverterAlg.h.

77 {
78 this, "InputPixelClusters", "",
79 "Input xAOD pixel clusters converted from Traccc"};

◆ m_inputStripClustersKey

SG::ReadHandleKey<xAOD::StripClusterContainer> ActsTrk::TracccTrackConverterAlg::m_inputStripClustersKey
private
Initial value:
{
this, "InputStripClusters", "",
"Input xAOD strip clusters converted from Traccc"}

Definition at line 80 of file TracccTrackConverterAlg.h.

80 {
81 this, "InputStripClusters", "",
82 "Input xAOD strip clusters converted from Traccc"};

◆ m_inputTracksKey

SG::ReadHandleKey<traccc_track_container::buffer> ActsTrk::TracccTrackConverterAlg::m_inputTracksKey
private
Initial value:
{
this, "InputTracks", "",
"Input traccc track collection buffer"}

Definition at line 89 of file TracccTrackConverterAlg.h.

89 {
90 this, "InputTracks", "",
91 "Input traccc track collection buffer"};

◆ m_nExcludedBadNdf

std::atomic<int> ActsTrk::TracccTrackConverterAlg::m_nExcludedBadNdf = 0
mutableprivate

Definition at line 125 of file TracccTrackConverterAlg.h.

◆ m_nExcludedFitOutcome

std::atomic<int> ActsTrk::TracccTrackConverterAlg::m_nExcludedFitOutcome = 0
mutableprivate

Definition at line 123 of file TracccTrackConverterAlg.h.

◆ m_nExcludedNoState

std::atomic<int> ActsTrk::TracccTrackConverterAlg::m_nExcludedNoState = 0
mutableprivate

Definition at line 124 of file TracccTrackConverterAlg.h.

◆ m_nExcludedWeirdGlobal

std::atomic<int> ActsTrk::TracccTrackConverterAlg::m_nExcludedWeirdGlobal = 0
mutableprivate

Definition at line 127 of file TracccTrackConverterAlg.h.

◆ m_nExcludedWeirdState

std::atomic<int> ActsTrk::TracccTrackConverterAlg::m_nExcludedWeirdState = 0
mutableprivate

Definition at line 126 of file TracccTrackConverterAlg.h.

◆ m_nTracksIn

std::atomic<int> ActsTrk::TracccTrackConverterAlg::m_nTracksIn = 0
mutableprivate

The object counters for debug prints in finalize method {.

Definition at line 121 of file TracccTrackConverterAlg.h.

◆ m_nTracksOut

std::atomic<int> ActsTrk::TracccTrackConverterAlg::m_nTracksOut = 0
mutableprivate

Definition at line 122 of file TracccTrackConverterAlg.h.

◆ m_outputTracksKey

SG::WriteHandleKey<ActsTrk::TrackContainer> ActsTrk::TracccTrackConverterAlg::m_outputTracksKey
private
Initial value:
{
this, "OutputTracks", "",
"Output ACTS track container"}

Definition at line 96 of file TracccTrackConverterAlg.h.

96 {
97 this, "OutputTracks", "",
98 "Output ACTS track container"};

◆ m_trackingGeometry

std::shared_ptr<const Acts::TrackingGeometry> ActsTrk::TracccTrackConverterAlg::m_trackingGeometry
private

Definition at line 108 of file TracccTrackConverterAlg.h.

◆ m_trackingGeometrySvc

ServiceHandle<ActsTrk::ITrackingGeometrySvc> ActsTrk::TracccTrackConverterAlg::m_trackingGeometrySvc {this, "TrackingGeometrySvc", "ActsTrackingGeometrySvc"}
private

Definition at line 109 of file TracccTrackConverterAlg.h.

109{this, "TrackingGeometrySvc", "ActsTrackingGeometrySvc"};

◆ m_tracksBackendHandlesHelper

ActsTrk::MutableTrackContainerHandlesHelper ActsTrk::TracccTrackConverterAlg::m_tracksBackendHandlesHelper
private
Initial value:
{
this}

Definition at line 112 of file TracccTrackConverterAlg.h.

112 {
113 this};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 387 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_vhka
privateinherited

Definition at line 386 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: