ATLAS Offline Software
KalmanUpdator_xk.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // KalmanUpdator_xk.h
7 // Header file for Kalman Fitter Updator
9 // (c) ATLAS Detector software
11 // Version 1.0 7/6/2005 I.Gavrilenko
13 
14 #ifndef TRK_KALMANUPDATOR_XK_H
15 #define TRK_KALMANUPDATOR_XK_H
16 
20 
21 namespace Trk {
22 
31  class LocalParameters ;
32  class PatternTrackParameters;
33 
34  class KalmanUpdator_xk final: virtual public IUpdator,
35  virtual public IPatternParametersUpdator,
36  public AthAlgTool
37  {
39  // Public methods:
41 
42  public:
43 
45  // Standard Athena tool methods
47 
48  KalmanUpdator_xk(const std::string&, const std::string&,
49  const IInterface*);
50  virtual ~KalmanUpdator_xk();
51  virtual StatusCode initialize() override final;
52  virtual StatusCode finalize() override final;
53 
54  // /////////////////////////////////////////////////////////////////
55  // Main public methods for kalman filter updator tool
56  // /////////////////////////////////////////////////////////////////
57 
58  // /////////////////////////////////////////////////////////////////
59  // Add and remove without Xi2 calculation
60  // /////////////////////////////////////////////////////////////////
61 
63  virtual std::unique_ptr<TrackParameters> addToState(
65  const Amg::MatrixX&) const override final;
67  virtual std::unique_ptr<TrackParameters> addToState(
69  const Amg::MatrixX&) const override final;
70 
73  const Amg::MatrixX&,
74  PatternTrackParameters&) const override final;
77  const Amg::MatrixX&,
78  PatternTrackParameters&) const override final;
81  virtual bool addToStateOneDimension(
83  PatternTrackParameters&) const override final;
84 
86  // Remove without Xi2 calculation
88 
89  virtual std::unique_ptr<TrackParameters> removeFromState(
91  const Amg::MatrixX&) const override final;
92  virtual std::unique_ptr<TrackParameters> removeFromState(
94  const Amg::MatrixX&) const override final;
95 
97  const Amg::MatrixX&,
98  PatternTrackParameters&) const override final;
101  PatternTrackParameters&) const override final;
102 
104  // Add with Xi2 calculation
106 
107  virtual std::unique_ptr<TrackParameters> addToState(
109  FitQualityOnSurface*&) const override final;
110  virtual std::unique_ptr<TrackParameters> addToState(
112  FitQualityOnSurface*&) const override final;
113  virtual std::pair<AmgVector(5), AmgSymMatrix(5)>*
115  const Amg::VectorX&, const Amg::MatrixX&, int,
117  bool) const override final;
118 
121  double&, int&) const override final;
124  double&, int&) const override final;
126  const Amg::Vector2D&,
127  const Amg::MatrixX&,
128  PatternTrackParameters&, double&,
129  int&) const override final;
130 
132  // Remove with Xi2 calculation
134 
135  virtual std::unique_ptr<TrackParameters> removeFromState(
137  FitQualityOnSurface*&) const override final;
138  virtual std::unique_ptr<TrackParameters> removeFromState(
140  FitQualityOnSurface*&) const override final;
141 
144  double&, int&) const override final;
147  PatternTrackParameters&, double&,
148  int&) const override;
149 
151  // Combine two state with or without Xi2 calculation
153 
154  virtual std::unique_ptr<TrackParameters> combineStates(
155  const TrackParameters&, const TrackParameters&) const override final;
156  virtual std::unique_ptr<TrackParameters> combineStates(
158  FitQualityOnSurface*&) const override final;
159 
162  PatternTrackParameters&) const override final;
166  double&) const override final;
167 
169  // Xi2 calculation
171 
174  const Amg::MatrixX&) const override final;
177  const Amg::MatrixX&) const override final;
180  const Amg::MatrixX&) const override final;
183  const Amg::MatrixX&) const override final;
185  const TrackParameters&, const TrackParameters&) const override final;
186 
188  const Amg::Vector2D&,
189  const Amg::MatrixX&, int&,
190  double&) const override final;
193  const Amg::MatrixX&, int&,
194  double&) const override final;
197  int&, double&) const override final;
200  const Amg::MatrixX&, int&,
201  double&) const override final;
204  double&) const override final;
205 
207  // let the client tools know how the assumptions on the initial
208  // precision for non-measured track parameters are configured
210 
211  virtual std::vector<double> initialErrors() const override final;
212 
213  protected:
214 
216  // Protected methods
218 
220  // Updators
222 
223  std::unique_ptr<TrackParameters> update
225  FitQualityOnSurface*&,int,bool) const;
226 
227  std::unique_ptr<TrackParameters> update
229  FitQualityOnSurface*&,int,bool) const;
230 
231  bool update
233  int,bool,PatternTrackParameters&,double&,int&) const;
234 
235  bool updateOneDimension
237  int,bool,PatternTrackParameters&,double&) const;
238 
239  bool update
241  int,bool,PatternTrackParameters&,double&,int&) const;
242 
244  // Xi2 calculation
246 
247  static bool predictedStateFitQuality
248  (const double*,const Amg::Vector2D&,const Amg::MatrixX&,int&,double&) ;
249 
250  static bool fullStateFitQuality
251  (const double*,const Amg::Vector2D&,const Amg::MatrixX&,int&,double&) ;
252 
254  // Converters
256 
257  static bool trackParametersToUpdator
258  (const TrackParameters&,double*,double*) ;
259 
260  static bool trackParametersToUpdator
261  (const PatternTrackParameters&,double*,double*) ;
262 
263  static bool localParametersToUpdator
264  (const LocalParameters&,const Amg::MatrixX&,int&,int&,double*,double*) ;
265 
266  static std::unique_ptr<TrackParameters> updatorToTrackParameters
267  (const TrackParameters&,double*,double*) ;
268 
270  // Update no measured track parameters
272 
274  (const double*,const double*,double*,double*) const;
275 
277  (const double*,const double*,double*,double*) const;
278 
280  (const double*,const double*,double*,double*,int) const;
281 
283  // Update measured track parameters
285 
286  static bool updateWithOneDim
287  (int,bool,const double*,const double*,double*,double*,double&) ;
288 
289  static bool updateWithTwoDim
290  (int,bool,const double*,const double*,double*,double*,double&) ;
291 
292  static bool updateWithTwoDimParameters
293  (int,bool,const double*,const double*,double*,const double*,double&) ;
294 
295  static bool updateWithFiveDim
296  ( bool,double*,double*,double*,double*,double&) ;
297 
298  bool updateWithAnyDim
299  (int,bool,double*,const double*,double*,double*,double&,
300  int,int) const;
301 
303  (int,bool,double*,double*,double*,double*,double&) const;
304 
306  (int,bool,double*,double*,double*,double*,double&) const;
307 
308  static bool invert (int,double*,double*) ;
309  static bool invert2( const double*,double*) ;
310  static bool invert3( const double*,double*) ;
311  static bool invert4( const double*,double*) ;
312  static bool invert5( const double*,double*) ;
313 
314  static double Xi2 (int,double*,double*) ;
315  static double Xi2for1( const double*,const double*) ;
316  static double Xi2for2( const double*,const double*) ;
317  static double Xi2for3( const double*,const double*) ;
318  static double Xi2for4( const double*,const double*) ;
319  static double Xi2for5( const double*,const double*) ;
320 
321  static int differenceParLoc(int,const double*,const double*,double*) ;
322  static void differenceLocPar(int,const double*,const double*,double*) ;
323  static void testAngles(double*,double*) ;
324 
325  void mapKeyProduction();
326 
328  // Protected data members
330 
331  std::vector<double> m_cov0;
332  unsigned int m_key[ 33]{};
333  unsigned int m_map[160]{};
335  };
336 
338  // Inline methods
340 
341 } // end of namespace
342 
343 #endif // TRK_KALMANUPDATOR_XK_H
Trk::LocalParameters
Definition: LocalParameters.h:98
Trk::KalmanUpdator_xk::differenceParLoc
static int differenceParLoc(int, const double *, const double *, double *)
Definition: KalmanUpdator_xk.cxx:2241
Amg::VectorX
Eigen::Matrix< double, Eigen::Dynamic, 1 > VectorX
Dynamic Vector - dynamic allocation.
Definition: EventPrimitives.h:30
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:27
Trk::KalmanUpdator_xk::updateWithTwoDim
static bool updateWithTwoDim(int, bool, const double *, const double *, double *, double *, double &)
Definition: KalmanUpdator_xk.cxx:1418
Trk::KalmanUpdator_xk::updateWithTwoDimWithBoundary
bool updateWithTwoDimWithBoundary(int, bool, double *, double *, double *, double *, double &) const
Definition: KalmanUpdator_xk.cxx:1542
Trk::KalmanUpdator_xk::initialErrors
virtual std::vector< double > initialErrors() const override final
let the client tools know how the assumptions on the initial precision for non-measured track paramet...
Definition: KalmanUpdator_xk.cxx:825
Trk::KalmanUpdator_xk::Xi2
static double Xi2(int, double *, double *)
Definition: KalmanUpdator_xk.cxx:2156
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
Trk::KalmanUpdator_xk::invert3
static bool invert3(const double *, double *)
Definition: KalmanUpdator_xk.cxx:1984
Trk::KalmanUpdator_xk::fullStateFitQuality
virtual FitQualityOnSurface fullStateFitQuality(const TrackParameters &, const Amg::Vector2D &, const Amg::MatrixX &) const override final
estimator for FitQuality on Surface from a full track state, that is a state which contains the curre...
Definition: KalmanUpdator_xk.cxx:625
Trk::KalmanUpdator_xk::m_key
unsigned int m_key[33]
Definition: KalmanUpdator_xk.h:332
Trk::KalmanUpdator_xk::testAngles
static void testAngles(double *, double *)
Definition: KalmanUpdator_xk.cxx:2318
Trk::KalmanUpdator_xk::m_cov0
std::vector< double > m_cov0
Definition: KalmanUpdator_xk.h:331
Trk::KalmanUpdator_xk::invert
static bool invert(int, double *, double *)
Definition: KalmanUpdator_xk.cxx:1944
Trk::KalmanUpdator_xk::updateWithOneDimWithBoundary
bool updateWithOneDimWithBoundary(int, bool, double *, double *, double *, double *, double &) const
Definition: KalmanUpdator_xk.cxx:1351
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
Trk::KalmanUpdator_xk::updateWithAnyDim
bool updateWithAnyDim(int, bool, double *, const double *, double *, double *, double &, int, int) const
Definition: KalmanUpdator_xk.cxx:1724
Trk::KalmanUpdator_xk::m_covBoundary
double m_covBoundary
Definition: KalmanUpdator_xk.h:334
Trk::KalmanUpdator_xk::updateWithTwoDimParameters
static bool updateWithTwoDimParameters(int, bool, const double *, const double *, double *, const double *, double &)
Definition: KalmanUpdator_xk.cxx:1490
protected
#define protected
Definition: DetDescrConditionsDict_dict_fixes.cxx:14
Trk::KalmanUpdator_xk::updateNoMeasuredWithTwoDim
bool updateNoMeasuredWithTwoDim(const double *, const double *, double *, double *) const
Definition: KalmanUpdator_xk.cxx:1227
IUpdator.h
Trk::KalmanUpdator_xk::combineStates
virtual std::unique_ptr< TrackParameters > combineStates(const TrackParameters &, const TrackParameters &) const override final
adds to a track state the parameters from another state using a statistical combination - use with ca...
Definition: KalmanUpdator_xk.cxx:399
Trk::KalmanUpdator_xk::update
std::unique_ptr< TrackParameters > update(const TrackParameters &, const Amg::Vector2D &, const Amg::MatrixX &, FitQualityOnSurface *&, int, bool) const
Definition: KalmanUpdator_xk.cxx:847
Trk::IPatternParametersUpdator
Interface for updating Trk::PatternTrackParameters, the fast internal representation of track paramet...
Definition: IPatternParametersUpdator.h:40
Trk::AmgSymMatrix
AmgSymMatrix(5) &GXFTrackState
Definition: GXFTrackState.h:156
Trk::FitQualityOnSurface
Definition: FitQualityOnSurface.h:19
Trk::KalmanUpdator_xk::Xi2for1
static double Xi2for1(const double *, const double *)
Definition: KalmanUpdator_xk.cxx:2171
IPatternParametersUpdator.h
Trk::KalmanUpdator_xk::m_map
unsigned int m_map[160]
Definition: KalmanUpdator_xk.h:333
Trk::KalmanUpdator_xk::finalize
virtual StatusCode finalize() override final
Definition: KalmanUpdator_xk.cxx:75
Trk::KalmanUpdator_xk::updatorToTrackParameters
static std::unique_ptr< TrackParameters > updatorToTrackParameters(const TrackParameters &, double *, double *)
Definition: KalmanUpdator_xk.cxx:1924
Trk::KalmanUpdator_xk::updateNoMeasuredWithOneDim
bool updateNoMeasuredWithOneDim(const double *, const double *, double *, double *) const
Definition: KalmanUpdator_xk.cxx:1199
Trk::KalmanUpdator_xk::trackParametersToUpdator
static bool trackParametersToUpdator(const TrackParameters &, double *, double *)
Definition: KalmanUpdator_xk.cxx:1812
Trk::KalmanUpdator_xk::KalmanUpdator_xk
KalmanUpdator_xk(const std::string &, const std::string &, const IInterface *)
Definition: KalmanUpdator_xk.cxx:24
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
vector
Definition: MultiHisto.h:13
AmgVector
AmgVector(4) T2BSTrackFilterTool
Definition: T2BSTrackFilterTool.cxx:114
AthAlgTool.h
Trk::KalmanUpdator_xk::addToStateOneDimension
virtual bool addToStateOneDimension(PatternTrackParameters &, const Amg::Vector2D &, const Amg::MatrixX &, PatternTrackParameters &) const override final
add without chi2 calculation, PRD-level, pattern track parameters, specifically 1D
Definition: KalmanUpdator_xk.cxx:109
Trk::KalmanUpdator_xk::updateWithFiveDim
static bool updateWithFiveDim(bool, double *, double *, double *, double *, double &)
Definition: KalmanUpdator_xk.cxx:1621
Trk::KalmanUpdator_xk::Xi2for4
static double Xi2for4(const double *, const double *)
Definition: KalmanUpdator_xk.cxx:2209
Trk::ParametersBase
Definition: ParametersBase.h:55
Trk::KalmanUpdator_xk::invert5
static bool invert5(const double *, double *)
Definition: KalmanUpdator_xk.cxx:2069
Trk::KalmanUpdator_xk::Xi2for3
static double Xi2for3(const double *, const double *)
Definition: KalmanUpdator_xk.cxx:2195
Trk::KalmanUpdator_xk::~KalmanUpdator_xk
virtual ~KalmanUpdator_xk()
Trk::KalmanUpdator_xk::differenceLocPar
static void differenceLocPar(int, const double *, const double *, double *)
Definition: KalmanUpdator_xk.cxx:2271
Trk::KalmanUpdator_xk::addToState
virtual std::unique_ptr< TrackParameters > addToState(const TrackParameters &, const Amg::Vector2D &, const Amg::MatrixX &) const override final
add without chi2 calculation, PRD-level, EDM track parameters
Definition: KalmanUpdator_xk.cxx:85
Trk::KalmanUpdator_xk::predictedStateFitQuality
virtual FitQualityOnSurface predictedStateFitQuality(const TrackParameters &, const Amg::Vector2D &, const Amg::MatrixX &) const override final
estimator for FitQuality on Surface from a predicted track state, that is a state which does not cont...
Definition: KalmanUpdator_xk.cxx:509
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::KalmanUpdator_xk::updateWithOneDim
static bool updateWithOneDim(int, bool, const double *, const double *, double *, double *, double &)
Definition: KalmanUpdator_xk.cxx:1293
Amg
Definition of ATLAS Math & Geometry primitives (Amg)
Definition: AmgStringHelpers.h:19
Trk::KalmanUpdator_xk::mapKeyProduction
void mapKeyProduction()
Definition: KalmanUpdator_xk.cxx:2295
Trk::KalmanUpdator_xk::updateNoMeasuredWithAnyDim
bool updateNoMeasuredWithAnyDim(const double *, const double *, double *, double *, int) const
Definition: KalmanUpdator_xk.cxx:1258
Trk::KalmanUpdator_xk::updateParameterDifference
virtual std::pair< AmgVector(5), AmgSymMatrix(5)> * updateParameterDifference(const AmgVector(5) &, const AmgSymMatrix(5) &, const Amg::VectorX &, const Amg::MatrixX &, int, Trk::FitQualityOnSurface *&, bool) const override final
pure AMG interface for reference-track KF, allowing update of parameter differences
Definition: KalmanUpdator_xk.cxx:281
Trk::IUpdator
Set of interfaces for methods operating on track states, mainly for Kalman filtering.
Definition: IUpdator.h:64
Trk::KalmanUpdator_xk::Xi2for2
static double Xi2for2(const double *, const double *)
Definition: KalmanUpdator_xk.cxx:2182
Trk::KalmanUpdator_xk::invert4
static bool invert4(const double *, double *)
Definition: KalmanUpdator_xk.cxx:2014
Trk::KalmanUpdator_xk::localParametersToUpdator
static bool localParametersToUpdator(const LocalParameters &, const Amg::MatrixX &, int &, int &, double *, double *)
Definition: KalmanUpdator_xk.cxx:1888
Trk::KalmanUpdator_xk::Xi2for5
static double Xi2for5(const double *, const double *)
Definition: KalmanUpdator_xk.cxx:2224
Trk::KalmanUpdator_xk::initialize
virtual StatusCode initialize() override final
Definition: KalmanUpdator_xk.cxx:53
Trk::PatternTrackParameters
Definition: PatternTrackParameters.h:32
Trk::KalmanUpdator_xk
Definition: KalmanUpdator_xk.h:37
Trk::KalmanUpdator_xk::updateOneDimension
bool updateOneDimension(PatternTrackParameters &, const Amg::Vector2D &, const Amg::MatrixX &, int, bool, PatternTrackParameters &, double &) const
Definition: KalmanUpdator_xk.cxx:963
AthAlgTool
Definition: AthAlgTool.h:26
Trk::KalmanUpdator_xk::invert2
static bool invert2(const double *, double *)
Definition: KalmanUpdator_xk.cxx:1963
Trk::KalmanUpdator_xk::removeFromState
virtual std::unique_ptr< TrackParameters > removeFromState(const TrackParameters &, const Amg::Vector2D &, const Amg::MatrixX &) const override final
the reverse updating or inverse KalmanFilter removes a measurement from the track state,...
Definition: KalmanUpdator_xk.cxx:123