Skip to content
Snippets Groups Projects
Commit 29e7b482 authored by Wouter Hulsbergen's avatar Wouter Hulsbergen
Browse files

copy covariance matrix rather than keep pointer in CubicStateInterpolationTraj

parent 7eac461c
No related branches found
No related tags found
1 merge request!873Update of TrackVertexUtils
......@@ -18,7 +18,7 @@
namespace LHCb
{
class CubicStateInterpolationTraj : public CubicStateVectorInterpolationTraj
class CubicStateInterpolationTraj : public CubicStateVectorInterpolationTraj
{
public:
/// Constructor from two states
......@@ -40,14 +40,14 @@ namespace LHCb
Gaudi::TrackSymMatrix covariance( double z ) const ;
/// Calculate state at location z
State state(double z) const override;
State state(double z) const override final ;
/// Clone this trajectory
std::unique_ptr<Trajectory> clone() const override { return std::unique_ptr<Trajectory>(new CubicStateInterpolationTraj(*this)) ; }
private:
const Gaudi::TrackSymMatrix* m_covbegin = nullptr ; ///< Covariance at first state
const Gaudi::TrackSymMatrix* m_covend = nullptr; ///< Covariance at second state
Gaudi::TrackSymMatrix m_covbegin ; ///< Covariance at first state
Gaudi::TrackSymMatrix m_covend ; ///< Covariance at second state
};
/*************************************************************************************************/
......@@ -58,7 +58,7 @@ namespace LHCb
CubicStateInterpolationTraj::CubicStateInterpolationTraj(const LHCb::State& begin,const LHCb::State& end)
:
CubicStateVectorInterpolationTraj(begin,end),
m_covbegin(&(begin.covariance())), m_covend(&(end.covariance()))
m_covbegin(begin.covariance()), m_covend(end.covariance())
{
}
......@@ -66,7 +66,7 @@ namespace LHCb
CubicStateInterpolationTraj::CubicStateInterpolationTraj(const LHCb::State& state,const Gaudi::XYZVector& bfield)
:
CubicStateVectorInterpolationTraj(state,bfield),
m_covbegin(&(state.covariance())), m_covend(m_covbegin)
m_covbegin(state.covariance()), m_covend(m_covbegin)
{
}
......@@ -74,15 +74,15 @@ namespace LHCb
void CubicStateInterpolationTraj::init(const LHCb::State& begin,const LHCb::State& end)
{
CubicStateVectorInterpolationTraj::init(begin,end) ;
m_covbegin = &(begin.covariance()) ;
m_covend = &(end.covariance()) ;
m_covbegin = begin.covariance() ;
m_covend = end.covariance() ;
}
inline
void CubicStateInterpolationTraj::init(const LHCb::State& state,const Gaudi::XYZVector& bfield)
{
CubicStateVectorInterpolationTraj::init(state,bfield) ;
m_covbegin = m_covend = &(state.covariance()) ;
m_covbegin = m_covend = state.covariance() ;
}
}
......
......@@ -32,19 +32,19 @@ namespace LHCb
{
Gaudi::TrackSymMatrix cov ;
if( z <= zbegin() ) {
cov = *m_covbegin ;
cov = m_covbegin ;
transport( cov, z - zbegin() ) ;
} else if (z>= zend()) {
cov = *m_covend ;
cov = m_covend ;
transport( cov, z - zend() ) ;
} else {
// what is the right weight? FIXME!
const double zfrac = (z - zbegin())/(zend()-zbegin()) ;
const double weight = (1-zfrac) ; //linear
//double weight = 0.5 - 4*std::pow(zfrac-0.5,3) ; // cubic
Gaudi::TrackSymMatrix covA = *m_covbegin ;
Gaudi::TrackSymMatrix covA = m_covbegin ;
transport( covA, z - zbegin() ) ;
Gaudi::TrackSymMatrix covB = *m_covend ;
Gaudi::TrackSymMatrix covB = m_covend ;
transport( covB, z - zend() ) ;
cov = weight * covA + (1-weight)* covB ;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment