////////////////////////////////////////////////////////////////////////// // // // RhoError // // // // Error matrix class // // // // Author: Marcel Kunze, RUB, Nov. 99 // // Copyright (C) 1999-2001, Ruhr-University Bochum. // // Ralf Kliemt, HIM/GSI Feb.2013 (Cleanup & Restructuring) // // // ////////////////////////////////////////////////////////////////////////// #include #include #include "RhoError.h" ClassImp ( RhoError ) #include using namespace std; const Double_t RhoError::chisqUndef = -1.; RhoError::RhoError ( Int_t n, Double_t init ) { TMatrixD::Allocate ( n,n ); for ( int i1=0; i1> ( std::istream& in, RhoError& mat ) { // Peek at the next non-space character: char nextChar = ' '; while ( isspace ( nextChar ) ) { nextChar = in.get(); } in.putback ( nextChar ); if ( EOF != nextChar ) { if ( !isdigit ( nextChar ) ) { // Remove the "Bbr Covariance Matrix:" line: const int DUMMY_SIZE = 1000; char dummy[DUMMY_SIZE]; in.getline ( dummy, DUMMY_SIZE ); } // Read in the matrix: for ( int row = 1; row <= mat.GetNrows(); ++row ) { for ( int col = 1; col <= mat.GetNcols(); ++col ) { in >> mat ( row, col ); } } } return in; } RhoError& operator* ( Double_t t, const RhoError& m1 ) { static RhoError mret ( m1 ); mret.ResizeTo ( m1 ); mret = m1; mret *= t; return mret; } RhoError& operator* ( const RhoError& m1, Double_t t ) { static RhoError mret ( m1 ); mret.ResizeTo ( m1 ); mret = m1; mret *= t; return mret; } /* TError operator/(Double_t t, const TError& m1) { TError mret = m1; mret /= t; return mret; } TError operator/(const TError& m1, Double_t t) { TError mret = m1; mret /= t; return mret; } */ RhoError& operator+ ( const RhoError& m1, const RhoError& m2 ) { static RhoError mret ( m1 ); mret.ResizeTo ( m1 ); mret = m1; mret += m2; return mret; } RhoError& operator- ( const RhoError& m1, const RhoError& m2 ) { static RhoError mret ( m1 ); mret.ResizeTo ( m1 ); mret -= m2; return mret; } Double_t RhoError::Similarity ( TVectorD& m1 ) { register Double_t mret = 0.0; TVectorD temp ( m1 ); temp*= ( *this ); // If m1*(*this) has correct dimensions, then so will the m1.T multiplication. // So there is no need to check dimensions again. Double_t* a=&temp ( 0 ); Double_t* b=&m1 ( 0 ); Double_t* e=a+m1.GetNrows(); for ( ; a