ATLAS Offline Software
TrackToTrackParticleCnvAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
5 
10 #include "Acts/Definitions/Units.hpp"
11 #include "Acts/Propagator/detail/JacobianEngine.hpp"
12 #include "ActsInterop/Logger.h"
13 
19 #include "GaudiKernel/PhysicalConstants.h"
20 
22 #include "HitSummaryDataUtils.h"
23 #include "ExpectedHitUtils.h"
24 
25 #include <tuple>
26 #include <sstream>
27 
28 namespace {
29 
36  template <typename T, class T_SquareMatrix>
37  inline void lowerTriangleToVector(const T_SquareMatrix& covMatrix,
38  std::vector<T>& vec, unsigned int n_rows_max) {
39  assert( covMatrix.rows() == covMatrix.cols());
40  vec.clear();
41  unsigned int n_rows = std::min(n_rows_max, static_cast<unsigned int>(covMatrix.rows()));
42  vec.reserve((n_rows+1)*n_rows/2);
43  for (unsigned int i = 0; i < n_rows; ++i) {
44  for (unsigned int j = 0; j <= i; ++j) {
45  vec.emplace_back(covMatrix(i, j));
46  }
47  }
48  }
49 
59  template <typename T, class T_SquareMatrix>
60  inline void lowerTriangleToVectorScaleLastRow(const T_SquareMatrix& covMatrix,
61  std::vector<T>& vec, unsigned int n_rows_max,
62  typename T_SquareMatrix::Scalar last_element_scale) {
63  assert( covMatrix.rows() == covMatrix.cols());
64  vec.clear();
65  unsigned int n_rows = std::min(n_rows_max, static_cast<unsigned int>(covMatrix.rows()));
66  vec.reserve((n_rows+1)*n_rows/2);
67  for (unsigned int i = 0; i < n_rows; ++i) {
68  for (unsigned int j = 0; j <= i; ++j) {
69  vec.emplace_back(covMatrix(i, j));
70  }
71  }
72  typename std::vector<T>::iterator cov_iter = vec.end();
73  --cov_iter;
74  *cov_iter *= last_element_scale; // apply scale twice to diagonal element
75  for (unsigned int i=0; i<n_rows_max; ++i) {
76  *cov_iter *= last_element_scale;
77  --cov_iter;
78  }
79  }
80 
86  void setSummaryValue(xAOD::TrackParticle &track_particle, uint8_t value, xAOD::SummaryType summary_type) {
87  uint8_t tmp = value;
88  track_particle.setSummaryValue(tmp, summary_type);
89  }
90 }
91 
92 namespace {
93  // Create lut to map neasurement types (pixel and strips only) to hit summary types.
94  std::array<unsigned short,ActsTrk::to_underlying(xAOD::UncalibMeasType::nTypes)> makeMeasurementToSummaryTypeMap() {
96  for (unsigned short &elm : ret) {
98  }
101  return ret;
102  }
103 }
104 
105 namespace ActsTrk
106 {
107  std::vector<std::pair<Acts::PdgParticle, xAOD::ParticleHypothesis> > TrackToTrackParticleCnvAlg::s_actsHypothesisToxAOD;
108 
110  if (s_actsHypothesisToxAOD.empty()) {
111  s_actsHypothesisToxAOD.reserve(7);
112  s_actsHypothesisToxAOD.push_back( std::make_pair( Acts::eElectron , xAOD::electron) );
113  s_actsHypothesisToxAOD.push_back( std::make_pair( Acts::eMuon , xAOD::muon) );
114  s_actsHypothesisToxAOD.push_back( std::make_pair( Acts::ePionPlus , xAOD::pion) );
115  s_actsHypothesisToxAOD.push_back( std::make_pair( Acts::eProton , xAOD::proton) );
116  s_actsHypothesisToxAOD.push_back( std::make_pair( Acts::ePionZero , xAOD::pi0) );
117  s_actsHypothesisToxAOD.push_back( std::make_pair( Acts::eNeutron , xAOD::neutron) );
118  s_actsHypothesisToxAOD.push_back( std::make_pair( Acts::eGamma , xAOD::photon) );
119  }
120  }
121 
122 
124  ISvcLocator *pSvcLocator)
125  : AthReentrantAlgorithm(name, pSvcLocator)
126  {
127  }
128 
130  {
131  ATH_CHECK( m_tracksContainerKey.initialize() );
135 
136  ATH_CHECK( m_extrapolationTool.retrieve() ); // for extrapolation to beamline
137 
138  // propagator for conversion to curvilnear parameters
139  {
140  auto logger = makeActsAthenaLogger(this, "Prop");
141 
142  Navigator::Config cfg{m_extrapolationTool->trackingGeometryTool()->trackingGeometry()};
143  cfg.resolvePassive = false;
144  cfg.resolveMaterial = true;
145  cfg.resolveSensitive = true;
146  auto navigtor_logger = logger->cloneWithSuffix("Navigator");
147  m_propagator = std::make_unique<Propagator>(Stepper(std::make_shared<ATLASMagneticFieldWrapper>()),
148  Navigator(cfg,std::move(navigtor_logger)),
149  std::move(logger));
150  }
151 
152  // for layer/module-type information per hit
153  ATH_CHECK( m_siDetEleCollKey.initialize() );
154  if (m_siDetEleCollToMeasurementType.size() == m_siDetEleCollKey.size()) {
155  unsigned int collection_idx=0;
157  if (type <1 || type >2) {
158  ATH_MSG_ERROR("Invalid measurement type (" << type << ") given for collection " << collection_idx << " : "
159  << m_siDetEleCollKey[collection_idx].key()
160  << ". Expected 1 for pixel, 2 for strips.");
161  return StatusCode::FAILURE;
162  }
163  ++collection_idx;
164  }
165  }
166  else {
167  ATH_MSG_ERROR("Expected exactly one value in SiDetEleCollToMeasurementType per SiDetectorElementCollection. But got "
168  << m_siDetEleCollToMeasurementType.size() << " instead of " << m_siDetEleCollKey.size() << ".");
169  return StatusCode::FAILURE;
170  }
171 
172  if (m_pixelExpectLayerCylinder.size() != 2) {
173  ATH_MSG_ERROR("Expected 2 values for PixelExpectLayerCylinder a cylinder radius and half length but got "
174  << m_pixelExpectLayerCylinder.size() << ".");
175  return StatusCode::FAILURE;
176  }
177  m_innerExtrapolationVolume = Acts::Surface::makeShared<Acts::CylinderSurface>(Acts::Transform3::Identity(),
181 
182  return StatusCode::SUCCESS;
183  }
184 
185  StatusCode TrackToTrackParticleCnvAlg::execute(const EventContext &ctx) const
186  {
188  if (wh_track_particles.record(std::make_unique<xAOD::TrackParticleContainer>(),
189  std::make_unique<xAOD::TrackParticleAuxContainer>()).isFailure()) {
190  ATH_MSG_ERROR("Failed to record track particle container with key " << m_trackParticlesOutKey.key() );
191  return StatusCode::FAILURE;
192  }
193 
194  xAOD::TrackParticleContainer *track_particles = wh_track_particles.ptr();
195 
197  ATH_CHECK(beamSpotHandle.isValid());
198  const InDet::BeamSpotData *beamspot_data = beamSpotHandle.cptr();
199 
200  std::size_t nTracks = 0ul;
201  std::vector<const ActsTrk::TrackContainer *> trackContainers;
203  SG::ReadHandle<ActsTrk::TrackContainer> handle = SG::makeHandle( handleKey, ctx );
204  ATH_CHECK(handle.isValid());
205  trackContainers.push_back( handle.cptr() );
206  nTracks += trackContainers.back()->size();
207  }
208 
210  ATH_CHECK(fieldHandle.isValid());
211  const AtlasFieldCacheCondObj *field_cond_data = fieldHandle.cptr();
212  MagField::AtlasFieldCache fieldCache;
213  field_cond_data->getInitializedCache(fieldCache);
214 
215  const ActsGeometryContext &gctx = m_extrapolationTool->trackingGeometryTool()->getNominalGeometryContext();
216  std::shared_ptr<Acts::PerigeeSurface> perigee_surface = makePerigeeSurface(beamspot_data);
217  track_particles->reserve( nTracks );
218 
220  for (unsigned int idx=0; idx <m_siDetEleCollToMeasurementType.size(); ++idx ) {
222  ATH_CHECK(detHandle.isValid());
223  siDetEleColl[m_siDetEleCollToMeasurementType[idx] ] = detHandle.cptr();
224  }
225 
227  measurementToSummaryType ATLAS_THREAD_SAFE (makeMeasurementToSummaryTypeMap());
228 
229 
230 
231  // re-used temporaries
232  std::vector<float> tmp_cov_vector;
233  std::vector<ActsTrk::TrackStateBackend::ConstTrackStateProxy::IndexType > tmp_param_state_idx;
234  tmp_param_state_idx.reserve(30);
235  Amg::Vector3D magnFieldVect;
236  std::vector<std::vector<float>> parametersVec;
237  HitSummaryData hitInfo;
238 
239  unsigned int converted_track_states=0;
240 
241  static const SG::AuxElement::Decorator<ElementLink<ActsTrk::TrackContainer> > trackLink("actsTrack");
242 
243  using namespace Acts::UnitLiterals;
244  for (const ActsTrk::TrackContainer *tracksContainer : trackContainers) {
245  for (const typename ActsTrk::TrackContainer::ConstTrackProxy track : *tracksContainer) {
246  track_particles->push_back( new xAOD::TrackParticle );
247  xAOD::TrackParticle *track_particle=track_particles->back();
248 
249  // convert defining parameters
250  // @TODO add support for other modes available in the legacy converter : wrt a vertex, origin, beamspot ?
251  Acts::BoundTrackParameters perigeeParam = parametersAtBeamLine(ctx, track, *perigee_surface);
252  track_particle->setDefiningParameters(perigeeParam.parameters()[Acts::eBoundLoc0],
253  perigeeParam.parameters()[Acts::eBoundLoc1],
254  perigeeParam.parameters()[Acts::eBoundPhi],
255  perigeeParam.parameters()[Acts::eBoundTheta],
256  perigeeParam.parameters()[Acts::eBoundQOverP] * 1_MeV);
257  if (perigeeParam.covariance().has_value()) {
258  // only use the 5x5 sub-matrix of the full covariance matrix
259  lowerTriangleToVectorScaleLastRow(perigeeParam.covariance().value(),tmp_cov_vector,5, 1_MeV);
260  track_particle->setDefiningParametersCovMatrixVec(tmp_cov_vector);
261  }
262  // optional beam tilt
263  if (beamspot_data) {
264  track_particle->setBeamlineTiltX(beamspot_data->beamTilt(0));
265  track_particle->setBeamlineTiltY(beamspot_data->beamTilt(1));
266  }
267 
268  // fit info, quality
269  track_particle->setFitQuality(track.chi2(), track.nDoF());
270  track_particle->setPatternRecognitionInfo( (1ul << xAOD::SiSPSeededFinder) );
271  track_particle->setTrackFitter(xAOD::KalmanFitter);
272 
273  const Acts::ParticleHypothesis &hypothesis = track.particleHypothesis();
274  track_particle->setParticleHypothesis(convertParticleHypothesis( hypothesis.absolutePdg() ));
275  constexpr float inv_1_MeV = 1/1_MeV;
276  // gather track state indices for parameter conversion
277  // @TODO add support for muons
278 
279  // xAOD::UncalibMeasType::underlying_type is expected to be the number of UncalibMeasTypes
281  to_underlying(xAOD::UncalibMeasType::nTypes)> specialHitCounts{};
282 
283  SumOfValues chi2_stat;
284  gatherTrackSummaryData(*tracksContainer,
285  track,
286  siDetEleColl,
287  measurementToSummaryType,
288  chi2_stat,
289  hitInfo,
290  tmp_param_state_idx,
291  specialHitCounts);
292 
293  // Muon
294  // MdtDriftCircleType = 3
295  // RpcStripType = 4,
296  // TgcStripType = 5,
297  // MMClusterType = 6,
298  // sTgcStripType = 7,
299 
300  // pixel summaries
301  std::array< std::tuple< uint8_t, uint8_t, uint8_t, bool >, 4> copy_summary {
302  std::make_tuple(static_cast<uint8_t>(HitSummaryData::pixelTotal),
304  static_cast<uint8_t>(xAOD::numberOfPixelHits),
305  false),
306 
307  std::make_tuple(static_cast<uint8_t>(HitSummaryData::pixelBarrelFlat),
310  true),
311 
312  std::make_tuple(static_cast<uint8_t>(HitSummaryData::pixelBarrelInclined),
315  true),
316 
317  std::make_tuple(static_cast<uint8_t>(HitSummaryData::pixelEndcap),
319  static_cast<uint8_t>(xAOD::numberOfPixelEndcapHits),\
320  true) };
321 
322  for (auto [src_region, dest_xaod_summary_layer, dest_xaod_summary_hits, add_outlier] : copy_summary ) {
323  setSummaryValue(*track_particle,
324  hitInfo.contributingLayers( static_cast<HitSummaryData::DetectorRegion>(src_region)),
325  static_cast<xAOD::SummaryType>(dest_xaod_summary_layer));
326  setSummaryValue(*track_particle,
327  hitInfo.contributingHits(static_cast<HitSummaryData::DetectorRegion>(src_region))
328  + ( add_outlier
329  ? hitInfo.contributingOutlierHits(static_cast<HitSummaryData::DetectorRegion>(src_region))
330  : 0),
331  static_cast<xAOD::SummaryType>(dest_xaod_summary_hits));
332  }
333  setSummaryValue(*track_particle,
337  setSummaryValue(*track_particle,
340  setSummaryValue(*track_particle,
346  setSummaryValue(*track_particle,
350  setSummaryValue(*track_particle,
352  // specialHitCounts[to_underlying(xAOD::UncalibMeasType::PixelClusterType)][HitCategory::Outlier],
354  setSummaryValue(*track_particle,
357  // do not expect pixel hits if there are not contributing pixel hits in the flat barrel and expectIfPixelContributes is true
358  std::array<unsigned int,4> expect_layer_pattern = (( !m_expectIfPixelContributes.value()
360  ? expectedLayerPattern(ctx,
362  perigeeParam,
364  : std::array<unsigned int,4> {0u,0u, 0u,0u} );
365 
366  // @TODO consider end-caps for inner most pixel hits ?
367  setSummaryValue(*track_particle,
368  static_cast<uint8_t>((expect_layer_pattern[0] & (1<<0)) != 0 ),
370  setSummaryValue(*track_particle,
371  static_cast<uint8_t>((expect_layer_pattern[0] & (1<<1)) != 0 ),
373  setSummaryValue(*track_particle,
374  static_cast<unsigned int >(hitInfo.sum<HitSummaryData::Hit>(HitSummaryData::pixelBarrelFlat,0)),
376  setSummaryValue(*track_particle,
377  static_cast<unsigned int >(hitInfo.sum<HitSummaryData::Outlier>(HitSummaryData::pixelBarrelFlat,0)),
379  setSummaryValue(*track_particle,
380  static_cast<unsigned int >(hitInfo.sum<HitSummaryData::Hit>(HitSummaryData::pixelBarrelFlat,1)),
382  setSummaryValue(*track_particle,
383  static_cast<unsigned int >(hitInfo.sum<HitSummaryData::Outlier>(HitSummaryData::pixelBarrelFlat,1)),
385 
386  // Strip summaries
387  setSummaryValue(*track_particle,
390  setSummaryValue(*track_particle,
392  // specialHitCounts[to_underlying(xAOD::UncalibMeasType::StripClusterType)][HitCategory::Outlier],
394  setSummaryValue(*track_particle,
397 
398  double biased_chi2_variance = chi2_stat.biasedVariance();
399  setSummaryValue(*track_particle,
400  static_cast<uint8_t> (biased_chi2_variance>0.
401  ? std::min(static_cast<unsigned int>(std::sqrt(biased_chi2_variance) * 100),255u)
402  : 0u),
404 
405  setSummaryValue(*track_particle,
409 
410 
411  // @TODO slect states for which parameters are stored
412  if (m_firstAndLastParamOnly && tmp_param_state_idx.size()>2) {
413  tmp_param_state_idx[1]=tmp_param_state_idx.back();
414  tmp_param_state_idx.erase(tmp_param_state_idx.begin()+2,tmp_param_state_idx.end());
415  }
416 
417  // store track parameters and covariances for slected states
418  parametersVec.clear();
419  parametersVec.reserve(tmp_param_state_idx.size());
420 
421  for(std::vector<ActsTrk::TrackStateBackend::ConstTrackStateProxy::IndexType>::const_reverse_iterator
422  idx_iter = tmp_param_state_idx.rbegin();
423  idx_iter != tmp_param_state_idx.rend();
424  ++idx_iter) {
425  // for(ActsTrk::TrackStateBackend::ConstTrackStateProxy::IndexType idx : tmp_param_state_idx) {
426  ActsTrk::TrackStateBackend::ConstTrackStateProxy
427  state = tracksContainer->trackStateContainer().getTrackState(*idx_iter);
428  const Acts::BoundTrackParameters actsParam = track.createParametersFromState(state);
429 
430  Acts::Vector3 position = actsParam.position(gctx.context());
431  Acts::Vector3 momentum = actsParam.momentum();
432 
433  // scaling from Acts momentume units (GeV) to Athena Units (MeV)
434  for (unsigned int i=0; i<momentum.rows(); ++i) {
435  momentum(i) *= inv_1_MeV;
436  }
437 
438 
439  if (actsParam.covariance()) {
440  Acts::MagneticFieldContext mfContext = m_extrapolationTool->getMagneticFieldContext(ctx);
441  Acts::GeometryContext tgContext = gctx.context();
442 
443  magnFieldVect.setZero();
444  fieldCache.getField(position.data(), magnFieldVect.data());
445  // scaling from Athena magnetic field units kT to Acts units T
446  {
447  using namespace Acts::UnitLiterals;
448  magnFieldVect *= 1000_T;
449  }
450 
451  auto curvilinear_cov_result = convertActsBoundCovToCurvilinearParam(tgContext, actsParam, magnFieldVect, hypothesis);
452  if (curvilinear_cov_result.has_value()) {
453  Acts::BoundSquareMatrix &curvilinear_cov = curvilinear_cov_result.value();
454 
455  // convert q/p components from GeV (Acts) to MeV (Athena)
456  for (unsigned int col_i=0; col_i<4; ++col_i) {
457  curvilinear_cov(col_i,4) *= 1_MeV;
458  curvilinear_cov(4,col_i) *= 1_MeV;
459  }
460  curvilinear_cov(4,4) *= (1_MeV * 1_MeV);
461 
462  std::size_t param_idx = parametersVec.size();
463  // only use the 5x5 sub-matrix of the full covariance matrix
464  lowerTriangleToVector(curvilinear_cov,tmp_cov_vector,5);
465  if (tmp_cov_vector.size() != 15) {
466  ATH_MSG_ERROR("Invalid size of lower triangle cov " << tmp_cov_vector.size() << " != 15"
467  << " input matrix : " << curvilinear_cov.rows() << " x " << curvilinear_cov.cols() );
468  }
469  track_particle->setTrackParameterCovarianceMatrix(param_idx, tmp_cov_vector);
470  }
471  }
472  parametersVec.emplace_back(std::vector<float>{
473  static_cast<float>(position[0]),static_cast<float>(position[1]),static_cast<float>(position[2]),
474  static_cast<float>(momentum[0]),static_cast<float>(momentum[1]),static_cast<float>(momentum[2]) });
475  ++converted_track_states;
476 
477 
478  }
479  for (const std::vector<float> &param : parametersVec) {
480  if (param.size() != 6) {
481  ATH_MSG_ERROR("Invalid size of param element " << param.size() << " != 6" );
482  }
483  }
484 
485  track_particle->setTrackParameters(parametersVec);
486 
487  // add element to link to the correspond track
488  trackLink(*track_particle)
489  = ElementLink<ActsTrk::TrackContainer>( tracksContainer,
490  track.index() );
491  ATH_CHECK( (trackLink(*track_particle)).isValid() );
492  }
493  }
494  ATH_MSG_DEBUG( "Converted " << nTracks << " acts tracks into " << track_particles->size()
495  << " track particles with parameters for " << converted_track_states << " track states.");
496 
497  return StatusCode::SUCCESS;
498  }
499 
500  std::shared_ptr<Acts::PerigeeSurface> TrackToTrackParticleCnvAlg::makePerigeeSurface(const InDet::BeamSpotData *beamspot_data) {
501  // @from TrackToVertex::trackAtBeamline
502  Acts::Vector3 beamspot(0., 0., 0.);
503  float tiltx = 0.0;
504  float tilty = 0.0;
505  if (beamspot_data) {
506  beamspot = Acts::Vector3(beamspot_data->beamVtx().position());
507  tiltx = beamspot_data->beamTilt(0);
508  tilty = beamspot_data->beamTilt(1);
509  }
510  Acts::Translation3 translation(beamspot);
511  Acts::Transform3 transform( translation * Acts::RotationMatrix3::Identity() );
512  transform *= Acts::AngleAxis3(tilty, Acts::Vector3(0.,1.,0.));
513  transform *= Acts::AngleAxis3(tiltx, Acts::Vector3(1.,0.,0.));
514  return Acts::Surface::makeShared<Acts::PerigeeSurface>(transform);
515  }
516 
517  Acts::BoundTrackParameters TrackToTrackParticleCnvAlg::parametersAtBeamLine(const EventContext &ctx,
518  const typename ActsTrk::TrackContainer::ConstTrackProxy &track,
519  const Acts::PerigeeSurface &perigee_surface) const {
520  Acts::BoundTrackParameters trackParam = track.createParametersAtReference();
521 
522  std::optional<const Acts::BoundTrackParameters>
523  perigeeParam = m_extrapolationTool->propagate(ctx,
524  trackParam,
525  perigee_surface,
526  Acts::Direction::Backward, // @TODO try forward if backward fails ?
528  if (!perigeeParam.has_value()) {
529  ATH_MSG_WARNING( "Failed to extrapolate to perigee");
530  return trackParam;
531  }
532  else {
533  return perigeeParam.value();
534  }
535  }
536 
537 }
DataVector::reserve
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
xAOD::neutron
@ neutron
for Fatras usage
Definition: TrackingPrimitives.h:200
xAOD::numberOfPixelHoles
@ numberOfPixelHoles
number of pixel layers on track with absence of hits [unit8_t].
Definition: TrackingPrimitives.h:261
xAOD::muon
@ muon
Definition: TrackingPrimitives.h:195
xAOD::TrackParticle_v1::setTrackFitter
void setTrackFitter(const TrackFitter fitter)
Method for setting the fitter, using the TrackFitter enum.
Definition: TrackParticle_v1.cxx:693
ActsTrk::TrackToTrackParticleCnvAlg::makePerigeeSurface
static std::shared_ptr< Acts::PerigeeSurface > makePerigeeSurface(const InDet::BeamSpotData *beamspotptr)
Definition: TrackToTrackParticleCnvAlg.cxx:500
ActsTrk::TrackContainer
Definition: TrackContainer.h:31
ActsTrk::TrackToTrackParticleCnvAlg::m_expectIfPixelContributes
Gaudi::Property< bool > m_expectIfPixelContributes
Definition: TrackToTrackParticleCnvAlg.h:90
ActsTrk::TrackToTrackParticleCnvAlg::m_innerExtrapolationVolume
std::shared_ptr< Acts::CylinderSurface > m_innerExtrapolationVolume
Definition: TrackToTrackParticleCnvAlg.h:96
xAOD::short
short
Definition: Vertex_v1.cxx:165
ActsTrk::TrackToTrackParticleCnvAlg::initialize
virtual StatusCode initialize() override
Definition: TrackToTrackParticleCnvAlg.cxx:129
InDetDD::SiDetectorElementCollection
Definition: SiDetectorElementCollection.h:30
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
CurvilinearCovarianceHelper.h
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:575
xAOD::electron
@ electron
Definition: TrackingPrimitives.h:194
ActsTrk::TrackToTrackParticleCnvAlg::m_pixelExpectLayerCylinder
Gaudi::Property< std::vector< float > > m_pixelExpectLayerCylinder
Definition: TrackToTrackParticleCnvAlg.h:93
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
xAOD::TrackParticle_v1::setTrackParameters
void setTrackParameters(std::vector< std::vector< float > > &parameters)
Set the parameters via the passed vector of vectors.
Definition: TrackParticle_v1.cxx:567
AtlasFieldCacheCondObj
Definition: AtlasFieldCacheCondObj.h:19
ActsTrk::expectedLayerPattern
std::array< unsigned int, 4 > expectedLayerPattern(const EventContext &ctx, const IActsExtrapolationTool &extrapolator, Acts::BoundTrackParameters perigee_parameters, const Acts::CylinderSurface &extrapolation_volume)
Extrapolate from the perigee outwards and gather information which detector layers should have hits.
Definition: ExpectedHitUtils.cxx:14
ActsTrk::TrackToTrackParticleCnvAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: TrackToTrackParticleCnvAlg.cxx:185
ActsGeometryContext.h
xAOD::numberOfContribPixelBarrelInclinedLayers
@ numberOfContribPixelBarrelInclinedLayers
number of contributing barrel inclined layers of the pixel detector [unit8_t].
Definition: TrackingPrimitives.h:309
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
xAOD::UncalibMeasType::StripClusterType
@ StripClusterType
ActsTrk::SumOfValues
Helper class to gather statistics and compute the biased variance.
Definition: HitSummaryDataUtils.h:234
ActsTrk::HitSummaryData::Hit
@ Hit
Definition: HitSummaryDataUtils.h:96
ActsTrk::TrackToTrackParticleCnvAlg::m_firstAndLastParamOnly
Gaudi::Property< bool > m_firstAndLastParamOnly
Definition: TrackToTrackParticleCnvAlg.h:88
ActsTrk::gatherTrackSummaryData
void gatherTrackSummaryData(const ActsTrk::TrackContainer &tracksContainer, const typename ActsTrk::TrackContainer::ConstTrackProxy &track, const std::array< const InDetDD::SiDetectorElementCollection *, to_underlying(xAOD::UncalibMeasType::nTypes)> &siDetEleColl, const std::array< unsigned short, to_underlying(xAOD::UncalibMeasType::nTypes)> &measurement_to_summary_type, SumOfValues &chi2_stat_out, HitSummaryData &hit_info_out, std::vector< ActsTrk::TrackStateBackend::ConstTrackStateProxy::IndexType > &param_state_idx_out, std::array< std::array< uint8_t, to_underlying(HitCategory::N)>, to_underlying(xAOD::UncalibMeasType::nTypes)> &special_hit_counts_out)
Helper to gather track summary information from the track states of the specified track.
Definition: HitSummaryDataUtils.cxx:16
xAOD::numberOfContribPixelBarrelFlatLayers
@ numberOfContribPixelBarrelFlatLayers
number of contributing barrel flat layers of the pixel detector [unit8_t].
Definition: TrackingPrimitives.h:308
SG::ReadCondHandle::isValid
bool isValid()
Definition: ReadCondHandle.h:205
ATLASMagneticFieldWrapper.h
xAOD::pion
@ pion
Definition: TrackingPrimitives.h:196
xAOD::TrackParticle_v1::setDefiningParameters
void setDefiningParameters(float d0, float z0, float phi0, float theta, float qOverP)
Set the defining parameters.
Definition: TrackParticle_v1.cxx:177
HitSummaryDataUtils.h
athena.value
value
Definition: athena.py:122
xAOD::numberOfPixelHits
@ numberOfPixelHits
these are the pixel hits, including the b-layer [unit8_t].
Definition: TrackingPrimitives.h:259
xAOD::expectInnermostPixelLayerHit
@ expectInnermostPixelLayerHit
Do we expect a 0th-layer barrel hit for this track?
Definition: TrackingPrimitives.h:236
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
InDet::BeamSpotData::beamVtx
const Trk::RecVertex & beamVtx() const noexcept
Definition: BeamSpotData.h:79
ActsTrk::HitSummaryData::pixelBarrelInclined
@ pixelBarrelInclined
Definition: HitSummaryDataUtils.h:44
xAOD::TrackParticle_v1::setTrackParameterCovarianceMatrix
void setTrackParameterCovarianceMatrix(unsigned int index, std::vector< float > &cov)
Set the cov matrix of the parameter at 'index', using a vector of floats.
Definition: TrackParticle_v1.cxx:638
isValid
bool isValid(const T &p)
Definition: AtlasPID.h:214
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
SG::ReadHandleKey< ActsTrk::TrackContainer >
ActsTrk::HitSummaryData::pixelTotal
@ pixelTotal
Definition: HitSummaryDataUtils.h:49
ActsTrk::to_underlying
constexpr std::underlying_type< T_EnumClass >::type to_underlying(T_EnumClass an_enum)
Helper to convert class enum into an integer.
Definition: HitSummaryDataUtils.h:24
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:83
ActsTrk::HitSummaryData::sum
uint8_t sum(DetectorRegion region, uint8_t layer) const
return the total number of hits, outliers or hits+outliers in the givrn detector region and layer.
Definition: HitSummaryDataUtils.h:207
xAOD::numberOfInnermostPixelLayerEndcapOutliers
@ numberOfInnermostPixelLayerEndcapOutliers
number of 0th layer endcap outliers
Definition: TrackingPrimitives.h:243
xAOD::TrackParticle_v1::setBeamlineTiltY
void setBeamlineTiltY(float tiltY)
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
ActsTrk::HitSummaryData::contributingHits
uint8_t contributingHits(DetectorRegion region) const
return the number of hits in a certain detector region.
Definition: HitSummaryDataUtils.h:189
ActsTrk::HitSummaryData::stripTotal
@ stripTotal
Definition: HitSummaryDataUtils.h:50
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:269
makeActsAthenaLogger
std::unique_ptr< const Acts::Logger > makeActsAthenaLogger(IMessageSvc *svc, const std::string &name, int level, std::optional< std::string > parent_name)
Definition: Tracking/Acts/ActsInterop/src/Logger.cxx:64
ActsGeometryContext::context
Acts::GeometryContext context() const
Definition: ActsGeometryContext.h:46
xAOD::TrackParticle_v1::setFitQuality
void setFitQuality(float chiSquared, float numberDoF)
Set the 'Fit Quality' information.
Definition: TrackParticle_v1.cxx:534
xAOD::numberOfContribPixelEndcap
@ numberOfContribPixelEndcap
number of contributing endcap layers of the pixel detector [unit8_t].
Definition: TrackingPrimitives.h:310
GeoPrimitives.h
xAOD::numberOfInnermostPixelLayerOutliers
@ numberOfInnermostPixelLayerOutliers
number of 0th layer barrel outliers
Definition: TrackingPrimitives.h:238
xAOD::numberOfInnermostPixelLayerEndcapHits
@ numberOfInnermostPixelLayerEndcapHits
these are the hits in the 0th pixel layer endcap [unit8_t].
Definition: TrackingPrimitives.h:242
ActsTrk::HitSummaryData::contributingOutlierHits
uint8_t contributingOutlierHits(DetectorRegion region) const
return the number of outliers in a certain detector region.
Definition: HitSummaryDataUtils.h:197
AtlasFieldCacheCondObj::getInitializedCache
void getInitializedCache(MagField::AtlasFieldCache &cache) const
get B field cache for evaluation as a function of 2-d (solenoid) or 3-d (toroid) position.
Definition: AtlasFieldCacheCondObj.h:52
ActsTrk::TrackToTrackParticleCnvAlg::Navigator
Acts::Navigator Navigator
Definition: TrackToTrackParticleCnvAlg.h:58
xAOD::SummaryType
SummaryType
Enumerates the different types of information stored in Summary.
Definition: TrackingPrimitives.h:228
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
xAOD::expectNextToInnermostPixelLayerHit
@ expectNextToInnermostPixelLayerHit
Do we expect a 1st-layer barrel hit for this track?
Definition: TrackingPrimitives.h:247
xAOD::numberOfPixelBarrelFlatHits
@ numberOfPixelBarrelFlatHits
these are the pixel hits, in the barrel flat layers [unit8_t].
Definition: TrackingPrimitives.h:311
TrackParticleAuxContainer.h
ParticleGun_EoverP_Config.momentum
momentum
Definition: ParticleGun_EoverP_Config.py:63
ActsTrk::TrackToTrackParticleCnvAlg::initParticleHypothesisMap
static void initParticleHypothesisMap()
Definition: TrackToTrackParticleCnvAlg.cxx:109
SG::Decorator
Helper class to provide type-safe access to aux data.
Definition: Decorator.h:58
lumiFormat.i
int i
Definition: lumiFormat.py:92
ActsTrk::HitSummaryData::DetectorRegion
DetectorRegion
Regions for which hit counts are computed.
Definition: HitSummaryDataUtils.h:42
ret
T ret(T t)
Definition: rootspy.cxx:260
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SG::WriteHandle::ptr
pointer_type ptr()
Dereference the pointer.
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
xAOD::covMatrix
covMatrix
Definition: TrackMeasurement_v1.cxx:19
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
AtlasFieldCache.h
xAOD::numberOfPixelOutliers
@ numberOfPixelOutliers
these are the pixel outliers, including the b-layer [unit8_t].
Definition: TrackingPrimitives.h:260
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
xAOD::standardDeviationOfChi2OS
@ standardDeviationOfChi2OS
100 times the standard deviation of the chi2 from the surfaces [unit8_t].
Definition: TrackingPrimitives.h:298
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
Trk::Vertex::position
const Amg::Vector3D & position() const
return position of vertex
Definition: Vertex.cxx:72
xAOD::numberOfSCTHoles
@ numberOfSCTHoles
number of SCT holes [unit8_t].
Definition: TrackingPrimitives.h:270
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
DataVector::back
const T * back() const
Access the last element in the collection as an rvalue.
DataVector< xAOD::TrackParticle_v1 >
xAOD::TrackParticle_v1::setParticleHypothesis
void setParticleHypothesis(const ParticleHypothesis hypo)
Method for setting the particle type, using the ParticleHypothesis enum.
Definition: TrackParticle_v1.cxx:723
xAOD::numberOfTrackSummaryTypes
@ numberOfTrackSummaryTypes
Definition: TrackingPrimitives.h:319
ActsGeometryContext
Include the GeoPrimitives which need to be put first.
Definition: ActsGeometryContext.h:28
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
xAOD::numberOfNextToInnermostPixelLayerEndcapHits
@ numberOfNextToInnermostPixelLayerEndcapHits
these are the hits in the 0.5th and 1st pixel layer endcap rings [unit8_t].
Definition: TrackingPrimitives.h:253
min
#define min(a, b)
Definition: cfImp.cxx:40
lumiFormat.array
array
Definition: lumiFormat.py:98
ActsTrk::TrackToTrackParticleCnvAlg::m_trackParticlesOutKey
SG::WriteHandleKey< xAOD::TrackParticleContainer > m_trackParticlesOutKey
Definition: TrackToTrackParticleCnvAlg.h:83
xAOD::UncalibMeasType::nTypes
@ nTypes
xAOD::KalmanFitter
@ KalmanFitter
tracks produced by the Kalman Fitter
Definition: TrackingPrimitives.h:47
xAOD::numberOfNextToInnermostPixelLayerOutliers
@ numberOfNextToInnermostPixelLayerOutliers
number of 1st pixel layer barrel outliers
Definition: TrackingPrimitives.h:249
xAOD::numberOfNextToInnermostPixelLayerHits
@ numberOfNextToInnermostPixelLayerHits
these are the hits in the 1st pixel barrel layer
Definition: TrackingPrimitives.h:248
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
xAOD::proton
@ proton
Definition: TrackingPrimitives.h:198
ActsTrk::TrackToTrackParticleCnvAlg::m_fieldCacheCondObjInputKey
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCacheCondObjInputKey
Definition: TrackToTrackParticleCnvAlg.h:75
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
WriteCaloSwCorrections.cfg
cfg
Definition: WriteCaloSwCorrections.py:23
xAOD::ParticleHypothesis
ParticleHypothesis
Definition: TrackingPrimitives.h:192
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
ActsTrk::HitSummaryData::pixelEndcap
@ pixelEndcap
Definition: HitSummaryDataUtils.h:45
xAOD::pi0
@ pi0
for Fatras usage
Definition: TrackingPrimitives.h:201
SiDetectorElement.h
xAOD::numberOfPixelBarrelInclinedHits
@ numberOfPixelBarrelInclinedHits
these are the pixel hits, in the barrel inclined layers [unit8_t].
Definition: TrackingPrimitives.h:312
xAOD::TrackParticle_v1::setDefiningParametersCovMatrixVec
void setDefiningParametersCovMatrixVec(const std::vector< float > &cov)
Definition: TrackParticle_v1.cxx:460
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
xAOD::TrackParticle_v1::setSummaryValue
void setSummaryValue(uint8_t &value, const SummaryType &information)
Set method for TrackSummary values.
Definition: TrackParticle_v1.cxx:752
xAOD::numberOfOutliersOnTrack
@ numberOfOutliersOnTrack
number of measurements flaged as outliers in TSOS [unit8_t].
Definition: TrackingPrimitives.h:297
InDet::BeamSpotData
Definition: BeamSpotData.h:21
xAOD::photon
@ photon
Definition: TrackingPrimitives.h:199
ActsTrk::TrackToTrackParticleCnvAlg::m_beamSpotKey
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
Definition: TrackToTrackParticleCnvAlg.h:73
ActsTrk::TrackToTrackParticleCnvAlg::Stepper
Acts::EigenStepper<> Stepper
Definition: TrackToTrackParticleCnvAlg.h:57
ActsTrk::convertActsBoundCovToCurvilinearParam
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.
Definition: CurvilinearCovarianceHelper.h:60
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
xAOD::numberOfSCTOutliers
@ numberOfSCTOutliers
number of SCT outliers [unit8_t].
Definition: TrackingPrimitives.h:269
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
xAOD::numberOfNextToInnermostPixelLayerEndcapOutliers
@ numberOfNextToInnermostPixelLayerEndcapOutliers
number of 1st layer endcap disk outliers
Definition: TrackingPrimitives.h:254
MagField::AtlasFieldCache
Local cache for magnetic field (based on MagFieldServices/AtlasFieldSvcTLS.h)
Definition: AtlasFieldCache.h:43
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
ActsTrk::HitSummaryData::pixelBarrelFlat
@ pixelBarrelFlat
Definition: HitSummaryDataUtils.h:43
xAOD::SiSPSeededFinder
@ SiSPSeededFinder
Tracks from SiSPSeedFinder.
Definition: TrackingPrimitives.h:85
MagField::AtlasFieldCache::getField
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,...
Definition: AtlasFieldCache.cxx:42
ActsTrk::TrackToTrackParticleCnvAlg::m_propagator
std::unique_ptr< Propagator > m_propagator
Definition: TrackToTrackParticleCnvAlg.h:97
xAOD::numberOfContribPixelLayers
@ numberOfContribPixelLayers
number of contributing layers of the pixel detector [unit8_t].
Definition: TrackingPrimitives.h:230
xAOD::numberOfSCTHits
@ numberOfSCTHits
number of hits in SCT [unit8_t].
Definition: TrackingPrimitives.h:268
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MuonDetectorBuilderTool.cxx:34
ActsTrk::SumOfValues::biasedVariance
double biasedVariance() const
Definition: HitSummaryDataUtils.h:255
xAOD::numberOfPixelEndcapHits
@ numberOfPixelEndcapHits
these are the pixel hits, in the endcap layers [unit8_t].
Definition: TrackingPrimitives.h:313
ActsTrk::TrackToTrackParticleCnvAlg::m_tracksContainerKey
SG::ReadHandleKeyArray< ActsTrk::TrackContainer > m_tracksContainerKey
Definition: TrackToTrackParticleCnvAlg.h:71
ActsTrk::TrackToTrackParticleCnvAlg::m_paramExtrapolationParLimit
Gaudi::Property< double > m_paramExtrapolationParLimit
Definition: TrackToTrackParticleCnvAlg.h:86
ActsTrk::HitSummaryData::Outlier
@ Outlier
Definition: HitSummaryDataUtils.h:97
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
ActsTrk::TrackToTrackParticleCnvAlg::parametersAtBeamLine
Acts::BoundTrackParameters parametersAtBeamLine(const EventContext &ctx, const typename ActsTrk::TrackContainer::ConstTrackProxy &track, const Acts::PerigeeSurface &perigee_surface) const
Definition: TrackToTrackParticleCnvAlg.cxx:517
ActsTrk::HitSummaryData::contributingLayers
uint8_t contributingLayers(DetectorRegion region) const
return the number of layers contributing to the hit collection in the given detector region.
Definition: HitSummaryDataUtils.h:181
ActsTrk::TrackToTrackParticleCnvAlg::m_extrapolationTool
ToolHandle< IActsExtrapolationTool > m_extrapolationTool
Definition: TrackToTrackParticleCnvAlg.h:68
ActsTrk::TrackToTrackParticleCnvAlg::m_siDetEleCollToMeasurementType
Gaudi::Property< std::vector< unsigned int > > m_siDetEleCollToMeasurementType
Definition: TrackToTrackParticleCnvAlg.h:80
TrackToTrackParticleCnvAlg.h
Logger.h
ActsTrk::TrackToTrackParticleCnvAlg::ATLAS_THREAD_SAFE
static std::vector< std::pair< Acts::PdgParticle, xAOD::ParticleHypothesis > > s_actsHypothesisToxAOD ATLAS_THREAD_SAFE
Definition: TrackToTrackParticleCnvAlg.h:99
ActsTrk::TrackToTrackParticleCnvAlg::m_siDetEleCollKey
SG::ReadCondHandleKeyArray< InDetDD::SiDetectorElementCollection > m_siDetEleCollKey
Definition: TrackToTrackParticleCnvAlg.h:78
ExpectedHitUtils.h
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
Decorator.h
Helper class to provide type-safe access to aux data.
xAOD::TrackParticle_v1::setBeamlineTiltX
void setBeamlineTiltX(float tiltX)
python.iconfTool.gui.pad.logger
logger
Definition: pad.py:14
IActsTrackingGeometryTool.h
ActsTrk::HitCategory::N
@ N
Definition: HitSummaryDataUtils.h:32
ActsTrk::TrackToTrackParticleCnvAlg::convertParticleHypothesis
static xAOD::ParticleHypothesis convertParticleHypothesis(Acts::PdgParticle abs_pdg_id)
Definition: TrackToTrackParticleCnvAlg.h:106
ActsTrk::HitCategory::Hole
@ Hole
Definition: HitSummaryDataUtils.h:31
xAOD::UncalibMeasType::PixelClusterType
@ PixelClusterType
xAOD::numberOfInnermostPixelLayerHits
@ numberOfInnermostPixelLayerHits
these are the hits in the 0th pixel barrel layer
Definition: TrackingPrimitives.h:237
InDet::BeamSpotData::beamTilt
float beamTilt(int i) const noexcept
Returns the beam sigma for the i+3-th error matrix element (the 'tilt')
Definition: BeamSpotData.h:74
ActsTrk::HitSummaryData
Helper class to gather hit summary information for e.g.
Definition: HitSummaryDataUtils.h:38
xAOD::TrackParticle_v1::setPatternRecognitionInfo
void setPatternRecognitionInfo(const std::bitset< xAOD::NumberOfTrackRecoInfo > &patternReco)
Method setting the pattern recognition algorithm, using a bitset.
Definition: TrackParticle_v1.cxx:718
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
SG::ReadCondHandle::cptr
const_pointer_type cptr()
Definition: ReadCondHandle.h:67
ActsTrk::TrackToTrackParticleCnvAlg::TrackToTrackParticleCnvAlg
TrackToTrackParticleCnvAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: TrackToTrackParticleCnvAlg.cxx:123