00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "MdcRecoUtil/DifVector.h"
00023 #include "MdcRecoUtil/DifRotation.h"
00024 #include "CLHEP/Vector/ThreeVector.h"
00025 using std::cout;
00026
00027 extern const DifVector xhat(1,0,0);
00028 extern const DifVector yhat(0,1,0);
00029 extern const DifVector zhat(0,0,1);
00030 extern const DifVector nullVec(0,0,0);
00031
00032 DifVector::DifVector()
00033 :x(0.0),y(0.0),z(0.0)
00034 {}
00035
00036 DifVector::DifVector
00037 (const DifNumber& X,const DifNumber& Y,const DifNumber& Z)
00038 :x(X),y(Y),z(Z)
00039 {}
00040
00041 DifVector::DifVector
00042 (double X, double Y,double Z)
00043 :x(X),y(Y),z(Z)
00044 {}
00045
00046 DifVector::DifVector(const Hep3Vector& v)
00047 :x(v.x()),y(v.y()),z(v.z())
00048 {}
00049
00050 DifVector::DifVector(const DifVector& v)
00051 :x(v.x),y(v.y),z(v.z)
00052 {}
00053
00054 HepSymMatrix DifVector::errorMatrix(const HepSymMatrix& e)const {
00055 HepSymMatrix temp(3);
00056 temp(1,1)=correlation(x,x,e);
00057 temp(1,2)=correlation(x,y,e);
00058 temp(1,3)=correlation(x,z,e);
00059 temp(2,2)=correlation(y,y,e);
00060 temp(2,3)=correlation(y,z,e);
00061 temp(3,3)=correlation(z,z,e);
00062 return temp;
00063 }
00064
00065 HepMatrix DifVector::jacobian()const{
00066 int npar=x.nPar();
00067 HepMatrix temp(3,npar);
00068 for(int i=1; i<=npar; i++){
00069 temp(1,i)=x.derivative(i);
00070 temp(2,i)=y.derivative(i);
00071 temp(3,i)=z.derivative(i);
00072 }
00073 return temp;
00074 }
00075
00076 DifVector& DifVector::rotate(const DifRotation& r) {
00077 r.rotate(*this); return *this;
00078 }
00079
00080 DifVector& DifVector::rotate(const DifNumber& a,const DifNumber& b,const DifNumber& g) {
00081 DifRotation(a,b,g).rotate(*this);
00082 return *this;
00083 }
00084
00085 void DifVector::print()const {
00086
00087
00088
00089
00090
00091
00092 cout << "Yzhang::DifVector::print x,y,z SKIPED!\n";
00093 }