Kalman Filter Stage 1

My direction of research has changed slightly since the start of summer. My new goal is to apply a Kalman filter to the MINERvA testbeam. One of the purposes of this testbeam is to determine the momenta of the incoming particles, which is accomplished by setting up a pairs of wire chambers before and after a magnet. These pairs of wire chambers enable us to determine the direction of the particle’s motion before and after passage through the magnetic field, and, from this change in direction, we can determine the particle’s momentum. However, the wire chambers have some degree of error in determining the particle’s position which translates to errors in the particle’s direction and momentum.

In order to reduce these errors, I have implemented a Kalman filter. For simplicity, I first fit tracks of particles sent through with the magnet turned off. I started off with some initial estimate of the particle’s state vector (a vector which encodes both the particle’s position and direction of motion) at the first wire chamber (I set the position equal to the position measured by the first wire chamber, and the direction to be the same as that between the beam source and the hit location). I also encoded the errors associated with these values in a covariance matrix. At this point I used the state vector at the first wire chamber to try to predict what the state vector should be at the second wire chamber. At the same time, I propagated the errors in the covariance matrix to try to determine the errors in the estimated second wire chamber state vector. I then added to this the errors that would be caused by multiple scattering (as the particle moves through a medium, it jostled around by particles in that medium, resulting in random changes in its direction). There are now two calculations of the particle’s state vector at the second wire chamber: the one actually measured by the second wire chamber and the one that would be predicted based on the state vector at the first wire chamber, both of which have errors associated with them. I obtained an improved estimate for the particle’s actual state vector by taking a weighted average of the predicted and the measured hit locations. This returns a new state vector at the second wire chamber with lower errors than either the measured or predicted state vectors. From here, I applied the same process forward to wire chambers 3 and 4, and then went in reverse to improve the estimates at some of the earlier wire chambers.

I have run into a couple rather annoying errors so far. First, the matrix2 = matrix1.Invert(); command was not working as I had expected, in that, not only did it set matrix2 equal to the inverse of matrix1, but it also set matrix1 equal to its own inverse. This led to later attempts at calling matrix1 not being what I had expected, with the end of result of messing up my output. Given my unfamiliarity with the Kalman filter, I spent a good deal of time looking for errors in how I applied it, if I left out some matrix in some equation somewhere, and, after that, a fair amount of time making sure that all of the covariance matrices and such were correct, etc. Having fixed that, on the advice of my¬†adviser, I went back and noted that the values obtained in the “predict the state vector at the next wire chamber” step differed from the measured values by more than the predicted error. My current theory is that this is due to my small-angle assumption ( tan(x)=sin(x)=x for x<<1 ) being overly simplistic, with the particle’s path angle not <<1. I am currently working on fixing this error by storing tan(angle) and not simple the angle itself in the state vector.