Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
GaussianSumFitter.cxx
Go to the documentation of this file.
1 /*§
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
16 //
18 //
29 #include "TrkTrack/Track.h"
30 #include "TrkTrack/TrackInfo.h"
31 //
32 #include <algorithm>
33 #include <vector>
34 
35 namespace {
36 
37 std::unique_ptr<Trk::FitQuality>
38 buildFitQuality(const Trk::GaussianSumFitter::GSFTrajectory& smoothedTrajectory)
39 {
40 
41  /*
42  * Build fit quality by summing the chi2 and ndof for each
43  * measurements
44  */
45  double chiSquared = 0.;
46  int numberDoF = -5;
47  Trk::GaussianSumFitter::GSFTrajectory::const_iterator stateOnSurface =
48  smoothedTrajectory.begin();
49  for (; stateOnSurface != smoothedTrajectory.end(); ++stateOnSurface) {
50  if (!stateOnSurface->typeFlags.test(Trk::TrackStateOnSurface::Measurement)) {
51  continue;
52  }
53  if (!stateOnSurface->fitQualityOnSurface) {
54  continue;
55  }
56  chiSquared += stateOnSurface->fitQualityOnSurface.chiSquared();
57  numberDoF += stateOnSurface->fitQualityOnSurface.numberDoF();
58  }
59  if (std::isnan(chiSquared) || chiSquared <= 0.) {
60  return nullptr;
61  }
62  return std::make_unique<Trk::FitQuality>(chiSquared, numberDoF);
63 }
64 
65 /*
66  * Helper to return the MultiComponent TSOS
67  * that we will push back to the Trajectory DataVector
68  * (taking ownership)
69  */
70 GSFTsos smootherHelper(
71  Trk::MultiComponentState&& updatedState,
72  std::unique_ptr<Trk::MeasurementBase>&& measurement,
74  bool combineToSingle,
75  bool useMode)
76 
77 {
78  if (combineToSingle) {
79  auto combinedLastState = Trk::MultiComponentStateCombiner::combineToSingle(updatedState, useMode);
80  if (combinedLastState) {
81  return {fitQuality, std::move(measurement), std::move(combinedLastState),std::move(updatedState)};
82  }
83  }
84  return {fitQuality, std::move(measurement), nullptr, std::move(updatedState)};
85 }
86 
87 } // end of anonymous namespace
88 
90  const std::string& name,
91  const IInterface* parent)
93  , m_directionToPerigee(Trk::oppositeMomentum)
94  , m_trkParametersComparisonFunction{}
95  , m_sortingReferencePoint{ 0, 0, 0 }
96 {
97  declareInterface<ITrackFitter>(this);
98  declareProperty("SortingReferencePoint", m_sortingReferencePoint);
99 }
100 
103 {
104 
105  if (m_maximumNumberOfComponents > GSFConstants::maxNumberofStateComponents) {
106  ATH_MSG_FATAL("Requested MaximumNumberOfComponents > "
108  return StatusCode::FAILURE;
109  }
110 
111  // GSF extrapolator
112  ATH_CHECK(m_extrapolator.retrieve());
113 
114  // We need a to create RIO_OnTrack (calibrated/corrected)
115  // measurements only if we start from PrePRawData.
116  if (!m_refitOnMeasurementBase) {
117  ATH_CHECK(m_rioOnTrackCreator.retrieve());
118  } else {
119  m_rioOnTrackCreator.disable();
120  }
121  // Initialise the closest track parameters search algorithm
122  Amg::Vector3D referencePosition(m_sortingReferencePoint[0],
123  m_sortingReferencePoint[1],
124  m_sortingReferencePoint[2]);
125 
126  m_trkParametersComparisonFunction =
127  Trk::TrkParametersComparisonFunction(referencePosition);
128 
129  return StatusCode::SUCCESS;
130 }
131 
132 /*
133  * Interface Method
134  * Refitting of an input track.
135  * Extract the measurementBase or
136  * PrepRawData and refit.
137  */
138 std::unique_ptr<Trk::Track>
140  const EventContext& ctx,
141  const Trk::Track& inputTrack,
142  const Trk::RunOutlierRemoval outlierRemoval,
143  const Trk::ParticleHypothesis particleHypothesis) const
144 {
145  // Check that the input track has well defined parameters
146  if (inputTrack.trackParameters()->empty()) {
147  ATH_MSG_FATAL("No track parameters on Track!");
148  return nullptr;
149  }
150  // Check that the input track has associated MeasurementBase objects
151  if (inputTrack.trackStateOnSurfaces()->empty()) {
152  ATH_MSG_FATAL("Empty MeasurementBase ");
153  return nullptr;
154  }
155  // Retrieve the set of track parameters closest to the reference point
156  const Trk::TrackParameters* parametersNearestReference =
157  *(std::min_element(inputTrack.trackParameters()->begin(),
158  inputTrack.trackParameters()->end(),
159  m_trkParametersComparisonFunction));
160 
161  // If we refit using measurement base then
162  // extract the measurements from the input track
163  // and fit them
164  if (m_refitOnMeasurementBase) {
165 
166  MeasurementSet measurementSet;
167 
168  for (const auto* tsos : *(inputTrack.trackStateOnSurfaces())) {
169 
170  if (!(tsos)) {
171  ATH_MSG_WARNING("Track contains an empty MeasurementBase object ");
172  continue;
173  }
174 
175  const MeasurementBase* meas = tsos->measurementOnTrack();
176  if (meas) {
177  if (tsos->type(TrackStateOnSurface::Measurement)) {
178  measurementSet.push_back(meas);
179  } else if (m_reintegrateOutliers &&
180  tsos->type(TrackStateOnSurface::Outlier)) {
181  measurementSet.push_back(meas);
182  }
183  }
184  }
185 
186  return fit(ctx,
187  measurementSet,
188  *parametersNearestReference,
189  outlierRemoval,
190  particleHypothesis);
191  }
192 
193  // If we refit using PrepRawData level then
194  // extract the the PrepRawData from the input track
195  // and fit them
196  PrepRawDataSet prepRawDataSet;
197 
198  for (const auto* meas : *(inputTrack.measurementsOnTrack())) {
199 
200  if (!meas) {
201  continue;
202  }
203  const Trk::RIO_OnTrack* rioOnTrack = nullptr;
204  if (meas->type(Trk::MeasurementBaseType::RIO_OnTrack)) {
205  rioOnTrack = static_cast<const Trk::RIO_OnTrack*>(meas);
206  }
207  if (!rioOnTrack) {
208  continue;
209  }
210  const PrepRawData* prepRawData = rioOnTrack->prepRawData();
211  if (!prepRawData) {
212  continue;
213  }
214  prepRawDataSet.push_back(prepRawData);
215  }
216 
217  return fit(ctx,
218  prepRawDataSet,
219  *parametersNearestReference,
220  outlierRemoval,
221  particleHypothesis);
222 }
223 
224 /*
225  * Interface Method
226  * Fitting of a set of PrepRawData objects
227  */
228 std::unique_ptr<Trk::Track>
230  const EventContext& ctx,
231  const Trk::PrepRawDataSet& prepRawDataSet,
232  const Trk::TrackParameters& estimatedParametersNearOrigin,
233  const Trk::RunOutlierRemoval /* Not used*/,
234  const Trk::ParticleHypothesis particleHypothesis) const
235 {
236 
237  // Protect against empty PrepRawDataSet object
238  if (prepRawDataSet.empty()) {
239  ATH_MSG_FATAL("PrepRawData set for fit is empty");
240  return nullptr;
241  }
242 
243  // We need a sorted PrepRawDataSet
244  Trk::PrepRawDataSet sortedPrepRawDataSet = PrepRawDataSet(prepRawDataSet);
245  Trk::PrepRawDataComparisonFunction prdComparisonFunction =
247  estimatedParametersNearOrigin.position(),
248  estimatedParametersNearOrigin.momentum());
249 
250  std::sort(sortedPrepRawDataSet.begin(),
251  sortedPrepRawDataSet.end(),
252  prdComparisonFunction);
253 
254  // Create Extrapolator cache that holds material effects cache;
255  Trk::IMultiStateExtrapolator::Cache extrapolatorCache;
256  // Perform GSF forward fit
257  GSFTrajectory forwardTrajectory =
258  forwardPRDfit(ctx, extrapolatorCache, sortedPrepRawDataSet,
259  estimatedParametersNearOrigin, particleHypothesis);
260 
261  if (forwardTrajectory.empty()) {
262  return nullptr;
263  }
264  // Perform GSF smoother operation
265  GSFTrajectory smoothedTrajectory =
266  smootherFit(ctx, extrapolatorCache, forwardTrajectory, particleHypothesis);
267  if (smoothedTrajectory.empty()) {
268  return nullptr;
269  }
270 
271  // Fit quality
272  std::unique_ptr<FitQuality> fitQuality = buildFitQuality(smoothedTrajectory);
273  if (!fitQuality) {
274  return nullptr;
275  }
276 
277  // Create parameters at perigee if needed
278  auto perigeeMultiStateOnSurface =
279  makePerigee(ctx, extrapolatorCache, smoothedTrajectory, particleHypothesis);
280  if (!perigeeMultiStateOnSurface.multiComponentState.empty()) {
281  smoothedTrajectory.push_back(std::move(perigeeMultiStateOnSurface));
282  } else {
283  return nullptr;
284  }
285 
286  // Reverse the order of the TSOS's after the smoother
287  // to make be order flow from inside to out
288  std::reverse(smoothedTrajectory.begin(), smoothedTrajectory.end());
289 
290  // Create Trk::Track
292  info.setTrackProperties(TrackInfo::BremFit);
293  info.setTrackProperties(TrackInfo::BremFitSuccessful);
294  return std::make_unique<Track>(
295  info, convertTrajToTrack(smoothedTrajectory),
296  std::move(fitQuality));
297 }
298 
299 /*
300  * Interface method
301  * Fitting of a set of MeasurementBase objects
302  */
303 std::unique_ptr<Trk::Track>
305  const EventContext& ctx,
306  const Trk::MeasurementSet& measurementSet,
307  const Trk::TrackParameters& estimatedParametersNearOrigin,
308  const Trk::RunOutlierRemoval /* Not used*/,
309  const Trk::ParticleHypothesis particleHypothesis) const
310 {
311 
312  // Protect against empty PrepRawDataSet object
313  if (measurementSet.empty()) {
314  ATH_MSG_FATAL("MeasurementSet for fit is empty");
315  return nullptr;
316  }
317 
318  // We need to separate the possible CaloCluster on Track
319  // measurement from the rest
320  const Trk::CaloCluster_OnTrack* ccot(nullptr);
321 
322  Trk::MeasurementSet cleanedMeasurementSet;
323  cleanedMeasurementSet.reserve(measurementSet.size());
324 
325  for (const auto* meas : measurementSet) {
326  if (!meas) {
328  "There is an empty MeasurementBase object in the track! ");
329  continue;
330  }
332  ccot = static_cast<const Trk::CaloCluster_OnTrack*>(meas);
333  } else {
334  cleanedMeasurementSet.push_back(meas);
335  }
336  }
337 
338  // We need a sorted measurement set
339  Trk::MeasurementSet sortedMeasurementSet =
340  MeasurementSet(cleanedMeasurementSet);
341 
342  Trk::MeasurementBaseComparisonFunction measurementBaseComparisonFunction(
343  estimatedParametersNearOrigin.position(),
344  estimatedParametersNearOrigin.momentum());
345  sort(sortedMeasurementSet.begin(),
346  sortedMeasurementSet.end(),
347  measurementBaseComparisonFunction);
348 
349  // Create Extrapolator cache that holds material effects cache;
350  Trk::IMultiStateExtrapolator::Cache extrapolatorCache;
351 
352  // Perform GSF forwards fit
353  GSFTrajectory forwardTrajectory =
354  forwardMeasurementFit(ctx, extrapolatorCache, sortedMeasurementSet,
355  estimatedParametersNearOrigin, particleHypothesis);
356 
357  if (forwardTrajectory.empty()) {
358  return nullptr;
359  }
360 
361  // Perform GSF smoother operation
362  GSFTrajectory smoothedTrajectory = smootherFit(
363  ctx, extrapolatorCache, forwardTrajectory, particleHypothesis, ccot);
364  if (smoothedTrajectory.empty()) {
365  return nullptr;
366  }
367 
368  // fit quality
369  std::unique_ptr<FitQuality> fitQuality = buildFitQuality(smoothedTrajectory);
370  if (!fitQuality) {
371  return nullptr;
372  }
373 
374  // Create parameters at perigee if needed
375  auto perigeeMultiStateOnSurface =
376  makePerigee(ctx, extrapolatorCache, smoothedTrajectory, particleHypothesis);
377  if (!perigeeMultiStateOnSurface.multiComponentState.empty()) {
378  smoothedTrajectory.push_back(std::move(perigeeMultiStateOnSurface));
379  } else {
380  return nullptr;
381  }
382 
383  // Reverse the order of the TSOS's to make be order flow from inside to out
384  std::reverse(smoothedTrajectory.begin(), smoothedTrajectory.end());
385 
386  // Create track
388  info.setTrackProperties(TrackInfo::BremFit);
389  info.setTrackProperties(TrackInfo::BremFitSuccessful);
390  return std::make_unique<Track>(
391  info, convertTrajToTrack(smoothedTrajectory),
392  std::move(fitQuality));
393 }
394 
395 /*
396  * Interface method
397  * Refit a track adding a PrepRawData set
398  */
399 std::unique_ptr<Trk::Track>
400 Trk::GaussianSumFitter::fit(const EventContext& ctx,
401  const Track& intrk,
402  const PrepRawDataSet& addPrdColl,
403  const RunOutlierRemoval runOutlier,
404  const ParticleHypothesis matEffects) const
405 {
406  // protection, if empty PrepRawDataSet
407  if (addPrdColl.empty()) {
409  "client tries to add an empty PrepRawDataSet to the track fit.");
410  return fit(ctx, intrk, runOutlier, matEffects);
411  }
412  // determine the Track Parameter which is the start of the trajectory
413  const TrackParameters* estimatedStartParameters =
414  *(std::min_element(intrk.trackParameters()->begin(),
415  intrk.trackParameters()->end(),
416  m_trkParametersComparisonFunction));
417 
418  // use external preparator class to prepare PRD set for fitter interface
420  intrk, addPrdColl, false, true);
421 
422  // delegate to fitting PrepRawData interface method
423  return fit(ctx, PRDColl, *estimatedStartParameters, runOutlier, matEffects);
424 }
425 
426 /*
427  * Interface method
428  * Refit a track adding a RIO_OnTrack set
429  */
430 std::unique_ptr<Trk::Track>
431 Trk::GaussianSumFitter::fit(const EventContext& ctx,
432  const Track& inputTrack,
433  const MeasurementSet& measurementSet,
434  const RunOutlierRemoval runOutlier,
435  const ParticleHypothesis matEffects) const
436 {
437 
438  // protection, if empty MeasurementSet
439  if (measurementSet.empty()) {
441  "Client tries to add an empty MeasurementSet to the track fit.");
442  return fit(ctx, inputTrack, runOutlier, matEffects);
443  }
444  // Check that the input track has well defined parameters
445  if (inputTrack.trackParameters()->empty()) {
446  ATH_MSG_FATAL("No estimation of track parameters near origin!");
447  return nullptr;
448  }
449  // Check that the input track has associated MeasurementBase objects
450  if (inputTrack.trackStateOnSurfaces()->empty()) {
451  ATH_MSG_FATAL("Attempting to fit track to empty MeasurementBase "
452  "collection!");
453  return nullptr;
454  }
455  // Retrieve the set of track parameters closest to the reference point
456  const Trk::TrackParameters* parametersNearestReference =
457  *(std::min_element(inputTrack.trackParameters()->begin(),
458  inputTrack.trackParameters()->end(),
459  m_trkParametersComparisonFunction));
460 
462  inputTrack, measurementSet);
463 
464  // delegate to measurementBase fit method
465  return fit(
466  ctx, combinedMS, *parametersNearestReference, runOutlier, matEffects);
467 }
468 
469 /*
470  * Interface method
471  * Combine two tracks by refitting
472  */
473 std::unique_ptr<Trk::Track>
474 Trk::GaussianSumFitter::fit(const EventContext& ctx,
475  const Track& intrk1,
476  const Track& intrk2,
477  const RunOutlierRemoval runOutlier,
478  const ParticleHypothesis matEffects) const
479 {
480  // Just add the hits on tracks
481  // protection against not having measurements on the input tracks
482  if (!intrk1.trackStateOnSurfaces() || !intrk2.trackStateOnSurfaces() ||
483  intrk1.trackStateOnSurfaces()->size() < 2) {
484  ATH_MSG_WARNING("called to refit empty track or track with too little "
485  "information, reject fit");
486  return nullptr;
487  }
488  if (!intrk1.trackParameters() || intrk1.trackParameters()->empty()) {
489  ATH_MSG_WARNING("input #1 fails to provide track parameters for "
490  "seeding the GXF, reject fit");
491  return nullptr;
492  }
493 
494  const TrackParameters* minPar = *(intrk1.trackParameters()->begin());
496  for (const auto* tsos : *(intrk1.trackStateOnSurfaces())) {
497  if (!(tsos->type(Trk::TrackStateOnSurface::Measurement) ||
498  tsos->type(Trk::TrackStateOnSurface::Outlier))) {
499  continue;
500  }
501 
502  if (tsos->measurementOnTrack()->type(
504  continue;
505  }
506 
507  ms.push_back(tsos->measurementOnTrack());
508  }
509 
510  for (const auto* tsos : *(intrk2.trackStateOnSurfaces())) {
511 
512  if (!(tsos->type(Trk::TrackStateOnSurface::Measurement) ||
513  tsos->type(Trk::TrackStateOnSurface::Outlier))) {
514  continue;
515  }
516 
517  if (tsos->measurementOnTrack()->type(
519  continue;
520  }
521  ms.push_back(tsos->measurementOnTrack());
522  }
523  // call measurement base interface
524  return fit(ctx, ms, *minPar, runOutlier, matEffects);
525 }
526 
527 /*Helper to convert the GSFTrajectory to a Trk::Track */
528 std::unique_ptr<MultiComponentStateOnSurfaceDV> Trk::GaussianSumFitter::convertTrajToTrack(
529  GSFTrajectory& trajectory) const{
530  bool slimTransientMTSOS = m_slimTransientMTSOS;
531  auto MTSOS = std::make_unique<MultiComponentStateOnSurfaceDV>();
532  MTSOS->reserve(trajectory.size());
533  for (GSFTsos& state : trajectory) {
534  MTSOS->push_back(state.convert(slimTransientMTSOS));
535  }
536  return MTSOS;
537 }
538 
539 /*
540  * Helper creating a multicomponent
541  * perigee TrackStateOnSurface
542  */
543 GSFTsos
545  const EventContext& ctx,
546  Trk::IMultiStateExtrapolator::Cache& extrapolatorCache,
547  const GSFTrajectory& smoothedTrajectory,
548  const Trk::ParticleHypothesis particleHypothesis) const
549 {
550 
551  // Start at the end of the smoothed trajectory
552  // we should be the closest to perigee/origin.
553  const GSFTsos&
554  multiComponentStateOnSurfaceNearestOrigin = smoothedTrajectory.back();
555  const Trk::MultiComponentState* multiComponentState =
556  &(multiComponentStateOnSurfaceNearestOrigin.multiComponentState);
557 
558  // Extrapolate to perigee
559  const Trk::PerigeeSurface perigeeSurface;
560  Trk::MultiComponentState stateExtrapolatedToPerigee =
561  m_extrapolator->extrapolate(ctx,
562  extrapolatorCache,
563  *multiComponentState,
564  perigeeSurface,
565  m_directionToPerigee,
566  false,
567  particleHypothesis);
568 
569  if (stateExtrapolatedToPerigee.empty()) {
570  return {};
571  }
572 
573  // Determine the combined state
574  std::unique_ptr<Trk::TrackParameters> combinedPerigee =
575  MultiComponentStateCombiner::combineToSingle(stateExtrapolatedToPerigee, m_useMode);
576 
577  // Perigee is an additional MultiComponentStateOnSurface
578  std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes>
579  pattern(0);
581 
582  if(std::abs(combinedPerigee->position().z())>5000.) {
583  ATH_MSG_WARNING("Pathological perigee well outside of tracking detector!! Returning {}");
584  return {};
585  }
586 
587  if (std::abs(combinedPerigee->parameters()[Trk::qOverP]) > 1e8) {
589  "makePerigee() about to return with 0 momentum!! Returning {}");
590  return {};
591  }
592 
593  return {Trk::FitQualityOnSurface{},
594  nullptr,
595  std::move(combinedPerigee),
596  std::move(stateExtrapolatedToPerigee),
597  pattern};
598 }
599 
600 /*
601  * Private method for
602  * Forward fit on a set of PrepRawData
603  */
606  const EventContext& ctx,
607  Trk::IMultiStateExtrapolator::Cache& extrapolatorCache,
608  const Trk::PrepRawDataSet& inputPrepRawDataSet,
609  const Trk::TrackParameters& estimatedTrackParametersNearOrigin,
610  const Trk::ParticleHypothesis particleHypothesis) const
611 {
612 
613  // Extract PrepRawDataSet into new local object and check that the PrepRawData
614  // is associated with a detector element
615  Trk::PrepRawDataSet prepRawDataSet;
616  for (const auto* rawData : inputPrepRawDataSet) {
617  if (!(rawData->detectorElement())) {
618  ATH_MSG_WARNING("PrepRawData has no Element link... disregard it");
619  } else {
620  prepRawDataSet.push_back(rawData);
621  }
622  }
623  // For starting guess a multicompoment state
624  // that has single component with weight 1
625  const AmgVector(5)& par = estimatedTrackParametersNearOrigin.parameters();
626  Trk::ComponentParameters componentParametersNearOrigin = {
627  estimatedTrackParametersNearOrigin.associatedSurface()
629  par[Trk::loc2],
630  par[Trk::phi],
631  par[Trk::theta],
632  par[Trk::qOverP],
633  std::nullopt /*no errors*/),
634  1.};
635 
636  Trk::MultiComponentState multiComponentStateNearOrigin{};
637  multiComponentStateNearOrigin.push_back(
638  std::move(componentParametersNearOrigin));
639 
640  // Create new trajectory
641  GSFTrajectory forwardTrajectory{};
642  forwardTrajectory.reserve(prepRawDataSet.size());
643  for (const auto* prepRawData : prepRawDataSet) {
644  // Every step the ForwardTrajectory is updated
645  bool stepIsValid = stepForwardFit(
646  ctx,
647  extrapolatorCache,
648  forwardTrajectory,
649  prepRawData,
650  nullptr,
651  prepRawData->detectorElement()->surface(prepRawData->identify()),
652  multiComponentStateNearOrigin,
653  particleHypothesis);
654 
655  if (!stepIsValid) {
656  return GSFTrajectory{};
657  }
658  }
659  return forwardTrajectory;
660 }
661 
662 /*
663  * Private method for
664  * forward fit on a set of Measurements
665  */
668  const EventContext& ctx,
669  Trk::IMultiStateExtrapolator::Cache& extrapolatorCache,
670  const Trk::MeasurementSet& inputMeasurementSet,
671  const Trk::TrackParameters& estimatedTrackParametersNearOrigin,
672  const Trk::ParticleHypothesis particleHypothesis) const
673 {
674 
675  if (inputMeasurementSet.empty()) {
676  ATH_MSG_ERROR("forwardMeasurementFit: Input MeasurementSet is empty!");
677  return GSFTrajectory{};
678  }
679  // For starting guess a multicompoment state
680  // that has single component with weight 1
681  const AmgVector(5)& par = estimatedTrackParametersNearOrigin.parameters();
682  Trk::ComponentParameters componentParametersNearOrigin = {
683  estimatedTrackParametersNearOrigin.associatedSurface()
685  par[Trk::loc2],
686  par[Trk::phi],
687  par[Trk::theta],
688  par[Trk::qOverP],
689  std::nullopt /*no errors*/),
690  1.};
691  Trk::MultiComponentState multiComponentStateNearOrigin{};
692  multiComponentStateNearOrigin.push_back(
693  std::move(componentParametersNearOrigin));
694 
695  GSFTrajectory forwardTrajectory{};
696  forwardTrajectory.reserve(inputMeasurementSet.size());
697  for (const auto* measurement : inputMeasurementSet) {
698  // Every step the ForwardTrajectory is updated
699  bool stepIsValid = stepForwardFit(ctx,
700  extrapolatorCache,
701  forwardTrajectory,
702  nullptr,
703  measurement,
704  measurement->associatedSurface(),
705  multiComponentStateNearOrigin,
706  particleHypothesis);
707 
708  if (!stepIsValid) {
709  return GSFTrajectory{};
710  }
711  }
712  return forwardTrajectory;
713 }
714 
715 /*
716  * Actual
717  * Implementation method for StepForwardFit
718  */
719 bool
721  const EventContext& ctx,
722  Trk::IMultiStateExtrapolator::Cache& extrapolatorCache,
723  GSFTrajectory& forwardTrajectory,
724  const Trk::PrepRawData* originalPrepRawData,
725  const Trk::MeasurementBase* originalMeasurement,
726  const Trk::Surface& surface,
727  Trk::MultiComponentState& updatedState,
728  const Trk::ParticleHypothesis particleHypothesis) const
729 {
730  // Protect against undefined Measurement or PrepRawData
731  if (!originalPrepRawData && !originalMeasurement) {
732  ATH_MSG_WARNING("No measurement base or PrepRawData passed to "
733  "StepForwardFit!");
734  return false;
735  }
736 
737  if (!originalMeasurement && m_refitOnMeasurementBase) {
738  ATH_MSG_WARNING("No measurement base information passed to StepForwardFit");
739  return false;
740  }
741  // Propagate the multi-component state to the next measurement surface
742  // accounting for the material effects. This gives us
743  // the prediction at that surface.
744  Trk::MultiComponentState extrapolatedState =
745  m_extrapolator->extrapolate(ctx,
746  extrapolatorCache,
747  updatedState,
748  surface,
750  false,
751  particleHypothesis);
752  if (extrapolatedState.empty()) {
753  return false;
754  }
755 
756  // we need to account for either measurement base input
757  // or PrepRawData input.
758  std::unique_ptr<Trk::MeasurementBase> measurement = nullptr;
759  if (originalMeasurement) { // clone original MeasurementBase object
760  measurement.reset(originalMeasurement->clone());
761  } else {
762  std::unique_ptr<Trk::TrackParameters> combinedState =
764  if (!combinedState) {
765  ATH_MSG_WARNING("State combination failed... exiting");
766  return false;
767  }
768  // Create a new MeasurementBase object from PrepRawData
769  measurement.reset(
770  m_rioOnTrackCreator->correct(*originalPrepRawData, *combinedState, ctx));
771  combinedState.reset();
772  }
773  if (!measurement) {
774  ATH_MSG_WARNING("stepForwardFit no measurement to update with");
775  return false;
776  }
777 
778  // Perform measurement update
780  // We need to keep the extrapolatedState so clone
781  updatedState = Trk::GsfMeasurementUpdator::update(
782  MultiComponentStateHelpers::clone(extrapolatedState),
783  *measurement,
784  fitQuality);
785 
786  if (updatedState.empty()) {
787  return false;
788  }
789 
790  // Hits with excessive chi2 are outliers.
791  // We ingore the update, reset back to the extrapolated
792  // state before the update
793  if (fitQuality.chiSquared() >
794  m_cutChiSquaredPerNumberDOF * fitQuality.numberDoF()) {
796  std::bitset<TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> type(0);
798  forwardTrajectory.emplace_back(
799  fitQuality,
800  std::move(measurement),
801  nullptr,
802  // used below for the updated state so clone
803  Trk::MultiComponentStateHelpers::clone(extrapolatedState),
804  type);
805  // reset the updated state to the extrapolated state
806  // before the measurement update
807  updatedState = std::move(extrapolatedState);
808  } else {
809  forwardTrajectory.emplace_back(fitQuality,
810  std::move(measurement),
811  nullptr,
812  std::move(extrapolatedState));
813  }
814  return true;
815 }
816 
817 /*
818  * Actual
819  * Implementation of the smoothing of the trajectory.
820  */
823  const EventContext& ctx,
824  Trk::IMultiStateExtrapolator::Cache& extrapolatorCache,
825  GSFTrajectory& forwardTrajectory,
826  const ParticleHypothesis particleHypothesis,
827  const Trk::CaloCluster_OnTrack* ccot) const
828 {
829  if (forwardTrajectory.empty()) {
831  "Attempting to smooth an empty forward trajectory... Exiting!");
832  return {};
833  }
834 
835  GSFTrajectory smoothedTrajectory;
836  smoothedTrajectory.reserve(forwardTrajectory.size());
837  // For the smoother we start from the end and we go
838  // to begin. We need to find the the first track
839  // state on surface in this reverse direction
840  GSFTrajectory::reverse_iterator trackStateOnSurfaceItr =
841  forwardTrajectory.rbegin();
842  bool foundMeasurement = false;
843  for (; trackStateOnSurfaceItr != forwardTrajectory.rend();
844  ++trackStateOnSurfaceItr) {
845  if (!(*trackStateOnSurfaceItr).typeFlags.test(TrackStateOnSurface::Measurement)) {
846  smoothedTrajectory.emplace_back(std::move(*trackStateOnSurfaceItr));
847  } else {
848  foundMeasurement = true;
849  break;
850  }
851  }
852 
853  if(!foundMeasurement){
854  return {};
855  }
856  // This is the 1st track state on surface for a measurement
857  // in the reverse direction. Our starting point for the smoother
858  MultiComponentState smootherPredictionMultiState =
859  std::move(trackStateOnSurfaceItr->multiComponentState);
860  // Perform the update with the measurement and create the
861  // the 1st updated/smoothed entry in the trajectory
862  std::unique_ptr<Trk::MeasurementBase> firstSmootherMeasurementOnTrack =
863  std::move(trackStateOnSurfaceItr->measurementOnTrack);
864  if (!firstSmootherMeasurementOnTrack) {
866  "Initial state on surface in smoother does not have an associated "
867  "MeasurementBase object");
868  return {};
869  }
871  Trk::MultiComponentState firstSmoothedState =
872  Trk::GsfMeasurementUpdator::update(std::move(smootherPredictionMultiState),
873  *firstSmootherMeasurementOnTrack,
874  fitQuality);
875  if (firstSmoothedState.empty()) {
876  return {};
877  }
878 
879  if (!MultiComponentStateHelpers::allHaveCovariance(firstSmoothedState)) {
881  "Not all components have covariance. Rejecting smoothed state.");
882  return {};
883  }
884  // The first in reverse (last in normal order) TSOS is special so we do a proper collapse
885  // of the multi component to single TrackParameter
886  std::unique_ptr<Trk::TrackParameters> combinedFirstSmoothedState =
887  MultiComponentStateCombiner::combineToSingle(firstSmoothedState, m_useMode);
888  smoothedTrajectory.emplace_back(
889  fitQuality, std::move(firstSmootherMeasurementOnTrack),
890  std::move(combinedFirstSmoothedState),
891  MultiComponentStateHelpers::clone(firstSmoothedState));
892  const auto& updatedFirstStateOnSurface = smoothedTrajectory.back();
893 
894  // continue the reverse looping of the TrackStateOnSurfaces
895  // in the forward trajectory
896  ++trackStateOnSurfaceItr;
897  // The is the last one we will see
898  auto lasttrackStateOnSurface = forwardTrajectory.rend() - 1;
899  // TSOS that the cluster measuremenet will added on.
900  auto secondLastTrackStateOnSurface = forwardTrajectory.rend() - 2;
901  // Generate a prediction by scaling the covariance of all components in the
902  // first smoothed state and perform a measurement update to it.
903  // This way there is no dependance on error of prediction
904  // NB local Y and theta are not blown out too much to help in the TRT.
905  Trk::MultiComponentState smoothedStateWithScaledError =
907  std::move(firstSmoothedState), 15., 5., 15., 5., 15.);
908  Trk::FitQualityOnSurface fitQualityWithScaledErrors;
910  std::move(smoothedStateWithScaledError),
911  *(updatedFirstStateOnSurface.measurementOnTrack),
912  fitQualityWithScaledErrors);
913  if (updatedState.empty()) {
914  ATH_MSG_WARNING("Smoother prediction could not be determined");
915  return {};
916  }
917 
918  // loopUpdatedState is a plain ptr to the most recent
919  // predicted MultiComponentState.
920  // We start from our previous inflated prediction
921  Trk::MultiComponentState* loopUpdatedState = &updatedState;
922 
923  for (; trackStateOnSurfaceItr != forwardTrajectory.rend();
924  ++trackStateOnSurfaceItr) {
925  auto& trackStateOnSurface = (*trackStateOnSurfaceItr);
926  // Retrieve the MeasurementBase object from the TrackStateOnSurface object
927  std::unique_ptr<Trk::MeasurementBase> measurement =
928  std::move(trackStateOnSurface.measurementOnTrack);
929  if (!measurement) {
930  ATH_MSG_WARNING("MeasurementBase object could not be extracted from a "
931  "measurement TSOS... continuing");
932  continue;
933  }
934  // Create prediction for the next measurement surface.
935  // For the smoother the direction of propagation
936  // is opposite to the direction of momentum
937  Trk::MultiComponentState extrapolatedState =
938  m_extrapolator->extrapolate(ctx,
939  extrapolatorCache,
940  (*loopUpdatedState),
941  measurement->associatedSurface(),
943  false,
944  particleHypothesis);
945 
946  if (extrapolatedState.empty()) {
947  return {};
948  }
949  // Handle the case where Original measurement was flagged as an outlier
950  // and not used
951  if (!trackStateOnSurface.typeFlags.test(TrackStateOnSurface::Measurement)) {
952  std::bitset<TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> type(0);
954  smoothedTrajectory.emplace_back(
955  FitQualityOnSurface(1, 1),
956  std::move(measurement),
957  nullptr,
958  std::move(extrapolatedState),
959  type);
960  loopUpdatedState = &(smoothedTrajectory.back().multiComponentState);
961  continue;
962  }
963  // Update with the measurement
964  updatedState = Trk::GsfMeasurementUpdator::update(std::move(extrapolatedState), *measurement, fitQuality);
965  if (updatedState.empty()) {
966  ATH_MSG_WARNING("Could not update the multi-component state");
967  return {};
968  }
969  // last in reverse (first in normal order) is special as we collapse to single track Parameters
970  bool islast = (trackStateOnSurfaceItr == lasttrackStateOnSurface);
971  if (m_combineWithFitter) {
972  // Optional combine smoother state with fitter state
973  // e.g combine the current tsos (from the forward) with
974  // the updated from the smoother
975  const Trk::MultiComponentState& forwardsMultiState = trackStateOnSurface.multiComponentState;
977  forwardsMultiState, updatedState, m_maximumNumberOfComponents);
978  //
979  if (combinedfitterState.empty()) {
980  ATH_MSG_WARNING("Could not combine state from forward fit with "
981  "smoother state");
982  return {};
983  }
984  auto combinedFitQuality = Trk::GsfMeasurementUpdator::fitQuality(combinedfitterState, *measurement);
985  smoothedTrajectory.emplace_back(smootherHelper(std::move(combinedfitterState), std::move(measurement),
986  combinedFitQuality, islast, m_useMode));
987  } else {
988  // If combination with forwards state is not done
989  smoothedTrajectory.emplace_back(smootherHelper(std::move(updatedState), std::move(measurement),
990  fitQuality, islast, m_useMode));
991  }
992  // Handle adding measurement from calo if it is present
993  if (ccot && trackStateOnSurfaceItr == secondLastTrackStateOnSurface) {
994  if (!addCCOT(ctx, ccot, smoothedTrajectory)) {
995  ATH_MSG_WARNING("Could not add Calo Cluster On Track Measurement");
996  return {};
997  }
998  }
999  // For the next iteration start from last added
1000  loopUpdatedState = &(smoothedTrajectory.back().multiComponentState);
1001  } // End for loop over all components
1002  return smoothedTrajectory;
1003 }
1004 
1005 /*
1006  * Account for additional measurement from
1007  * the calorimeter
1008  */
1009 bool
1011  const EventContext& ctx,
1012  const Trk::CaloCluster_OnTrack* ccot,
1013  GSFTrajectory& smoothedTrajectory) const
1014 {
1015  const GSFTsos& currentMultiStateOS = smoothedTrajectory.back();
1016  if (!ccot) {
1017  return false;
1018  }
1019  const auto& currentMultiComponentState = currentMultiStateOS.multiComponentState;
1020  const Trk::MeasurementBase* measurement = currentMultiStateOS.measurementOnTrack.get();
1021  if (!measurement) {
1022  return false;
1023  }
1024  const Trk::Surface& currentSurface = measurement->associatedSurface();
1025 
1026  //Create a ccot that we will own. So we use it to build our own TSOS
1027  auto ownCCOT = ccot->uniqueClone();
1028  // Extrapolate to the Calo to get prediction
1029  Trk::MultiComponentState extrapolatedToCaloState = m_extrapolator->extrapolateDirectly(
1030  ctx, currentMultiComponentState, ownCCOT->associatedSurface(),
1032 
1033  if (extrapolatedToCaloState.empty()) {
1034  return false;
1035  }
1036  // Update newly extrapolated state with measurement
1038  Trk::MultiComponentState updatedStateAtCalo =
1039  Trk::GsfMeasurementUpdator::update(std::move(extrapolatedToCaloState),
1040  *ownCCOT, fitQuality);
1041  if (updatedStateAtCalo.empty()) {
1042  return false;
1043  }
1044 
1045  // Extrapolate back to the surface near the origin
1046  auto improvedState = m_extrapolator->extrapolateDirectly(
1047  ctx, updatedStateAtCalo, currentSurface, Trk::oppositeMomentum,
1048  false, Trk::nonInteracting);
1049 
1050  if (improvedState.empty()) {
1051  return false;
1052  }
1053  // Combine the improved state after extrapolating back from the calo
1054  // and find the mode of the distribution
1055  std::unique_ptr<Trk::TrackParameters> combinedSingleState =
1056  MultiComponentStateCombiner::combineToSingle(improvedState, m_useMode);
1057 
1058  // Now build a dummy measurement for the improved estimation
1060  covMatrix.setZero();
1061  covMatrix(0, 0) = 1e6;
1063  Trk::LocalParameters locpars(locX);
1064  auto pseudoMeasurement = std::make_unique<Trk::PseudoMeasurementOnTrack>(
1065  std::move(locpars), std::move(covMatrix), currentSurface);
1066 
1067  // Build TSOS at the surface of calo
1068  smoothedTrajectory.emplace_back(
1069  fitQuality,
1070  std::move(ownCCOT),
1071  nullptr,
1072  std::move(updatedStateAtCalo));
1073 
1074  // Build a TSOS using the dummy measurement and and the final combined state
1075  smoothedTrajectory.emplace_back(
1076  FitQualityOnSurface{}, // We do not add the fitquality again. As this would be the one we
1077  // add at calo, here not a real measurement
1078  std::move(pseudoMeasurement),
1079  std::move(combinedSingleState),
1080  std::move(improvedState));
1081 
1082  return true;
1083 }
grepfile.info
info
Definition: grepfile.py:38
mergePhysValFiles.pattern
pattern
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:26
Trk::MultiComponentStateHelpers::allHaveCovariance
bool allHaveCovariance(const MultiComponentState &in)
Check to see if all components have covariance Matrix.
Definition: ComponentParameters.cxx:66
Trk::LocalParameters
Definition: LocalParameters.h:98
EstimatedBremOnTrack.h
Trk::TrackInfo
Contains information about the 'fitter' of this track.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/TrackInfo.h:32
Trk::TrackStateOnSurface::Perigee
@ Perigee
This represents a perigee, and so will contain a Perigee object only.
Definition: TrackStateOnSurface.h:117
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
Trk::TrackInfo::GaussianSumFilter
@ GaussianSumFilter
Tracks from Gaussian Sum Filter.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/TrackInfo.h:53
MultiComponentStateCombiner.h
Trk::GaussianSumFitter::smootherFit
GSFTrajectory smootherFit(const EventContext &ctx, Trk::IMultiStateExtrapolator::Cache &, GSFTrajectory &forwardTrajectory, const ParticleHypothesis particleHypothesis=nonInteracting, const CaloCluster_OnTrack *ccot=nullptr) const
Gsf smoothed trajectory.
Definition: GaussianSumFitter.cxx:822
Trk::PrepRawDataSet
std::vector< const PrepRawData * > PrepRawDataSet
vector of clusters and drift circles
Definition: FitterTypes.h:26
TrackFitInputPreparator.h
Trk::MeasurementBase::clone
virtual MeasurementBase * clone() const =0
Pseudo-Constructor.
TrackParameters.h
PerigeeSurface.h
Trk::locX
@ locX
Definition: ParamDefs.h:37
GaussianSumFitter.h
Class for fitting according to the Gaussian Sum Filter formalism.
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
Trk::GaussianSumFitter::initialize
virtual StatusCode initialize() override final
AlgTool initialise method.
Definition: GaussianSumFitter.cxx:102
Trk::PerigeeSurface
Definition: PerigeeSurface.h:43
Trk::ParametersBase::position
const Amg::Vector3D & position() const
Access method for the position.
Trk::oppositeMomentum
@ oppositeMomentum
Definition: PropDirection.h:21
Trk::ParametersBase::associatedSurface
virtual const Surface & associatedSurface() const override=0
Access to the Surface associated to the Parameters.
Trk::TrackFitInputPreparator::stripPrepRawData
PrepRawDataSet stripPrepRawData(const Track &, const PrepRawDataSet &, const SortInputFlag, const bool)
create a vector of PrepRawData* from the mixed input of track and single PrepRawData.
Definition: TrackFitInputPreparator.cxx:42
Trk::Track::trackStateOnSurfaces
const Trk::TrackStates * trackStateOnSurfaces() const
return a pointer to a const DataVector of const TrackStateOnSurfaces.
Trk::MeasurementBaseType::CaloCluster_OnTrack
@ CaloCluster_OnTrack
Definition: MeasurementBase.h:53
Trk::TrackInfo::BremFitSuccessful
@ BremFitSuccessful
A brem fit was performed on this track and this fit was successful.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/TrackInfo.h:81
Trk::GaussianSumFitter::convertTrajToTrack
std::unique_ptr< MultiComponentStateOnSurfaceDV > convertTrajToTrack(GSFTrajectory &trajectory) const
Definition: GaussianSumFitter.cxx:528
Trk::GaussianSumFitter::forwardPRDfit
GSFTrajectory forwardPRDfit(const EventContext &ctx, IMultiStateExtrapolator::Cache &cache, const PrepRawDataSet &inputPrepRawDataSet, const TrackParameters &estimatedTrackParametersNearOrigin, const ParticleHypothesis particleHypothesis=nonInteracting) const
Forward GSF fit using PrepRawData.
Definition: GaussianSumFitter.cxx:605
Trk::loc2
@ loc2
generic first and second local coordinate
Definition: ParamDefs.h:35
Trk::RIO_OnTrack
Definition: RIO_OnTrack.h:70
Trk::alongMomentum
@ alongMomentum
Definition: PropDirection.h:20
Trk::MultiComponentStateCombiner::combineToSingle
std::unique_ptr< Trk::TrackParameters > combineToSingle(const MultiComponentState &, const bool useMode=false)
@bried Calculate combined state of many components
Definition: MultiComponentStateCombiner.cxx:305
PrepRawData.h
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
Trk::RunOutlierRemoval
bool RunOutlierRemoval
switch to toggle quality processing after fit
Definition: FitterTypes.h:22
Trk::DefinedParameter
std::pair< double, ParamDefs > DefinedParameter
Definition: DefinedParameter.h:27
Trk::GaussianSumFitter::GSFTrajectory
std::vector< GSFTsos > GSFTrajectory
Definition: GaussianSumFitter.h:111
DeMoUpdate.reverse
reverse
Definition: DeMoUpdate.py:563
Trk::GaussianSumFitter::stepForwardFit
bool stepForwardFit(const EventContext &ctx, IMultiStateExtrapolator::Cache &, GSFTrajectory &forwardTrajectory, const PrepRawData *originalPrepRawData, const MeasurementBase *originalMeasurement, const Surface &surface, MultiComponentState &updatedState, const ParticleHypothesis particleHypothesis=nonInteracting) const
Progress one step along the fit.
Definition: GaussianSumFitter.cxx:720
Trk::TrackStateOnSurface::Outlier
@ Outlier
This TSoS contains an outlier, that is, it contains a MeasurementBase/RIO_OnTrack which was not used ...
Definition: TrackStateOnSurface.h:122
GSFConstants::maxNumberofStateComponents
constexpr int8_t maxNumberofStateComponents
Note the Gaussian sum approach as describe e.g in " Optimal Filtering" Anderson and Moore "Track Fitt...
Definition: GsfConstants.h:47
Track.h
Trk::AmgSymMatrix
AmgSymMatrix(5) &GXFTrackState
Definition: GXFTrackState.h:156
Trk::FitQualityOnSurface
Definition: FitQualityOnSurface.h:19
IMultiStateExtrapolator.h
Trk::ParticleHypothesis
ParticleHypothesis
Definition: ParticleHypothesis.h:25
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
Trk::CaloCluster_OnTrack::uniqueClone
std::unique_ptr< CaloCluster_OnTrack > uniqueClone() const
NVI Clone giving up unique pointer.
Definition: CaloCluster_OnTrack.h:58
Trk::Surface::createUniqueTrackParameters
virtual ChargedTrackParametersUniquePtr createUniqueTrackParameters(double l1, double l2, double phi, double theat, double qop, std::optional< AmgSymMatrix(5)> cov=std::nullopt) const =0
Use the Surface as a ParametersBase constructor, from local parameters - charged.
Trk::theta
@ theta
Definition: ParamDefs.h:66
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
xAOD::covMatrix
covMatrix
Definition: TrackMeasurement_v1.cxx:19
AmgVector
AmgVector(4) T2BSTrackFilterTool
Definition: T2BSTrackFilterTool.cxx:114
PrepRawDataComparisonFunction.h
GSFTsos::measurementOnTrack
std::unique_ptr< Trk::MeasurementBase > measurementOnTrack
Definition: GSFTsos.h:24
Trk::MultiComponentStateHelpers::clone
MultiComponentState clone(const MultiComponentState &in)
Clone TrackParameters method.
Definition: ComponentParameters.cxx:15
PseudoMeasurementOnTrack.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
Trk::GaussianSumFitter::GaussianSumFitter
GaussianSumFitter(const std::string &, const std::string &, const IInterface *)
Constructor with parameters to be passed to AlgTool.
Definition: GaussianSumFitter.cxx:89
Trk::MultiComponentState
std::vector< ComponentParameters > MultiComponentState
Definition: ComponentParameters.h:27
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Trk::TrackInfo::BremFit
@ BremFit
A brem fit was performed on this track.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/TrackInfo.h:78
Trk::ParametersBase
Definition: ParametersBase.h:55
Trk::FitQualityOnSurface::numberDoF
int numberDoF() const
returns the number of degrees of freedom of the overall track or vertex fit as integer
Definition: FitQuality.h:60
Trk::IMultiStateExtrapolator::Cache
MultiStateExtrapolator cache class.
Definition: IMultiStateExtrapolator.h:56
MuonValidation_CreateResolutionProfiles.fit
def fit(h, emin, emax)
Definition: MuonValidation_CreateResolutionProfiles.py:69
GSFTsos
Definition: GSFTsos.h:17
Trk::MultiComponentStateHelpers::WithScaledError
MultiComponentState WithScaledError(MultiComponentState &&in, double errorScaleLocX, double errorScaleLocY, double errorScalePhi, double errorScaleTheta, double errorScaleQoverP)
Scale the covariance matrix components by individual factors.
Definition: ComponentParameters.cxx:26
Trk::MeasurementSet
std::vector< const MeasurementBase * > MeasurementSet
vector of fittable measurements
Definition: FitterTypes.h:30
Trk::PrepRawData
Definition: PrepRawData.h:62
Trk::MeasurementBase
Definition: MeasurementBase.h:58
Trk::Track::trackParameters
const DataVector< const TrackParameters > * trackParameters() const
Return a pointer to a vector of TrackParameters.
Definition: Tracking/TrkEvent/TrkTrack/src/Track.cxx:97
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::GaussianSumFitter::forwardMeasurementFit
GSFTrajectory forwardMeasurementFit(const EventContext &ctx, IMultiStateExtrapolator::Cache &cache, const MeasurementSet &inputMeasurementSet, const TrackParameters &estimatedTrackParametersNearOrigin, const ParticleHypothesis particleHypothesis=nonInteracting) const
Forward GSF fit using MeasurementSet.
Definition: GaussianSumFitter.cxx:667
Trk::CaloCluster_OnTrack
Definition: CaloCluster_OnTrack.h:32
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
Trk::MeasurementBase::associatedSurface
virtual const Surface & associatedSurface() const =0
Interface method to get the associated Surface.
TrackInfo.h
createCoolChannelIdFile.par
par
Definition: createCoolChannelIdFile.py:29
RIO_OnTrack.h
Trk::GaussianSumFitter::addCCOT
bool addCCOT(const EventContext &ctx, const Trk::CaloCluster_OnTrack *ccot, GSFTrajectory &smoothedTrajectory) const
Methof to add the CaloCluster onto the track.
Definition: GaussianSumFitter.cxx:1010
Trk::nonInteracting
@ nonInteracting
Definition: ParticleHypothesis.h:25
Trk::pseudoMeasurement
@ pseudoMeasurement
Definition: MeasurementType.h:26
GSFTsos::multiComponentState
Trk::MultiComponentState multiComponentState
Definition: GSFTsos.h:20
Trk::ComponentParameters
Definition: ComponentParameters.h:22
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Trk::RIO_OnTrack::prepRawData
virtual const Trk::PrepRawData * prepRawData() const =0
returns the PrepRawData (also known as RIO) object to which this RIO_OnTrack is associated.
Trk::MeasurementBaseType::RIO_OnTrack
@ RIO_OnTrack
Definition: MeasurementBase.h:49
Trk::GaussianSumFitter::fit
virtual std::unique_ptr< Track > fit(const EventContext &ctx, const Track &, const RunOutlierRemoval, const ParticleHypothesis particleHypothesis=nonInteracting) const override final
Refit a track using the Gaussian Sum Filter.
Definition: GaussianSumFitter.cxx:139
IDTPM::chiSquared
float chiSquared(const U &p)
Definition: TrackParametersHelper.h:128
Trk::GsfMeasurementUpdator::fitQuality
FitQualityOnSurface fitQuality(const MultiComponentState &, const MeasurementBase &)
Method for determining the chi2 of the multi-component state and the number of degrees of freedom.
Definition: GsfMeasurementUpdator.cxx:845
Trk::Track::measurementsOnTrack
const DataVector< const MeasurementBase > * measurementsOnTrack() const
return a pointer to a vector of MeasurementBase (NOT including any that come from outliers).
Definition: Tracking/TrkEvent/TrkTrack/src/Track.cxx:178
Trk::ParametersBase::momentum
const Amg::Vector3D & momentum() const
Access method for the momentum.
CaloCluster_OnTrack.h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
Trk::TrkParametersComparisonFunction
ComparisonFunction< TrackParameters > TrkParametersComparisonFunction
Definition: TrkParametersComparisonFunction.h:26
Trk::GaussianSumFitter::makePerigee
GSFTsos makePerigee(const EventContext &ctx, Trk::IMultiStateExtrapolator::Cache &, const GSFTrajectory &smoothedTrajectory, const ParticleHypothesis particleHypothesis=nonInteracting) const
Produces a perigee from a smoothed trajectory.
Definition: GaussianSumFitter.cxx:544
Trk::qOverP
@ qOverP
perigee
Definition: ParamDefs.h:67
Trk::MeasurementBaseType::PseudoMeasurementOnTrack
@ PseudoMeasurementOnTrack
Definition: MeasurementBase.h:51
Track
Definition: TriggerChamberClusterOnTrackCreator.h:21
GsfConstants.h
Trk::phi
@ phi
Definition: ParamDefs.h:75
Trk::PrepRawDataComparisonFunction
Class providing comparison function, or relational definition, for PrepRawData.
Definition: PrepRawDataComparisonFunction.h:33
Trk::MeasurementBaseComparisonFunction
Class implementing a comparison function for sorting MeasurementBase objects.
Definition: MeasurementBaseComparisonFunction.h:40
Trk::MultiComponentStateCombiner::combineWithSmoother
Trk::MultiComponentState combineWithSmoother(const Trk::MultiComponentState &forwardsMultiState, const Trk::MultiComponentState &smootherMultiState, unsigned int maximumNumberOfComponents)
Helper to combine forward with smoother MultiComponentStates.
Definition: MultiComponentStateCombiner.cxx:409
Trk::GsfMeasurementUpdator::update
MultiComponentState update(Trk::MultiComponentState &&, const Trk::MeasurementBase &, FitQualityOnSurface &fitQoS)
Method for updating the multi-state with a new measurement and calculate the fit qaulity at the same ...
Definition: GsfMeasurementUpdator.cxx:808
AthAlgTool
Definition: AthAlgTool.h:26
FitQuality.h
Trk::loc1
@ loc1
Definition: ParamDefs.h:34
Trk::Surface
Definition: Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h:79
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
Trk::TrackFitInputPreparator::stripMeasurements
MeasurementSet stripMeasurements(const Track &, const MeasurementSet &)
get the MeasurementSet out of a track+measurements combination.
Definition: TrackFitInputPreparator.cxx:19
Trk::FitQualityOnSurface::chiSquared
double chiSquared() const
returns the of the overall track fit
Definition: FitQuality.h:56
DataVector::empty
bool empty() const noexcept
Returns true if the collection is empty.
Trk::TrackStateOnSurface::Measurement
@ Measurement
This is a measurement, and will at least contain a Trk::MeasurementBase.
Definition: TrackStateOnSurface.h:101
MeasurementBaseComparisonFunction.h
python.SystemOfUnits.ms
float ms
Definition: SystemOfUnits.py:147