def __init__(self, state=Array.Vector(), CovarianceMatrix=Array.Matrix()): self.state = state self.CovarianceMatrix = CovarianceMatrix
return Array.Matrix([1., 0., 0., 0.], [0., 1., 0., 0.]) def MultipleScatteringMatrix(self, index): return Array.Identity(4) * 1e-12 def NoiseMatrix(self, index): return Array.Identity(2) * self.xyresolution**2 if __name__ == '__main__': import ROOT R = ROOT.TRandom3(0) V = Array.Identity(2) * 0.01 Nhits = 500 hits = [ Array.Vector( sin(0.01 * i) + R.Gaus(0, .1), -cos(0.1 * i) + R.Gaus(0, .1)) for i in range(Nhits) ] runnings = map(float, range(Nhits)) measurements = [KalmanData(h, V) for h in hits] istate = Array.Vector(hits[0][0], hits[0][1], 0., 0.) istate = Array.Vector(0., 0., 0., 0.) icvmatrix = Array.Identity(4) * 2 nextkf = NEXTKF() nextkf = TrigoKF() nextkf.SetMeasurements(runnings, measurements) nextkf.SetInitialState(KalmanData(istate, icvmatrix)) track = nextkf.Fit() p = track.Plot() p3 = track.Plot3D()