20#include "TrkExtAlg/Ext_errmx.h"
22extern bool Ext_err_valid(
bool msg,
const HepSymMatrix &error,
23 const int dimension );
24static const double Eps(1.0e-12);
25static const double Infinite(1.0e+12);
30 m_err2(2), m_valid(0) {}
35 m_err3(err.m_err3), m_R(err.m_R), m_err2(err.m_err2),
36 m_valid(err.m_valid) {}
39 m_err3(3,0), m_R(3,3,0), m_err2(2), m_valid(1) {}
49 for(
int i = 1; i <=
m_err.num_col(); i++ ){
50 for(
int j = 1; j <= i; j++ ){
51 m_err.fast( i, j ) = error[ ne++ ];
61 const Hep3Vector &nz )
const
77 m_err3 = (
m_err.sub( 1, 3 )).similarity( m_R );
99 if( !(*this).valid( 0 ) ){
110 double nr_np( nr*np );
111 double denom( 1.0 - nr_np*nr_np );
116 double fac( 1.0 / sqrt( denom ) );
117 Hep3Vector nx( ( nr - nr_np * np ) * fac );
118 Hep3Vector ny( np.cross( nx ) );
120 (*this).set_plane_errs( nx, ny, np );
122 double sigma2( m_err3( 1, 1 ) );
124 error = sqrt( sigma2 ) * fac;
141 const Hep3Vector &nr,
const Hep3Vector &nt )
const
155 if( !(*this).valid( 1 ) ){
160 double nr_np( nr*np );
161 double denom_r( 1.0 - nr_np*nr_np );
165 double nt_np( nt*np );
166 double denom_t( 1.0 - nt_np*nt_np );
167 double fac_r( 1.0 / sqrt( denom_r ) );
168 Hep3Vector nx( ( nr - nr_np * np ) * fac_r );
169 Hep3Vector ny( np.cross( nx ) );
171 (*this).set_plane_errs( nx, ny, np );
173 double sigma2( m_err3( 1, 1 ) );
175 m_err2( 1 ) = sqrt( sigma2 ) * fac_r;
181 double fac_t( 1.0 / sqrt( denom_t ) );
182 sigma2 = m_err3( 2, 2 );
184 m_err2( 2 ) = sqrt( sigma2 ) * fac_t;
189 m_err2( 2 ) = (*this).get_plane_err( np, nt );
192 m_err2( 1 ) = (*this).get_plane_err( np, nr );
193 m_err2( 2 ) = (*this).get_plane_err( np, nt );
216 const Hep3Vector &pv )
const
223 Hep3Vector np( pv.unit() );
230 if( np.x() != 0 || np.y() != 0 ){
241 if( np.y() != 0 || np.z() != 0 ){
252 if( np.z() != 0 || np.x() != 0 ){
262 Hep3Vector nt( np.cross( nr ) );
263 const HepVector & err_v = (*this).get_plane_errs( np, nr, nt );
265 *(m_nv+1) = err_v[1]*nt;
284 Hep3Vector np( pv.unit() );
285 Hep3Vector nz( 0.0, 0.0, 1.0 );
286 Hep3Vector nt( (nz.cross(np)).unit() );
287 Hep3Vector nr( nt.cross(np) );
289 const HepVector & err_v = (*this).get_plane_errs( np, nr, nt );
291 *(m_nv+1) = err_v[1]*nt;
323 m_valid = err.m_valid;
325 *(m_nv+1) = *(err.m_nv+1);
335 s <<
" m_valid: " << err.m_valid <<
'\n'
336 <<
"m_err: " << err.
m_err <<
" m_err3: " << err.m_err3
337 <<
" m_R: " << err.m_R <<
" m_err2: " << err.m_err2
338 <<
" *m_nv: " << *err.m_nv
339 <<
" *(m_nv+1): " << *(err.m_nv+1)
bool Ext_err_valid(bool msg, HepSymMatrix &error, const int dimension)
bool Ext_err_valid(bool msg, const HepSymMatrix &error, const int dimension)
std::ostream & operator<<(std::ostream &s, const Ext_errmx &err)
void put_err(const double error[])
bool valid(bool msg) const
Ext_errmx & operator=(const Ext_errmx &errmx)
const Hep3Vector * get_tvs(const int view, const Hep3Vector &pv) const
void set_plane_errs(const Hep3Vector &nx, const Hep3Vector &ny, const Hep3Vector &nz) const
const HepVector & get_plane_errs(const Hep3Vector &np, const Hep3Vector &nr, const Hep3Vector &nt) const
double get_plane_err(const Hep3Vector &np, const Hep3Vector &nr) const