ATLAS Offline Software
TrkFitter/TrkGaussianSumFilter/src/GaussianSumFitter.cxx
Go to the documentation of this file.
1 /*ยง
2  Copyright (C) 2002-2023 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) {
80  updatedState, useMode);
81  if (combinedLastState) {
82  return {fitQuality, std::move(measurement), std::move(combinedLastState),
83  std::move(updatedState)};
84  }
85  }
86  return {fitQuality, std::move(measurement), nullptr, std::move(updatedState)};
87 }
88 
89 } // end of anonymous namespace
90 
92  const std::string& name,
93  const IInterface* parent)
95  , m_directionToPerigee(Trk::oppositeMomentum)
96  , m_trkParametersComparisonFunction{}
97  , m_sortingReferencePoint{ 0, 0, 0 }
98 {
99  declareInterface<ITrackFitter>(this);
100  declareProperty("SortingReferencePoint", m_sortingReferencePoint);
101 }
102 
105 {
106 
107  if (m_maximumNumberOfComponents > GSFConstants::maxNumberofStateComponents) {
108  ATH_MSG_FATAL("Requested MaximumNumberOfComponents > "
110  return StatusCode::FAILURE;
111  }
112 
113  // GSF extrapolator
114  ATH_CHECK(m_extrapolator.retrieve());
115 
116  // We need a to create RIO_OnTrack (calibrated/corrected)
117  // measurements only if we start from PrePRawData.
118  if (!m_refitOnMeasurementBase) {
119  ATH_CHECK(m_rioOnTrackCreator.retrieve());
120  } else {
121  m_rioOnTrackCreator.disable();
122  }
123  // Initialise the closest track parameters search algorithm
124  Amg::Vector3D referencePosition(m_sortingReferencePoint[0],
125  m_sortingReferencePoint[1],
126  m_sortingReferencePoint[2]);
127 
128  m_trkParametersComparisonFunction =
129  Trk::TrkParametersComparisonFunction(referencePosition);
130 
131  return StatusCode::SUCCESS;
132 }
133 
134 /*
135  * Interface Method
136  * Refitting of an input track.
137  * Extract the measurementBase or
138  * PrepRawData and refit.
139  */
140 std::unique_ptr<Trk::Track>
142  const EventContext& ctx,
143  const Trk::Track& inputTrack,
144  const Trk::RunOutlierRemoval outlierRemoval,
145  const Trk::ParticleHypothesis particleHypothesis) const
146 {
147  // Check that the input track has well defined parameters
148  if (inputTrack.trackParameters()->empty()) {
149  ATH_MSG_FATAL("No track parameters on Track!");
150  return nullptr;
151  }
152  // Check that the input track has associated MeasurementBase objects
153  if (inputTrack.trackStateOnSurfaces()->empty()) {
154  ATH_MSG_FATAL("Empty MeasurementBase ");
155  return nullptr;
156  }
157  // Retrieve the set of track parameters closest to the reference point
158  const Trk::TrackParameters* parametersNearestReference =
159  *(std::min_element(inputTrack.trackParameters()->begin(),
160  inputTrack.trackParameters()->end(),
161  m_trkParametersComparisonFunction));
162 
163  // If we refit using measurement base then
164  // extract the measurements from the input track
165  // and fit them
166  if (m_refitOnMeasurementBase) {
167 
168  MeasurementSet measurementSet;
169 
170  for (const auto* tsos : *(inputTrack.trackStateOnSurfaces())) {
171 
172  if (!(tsos)) {
173  ATH_MSG_WARNING("Track contains an empty MeasurementBase object ");
174  continue;
175  }
176 
177  const MeasurementBase* meas = tsos->measurementOnTrack();
178  if (meas) {
179  if (tsos->type(TrackStateOnSurface::Measurement)) {
180  measurementSet.push_back(meas);
181  } else if (m_reintegrateOutliers &&
182  tsos->type(TrackStateOnSurface::Outlier)) {
183  measurementSet.push_back(meas);
184  }
185  }
186  }
187 
188  return fit(ctx,
189  measurementSet,
190  *parametersNearestReference,
191  outlierRemoval,
192  particleHypothesis);
193  }
194 
195  // If we refit using PrepRawData level then
196  // extract the the PrepRawData from the input track
197  // and fit them
198  PrepRawDataSet prepRawDataSet;
199 
200  for (const auto* meas : *(inputTrack.measurementsOnTrack())) {
201 
202  if (!meas) {
203  continue;
204  }
205  const Trk::RIO_OnTrack* rioOnTrack = nullptr;
206  if (meas->type(Trk::MeasurementBaseType::RIO_OnTrack)) {
207  rioOnTrack = static_cast<const Trk::RIO_OnTrack*>(meas);
208  }
209  if (!rioOnTrack) {
210  continue;
211  }
212  const PrepRawData* prepRawData = rioOnTrack->prepRawData();
213  if (!prepRawData) {
214  continue;
215  }
216  prepRawDataSet.push_back(prepRawData);
217  }
218 
219  return fit(ctx,
220  prepRawDataSet,
221  *parametersNearestReference,
222  outlierRemoval,
223  particleHypothesis);
224 }
225 
226 /*
227  * Interface Method
228  * Fitting of a set of PrepRawData objects
229  */
230 std::unique_ptr<Trk::Track>
232  const EventContext& ctx,
233  const Trk::PrepRawDataSet& prepRawDataSet,
234  const Trk::TrackParameters& estimatedParametersNearOrigin,
235  const Trk::RunOutlierRemoval /* Not used*/,
236  const Trk::ParticleHypothesis particleHypothesis) const
237 {
238 
239  // Protect against empty PrepRawDataSet object
240  if (prepRawDataSet.empty()) {
241  ATH_MSG_FATAL("PrepRawData set for fit is empty");
242  return nullptr;
243  }
244 
245  // We need a sorted PrepRawDataSet
246  Trk::PrepRawDataSet sortedPrepRawDataSet = PrepRawDataSet(prepRawDataSet);
247  Trk::PrepRawDataComparisonFunction prdComparisonFunction =
249  estimatedParametersNearOrigin.position(),
250  estimatedParametersNearOrigin.momentum());
251 
252  std::sort(sortedPrepRawDataSet.begin(),
253  sortedPrepRawDataSet.end(),
254  prdComparisonFunction);
255 
256  // Create Extrapolator cache that holds material effects cache;
257  Trk::IMultiStateExtrapolator::Cache extrapolatorCache;
258  // Perform GSF forward fit
259  GSFTrajectory forwardTrajectory =
260  forwardPRDfit(ctx, extrapolatorCache, sortedPrepRawDataSet,
261  estimatedParametersNearOrigin, particleHypothesis);
262 
263  if (forwardTrajectory.empty()) {
264  return nullptr;
265  }
266  // Perform GSF smoother operation
267  GSFTrajectory smoothedTrajectory =
268  smootherFit(ctx, extrapolatorCache, forwardTrajectory, particleHypothesis);
269  if (smoothedTrajectory.empty()) {
270  return nullptr;
271  }
272 
273  // Fit quality
274  std::unique_ptr<FitQuality> fitQuality = buildFitQuality(smoothedTrajectory);
275  if (!fitQuality) {
276  return nullptr;
277  }
278 
279  // Create parameters at perigee if needed
280  auto perigeeMultiStateOnSurface =
281  makePerigee(ctx, extrapolatorCache, smoothedTrajectory, particleHypothesis);
282  if (!perigeeMultiStateOnSurface.multiComponentState.empty()) {
283  smoothedTrajectory.push_back(std::move(perigeeMultiStateOnSurface));
284  } else {
285  return nullptr;
286  }
287 
288  // Reverse the order of the TSOS's after the smoother
289  // to make be order flow from inside to out
290  std::reverse(smoothedTrajectory.begin(), smoothedTrajectory.end());
291 
292  // Create Trk::Track
294  info.setTrackProperties(TrackInfo::BremFit);
295  info.setTrackProperties(TrackInfo::BremFitSuccessful);
296  return std::make_unique<Track>(
297  info, convertTrajToTrack(smoothedTrajectory),
298  std::move(fitQuality));
299 }
300 
301 /*
302  * Interface method
303  * Fitting of a set of MeasurementBase objects
304  */
305 std::unique_ptr<Trk::Track>
307  const EventContext& ctx,
308  const Trk::MeasurementSet& measurementSet,
309  const Trk::TrackParameters& estimatedParametersNearOrigin,
310  const Trk::RunOutlierRemoval /* Not used*/,
311  const Trk::ParticleHypothesis particleHypothesis) const
312 {
313 
314  // Protect against empty PrepRawDataSet object
315  if (measurementSet.empty()) {
316  ATH_MSG_FATAL("MeasurementSet for fit is empty");
317  return nullptr;
318  }
319 
320  // We need to separate the possible CaloCluster on Track
321  // measurement from the rest
322  const Trk::CaloCluster_OnTrack* ccot(nullptr);
323 
324  Trk::MeasurementSet cleanedMeasurementSet;
325  cleanedMeasurementSet.reserve(measurementSet.size());
326 
327  for (const auto* meas : measurementSet) {
328  if (!meas) {
330  "There is an empty MeasurementBase object in the track! ");
331  continue;
332  }
334  ccot = static_cast<const Trk::CaloCluster_OnTrack*>(meas);
335  } else {
336  cleanedMeasurementSet.push_back(meas);
337  }
338  }
339 
340  // We need a sorted measurement set
341  Trk::MeasurementSet sortedMeasurementSet =
342  MeasurementSet(cleanedMeasurementSet);
343 
344  Trk::MeasurementBaseComparisonFunction measurementBaseComparisonFunction(
345  estimatedParametersNearOrigin.position(),
346  estimatedParametersNearOrigin.momentum());
347  sort(sortedMeasurementSet.begin(),
348  sortedMeasurementSet.end(),
349  measurementBaseComparisonFunction);
350 
351  // Create Extrapolator cache that holds material effects cache;
352  Trk::IMultiStateExtrapolator::Cache extrapolatorCache;
353 
354  // Perform GSF forwards fit
355  GSFTrajectory forwardTrajectory =
356  forwardMeasurementFit(ctx, extrapolatorCache, sortedMeasurementSet,
357  estimatedParametersNearOrigin, particleHypothesis);
358 
359  if (forwardTrajectory.empty()) {
360  return nullptr;
361  }
362 
363  // Perform GSF smoother operation
364  GSFTrajectory smoothedTrajectory = smootherFit(
365  ctx, extrapolatorCache, forwardTrajectory, particleHypothesis, ccot);
366  if (smoothedTrajectory.empty()) {
367  return nullptr;
368  }
369 
370  // fit quality
371  std::unique_ptr<FitQuality> fitQuality = buildFitQuality(smoothedTrajectory);
372  if (!fitQuality) {
373  return nullptr;
374  }
375 
376  // Create parameters at perigee if needed
377  auto perigeeMultiStateOnSurface =
378  makePerigee(ctx, extrapolatorCache, smoothedTrajectory, particleHypothesis);
379  if (!perigeeMultiStateOnSurface.multiComponentState.empty()) {
380  smoothedTrajectory.push_back(std::move(perigeeMultiStateOnSurface));
381  } else {
382  return nullptr;
383  }
384 
385  // Reverse the order of the TSOS's to make be order flow from inside to out
386  std::reverse(smoothedTrajectory.begin(), smoothedTrajectory.end());
387 
388  // Create track
390  info.setTrackProperties(TrackInfo::BremFit);
391  info.setTrackProperties(TrackInfo::BremFitSuccessful);
392  return std::make_unique<Track>(
393  info, convertTrajToTrack(smoothedTrajectory),
394  std::move(fitQuality));
395 }
396 
397 /*
398  * Interface method
399  * Refit a track adding a PrepRawData set
400  */
401 std::unique_ptr<Trk::Track>
402 Trk::GaussianSumFitter::fit(const EventContext& ctx,
403  const Track& intrk,
404  const PrepRawDataSet& addPrdColl,
405  const RunOutlierRemoval runOutlier,
406  const ParticleHypothesis matEffects) const
407 {
408  // protection, if empty PrepRawDataSet
409  if (addPrdColl.empty()) {
411  "client tries to add an empty PrepRawDataSet to the track fit.");
412  return fit(ctx, intrk, runOutlier, matEffects);
413  }
414  // determine the Track Parameter which is the start of the trajectory
415  const TrackParameters* estimatedStartParameters =
416  *(std::min_element(intrk.trackParameters()->begin(),
417  intrk.trackParameters()->end(),
418  m_trkParametersComparisonFunction));
419 
420  // use external preparator class to prepare PRD set for fitter interface
422  intrk, addPrdColl, false, true);
423 
424  // delegate to fitting PrepRawData interface method
425  return fit(ctx, PRDColl, *estimatedStartParameters, runOutlier, matEffects);
426 }
427 
428 /*
429  * Interface method
430  * Refit a track adding a RIO_OnTrack set
431  */
432 std::unique_ptr<Trk::Track>
433 Trk::GaussianSumFitter::fit(const EventContext& ctx,
434  const Track& inputTrack,
435  const MeasurementSet& measurementSet,
436  const RunOutlierRemoval runOutlier,
437  const ParticleHypothesis matEffects) const
438 {
439 
440  // protection, if empty MeasurementSet
441  if (measurementSet.empty()) {
443  "Client tries to add an empty MeasurementSet to the track fit.");
444  return fit(ctx, inputTrack, runOutlier, matEffects);
445  }
446  // Check that the input track has well defined parameters
447  if (inputTrack.trackParameters()->empty()) {
448  ATH_MSG_FATAL("No estimation of track parameters near origin!");
449  return nullptr;
450  }
451  // Check that the input track has associated MeasurementBase objects
452  if (inputTrack.trackStateOnSurfaces()->empty()) {
453  ATH_MSG_FATAL("Attempting to fit track to empty MeasurementBase "
454  "collection!");
455  return nullptr;
456  }
457  // Retrieve the set of track parameters closest to the reference point
458  const Trk::TrackParameters* parametersNearestReference =
459  *(std::min_element(inputTrack.trackParameters()->begin(),
460  inputTrack.trackParameters()->end(),
461  m_trkParametersComparisonFunction));
462 
464  inputTrack, measurementSet);
465 
466  // delegate to measurementBase fit method
467  return fit(
468  ctx, combinedMS, *parametersNearestReference, runOutlier, matEffects);
469 }
470 
471 /*
472  * Interface method
473  * Combine two tracks by refitting
474  */
475 std::unique_ptr<Trk::Track>
476 Trk::GaussianSumFitter::fit(const EventContext& ctx,
477  const Track& intrk1,
478  const Track& intrk2,
479  const RunOutlierRemoval runOutlier,
480  const ParticleHypothesis matEffects) const
481 {
482  // Just add the hits on tracks
483  // protection against not having measurements on the input tracks
484  if (!intrk1.trackStateOnSurfaces() || !intrk2.trackStateOnSurfaces() ||
485  intrk1.trackStateOnSurfaces()->size() < 2) {
486  ATH_MSG_WARNING("called to refit empty track or track with too little "
487  "information, reject fit");
488  return nullptr;
489  }
490  if (!intrk1.trackParameters() || intrk1.trackParameters()->empty()) {
491  ATH_MSG_WARNING("input #1 fails to provide track parameters for "
492  "seeding the GXF, reject fit");
493  return nullptr;
494  }
495 
496  const TrackParameters* minPar = *(intrk1.trackParameters()->begin());
498  for (const auto* tsos : *(intrk1.trackStateOnSurfaces())) {
499  if (!(tsos->type(Trk::TrackStateOnSurface::Measurement) ||
500  tsos->type(Trk::TrackStateOnSurface::Outlier))) {
501  continue;
502  }
503 
504  if (tsos->measurementOnTrack()->type(
506  continue;
507  }
508 
509  ms.push_back(tsos->measurementOnTrack());
510  }
511 
512  for (const auto* tsos : *(intrk2.trackStateOnSurfaces())) {
513 
514  if (!(tsos->type(Trk::TrackStateOnSurface::Measurement) ||
515  tsos->type(Trk::TrackStateOnSurface::Outlier))) {
516  continue;
517  }
518 
519  if (tsos->measurementOnTrack()->type(
521  continue;
522  }
523  ms.push_back(tsos->measurementOnTrack());
524  }
525  // call measurement base interface
526  return fit(ctx, ms, *minPar, runOutlier, matEffects);
527 }
528 
529 /*Helper to convert the GSFTrajectory to a Trk::Track */
530 std::unique_ptr<MultiComponentStateOnSurfaceDV> Trk::GaussianSumFitter::convertTrajToTrack(
531  GSFTrajectory& trajectory) const{
532  bool slimTransientMTSOS = m_slimTransientMTSOS;
533  auto MTSOS = std::make_unique<MultiComponentStateOnSurfaceDV>();
534  MTSOS->reserve(trajectory.size());
535  for (GSFTsos& state : trajectory) {
536  MTSOS->push_back(state.convert(slimTransientMTSOS));
537  }
538  return MTSOS;
539 }
540 
541 /*
542  * Helper creating a multicomponent
543  * perigee TrackStateOnSurface
544  */
545 GSFTsos
547  const EventContext& ctx,
548  Trk::IMultiStateExtrapolator::Cache& extrapolatorCache,
549  const GSFTrajectory& smoothedTrajectory,
550  const Trk::ParticleHypothesis particleHypothesis) const
551 {
552 
553  // Start at the end of the smoothed trajectory
554  // we should be the closest to perigee/origin.
555  const GSFTsos&
556  multiComponentStateOnSurfaceNearestOrigin = smoothedTrajectory.back();
557  const Trk::MultiComponentState* multiComponentState =
558  &(multiComponentStateOnSurfaceNearestOrigin.multiComponentState);
559 
560  // Extrapolate to perigee
561  const Trk::PerigeeSurface perigeeSurface;
562  Trk::MultiComponentState stateExtrapolatedToPerigee =
563  m_extrapolator->extrapolate(ctx,
564  extrapolatorCache,
565  *multiComponentState,
566  perigeeSurface,
567  m_directionToPerigee,
568  false,
569  particleHypothesis);
570 
571  if (stateExtrapolatedToPerigee.empty()) {
572  return {};
573  }
574 
575  // Determine the combined state
576  std::unique_ptr<Trk::TrackParameters> combinedPerigee =
577  MultiComponentStateCombiner::combineToSingle(stateExtrapolatedToPerigee, m_useMode);
578 
579  // Perigee is an additional MultiComponentStateOnSurface
580  std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes>
581  pattern(0);
583 
584  if(std::abs(combinedPerigee->position().z())>10000.) {
585  ATH_MSG_WARNING("Pathological perigee well outside of detector!! Returning {}");
586  return {};
587  }
588 
589  if (std::abs(combinedPerigee->parameters()[Trk::qOverP]) > 1e8) {
591  "makePerigee() about to return with 0 momentum!! Returning {}");
592  return {};
593  }
594 
595  return {Trk::FitQualityOnSurface{},
596  nullptr,
597  std::move(combinedPerigee),
598  std::move(stateExtrapolatedToPerigee),
599  pattern};
600 }
601 
602 /*
603  * Private method for
604  * Forward fit on a set of PrepRawData
605  */
608  const EventContext& ctx,
609  Trk::IMultiStateExtrapolator::Cache& extrapolatorCache,
610  const Trk::PrepRawDataSet& inputPrepRawDataSet,
611  const Trk::TrackParameters& estimatedTrackParametersNearOrigin,
612  const Trk::ParticleHypothesis particleHypothesis) const
613 {
614 
615  // Extract PrepRawDataSet into new local object and check that the PrepRawData
616  // is associated with a detector element
617  Trk::PrepRawDataSet prepRawDataSet;
618  for (const auto* rawData : inputPrepRawDataSet) {
619  if (!(rawData->detectorElement())) {
620  ATH_MSG_WARNING("PrepRawData has no Element link... disregard it");
621  } else {
622  prepRawDataSet.push_back(rawData);
623  }
624  }
625  // For starting guess a multicompoment state
626  // that has single component with weight 1
627  const AmgVector(5)& par = estimatedTrackParametersNearOrigin.parameters();
628  Trk::ComponentParameters componentParametersNearOrigin = {
629  estimatedTrackParametersNearOrigin.associatedSurface()
631  par[Trk::loc2],
632  par[Trk::phi],
633  par[Trk::theta],
634  par[Trk::qOverP],
635  std::nullopt /*no errors*/),
636  1.};
637 
638  Trk::MultiComponentState multiComponentStateNearOrigin{};
639  multiComponentStateNearOrigin.push_back(
640  std::move(componentParametersNearOrigin));
641 
642  // Create new trajectory
643  GSFTrajectory forwardTrajectory{};
644  forwardTrajectory.reserve(prepRawDataSet.size());
645  for (const auto* prepRawData : prepRawDataSet) {
646  // Every step the ForwardTrajectory is updated
647  bool stepIsValid = stepForwardFit(
648  ctx,
649  extrapolatorCache,
650  forwardTrajectory,
651  prepRawData,
652  nullptr,
653  prepRawData->detectorElement()->surface(prepRawData->identify()),
654  multiComponentStateNearOrigin,
655  particleHypothesis);
656 
657  if (!stepIsValid) {
658  return GSFTrajectory{};
659  }
660  }
661  return forwardTrajectory;
662 }
663 
664 /*
665  * Private method for
666  * forward fit on a set of Measurements
667  */
670  const EventContext& ctx,
671  Trk::IMultiStateExtrapolator::Cache& extrapolatorCache,
672  const Trk::MeasurementSet& inputMeasurementSet,
673  const Trk::TrackParameters& estimatedTrackParametersNearOrigin,
674  const Trk::ParticleHypothesis particleHypothesis) const
675 {
676 
677  if (inputMeasurementSet.empty()) {
678  ATH_MSG_ERROR("forwardMeasurementFit: Input MeasurementSet is empty!");
679  return GSFTrajectory{};
680  }
681  // For starting guess a multicompoment state
682  // that has single component with weight 1
683  const AmgVector(5)& par = estimatedTrackParametersNearOrigin.parameters();
684  Trk::ComponentParameters componentParametersNearOrigin = {
685  estimatedTrackParametersNearOrigin.associatedSurface()
687  par[Trk::loc2],
688  par[Trk::phi],
689  par[Trk::theta],
690  par[Trk::qOverP],
691  std::nullopt /*no errors*/),
692  1.};
693  Trk::MultiComponentState multiComponentStateNearOrigin{};
694  multiComponentStateNearOrigin.push_back(
695  std::move(componentParametersNearOrigin));
696 
697  GSFTrajectory forwardTrajectory{};
698  forwardTrajectory.reserve(inputMeasurementSet.size());
699  for (const auto* measurement : inputMeasurementSet) {
700  // Every step the ForwardTrajectory is updated
701  bool stepIsValid = stepForwardFit(ctx,
702  extrapolatorCache,
703  forwardTrajectory,
704  nullptr,
705  measurement,
706  measurement->associatedSurface(),
707  multiComponentStateNearOrigin,
708  particleHypothesis);
709 
710  if (!stepIsValid) {
711  return GSFTrajectory{};
712  }
713  }
714  return forwardTrajectory;
715 }
716 
717 /*
718  * Actual
719  * Implementation method for StepForwardFit
720  */
721 bool
723  const EventContext& ctx,
724  Trk::IMultiStateExtrapolator::Cache& extrapolatorCache,
725  GSFTrajectory& forwardTrajectory,
726  const Trk::PrepRawData* originalPrepRawData,
727  const Trk::MeasurementBase* originalMeasurement,
728  const Trk::Surface& surface,
729  Trk::MultiComponentState& updatedState,
730  const Trk::ParticleHypothesis particleHypothesis) const
731 {
732  // Protect against undefined Measurement or PrepRawData
733  if (!originalPrepRawData && !originalMeasurement) {
734  ATH_MSG_WARNING("No measurement base or PrepRawData passed to "
735  "StepForwardFit!");
736  return false;
737  }
738 
739  if (!originalMeasurement && m_refitOnMeasurementBase) {
740  ATH_MSG_WARNING("No measurement base information passed to StepForwardFit");
741  return false;
742  }
743  // Propagate the multi-component state to the next measurement surface
744  // accounting for the material effects. This gives us
745  // the prediction at that surface.
746  Trk::MultiComponentState extrapolatedState =
747  m_extrapolator->extrapolate(ctx,
748  extrapolatorCache,
749  updatedState,
750  surface,
752  false,
753  particleHypothesis);
754  if (extrapolatedState.empty()) {
755  return false;
756  }
757 
758  // we need to account for either measurement base input
759  // or PrepRawData input.
760  std::unique_ptr<Trk::MeasurementBase> measurement = nullptr;
761  if (originalMeasurement) { // clone original MeasurementBase object
762  measurement.reset(originalMeasurement->clone());
763  } else {
764  std::unique_ptr<Trk::TrackParameters> combinedState =
766  if (!combinedState) {
767  ATH_MSG_WARNING("State combination failed... exiting");
768  return false;
769  }
770  // Create a new MeasurementBase object from PrepRawData
771  measurement.reset(
772  m_rioOnTrackCreator->correct(*originalPrepRawData, *combinedState));
773  combinedState.reset();
774  }
775  if (!measurement) {
776  ATH_MSG_WARNING("stepForwardFit no measurement to update with");
777  return false;
778  }
779 
780  // Perform measurement update
782  // We need to keep the extrapolatedState so clone
783  updatedState = Trk::GsfMeasurementUpdator::update(
784  MultiComponentStateHelpers::clone(extrapolatedState),
785  *measurement,
786  fitQuality);
787 
788  if (updatedState.empty()) {
789  return false;
790  }
791 
792  // Hits with excessive chi2 are outliers.
793  // We ingore the update, reset back to the extrapolated
794  // state before the update
795  if (fitQuality.chiSquared() >
796  m_cutChiSquaredPerNumberDOF * fitQuality.numberDoF()) {
798  std::bitset<TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> type(0);
800  forwardTrajectory.emplace_back(
801  fitQuality,
802  std::move(measurement),
803  nullptr,
804  // used below for the updated state so clone
805  Trk::MultiComponentStateHelpers::clone(extrapolatedState),
806  type);
807  // reset the updated state to the extrapolated state
808  // before the measurement update
809  updatedState = std::move(extrapolatedState);
810  } else {
811  forwardTrajectory.emplace_back(fitQuality,
812  std::move(measurement),
813  nullptr,
814  std::move(extrapolatedState));
815  }
816  return true;
817 }
818 
819 /*
820  * Actual
821  * Implementation of the smoothing of the trajectory.
822  */
825  const EventContext& ctx,
826  Trk::IMultiStateExtrapolator::Cache& extrapolatorCache,
827  GSFTrajectory& forwardTrajectory,
828  const ParticleHypothesis particleHypothesis,
829  const Trk::CaloCluster_OnTrack* ccot) const
830 {
831  if (forwardTrajectory.empty()) {
833  "Attempting to smooth an empty forward trajectory... Exiting!");
834  return {};
835  }
836 
837  GSFTrajectory smoothedTrajectory;
838  smoothedTrajectory.reserve(forwardTrajectory.size());
839  // For the smoother we start from the end and we go
840  // to begin. We need to find the the first track
841  // state on surface in this reverse direction
842  GSFTrajectory::reverse_iterator trackStateOnSurfaceItr =
843  forwardTrajectory.rbegin();
844  bool foundMeasurement = false;
845  for (; trackStateOnSurfaceItr != forwardTrajectory.rend();
846  ++trackStateOnSurfaceItr) {
847  if (!(*trackStateOnSurfaceItr).typeFlags.test(TrackStateOnSurface::Measurement)) {
848  smoothedTrajectory.emplace_back(std::move(*trackStateOnSurfaceItr));
849  } else {
850  foundMeasurement = true;
851  break;
852  }
853  }
854 
855  if(!foundMeasurement){
856  return {};
857  }
858  // This is the 1st track state on surface for a measurement
859  // in the reverse direction. Our starting point for the smoother
860  MultiComponentState smootherPredictionMultiState =
861  std::move(trackStateOnSurfaceItr->multiComponentState);
862  // Perform the update with the measurement and create the
863  // the 1st updated/smoothed entry in the trajectory
864  std::unique_ptr<Trk::MeasurementBase> firstSmootherMeasurementOnTrack =
865  std::move(trackStateOnSurfaceItr->measurementOnTrack);
866  if (!firstSmootherMeasurementOnTrack) {
868  "Initial state on surface in smoother does not have an associated "
869  "MeasurementBase object");
870  return {};
871  }
873  Trk::MultiComponentState firstSmoothedState =
874  Trk::GsfMeasurementUpdator::update(std::move(smootherPredictionMultiState),
875  *firstSmootherMeasurementOnTrack,
876  fitQuality);
877  if (firstSmoothedState.empty()) {
878  return {};
879  }
880 
881  if (!MultiComponentStateHelpers::allHaveCovariance(firstSmoothedState)) {
883  "Not all components have covariance. Rejecting smoothed state.");
884  return {};
885  }
886  // The first in reverse (last in normal order) TSOS is special so we do a proper collapse
887  // of the multi component to single TrackParameter
888  std::unique_ptr<Trk::TrackParameters> combinedFirstSmoothedState =
889  MultiComponentStateCombiner::combineToSingle(firstSmoothedState, m_useMode);
890  smoothedTrajectory.emplace_back(
891  fitQuality, std::move(firstSmootherMeasurementOnTrack),
892  std::move(combinedFirstSmoothedState),
893  MultiComponentStateHelpers::clone(firstSmoothedState));
894  const auto& updatedFirstStateOnSurface = smoothedTrajectory.back();
895 
896  // continue the reverse looping of the TrackStateOnSurfaces
897  // in the forward trajectory
898  ++trackStateOnSurfaceItr;
899  // The is the last one we will see
900  auto lasttrackStateOnSurface = forwardTrajectory.rend() - 1;
901  // TSOS that the cluster measuremenet will added on.
902  auto secondLastTrackStateOnSurface = forwardTrajectory.rend() - 2;
903  // Generate a prediction by scaling the covariance of all components in the
904  // first smoothed state and perform a measurement update to it.
905  // This way there is no dependance on error of prediction
906  // NB local Y and theta are not blown out too much to help in the TRT.
907  Trk::MultiComponentState smoothedStateWithScaledError =
909  std::move(firstSmoothedState), 15., 5., 15., 5., 15.);
910  Trk::FitQualityOnSurface fitQualityWithScaledErrors;
912  std::move(smoothedStateWithScaledError),
913  *(updatedFirstStateOnSurface.measurementOnTrack),
914  fitQualityWithScaledErrors);
915  if (updatedState.empty()) {
916  ATH_MSG_WARNING("Smoother prediction could not be determined");
917  return {};
918  }
919 
920  // loopUpdatedState is a plain ptr to the most recent
921  // predicted MultiComponentState.
922  // We start from our previous inflated prediction
923  Trk::MultiComponentState* loopUpdatedState = &updatedState;
924 
925  for (; trackStateOnSurfaceItr != forwardTrajectory.rend();
926  ++trackStateOnSurfaceItr) {
927  auto& trackStateOnSurface = (*trackStateOnSurfaceItr);
928  // Retrieve the MeasurementBase object from the TrackStateOnSurface object
929  std::unique_ptr<Trk::MeasurementBase> measurement =
930  std::move(trackStateOnSurface.measurementOnTrack);
931  if (!measurement) {
932  ATH_MSG_WARNING("MeasurementBase object could not be extracted from a "
933  "measurement TSOS... continuing");
934  continue;
935  }
936  // Create prediction for the next measurement surface.
937  // For the smoother the direction of propagation
938  // is opposite to the direction of momentum
939  Trk::MultiComponentState extrapolatedState =
940  m_extrapolator->extrapolate(ctx,
941  extrapolatorCache,
942  (*loopUpdatedState),
943  measurement->associatedSurface(),
945  false,
946  particleHypothesis);
947 
948  if (extrapolatedState.empty()) {
949  return {};
950  }
951  // Handle the case where Original measurement was flagged as an outlier
952  if (!trackStateOnSurface.typeFlags.test(TrackStateOnSurface::Measurement)) {
953  std::bitset<TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> type(
954  0);
956  smoothedTrajectory.emplace_back(
957  FitQualityOnSurface(1, 1),
958  std::move(measurement),
959  nullptr,
960  std::move(extrapolatedState),
961  type);
962  loopUpdatedState = &(smoothedTrajectory.back().multiComponentState);
963  continue;
964  }
965  // Update with the measurement
966  updatedState = Trk::GsfMeasurementUpdator::update(
967  std::move(extrapolatedState), *measurement, fitQuality);
968  if (updatedState.empty()) {
970  "Could not update the multi-component state... rejecting track!");
971  return {};
972  }
973  // last in reverse (first in normal order) is special as we collapse to single track Parameters
974  bool islast = (trackStateOnSurfaceItr == lasttrackStateOnSurface);
975  if (m_combineWithFitter) {
976  // Optional combine smoother state with fitter state
977  // e.g combine the current tsos (from the forward) with
978  // the updated from the smoother
979  const Trk::MultiComponentState& forwardsMultiState =
980  trackStateOnSurface.multiComponentState;
981  Trk::MultiComponentState combinedfitterState =
983  forwardsMultiState, updatedState, m_maximumNumberOfComponents);
984  //
985  if (combinedfitterState.empty()) {
986  ATH_MSG_WARNING("Could not combine state from forward fit with "
987  "smoother state");
988  return {};
989  }
990  auto combinedFitQuality = Trk::GsfMeasurementUpdator::fitQuality(
991  combinedfitterState, *measurement);
992  smoothedTrajectory.emplace_back(
993  smootherHelper(std::move(combinedfitterState), std::move(measurement),
994  combinedFitQuality, islast, m_useMode));
995  } else {
996  // If combination with forwards state is not done
997  smoothedTrajectory.emplace_back(
998  smootherHelper(std::move(updatedState), std::move(measurement),
999  fitQuality, islast, m_useMode));
1000  }
1001  //
1002  // For the next iteration start from last added
1003  loopUpdatedState = &(smoothedTrajectory.back().multiComponentState);
1004  // Handle adding measurement from calo if it is present
1005  if (ccot && trackStateOnSurfaceItr == secondLastTrackStateOnSurface) {
1006  Trk::MultiComponentState ccotState =
1007  addCCOT(ctx, ccot, smoothedTrajectory);
1008  if (!ccotState.empty()) {
1009  (*loopUpdatedState) = std::move(ccotState);
1010  }
1011  }
1012  } // End for loop over all components
1013 
1014  return smoothedTrajectory;
1015 }
1016 
1017 /*
1018  * Account for additional measurement from
1019  * the calorimeter
1020  */
1023  const EventContext& ctx,
1024  const Trk::CaloCluster_OnTrack* ccot,
1025  GSFTrajectory& smoothedTrajectory) const
1026 {
1027  const GSFTsos& currentMultiStateOS = smoothedTrajectory.back();
1028  if (!ccot) {
1029  return {};
1030  }
1031  const auto& currentMultiComponentState = currentMultiStateOS.multiComponentState;
1032  const Trk::MeasurementBase* measurement = currentMultiStateOS.measurementOnTrack.get();
1033  const Trk::Surface* currentSurface(nullptr);
1034  if (measurement) {
1035  currentSurface = &(measurement->associatedSurface());
1036  }
1037  Trk::MultiComponentState extrapolatedState{};
1038  // Extrapolate to the Calo to get prediction
1039  if (currentSurface) {
1040  extrapolatedState =
1041  m_extrapolator->extrapolateDirectly(ctx,
1042  currentMultiComponentState,
1043  ccot->associatedSurface(),
1045  false,
1047  }
1048  if (extrapolatedState.empty()) {
1049  return {};
1050  }
1051  // Update newly extrapolated state with measurement
1054  std::move(extrapolatedState), *ccot, fitQuality);
1055  if (updatedState.empty()) {
1056  return {};
1057  }
1058 
1059  // Extrapolate back to the surface nearest the origin
1060  extrapolatedState = m_extrapolator->extrapolateDirectly(ctx,
1061  updatedState,
1062  *currentSurface,
1064  false,
1066  if (extrapolatedState.empty()) {
1067  return {};
1068  }
1069 
1070  // Build TSOS with CCOT at the surface of calo
1071  // updated state not used after this point
1072  smoothedTrajectory.emplace_back(
1073  fitQuality,
1074  std::unique_ptr<Trk::CaloCluster_OnTrack>(ccot->clone()),
1075  nullptr,
1076  std::move(updatedState));
1077 
1078  // Now build a dummy measurement .... we dont want to a double count the
1079  // measurement but we need to extrapolate back to origin to allow for the
1080  // perigee parameters to be estimated.
1081  // Note this only important if the track is
1082  // refit otherwise it has no influence.
1084  covMatrix.setZero();
1085  covMatrix(0, 0) = 1e6;
1086 
1088  Trk::LocalParameters locpars(locX);
1089 
1090  auto pseudoMeasurement = std::make_unique<Trk::PseudoMeasurementOnTrack>(
1091  std::move(locpars), std::move(covMatrix), *currentSurface);
1092 
1093  // Combine the state and find the mode of the distribution
1094  std::unique_ptr<Trk::TrackParameters> combinedState =
1095  MultiComponentStateCombiner::combineToSingle(extrapolatedState, m_useMode);
1096  auto combinedFitQuality =
1097  Trk::GsfMeasurementUpdator::fitQuality(extrapolatedState, *ccot);
1098 
1099  // Build a TSOS using the dummy measurement and combined state
1100  smoothedTrajectory.emplace_back(
1101  combinedFitQuality,
1102  std::move(pseudoMeasurement),
1103  std::move(combinedState),
1104  MultiComponentStateHelpers::clone(extrapolatedState));
1105 
1106  return extrapolatedState;
1107 }
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: TrkFitter/TrkGaussianSumFilter/src/GaussianSumFitter.cxx:824
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:43
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: TrkFitter/TrkGaussianSumFilter/src/GaussianSumFitter.cxx:104
GaussianSumFitter.h
Class for fitting according to the Gaussian Sum Filter formalism.
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: TrkFitter/TrkGaussianSumFilter/src/GaussianSumFitter.cxx:530
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: TrkFitter/TrkGaussianSumFilter/src/GaussianSumFitter.cxx:607
Trk::loc2
@ loc2
generic first and second local coordinate
Definition: ParamDefs.h:41
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
python.SystemOfUnits.ms
int ms
Definition: SystemOfUnits.py:132
PrepRawData.h
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: TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/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: TrkFitter/TrkGaussianSumFilter/src/GaussianSumFitter.cxx:722
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::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::CaloCluster_OnTrack::associatedSurface
virtual const Surface & associatedSurface() const override final
returns the surface for the local to global transformation
Definition: CaloCluster_OnTrack.h:98
Trk::theta
@ theta
Definition: ParamDefs.h:72
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
Trk::CaloCluster_OnTrack::clone
virtual CaloCluster_OnTrack * clone() const override final
Pseudo-constructor, needed to avoid excessive RTTI.
Definition: CaloCluster_OnTrack.cxx:62
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: TrkFitter/TrkGaussianSumFilter/src/GaussianSumFitter.cxx:91
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: TrkFitter/TrkGaussianSumFilter/src/GaussianSumFitter.cxx:669
Trk::CaloCluster_OnTrack
Definition: CaloCluster_OnTrack.h:32
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
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::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: TrkFitter/TrkGaussianSumFilter/src/GaussianSumFitter.cxx:141
IDTPM::chiSquared
float chiSquared(const U &p)
Definition: TrackParametersHelper.h:136
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
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
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: TrkFitter/TrkGaussianSumFilter/src/GaussianSumFitter.cxx:546
Trk::qOverP
@ qOverP
perigee
Definition: ParamDefs.h:73
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
Trk::MeasurementBaseType::PseudoMeasurementOnTrack
@ PseudoMeasurementOnTrack
Definition: MeasurementBase.h:51
Track
Definition: TriggerChamberClusterOnTrackCreator.h:21
GsfConstants.h
Trk::phi
@ phi
Definition: ParamDefs.h:81
Trk::PrepRawDataComparisonFunction
Class providing comparison function, or relational definition, for PrepRawData.
Definition: PrepRawDataComparisonFunction.h:33
Trk::GaussianSumFitter::addCCOT
MultiComponentState addCCOT(const EventContext &ctx, const Trk::CaloCluster_OnTrack *ccot, GSFTrajectory &smoothedTrajectory) const
Methof to add the CaloCluster onto the track.
Definition: TrkFitter/TrkGaussianSumFilter/src/GaussianSumFitter.cxx:1022
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:40
Trk::Surface
Definition: Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h:75
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