00001 //-------------------------------------------------------------------------- 00002 // File and Version Information: 00003 // $Id: TrkParams.cxx,v 1.1.1.1 2005/04/21 06:01:42 zhangy Exp $ 00004 // 00005 // Description: 00006 // Implementation of TrkParams class 00007 // 00008 // Environment: 00009 // Software developed for the BaBar Detector at the SLAC B-Factory. 00010 // 00011 // Author(s): Dave Brown, Steve Schaffner 00012 //------------------------------------------------------------------------ 00013 //#include "BaBar/BaBar.h" 00014 #include <assert.h> 00015 #include "TrkBase/TrkParams.h" 00016 #include <iostream> 00017 using std::ostream; 00018 00019 // Construct with the correct dimension 00020 //-------------------------------------- 00021 TrkParams::TrkParams(int ndim) : DifIndepPar(ndim), _weightInverted(false) 00022 //-------------------------------------- 00023 { 00024 } 00025 00026 // Construct from an input parameter vector and covariance matrix 00027 //-------------------------------------- 00028 TrkParams::TrkParams(const HepVector& pvec,const HepSymMatrix& pcov) : 00029 DifIndepPar(pvec, pcov), _weightInverted(false) 00030 //-------------------------------------- 00031 { 00032 00033 } 00034 00035 // copy constructor 00036 //-------------------------------------- 00037 TrkParams::TrkParams(const TrkParams& old) : 00038 DifIndepPar(old), _weightInverted(old._weightInverted), _weightMatrix(old._weightMatrix) 00039 //-------------------------------------- 00040 {} 00041 00042 // base implementation of clone function 00043 //-------------------------------------- 00044 TrkParams* 00045 TrkParams::clone() const { 00046 //-------------------------------------- 00047 return new TrkParams(*this); 00048 } 00049 00050 //-------------------------------------- 00051 TrkParams::~TrkParams() {} 00052 //-------------------------------------- 00053 00054 // Assignment operator 00055 //-------------------------------------- 00056 TrkParams& 00057 TrkParams::operator = (const TrkParams& other){ 00058 //-------------------------------------- 00059 if (this == &other) return *this; 00060 parameter() = other.parameter(); 00061 covariance() = other.covariance(); 00062 _weightInverted = other._weightInverted ; 00063 _weightMatrix = other._weightMatrix ; 00064 return *this; 00065 } 00066 00067 //-------------------------------------- 00068 void 00069 TrkParams::printAll(ostream& os) const { 00070 //-------------------------------------- 00071 DifIndepPar::printAll(os); 00072 } 00073 00074 00075 const HepSymMatrix& TrkParams::weightMatrix() const { 00076 00077 if (!_weightInverted){ 00078 _weightMatrix = covariance(); 00079 int invStatus; 00080 _weightMatrix.invert(invStatus); 00081 _weightInverted = true; 00082 } 00083 return _weightMatrix; 00084 00085 }