BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Reconstruction/MdcPatRec/MdcRecoUtil/include/MdcRecoUtil/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/Matrix.h"
38#include "CLHEP/Matrix/SymMatrix.h"
39#include "CLHEP/Matrix/Vector.h"
40#include "CLHEP/Vector/LorentzRotation.h"
41#include "CLHEP/Vector/Rotation.h"
42
43using namespace CLHEP;
44
45class BesError : public HepSymMatrix {
46
47public:
48 static const double chisqUndef;
49 BesError() : HepSymMatrix() {}
50
51 BesError( int n ) : HepSymMatrix( n, 0 ) {}
52
53 // autocast copy constructor. HepSymMatrix's promoted back
54 // into BesError matrices.
55
56 BesError( const HepSymMatrix& p ) : HepSymMatrix( p ) {}
57
58 // new constructors for this class
59 BesError( const BesError& v ) : HepSymMatrix() { *this = v; }
60
62 if ( this != &v ) { HepSymMatrix::operator=( v ); }
63 return *this;
64 }
65
66 BesError& operator=( const HepSymMatrix& v ) {
67 if ( this != &v ) { HepSymMatrix::operator=( v ); }
68 return *this;
69 }
70
71 // destructor MAY be needed later
72 // virtual ~BesError() {};
73
74 //----------------------------------------------------------------------
75 // determineChisq
76 // Compute v^T * V^(-1)*v - ie the chisq for this covariance
77 // matrix and the difference vector v.
78 //----------------------------------------------------------------------
79
80 double determineChisq( const HepVector& diff ) const;
81
82 // Get right signature for all operations performed on BesError matrices
83 // that should (and will) result in BesError matrices. These include
84 // similarity transforms, transpose, inverse, matrix multiplication,
85 // addition, and subtraction. HepSymMatrix's as a result of operations
86 // are promoted back into BesError matrices if we start out
87 // with BesError matrices in the first place. (See copy constructors)
88
89 BesError& operator*=( double t ) { return (BesError&)HepSymMatrix::operator*=( t ); }
90
91 BesError& operator/=( double t ) { return (BesError&)HepSymMatrix::operator/=( t ); }
92
94 HepSymMatrix::operator+=( m2 );
95 return *this;
96 }
97
99 HepSymMatrix::operator-=( m2 );
100 return *this;
101 }
102
104 BesError temp( *this );
105 return temp;
106 }
107 // does nothing -- covariance Matrices have never negative entries on the
108 // main diagonal
109
110 // Implement the signature for operators I also inherit
111 BesError& operator+=( const HepSymMatrix& m2 ) {
112 HepSymMatrix::operator+=( m2 );
113 return *this;
114 }
115
116 BesError& operator-=( const HepSymMatrix& m2 ) {
117 HepSymMatrix::operator-=( m2 );
118 return *this;
119 }
120
122 BesError temp( *this );
123 return temp;
124 }
125
126 BesError& operator+=( const HepDiagMatrix& m2 ) {
127 HepSymMatrix::operator+=( m2 );
128 return *this;
129 }
130
131 BesError& operator-=( const HepDiagMatrix& m2 ) {
132 HepSymMatrix::operator-=( m2 );
133 return *this;
134 }
135
136 BesError similarity( const HepRotation& rot ) const;
137 BesError similarity( const HepLorentzRotation& rot ) const;
138 // When feasible implement R * covMatrix * R_transpose (= R^-1)
139
141 // implement E * covMatrix * E
142
143 BesError similarity( const HepMatrix& m1 ) const {
144 BesError mret( m1.num_row() );
145 mret.similarityWith( *this, m1 );
146 return mret;
147 }
148
149 BesError& similarityWith( const BesError& m, const HepMatrix& m1 );
150
151 // provide call ups to base classes similarity methods not implemented
152 // here
153 double similarity( const HepVector& v ) const { return this->HepSymMatrix::similarity( v ); }
154 HepSymMatrix similarity( const HepSymMatrix& m1 ) const {
155 return this->HepSymMatrix::similarity( m1 );
156 }
157
158private:
159 friend BesError operator*( double t, const BesError& m1 );
160
161 friend BesError operator*( const BesError& m1, double t );
162
163 friend BesError operator/( double t, const BesError& m1 );
164
165 friend BesError operator/( const BesError& m1, double t );
166
167 friend BesError operator+( const BesError& m1, const BesError& m2 );
168
169 friend BesError operator-( const BesError& m1, const BesError& m2 );
170
171 friend std::ostream& operator<<( std::ostream& out, const BesError& mat );
172 friend std::istream& operator>>( std::istream& in, BesError& mat );
173};
174
175#endif
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:93
BesError similarity(const HepRotation &rot) const
BesError similarity(const BesError &E)
HepSymMatrix similarity(const HepSymMatrix &m1) const
friend BesError operator+(const BesError &m1, const BesError &m2)
Definition BesError.cxx:182
friend BesError operator*(double t, const BesError &m1)
Definition BesError.cxx:158
double determineChisq(const HepVector &diff) const
friend BesError operator/(double t, const BesError &m1)
Definition BesError.cxx:170
BesError similarity(const HepLorentzRotation &rot) const
friend std::istream & operator>>(std::istream &in, BesError &mat)
friend std::ostream & operator<<(std::ostream &out, const BesError &mat)
double double * m2
Definition qcdloop1.h:83
double * m1
Definition qcdloop1.h:83
int t()
Definition t.c:1