Public Member Functions | Private Attributes | List of all members
beamlinereco::Kalman Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-12-03/BeamlineReco/KalmanFilterAlg.h"

Public Member Functions

 Kalman (double process_noise, double sensor_noise, double estimated_error, double intial_value)
 
double GetFilteredValue (double measurement)
 
void SetParameters (double process_noise, double sensor_noise, double estimated_error)
 
void SetParameters (double process_noise, double sensor_noise)
 
double GetProcessNoise ()
 
double GetSensorNoise ()
 
double GetEstimatedError ()
 

Private Attributes

double q
 
double r
 
double x
 
double p
 
double k
 

Detailed Description

Definition at line 14 of file KalmanFilterAlg.h.

Constructor & Destructor Documentation

beamlinereco::Kalman::Kalman ( double  process_noise,
double  sensor_noise,
double  estimated_error,
double  intial_value 
)
inline

Definition at line 24 of file KalmanFilterAlg.h.

24  {
25  /* The variables are x for the filtered value, q for the process noise,
26  r for the sensor noise, p for the estimated error and k for the Kalman Gain.
27  The state of the filter is defined by the values of these variables.
28 
29  The initial values for p is not very important since it is adjusted
30  during the process. It must be just high enough to narrow down.
31  The initial value for the readout is also not very important, since
32  it is updated during the process.
33  But tweaking the values for the process noise and sensor noise
34  is essential to get clear readouts.
35 
36  For large noise reduction, you can try to start from: (see http://interactive-matter.eu/blog/2009/12/18/filtering-sensor-data-with-a-kalman-filter/ )
37  q = 0.125
38  r = 32
39  p = 1023 //"large enough to narrow down"
40  e.g.
41  myVar = Kalman(0.125,32,1023,0);
42  */
43  this->q = process_noise;
44  this->r = sensor_noise;
45  this->p = estimated_error;
46  this->x = intial_value; //x will hold the iterated filtered value
47  }
const char * p
Definition: xmltok.h:285

Member Function Documentation

double beamlinereco::Kalman::GetEstimatedError ( )
inline

Definition at line 82 of file KalmanFilterAlg.h.

References p.

82  {
83  return this->p;
84  }
double beamlinereco::Kalman::GetFilteredValue ( double  measurement)
inline

Definition at line 49 of file KalmanFilterAlg.h.

References k, q, r, and x.

Referenced by beamlinereco::CFDHitFinder< T >::SetWaveform().

49  {
50  /* Updates and gets the current measurement value */
51  //prediction update
52  //omit x = x
53  this->p = this->p + this->q;
54 
55  //measurement update
56  this->k = this->p / (this->p + this->r);
57  this->x = this->x + this->k * (measurement - this->x);
58  this->p = (1 - this->k) * this->p;
59 
60  return this->x;
61  }
const char * p
Definition: xmltok.h:285
double beamlinereco::Kalman::GetProcessNoise ( )
inline

Definition at line 74 of file KalmanFilterAlg.h.

References q.

74  {
75  return this->q;
76  }
double beamlinereco::Kalman::GetSensorNoise ( )
inline

Definition at line 78 of file KalmanFilterAlg.h.

References r.

78  {
79  return this->r;
80  }
void beamlinereco::Kalman::SetParameters ( double  process_noise,
double  sensor_noise,
double  estimated_error 
)
inline

Definition at line 63 of file KalmanFilterAlg.h.

63  {
64  this->q = process_noise;
65  this->r = sensor_noise;
66  this->p = estimated_error;
67  }
const char * p
Definition: xmltok.h:285
void beamlinereco::Kalman::SetParameters ( double  process_noise,
double  sensor_noise 
)
inline

Definition at line 69 of file KalmanFilterAlg.h.

69  {
70  this->q = process_noise;
71  this->r = sensor_noise;
72  }

Member Data Documentation

double beamlinereco::Kalman::k
private

Definition at line 21 of file KalmanFilterAlg.h.

Referenced by GetFilteredValue().

double beamlinereco::Kalman::p
private

Definition at line 20 of file KalmanFilterAlg.h.

Referenced by GetEstimatedError().

double beamlinereco::Kalman::q
private

Definition at line 17 of file KalmanFilterAlg.h.

Referenced by GetFilteredValue(), and GetProcessNoise().

double beamlinereco::Kalman::r
private

Definition at line 18 of file KalmanFilterAlg.h.

Referenced by GetFilteredValue(), and GetSensorNoise().

double beamlinereco::Kalman::x
private

The documentation for this class was generated from the following file: