CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/TrackingTools/TrajectoryParametrization/interface/CurvilinearTrajectoryError.h

Go to the documentation of this file.
00001 #ifndef _TRACKER_CURVILINEARTRAJECTORYERROR_H_
00002 #define _TRACKER_CURVILINEARTRAJECTORYERROR_H_
00003 
00004 #include "DataFormats/GeometrySurface/interface/TrivialError.h"
00005 #include "DataFormats/Math/interface/AlgebraicROOTObjects.h"
00006 #include "DataFormats/Math/interface/Error.h"
00007 
00027 class CurvilinearTrajectoryError {
00028 public:
00029 
00031   enum { dimension = 5 };
00033   typedef math::Error<dimension>::type MathCovarianceMatrix;
00034 
00035 // construct
00036   CurvilinearTrajectoryError() {}
00037 
00038   CurvilinearTrajectoryError(InvalidError) {theCovarianceMatrix(0,0)=-99999.e10;}
00039 
00043   CurvilinearTrajectoryError(const AlgebraicSymMatrix55& aCovarianceMatrix) :
00044     theCovarianceMatrix(aCovarianceMatrix) { }
00045 
00046   bool invalid() const { return theCovarianceMatrix(0,0)<-1.e10;}
00047   bool valid() const { return !invalid();}
00048 
00049   // not really full check of posdef
00050   bool posDef() const { 
00051     return (theCovarianceMatrix(0,0)>=0) && (theCovarianceMatrix(1,1)>=0) && 
00052       (theCovarianceMatrix(2,2)>=0) && (theCovarianceMatrix(3,3)>=0) && (theCovarianceMatrix(4,4)>=0);
00053   }
00054 
00055 
00056 // access
00057 
00060   const AlgebraicSymMatrix55 &matrix() const {
00061     return theCovarianceMatrix;
00062   }
00063 
00067   void operator *= (double factor) {
00068     theCovarianceMatrix *= factor;
00069   }
00070 
00071   void zeroFieldScaling(double factor){
00072     double root_of_factor = sqrt(factor);
00073     //scale the 0 indexed covariance by the factor
00074     for (unsigned int i=1;i!=5;++i)      theCovarianceMatrix(i,0)*=root_of_factor;
00075 
00076     //scale all others by the scared factor
00077     for (unsigned int i=1;i!=5;++i)  for (unsigned int j=i;j!=5;++j) theCovarianceMatrix(i,j)*=factor;
00078     //term 0,0 is not scaled at all
00079   }
00080 
00081   operator MathCovarianceMatrix() { return theCovarianceMatrix; }
00082   operator const MathCovarianceMatrix &() const { return theCovarianceMatrix; }
00083 
00084 private:
00085   AlgebraicSymMatrix55 theCovarianceMatrix;
00086 };
00087 
00088 #endif