UNDERSTANDING THE KALMAN FILTER

48
UNDERSTANDING THE KALMAN FILTER: TESTING ONATOY MONTE CARLO MODEL Presents: Federico Battisti

Transcript of UNDERSTANDING THE KALMAN FILTER

UNDERSTANDING THE KALMAN FILTER:

TESTING ON A TOY MONTE CARLO MODELPresents:

Federico Battisti

FEDERICOBATTISTI

OUTLINE

2

β€’ This presentation will cover a fairly complete description of our current Kalman Filter based

reconstruction algorithm together with some early findings from a Toy Monte Carlo study developed to

study the performance of said algorithm

β€’ The presentation will be divided into 4 main sections:

➒ Description of what Kinematic Fitting is

➒ Description of what a Kalman Filter is

➒ Description of our own algorithm (T. Junk, DUNE-Doc-13933 https://docs.dunescience.org/cgi-bin/private/ShowDocument?docid=13933), which is a convolution of a Kalman Filter and a

Kinematic Fitting algorithm

➒ Early findings from my Toy Monte Carlo study

FEDERICOBATTISTI

KINEMATIC FITTING

3

FEDERICOBATTISTI

KINEMATIC FITTING

4

π‘₯β„Žπ‘₯𝑓

(π‘₯β„Ž, π‘¦β„Ž)

𝑓

πœŽπ‘¦

𝜎π‘₯

(π‘₯𝑓, π‘¦β„Ž)

β€’ A new value for the x coordinate π‘₯𝑓

is calculated as an alternative to the

measured value π‘₯β„Ž

β€’ π‘₯𝑓 is taken such that the weighted

distance (in terms of 𝜎π‘₯ and πœŽπ‘¦)

between the model 𝑓 and the

measurement (π‘₯β„Ž, π‘¦β„Ž) is minimal.

β€’ In the limit case where πœŽπ‘¦ is very

large, this is equivalent to using the

measured π‘₯β„Ž

β€’ In the limit case where 𝜎π‘₯ is very

large, this is equivalent to using the π‘₯from the model (this is the case

shown in the diagram)

FEDERICOBATTISTI

KINEMATIC FITTING

5

β€’ Kinematic fitting is an algorithm that updates a measurement within error in the presence of a model

constraint.

β€’ An example of this sort of fit can be found in https://inspirehep.net/literature/1780811 where

kinematic fitting has been used in the context of neutrino-induced charged-current (CC) πœ‹0production on carbon, to improve the neutral pion momentum reconstruction

β€’ For more insights you can consult:

➒ https://www.phys.ufl.edu/~avery/fitting/kinfit_talk1.pdf

➒ http://www-hermes.desy.de/notes/pub/TALK/yaschenk.ColloqGlasgow.pdf

FEDERICOBATTISTI

KALMAN FILTER

6

FEDERICOBATTISTI

KALMAN FILTER IN GENERAL

7

β€’ A Kalman filter is an iterative algorithm which uses a system's physical laws of motion, known control inputs and

multiple sequential measurements to form an estimate of the system's varying quantities

β€’ At each step of the iteration an estimate of the state of the system is produced as a weighted average of the system's

predicted state and of the new measurement. The weights are calculated from the covariance.

β€’ The extended Kalman filter expands the Kalman filter technique to non-linear systems

β€’ The models for state transition and measurement can be written as:

π‘ π‘˜ = 𝑓 π‘ π‘˜βˆ’1, π‘‹π‘˜βˆ’1

β€’ Where 𝑓 is the function of the previous state, π‘ π‘˜βˆ’1 , and the free parameter, π‘‹π‘˜βˆ’1, that provides the current state π‘ π‘˜.

β€’ Note that the measurement vector π‘šπ‘˜β„Ž and the state vector π‘ π‘˜ do not necessarily have the same number of

components

π‘šπ‘˜β„Ž

STATE VECTOR

MEASUREMENT

VECTOR

FEDERICOBATTISTI

KALMAN FILTER IN GENERAL

8

1. Make a priori predictions for the current step’s state and covariance matrix using the a posteriori best estimate of

the previous step (i.e. updated using measurement)

π‘ π‘˜βˆ’ = 𝑓 π‘ π‘˜βˆ’1

+ , π‘‹π‘˜βˆ’1

π‘ƒπ‘˜βˆ’ = πΉπ‘˜βˆ’1π‘ƒπ‘˜βˆ’1

+ πΉπ‘˜βˆ’1𝑇 + 𝑄

πΉπ‘˜βˆ’1 = α‰€πœ•π‘“

πœ•π‘ π‘ π‘˜βˆ’1+ ,π‘‹π‘˜βˆ’1

𝑄

JACOBIAN PROCESS NOISE

COVARIANCE

STATE VECTOR

COVARIANCE MATRIX

Note: In the first iteration step we use step 0 estimates for the state vector and the covariance matrix (𝑠0, 𝑃0), which

can be made very roughly

FEDERICOBATTISTI

KALMAN FILTER IN GENERAL

9

2. Calculate the measurement residual and the Kalman Gain

π‘¦π‘˜ = π‘šπ‘˜β„Ž βˆ’ 𝐻(π‘ π‘˜

βˆ’)

πΎπ‘˜ = π‘ƒπ‘˜βˆ’π»π‘‡ 𝑅 + π»π‘ƒπ‘˜

βˆ’π»π‘‡ βˆ’1

3. Update the estimate

π‘ π‘˜+ = π‘ π‘˜

βˆ’ + πΎπ‘˜ 𝑦

π‘ƒπ‘˜+ = 1 βˆ’ πΎπ‘˜π» π‘ƒπ‘˜

βˆ’

RESIDUAL

KALMAN GAIN

STATE VECTOR

COVARIANCE MATRIX

𝑅

MEASUREMENT

NOISE COVARIANCE

𝐻

CONVERSION

MATRIX

Note: the conversion matrix is

needed to make the dimensions

of vectors and matrixes turn out

right. For exemple if π‘ π‘˜β„Ž is a 2-

D vector and π‘ π‘˜βˆ’ is 5-D, then H

would be a 2 Γ— 5 matrix:

𝐻 = (1 0 00 1 0

0 00 0

)

Note: in the case

where R is a null

matrix π‘ π‘˜+ = π‘ π‘˜

β„Ž

and π‘ƒπ‘˜+ = 0

FEDERICOBATTISTI

KALMAN FILTER IN GENERAL

10

(π‘₯0β„Ž, 𝑦0

β„Ž)

(π‘₯1β„Ž, 𝑦1

βˆ’)

(π‘₯1β„Ž, 𝑦1

β„Ž)

(π‘₯1β„Ž, 𝑦1

+)

(π‘₯2β„Ž, 𝑦2

+)

(π‘₯2β„Ž, 𝑦2

βˆ’) (π‘₯3β„Ž, 𝑦3

β„Ž) (π‘₯4β„Ž, 𝑦4

β„Ž)

(π‘₯3β„Ž, 𝑦3

+) (π‘₯4β„Ž, 𝑦4

+)

(π‘₯2β„Ž, 𝑦2

β„Ž) (π‘₯3β„Ž, 𝑦3

βˆ’)(π‘₯4

β„Ž, 𝑦4βˆ’)

π‘₯

𝑦

π‘₯1β„Ž π‘₯2

β„Ž π‘₯4β„Žπ‘₯3

β„Ž

FEDERICOBATTISTI

OUR RECONSTRUCTION ALGORITHMβ„’

11

T. Junk, DUNE-Doc-13933: https://docs.dunescience.org/cgi-bin/private/ShowDocument?docid=13933

FEDERICOBATTISTI

KINEMATIC FITTING

12

𝑑π‘₯1

π‘₯1β„Žπ‘₯1

𝑓

(π‘₯1β„Ž, 𝑦1

β„Ž)

𝑓

(π‘₯0𝑓, 𝑦0

𝑓)

β€’ In our case we use kinematic fitting

to determine the free parameter step

𝑑π‘₯π‘˜β€’ 𝑑π‘₯π‘˜ is taken such that a weighted

distance Ξ” (in terms of 𝜎π‘₯ and πœŽπ‘¦ =

πœŽπ‘§ = πœŽπ‘¦π‘§) between the model 𝑓 and

the measurement (π‘₯π‘˜β„Ž, π‘¦π‘˜

β„Ž) is

minimal.

β€’ In the limit case where πœŽπ‘¦π‘§ is very

large, this is equivalent to using the

measured π‘₯β„Ž

β€’ In the limit case where 𝜎π‘₯ is very

large, this is equivalent to using the

π‘₯ from the model (this is the case

shown in the diagram)

πœŽπ‘¦

𝜎π‘₯

(π‘₯1𝑓, 𝑦1

β„Ž)

FEDERICOBATTISTI

KINEMATIC FITTING

13

β€’ The quantity minimize in our kinematic fitting is the weighted distance Ξ” with 𝜎π‘₯, πœŽπ‘¦ = (0.5π‘π‘š, 1π‘π‘š):

Ξ”(𝑑π‘₯π‘˜; π‘₯π‘˜β„Ž, π‘¦π‘˜

β„Ž, π‘§π‘˜β„Ž, π‘₯π‘˜βˆ’1

𝑓, π‘¦π‘˜βˆ’1

+ , π‘§π‘˜βˆ’1+ , πœ†π‘˜βˆ’1

+ , πœ™π‘˜βˆ’1+ ) =

π‘₯π‘˜β„Ž βˆ’ π‘₯π‘˜

𝑓

𝜎π‘₯

2

+π‘¦π‘˜β„Ž βˆ’ π‘¦π‘˜

βˆ’

πœŽπ‘¦π‘§

2

+π‘§π‘˜β„Ž βˆ’ π‘§π‘˜

βˆ’

πœŽπ‘¦π‘§

2

=π‘₯π‘˜β„Ž βˆ’ π‘₯π‘˜βˆ’1

π‘“βˆ’ 𝑑π‘₯π‘˜

𝜎π‘₯

2

+π‘¦π‘˜β„Ž βˆ’ π‘¦π‘˜βˆ’1

+ βˆ’ 𝑑π‘₯π‘˜ Γ— cot πœ†π‘˜βˆ’1 Γ— sinπœ™π‘˜βˆ’1+

πœŽπ‘¦π‘§

2

+π‘§π‘˜β„Ž βˆ’ π‘§π‘˜βˆ’1

+ βˆ’ 𝑑π‘₯π‘˜ Γ— cot πœ†π‘˜βˆ’1 Γ— cosπœ™π‘˜βˆ’1+

πœŽπ‘¦π‘§

2

β€’ We determine 𝑑π‘₯π‘˜ by imposing that the derivative of Ξ” is equal to zero

𝑑π‘₯π‘˜ =

cot πœ†π‘˜βˆ’1+

πœŽπ‘¦π‘§2 π‘¦π‘˜

β„Ž βˆ’ π‘¦π‘˜βˆ’1+ sinπœ™π‘˜βˆ’1

+ + π‘§π‘˜β„Ž βˆ’ π‘§π‘˜βˆ’1

+ cosπœ™π‘˜βˆ’1+ +

π‘₯π‘˜β„Ž βˆ’ π‘₯π‘˜βˆ’1

𝑓

𝜎π‘₯2

ࡘcot2 πœ†π‘˜βˆ’1

+

πœŽπ‘¦π‘§2 + ΰ΅—1 𝜎π‘₯

2

dΞ”

d(𝑑π‘₯π‘˜)= 0

FEDERICOBATTISTI

OUR KALMAN FILTER: VISUALIZATION

14

𝑦0

𝑦1βˆ’

𝑦1β„Ž

𝑦1+

𝑦

π‘₯1β„Ž π‘₯2

β„Ž π‘₯3β„Žπ‘₯1

𝑓π‘₯2𝑓 π‘₯3

𝑓

Ξ”π‘šπ‘–π‘›

𝑑π‘₯π‘˜

π‘₯π‘˜β„Žπ‘₯π‘˜

𝑓

(π‘₯π‘˜β„Ž , π‘¦π‘˜

β„Ž)

𝑓(π‘₯π‘˜βˆ’1𝑓

, π‘¦π‘˜βˆ’1+ )

(π‘₯π‘˜βˆ’1𝑓

, π‘¦π‘˜βˆ’1+ )

KINEMATIC FITTING

STANDARD KALMAN FILTER

OUR KALMAN FILTERβ„’

+

=

π‘₯

FEDERICOBATTISTI

TOY MONTE CARLO STUDY

15

FEDERICOBATTISTI

TOY MONTE CARLO OUTLINE

β€’ We constructed a Toy Monte Carlo study as a sanity check for our current Kalman filterβ„’

β€’ The study will eventually develop in multiple steps:

➒ Use a perfect helix model with fixed step length to check the a priori model

➒ Use a perfect helix model with randomized step length (but no smearing)

➒ Add Gaussian error on π‘₯𝑦𝑧 (1D at a time, then 2D at a time, then fully 3D) to validate covariance and

calibrate πœ’2

➒ Use Cauchy smearing instead to test sensitivity to noise model

➒ Simulate Energy Loss etc..

β€’ The current presentation will cover the first two steps in the study

16

FEDERICOBATTISTI

TOY MONTE CARLO

β€’ We applied our Kalman Filterβ„’ to ideal

measurements following perfectly an helix with

initial coordinates: 𝑠0𝑇 =

(𝑦0 𝑧0 1/π‘Ÿ0 πœ™0 πœ†0) =𝑦0β„Ž 𝑧0

β„Ž 0.014 π‘π‘šβˆ’1 6 rad βˆ’0.05 radand the free parameter π‘₯0 = π‘₯0

β„Ž and the step

𝑑π‘₯ = 0.04 cm

17

Note: even though we have unsmeared

idealized measurement for this first study

we kept the β€˜π‘… (noise) matrix’ unmodified

with uncertainties Ξ£π‘₯𝑦 = 4π‘π‘š

FEDERICOBATTISTI

TOY MONTE CARLO

β€’ Plots describing the evolution of the estimate of the measured quantities (𝑦, 𝑧) as a function of the free parameter π‘₯ for the

perfect helix. Note that the TPC points have on the x coordinate the measured value, while for the estimates we use the estimated

π‘₯ from the kinematic fitting (i.e. π‘₯π‘˜ = π‘₯0 + π‘˜ Γ— 𝑑π‘₯π‘˜)

18FILTER PROPAGATION DIRECTION

KFβ„’: 𝜎π‘₯, πœŽπ‘¦π‘§ = (0.5π‘π‘š, 1π‘π‘š)Note: the β€˜TPC Cluster measured values’ are

from a Toy MC, so the red error bars are the

dummy values from the R matrix

FEDERICOBATTISTI

TOY MONTE CARLO

β€’ We now replot the results from the previous slide, all identical except replacing the π‘₯ coordinate by π‘₯β„Ž instead of π‘₯𝑓. The

plots show that the predicted 𝑦 and 𝑧 components coincide with the measured ones

19FILTER PROPAGATION DIRECTION

Note: this is not the same as using

the standard Kalman filter since y

and z have been estimated using

the x from kinematic fitting, as in

the previous slideKFβ„’: 𝜎π‘₯, πœŽπ‘¦π‘§ = (0.5π‘π‘š, 1π‘π‘š)

FEDERICOBATTISTI

TOY MONTE CARLO: UNDERSTANDING STEP DETERMINATION

20

β€’ With the current sigma values (𝜎π‘₯ = 0.5π‘π‘š and πœŽπ‘¦π‘§ = 1π‘π‘š ) the ratio 𝜎π‘₯/πœŽπ‘¦ is large enough that the evolution of

𝑦 and 𝑧 is essentially decoupled from the evolution of the free parameter π‘₯.

β€’ This gives us π‘¦π‘˜βˆ’ ≃ π‘¦π‘˜

β„Ž and π‘§π‘˜βˆ’ ≃ π‘§π‘˜

β„Ž and an π‘₯𝑓 that is updated completely disregarding the measured π‘₯β„Ž values

β€’ A way to see this is to divide the 𝑑π‘₯π‘˜ update formula into two parts: one that depends on the evolution of the π‘₯ free

parameter, and one on 𝑦 and 𝑧:

𝑑π‘₯π‘˜ =

cot πœ†π‘˜βˆ’1+

πœŽπ‘¦π‘§2 π‘¦π‘˜

β„Ž βˆ’ π‘¦π‘˜βˆ’1+ sinπœ™π‘˜βˆ’1

+ + π‘§π‘˜β„Ž βˆ’ π‘§π‘˜βˆ’1

+ cos πœ™π‘˜βˆ’1+

ࡘcot2 πœ†π‘˜βˆ’1

+

πœŽπ‘¦π‘§2 + ΰ΅—1 𝜎π‘₯

2

+

π‘₯π‘˜β„Ž βˆ’ π‘₯π‘˜βˆ’1

𝑓

𝜎π‘₯2

ࡘcot2 πœ†π‘˜βˆ’1

+

πœŽπ‘¦π‘§2 + ΰ΅—1 𝜎π‘₯

2

= 𝑑π‘₯𝑦𝑧 + 𝑑π‘₯π‘₯

β€’ With the current sigma values (𝜎π‘₯ = 0.5π‘π‘š and πœŽπ‘¦π‘§ = 1π‘π‘š ) 𝑑π‘₯𝑦𝑧 completely dominates, being often 2 or 3

orders of magnitude larger than 𝑑π‘₯π‘₯: this gives us fairly predictions for 𝑦 and 𝑧 very close to the measured values,

but completely wrong ones for π‘₯, becuase the fit can never recover from a bad initial estimate for the free

parameter

FEDERICOBATTISTI

TOY MONTE CARLO: UNDERSTANDING STEP DETERMINATION

21FILTER PROPAGATION DIRECTION

β€’ In order for the x parameter to have more weight in the update of 𝑑π‘₯π‘˜, changed the value of πœŽπ‘¦π‘§ from 1cm to 4cm, leaving 𝜎π‘₯ = 0.5π‘π‘š

β€’ The fit initially concentrates on fixing the π‘₯ prediction until that becomes accurate, and then it focuses on yz, reaching similar levels of

precision by the end

KFβ„’: 𝜎π‘₯, πœŽπ‘¦π‘§ = (0.5π‘π‘š, 4π‘π‘š)

FEDERICOBATTISTI

TOY MONTE CARLO: UNDERSTANDING STEP DETERMINATION

22FILTER PROPAGATION DIRECTION

β€’ We now test an extreme case were πœŽπ‘¦π‘§/𝜎π‘₯ is very large: πœŽπ‘¦π‘§ is changed from 1cm to 1000cm, leaving 𝜎π‘₯ = 0.5π‘π‘š

β€’ This becomes very close to be using π‘₯β„Ž instead of π‘₯𝑓

KFβ„’: 𝜎π‘₯, πœŽπ‘¦π‘§ = (0.5π‘π‘š, 1000π‘π‘š)

FEDERICOBATTISTI

TOY MONTE CARLO: UNDERSTANDING STEP DETERMINATION

23FILTER PROPAGATION DIRECTION

β€’ We try applying a standard Kalman Filter to our Toy Monte Carlo, such that it is identical to our Kalman Filterβ„’ but it avoids the

kinematic fitting algorithm completely

β€’ We get essentially the same result as in the last slide: having πœŽπ‘¦π‘§/𝜎π‘₯ very large is equivalent to a standard Kalman Filter

FEDERICOBATTISTI

RANDOMIZED X STEP

β€’ Now we try applying our Kalman Filter to

ideal measurements following perfectly an

helix with initial coordinates: π‘₯𝑖𝑇 =

(𝑦𝑖 𝑧𝑖 1/π‘Ÿπ‘– πœ™π‘– πœ†π‘–) =𝑦1β„Ž 𝑧1

β„Ž 0.014 π‘π‘šβˆ’1 6 rad βˆ’0.05 radand the free parameter π‘₯𝑖 = π‘₯1

β„Ž but with a

randomized step 𝑑π‘₯ uniformely distributed

between 0.02cm and 0.06cm.

24

Note: the step progression is rondomized,

but we are still following a perfect helix

i.e. No smearing on the xyz coordinates

is involved

FEDERICOBATTISTI

RANDOMIZED X STEP

β€’ Plots describing the evolution of the estimate of the measured quantities (𝑦, 𝑧) as a function of the free parameter π‘₯ for the

perfect helix. Note that the the TPC points have on the x coordinate the measured value, while for the estimates we use the

estimated x (i.e. π‘₯π‘˜ = π‘₯0 + π‘˜ Γ— 𝑑π‘₯π‘˜)

25FILTER PROPAGATION DIRECTION

KFβ„’: 𝜎π‘₯, πœŽπ‘¦π‘§ = (0.5π‘π‘š, 1π‘π‘š)

FEDERICOBATTISTI

RANDOMIZED X STEP

β€’ Reapplying the fit with the new πœŽπ‘¦π‘§ = 4cm we see that the 3D predictions are more in line with the Monte Carlo truth, past the

first few steps

26

FILTER

PROPAGATION

DIRECTION

KFβ„’: 𝜎π‘₯, πœŽπ‘¦π‘§ = (0.5π‘π‘š, 1π‘π‘š) KFβ„’: 𝜎π‘₯, πœŽπ‘¦π‘§ = (0.5π‘π‘š, 4π‘π‘š)

FEDERICOBATTISTI

RANDOMIZED X STEP

β€’ Reapplying the fit with the new πœŽπ‘¦π‘§ = 4cm we see that the 3D predictions are more in line with the Monte Carlo truth, past the

first few steps

27

FILTER

PROPAGATION

DIRECTION

KFβ„’: 𝜎π‘₯, πœŽπ‘¦π‘§ = (0.5π‘π‘š, 1π‘π‘š) KFβ„’: 𝜎π‘₯, πœŽπ‘¦π‘§ = (0.5π‘π‘š, 4π‘π‘š)

FEDERICOBATTISTI

RANDOMIZED X STEP: TESTING THE RATIO

β€’ Since 𝜎π‘₯ and πœŽπ‘¦π‘§ are essentially weights, only their ratio 𝜎π‘₯/πœŽπ‘¦π‘§ should matter. To test this we try the pair 𝜎π‘₯ , πœŽπ‘¦π‘§ =

(1π‘π‘š, 8π‘π‘š) which has the same ratio as 𝜎π‘₯ , πœŽπ‘¦π‘§ = (0.5π‘π‘š, 4π‘π‘š)

28

FILTER

PROPAGATION

DIRECTION

KFβ„’: 𝜎π‘₯, πœŽπ‘¦π‘§ = (1π‘π‘š, 8π‘π‘š)KFβ„’: 𝜎π‘₯, πœŽπ‘¦π‘§ = (0.5π‘π‘š, 4π‘π‘š)

FEDERICOBATTISTI

RANDOMIZED X STEP: TESTING THE RATIO

β€’ Since 𝜎π‘₯ and πœŽπ‘¦π‘§ are essentially weights, only their ratio 𝜎π‘₯/πœŽπ‘¦π‘§ should matter. To test this we try the pair 𝜎π‘₯ , πœŽπ‘¦π‘§ =

(1π‘π‘š, 8π‘π‘š) which has the same ratio as 𝜎π‘₯ , πœŽπ‘¦π‘§ = (0.5π‘π‘š, 4π‘π‘š)

29

FILTER

PROPAGATION

DIRECTION

KFβ„’: 𝜎π‘₯, πœŽπ‘¦π‘§ = (0.5π‘π‘š, 4π‘π‘š) KFβ„’: 𝜎π‘₯, πœŽπ‘¦π‘§ = (1π‘π‘š, 8π‘π‘š)

FEDERICOBATTISTI

RANDOMIZED X STEP

β€’ Plots comparing the reconstructed tansverse momentum 𝑝𝑇 and the reconstructed total momentum 𝑝𝑇 from our Kalman filter

algorithmβ„’ to the MC truth as a function of the free parameter π‘₯

30FORWARD FITKFβ„’: 𝜎π‘₯, πœŽπ‘¦π‘§ = (0.5π‘π‘š, 1π‘π‘š)

FEDERICOBATTISTI

RESULTS FROM THE STANDARD KALMAN FILTER

31FITTER PROPAGATION DIRECTION

β€’ We try applying a standard Kalman Filter to our Toy Monte Carlo, such that it is identical to our Kalman Filterβ„’ but it avoids the

kinematic fitting algorithm completely

β€’ This means that our free parameter coincides with the measured value of x for the TPC cluster

FEDERICOBATTISTI

APPLYING A VERY SMALL R A STANDARD KALMAN FILTER

32FITTER PROPAGATION DIRECTION

β€’ We try applying a standard Kalman Filter to our Toy Monte Carlo, substituting the values in the 𝑅 matrix with Ξ£π‘₯𝑦 = 10βˆ’6cm ,

where before we had Ξ£π‘₯𝑦 = 4cm: with such a small R the Kalman filter follows the measurements almost exactly

FEDERICOBATTISTI

APPLYING A VERY SMALL R TO OUR KALMAN FILTER

33FITTER PROPAGATION DIRECTION

β€’ We try applying our Kalman Filterβ„’ to our Toy Monte Carlo, but substituting the values in the 𝑅 matrix with Ξ£π‘₯𝑦 = 10βˆ’6cm ,

where before we had Ξ£π‘₯𝑦 = 4cm: with such a small R the Kalman filter should converge with the measurement very quickly

(this happens immediately with a Standard Kalman filter, as you can see in the previous slide)

KFβ„’: 𝜎π‘₯, πœŽπ‘¦π‘§ = (0.5π‘π‘š, 4π‘π‘š)

FEDERICOBATTISTI

SUMMARY AND FUTURE STEPS

β€’ The Kalman Filter now in use is convoluted with Kinematic Fitting which determines the evolution of the free

parameter, minimizing the distance between the measured value and the a priori prediction

β€’ The Kinematic Fitting is regulated by two weights πœŽπ‘¦π‘§ and 𝜎π‘₯ whose ratio determines weather the fit is

dominated by corrections related to the 𝑦𝑧 or the π‘₯ measurements and predictions

β€’ With the previous values of 𝜎π‘₯, πœŽπ‘¦π‘§ = (0.5π‘π‘š, 1π‘π‘š) the Kalman Fit disregarded the π‘₯ measurements in the

update

➒ Increasing the value of πœŽπ‘¦π‘§ ,bringing the ratio from Ξ€πœŽπ‘¦π‘§ 𝜎π‘₯ = 2 to Ξ€πœŽπ‘¦π‘§ 𝜎π‘₯ = 8 the fit better takes into

account the x measurements and follows the Monte Carlo truth more closely

β€’ Future steps:

➒ Weights with a larger Ξ€πœŽπ‘¦π‘§ 𝜎π‘₯ ratio (i.e. following the x measurement more closely) should maybe be

used

➒ A smeared helix Toy Monte Carlo needs to be investigated

➒ Other options for the free parameter need to be studied

34

FEDERICOBATTISTI

BACKUP

35

FEDERICOBATTISTI

KALMAN FILTER APPLICATION

36

β€’ We apply a Kalman filter to the motion of a charged particle in the magnetic field

ቐ

π‘₯ = π‘₯0 + π‘Ÿ tanπœ† (πœ™ βˆ’ πœ™0)𝑦 = 𝑦𝐢 βˆ’ π‘Ÿ cosπœ™π‘§ = 𝑧𝐢 + π‘Ÿ sinπœ™

TRACK PARAMETERS

We apply the Kalman filter to track candidates,

consisting of groups of TPC clusters, which are

identified and put together during the

reconstruction process. Each step of the Kalman

filter algorithm is identified by one of these TPC

clusters

T. Junk, DUNE-Doc-13933

https://docs.dunescience.org/cgi-bin/private/ShowDocument?docid=13933

FEDERICOBATTISTI

KALMAN FILTER: COORDINATE SYSTEM

37

β€’ Note that in our coordinate sytem z is the flux direction, y is the vertical direction and x is the drift direction (i.e.

the magnetic field direction)

y

z

x

FEDERICOBATTISTI

KALMAN FILTER APPLICATION: INITIAL ESTIMATES

β€’ Before the Kalman filter algorithm can be applied, we need an initial estimate for the state vector, which in our case

includes 𝑦, 𝑧, Ξ€1 π‘Ÿ , πœ™ and πœ† and the covariance matrix

π‘₯0𝑇 = (𝑦0 𝑧0 1/π‘Ÿ0 πœ™0 πœ†0) = 0 0 0.1 0 0

𝑃0 =

12 0 00 12 0000

000

0.52

00

000

0.52

0

0000

0.52

STATE VECTOR

COVARIANCE

MATRIX

38

β€’ The estimated quantities from the state vector can be used to estimate the particle’s momentum

࡞

𝑝π‘₯ = 𝑝𝑇 tan πœ†π‘π‘¦ = 𝑝𝑇 sinπœ™

𝑝𝑧 = 𝑝𝑇 cosπœ™

𝑝𝑇 Ξ€GeV 𝑐 = 0.3 Γ— 𝐡 𝑇 Γ— π‘Ÿ(π‘š)

FEDERICOBATTISTI

KALMAN FILTER APPLICATION: PREDICTION AND MEASUREMENT

39

β€’ From the equation of motion we obtain the prediction function for our state vector. Note that the drift direction π‘₯ is

used as our free parameter

ොπ‘₯π‘˜βˆ’ = 𝑓

ΰ·œπ‘¦π‘˜βˆ’1+

ΖΈπ‘§π‘˜βˆ’1+

1/ ΖΈπ‘Ÿπ‘˜βˆ’1+

πœ™π‘˜βˆ’1+

αˆ˜πœ†π‘˜βˆ’1+

=

ΰ·œπ‘¦π‘˜βˆ’1+ + dxk Γ— cot αˆ˜πœ†π‘˜βˆ’1 Γ— sin πœ™π‘˜βˆ’1

+

ΖΈπ‘§π‘˜βˆ’1+ + dxk Γ— cot αˆ˜πœ†π‘˜βˆ’1 Γ— cos πœ™π‘˜βˆ’1

+

1/ ΖΈπ‘Ÿπ‘˜βˆ’1+

πœ™π‘˜βˆ’1+ + dxk Γ— cot αˆ˜πœ†π‘˜βˆ’1 Γ—1/ ΖΈπ‘Ÿπ‘˜βˆ’1

+

αˆ˜πœ†π‘˜βˆ’1+

β€’ The only measured quantities in our case are 𝑦 and 𝑧, and are set at the center of the TPC cluster correspondent to

the present step.

π‘ π‘˜β„Ž =

π‘¦π‘˜β„Ž

π‘§π‘˜β„Ž

Note: the prediction model

does not account for dE/dx

energy loss

FEDERICOBATTISTI

KALMAN FILTER APPLICATION: COVARIANCE MATRIX PREDICTION

40

β€’ First step to make the prediction for the covariance matrix is to calculate the Jacobian

πΉπ‘˜βˆ’1 =πœ•π‘“ ොπ‘₯π‘˜βˆ’1

+

πœ• ොπ‘₯π‘˜βˆ’1+ =

1 00000

1000

001

𝑑π‘₯π‘˜ cot αˆ˜πœ†π‘˜βˆ’1+

0

𝑑π‘₯π‘˜ cot αˆ˜πœ†π‘˜βˆ’1+ cos πœ™π‘˜βˆ’1

+

βˆ’π‘‘π‘₯π‘˜ cot αˆ˜πœ†π‘˜βˆ’1+ sin πœ™π‘˜βˆ’1

+

010

𝑑π‘₯π‘˜ sin πœ™π‘˜βˆ’1+ (βˆ’1 βˆ’ cot2 αˆ˜πœ†π‘˜βˆ’1

+ )

𝑑π‘₯π‘˜ cos πœ™π‘˜βˆ’1+ (βˆ’1 βˆ’ cot2 αˆ˜πœ†π‘˜βˆ’1

+ )0

΀𝑑π‘₯π‘˜ ΖΈπ‘Ÿπ‘˜βˆ’1+ (βˆ’1 βˆ’ cot2 αˆ˜πœ†π‘˜βˆ’1

+ )1

β€’ The step uncertainty matrix is also needed

𝑄 =

0 00000

0000

00

πœŽΞ”1/π‘Ÿ00

000πœŽΞ”πœ™0

0000πœŽΞ”πœ†

β€’ The prediction is then:

π‘ƒπ‘˜βˆ’ = πΉπ‘˜βˆ’1π‘ƒπ‘˜βˆ’1πΉπ‘˜βˆ’1

𝑇 + 𝑄

FEDERICOBATTISTI

KALMAN FILTER APPLICATION: EVALUATE THE RESIDUAL

β€’ We now evaluate the residual and Kalman Gain

π‘¦π‘˜ = π‘ π‘˜β„Ž βˆ’π» ොπ‘₯π‘˜

βˆ’ =π‘¦π‘˜β„Ž βˆ’ ΰ·œπ‘¦π‘˜

βˆ’

π‘§π‘˜β„Ž βˆ’ ΖΈπ‘§π‘˜

βˆ’

πΎπ‘˜ = π‘ƒπ‘˜βˆ’π» 𝑅 + π»π‘ƒπ‘˜

βˆ’π»π‘‡ βˆ’1

𝐻 =1 0 00 1 0

00

00

𝑅 =Σ𝑦𝑧2 0

0 Σ𝑦𝑧2

KALMAN GAIN

RESIDUAL With:

CONVERSION MATRIX

MEASUREMENT NOISE COVARIANCE

Note: The uncertainties in R are fixed, before the Kalman filter is applied, as external parameters: R is not updated.

41

FEDERICOBATTISTI

KALMAN FILTER APPLICATION: PREDICTION UPDATE

β€’ We are now finally able to update our estimates using both the a priori prediction and the measurement

ොπ‘₯π‘˜+ = ොπ‘₯π‘˜

βˆ’ + πΎπ‘˜ π‘¦π‘˜

π‘ƒπ‘˜+ = 1 βˆ’ π»π‘˜πΎπ‘˜ π‘ƒπ‘˜

βˆ’

STATE VECTOR

COVARIANCE MATRIX

42

FEDERICOBATTISTI

TOY MONTE CARLO

β€’ Plots describing the evolution of the estimate of the non measured quantities (1

π‘Ÿ, πœ™, πœ†) as a function of the free parameter π‘₯ for the

perfect helix

43

FILTER PROPAGATION DIRECTION

43

𝜎π‘₯, πœŽπ‘¦π‘§ = (0.5π‘π‘š, 1π‘π‘š)

FEDERICOBATTISTI

TOY MONTE CARLO

β€’ Plots comparing the reconstructed tansverse momentum 𝑝𝑇 and the reconstructed total momentum 𝑝𝑇 from the Kalman fitter

algorithm to the MC truth as a function of the free parameter π‘₯

44FORWARD FIT𝜎π‘₯, πœŽπ‘¦π‘§ = (0.5π‘π‘š, 1π‘π‘š)

FEDERICOBATTISTI

RANDOMIZED X STEP

β€’ Plots describing the evolution of the estimate of the non measured quantities (1

π‘Ÿ, πœ™, πœ†) as a function of the free parameter π‘₯ for the

perfect helix

45

FILTER PROPAGATION DIRECTION

45

𝜎π‘₯, πœŽπ‘¦π‘§ = (0.5π‘π‘š, 1π‘π‘š)

FEDERICOBATTISTI

UNDERSTANDING STEP DETERMINATION

β€’ Reapplying the fit with the new πœŽπ‘¦π‘§ = 4cm we see that the 3D predictions are more in line with the Montecarlo truth, past the

first few steps

46

FITTER

PROPAGATION

DIRECTION

πœŽπ‘¦π‘§ = 2π‘π‘š πœŽπ‘¦π‘§ = 4π‘π‘š

FEDERICOBATTISTI

UNDERSTANDING STEP DETERMINATION

β€’ Reapplying the fit with the new πœŽπ‘¦π‘§ = 4cm we see that the 3D predictions are more in line with the Montecarlo truth, past the

first few steps

47

πœŽπ‘¦π‘§ = 2π‘π‘š

FITTER

PROPAGATION

DIRECTION

πœŽπ‘¦π‘§ = 4π‘π‘š

FEDERICOBATTISTI

UNDERSTANDING STEP DETERMINATION

β€’ The momentum reconstruction performance remains roughly the same

48BACKWARD FIT