PandaRoot
RhoError.h
Go to the documentation of this file.
1 #ifndef RHOERROR_H
2 #define RHOERROR_H
3 // //
5 // RhoError //
6 // //
7 // Error matrix class //
8 // //
9 // Author: Marcel Kunze, RUB, Nov. 99 //
10 // Copyright (C) 1999-2001, Ruhr-University Bochum. //
11 // Ralf Kliemt, HIM/GSI Feb.2013 (Cleanup & Restructuring) //
12 // //
14 
15 // Description:
16 // A wrapper for a covariance matrix. A covariance matrix is
17 // a symmetric n X n matrix. Change in chisq from point
18 // covariance matrix was determined is just
19 //
20 // diff * covariance^-1 * diff_transpose
21 //
22 // which is implemented in a similarity transform in TMatrixD
23 // the method determineChisq carries this calculation out and requires
24 // the result to be a scalar.
25 
26 #include <iostream>
27 
28 #include <math.h>
29 #include "TVectorD.h"
30 #include "TMatrixD.h"
31 #include "TRotation.h"
32 #include "TLorentzRotation.h"
33 
34 class RhoError : public TMatrixD {
35 
36  public:
37  static const Double_t chisqUndef;
38 
39  RhoError(Int_t n, Double_t init = 0.0);
40 
41  // autocast copy constructor. TMatrixD's promoted back
42  // into TError matrices.
43 
44  RhoError(const TMatrixD &p);
45 
46  // new constructors for this class
47  RhoError(const RhoError &v);
48 
49  RhoError &operator=(const RhoError &v);
50 
51  RhoError &operator=(const TMatrixD &v);
52 
53  // destructor MAY be needed later
54  virtual ~RhoError(){};
55 
56  //----------------------------------------------------------------------
57  // determineChisq
58  // Compute v^T * V^(-1)*v - ie the chisq for this covariance
59  // matrix and the difference vector v.
60  //----------------------------------------------------------------------
61 
62  Double_t DetermineChisq(TVectorD &diff);
63 
64  // Get right signature for all operations performed on TError matrices
65  // that should (and will) result in TError matrices. These include
66  // similarity transforms, transpose, inverse, matrix multiplication,
67  // addition, and subtraction. TMatrixD's as a result of operations
68  // are promoted back into TError matrices if we start out
69  // with TError matrices in the first place. (See copy constructors)
70 
71  RhoError &operator*=(Double_t t);
72 
73  // TError& operator /= (Double_t t);
74 
75  // TError& operator += (const TError& m2);
76 
77  // TError& operator -= (const TError& m2);
78 
80 
81  // TError& Similarity(const TError& E);
82  // implement E * covMatrix * E
83 
84  RhoError Similarity(const TMatrixD &m1) const;
85 
86  RhoError &SimilarityWith(const RhoError &m, const TMatrixD &m1);
87 
88  RhoError Similarity(const TRotation &rot) const;
89  RhoError Similarity(const TLorentzRotation &rot) const;
90  // When feasible implement R * covMatrix * R_transpose (= R^-1)
91 
92  Double_t Similarity(TVectorD &m1);
94 
95  private:
96  friend RhoError operator*(Double_t t, const RhoError &m1);
97 
98  friend RhoError operator*(const RhoError &m1, Double_t t);
99  /*
100  friend TError& operator/(Double_t t, const TError& m1);
101 
102  friend TError& operator/(const TError& m1, Double_t t);
103  */
104  friend RhoError operator+(const RhoError &m1, const RhoError &m2);
105 
106  friend RhoError operator-(const RhoError &m1, const RhoError &m2);
107 
108  friend std::ostream &operator<<(std::ostream &out, const RhoError &mat);
109  friend std::istream &operator>>(std::istream &in, RhoError &mat);
110 
111  public:
112  ClassDef(RhoError, 1) // Wrapper class for a covariance matrix
113 };
114 
115 #endif
RhoError Similarity(const TMatrixD &m1) const
friend std::istream & operator>>(std::istream &in, RhoError &mat)
friend RhoError operator*(Double_t t, const RhoError &m1)
Double_t DetermineChisq(TVectorD &diff)
__m128 m
Definition: P4_F32vec4.h:26
friend std::ostream & operator<<(std::ostream &out, const RhoError &mat)
__m128 v
Definition: P4_F32vec4.h:3
static const Double_t chisqUndef
Definition: RhoError.h:37
friend RhoError operator+(const RhoError &m1, const RhoError &m2)
RhoError & SimilarityWith(const RhoError &m, const TMatrixD &m1)
RhoError & operator*=(Double_t t)
RhoError & operator=(const RhoError &v)
TMatrixD SimilarityT(TMatrixD &m1)
RhoError(Int_t n, Double_t init=0.0)
RhoError & operator-()
TMatrixT< double > TMatrixD
Definition: PndLmdDim.h:52
virtual ~RhoError()
Definition: RhoError.h:54