#include "SpacepointHitPolicy.h" #include "assert.h" #include "TMath.h" #include "AbsRecoHit.h" TMatrixT SpacepointHitPolicy::hitCoord(AbsRecoHit* hit,const DetPlane& plane) { TMatrixT returnMat(2,1); TMatrixT _D(3,1); TVector3 _U; TVector3 _V; _D[0][0] = (plane.getO())[0]; _D[1][0] = (plane.getO())[1]; _D[2][0] = (plane.getO())[2]; _D *= -1.; _D += hit->getRawHitCoord(); //now the vector _D points from the origin of the plane to the hit point _U = plane.getU(); _V = plane.getV(); returnMat[0][0] = _D[0][0] * _U[0] + _D[1][0] * _U[1] + _D[2][0] * _U[2]; returnMat[1][0] = _D[0][0] * _V[0] + _D[1][0] * _V[1] + _D[2][0] * _V[2]; //std::cout << "hitCoord="< SpacepointHitPolicy::hitCov(AbsRecoHit* hit,const DetPlane& plane) { TVector3 _U; TVector3 _V; _U = plane.getU(); _V = plane.getV(); TMatrixT rawCov = hit->getRawHitCov(); TMatrixT jac(3,2); // jac = dF_i/dx_j = s_unitvec * t_untivec, with s=u,v and t=x,y,z jac[0][0] = _U[0]; jac[1][0] = _U[1]; jac[2][0] = _U[2]; jac[0][1] = _V[0]; jac[1][1] = _V[1]; jac[2][1] = _V[2]; TMatrixT jac_orig = jac; TMatrixT jac_t = jac.T(); TMatrixT result=jac_t * (rawCov * jac_orig); //std::cout << "hitCov="< rawcoord = hit->getRawHitCoord(); TVector3 point(rawcoord[0][0],rawcoord[1][0],rawcoord[2][0]); TVector3 poca,dirInPoca; rep->extrapolateToPoca(point,poca,dirInPoca); _plane.setO(point); _plane.setNormal(dirInPoca); return _plane; }