Added unit test for TrajDensity and debugged same.