ATLAS Offline Software
Loading...
Searching...
No Matches
TrackToTrackParticleCnvTool.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
10
11
12#include "Acts/Definitions/Units.hpp"
13
16
17#include "GaudiKernel/PhysicalConstants.h"
18
25
26#include <Acts/Definitions/TrackParametrization.hpp>
27#include <Acts/Utilities/Helpers.hpp>
28#include <Acts/Utilities/MathHelpers.hpp>
29#include <Acts/Definitions/Tolerance.hpp>
30#include <tuple>
31
32namespace {
33 constexpr float toFloat(const double x) {
34
35 if (std::abs(x) < Acts::s_epsilon) {
36 return 0.f;
37 }
38 constexpr double min = 3.*static_cast<double>(std::numeric_limits<float>::min());
39 constexpr double max = static_cast<double>(std::numeric_limits<float>::max());
40 const double clampedX = std::copysign(std::clamp(std::abs(x), min, max), x);
41
42 return static_cast<float>(clampedX);
43 }
44 template <int nRowsMax, int nMatSize>
45 inline void lowerTriangleToVector(const Acts::SquareMatrix<nMatSize>& covMatrix,
46 std::vector<float>& vec) {
47 assert( covMatrix.rows() == covMatrix.cols());
48 static_assert(nRowsMax > 0);
49 static_assert(nMatSize > 0);
50 constexpr int nRows = std::min(nRowsMax, nMatSize);
51 vec.clear();
52 vec.reserve(Acts::sumUpToN(nRows));
53 for (int i = 0; i < nRows; ++i) {
54 for (int j = 0; j <= i; ++j) {
55 vec.emplace_back(toFloat(covMatrix(i, j)));
56 }
57 }
58 }
59
60 template <int nRowsMax, int nMatSize>
61 inline void lowerTriangleToVectorScaleLastRow(const Acts::SquareMatrix<nMatSize>& covMatrix,
62 std::vector<float>& vec,
63 const double last_element_scale) {
64 vec.clear();
65 static_assert(nRowsMax > 0);
66 static_assert(nMatSize > 0);
67 constexpr int nRows = std::min(nRowsMax, nMatSize);
68 vec.reserve(Acts::sumUpToN(nRows));
69 for (int i = 0; i < nRows; ++i) {
70 for (int j = 0; j <= i; ++j) {
71 const double covVal = covMatrix(i,j) *
72 ( i == Acts::eBoundQOverP || j == Acts::eBoundQOverP ?
73 last_element_scale : 1.);
74 vec.emplace_back(toFloat(covVal));
75 }
76 }
77 }
78
79 void setSummaryValue(xAOD::TrackParticle& track_particle, uint8_t value, xAOD::SummaryType summary_type) {
81 track_particle.setSummaryValue(tmp, summary_type);
82 }
83
84 std::array<unsigned short, Acts::toUnderlying(xAOD::UncalibMeasType::nTypes)> makeMeasurementToSummaryTypeMap() {
85 std::array<unsigned short, Acts::toUnderlying(xAOD::UncalibMeasType::nTypes)> ret;
86 for (unsigned short& elm : ret) {
88 }
92 return ret;
93 }
94}
95
96namespace ActsTrk {
97
99
100 ATH_CHECK( m_extrapolationTool.retrieve() );
101 ATH_CHECK( m_muonSummaryTool.retrieve(EnableTool{!m_muonSummaryTool.empty()}));
102 ATH_CHECK(m_ctxProvider.initialize());
103
104 return StatusCode::SUCCESS;
105 }
106
108 const EventContext& ctx,
109 const ActsTrk::TrackContainer::ConstTrackProxy& track,
110 const Acts::Surface& perigeeSurface,
111 const InDet::BeamSpotData* beamspot_data) const {
112 using namespace Acts::UnitLiterals;
113
114 MagField::AtlasFieldCache fieldCache;
115 m_ctxProvider.getMagneticFieldContext(ctx).get<const AtlasFieldCacheCondObj*>()->getInitializedCache(fieldCache);
116
117 if (m_muonSummaryTool.isEnabled()) {
118 m_muonSummaryTool->copySummary(m_muonSummaryTool->makeSummary(ctx, track),
119 track_particle);
120 }
121 const Acts::GeometryContext tgContext = m_ctxProvider.getGeometryContext(ctx);
122
123 static const std::array<unsigned short, Acts::toUnderlying(xAOD::UncalibMeasType::nTypes)>
124 measurementToSummaryType ATLAS_THREAD_SAFE (makeMeasurementToSummaryTypeMap());
125
126 // re-used temporaries
127 std::vector<float> tmp_cov_vector;
128 std::vector<ActsTrk::TrackStateBackend::ConstTrackStateProxy::IndexType> tmp_param_state_idx;
129 tmp_param_state_idx.reserve(30);
130 Amg::Vector3D magnFieldVect;
131 std::vector<std::vector<float>> parametersVec;
133
134 // convert defining parameters
135 Acts::BoundTrackParameters perigeeParam = [&] {
136 if (&perigeeSurface == &track.referenceSurface()) {
137 return track.createParametersAtReference();
138 } else {
139 return parametersAtPerigee(ctx, track, perigeeSurface);
140 }
141 }();
142
143 Acts::BoundVector boundParams = perigeeParam.parameters();
144 track_particle.setDefiningParameters(boundParams[Acts::eBoundLoc0],
145 boundParams[Acts::eBoundLoc1],
146 boundParams[Acts::eBoundPhi],
147 boundParams[Acts::eBoundTheta],
148 boundParams[Acts::eBoundQOverP] * 1_MeV);
149
150 if (m_hgtdDecorationLevel>0) {
151 static const SG::Accessor<float> perigeeTime("time");
152 perigeeTime(track_particle) = ActsTrk::timeToAthena(boundParams[Acts::eBoundTime]);
153 }
154
155 if (perigeeParam.covariance().has_value()) {
156 lowerTriangleToVectorScaleLastRow<5>(perigeeParam.covariance().value(), tmp_cov_vector, 1_MeV);
157 track_particle.setDefiningParametersCovMatrixVec(tmp_cov_vector);
158 if (m_hgtdDecorationLevel>0) {
159 static const SG::Accessor<float> perigeeTimeResolution("timeResolution");
160 perigeeTimeResolution(track_particle) = ActsTrk::timeToAthena(perigeeParam.covariance().value()(Acts::eBoundTime,Acts::eBoundTime));
161 }
162 }
163
164 // optional beam tilt
165 if (beamspot_data) {
166 track_particle.setBeamlineTiltX(beamspot_data->beamTilt(0));
167 track_particle.setBeamlineTiltY(beamspot_data->beamTilt(1));
168 }
169
170 // fit info, quality
171 track_particle.setFitQuality(track.chi2(), track.nDoF());
175 }
176 else {
177 track_particle.setTrackFitter(static_cast<xAOD::TrackFitter>(m_trackFitter.value()));
178 }
179
180 const Acts::ParticleHypothesis& hypothesis = track.particleHypothesis();
181 track_particle.setParticleHypothesis(ParticleHypothesis::convert(hypothesis));
182 constexpr float inv_1_MeV = 1 / 1_MeV;
183
184 std::array<std::array<uint8_t, Acts::toUnderlying(ActsTrk::detail::HitCategory::N)>,
185 Acts::toUnderlying(xAOD::UncalibMeasType::nTypes)> specialHitCounts{};
186
189 gatherTrackSummaryData(track,
190 measurementToSummaryType,
191 chi2_stat,
192 hitInfo,
193 tmp_param_state_idx,
194 specialHitCounts,
195 time_info);
196
197 // pixel summaries
198 static constexpr std::array<std::tuple<uint8_t, uint8_t, uint8_t, bool>, 5> copy_summary {
199 std::make_tuple(static_cast<uint8_t>(ActsTrk::detail::HitSummaryData::pixelTotal),
200 static_cast<uint8_t>(xAOD::numberOfContribPixelLayers),
201 static_cast<uint8_t>(xAOD::numberOfPixelHits),
202 false),
203 std::make_tuple(static_cast<uint8_t>(ActsTrk::detail::HitSummaryData::pixelBarrel),
204 static_cast<uint8_t>(xAOD::numberOfContribPixelBarrelLayers),
205 static_cast<uint8_t>(xAOD::numberOfPixelBarrelHits),
206 true),
207 std::make_tuple(static_cast<uint8_t>(ActsTrk::detail::HitSummaryData::pixelEndcap),
208 static_cast<uint8_t>(xAOD::numberOfContribPixelEndcap),
209 static_cast<uint8_t>(xAOD::numberOfPixelEndcapHits),
210 true),
211 std::make_tuple(static_cast<uint8_t>(ActsTrk::detail::HitSummaryData::pixelBarrelFlat),
212 static_cast<uint8_t>(xAOD::numberOfContribPixelBarrelFlatLayers),
213 static_cast<uint8_t>(xAOD::numberOfPixelBarrelFlatHits),
214 true),
215 std::make_tuple(static_cast<uint8_t>(ActsTrk::detail::HitSummaryData::pixelBarrelInclined),
217 static_cast<uint8_t>(xAOD::numberOfPixelBarrelInclinedHits),
218 true)
219 };
220
221 // if not adding expert level decorations only set the total
222 for (auto [src_region, dest_xaod_summary_layer, dest_xaod_summary_hits, add_outlier] : std::span(copy_summary.begin(),
224 ? copy_summary.end()
225 : copy_summary.begin()+1)) {
226 setSummaryValue(track_particle,
228 static_cast<xAOD::SummaryType>(dest_xaod_summary_layer));
229 setSummaryValue(track_particle,
231 + (add_outlier
233 : 0),
234 static_cast<xAOD::SummaryType>(dest_xaod_summary_hits));
235 }
236
237 // map to xAOD::summaryType from [barrel, endcap] x [innermost, next-to-innerost] x [Hits,Outlier,Shared,Split]
238 static constexpr std::array<std::array<std::array<xAOD::SummaryType,4>,2>,2> summaryTypeMap
239 {
240 std::array<std::array<xAOD::SummaryType,4>,2>{ // Pixel barrel
241 std::array<xAOD::SummaryType,4>{ // innermost
246 std::array<xAOD::SummaryType,4>{ // next-to-innermost
251
252 std::array<std::array<xAOD::SummaryType,4>,2>{ // Pixel endcap
253 std::array<xAOD::SummaryType,4>{// innermost
258 std::array<xAOD::SummaryType,4>{// next-to-innermost
263 };
264
265 // counts for the innermost barrel and endcap layers
266 std::array< std::array< std::array<uint8_t,4>,3>, 2> pixel_counts {
267 std::array< std::array<uint8_t,4>,3>{ // barrel counts
270 std::array<std::uint8_t,4>{}},
271 std::array< std::array<uint8_t,4>,3>{ // endcap counts
275 };
276
277 static constexpr std::array<std::array<std::array<unsigned int,2>,2>,2> innerlayer_range{
278 std::array<std::array<unsigned int,2>,2> { // barrel
279 std::array<unsigned int,2>{0u,1u}, // layer range [a,b) considered for innermost barrel: 0
280 std::array<unsigned int,2>{1u,2u} // layer range [a,b) considered for next-to-innermost barrel: 1
281 },
282 std::array<std::array<unsigned int,2>,2> { // endcap
283 std::array<unsigned int,2>{0u,1u}, // layer range [a,b) considered for innermost endcap: 0
284 std::array<unsigned int,2>{1u,3u} // layer range [a,b) considered for next-to-innermost endcap: 1,2
285 }
286 };
287
288 // iterate over barrel,endcap:
289 for (unsigned int barrel_endcap_i=0; barrel_endcap_i<2; ++barrel_endcap_i) {
290 // iterate over inner and next-to-inner most:
291 for (unsigned int innerlayer_range_i=0; innerlayer_range_i<2; ++innerlayer_range_i) {
292 // iterate over hit, outlier, shared, split
293 for (unsigned int count_type_i=0;
294 count_type_i<static_cast<unsigned int>(ActsTrk::detail::HitSummaryData::CountType::NCountTypes);
295 ++count_type_i) {
296 unsigned int count=0;
297 // iterate over layers to be considered for innermost and next-to-innermost
298 for (unsigned int innerlayer_i=innerlayer_range[barrel_endcap_i][innerlayer_range_i][0];
299 innerlayer_i < innerlayer_range[barrel_endcap_i][innerlayer_range_i][1];
300 ++innerlayer_i) {
301 assert( barrel_endcap_i < pixel_counts.size());
302 assert( innerlayer_i < pixel_counts[barrel_endcap_i].size());
303 assert( count_type_i < pixel_counts[barrel_endcap_i][innerlayer_i].size());
304 count += pixel_counts[barrel_endcap_i][innerlayer_i][count_type_i];
305 }
306 if (barrel_endcap_i==1) {
307 if (count_type_i==static_cast<unsigned int>(ActsTrk::detail::HitSummaryData::CountType::Hit)) {
308 // "hit" count for end-caps in summary is hit+outlier
309 for (unsigned int innerlayer_i=innerlayer_range[barrel_endcap_i][innerlayer_range_i][0];
310 innerlayer_i < innerlayer_range[barrel_endcap_i][innerlayer_range_i][1];
311 ++innerlayer_i) {
312 assert( static_cast<unsigned int>(ActsTrk::detail::HitSummaryData::CountType::Outlier) < pixel_counts[barrel_endcap_i][innerlayer_i].size());
313 count += pixel_counts[barrel_endcap_i][innerlayer_i][static_cast<unsigned int>(ActsTrk::detail::HitSummaryData::CountType::Outlier)];
314 }
315 }
316 }
317 assert( barrel_endcap_i < summaryTypeMap.size());
318 assert( innerlayer_range_i < summaryTypeMap[barrel_endcap_i].size());
319 assert( count_type_i < summaryTypeMap[barrel_endcap_i][innerlayer_range_i].size());
320 setSummaryValue(track_particle, count, summaryTypeMap[barrel_endcap_i][innerlayer_range_i][count_type_i]);
321 }
322 }
323 }
324
325 setSummaryValue(track_particle,
326 specialHitCounts[Acts::toUnderlying(xAOD::UncalibMeasType::PixelClusterType)][Acts::toUnderlying(ActsTrk::detail::HitCategory::Hole)],
328 setSummaryValue(track_particle,
329 specialHitCounts[Acts::toUnderlying(xAOD::UncalibMeasType::PixelClusterType)][Acts::toUnderlying(ActsTrk::detail::HitCategory::DeadSensor)],
331
332 // expected layer pattern
333 std::array<unsigned int, 4> expect_layer_pattern{};
334 if (detail::ExpectedLayerPatternHelper::exists(track.container())) {
335 expect_layer_pattern = detail::ExpectedLayerPatternHelper::get(track);
336 } else {
337 expect_layer_pattern = (m_computeExpectedLayerPattern.value()
338 && (!m_expectIfPixelContributes.value()
342 perigeeParam,
343 m_pixelExpectLayerPathLimitInMM.value() * Acts::UnitConstants::mm)
344 : std::array<unsigned int, 4>{0u, 0u, 0u, 0u});
345 }
346
347 // @TODO consider end-caps for inner most pixel hits ?
348 setSummaryValue(track_particle,
349 static_cast<uint8_t>((expect_layer_pattern[0] & (1<<0)) != 0),
351 setSummaryValue(track_particle,
352 static_cast<uint8_t>((expect_layer_pattern[0] & (1<<1)) != 0),
354
355 // Strip, HGTD and seom pixel summaries
358 xAOD::SummaryType> ,9 > copy_summary_types = {
359 // pixel _hits_ are copied above
363
367
371 };
372
373 for (auto [region,count_type,dest_summary_type] : std::span(copy_summary_types.begin(),
374 copy_summary_types.begin()+(m_hgtdDecorationLevel>0
375 ? copy_summary_types.size()
376 : copy_summary_types.size()-3) )) {
377 setSummaryValue(track_particle,hitInfo.contributingHits(region, count_type),dest_summary_type);
378 }
379 setSummaryValue(track_particle,
380 specialHitCounts[Acts::toUnderlying(xAOD::UncalibMeasType::StripClusterType)][Acts::toUnderlying(ActsTrk::detail::HitCategory::Hole)],
382 setSummaryValue(track_particle,
383 specialHitCounts[Acts::toUnderlying(xAOD::UncalibMeasType::StripClusterType)][Acts::toUnderlying(ActsTrk::detail::HitCategory::DeadSensor)],
385 if (m_hgtdDecorationLevel>0) {
386 setSummaryValue(
387 track_particle,
388 specialHitCounts[Acts::toUnderlying(xAOD::UncalibMeasType::HGTDClusterType)][Acts::toUnderlying(ActsTrk::detail::HitCategory::Hole)],
390 }
391
392 double biased_chi2_variance = chi2_stat.biasedVariance();
393 setSummaryValue(track_particle,
394 static_cast<uint8_t>(biased_chi2_variance > 0.
395 ? std::min(static_cast<unsigned int>(std::sqrt(biased_chi2_variance) * 100), 255u)
396 : 0u),
398
399 setSummaryValue(track_particle,
403
404 if (m_hgtdDecorationLevel>0) {
405 static const SG::Accessor<uint8_t> hasValidTime("hasValidTime");
406 static const SG::Accessor<uint32_t> hgtdSummary("HGTDSummaryinfo");
407 using HitSummaryData=ActsTrk::detail::HitSummaryData;
408 unsigned int n_hgtd_hits = hitInfo.contributingHits(static_cast<HitSummaryData::DetectorRegion>(HitSummaryData::hgtdTotal));
409 unsigned int n_hgtd_outliers = hitInfo.contributingOutlierHits(static_cast<HitSummaryData::DetectorRegion>(HitSummaryData::hgtdTotal));
410 hasValidTime(track_particle) = n_hgtd_hits > 2 || n_hgtd_hits>n_hgtd_outliers;
411 unsigned int hgtd_hit_pattern = (n_hgtd_hits>0u
412 ? hitInfo.layerPattern(static_cast<HitSummaryData::DetectorRegion>(HitSummaryData::hgtdTotal),
413 true /* include outlier */)
414 : 0u);
415 hgtdSummary(track_particle) = hgtd_hit_pattern;
417 static const SG::Accessor<float> meanTime("HGTDMeanTime");
418 static const SG::Accessor<float> timeResolution("HGTDMeanTimeResolution");
419 static const SG::Accessor<float> hgtdChi2("HGTDChi2");
420 meanTime(track_particle) = time_info.mean;
421 timeResolution(track_particle) = time_info.resolution;
422 hgtdChi2(track_particle) = static_cast<float>(time_info.chi2);
423 }
424 }
425
426 // @TODO select states for which parameters are stored
427 if (m_firstAndLastParamOnly && tmp_param_state_idx.size() > 2) {
428 tmp_param_state_idx[1] = tmp_param_state_idx.back();
429 tmp_param_state_idx.erase(tmp_param_state_idx.begin() + 2, tmp_param_state_idx.end());
430 }
431
432 // store track parameters and covariances for selected states
433 parametersVec.clear();
434 parametersVec.reserve(tmp_param_state_idx.size());
435
436 // Check if this is a seed track (TSOS mask = None, no Predicted/Filtered/Calibrated)
437 // For seed tracks, perigee parameters are already set from SeedsToTrackParamsAlg, skip per-TSOS loop
438 bool isSeedTrack = tmp_param_state_idx.empty() ? false
439 : track.container().trackStateContainer().getTrackState(tmp_param_state_idx.front()).getMask() == Acts::TrackStatePropMask::None;
440
441 if (isSeedTrack) {
442 ATH_MSG_DEBUG("Seed track detected, skipping per-TSOS parameter extraction");
443 }
444 else {
445 for (std::vector<ActsTrk::TrackStateBackend::ConstTrackStateProxy::IndexType>::const_reverse_iterator
446 idx_iter = tmp_param_state_idx.rbegin();
447 idx_iter != tmp_param_state_idx.rend();
448 ++idx_iter) {
449 ActsTrk::TrackStateBackend::ConstTrackStateProxy
450 state = track.container().trackStateContainer().getTrackState(*idx_iter);
451 const Acts::BoundTrackParameters actsParam = track.createParametersFromState(state);
452
453 Acts::Vector3 position = actsParam.position(tgContext);
454 Acts::Vector3 momentum = actsParam.momentum();
455
456 // scaling from Acts momentum units (GeV) to Athena Units (MeV)
457 for (unsigned int i = 0; i < momentum.rows(); ++i) {
458 momentum(i) *= inv_1_MeV;
459 }
460
461 if (actsParam.covariance()) {
462 const Acts::MagneticFieldContext mfContext = m_ctxProvider.getMagneticFieldContext(ctx);
463
464
465 magnFieldVect.setZero();
466 fieldCache.getField(position.data(), magnFieldVect.data());
467 // scaling from Athena magnetic field units kT to Acts units T
468 {
469 using namespace Acts::UnitLiterals;
470 magnFieldVect *= 1000_T;
471 }
472
473 auto curvilinear_cov_result = ActsTrk::detail::convertActsBoundCovToCurvilinearParam(tgContext, actsParam, magnFieldVect, hypothesis);
474 if (curvilinear_cov_result.has_value()) {
475 Acts::BoundMatrix& curvilinear_cov = curvilinear_cov_result.value();
476
477 // convert q/p components from GeV (Acts) to MeV (Athena)
478 for (unsigned int col_i = 0; col_i < 4; ++col_i) {
479 curvilinear_cov(col_i, 4) *= 1_MeV;
480 curvilinear_cov(4, col_i) *= 1_MeV;
481 }
482 curvilinear_cov(4, 4) *= (1_MeV * 1_MeV);
483
484 std::size_t param_idx = parametersVec.size();
485 // only use the 5x5 sub-matrix of the full covariance matrix
486 lowerTriangleToVector<5>(curvilinear_cov, tmp_cov_vector);
487 if (tmp_cov_vector.size() != 15) {
488 ATH_MSG_ERROR("Invalid size of lower triangle cov " << tmp_cov_vector.size() << " != 15"
489 << " input matrix : " << curvilinear_cov.rows() << " x " << curvilinear_cov.cols());
490 }
491 track_particle.setTrackParameterCovarianceMatrix(param_idx, tmp_cov_vector);
492 }
493 }
494 parametersVec.emplace_back(std::vector<float>{
495 static_cast<float>(position[0]), static_cast<float>(position[1]), static_cast<float>(position[2]),
496 static_cast<float>(momentum[0]), static_cast<float>(momentum[1]), static_cast<float>(momentum[2]) });
497 }
498 } // end else (isSeedTrack)
499 for (const std::vector<float>& param : parametersVec) {
500 if (param.size() != 6) {
501 ATH_MSG_ERROR("Invalid size of param element " << param.size() << " != 6");
502 }
503 }
504
505 track_particle.setTrackParameters(parametersVec);
506 if( !parametersVec.empty() ) {
508 track_particle.setParameterPosition(parametersVec.size()-1, xAOD::ParameterPosition::LastMeasurement);
509 }
510
511
512 return StatusCode::SUCCESS;
513 }
514
515 Acts::BoundTrackParameters TrackToTrackParticleCnvTool::parametersAtPerigee(const EventContext& ctx,
516 const ActsTrk::TrackContainer::ConstTrackProxy& track,
517 const Acts::Surface& perigee_surface) const {
518 const Acts::BoundTrackParameters trackParam = track.createParametersAtReference();
519
520 Acts::Result<Acts::BoundTrackParameters>
521 perigeeParam = m_extrapolationTool->propagate(ctx,
522 trackParam,
523 perigee_surface,
524 Acts::Direction::Backward(),
526 if (!perigeeParam.ok()) {
527 ATH_MSG_WARNING("Failed to extrapolate to perigee, started from \n" << trackParam << " " << trackParam.referenceSurface().name());
528 return trackParam;
529 }
530
531 return perigeeParam.value();
532 }
533
534}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
std::vector< size_t > vec
size_t size() const
Number of registered mappings.
#define x
#define min(a, b)
Definition cfImp.cxx:40
#define max(a, b)
Definition cfImp.cxx:41
#define ATLAS_THREAD_SAFE
Acts::BoundTrackParameters parametersAtPerigee(const EventContext &ctx, const ActsTrk::TrackContainer::ConstTrackProxy &track, const Acts::Surface &perigee_surface) const
ToolHandle< ActsTrk::IExtrapolationTool > m_extrapolationTool
Gaudi::Property< double > m_pixelExpectLayerPathLimitInMM
ContextUtility m_ctxProvider
Utility to fetch the geometry, magnetic field and calibration context in the event.
PublicToolHandle< MuonR4::ITrackSummaryTool > m_muonSummaryTool
virtual StatusCode convert(xAOD::TrackParticle &trackParticle, const EventContext &ctx, const ActsTrk::TrackContainer::ConstTrackProxy &track, const Acts::Surface &perigeeSurface, const InDet::BeamSpotData *beamspotData=nullptr) const override
Gaudi::Property< unsigned long > m_patternRecognitionInfo
Helper class to gather hit summary information for e.g.
unsigned int layerPattern(DetectorRegion region, bool include_outlier) const
Get a bit pattern with one bit set per layer which is set if the layer has a hit or optionally an out...
DetectorRegion
Regions for which hit counts are computed.
std::array< uint8_t, 4 > sumPerCountType(DetectorRegion region, uint8_t layer) const
return the total number of hits, outliers, shared hits and split hits in the given detector region an...
uint8_t contributingHits(DetectorRegion region, CountType hit_type=CountType::Hit) const
return the number of hits in a certain detector region.
uint8_t contributingOutlierHits(DetectorRegion region) const
return the number of outliers in a certain detector region.
uint8_t contributingLayers(DetectorRegion region) const
return the number of layers contributing to the hit collection in the given detector region.
Helper class to gather statistics and compute the biased variance.
float beamTilt(int i) const noexcept
Returns the beam sigma for the i+3-th error matrix element (the 'tilt').
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,...
Helper class to provide type-safe access to aux data.
void setTrackParameterCovarianceMatrix(unsigned int index, std::vector< float > &cov)
Set the cov matrix of the parameter at 'index', using a vector of floats.
void setTrackParameters(std::vector< std::vector< float > > &parameters)
Set the parameters via the passed vector of vectors.
void setBeamlineTiltX(float tiltX)
void setParameterPosition(unsigned int index, ParameterPosition pos)
Set the 'position' (i.e. where it is in ATLAS) of the parameter at 'index', using the ParameterPositi...
void setFitQuality(float chiSquared, float numberDoF)
Set the 'Fit Quality' information.
void setBeamlineTiltY(float tiltY)
void setDefiningParameters(float d0, float z0, float phi0, float theta, float qOverP)
Set the defining parameters.
void setParticleHypothesis(const ParticleHypothesis hypo)
Method for setting the particle type, using the ParticleHypothesis enum.
void setSummaryValue(uint8_t &value, const SummaryType &information)
Set method for TrackSummary values.
void setTrackFitter(const TrackFitter fitter)
Method for setting the fitter, using the TrackFitter enum.
void setPatternRecognitionInfo(const std::bitset< xAOD::NumberOfTrackRecoInfo > &patternReco)
Method setting the pattern recognition algorithm, using a bitset.
void setDefiningParametersCovMatrixVec(const std::vector< float > &cov)
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:148
xAOD::ParticleHypothesis convert(Acts::ParticleHypothesis h)
std::array< unsigned int, 4 > expectedLayerPattern(const EventContext &ctx, const ActsTrk::IExtrapolationTool &extrapolator, const Acts::BoundTrackParameters &perigee_parameters, double pathLimit)
Extrapolate from the perigee outwards and gather information which detector layers should have hits.
std::optional< Acts::BoundMatrix > convertActsBoundCovToCurvilinearParam(const Acts::GeometryContext &tgContext, const Acts::BoundTrackParameters &param, const Acts::Vector3 &magnFieldVect, const Acts::ParticleHypothesis &particle_hypothesis)
Convert the covariance of the given Acts track parameters into curvilinear parameterisation.
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
constexpr double timeToAthena(T actsT)
Converts a time unit from Acts to Athena units.
Eigen::Matrix< double, 3, 1 > Vector3D
unsigned int constexpr nRows
Definition RPDUtils.h:24
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)
TrackFitter
Enums to identify who created this track and which properties does it have.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
SummaryType
Enumerates the different types of information stored in Summary.
@ numberOfInnermostPixelLayerSharedEndcapHits
number of Pixel 0th layer endcap hits shared by several tracks.
@ expectInnermostPixelLayerHit
Do we expect a 0th-layer barrel hit for this track?
@ numberOfHGTDHoles
number of HGTD layers on track with absence of hits [unit8_t].
@ numberOfHGTDSharedHits
number of HGTD all-layer hits shared by several tracks [unit8_t].
@ numberOfPixelHoles
number of pixel layers on track with absence of hits [unit8_t].
@ numberOfInnermostPixelLayerEndcapHits
these are the hits in the 0th pixel layer endcap [unit8_t].
@ numberOfNextToInnermostPixelLayerSharedHits
number of Pixel 1st layer barrel hits shared by several tracks.
@ numberOfNextToInnermostPixelLayerSharedEndcapHits
number of Pixel 1st layer endcap hits shared by several tracks.
@ numberOfContribPixelLayers
number of contributing layers of the pixel detector [unit8_t].
@ standardDeviationOfChi2OS
100 times the standard deviation of the chi2 from the surfaces [unit8_t].
@ numberOfNextToInnermostPixelLayerSplitHits
number of Pixel 1st layer barrel hits split by cluster splitting
@ numberOfPixelSplitHits
number of Pixel all-layer hits split by cluster splitting [unit8_t].
@ numberOfInnermostPixelLayerEndcapOutliers
number of 0th layer endcap outliers
@ numberOfPixelBarrelHits
these are the pixel hits, in the barrel flat layers [unit8_t].
@ numberOfInnermostPixelLayerSharedHits
number of Pixel 0th layer barrel hits shared by several tracks.
@ numberOfPixelOutliers
these are the pixel outliers, including the b-layer [unit8_t].
@ numberOfContribPixelBarrelFlatLayers
number of contributing barrel flat layers of the pixel detector [unit8_t].
@ numberOfTrackSummaryTypes
@ numberOfNextToInnermostPixelLayerHits
these are the hits in the 1st pixel barrel layer
@ numberOfContribPixelBarrelInclinedLayers
number of contributing barrel inclined layers of the pixel detector [unit8_t].
@ numberOfSCTDeadSensors
number of dead SCT sensors crossed [unit8_t].
@ numberOfInnermostPixelLayerSplitHits
number of Pixel 0th layer barrel hits split by cluster splitting
@ numberOfPixelEndcapHits
these are the pixel hits, in the endcap layers [unit8_t].
@ numberOfInnermostPixelLayerOutliers
number of 0th layer barrel outliers
@ numberOfNextToInnermostPixelLayerSplitEndcapHits
number of Pixel 1st layer endcap hits split by cluster splitting
@ numberOfOutliersOnTrack
number of measurements flaged as outliers in TSOS [unit8_t].
@ numberOfNextToInnermostPixelLayerEndcapHits
these are the hits in the 0.5th and 1st pixel layer endcap rings [unit8_t].
@ expectNextToInnermostPixelLayerHit
Do we expect a 1st-layer barrel hit for this track?
@ numberOfContribPixelEndcap
number of contributing endcap layers of the pixel detector [unit8_t].
@ numberOfNextToInnermostPixelLayerEndcapOutliers
number of 1st layer endcap disk outliers
@ numberOfSCTHits
number of hits in SCT [unit8_t].
@ numberOfPixelBarrelInclinedHits
these are the pixel hits, in the barrel inclined layers [unit8_t].
@ numberOfSCTOutliers
number of SCT outliers [unit8_t].
@ numberOfPixelBarrelFlatHits
these are the pixel hits, in the barrel flat layers [unit8_t].
@ numberOfInnermostPixelLayerHits
these are the hits in the 0th pixel barrel layer
@ numberOfHGTDHits
number of HGTD hits [unit8_t].
@ numberOfPixelHits
these are the pixel hits, including the b-layer [unit8_t].
@ numberOfPixelSharedHits
number of Pixel all-layer hits shared by several tracks [unit8_t].
@ numberOfSCTSharedHits
number of SCT hits shared by several tracks [unit8_t].
@ numberOfInnermostPixelLayerSplitEndcapHits
number of Pixel 0th layer endcap hits shared by several tracks.
@ numberOfHGTDOutliers
number of HGTD outliers [unit8_t].
@ numberOfContribPixelBarrelLayers
number of contributing barrel flat layers of the pixel detector [unit8_t].
@ numberOfPixelDeadSensors
number of dead pixel sensors crossed [unit8_t].
@ numberOfNextToInnermostPixelLayerOutliers
number of 1st pixel layer barrel outliers
@ numberOfSCTHoles
number of SCT holes [unit8_t].
@ FirstMeasurement
Parameter defined at the position of the 1st measurement.
@ LastMeasurement
Parameter defined at the position of the last measurement.
static xAOD::TrackFitter fitterType(const consttrackproxy_t &trackProxy)
get fitter type of a track
static bool hasFitterType(const consttrackproxy_t &trackProxy)
test whether a track has a fitter type
static std::array< unsigned int, 4 > get(const track_proxy_t &track)
static bool exists(track_container_t &trackContainer)