36static const char rscid[] =
"$Id: BesError.cxx,v 1.2 2009/12/23 02:59:56 zhangy Exp $";
44#include "MdcRecoUtil/BesError.h"
45#include "CLHEP/Matrix/Matrix.h"
54 mat(1,1)=rot.xx(); mat(1,2)=rot.xy(); mat(1,3)=rot.xz();
55 mat(2,1)=rot.yx(); mat(2,2)=rot.yy(); mat(2,3)=rot.yz();
56 mat(3,1)=rot.zx(); mat(3,2)=rot.zy(); mat(3,3)=rot.zz();
66 mat(1,1)=rot.xx(); mat(1,2)=rot.xy(); mat(1,3)=rot.xz(); mat(1,4)=rot.xt();
67 mat(2,1)=rot.yx(); mat(2,2)=rot.yy(); mat(2,3)=rot.yz(); mat(2,4)=rot.yt();
68 mat(3,1)=rot.zx(); mat(3,2)=rot.zy(); mat(3,3)=rot.zz(); mat(3,4)=rot.zt();
69 mat(4,1)=rot.tx(); mat(4,2)=rot.ty(); mat(4,3)=rot.tz(); mat(4,4)=rot.tt();
77 BesError mret(HepSymMatrix::similarity(E));
84 assert(num_row() == m1.num_row());
85 HepMatrix temp = m1*mat;
88 for (
int r = 0; r < num_row(); r++) {
89 for (
int c = 0; c <= r; c++) {
91 for (
int k = 0; k < m1.num_col(); k++) {
92 tmp += temp[r][k]*m1[c][k];
112 HepMatrix dMat(diff.num_row(), 1);
114 for (
int i = 0; i < diff.num_row(); i++) dMat[i][0] = diff[i];
116 double chisq = (inverse(ierr).similarityT(dMat))[0][0];
118 if (ierr == 0)
return chisq;
124 out <<
"Bes Covariance Matrix:";
125 out << (HepSymMatrix&) mat;
132 while (isspace(nextChar)){
135 in.putback(nextChar);
137 if (EOF != nextChar){
138 if (!isdigit(nextChar)){
140 const int DUMMY_SIZE = 1000;
141 char dummy[DUMMY_SIZE];
142 in.getline(dummy, DUMMY_SIZE);
145 for (
int row = 1; row <= mat.num_row(); ++row){
146 for (
int col = 1; col <= mat.num_col(); ++col){
ostream & operator<<(ostream &out, const BesError &mat)
BesError operator-(const BesError &m1, const BesError &m2)
BesError operator*(double t, const BesError &m1)
BesError operator/(double t, const BesError &m1)
istream & operator>>(istream &in, BesError &mat)
BesError & similarityWith(const BesError &m, const HepMatrix &m1)
static const double chisqUndef
BesError similarity(const HepRotation &rot) const
friend BesError operator+(const BesError &m1, const BesError &m2)
double determineChisq(const HepVector &diff) const