BOSS 6.6.4.p03
BESIII Offline Software System
Loading...
Searching...
No Matches
BesError.h
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2// File and Version Information:
3// $Id: BesError.h,v 1.5 2010/03/25 09:55:57 zhangy Exp $
4//
5// Description:
6// A wrapper for a covariance matrix. A covariance matrix is
7// a symmetric n X n matrix. Change in chisq from point
8// covariance matrix was determined is just
9//
10// diff * covariance^-1 * diff_transpose
11//
12// which is implemented in a similarity transform in HepSymMatrix
13// the method determineChisq carries this calculation out and requires
14// the result to be a scalar.
15//
16//
17// Environment:
18// Software developed for the BaBar Detector at the SLAC B-Factory.
19//
20// Author List:
21// Forest Rouse Jan 1996
22// Victoria Novotny Aug 1996
23//
24// Copyright Information:
25// Copyright (C) 1996
26//
27// History:
28// Migration for BESIII MDC
29//
30//------------------------------------------------------------------------
31#ifndef BESERROR_HH
32#define BESERROR_HH
33
34#include <iostream>
35#include <math.h>
36
37#include "CLHEP/Matrix/Vector.h"
38#include "CLHEP/Matrix/Matrix.h"
39#include "CLHEP/Matrix/SymMatrix.h"
40#include "CLHEP/Vector/Rotation.h"
41#include "CLHEP/Vector/LorentzRotation.h"
42
43
44using namespace CLHEP;
45
46class BesError : public HepSymMatrix {
47
48public:
49
50 static const double chisqUndef;
51 BesError() : HepSymMatrix() {}
52
53 BesError(int n) : HepSymMatrix(n, 0) {}
54
55 // autocast copy constructor. HepSymMatrix's promoted back
56 // into BesError matrices.
57
58 BesError( const HepSymMatrix &p ) : HepSymMatrix(p) {}
59
60 // new constructors for this class
61 BesError(const BesError& v) : HepSymMatrix() {*this = v;}
62
64 {
65 if (this != &v) {
66 HepSymMatrix::operator=(v);
67 }
68 return *this;
69 }
70
71 BesError& operator=(const HepSymMatrix& v)
72 {
73 if (this != &v) {
74 HepSymMatrix::operator=(v);
75 }
76 return *this;
77 }
78
79 // destructor MAY be needed later
80 // virtual ~BesError() {};
81
82 //----------------------------------------------------------------------
83 // determineChisq
84 // Compute v^T * V^(-1)*v - ie the chisq for this covariance
85 // matrix and the difference vector v.
86 //----------------------------------------------------------------------
87
88 double determineChisq(const HepVector& diff) const;
89
90 // Get right signature for all operations performed on BesError matrices
91 // that should (and will) result in BesError matrices. These include
92 // similarity transforms, transpose, inverse, matrix multiplication,
93 // addition, and subtraction. HepSymMatrix's as a result of operations
94 // are promoted back into BesError matrices if we start out
95 // with BesError matrices in the first place. (See copy constructors)
96
98 { return (BesError&) HepSymMatrix::operator*=(t); }
99
101 {return (BesError&) HepSymMatrix::operator/=(t); }
102
104 {
105 HepSymMatrix::operator+=(m2);
106 return *this;
107 }
108
110 {
111 HepSymMatrix::operator-=(m2);
112 return *this;
113 }
114
116 { BesError temp(*this);
117 return temp; }
118 // does nothing -- covariance Matrices have never negative entries on the
119 // main diagonal
120
121 // Implement the signature for operators I also inherit
122 BesError& operator += (const HepSymMatrix& m2)
123 {
124 HepSymMatrix::operator+=(m2);
125 return *this;
126 }
127
128 BesError& operator -= (const HepSymMatrix& m2)
129 {
130 HepSymMatrix::operator-=(m2);
131 return *this;
132 }
133
135 { BesError temp(*this);
136 return temp;}
137
138 BesError& operator += (const HepDiagMatrix& m2)
139 {
140 HepSymMatrix::operator+=(m2);
141 return *this;
142 }
143
144 BesError& operator -= (const HepDiagMatrix& m2)
145 {
146 HepSymMatrix::operator-=(m2);
147 return *this;
148 }
149
150 BesError similarity(const HepRotation& rot) const;
151 BesError similarity(const HepLorentzRotation& rot) const;
152 // When feasible implement R * covMatrix * R_transpose (= R^-1)
153
154 BesError similarity(const BesError& E);
155 // implement E * covMatrix * E
156
157 BesError similarity(const HepMatrix& m1) const
158 {
159 BesError mret(m1.num_row());
160 mret.similarityWith(*this, m1);
161 return mret;
162 }
163
164 BesError& similarityWith(const BesError& m, const HepMatrix& m1);
165
166 // provide call ups to base classes similarity methods not implemented
167 // here
168 double similarity(const HepVector &v) const
169 { return this->HepSymMatrix::similarity( v ); }
170 HepSymMatrix similarity(const HepSymMatrix &m1) const
171 { return this->HepSymMatrix::similarity( m1 ); }
172
173private:
174
175 friend BesError operator*(double t, const BesError& m1);
176
177 friend BesError operator*(const BesError& m1, double t);
178
179 friend BesError operator/(double t, const BesError& m1);
180
181 friend BesError operator/(const BesError& m1, double t);
182
183 friend BesError operator+(const BesError& m1, const BesError& m2);
184
185 friend BesError operator-(const BesError& m1, const BesError& m2);
186
187 friend std::ostream& operator<<(std::ostream& out, const BesError& mat);
188 friend std::istream& operator>>(std::istream& in, BesError& mat);
189
190};
191
192#endif
193
194
195
196
197
198
const Int_t n
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
Definition: KarLud.h:35
BesError & similarityWith(const BesError &m, const HepMatrix &m1)
Definition: BesError.cxx:81
BesError & operator=(const HepSymMatrix &v)
Definition: BesError.h:71
BesError & operator-=(const BesError &m2)
Definition: BesError.h:109
BesError(const BesError &v)
Definition: BesError.h:61
BesError & operator/=(double t)
Definition: BesError.h:100
static const double chisqUndef
Definition: BesError.h:50
BesError similarity(const HepRotation &rot) const
Definition: BesError.cxx:51
BesError(const HepSymMatrix &p)
Definition: BesError.h:58
BesError similarity(const HepMatrix &m1) const
Definition: BesError.h:157
HepSymMatrix similarity(const HepSymMatrix &m1) const
Definition: BesError.h:170
BesError(int n)
Definition: BesError.h:53
friend BesError operator+(const BesError &m1, const BesError &m2)
Definition: BesError.cxx:183
double similarity(const HepVector &v) const
Definition: BesError.h:168
BesError operator-()
Definition: BesError.h:115
friend BesError operator*(double t, const BesError &m1)
Definition: BesError.cxx:155
double determineChisq(const HepVector &diff) const
Definition: BesError.cxx:109
friend BesError operator/(double t, const BesError &m1)
Definition: BesError.cxx:169
friend std::istream & operator>>(std::istream &in, BesError &mat)
BesError & operator*=(double t)
Definition: BesError.h:97
BesError & operator=(const BesError &v)
Definition: BesError.h:63
BesError & operator+=(const BesError &m2)
Definition: BesError.h:103
friend std::ostream & operator<<(std::ostream &out, const BesError &mat)
BesError()
Definition: BesError.h:51
int t()
Definition: t.c:1