#include <Ext_errmx.h>
Inheritance diagram for Ext_errmx:
Public Member Functions | |
Ext_errmx () | |
Ext_errmx (const Ext_errmx &errmx) | |
Ext_errmx (const HepSymMatrix &err) | |
virtual | ~Ext_errmx () |
void | put_err (const double error[]) |
void | put_err (const HepSymMatrix &err) |
const HepSymMatrix & | get_err () const |
double | get_plane_err (const Hep3Vector &np, const Hep3Vector &nr) const |
const HepVector & | get_plane_errs (const Hep3Vector &np, const Hep3Vector &nr, const Hep3Vector &nt) const |
const Hep3Vector * | get_tvs (const int view, const Hep3Vector &pv) const |
const Hep3Vector * | get_tvs (const Hep3Vector &pv) const |
bool | valid (bool msg) const |
Ext_errmx & | operator= (const Ext_errmx &errmx) |
Protected Member Functions | |
void | set_plane_errs (const Hep3Vector &nx, const Hep3Vector &ny, const Hep3Vector &nz) const |
Protected Attributes | |
HepSymMatrix | m_err |
Private Attributes | |
bool | m_valid |
HepSymMatrix | m_err3 |
HepVector | m_err2 |
Hep3Vector | m_nv [2] |
HepMatrix | m_R |
Friends | |
std::ostream & | operator<< (std::ostream &s, const Ext_errmx &errmx) |
Definition at line 36 of file Ext_errmx.h.
Ext_errmx::Ext_errmx | ( | ) |
Ext_errmx::Ext_errmx | ( | const Ext_errmx & | errmx | ) |
Ext_errmx::Ext_errmx | ( | const HepSymMatrix & | err | ) |
virtual Ext_errmx::~Ext_errmx | ( | ) | [inline, virtual] |
const HepSymMatrix & Ext_errmx::get_err | ( | ) | const [inline] |
Definition at line 157 of file Ext_errmx.h.
References m_err.
Referenced by ExtSteppingAction::UserSteppingAction().
00157 { 00158 return m_err; 00159 }
double Ext_errmx::get_plane_err | ( | const Hep3Vector & | np, | |
const Hep3Vector & | nr | |||
) | const |
Definition at line 85 of file Ext_errmx.cxx.
References Eps(), ers::error, Infinite(), and nr.
Referenced by ExtSteppingAction::UserSteppingAction().
00095 { 00096 00097 // Check the validity of the error matrix. 00098 00099 if( !(*this).valid( 0 ) ){ 00100 //std::cout << "%WARNING at Ext_get_plane_err: You are trying to calculate" 00101 // << " error \n using an invalid error matrix." << std::endl; 00102 } 00103 00104 // Construct 3 TCS axes. 00105 00106 // x: nx --- unit vector which is perp to np and on the plane of nr and np. 00107 // y: nz x nx 00108 // z: nz( = np ) --- direction of the track. 00109 00110 double nr_np( nr*np ); 00111 double denom( 1.0 - nr_np*nr_np ); 00112 double error( 0.0 ); 00113 00114 if( denom > Eps ){ // Track is not parallel to the readout direction. 00115 00116 double fac( 1.0 / sqrt( denom ) ); 00117 Hep3Vector nx( ( nr - nr_np * np ) * fac ); 00118 Hep3Vector ny( np.cross( nx ) ); 00119 00120 (*this).set_plane_errs( nx, ny, np ); 00121 00122 double sigma2( m_err3( 1, 1 ) ); // Error along nx. 00123 if( sigma2 > 0 ){ 00124 error = sqrt( sigma2 ) * fac; // Error projection. 00125 } 00126 00127 } else { // Track is parallel to the readout direction. 00128 00129 error = Infinite; 00130 00131 } 00132 return( error ); 00133 }
const HepVector & Ext_errmx::get_plane_errs | ( | const Hep3Vector & | np, | |
const Hep3Vector & | nr, | |||
const Hep3Vector & | nt | |||
) | const |
Get the 2D projected error vector on the detector plane. {itemize} np: track direction unit vector. nr: readout direction unit vector. nt: ( np x nr ) unit vector. HepVector(1)= error(sigma) along the nr. HepVector(2)= error(sigma) along the nt. {itemize}
Definition at line 140 of file Ext_errmx.cxx.
00151 { 00152 00153 // Check the validity of the error matrix. 00154 00155 if( !(*this).valid( 1 ) ){ 00156 // std::cout << "%WARNING at Ext_get_plane_errs: You are trying to calculate" 00157 // << " error \n using an invalid error matrix." << std::endl; 00158 } 00159 00160 double nr_np( nr*np ); 00161 double denom_r( 1.0 - nr_np*nr_np ); 00162 00163 if( denom_r > Eps ){ // nr is not parallel to the track direction: np. 00164 00165 double nt_np( nt*np ); 00166 double denom_t( 1.0 - nt_np*nt_np ); 00167 double fac_r( 1.0 / sqrt( denom_r ) ); 00168 Hep3Vector nx( ( nr - nr_np * np ) * fac_r ); 00169 Hep3Vector ny( np.cross( nx ) ); 00170 00171 (*this).set_plane_errs( nx, ny, np ); 00172 00173 double sigma2( m_err3( 1, 1 ) ); // Error along nx. 00174 if( sigma2 > 0 ){ 00175 m_err2( 1 ) = sqrt( sigma2 ) * fac_r; // Error projection. 00176 } else { 00177 m_err2( 1 ) = 0.0; 00178 } 00179 00180 if( denom_t > Eps ){ // nt is not parallel to the track direction: np. 00181 double fac_t( 1.0 / sqrt( denom_t ) ); 00182 sigma2 = m_err3( 2, 2 ); 00183 if( sigma2 > 0 ){ 00184 m_err2( 2 ) = sqrt( sigma2 ) * fac_t; // Error projection. 00185 } else { 00186 m_err2( 2 ) = 0.0; 00187 } 00188 } else { // nt is parallel to the track direction: np. 00189 m_err2( 2 ) = (*this).get_plane_err( np, nt ); 00190 } 00191 } else { // nr is parallel to the track direction: np. 00192 m_err2( 1 ) = (*this).get_plane_err( np, nr ); 00193 m_err2( 2 ) = (*this).get_plane_err( np, nt ); 00194 } 00195 return( m_err2 ); 00196 }
const Hep3Vector * Ext_errmx::get_tvs | ( | const Hep3Vector & | pv | ) | const |
Get the 2D projected track error perpendicular to a given vector at the current point. pv: a given vector, momentum vector, for example. {itemize} Hep3Vector(1)= error(1 sigma) along the direction which is perpendicular to pv on the plane formed by pv and z-axis. Hep3Vector(2)= error(1 sigma) along the direction which is (pv) x (HepVector(1) direction). {itemize}
Definition at line 278 of file Ext_errmx.cxx.
00282 { 00283 00284 Hep3Vector np( pv.unit() ); 00285 Hep3Vector nz( 0.0, 0.0, 1.0 ); 00286 Hep3Vector nt( (nz.cross(np)).unit() ); 00287 Hep3Vector nr( nt.cross(np) ); 00288 00289 const HepVector & err_v = (*this).get_plane_errs( np, nr, nt ); 00290 *m_nv = err_v[0]*nr; 00291 *(m_nv+1) = err_v[1]*nt; 00292 return( m_nv ); 00293 00294 }
const Hep3Vector * Ext_errmx::get_tvs | ( | const int | view, | |
const Hep3Vector & | pv | |||
) | const |
Get 2D projected track error perpendicular to a given vector at the current point. pv: a given vector, momentum vector for example. {itemize} view=1. {itemize} Hep3Vector(1)= error(1 sigma) along the direction which is perpendicular to pv on the xy plane. Hep3Vector(2)= error(1 sigma) along the direction which is (pv) x (HepVector(1) direction). {itemize} view=2. {itemize} Hep3Vector(1)= error(1 sigma) along the direction which is perpendicular to pv on the zy plane. Hep3Vector(2)= error(1 sigma) along the direction which is (pv) x (HepVector(1) direction). {itemize} view=3. {itemize} Hep3Vector(1)= error(1 sigma) along the direction which is perpendicular to pv on the zx plane. Hep3Vector(2)= error(1 sigma) along the direction which is (pv) x (HepVector(1) direction). {itemize} {itemize}
Definition at line 215 of file Ext_errmx.cxx.
References nr.
00221 { 00222 00223 Hep3Vector np( pv.unit() ); 00224 Hep3Vector nr; 00225 00226 switch( view ){ 00227 00228 case 1: // xy view 00229 00230 if( np.x() != 0 || np.y() != 0 ){ 00231 nr.setX( np.y() ); 00232 nr.setY( -np.x() ); 00233 nr = nr.unit(); 00234 } else { // Pointing to z-direction. 00235 nr.setX( 1 ); 00236 } 00237 break; 00238 00239 case 2: // zy view 00240 00241 if( np.y() != 0 || np.z() != 0 ){ 00242 nr.setY( -np.z() ); 00243 nr.setZ( np.y() ); 00244 nr = nr.unit(); 00245 } else { // Pointing to x-direction. 00246 nr.setZ( 1 ); 00247 } 00248 break; 00249 00250 case 3: // zx view 00251 00252 if( np.z() != 0 || np.x() != 0 ){ 00253 nr.setX( -np.z() ); 00254 nr.setZ( np.x() ); 00255 nr = nr.unit(); 00256 } else { // Pointing to z-direction. 00257 nr.setZ( 1 ); 00258 } 00259 break; 00260 } /* End of switch */ 00261 00262 Hep3Vector nt( np.cross( nr ) ); 00263 const HepVector & err_v = (*this).get_plane_errs( np, nr, nt ); 00264 *m_nv = err_v[0]*nr; 00265 *(m_nv+1) = err_v[1]*nt; 00266 return( m_nv ); 00267 }
Definition at line 316 of file Ext_errmx.cxx.
References showlog::err, m_err, m_err2, m_err3, m_nv, m_R, and m_valid.
00317 { 00318 if( this != &err ){ 00319 m_err = err.m_err; 00320 m_err3 = err.m_err3; 00321 m_err2 = err.m_err2; 00322 m_R = err.m_R; 00323 m_valid = err.m_valid; 00324 *m_nv = *err.m_nv; 00325 *(m_nv+1) = *(err.m_nv+1); 00326 } 00327 return *this; 00328 }
void Ext_errmx::put_err | ( | const HepSymMatrix & | err | ) | [inline] |
void Ext_errmx::put_err | ( | const double | error[] | ) |
Definition at line 45 of file Ext_errmx.cxx.
References genRecEmupikp::i, ganga-rec::j, m_err, and m_valid.
Referenced by Ext_xp_err::set_err(), and ExtSteppingAction::UserSteppingAction().
00046 { 00047 int ne = 0; 00048 00049 for( int i = 1; i <= m_err.num_col(); i++ ){ 00050 for( int j = 1; j <= i; j++ ){ 00051 m_err.fast( i, j ) = error[ ne++ ]; 00052 } 00053 } 00054 m_valid = 1; 00055 }
void Ext_errmx::set_plane_errs | ( | const Hep3Vector & | nx, | |
const Hep3Vector & | ny, | |||
const Hep3Vector & | nz | |||
) | const [protected] |
Definition at line 60 of file Ext_errmx.cxx.
References m_err, m_err3, and m_R.
00062 { 00063 // Setup the rotation matrix. 00064 00065 m_R( 1, 1 ) = nx.x(); 00066 m_R( 1, 2 ) = nx.y(); 00067 m_R( 1, 3 ) = nx.z(); 00068 m_R( 2, 1 ) = ny.x(); 00069 m_R( 2, 2 ) = ny.y(); 00070 m_R( 2, 3 ) = ny.z(); 00071 m_R( 3, 1 ) = nz.x(); 00072 m_R( 3, 2 ) = nz.y(); 00073 m_R( 3, 3 ) = nz.z(); 00074 00075 // Get the 3x3 sub matrix and Rotate the error matrix. 00076 00077 m_err3 = (m_err.sub( 1, 3 )).similarity( m_R ); 00078 00079 }
Definition at line 300 of file Ext_errmx.cxx.
References Ext_err_valid(), m_err, and m_valid.
00301 { 00302 if( m_valid ){ 00303 if( Ext_err_valid( msg, m_err, 6 ) ){ 00304 return 1; 00305 } else { 00306 m_valid = 0; 00307 return 0; 00308 } 00309 } else { 00310 return 0; 00311 } 00312 }
std::ostream& operator<< | ( | std::ostream & | s, | |
const Ext_errmx & | errmx | |||
) | [friend] |
Definition at line 333 of file Ext_errmx.cxx.
00334 { 00335 s << " m_valid: " << err.m_valid << '\n' 00336 << "m_err: " << err.m_err << " m_err3: " << err.m_err3 00337 << " m_R: " << err.m_R << " m_err2: " << err.m_err2 00338 << " *m_nv: " << *err.m_nv 00339 << " *(m_nv+1): " << *(err.m_nv+1) 00340 << std::endl; 00341 return s; 00342 }
HepSymMatrix Ext_errmx::m_err [protected] |
Definition at line 133 of file Ext_errmx.h.
Referenced by get_err(), Ext_xp_err::move(), operator=(), put_err(), set_plane_errs(), and valid().
HepVector Ext_errmx::m_err2 [mutable, private] |
HepSymMatrix Ext_errmx::m_err3 [mutable, private] |
Hep3Vector Ext_errmx::m_nv[2] [mutable, private] |
HepMatrix Ext_errmx::m_R [mutable, private] |
bool Ext_errmx::m_valid [mutable, private] |