/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Reconstruction/TrkExtAlg/TrkExtAlg-00-00-64/src/Ext_err_valid.cxx

Go to the documentation of this file.
00001 // File: Ext_err_valid.cc
00002 //
00003 // Check the validity of the error matrix and set the invalid element to 0.
00004 //
00005 // Creation: 13-Nov-1998
00006 // Version: 04-Mar-1999
00007 //
00008 // $Id: Ext_err_valid.cxx,v 1.2 2010/03/25 03:20:12 wangll Exp $
00009 //
00010 // Revision history
00011 //
00012 // $Log: Ext_err_valid.cxx,v $
00013 // Revision 1.2  2010/03/25 03:20:12  wangll
00014 // see the ChangeLog
00015 //
00016 // Revision 1.1.1.1  2005/08/10 06:59:26  wangll
00017 // First import TrkExtAlg.
00018 //
00019 // Revision 1.7  2000/04/13 22:13:14  katayama
00020 // added std:: to cout,cerr,endl,stream etc
00021 //
00022 // Revision 1.6  1999/03/05 07:03:27  teramoto
00023 // More for the treatment for the invalid error matrix.
00024 //
00025 // Revision 1.5  1999/03/05 02:13:43  teramoto
00026 // Reduction of the frequency of the invalid error matrix message.
00027 //
00028 // Revision 1.4  1999/02/26 09:30:02  teramoto
00029 // Suppress the invalid matrix error message and temporary fix the negative
00030 // diagonal element problem of the error matrix by forcing them to zero.
00031 //
00032 // Revision 1.3  1999/02/20 10:18:02  teramoto
00033 // Added error calculation skip function. Reduced error messages.
00034 //
00035 // Revision 1.2  1998/11/18 06:53:58  teramoto
00036 // Reduce the error messages for the invalid track error matrix.
00037 //
00038 // Revision 1.1  1998/11/13 11:20:19  teramoto
00039 // Modification for four purposes.
00040 // (1) Put protections for invalid error matrix values with error messages.
00041 // (2) Change the default media_list parameter from 0 to 1.
00042 // (3) Fill both the version 0 and 1 format panther banks as default.
00043 // (4) Put mandatory comment items in the heading comment lines.
00044 //
00045 
00046 #include        <iostream>
00047 #include        "CLHEP/Matrix/SymMatrix.h"
00048 
00049 using namespace CLHEP;
00050 
00051 static const double     Large( 1.0e13 );                // large number.
00052 
00053 /*
00054   valid(). Check the validity of the diagonal elements and if the
00055   element is not valid, force the element to 0.0.
00056 */
00057 
00058 bool Ext_err_valid( bool msg, HepSymMatrix &error, const int dimension )
00059 {
00060   bool valid( 1 );
00061   double trace( 0 );
00062 
00063   for( int i = 1; i<=dimension; i++ ){
00064     double elem( error( i, i ) );
00065     trace += elem;
00066     if( elem < 0.0 ){
00067       valid = 0;
00068       if( msg ){
00069         std::cout << "%ERROR detected at Ext_err_valid: error(" 
00070         << i << "," << i << ") = " << elem << " < 0.0. "
00071         << "Force to 0.0." << std::endl;
00072       }
00073       error( i, i ) = 0.0;
00074     } else if( elem > Large ){
00075       valid = 0;
00076       if( msg ){
00077         std::cout << "%ERROR detected at Ext_err_valid: error(" 
00078         << i << "," << i << ") = " << elem << " > " << Large
00079         << ". Force to " << Large << std::endl;
00080       }
00081       error( i, i ) = Large;
00082     }
00083   }
00084   if( !trace ) valid = 0;
00085   return( valid );
00086 }
00087 
00088 /*
00089   This only checks but it does not force to set 0.
00090 */
00091 
00092 bool Ext_err_valid( bool msg, const HepSymMatrix &error, const int dimension )
00093 {
00094   bool valid( 1 );
00095   double trace( 0 );
00096 
00097   for( int i = 1; i<=dimension; i++ ){
00098     double elem( error( i, i ) );
00099     trace += elem;
00100     if( elem < 0.0 ){
00101       valid = 0;
00102       if( msg ){
00103         std::cout << "%ERROR detected at Ext_err_valid: error matrix: error(" 
00104         << i << "," << i << ")= " << elem << " < 0.0." << std::endl;
00105       }
00106     } else if( elem > Large ){
00107       valid = 0;
00108       if( msg ){
00109         std::cout << "%ERROR detected at Ext_err_valid: error matrix: error(" 
00110         << i << "," << i << ")= " << elem << " > " << Large << std::endl;
00111       }
00112     }
00113   }
00114   if( !trace ) valid = 0;
00115   return( valid );
00116 }

Generated on Tue Nov 29 23:14:11 2016 for BOSS_7.0.2 by  doxygen 1.4.7