ATLAS Offline Software
KalmanFitter.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "KalmanFitter.h"
6 
7 // ATHENA
8 #include "Acts/EventData/Types.hpp"
9 #include "GaudiKernel/TypeNameString.h"
14 #include "GaudiKernel/EventContext.h"
17 #include "TrkTrack/Track.h"
18 
19 // ACTS
20 #include "Acts/EventData/Types.hpp"
21 #include "Acts/Definitions/TrackParametrization.hpp"
22 #include "Acts/Definitions/Units.hpp"
23 #include "Acts/Propagator/SympyStepper.hpp"
24 #include "Acts/Propagator/Navigator.hpp"
25 #include "Acts/Propagator/Propagator.hpp"
26 #include "Acts/Surfaces/PerigeeSurface.hpp"
27 #include "Acts/Surfaces/Surface.hpp"
28 #include "Acts/TrackFitting/KalmanFitter.hpp"
29 #include "Acts/Utilities/Helpers.hpp"
30 #include "Acts/Utilities/Logger.hpp"
31 #include "Acts/Utilities/CalibrationContext.hpp"
32 #include "Acts/EventData/VectorTrackContainer.hpp"
33 
38 
40 
41 // PACKAGE
46 #include "ActsInterop/Logger.h"
47 
48 #include "Acts/Propagator/DirectNavigator.hpp"
50 
51 // STL
52 #include <vector>
53 
54 namespace ActsTrk {
55 
56 /*
57 The following is the implementation of the PRDSourceLinkCalibrator.
58 To use this implementation, the flag for a refitting from PRD measurment has to be turned on in the appropriate Acts config.
59 */
60 template <typename trajectory_t>
61 void PRDSourceLinkCalibrator::calibrate(const Acts::GeometryContext& gctx,
62  const Acts::CalibrationContext& /*cctx*/,
63  const Acts::SourceLink& sl,
64  typename trajectory_t::TrackStateProxy trackState) const {
65 
66  const Trk::PrepRawData* prd = sl.template get<PRDSourceLink>().prd;
67  trackState.setUncalibratedSourceLink(Acts::SourceLink{sl});
68 
69  const Acts::BoundTrackParameters actsParam(trackState.referenceSurface().getSharedPtr(),
70  trackState.predicted(),
71  trackState.predictedCovariance(),
73  std::unique_ptr<const Trk::TrackParameters> trkParam = converterTool->actsTrackParametersToTrkParameters(actsParam, gctx);
74 
75  //RIO_OnTrack creation from the PrepRawData
76  const Trk::Surface & prdsurf = prd->detectorElement()->surface(prd->identify());
77  const Trk::RIO_OnTrack *rot = nullptr;
78  const Trk::PlaneSurface *plsurf = nullptr;
79  if (prdsurf.type() == Trk::SurfaceType::Plane)
80  plsurf = static_cast < const Trk::PlaneSurface *>(&prdsurf);
81 
82  const Trk::StraightLineSurface *slsurf = nullptr;
83 
84  if (prdsurf.type() == Trk::SurfaceType::Line)
85  slsurf = static_cast < const Trk::StraightLineSurface *>(&prdsurf);
86 
87  //@TODO, there is no way to put a MSG in this framework yet. So the next 3 lines are commented
88  //if ((slsurf == nullptr) && (plsurf == nullptr)) {
89  //msg(MSG::ERROR) << "Surface is neither PlaneSurface nor StraightLineSurface!" << endmsg; //ATH_MSG_ERROR doesn't work here because (ActsTrk::PRDSourceLinkCalibrator' has no member named 'msg')
90  // }
91  if (slsurf != nullptr) {
93  slsurf->center(),
94  trackState.predicted()[Trk::phi],
95  trackState.predicted()[Trk::theta],
96  trackState.predicted()[Trk::qOverP],
97  *slsurf
98  );
99  if(broadRotCreator){
100  rot = broadRotCreator->correct(*prd, atasl,Gaudi::Hive::currentContext());
101  }
102  else{
103  rot = rotCreator->correct(*prd, atasl,Gaudi::Hive::currentContext());
104  }
105  } else if (plsurf != nullptr) {
106  if ((trkParam.get())->covariance() != nullptr) {
107  Trk::AtaPlane atapl(
108  plsurf->center(),
109  trackState.predicted()[Trk::phi],
110  trackState.predicted()[Trk::theta],
111  trackState.predicted()[Trk::qOverP],
112  *plsurf,
113  AmgSymMatrix(5)(*trkParam.get()->covariance())
114  );
115  rot = rotCreator->correct(*prd, atapl,Gaudi::Hive::currentContext());
116  } else {
117  Trk::AtaPlane atapl(
118  plsurf->center(),
119  trackState.predicted()[Trk::phi],
120  trackState.predicted()[Trk::theta],
121  trackState.predicted()[Trk::qOverP],
122  *plsurf
123  );
124  rot = rotCreator->correct(*prd, atapl,Gaudi::Hive::currentContext());
125  }
126  } // End of RIO_OnTrack creation from the PrepRawData
127 
128  int dim = (*rot).localParameters().dimension();
129  trackState.allocateCalibrated(dim);
130 
131  //Writting the calibrated ROT measurment into the trackState
132  if (dim == 0)
133  {
134  throw std::runtime_error("Cannot create dim 0 measurement");
135  } else if (dim == 1) {
136  trackState.template calibrated<1>() = (*rot).localParameters().template head<1>();
137  trackState.template calibratedCovariance<1>() = (*rot).localCovariance().template topLeftCorner<1, 1>();
138  Acts::BoundSubspaceIndices subspaceIndices;
139  if ((*rot).associatedSurface().bounds().type() == Trk::SurfaceBounds::Annulus) {
140  subspaceIndices = {Acts::eBoundLoc1}; // y coordinate is l0
141  } else {
142  subspaceIndices = {Acts::eBoundLoc0}; // x coordinate is l0
143  }
144  trackState.setBoundSubspaceIndices(subspaceIndices);
145  }
146  else if (dim == 2)
147  {
148  trackState.template calibrated<2>() = (*rot).localParameters().template head<2>();
149  trackState.template calibratedCovariance<2>() = (*rot).localCovariance().template topLeftCorner<2, 2>();
150  Acts::BoundSubspaceIndices subspaceIndices = {Acts::eBoundLoc0, Acts::eBoundLoc1};
151  trackState.setBoundSubspaceIndices(subspaceIndices);
152  }
153  else
154  {
155  throw std::runtime_error("Dim " + std::to_string(dim) +
156  " currently not supported.");
157  }
158  delete rot; //Delete rot as a precaution
159 
160 }
161 
162 const Acts::Surface* PRDSourceLinkSurfaceAccessor::operator()(const Acts::SourceLink& sourceLink) const {
163  const auto& sl = sourceLink.get<PRDSourceLink>();
164  const auto& trkSrf = sl.prd->detectorElement()->surface(sl.prd->identify());
165  const auto& actsSrf = converterTool->trkSurfaceToActsSurface(trkSrf);
166  return &actsSrf;
167 }
168 
169 KalmanFitter::KalmanFitter(const std::string& t,const std::string& n,
170  const IInterface* p) :
171  base_class(t,n,p)
172 {}
173 
175 
176  ATH_MSG_DEBUG(name() << "::" << __FUNCTION__);
177  ATH_CHECK(m_trackingGeometryTool.retrieve());
178  ATH_CHECK(m_extrapolationTool.retrieve());
179  ATH_CHECK(m_ATLASConverterTool.retrieve());
180  ATH_CHECK(m_trkSummaryTool.retrieve());
181  if(m_doReFitFromPRD){
182  ATH_CHECK(m_ROTcreator.retrieve());
183  ATH_CHECK(m_broadROTcreator.retrieve());
184  }
185 
186  m_logger = makeActsAthenaLogger(this, "KalmanRefit");
187 
188  auto field = std::make_shared<ATLASMagneticFieldWrapper>();
189 
190  // Fitter
191  Acts::SympyStepper stepper(field);
192  Acts::Navigator navigator( Acts::Navigator::Config{ m_trackingGeometryTool->trackingGeometry() },
193  logger().cloneWithSuffix("Navigator"));
194  Acts::Propagator<Acts::SympyStepper, Acts::Navigator> propagator(stepper,
195  std::move(navigator),
196  logger().cloneWithSuffix("Prop"));
197 
198  m_fitter = std::make_unique<Fitter>(std::move(propagator),
199  logger().cloneWithSuffix("KalmanFitter"));
200 
201  // Direct Fitter
202  Acts::DirectNavigator directNavigator( logger().cloneWithSuffix("DirectNavigator") );
203  Acts::Propagator<Acts::SympyStepper, Acts::DirectNavigator> directPropagator(std::move(stepper),
204  std::move(directNavigator),
205  logger().cloneWithSuffix("DirectPropagator"));
206 
207  m_directFitter = std::make_unique<DirectFitter>(std::move(directPropagator),
208  logger().cloneWithSuffix("DirectKalmanFitter"));
209 
211  m_calibrator = std::make_unique<TrkMeasurementCalibrator>(*m_ATLASConverterTool);
214 
215  m_kfExtensions.outlierFinder.connect<&ActsTrk::detail::FitterHelperFunctions::ATLASOutlierFinder::operator()<ActsTrk::MutableTrackStateBackend>>(&m_outlierFinder);
216  m_kfExtensions.reverseFilteringLogic.connect<&ActsTrk::detail::FitterHelperFunctions::ReverseFilteringLogic::operator()<ActsTrk::MutableTrackStateBackend>>(&m_reverseFilteringLogic);
217  m_kfExtensions.updater.connect<&ActsTrk::detail::FitterHelperFunctions::gainMatrixUpdate<ActsTrk::MutableTrackStateBackend>>();
218  m_kfExtensions.smoother.connect<&ActsTrk::detail::FitterHelperFunctions::mbfSmoother<ActsTrk::MutableTrackStateBackend>>();
219  m_kfExtensions.calibrator.connect<&TrkMeasurementCalibrator::calibrate<ActsTrk::MutableTrackStateBackend>>(m_calibrator.get());
220 
221  return StatusCode::SUCCESS;
222 }
223 
224 // refit a track
225 // -------------------------------------------------------
226 std::unique_ptr<Trk::Track>
227 KalmanFitter::fit(const EventContext& ctx,
228  const Trk::Track& inputTrack,
229  const Trk::RunOutlierRemoval /*runOutlier*/,
230  const Trk::ParticleHypothesis /*prtHypothesis*/) const
231 {
232  std::unique_ptr<Trk::Track> track = nullptr;
233  ATH_MSG_VERBOSE ("--> enter KalmanFitter::fit(Track,,) with Track from author = "
234  << inputTrack.info().dumpInfo());
235 
236  // protection against not having measurements on the input track
237  if (!inputTrack.measurementsOnTrack() || inputTrack.measurementsOnTrack()->size() < 2) {
238  ATH_MSG_DEBUG("called to refit empty track or track with too little information, reject fit");
239  return nullptr;
240  }
241 
242  // protection against not having track parameters on the input track
243  if (!inputTrack.trackParameters() || inputTrack.trackParameters()->empty()) {
244  ATH_MSG_DEBUG("input fails to provide track parameters for seeding the KF, reject fit");
245  return nullptr;
246  }
247 
248  // Construct a perigee surface as the target surface
249  auto pSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(
250  Acts::Vector3{0., 0., 0.});
251 
252  Acts::GeometryContext tgContext = m_trackingGeometryTool->getGeometryContext(ctx).context();
253  Acts::MagneticFieldContext mfContext = m_extrapolationTool->getMagneticFieldContext(ctx);
254  // CalibrationContext converter not implemented yet.
255  Acts::CalibrationContext calContext = Acts::CalibrationContext();
256 
257  Acts::KalmanFitterExtensions<ActsTrk::MutableTrackStateBackend> kfExtensions = m_kfExtensions;
258 
259  ATLASSourceLinkSurfaceAccessor surfaceAccessor{&(*m_ATLASConverterTool)};
260  kfExtensions.surfaceAccessor.connect<&ATLASSourceLinkSurfaceAccessor::operator()>(&surfaceAccessor);
261 
262  Acts::PropagatorPlainOptions propagationOption(tgContext, mfContext);
263  propagationOption.maxSteps = m_option_maxPropagationStep;
264  // Set the KalmanFitter options
265  Acts::KalmanFitterOptions
266  kfOptions(tgContext, mfContext, calContext,
267  kfExtensions,
268  propagationOption,
269  &(*pSurface));
270 
271  std::vector<Acts::SourceLink> trackSourceLinks = m_ATLASConverterTool->trkTrackToSourceLinks(tgContext,inputTrack);
272  // protection against error in the conversion from Atlas masurement to Acts source link
273  if (trackSourceLinks.empty()) {
274  ATH_MSG_DEBUG("input contain measurement but no source link created, probable issue with the converter, reject fit ");
275  return track;
276  }
277 
278  const auto& initialParams = m_ATLASConverterTool->trkTrackParametersToActsParameters((*inputTrack.perigeeParameters()), tgContext);
279 
280  // The covariance from already fitted track are too small and would result an incorect smoothing.
281  // We scale up the input covaraiance to avoid this.
282  Acts::BoundSquareMatrix scaledCov = Acts::BoundSquareMatrix::Identity();
283  for (int i=0; i<6; ++i) {
285  (scaledCov)(i,i) = scale * initialParams.covariance().value()(i,i);
286  }
287 
288  // @TODO: Synchronize with prtHypothesis
290 
291  const Acts::BoundTrackParameters scaledInitialParams(initialParams.referenceSurface().getSharedPtr(),
292  initialParams.parameters(),
293  scaledCov,
294  hypothesis);
295 
297 
298  // Perform the fit
299  auto result = m_fitter->fit(trackSourceLinks.begin(), trackSourceLinks.end(),
300  scaledInitialParams, kfOptions, tracks);
301  if (result.ok()) {
302  track = makeTrack(ctx, tgContext, tracks, result);
303  }
304  return track;
305 }
306 
307 // fit a set of MeasurementBase objects
308 // --------------------------------
309 std::unique_ptr<Trk::Track>
310 KalmanFitter::fit(const EventContext& ctx,
311  const Trk::MeasurementSet& inputMeasSet,
312  const Trk::TrackParameters& estimatedStartParameters,
313  const Trk::RunOutlierRemoval /*runOutlier*/,
314  const Trk::ParticleHypothesis /*matEffects*/) const
315 {
316  std::unique_ptr<Trk::Track> track = nullptr;
317 
318  // protection against not having measurements on the input track
319  if (inputMeasSet.size() < 2) {
320  ATH_MSG_DEBUG("called to refit empty measurement set or a measurement set with too little information, reject fit");
321  return nullptr;
322  }
323 
324  // Construct a perigee surface as the target surface
325  auto pSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(
326  Acts::Vector3{0., 0., 0.});
327 
328  Acts::GeometryContext tgContext = m_trackingGeometryTool->getGeometryContext(ctx).context();
329  Acts::MagneticFieldContext mfContext = m_extrapolationTool->getMagneticFieldContext(ctx);
330  // CalibrationContext converter not implemented yet.
331  Acts::CalibrationContext calContext = Acts::CalibrationContext();
332 
333  Acts::KalmanFitterExtensions<ActsTrk::MutableTrackStateBackend> kfExtensions = m_kfExtensions;
334 
335  ATLASSourceLinkSurfaceAccessor surfaceAccessor{&(*m_ATLASConverterTool)};
336  kfExtensions.surfaceAccessor.connect<&ATLASSourceLinkSurfaceAccessor::operator()>(&surfaceAccessor);
337 
338  Acts::PropagatorPlainOptions propagationOption(tgContext, mfContext);
339  propagationOption.maxSteps = m_option_maxPropagationStep;
340  // Set the KalmanFitter options
341  Acts::KalmanFitterOptions
342  kfOptions(tgContext, mfContext, calContext,
343  kfExtensions,
344  propagationOption,
345  &(*pSurface));
346 
347  std::vector<Acts::SourceLink> trackSourceLinks;
348  trackSourceLinks.reserve(inputMeasSet.size());
349 
350  for (auto it = inputMeasSet.begin(); it != inputMeasSet.end(); ++it){
351  trackSourceLinks.push_back(m_ATLASConverterTool->trkMeasurementToSourceLink(tgContext, **it));
352  }
353  // protection against error in the conversion from Atlas masurement to Acts source link
354  if (trackSourceLinks.empty()) {
355  ATH_MSG_DEBUG("input contain measurement but no source link created, probable issue with the converter, reject fit ");
356  return track;
357  }
358 
359  const auto& initialParams = m_ATLASConverterTool->trkTrackParametersToActsParameters(estimatedStartParameters, tgContext);
360 
362 
363  // Perform the fit
364  auto result = m_fitter->fit(trackSourceLinks.begin(), trackSourceLinks.end(),
365  initialParams, kfOptions, tracks);
366  if (result.ok()) {
367  track = makeTrack(ctx, tgContext, tracks, result);
368  }
369  return track;
370 }
371 
372 // fit a set of PrepRawData objects
373 // --------------------------------
374 std::unique_ptr<Trk::Track>
375 KalmanFitter::fit(const EventContext& ctx,
376  const Trk::PrepRawDataSet& inputPRDColl,
377  const Trk::TrackParameters& estimatedStartParameters,
378  const Trk::RunOutlierRemoval /*runOutlier*/,
379  const Trk::ParticleHypothesis /*prtHypothesis*/) const
380 {
381  ATH_MSG_DEBUG("--> entering KalmanFitter::fit(PRDS,TP,)");
382 
383 
384  std::unique_ptr<Trk::Track> track = nullptr;
385 
386  // Construct a perigee surface as the target surface
387  auto pSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(
388  Acts::Vector3{0., 0., 0.});
389 
390  Acts::GeometryContext tgContext = m_trackingGeometryTool->getGeometryContext(ctx).context();
391  Acts::MagneticFieldContext mfContext = m_extrapolationTool->getMagneticFieldContext(ctx);
392  // CalibrationContext converter not implemented yet.
393  Acts::CalibrationContext calContext = Acts::CalibrationContext();
394 
395  Acts::KalmanFitterExtensions<ActsTrk::MutableTrackStateBackend> kfExtensions = m_kfExtensions;
396 
397  PRDSourceLinkCalibrator calibrator{}; // @TODO: Set tool pointers
398  calibrator.rotCreator =m_ROTcreator.get();
399  calibrator.broadRotCreator = m_broadROTcreator.get();
400  calibrator.converterTool = m_ATLASConverterTool.get();
401  kfExtensions.calibrator.connect<&PRDSourceLinkCalibrator::calibrate<ActsTrk::MutableTrackStateBackend>>(&calibrator);
402 
403  PRDSourceLinkSurfaceAccessor surfaceAccessor{m_ATLASConverterTool.get()};
404  kfExtensions.surfaceAccessor.connect<&PRDSourceLinkSurfaceAccessor::operator()>(&surfaceAccessor);
405 
406  Acts::PropagatorPlainOptions propagationOption(tgContext, mfContext);
407  propagationOption.maxSteps = m_option_maxPropagationStep;
408  // Set the KalmanFitter options
409  Acts::KalmanFitterOptions
410  kfOptions(tgContext, mfContext, calContext,
411  kfExtensions,
412  propagationOption,
413  &(*pSurface));
414 
415 
416  std::vector<Acts::SourceLink> trackSourceLinks;
417  trackSourceLinks.reserve(inputPRDColl.size());
418 
419  for(const Trk::PrepRawData* prd : inputPRDColl) {
420  trackSourceLinks.push_back(Acts::SourceLink{PRDSourceLink{prd}});
421  }
422  // protection against error in the conversion from Atlas masurement to Acts source link
423  if (trackSourceLinks.empty()) {
424  ATH_MSG_WARNING("input contain measurement but no source link created, probable issue with the converter, reject fit ");
425  return track;
426  }
427  //
428 
429  const auto& initialParams = m_ATLASConverterTool->trkTrackParametersToActsParameters(estimatedStartParameters, tgContext);
430 
431 
433  // Perform the fit
434  auto result = m_fitter->fit(trackSourceLinks.begin(), trackSourceLinks.end(),
435  initialParams, kfOptions, tracks);
436  if (result.ok()) {
437  track = makeTrack(ctx, tgContext, tracks, result, true);
438  }
439  return track;
440 }
441 
442 // fit a set of PrepRawData objects
443 // --------------------------------
444 std::unique_ptr< ActsTrk::MutableTrackContainer >
445 KalmanFitter::fit(const EventContext&,
446  const std::vector< ActsTrk::ATLASUncalibSourceLink> & clusterList,
447  const Acts::BoundTrackParameters& initialParams,
448  const Acts::GeometryContext& tgContext,
449  const Acts::MagneticFieldContext& mfContext,
450  const Acts::CalibrationContext& calContext,
451  const DetectorElementToActsGeometryIdMap &detectorElementToGeometryIdMap,
452  const Acts::Surface* targetSurface) const{
453  ATH_MSG_DEBUG("--> entering KalmanFitter::fit(xAODMeasure...things,TP,)");
454 
455  std::vector<Acts::SourceLink> sourceLinks;
456  sourceLinks.reserve(clusterList.size());
457 
458  std::vector<const Acts::Surface*> surfaces;
459  surfaces.reserve(clusterList.size());
460 
461  const Acts::TrackingGeometry *
462  actsTrackingGeometry = m_trackingGeometryTool->trackingGeometry().get();
463  if (!actsTrackingGeometry) {
464  throw std::runtime_error("No Acts tracking geometry.");
465  }
466 
467  for (const ActsTrk::ATLASUncalibSourceLink& el : clusterList) {
468  sourceLinks.emplace_back( el );
469  surfaces.push_back(ActsTrk::getSurfaceOfMeasurement(*actsTrackingGeometry, detectorElementToGeometryIdMap, getUncalibratedMeasurement(el) ));
470  }
471 
472  Acts::KalmanFitterExtensions<ActsTrk::MutableTrackStateBackend> kfExtensions = m_kfExtensions;
473 
474  ActsTrk::ATLASUncalibSourceLinkSurfaceAccessor surfaceAccessor( *actsTrackingGeometry, detectorElementToGeometryIdMap);
475  kfExtensions.surfaceAccessor.connect<&ActsTrk::ATLASUncalibSourceLinkSurfaceAccessor::operator()>(&surfaceAccessor);
476 
478  ::NoCalibration(*actsTrackingGeometry, detectorElementToGeometryIdMap);
479 
480  kfExtensions.calibrator.connect<&detail::OnTrackCalibrator<ActsTrk::MutableTrackStateBackend>::calibrate>(&calibrator);
481 
482  Acts::PropagatorPlainOptions propagationOption(tgContext, mfContext);
483  propagationOption.maxSteps = m_option_maxPropagationStep;
484 
485  // Construct a perigee surface as the target surface if none is provided
486  std::shared_ptr<Acts::Surface> pSurface{nullptr};
487  if (!targetSurface){
488  pSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(Acts::Vector3{0., 0., 0.});
489  targetSurface = pSurface.get();
490  }
491 
492  // Set the KalmanFitter options
493  Acts::KalmanFitterOptions<ActsTrk::MutableTrackStateBackend>
494  kfOptions(tgContext, mfContext, calContext,
495  kfExtensions,
496  propagationOption,
497  targetSurface);
498 
499  std::unique_ptr< ActsTrk::MutableTrackContainer > tracks = std::make_unique< ActsTrk::MutableTrackContainer >();
500 
501 
502  auto result = m_directFitter->fit(sourceLinks.begin(),
503  sourceLinks.end(),
504  initialParams,
505  kfOptions,
506  surfaces,
507  *tracks.get());
508 
509  if (not result.ok()) {
510  ATH_MSG_VERBOSE("Kalman Fitter on Seed has failed");
511  return nullptr;
512  }
513  return tracks;
514 }
515 
516 // extend a track fit to include an additional set of MeasurementBase objects
517 // re-implements the TrkFitterUtils/TrackFitter.cxx general code in a more
518 // mem efficient and stable way
519 // --------------------------------
520 std::unique_ptr<Trk::Track>
521 KalmanFitter::fit(const EventContext& ctx,
522  const Trk::Track& inputTrack,
523  const Trk::MeasurementSet& addMeasColl,
524  const Trk::RunOutlierRemoval /*runOutlier*/,
525  const Trk::ParticleHypothesis /*matEffects*/) const
526 {
527  ATH_MSG_VERBOSE ("--> enter KalmanFitter::fit(Track,Meas'BaseSet,,)");
528  ATH_MSG_VERBOSE (" with Track from author = " << inputTrack.info().dumpInfo());
529 
530  // protection, if empty MeasurementSet
531  if (addMeasColl.empty()) {
532  ATH_MSG_DEBUG( "client tries to add an empty MeasurementSet to the track fit." );
533  return fit(ctx,inputTrack);
534  }
535 
536  // protection against not having measurements on the input track
537  if (!inputTrack.measurementsOnTrack() || (inputTrack.measurementsOnTrack()->size() < 2 && addMeasColl.empty())) {
538  ATH_MSG_DEBUG("called to refit empty track or track with too little information, reject fit");
539  return nullptr;
540  }
541 
542  // protection against not having track parameters on the input track
543  if (!inputTrack.trackParameters() || inputTrack.trackParameters()->empty()) {
544  ATH_MSG_DEBUG("input fails to provide track parameters for seeding the KF, reject fit");
545  return nullptr;
546  }
547 
548  std::unique_ptr<Trk::Track> track = nullptr;
549 
550  // Construct a perigee surface as the target surface
551  auto pSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(
552  Acts::Vector3{0., 0., 0.});
553 
554  Acts::GeometryContext tgContext = m_trackingGeometryTool->getGeometryContext(ctx).context();
555  Acts::MagneticFieldContext mfContext = m_extrapolationTool->getMagneticFieldContext(ctx);
556  // CalibrationContext converter not implemented yet.
557  Acts::CalibrationContext calContext = Acts::CalibrationContext();
558 
559  Acts::KalmanFitterExtensions<ActsTrk::MutableTrackStateBackend> kfExtensions = m_kfExtensions;
560 
561  Acts::PropagatorPlainOptions propagationOption(tgContext, mfContext);
562  propagationOption.maxSteps = m_option_maxPropagationStep;
563  // Set the KalmanFitter options
564  Acts::KalmanFitterOptions
565  kfOptions(tgContext, mfContext, calContext,
566  kfExtensions,
567  propagationOption,
568  &(*pSurface));
569 
570  std::vector<Acts::SourceLink> trackSourceLinks = m_ATLASConverterTool->trkTrackToSourceLinks(tgContext, inputTrack);
571  const auto& initialParams = m_ATLASConverterTool->trkTrackParametersToActsParameters(*(inputTrack.perigeeParameters()), tgContext);
572 
573  for (auto it = addMeasColl.begin(); it != addMeasColl.end(); ++it)
574  {
575  trackSourceLinks.push_back(m_ATLASConverterTool->trkMeasurementToSourceLink(tgContext, **it));
576  }
577  // protection against error in the conversion from Atlas masurement to Acts source link
578  if (trackSourceLinks.empty()) {
579  ATH_MSG_DEBUG("input contain measurement but no source link created, probable issue with the converter, reject fit ");
580  return track;
581  }
582 
584  // Perform the fit
585  auto result = m_fitter->fit(trackSourceLinks.begin(), trackSourceLinks.end(),
586  initialParams, kfOptions, tracks);
587  if (result.ok()) {
588  track = makeTrack(ctx, tgContext, tracks, result);
589  }
590  return track;
591 }
592 
593 // extend a track fit to include an additional set of PrepRawData objects
594 // --------------------------------
595 std::unique_ptr<Trk::Track>
596 KalmanFitter::fit(const EventContext& /*ctx*/,
597  const Trk::Track& /*inputTrack*/,
598  const Trk::PrepRawDataSet& /*addPrdColl*/,
599  const Trk::RunOutlierRemoval /*runOutlier*/,
600  const Trk::ParticleHypothesis /*matEffects*/) const
601 {
602  ATH_MSG_DEBUG("Fit of Track with additional PrepRawDataSet not yet implemented");
603  return nullptr;
604 }
605 
606 // combined fit of two tracks
607 // --------------------------------
608 std::unique_ptr<Trk::Track>
609 KalmanFitter::fit(const EventContext& ctx,
610  const Trk::Track& intrk1,
611  const Trk::Track& intrk2,
612  const Trk::RunOutlierRemoval /*runOutlier*/,
613  const Trk::ParticleHypothesis /*matEffects*/) const
614 {
615  ATH_MSG_VERBOSE ("--> enter KalmanFitter::fit(Track,Track,)");
616  ATH_MSG_VERBOSE (" with Tracks from #1 = " << intrk1.info().dumpInfo()
617  << " and #2 = " << intrk2.info().dumpInfo());
618 
619  // protection, if empty track2
620  if (!intrk2.measurementsOnTrack()) {
621  ATH_MSG_DEBUG( "input #2 is empty try to fit track 1 alone" );
622  return fit(ctx,intrk1);
623  }
624 
625  // protection, if empty track1
626  if (!intrk1.measurementsOnTrack()) {
627  ATH_MSG_DEBUG( "input #1 is empty try to fit track 2 alone" );
628  return fit(ctx,intrk2);
629  }
630 
631  // protection against not having track parameters on the input track
632  if (!intrk1.trackParameters() || intrk1.trackParameters()->empty()) {
633  ATH_MSG_DEBUG("input #1 fails to provide track parameters for seeding the KF, reject fit");
634  return nullptr;
635  }
636 
637  std::unique_ptr<Trk::Track> track = nullptr;
638 
639  // Construct a perigee surface as the target surface
640  auto pSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(
641  Acts::Vector3{0., 0., 0.});
642 
643  Acts::GeometryContext tgContext = m_trackingGeometryTool->getGeometryContext(ctx).context();
644  Acts::MagneticFieldContext mfContext = m_extrapolationTool->getMagneticFieldContext(ctx);
645  // CalibrationContext converter not implemented yet.
646  Acts::CalibrationContext calContext = Acts::CalibrationContext();
647 
648  Acts::KalmanFitterExtensions<ActsTrk::MutableTrackStateBackend> kfExtensions = m_kfExtensions;
649 
650  Acts::PropagatorPlainOptions propagationOption(tgContext, mfContext);
651  propagationOption.maxSteps = m_option_maxPropagationStep;
652  // Set the KalmanFitter options
653  Acts::KalmanFitterOptions
654  kfOptions(tgContext, mfContext, calContext,
655  kfExtensions,
656  propagationOption,
657  &(*pSurface));
658 
659  std::vector<Acts::SourceLink> trackSourceLinks = m_ATLASConverterTool->trkTrackToSourceLinks(tgContext, intrk1);
660  std::vector<Acts::SourceLink> trackSourceLinks2 = m_ATLASConverterTool->trkTrackToSourceLinks(tgContext, intrk2);
661  trackSourceLinks.insert(trackSourceLinks.end(), trackSourceLinks2.begin(), trackSourceLinks2.end());
662  // protection against error in the conversion from Atlas masurement to Acts source link
663  if (trackSourceLinks.empty()) {
664  ATH_MSG_DEBUG("input contain measurement but no source link created, probable issue with the converter, reject fit ");
665  return track;
666  }
667 
668  const auto &initialParams = m_ATLASConverterTool->trkTrackParametersToActsParameters(*(intrk1.perigeeParameters()), tgContext);
669 
670  // The covariance from already fitted track are too small and would result an incorect smoothing.
671  // We scale up the input covaraiance to avoid this.
672  Acts::BoundSquareMatrix scaledCov = Acts::BoundSquareMatrix::Identity();
673  for (int i=0; i<6; ++i) {
675  (scaledCov)(i,i) = scale * initialParams.covariance().value()(i,i);
676  }
677 
678  const Acts::BoundTrackParameters scaledInitialParams(initialParams.referenceSurface().getSharedPtr(),
679  initialParams.parameters(),
680  scaledCov,
682 
683 
685  // Perform the fit
686  auto result = m_fitter->fit(trackSourceLinks.begin(), trackSourceLinks.end(),
687  scaledInitialParams, kfOptions, tracks);
688  if (result.ok()) {
689  track = makeTrack(ctx, tgContext, tracks, result);
690  }
691  return track;
692 }
693 
694 std::unique_ptr<Trk::Track>
695 KalmanFitter::makeTrack(const EventContext& ctx,
696  Acts::GeometryContext& tgContext,
698  Acts::Result<ActsTrk::MutableTrackContainer::TrackProxy, std::error_code>& fitResult, bool SourceLinkType) const {
699 
700  if (not fitResult.ok())
701  return nullptr;
702 
703  std::unique_ptr<Trk::Track> newtrack = nullptr;
704  // Get the fit output object
705  const auto& acts_track = fitResult.value();
706  auto finalTrajectory = std::make_unique<Trk::TrackStates>();
707  // initialise the number of dead Pixel and Acts strip
708  int numberOfDeadPixel = 0;
709  int numberOfDeadSCT = 0;
710 
711  std::vector<std::unique_ptr<const Acts::BoundTrackParameters>> actsSmoothedParam;
712  // Loop over all the output state to create track state
713  tracks.trackStateContainer().visitBackwards(acts_track.tipIndex(),
714  [&] (const auto &state) -> void
715  {
716  // First only concider state with an associated detector element not in the TRT
717  auto flag = state.typeFlags();
718  const auto* associatedDetEl = state.referenceSurface().associatedDetectorElement();
719  if (not associatedDetEl)
720  return;
721 
722  const auto* actsElement = dynamic_cast<const ActsDetectorElement*>(associatedDetEl);
723  if (not actsElement)
724  return;
725 
726  const auto* upstreamDetEl = actsElement->upstreamDetectorElement();
727  if (not upstreamDetEl)
728  return;
729 
730  ATH_MSG_VERBOSE("Try casting to TRT for if");
731  if (dynamic_cast<const InDetDD::TRT_BaseElement*>(upstreamDetEl))
732  return;
733 
734  const auto* trkDetElem = dynamic_cast<const Trk::TrkDetElementBase*>(upstreamDetEl);
735  if (not trkDetElem)
736  return;
737 
738  ATH_MSG_VERBOSE("trkDetElem type: " << static_cast<std::underlying_type_t<Trk::DetectorElemType>>(trkDetElem->detectorType()));
739 
740  ATH_MSG_VERBOSE("Try casting to SiDetectorElement");
741  const auto* detElem = dynamic_cast<const InDetDD::SiDetectorElement*>(upstreamDetEl);
742  if (not detElem)
743  return;
744  ATH_MSG_VERBOSE("detElem = " << detElem);
745 
746  // We need to determine the type of state
747  std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern;
748  std::unique_ptr<Trk::TrackParameters> parm;
749 
750  // State is a hole (no associated measurement), use predicted parameters
751  if (flag.test(Acts::TrackStateFlag::HoleFlag)){
752  ATH_MSG_VERBOSE("State is a hole (no associated measurement), use predicted parameters");
753  const Acts::BoundTrackParameters actsParam(state.referenceSurface().getSharedPtr(),
754  state.predicted(),
755  state.predictedCovariance(),
756  acts_track.particleHypothesis());
757  parm = m_ATLASConverterTool->actsTrackParametersToTrkParameters(actsParam, tgContext);
758  auto boundaryCheck = m_boundaryCheckTool->boundaryCheck(*parm);
759 
760  // Check if this is a hole, a dead sensors or a state outside the sensor boundary
761  ATH_MSG_VERBOSE("Check if this is a hole, a dead sensors or a state outside the sensor boundary");
762  if(boundaryCheck == Trk::BoundaryCheckResult::DeadElement){
763  if (detElem->isPixel()) {
764  ++numberOfDeadPixel;
765  }
766  else if (detElem->isSCT()) {
767  ++numberOfDeadSCT;
768  }
769  // Dead sensors states are not stored
770  return;
771  } else if (boundaryCheck != Trk::BoundaryCheckResult::Candidate){
772  // States outside the sensor boundary are ignored
773  return;
774  }
775  typePattern.set(Trk::TrackStateOnSurface::Hole);
776  }
777  // The state was tagged as an outlier or was missed in the reverse filtering, use filtered parameters
778  else if (flag.test(Acts::TrackStateFlag::OutlierFlag) or !state.hasSmoothed()) {
779  ATH_MSG_VERBOSE("The state was tagged as an outlier or was missed in the reverse filtering, use filtered parameters");
780  const Acts::BoundTrackParameters actsParam(state.referenceSurface().getSharedPtr(),
781  state.filtered(),
782  state.filteredCovariance(),
783  acts_track.particleHypothesis());
784  parm = m_ATLASConverterTool->actsTrackParametersToTrkParameters(actsParam, tgContext);
785  typePattern.set(Trk::TrackStateOnSurface::Outlier);
786  }
787  // The state is a measurement state, use smoothed parameters
788  else{
789  ATH_MSG_VERBOSE("The state is a measurement state, use smoothed parameters");
790 
791  const Acts::BoundTrackParameters actsParam(state.referenceSurface().getSharedPtr(),
792  state.smoothed(),
793  state.smoothedCovariance(),
794  acts_track.particleHypothesis());
795 
796  actsSmoothedParam.push_back(std::make_unique<const Acts::BoundTrackParameters>(Acts::BoundTrackParameters(actsParam)));
797  parm = m_ATLASConverterTool->actsTrackParametersToTrkParameters(actsParam, tgContext);
798  typePattern.set(Trk::TrackStateOnSurface::Measurement);
799  }
800  std::unique_ptr<Trk::MeasurementBase> measState;
801  if (state.hasUncalibratedSourceLink() && !SourceLinkType){
802  auto sl = state.getUncalibratedSourceLink().template get<ATLASSourceLink>();
803  assert(sl);
804  measState = sl->uniqueClone();
805  }
806  else if (state.hasUncalibratedSourceLink() && SourceLinkType){ //If the SourceLink is of type PRDSourceLink, we need to create the RIO_OnTrack here.
807  auto sl = state.getUncalibratedSourceLink().template get<PRDSourceLink>().prd;
808 
809  //ROT creation
810  const IdentifierHash idHash = sl->detectorElement()->identifyHash();
811  int dim = state.calibratedSize();
812  std::unique_ptr<Trk::RIO_OnTrack> rot;
813  if (dim == 1) {
814  const InDet::SCT_Cluster* sct_Cluster = dynamic_cast<const InDet::SCT_Cluster*>(sl);
815  if(!sct_Cluster){
816  ATH_MSG_ERROR("ERROR could not cast PRD to SCT_Cluster");
817  return;
818  }
819  rot = std::make_unique<InDet::SCT_ClusterOnTrack>(sct_Cluster,Trk::LocalParameters(Trk::DefinedParameter(state.template calibrated<1>()[0], Trk::loc1)), state.template calibratedCovariance<1>(),idHash);
820  }
821  else if (dim == 2) {
822  const InDet::PixelCluster* pixelCluster = dynamic_cast<const InDet::PixelCluster*>(sl);
823  if(!pixelCluster){
824  //sometimes even with dim=2, only the SCT_Cluster implementation work for RIO_OnTrack creation
825  ATH_MSG_VERBOSE("Dimension is 2 but we need SCT_Cluster for this measurment");
826  const InDet::SCT_Cluster* sct_Cluster = dynamic_cast<const InDet::SCT_Cluster*>(sl);
827  rot = std::make_unique<InDet::SCT_ClusterOnTrack>(sct_Cluster,Trk::LocalParameters(Trk::DefinedParameter(state.template calibrated<1>()[0], Trk::loc1)), state.template calibratedCovariance<1>(),idHash);
828  }
829  else{
830  rot = std::make_unique<InDet::PixelClusterOnTrack>(pixelCluster,Trk::LocalParameters(state.template calibrated<2>()),state.template calibratedCovariance<2>(),idHash);
831  }
832  }
833  else {
834  throw std::domain_error("Cannot handle measurement dim>2");
835  }
836  measState = rot->uniqueClone();
837  }
838  double nDoF = state.calibratedSize();
839  auto quality =Trk::FitQualityOnSurface(state.chi2(), nDoF);
840  const Trk::TrackStateOnSurface *perState = new Trk::TrackStateOnSurface(quality, std::move(measState), std::move(parm), nullptr, typePattern);
841  // If a state was succesfully created add it to the trajectory
842  if (perState) {
843  ATH_MSG_VERBOSE("State succesfully creates, adding it to the trajectory");
844  finalTrajectory->insert(finalTrajectory->begin(), perState);
845  }
846  });
847  // Convert the perigee state and add it to the trajectory
848  const Acts::BoundTrackParameters actsPer(acts_track.referenceSurface().getSharedPtr(),
849  acts_track.parameters(),
850  acts_track.covariance(),
851  acts_track.particleHypothesis());
852  std::unique_ptr<Trk::TrackParameters> per = m_ATLASConverterTool->actsTrackParametersToTrkParameters(actsPer, tgContext);
853  std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern;
854  typePattern.set(Trk::TrackStateOnSurface::Perigee);
855  const Trk::TrackStateOnSurface *perState = new Trk::TrackStateOnSurface(nullptr, std::move(per), nullptr, typePattern);
856  if (perState) finalTrajectory->insert(finalTrajectory->begin(), perState);
857 
858  // Create the track using the states
860  newInfo.setTrackFitter(Trk::TrackInfo::TrackFitter::KalmanFitter); //Mark the fitter as KalmanFitter
861  newtrack = std::make_unique<Trk::Track>(newInfo, std::move(finalTrajectory), nullptr);
862  if (newtrack) {
863  // Create the track summary and update the holes information
864  if (!newtrack->trackSummary()) {
865  newtrack->setTrackSummary(std::make_unique<Trk::TrackSummary>());
866  newtrack->trackSummary()->update(Trk::numberOfPixelHoles, 0);
867  newtrack->trackSummary()->update(Trk::numberOfSCTHoles, 0);
868  newtrack->trackSummary()->update(Trk::numberOfTRTHoles, 0);
869  newtrack->trackSummary()->update(Trk::numberOfPixelDeadSensors, numberOfDeadPixel);
870  newtrack->trackSummary()->update(Trk::numberOfSCTDeadSensors, numberOfDeadSCT);
871  }
872  m_trkSummaryTool->updateTrackSummary(ctx, *newtrack, true);
873  }
874  return newtrack;
875 }
876 
877 std::unique_ptr< ActsTrk::MutableTrackContainer >
878 KalmanFitter::fit(const EventContext& ctx,
879  const ActsTrk::Seed &seed,
880  const Acts::BoundTrackParameters& initialParams,
881  const Acts::GeometryContext& tgContext,
882  const Acts::MagneticFieldContext& mfContext,
883  const Acts::CalibrationContext& calContext,
884  const DetectorElementToActsGeometryIdMap &detectorElementToGeometryIdMap) const
885 {
886  const Acts::TrackingGeometry *
887  actsTrackingGeometry = m_trackingGeometryTool->trackingGeometry().get();
888  if (!actsTrackingGeometry) {
889  throw std::runtime_error("No Acts tracking geometry.");
890  }
891 
892  std::vector<ActsTrk::ATLASUncalibSourceLink> sourceLinks;
893  sourceLinks.reserve(6);
894 
895  std::vector<const Acts::Surface*> surfaces;
896  surfaces.reserve(6);
897 
898  const auto& sps = seed.sp();
899  for (const xAOD::SpacePoint* sp : sps) {
900  const auto& measurements = sp->measurements();
901  for (const xAOD::UncalibratedMeasurement *umeas : measurements) {
903  sourceLinks.emplace_back( el );
904  surfaces.push_back(ActsTrk::getSurfaceOfMeasurement(*actsTrackingGeometry, detectorElementToGeometryIdMap, *umeas));
905  }
906  }
907  return fit(ctx, sourceLinks, initialParams, tgContext, mfContext, calContext, detectorElementToGeometryIdMap, surfaces.front());
908 }
909 
910 }
Trk::noHypothesis
@ noHypothesis
Definition: ParticleHypothesis.h:37
ActsTrk::KalmanFitter::initialize
virtual StatusCode initialize() override
Definition: KalmanFitter.cxx:174
Trk::LocalParameters
Definition: LocalParameters.h:98
SCT_ClusterOnTrack.h
ActsTrk::PRDSourceLinkSurfaceAccessor::converterTool
const ActsTrk::IActsToTrkConverterTool * converterTool
Definition: KalmanFitter.h:82
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
ActsTrk::KalmanFitter::m_option_seedCovarianceScale
Gaudi::Property< double > m_option_seedCovarianceScale
Definition: KalmanFitter.h:196
ActsTrk::KalmanFitter::m_trackingGeometryTool
ToolHandle< IActsTrackingGeometryTool > m_trackingGeometryTool
Definition: KalmanFitter.h:182
Trk::IRIO_OnTrackCreator::correct
virtual RIO_OnTrack * correct(const PrepRawData &hit, const TrackParameters &trk, const EventContext &ctx) const =0
abstract base method for the creation of RIO_OnTrack it takes a RIO (PrepRawData) and the given Track...
Trk::PrepRawDataSet
std::vector< const PrepRawData * > PrepRawDataSet
vector of clusters and drift circles
Definition: FitterTypes.h:26
yodamerge_tmp.dim
dim
Definition: yodamerge_tmp.py:239
get_generator_info.result
result
Definition: get_generator_info.py:21
TrackParameters.h
MeasurementBase.h
PerigeeSurface.h
ActsTrk::DetectorElementToActsGeometryIdMap
Definition: DetectorElementToActsGeometryIdMap.h:31
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
ActsTrk::PRDSourceLinkCalibrator::rotCreator
const Trk::IRIO_OnTrackCreator * rotCreator
Definition: KalmanFitter.h:76
ActsGeometryContext.h
ActsTrk::PRDSourceLinkCalibrator::converterTool
const ActsTrk::IActsToTrkConverterTool * converterTool
Definition: KalmanFitter.h:78
PixelCluster.h
ActsTrk::detail::Navigator
Acts::Navigator Navigator
Definition: Tracking/Acts/ActsTrackReconstruction/src/detail/Definitions.h:31
ActsTrk::KalmanFitter::m_directFitter
std::unique_ptr< DirectFitter > m_directFitter
Definition: KalmanFitter.h:206
ActsTrk::KalmanFitter::m_option_maxPropagationStep
Gaudi::Property< int > m_option_maxPropagationStep
Definition: KalmanFitter.h:194
Trk::numberOfSCTDeadSensors
@ numberOfSCTDeadSensors
number of TRT hits
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:76
Trk::ParametersT
Dummy class used to allow special convertors to be called for surfaces owned by a detector element.
Definition: EMErrorDetail.h:25
Trk::Track::info
const TrackInfo & info() const
Returns a const ref to info of a const tracks.
ActsTrk::KalmanFitter::m_broadROTcreator
ToolHandle< Trk::IRIO_OnTrackCreator > m_broadROTcreator
Definition: KalmanFitter.h:221
ActsTrk::KalmanFitter::m_reverseFilteringLogic
ActsTrk::detail::FitterHelperFunctions::ReverseFilteringLogic m_reverseFilteringLogic
Definition: KalmanFitter.h:211
skel.it
it
Definition: skel.GENtoEVGEN.py:396
ATLASMagneticFieldWrapper.h
xAOD::pion
@ pion
Definition: TrackingPrimitives.h:196
Trk::SurfaceBounds::Annulus
@ Annulus
Definition: SurfaceBounds.h:70
xAOD::SpacePoint_v1
Definition: SpacePoint_v1.h:29
Trk::RIO_OnTrack
Definition: RIO_OnTrack.h:70
ReadOfcFromCool.field
field
Definition: ReadOfcFromCool.py:48
ActsTrk::detail::FitterHelperFunctions::ReverseFilteringLogic::momentumMax
double momentumMax
Definition: FitterHelperFunctions.h:90
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ActsTrk::PRDSourceLinkCalibrator::broadRotCreator
const Trk::IRIO_OnTrackCreator * broadRotCreator
Definition: KalmanFitter.h:77
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
Trk::Surface::center
const Amg::Vector3D & center() const
Returns the center position of the Surface.
yodamerge_tmp.scale
scale
Definition: yodamerge_tmp.py:138
SCT_Cluster.h
Trk::numberOfSCTHoles
@ numberOfSCTHoles
number of Holes in both sides of a SCT module
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:73
Trk::numberOfTRTHoles
@ numberOfTRTHoles
number of TRT hits which pass the high threshold (only xenon counted) total number of TRT hits which ...
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:83
AmgSymMatrix
#define AmgSymMatrix(dim)
Definition: EventPrimitives.h:50
PrepRawData.h
ActsTrk::KalmanFitter::m_extrapolationTool
ToolHandle< IActsExtrapolationTool > m_extrapolationTool
Definition: KalmanFitter.h:181
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
ActsTrk::getSurfaceOfMeasurement
const Acts::Surface * getSurfaceOfMeasurement(const Acts::TrackingGeometry &tracking_geometry, const DetectorElementToActsGeometryIdMap &detector_element_to_geoid, const xAOD::UncalibratedMeasurement &measurement)
Definition: SurfaceOfMeasurementUtil.h:13
Track.h
ActsTrk::KalmanFitter::KalmanFitter
KalmanFitter(const std::string &, const std::string &, const IInterface *)
Definition: KalmanFitter.cxx:169
makeActsAthenaLogger
std::unique_ptr< const Acts::Logger > makeActsAthenaLogger(IMessageSvc *svc, const std::string &name, int level, std::optional< std::string > parent_name)
Definition: Tracking/Acts/ActsInterop/src/Logger.cxx:64
Trk::FitQualityOnSurface
Definition: FitQualityOnSurface.h:19
Trk::ParticleHypothesis
ParticleHypothesis
Definition: ParticleHypothesis.h:25
ActsTrk::MutableMultiTrajectory
Athena implementation of ACTS::MultiTrajectory (ReadWrite version) The data is stored in 4 external b...
Definition: MultiTrajectory.h:81
ActsTrk::IActsToTrkConverterTool::trkSurfaceToActsSurface
virtual const Acts::Surface & trkSurfaceToActsSurface(const Trk::Surface &atlasSurface) const =0
KalmanFitter.h
OnTrackCalibrator.h
ActsTrk::KalmanFitter::m_doReFitFromPRD
Gaudi::Property< bool > m_doReFitFromPRD
Definition: KalmanFitter.h:224
ActsTrk::KalmanFitter::m_logger
std::unique_ptr< const Acts::Logger > m_logger
logging instance
Definition: KalmanFitter.h:219
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
xAOD::UncalibratedMeasurement_v1
Definition: UncalibratedMeasurement_v1.h:13
ActsTrk::makeATLASUncalibSourceLink
ATLASUncalibSourceLink makeATLASUncalibSourceLink(const xAOD::UncalibratedMeasurementContainer *container, std::size_t index, [[maybe_unused]] const EventContext &ctx)
Definition: ATLASSourceLink.h:30
lumiFormat.i
int i
Definition: lumiFormat.py:85
ActsTrk::KalmanFitter::m_calibrator
std::unique_ptr< TrkMeasurementCalibrator > m_calibrator
Definition: KalmanFitter.h:199
beamspotman.n
n
Definition: beamspotman.py:731
Trk::theta
@ theta
Definition: ParamDefs.h:66
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
Trk::numberOfPixelDeadSensors
@ numberOfPixelDeadSensors
number of pixel hits with broad errors (width/sqrt(12))
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:65
master.flag
bool flag
Definition: master.py:29
ActsTrk::KalmanFitter::m_ROTcreator
ToolHandle< Trk::IRIO_OnTrackCreator > m_ROTcreator
Definition: KalmanFitter.h:222
Trk::TrkDetElementBase::surface
virtual const Surface & surface() const =0
Return surface associated with this detector element.
plotIsoValidation.el
el
Definition: plotIsoValidation.py:197
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
ActsTrk::Seed
Acts::Seed< xAOD::SpacePoint, 3ul > Seed
Definition: Seed.h:12
ActsTrk::PRDSourceLinkCalibrator
Definition: KalmanFitter.h:69
TrackSummary.h
Trk::ParametersBase
Definition: ParametersBase.h:55
ActsTrk::KalmanFitter::m_option_ReverseFilteringPt
Gaudi::Property< double > m_option_ReverseFilteringPt
Definition: KalmanFitter.h:192
InDet::SCT_Cluster
Definition: InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/SCT_Cluster.h:34
ActsTrk::KalmanFitter::m_kfExtensions
Acts::KalmanFitterExtensions< ActsTrk::MutableTrackStateBackend > m_kfExtensions
Definition: KalmanFitter.h:208
ActsTrk::KalmanFitter::m_outlierFinder
ActsTrk::detail::FitterHelperFunctions::ATLASOutlierFinder m_outlierFinder
Definition: KalmanFitter.h:210
MuonValidation_CreateResolutionProfiles.fit
def fit(h, emin, emax)
Definition: MuonValidation_CreateResolutionProfiles.py:69
Trk::numberOfPixelHoles
@ numberOfPixelHoles
number of pixels which have a ganged ambiguity.
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:59
Trk::MeasurementSet
std::vector< const MeasurementBase * > MeasurementSet
vector of fittable measurements
Definition: FitterTypes.h:30
Trk::PrepRawData
Definition: PrepRawData.h:62
ActsTrk::IActsToTrkConverterTool::actsTrackParametersToTrkParameters
virtual std::unique_ptr< Trk::TrackParameters > actsTrackParametersToTrkParameters(const Acts::BoundTrackParameters &actsParameter, const Acts::GeometryContext &gctx) const =0
Trk::PrepRawData::identify
Identifier identify() const
return the identifier
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::Track::perigeeParameters
const Perigee * perigeeParameters() const
return Perigee.
Definition: Tracking/TrkEvent/TrkTrack/src/Track.cxx:163
xAOD::KalmanFitter
@ KalmanFitter
tracks produced by the Kalman Fitter
Definition: TrackingPrimitives.h:47
Trk::TrackStateOnSurface
represents the track state (measurement, material, fit parameters and quality) at a surface.
Definition: TrackStateOnSurface.h:71
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
RIO_OnTrack.h
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
ActsTrk::KalmanFitter::m_ATLASConverterTool
ToolHandle< ActsTrk::IActsToTrkConverterTool > m_ATLASConverterTool
Definition: KalmanFitter.h:183
ActsTrk::KalmanFitter::m_trkSummaryTool
ToolHandle< Trk::IExtendedTrackSummaryTool > m_trkSummaryTool
Definition: KalmanFitter.h:184
ActsTrk::getUncalibratedMeasurement
const xAOD::UncalibratedMeasurement & getUncalibratedMeasurement(const ATLASUncalibSourceLink &source_link)
Definition: ATLASSourceLink.h:26
Trk::TrackInfo::dumpInfo
std::string dumpInfo() const
Returns a string with the name of the fitter of this track (i.e.
Definition: Tracking/TrkEvent/TrkTrack/src/TrackInfo.cxx:45
ActsTrk::KalmanFitter::m_fitter
std::unique_ptr< Fitter > m_fitter
Definition: KalmanFitter.h:203
xAOD::ParticleHypothesis
ParticleHypothesis
Definition: TrackingPrimitives.h:192
InDet::PixelCluster
Definition: InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/PixelCluster.h:49
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::pixelCluster
@ pixelCluster
Definition: MeasurementType.h:22
ActsTrk::ATLASSourceLinkSurfaceAccessor
Definition: ATLASSourceLinkSurfaceAccessor.h:20
ActsTrk::KalmanFitter::m_option_outlierChi2Cut
Gaudi::Property< double > m_option_outlierChi2Cut
Definition: KalmanFitter.h:190
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
Trk::PlaneSurface
Definition: PlaneSurface.h:64
ActsTrk::PRDSourceLinkCalibrator::calibrate
void calibrate(const Acts::GeometryContext &gctx, const Acts::CalibrationContext &cctx, const Acts::SourceLink &sl, typename trajectory_t::TrackStateProxy trackState) const
Definition: KalmanFitter.cxx:61
ActsTrk::detail::FitterHelperFunctions::ATLASOutlierFinder::StateChiSquaredPerNumberDoFCut
double StateChiSquaredPerNumberDoFCut
Definition: FitterHelperFunctions.h:50
ActsTrk::PRDSourceLinkSurfaceAccessor::operator()
const Acts::Surface * operator()(const Acts::SourceLink &sourceLink) const
Definition: KalmanFitter.cxx:162
Trk::qOverP
@ qOverP
perigee
Definition: ParamDefs.h:67
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:567
ActsTrk::PRDSourceLinkSurfaceAccessor
Definition: KalmanFitter.h:81
ATLASSourceLinkSurfaceAccessor.h
Trk::SurfaceType::Plane
@ Plane
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MuonDetectorBuilderTool.cxx:49
Trk::phi
@ phi
Definition: ParamDefs.h:75
ActsTrk::KalmanFitter::logger
const Acts::Logger & logger() const
Private access to the logger.
Definition: KalmanFitter.h:214
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
ActsTrk::detail::OnTrackCalibrator
Definition: IOnTrackCalibratorTool.h:14
ActsTrk::ATLASUncalibSourceLinkSurfaceAccessor
Definition: ATLASSourceLinkSurfaceAccessor.h:26
Trk::SurfaceType::Line
@ Line
Logger.h
PixelClusterOnTrack.h
Trk::loc1
@ loc1
Definition: ParamDefs.h:34
Trk::Surface
Definition: Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h:75
ActsTrk::MutableTrackContainer
Definition: TrackContainer.h:122
ActsTrk::KalmanFitter::makeTrack
std::unique_ptr< Trk::Track > makeTrack(const EventContext &ctx, Acts::GeometryContext &tgContext, ActsTrk::MutableTrackContainer &tracks, Acts::Result< ActsTrk::MutableTrackContainer::TrackProxy, std::error_code > &fitResult, bool SourceLinkType=false) const
Definition: KalmanFitter.cxx:695
TrackContainer.h
ActsTrk::detail::OnTrackCalibrator::NoCalibration
static OnTrackCalibrator NoCalibration(const Acts::TrackingGeometry &trackingGeometry, const ActsTrk::DetectorElementToActsGeometryIdMap &detectorElementToGeoId)
Trk::Surface::type
constexpr virtual SurfaceType type() const =0
Returns the Surface type to avoid dynamic casts.
Trk::StraightLineSurface
Definition: StraightLineSurface.h:51
Trk::PrepRawData::detectorElement
virtual const TrkDetElementBase * detectorElement() const =0
return the detector element corresponding to this PRD The pointer will be zero if the det el is not d...
ActsTrk::KalmanFitter::fit
virtual std::unique_ptr< Trk::Track > fit(const EventContext &ctx, const Trk::Track &, const Trk::RunOutlierRemoval runOutlier=false, const Trk::ParticleHypothesis matEffects=Trk::nonInteracting) const override
refit a track
Definition: KalmanFitter.cxx:227