ATLAS Offline Software
KalmanFitterTool.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 "src/KalmanFitterTool.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.setProjectorSubspaceIndices(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.setProjectorSubspaceIndices(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 
170  const std::string& n,
171  const IInterface* p) :
172  base_class(t,n,p)
173 {}
174 
176 
177  ATH_MSG_DEBUG(name() << "::" << __FUNCTION__);
178  ATH_CHECK(m_trackingGeometryTool.retrieve());
179  ATH_CHECK(m_extrapolationTool.retrieve());
180  ATH_CHECK(m_ATLASConverterTool.retrieve());
181  ATH_CHECK(m_trkSummaryTool.retrieve());
182  if(m_doReFitFromPRD){
183  ATH_CHECK(m_ROTcreator.retrieve());
184  ATH_CHECK(m_broadROTcreator.retrieve());
185  }
186 
187  m_logger = makeActsAthenaLogger(this, "KalmanRefit");
188 
189  auto field = std::make_shared<ATLASMagneticFieldWrapper>();
190 
191  // Fitter
192  Acts::SympyStepper stepper(field);
193  Acts::Navigator navigator( Acts::Navigator::Config{ m_trackingGeometryTool->trackingGeometry() },
194  logger().cloneWithSuffix("Navigator"));
195  Acts::Propagator<Acts::SympyStepper, Acts::Navigator> propagator(stepper,
196  std::move(navigator),
197  logger().cloneWithSuffix("Prop"));
198 
199  m_fitter = std::make_unique<Fitter>(std::move(propagator),
200  logger().cloneWithSuffix("KalmanFitter"));
201 
202  // Direct Fitter
203  Acts::DirectNavigator directNavigator( logger().cloneWithSuffix("DirectNavigator") );
204  Acts::Propagator<Acts::SympyStepper, Acts::DirectNavigator> directPropagator(std::move(stepper),
205  std::move(directNavigator),
206  logger().cloneWithSuffix("DirectPropagator"));
207 
208  m_directFitter = std::make_unique<DirectFitter>(std::move(directPropagator),
209  logger().cloneWithSuffix("DirectKalmanFitter"));
210 
212  m_calibrator = std::make_unique<ActsTrk::detail::TrkMeasurementCalibrator>(*m_ATLASConverterTool);
215 
216  m_kfExtensions.outlierFinder.connect<&ActsTrk::detail::FitterHelperFunctions::ATLASOutlierFinder::operator()<ActsTrk::MutableTrackStateBackend>>(&m_outlierFinder);
217  m_kfExtensions.reverseFilteringLogic.connect<&ActsTrk::detail::FitterHelperFunctions::ReverseFilteringLogic::operator()<ActsTrk::MutableTrackStateBackend>>(&m_reverseFilteringLogic);
218  m_kfExtensions.updater.connect<&ActsTrk::detail::FitterHelperFunctions::gainMatrixUpdate<ActsTrk::MutableTrackStateBackend>>();
219  m_kfExtensions.smoother.connect<&ActsTrk::detail::FitterHelperFunctions::mbfSmoother<ActsTrk::MutableTrackStateBackend>>();
220  m_kfExtensions.calibrator.connect<&ActsTrk::detail::TrkMeasurementCalibrator::calibrate<ActsTrk::MutableTrackStateBackend>>(m_calibrator.get());
221 
222  return StatusCode::SUCCESS;
223 }
224 
225 // refit a track
226 // -------------------------------------------------------
227 std::unique_ptr<Trk::Track>
228 KalmanFitterTool::fit(const EventContext& ctx,
229  const Trk::Track& inputTrack,
230  const Trk::RunOutlierRemoval /*runOutlier*/,
231  const Trk::ParticleHypothesis /*prtHypothesis*/) const
232 {
233  std::unique_ptr<Trk::Track> track = nullptr;
234  ATH_MSG_VERBOSE ("--> enter KalmanFitter::fit(Track,,) with Track from author = "
235  << inputTrack.info().dumpInfo());
236 
237  // protection against not having measurements on the input track
238  if (!inputTrack.measurementsOnTrack() || inputTrack.measurementsOnTrack()->size() < 2) {
239  ATH_MSG_DEBUG("called to refit empty track or track with too little information, reject fit");
240  return nullptr;
241  }
242 
243  // protection against not having track parameters on the input track
244  if (!inputTrack.trackParameters() || inputTrack.trackParameters()->empty()) {
245  ATH_MSG_DEBUG("input fails to provide track parameters for seeding the KF, reject fit");
246  return nullptr;
247  }
248 
249  // Construct a perigee surface as the target surface
250  auto pSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(
251  Acts::Vector3{0., 0., 0.});
252 
253  Acts::GeometryContext tgContext = m_trackingGeometryTool->getGeometryContext(ctx).context();
254  Acts::MagneticFieldContext mfContext = m_extrapolationTool->getMagneticFieldContext(ctx);
255  // CalibrationContext converter not implemented yet.
256  Acts::CalibrationContext calContext = Acts::CalibrationContext();
257 
258  Acts::KalmanFitterExtensions<ActsTrk::MutableTrackStateBackend> kfExtensions = m_kfExtensions;
259 
260  ATLASSourceLinkSurfaceAccessor surfaceAccessor{&(*m_ATLASConverterTool)};
261  kfExtensions.surfaceAccessor.connect<&ATLASSourceLinkSurfaceAccessor::operator()>(&surfaceAccessor);
262 
263  Acts::PropagatorPlainOptions propagationOption(tgContext, mfContext);
264  propagationOption.maxSteps = m_option_maxPropagationStep;
265  // Set the KalmanFitter options
266  Acts::KalmanFitterOptions
267  kfOptions(tgContext, mfContext, calContext,
268  kfExtensions,
269  propagationOption,
270  &(*pSurface));
271 
272  std::vector<Acts::SourceLink> trackSourceLinks = m_ATLASConverterTool->trkTrackToSourceLinks(tgContext,inputTrack);
273  // protection against error in the conversion from Atlas masurement to Acts source link
274  if (trackSourceLinks.empty()) {
275  ATH_MSG_DEBUG("input contain measurement but no source link created, probable issue with the converter, reject fit ");
276  return track;
277  }
278 
279  const auto& initialParams = m_ATLASConverterTool->trkTrackParametersToActsParameters((*inputTrack.perigeeParameters()), tgContext);
280 
281  // The covariance from already fitted track are too small and would result an incorect smoothing.
282  // We scale up the input covaraiance to avoid this.
283  Acts::BoundSquareMatrix scaledCov = Acts::BoundSquareMatrix::Identity();
284  for (int i=0; i<6; ++i) {
286  (scaledCov)(i,i) = scale * initialParams.covariance().value()(i,i);
287  }
288 
289  // @TODO: Synchronize with prtHypothesis
291 
292  const Acts::BoundTrackParameters scaledInitialParams(initialParams.referenceSurface().getSharedPtr(),
293  initialParams.parameters(),
294  scaledCov,
295  hypothesis);
296 
298 
299  // Perform the fit
300  auto result = m_fitter->fit(trackSourceLinks.begin(), trackSourceLinks.end(),
301  scaledInitialParams, kfOptions, tracks);
302  if (result.ok()) {
303  track = makeTrack(ctx, tgContext, tracks, result);
304  }
305  return track;
306 }
307 
308 // fit a set of MeasurementBase objects
309 // --------------------------------
310 std::unique_ptr<Trk::Track>
311 KalmanFitterTool::fit(const EventContext& ctx,
312  const Trk::MeasurementSet& inputMeasSet,
313  const Trk::TrackParameters& estimatedStartParameters,
314  const Trk::RunOutlierRemoval /*runOutlier*/,
315  const Trk::ParticleHypothesis /*matEffects*/) const
316 {
317  std::unique_ptr<Trk::Track> track = nullptr;
318 
319  // protection against not having measurements on the input track
320  if (inputMeasSet.size() < 2) {
321  ATH_MSG_DEBUG("called to refit empty measurement set or a measurement set with too little information, reject fit");
322  return nullptr;
323  }
324 
325  // Construct a perigee surface as the target surface
326  auto pSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(
327  Acts::Vector3{0., 0., 0.});
328 
329  Acts::GeometryContext tgContext = m_trackingGeometryTool->getGeometryContext(ctx).context();
330  Acts::MagneticFieldContext mfContext = m_extrapolationTool->getMagneticFieldContext(ctx);
331  // CalibrationContext converter not implemented yet.
332  Acts::CalibrationContext calContext = Acts::CalibrationContext();
333 
334  Acts::KalmanFitterExtensions<ActsTrk::MutableTrackStateBackend> kfExtensions = m_kfExtensions;
335 
336  ATLASSourceLinkSurfaceAccessor surfaceAccessor{&(*m_ATLASConverterTool)};
337  kfExtensions.surfaceAccessor.connect<&ATLASSourceLinkSurfaceAccessor::operator()>(&surfaceAccessor);
338 
339  Acts::PropagatorPlainOptions propagationOption(tgContext, mfContext);
340  propagationOption.maxSteps = m_option_maxPropagationStep;
341  // Set the KalmanFitter options
342  Acts::KalmanFitterOptions
343  kfOptions(tgContext, mfContext, calContext,
344  kfExtensions,
345  propagationOption,
346  &(*pSurface));
347 
348  std::vector<Acts::SourceLink> trackSourceLinks;
349  trackSourceLinks.reserve(inputMeasSet.size());
350 
351  for (auto it = inputMeasSet.begin(); it != inputMeasSet.end(); ++it){
352  trackSourceLinks.push_back(m_ATLASConverterTool->trkMeasurementToSourceLink(tgContext, **it));
353  }
354  // protection against error in the conversion from Atlas masurement to Acts source link
355  if (trackSourceLinks.empty()) {
356  ATH_MSG_DEBUG("input contain measurement but no source link created, probable issue with the converter, reject fit ");
357  return track;
358  }
359 
360  const auto& initialParams = m_ATLASConverterTool->trkTrackParametersToActsParameters(estimatedStartParameters, tgContext);
361 
363 
364  // Perform the fit
365  auto result = m_fitter->fit(trackSourceLinks.begin(), trackSourceLinks.end(),
366  initialParams, kfOptions, tracks);
367  if (result.ok()) {
368  track = makeTrack(ctx, tgContext, tracks, result);
369  }
370  return track;
371 }
372 
373 // fit a set of PrepRawData objects
374 // --------------------------------
375 std::unique_ptr<Trk::Track>
376 KalmanFitterTool::fit(const EventContext& ctx,
377  const Trk::PrepRawDataSet& inputPRDColl,
378  const Trk::TrackParameters& estimatedStartParameters,
379  const Trk::RunOutlierRemoval /*runOutlier*/,
380  const Trk::ParticleHypothesis /*prtHypothesis*/) const
381 {
382  ATH_MSG_DEBUG("--> entering KalmanFitter::fit(PRDS,TP,)");
383 
384 
385  std::unique_ptr<Trk::Track> track = nullptr;
386 
387  // Construct a perigee surface as the target surface
388  auto pSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(
389  Acts::Vector3{0., 0., 0.});
390 
391  Acts::GeometryContext tgContext = m_trackingGeometryTool->getGeometryContext(ctx).context();
392  Acts::MagneticFieldContext mfContext = m_extrapolationTool->getMagneticFieldContext(ctx);
393  // CalibrationContext converter not implemented yet.
394  Acts::CalibrationContext calContext = Acts::CalibrationContext();
395 
396  Acts::KalmanFitterExtensions<ActsTrk::MutableTrackStateBackend> kfExtensions = m_kfExtensions;
397 
398  PRDSourceLinkCalibrator calibrator{}; // @TODO: Set tool pointers
399  calibrator.rotCreator =m_ROTcreator.get();
400  calibrator.broadRotCreator = m_broadROTcreator.get();
401  calibrator.converterTool = m_ATLASConverterTool.get();
402  kfExtensions.calibrator.connect<&PRDSourceLinkCalibrator::calibrate<ActsTrk::MutableTrackStateBackend>>(&calibrator);
403 
404  PRDSourceLinkSurfaceAccessor surfaceAccessor{m_ATLASConverterTool.get()};
405  kfExtensions.surfaceAccessor.connect<&PRDSourceLinkSurfaceAccessor::operator()>(&surfaceAccessor);
406 
407  Acts::PropagatorPlainOptions propagationOption(tgContext, mfContext);
408  propagationOption.maxSteps = m_option_maxPropagationStep;
409  // Set the KalmanFitter options
410  Acts::KalmanFitterOptions
411  kfOptions(tgContext, mfContext, calContext,
412  kfExtensions,
413  propagationOption,
414  &(*pSurface));
415 
416 
417  std::vector<Acts::SourceLink> trackSourceLinks;
418  trackSourceLinks.reserve(inputPRDColl.size());
419 
420  for(const Trk::PrepRawData* prd : inputPRDColl) {
421  trackSourceLinks.push_back(Acts::SourceLink{PRDSourceLink{prd}});
422  }
423  // protection against error in the conversion from Atlas masurement to Acts source link
424  if (trackSourceLinks.empty()) {
425  ATH_MSG_WARNING("input contain measurement but no source link created, probable issue with the converter, reject fit ");
426  return track;
427  }
428  //
429 
430  const auto& initialParams = m_ATLASConverterTool->trkTrackParametersToActsParameters(estimatedStartParameters, tgContext);
431 
432 
434  // Perform the fit
435  auto result = m_fitter->fit(trackSourceLinks.begin(), trackSourceLinks.end(),
436  initialParams, kfOptions, tracks);
437  if (result.ok()) {
438  track = makeTrack(ctx, tgContext, tracks, result, true);
439  }
440  return track;
441 }
442 
443 // fit a set of PrepRawData objects
444 // --------------------------------
445 std::unique_ptr< ActsTrk::MutableTrackContainer >
446 KalmanFitterTool::fit(const EventContext&,
447  const std::vector< ActsTrk::ATLASUncalibSourceLink> & clusterList,
448  const Acts::BoundTrackParameters& initialParams,
449  const Acts::GeometryContext& tgContext,
450  const Acts::MagneticFieldContext& mfContext,
451  const Acts::CalibrationContext& calContext,
452  const DetectorElementToActsGeometryIdMap &detectorElementToGeometryIdMap,
453  const Acts::Surface* targetSurface) const{
454  ATH_MSG_DEBUG("--> entering KalmanFitter::fit(xAODMeasure...things,TP,)");
455 
456  std::vector<Acts::SourceLink> sourceLinks;
457  sourceLinks.reserve(clusterList.size());
458 
459  std::vector<const Acts::Surface*> surfaces;
460  surfaces.reserve(clusterList.size());
461 
462  const Acts::TrackingGeometry *
463  actsTrackingGeometry = m_trackingGeometryTool->trackingGeometry().get();
464  if (!actsTrackingGeometry) {
465  throw std::runtime_error("No Acts tracking geometry.");
466  }
467 
468  for (const ActsTrk::ATLASUncalibSourceLink& el : clusterList) {
469  sourceLinks.emplace_back( el );
470  surfaces.push_back(ActsTrk::getSurfaceOfMeasurement(*actsTrackingGeometry, detectorElementToGeometryIdMap, getUncalibratedMeasurement(el) ));
471  }
472 
473  Acts::KalmanFitterExtensions<ActsTrk::MutableTrackStateBackend> kfExtensions = m_kfExtensions;
474 
475  ActsTrk::ATLASUncalibSourceLinkSurfaceAccessor surfaceAccessor( *actsTrackingGeometry, detectorElementToGeometryIdMap);
476  kfExtensions.surfaceAccessor.connect<&ActsTrk::ATLASUncalibSourceLinkSurfaceAccessor::operator()>(&surfaceAccessor);
477 
479  ::NoCalibration(*actsTrackingGeometry, detectorElementToGeometryIdMap);
480 
481  kfExtensions.calibrator.connect<&detail::OnTrackCalibrator<ActsTrk::MutableTrackStateBackend>::calibrate>(&calibrator);
482 
483  Acts::PropagatorPlainOptions propagationOption(tgContext, mfContext);
484  propagationOption.maxSteps = m_option_maxPropagationStep;
485 
486  // Construct a perigee surface as the target surface if none is provided
487  std::shared_ptr<Acts::Surface> pSurface{nullptr};
488  if (!targetSurface){
489  pSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(Acts::Vector3{0., 0., 0.});
490  targetSurface = pSurface.get();
491  }
492 
493  // Set the KalmanFitter options
494  Acts::KalmanFitterOptions<ActsTrk::MutableTrackStateBackend>
495  kfOptions(tgContext, mfContext, calContext,
496  kfExtensions,
497  propagationOption,
498  targetSurface);
499 
500  std::unique_ptr< ActsTrk::MutableTrackContainer > tracks = std::make_unique< ActsTrk::MutableTrackContainer >();
501 
502 
503  auto result = m_directFitter->fit(sourceLinks.begin(),
504  sourceLinks.end(),
505  initialParams,
506  kfOptions,
507  surfaces,
508  *tracks.get());
509 
510  if (not result.ok()) {
511  ATH_MSG_VERBOSE("Kalman Fitter on Seed has failed");
512  return nullptr;
513  }
514  return tracks;
515 }
516 
517 // extend a track fit to include an additional set of MeasurementBase objects
518 // re-implements the TrkFitterUtils/TrackFitter.cxx general code in a more
519 // mem efficient and stable way
520 // --------------------------------
521 std::unique_ptr<Trk::Track>
522 KalmanFitterTool::fit(const EventContext& ctx,
523  const Trk::Track& inputTrack,
524  const Trk::MeasurementSet& addMeasColl,
525  const Trk::RunOutlierRemoval /*runOutlier*/,
526  const Trk::ParticleHypothesis /*matEffects*/) const
527 {
528  ATH_MSG_VERBOSE ("--> enter KalmanFitter::fit(Track,Meas'BaseSet,,)");
529  ATH_MSG_VERBOSE (" with Track from author = " << inputTrack.info().dumpInfo());
530 
531  // protection, if empty MeasurementSet
532  if (addMeasColl.empty()) {
533  ATH_MSG_DEBUG( "client tries to add an empty MeasurementSet to the track fit." );
534  return fit(ctx,inputTrack);
535  }
536 
537  // protection against not having measurements on the input track
538  if (!inputTrack.measurementsOnTrack() || (inputTrack.measurementsOnTrack()->size() < 2 && addMeasColl.empty())) {
539  ATH_MSG_DEBUG("called to refit empty track or track with too little information, reject fit");
540  return nullptr;
541  }
542 
543  // protection against not having track parameters on the input track
544  if (!inputTrack.trackParameters() || inputTrack.trackParameters()->empty()) {
545  ATH_MSG_DEBUG("input fails to provide track parameters for seeding the KF, reject fit");
546  return nullptr;
547  }
548 
549  std::unique_ptr<Trk::Track> track = nullptr;
550 
551  // Construct a perigee surface as the target surface
552  auto pSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(
553  Acts::Vector3{0., 0., 0.});
554 
555  Acts::GeometryContext tgContext = m_trackingGeometryTool->getGeometryContext(ctx).context();
556  Acts::MagneticFieldContext mfContext = m_extrapolationTool->getMagneticFieldContext(ctx);
557  // CalibrationContext converter not implemented yet.
558  Acts::CalibrationContext calContext = Acts::CalibrationContext();
559 
560  Acts::KalmanFitterExtensions<ActsTrk::MutableTrackStateBackend> kfExtensions = m_kfExtensions;
561 
562  Acts::PropagatorPlainOptions propagationOption(tgContext, mfContext);
563  propagationOption.maxSteps = m_option_maxPropagationStep;
564  // Set the KalmanFitter options
565  Acts::KalmanFitterOptions
566  kfOptions(tgContext, mfContext, calContext,
567  kfExtensions,
568  propagationOption,
569  &(*pSurface));
570 
571  std::vector<Acts::SourceLink> trackSourceLinks = m_ATLASConverterTool->trkTrackToSourceLinks(tgContext, inputTrack);
572  const auto& initialParams = m_ATLASConverterTool->trkTrackParametersToActsParameters(*(inputTrack.perigeeParameters()), tgContext);
573 
574  for (auto it = addMeasColl.begin(); it != addMeasColl.end(); ++it)
575  {
576  trackSourceLinks.push_back(m_ATLASConverterTool->trkMeasurementToSourceLink(tgContext, **it));
577  }
578  // protection against error in the conversion from Atlas masurement to Acts source link
579  if (trackSourceLinks.empty()) {
580  ATH_MSG_DEBUG("input contain measurement but no source link created, probable issue with the converter, reject fit ");
581  return track;
582  }
583 
585  // Perform the fit
586  auto result = m_fitter->fit(trackSourceLinks.begin(), trackSourceLinks.end(),
587  initialParams, kfOptions, tracks);
588  if (result.ok()) {
589  track = makeTrack(ctx, tgContext, tracks, result);
590  }
591  return track;
592 }
593 
594 // extend a track fit to include an additional set of PrepRawData objects
595 // --------------------------------
596 std::unique_ptr<Trk::Track>
597 KalmanFitterTool::fit(const EventContext& /*ctx*/,
598  const Trk::Track& /*inputTrack*/,
599  const Trk::PrepRawDataSet& /*addPrdColl*/,
600  const Trk::RunOutlierRemoval /*runOutlier*/,
601  const Trk::ParticleHypothesis /*matEffects*/) const
602 {
603  ATH_MSG_DEBUG("Fit of Track with additional PrepRawDataSet not yet implemented");
604  return nullptr;
605 }
606 
607 // combined fit of two tracks
608 // --------------------------------
609 std::unique_ptr<Trk::Track>
610 KalmanFitterTool::fit(const EventContext& ctx,
611  const Trk::Track& intrk1,
612  const Trk::Track& intrk2,
613  const Trk::RunOutlierRemoval /*runOutlier*/,
614  const Trk::ParticleHypothesis /*matEffects*/) const
615 {
616  ATH_MSG_VERBOSE ("--> enter KalmanFitter::fit(Track,Track,)");
617  ATH_MSG_VERBOSE (" with Tracks from #1 = " << intrk1.info().dumpInfo()
618  << " and #2 = " << intrk2.info().dumpInfo());
619 
620  // protection, if empty track2
621  if (!intrk2.measurementsOnTrack()) {
622  ATH_MSG_DEBUG( "input #2 is empty try to fit track 1 alone" );
623  return fit(ctx,intrk1);
624  }
625 
626  // protection, if empty track1
627  if (!intrk1.measurementsOnTrack()) {
628  ATH_MSG_DEBUG( "input #1 is empty try to fit track 2 alone" );
629  return fit(ctx,intrk2);
630  }
631 
632  // protection against not having track parameters on the input track
633  if (!intrk1.trackParameters() || intrk1.trackParameters()->empty()) {
634  ATH_MSG_DEBUG("input #1 fails to provide track parameters for seeding the KF, reject fit");
635  return nullptr;
636  }
637 
638  std::unique_ptr<Trk::Track> track = nullptr;
639 
640  // Construct a perigee surface as the target surface
641  auto pSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(
642  Acts::Vector3{0., 0., 0.});
643 
644  Acts::GeometryContext tgContext = m_trackingGeometryTool->getGeometryContext(ctx).context();
645  Acts::MagneticFieldContext mfContext = m_extrapolationTool->getMagneticFieldContext(ctx);
646  // CalibrationContext converter not implemented yet.
647  Acts::CalibrationContext calContext = Acts::CalibrationContext();
648 
649  Acts::KalmanFitterExtensions<ActsTrk::MutableTrackStateBackend> kfExtensions = m_kfExtensions;
650 
651  Acts::PropagatorPlainOptions propagationOption(tgContext, mfContext);
652  propagationOption.maxSteps = m_option_maxPropagationStep;
653  // Set the KalmanFitter options
654  Acts::KalmanFitterOptions
655  kfOptions(tgContext, mfContext, calContext,
656  kfExtensions,
657  propagationOption,
658  &(*pSurface));
659 
660  std::vector<Acts::SourceLink> trackSourceLinks = m_ATLASConverterTool->trkTrackToSourceLinks(tgContext, intrk1);
661  std::vector<Acts::SourceLink> trackSourceLinks2 = m_ATLASConverterTool->trkTrackToSourceLinks(tgContext, intrk2);
662  trackSourceLinks.insert(trackSourceLinks.end(), trackSourceLinks2.begin(), trackSourceLinks2.end());
663  // protection against error in the conversion from Atlas masurement to Acts source link
664  if (trackSourceLinks.empty()) {
665  ATH_MSG_DEBUG("input contain measurement but no source link created, probable issue with the converter, reject fit ");
666  return track;
667  }
668 
669  const auto &initialParams = m_ATLASConverterTool->trkTrackParametersToActsParameters(*(intrk1.perigeeParameters()), tgContext);
670 
671  // The covariance from already fitted track are too small and would result an incorect smoothing.
672  // We scale up the input covaraiance to avoid this.
673  Acts::BoundSquareMatrix scaledCov = Acts::BoundSquareMatrix::Identity();
674  for (int i=0; i<6; ++i) {
676  (scaledCov)(i,i) = scale * initialParams.covariance().value()(i,i);
677  }
678 
679  const Acts::BoundTrackParameters scaledInitialParams(initialParams.referenceSurface().getSharedPtr(),
680  initialParams.parameters(),
681  scaledCov,
683 
684 
686  // Perform the fit
687  auto result = m_fitter->fit(trackSourceLinks.begin(), trackSourceLinks.end(),
688  scaledInitialParams, kfOptions, tracks);
689  if (result.ok()) {
690  track = makeTrack(ctx, tgContext, tracks, result);
691  }
692  return track;
693 }
694 
695 std::unique_ptr<Trk::Track>
696 KalmanFitterTool::makeTrack(const EventContext& ctx,
697  Acts::GeometryContext& tgContext,
699  Acts::Result<ActsTrk::MutableTrackContainer::TrackProxy, std::error_code>& fitResult,
700  bool SourceLinkType) const {
701 
702  if (not fitResult.ok())
703  return nullptr;
704 
705  std::unique_ptr<Trk::Track> newtrack = nullptr;
706  // Get the fit output object
707  const auto& acts_track = fitResult.value();
708  auto finalTrajectory = std::make_unique<Trk::TrackStates>();
709  // initialise the number of dead Pixel and Acts strip
710  int numberOfDeadPixel = 0;
711  int numberOfDeadSCT = 0;
712 
713  std::vector<std::unique_ptr<const Acts::BoundTrackParameters>> actsSmoothedParam;
714  // Loop over all the output state to create track state
715  tracks.trackStateContainer().visitBackwards(acts_track.tipIndex(),
716  [&] (const auto &state) -> void
717  {
718  // First only concider state with an associated detector element not in the TRT
719  auto flag = state.typeFlags();
720  const auto* associatedDetEl = state.referenceSurface().associatedDetectorElement();
721  if (not associatedDetEl)
722  return;
723 
724  const auto* actsElement = dynamic_cast<const ActsDetectorElement*>(associatedDetEl);
725  if (not actsElement)
726  return;
727 
728  const auto* upstreamDetEl = actsElement->upstreamDetectorElement();
729  if (not upstreamDetEl)
730  return;
731 
732  ATH_MSG_VERBOSE("Try casting to TRT for if");
733  if (dynamic_cast<const InDetDD::TRT_BaseElement*>(upstreamDetEl))
734  return;
735 
736  const auto* trkDetElem = dynamic_cast<const Trk::TrkDetElementBase*>(upstreamDetEl);
737  if (not trkDetElem)
738  return;
739 
740  ATH_MSG_VERBOSE("trkDetElem type: " << static_cast<std::underlying_type_t<Trk::DetectorElemType>>(trkDetElem->detectorType()));
741 
742  ATH_MSG_VERBOSE("Try casting to SiDetectorElement");
743  const auto* detElem = dynamic_cast<const InDetDD::SiDetectorElement*>(upstreamDetEl);
744  if (not detElem)
745  return;
746  ATH_MSG_VERBOSE("detElem = " << detElem);
747 
748  // We need to determine the type of state
749  std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern;
750  std::unique_ptr<Trk::TrackParameters> parm;
751 
752  // State is a hole (no associated measurement), use predicted parameters
753  if (flag.test(Acts::TrackStateFlag::HoleFlag)){
754  ATH_MSG_VERBOSE("State is a hole (no associated measurement), use predicted parameters");
755  const Acts::BoundTrackParameters actsParam(state.referenceSurface().getSharedPtr(),
756  state.predicted(),
757  state.predictedCovariance(),
758  acts_track.particleHypothesis());
759  parm = m_ATLASConverterTool->actsTrackParametersToTrkParameters(actsParam, tgContext);
760  auto boundaryCheck = m_boundaryCheckTool->boundaryCheck(*parm);
761 
762  // Check if this is a hole, a dead sensors or a state outside the sensor boundary
763  ATH_MSG_VERBOSE("Check if this is a hole, a dead sensors or a state outside the sensor boundary");
764  if(boundaryCheck == Trk::BoundaryCheckResult::DeadElement){
765  if (detElem->isPixel()) {
766  ++numberOfDeadPixel;
767  }
768  else if (detElem->isSCT()) {
769  ++numberOfDeadSCT;
770  }
771  // Dead sensors states are not stored
772  return;
773  } else if (boundaryCheck != Trk::BoundaryCheckResult::Candidate){
774  // States outside the sensor boundary are ignored
775  return;
776  }
777  typePattern.set(Trk::TrackStateOnSurface::Hole);
778  }
779  // The state was tagged as an outlier or was missed in the reverse filtering, use filtered parameters
780  else if (flag.test(Acts::TrackStateFlag::OutlierFlag) or !state.hasSmoothed()) {
781  ATH_MSG_VERBOSE("The state was tagged as an outlier or was missed in the reverse filtering, use filtered parameters");
782  const Acts::BoundTrackParameters actsParam(state.referenceSurface().getSharedPtr(),
783  state.filtered(),
784  state.filteredCovariance(),
785  acts_track.particleHypothesis());
786  parm = m_ATLASConverterTool->actsTrackParametersToTrkParameters(actsParam, tgContext);
787  typePattern.set(Trk::TrackStateOnSurface::Outlier);
788  }
789  // The state is a measurement state, use smoothed parameters
790  else{
791  ATH_MSG_VERBOSE("The state is a measurement state, use smoothed parameters");
792 
793  const Acts::BoundTrackParameters actsParam(state.referenceSurface().getSharedPtr(),
794  state.smoothed(),
795  state.smoothedCovariance(),
796  acts_track.particleHypothesis());
797 
798  actsSmoothedParam.push_back(std::make_unique<const Acts::BoundTrackParameters>(Acts::BoundTrackParameters(actsParam)));
799  parm = m_ATLASConverterTool->actsTrackParametersToTrkParameters(actsParam, tgContext);
800  typePattern.set(Trk::TrackStateOnSurface::Measurement);
801  }
802  std::unique_ptr<Trk::MeasurementBase> measState;
803  if (state.hasUncalibratedSourceLink() && !SourceLinkType){
804  auto sl = state.getUncalibratedSourceLink().template get<ATLASSourceLink>();
805  assert(sl);
806  measState = sl->uniqueClone();
807  }
808  else if (state.hasUncalibratedSourceLink() && SourceLinkType){ //If the SourceLink is of type PRDSourceLink, we need to create the RIO_OnTrack here.
809  auto sl = state.getUncalibratedSourceLink().template get<PRDSourceLink>().prd;
810 
811  //ROT creation
812  const IdentifierHash idHash = sl->detectorElement()->identifyHash();
813  int dim = state.calibratedSize();
814  std::unique_ptr<Trk::RIO_OnTrack> rot;
815  if (dim == 1) {
816  const InDet::SCT_Cluster* sct_Cluster = dynamic_cast<const InDet::SCT_Cluster*>(sl);
817  if(!sct_Cluster){
818  ATH_MSG_ERROR("ERROR could not cast PRD to SCT_Cluster");
819  return;
820  }
821  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);
822  }
823  else if (dim == 2) {
824  const InDet::PixelCluster* pixelCluster = dynamic_cast<const InDet::PixelCluster*>(sl);
825  if(!pixelCluster){
826  //sometimes even with dim=2, only the SCT_Cluster implementation work for RIO_OnTrack creation
827  ATH_MSG_VERBOSE("Dimension is 2 but we need SCT_Cluster for this measurment");
828  const InDet::SCT_Cluster* sct_Cluster = dynamic_cast<const InDet::SCT_Cluster*>(sl);
829  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);
830  }
831  else{
832  rot = std::make_unique<InDet::PixelClusterOnTrack>(pixelCluster,Trk::LocalParameters(state.template calibrated<2>()),state.template calibratedCovariance<2>(),idHash);
833  }
834  }
835  else {
836  throw std::domain_error("Cannot handle measurement dim>2");
837  }
838  measState = rot->uniqueClone();
839  }
840  double nDoF = state.calibratedSize();
841  auto quality =Trk::FitQualityOnSurface(state.chi2(), nDoF);
842  const Trk::TrackStateOnSurface *perState = new Trk::TrackStateOnSurface(quality, std::move(measState), std::move(parm), nullptr, typePattern);
843  // If a state was succesfully created add it to the trajectory
844  if (perState) {
845  ATH_MSG_VERBOSE("State succesfully creates, adding it to the trajectory");
846  finalTrajectory->insert(finalTrajectory->begin(), perState);
847  }
848  });
849  // Convert the perigee state and add it to the trajectory
850  const Acts::BoundTrackParameters actsPer(acts_track.referenceSurface().getSharedPtr(),
851  acts_track.parameters(),
852  acts_track.covariance(),
853  acts_track.particleHypothesis());
854  std::unique_ptr<Trk::TrackParameters> per = m_ATLASConverterTool->actsTrackParametersToTrkParameters(actsPer, tgContext);
855  std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern;
856  typePattern.set(Trk::TrackStateOnSurface::Perigee);
857  const Trk::TrackStateOnSurface *perState = new Trk::TrackStateOnSurface(nullptr, std::move(per), nullptr, typePattern);
858  if (perState) finalTrajectory->insert(finalTrajectory->begin(), perState);
859 
860  // Create the track using the states
862  newInfo.setTrackFitter(Trk::TrackInfo::TrackFitter::KalmanFitter); //Mark the fitter as KalmanFitter
863  newtrack = std::make_unique<Trk::Track>(newInfo, std::move(finalTrajectory), nullptr);
864  if (newtrack) {
865  // Create the track summary and update the holes information
866  if (!newtrack->trackSummary()) {
867  newtrack->setTrackSummary(std::make_unique<Trk::TrackSummary>());
868  newtrack->trackSummary()->update(Trk::numberOfPixelHoles, 0);
869  newtrack->trackSummary()->update(Trk::numberOfSCTHoles, 0);
870  newtrack->trackSummary()->update(Trk::numberOfTRTHoles, 0);
871  newtrack->trackSummary()->update(Trk::numberOfPixelDeadSensors, numberOfDeadPixel);
872  newtrack->trackSummary()->update(Trk::numberOfSCTDeadSensors, numberOfDeadSCT);
873  }
874  m_trkSummaryTool->updateTrackSummary(ctx, *newtrack, true);
875  }
876  return newtrack;
877 }
878 
879 std::unique_ptr< ActsTrk::MutableTrackContainer >
880 KalmanFitterTool::fit(const EventContext& ctx,
881  const ActsTrk::Seed &seed,
882  const Acts::BoundTrackParameters& initialParams,
883  const Acts::GeometryContext& tgContext,
884  const Acts::MagneticFieldContext& mfContext,
885  const Acts::CalibrationContext& calContext,
886  const DetectorElementToActsGeometryIdMap &detectorElementToGeometryIdMap) const
887 {
888  const Acts::TrackingGeometry *
889  actsTrackingGeometry = m_trackingGeometryTool->trackingGeometry().get();
890  if (!actsTrackingGeometry) {
891  throw std::runtime_error("No Acts tracking geometry.");
892  }
893 
894  std::vector<ActsTrk::ATLASUncalibSourceLink> sourceLinks;
895  sourceLinks.reserve(6);
896 
897  std::vector<const Acts::Surface*> surfaces;
898  surfaces.reserve(6);
899 
900  const auto& sps = seed.sp();
901  for (const xAOD::SpacePoint* sp : sps) {
902  const auto& measurements = sp->measurements();
903  for (const xAOD::UncalibratedMeasurement *umeas : measurements) {
905  sourceLinks.emplace_back( el );
906  surfaces.push_back(ActsTrk::getSurfaceOfMeasurement(*actsTrackingGeometry, detectorElementToGeometryIdMap, *umeas));
907  }
908  }
909  return fit(ctx, sourceLinks, initialParams, tgContext, mfContext, calContext, detectorElementToGeometryIdMap, surfaces.front());
910 }
911 
912 }
Trk::noHypothesis
@ noHypothesis
Definition: ParticleHypothesis.h:37
Trk::LocalParameters
Definition: LocalParameters.h:98
SCT_ClusterOnTrack.h
ActsTrk::PRDSourceLinkSurfaceAccessor::converterTool
const ActsTrk::IActsToTrkConverterTool * converterTool
Definition: KalmanFitterTool.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
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
ActsTrk::KalmanFitterTool::m_option_maxPropagationStep
Gaudi::Property< int > m_option_maxPropagationStep
Definition: KalmanFitterTool.h:195
yodamerge_tmp.dim
dim
Definition: yodamerge_tmp.py:239
get_generator_info.result
result
Definition: get_generator_info.py:21
TrackParameters.h
ActsTrk::KalmanFitterTool::logger
const Acts::Logger & logger() const
Private access to the logger.
Definition: KalmanFitterTool.h:215
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: KalmanFitterTool.h:76
ActsTrk::KalmanFitterTool::KalmanFitterTool
KalmanFitterTool(const std::string &, const std::string &, const IInterface *)
Definition: KalmanFitterTool.cxx:169
ActsGeometryContext.h
ActsTrk::PRDSourceLinkCalibrator::converterTool
const ActsTrk::IActsToTrkConverterTool * converterTool
Definition: KalmanFitterTool.h:78
PixelCluster.h
ActsTrk::detail::Navigator
Acts::Navigator Navigator
Definition: Tracking/Acts/ActsTrackReconstruction/src/detail/Definitions.h:31
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::KalmanFitterTool::m_fitter
std::unique_ptr< Fitter > m_fitter
Definition: KalmanFitterTool.h:204
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
ActsTrk::KalmanFitterTool::m_ROTcreator
ToolHandle< Trk::IRIO_OnTrackCreator > m_ROTcreator
Definition: KalmanFitterTool.h:223
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: KalmanFitterTool.h:77
ActsTrk::KalmanFitterTool::initialize
virtual StatusCode initialize() override
Definition: KalmanFitterTool.cxx:175
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
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::KalmanFitterTool::m_directFitter
std::unique_ptr< DirectFitter > m_directFitter
Definition: KalmanFitterTool.h:207
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
ActsTrk::KalmanFitterTool::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: KalmanFitterTool.cxx:228
Track.h
ActsTrk::KalmanFitterTool::m_outlierFinder
ActsTrk::detail::FitterHelperFunctions::ATLASOutlierFinder m_outlierFinder
Definition: KalmanFitterTool.h:211
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
OnTrackCalibrator.h
ActsTrk::KalmanFitterTool::m_extrapolationTool
ToolHandle< IActsExtrapolationTool > m_extrapolationTool
Definition: KalmanFitterTool.h:182
ActsTrk::KalmanFitterTool::m_trkSummaryTool
ToolHandle< Trk::IExtendedTrackSummaryTool > m_trkSummaryTool
Definition: KalmanFitterTool.h:185
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
ActsTrk::KalmanFitterTool::m_logger
std::unique_ptr< const Acts::Logger > m_logger
logging instance
Definition: KalmanFitterTool.h:220
lumiFormat.i
int i
Definition: lumiFormat.py:85
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
ActsTrk::KalmanFitterTool::m_calibrator
std::unique_ptr< ActsTrk::detail::TrkMeasurementCalibrator > m_calibrator
Definition: KalmanFitterTool.h:200
master.flag
bool flag
Definition: master.py:29
ActsTrk::KalmanFitterTool::m_option_outlierChi2Cut
Gaudi::Property< double > m_option_outlierChi2Cut
Definition: KalmanFitterTool.h:191
ActsTrk::KalmanFitterTool::m_option_seedCovarianceScale
Gaudi::Property< double > m_option_seedCovarianceScale
Definition: KalmanFitterTool.h:197
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::KalmanFitterTool::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: KalmanFitterTool.cxx:696
ActsTrk::PRDSourceLinkCalibrator
Definition: KalmanFitterTool.h:69
TrackSummary.h
Trk::ParametersBase
Definition: ParametersBase.h:55
InDet::SCT_Cluster
Definition: InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/SCT_Cluster.h:34
ActsTrk::KalmanFitterTool::m_ATLASConverterTool
ToolHandle< ActsTrk::IActsToTrkConverterTool > m_ATLASConverterTool
Definition: KalmanFitterTool.h:184
ActsTrk::KalmanFitterTool::m_doReFitFromPRD
Gaudi::Property< bool > m_doReFitFromPRD
Definition: KalmanFitterTool.h:225
MuonValidation_CreateResolutionProfiles.fit
def fit(h, emin, emax)
Definition: MuonValidation_CreateResolutionProfiles.py:69
ActsTrk::KalmanFitterTool::m_kfExtensions
Acts::KalmanFitterExtensions< ActsTrk::MutableTrackStateBackend > m_kfExtensions
Definition: KalmanFitterTool.h:209
ActsTrk::KalmanFitterTool::m_broadROTcreator
ToolHandle< Trk::IRIO_OnTrackCreator > m_broadROTcreator
Definition: KalmanFitterTool.h:222
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:228
RIO_OnTrack.h
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
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::KalmanFitterTool::m_reverseFilteringLogic
ActsTrk::detail::FitterHelperFunctions::ReverseFilteringLogic m_reverseFilteringLogic
Definition: KalmanFitterTool.h:212
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
KalmanFitterTool.h
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: KalmanFitterTool.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: KalmanFitterTool.cxx:162
Trk::qOverP
@ qOverP
perigee
Definition: ParamDefs.h:67
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:567
ActsTrk::PRDSourceLinkSurfaceAccessor
Definition: KalmanFitterTool.h:81
ATLASSourceLinkSurfaceAccessor.h
ActsTrk::KalmanFitterTool::m_trackingGeometryTool
ToolHandle< IActsTrackingGeometryTool > m_trackingGeometryTool
Definition: KalmanFitterTool.h:183
Trk::SurfaceType::Plane
@ Plane
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MuonDetectorBuilderTool.cxx:54
Trk::phi
@ phi
Definition: ParamDefs.h:75
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
ActsTrk::detail::OnTrackCalibrator
Definition: IOnTrackCalibratorTool.h:14
ActsTrk::ATLASUncalibSourceLinkSurfaceAccessor
Definition: ATLASSourceLinkSurfaceAccessor.h:26
ActsTrk::KalmanFitterTool::m_option_ReverseFilteringPt
Gaudi::Property< double > m_option_ReverseFilteringPt
Definition: KalmanFitterTool.h:193
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
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...