FairRoot/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 
37  public:
38 
39  static const Double_t chisqUndef;
40 
41  RhoError ( Int_t n, Double_t init = 0.0 );
42 
43  // autocast copy constructor. TMatrixD's promoted back
44  // into TError matrices.
45 
46  RhoError ( const TMatrixD& p );
47 
48  // new constructors for this class
49  RhoError ( const RhoError& v );
50 
51  RhoError& operator= ( const RhoError& v );
52 
53  RhoError& operator= ( const TMatrixD& v );
54 
55  // destructor MAY be needed later
56  virtual ~RhoError() {};
57 
58  //----------------------------------------------------------------------
59  // determineChisq
60  // Compute v^T * V^(-1)*v - ie the chisq for this covariance
61  // matrix and the difference vector v.
62  //----------------------------------------------------------------------
63 
64  Double_t DetermineChisq ( TVectorD& diff );
65 
66  // Get right signature for all operations performed on TError matrices
67  // that should (and will) result in TError matrices. These include
68  // similarity transforms, transpose, inverse, matrix multiplication,
69  // addition, and subtraction. TMatrixD's as a result of operations
70  // are promoted back into TError matrices if we start out
71  // with TError matrices in the first place. (See copy constructors)
72 
74 
75  // TError& operator /= (Double_t t);
76 
77  // TError& operator += (const TError& m2);
78 
79  // TError& operator -= (const TError& m2);
80 
82 
83  //TError& Similarity(const TError& E);
84  // implement E * covMatrix * E
85 
86  RhoError Similarity ( const TMatrixD& m1 ) const;
87 
88  RhoError& SimilarityWith ( const RhoError& m, const TMatrixD& m1 );
89 
90  RhoError Similarity ( const TRotation& rot ) const;
91  RhoError Similarity ( const TLorentzRotation& rot ) const;
92  // When feasible implement R * covMatrix * R_transpose (= R^-1)
93 
94  Double_t Similarity ( TVectorD& m1 );
96 
97  private:
98 
99  friend RhoError operator* ( Double_t t, const RhoError& m1 );
100 
101  friend RhoError operator* ( const RhoError& m1, Double_t t );
102  /*
103  friend TError& operator/(Double_t t, const TError& m1);
104 
105  friend TError& operator/(const TError& m1, Double_t t);
106  */
107  friend RhoError operator+ ( const RhoError& m1, const RhoError& m2 );
108 
109  friend RhoError operator- ( const RhoError& m1, const RhoError& m2 );
110 
111  friend std::ostream& operator<< ( std::ostream& out, const RhoError& mat );
112  friend std::istream& operator>> ( std::istream& in, RhoError& mat );
113 
114  public:
115  ClassDef ( RhoError,1 ) // Wrapper class for a covariance matrix
116 };
117 
118 #endif
friend std::istream & operator>>(std::istream &in, RhoError &mat)
Definition: RhoError.cxx:186
RhoError & SimilarityWith(const RhoError &m, const TMatrixD &m1)
Definition: RhoError.cxx:140
friend RhoError operator*(Double_t t, const RhoError &m1)
Definition: RhoError.cxx:213
Double_t DetermineChisq(TVectorD &diff)
Definition: RhoError.cxx:166
__m128 m
Definition: P4_F32vec4.h:28
int n
friend std::ostream & operator<<(std::ostream &out, const RhoError &mat)
Definition: RhoError.cxx:179
__m128 v
Definition: P4_F32vec4.h:4
Double_t p
Definition: anasim.C:58
static int init
Definition: ranlxd.cxx:374
static const Double_t chisqUndef
Definition: RhoError.h:39
friend RhoError operator+(const RhoError &m1, const RhoError &m2)
Definition: RhoError.cxx:245
RhoError & operator*=(Double_t t)
Definition: RhoError.cxx:61
TString m2(TString pts, TString exts="e px py pz")
Definition: invexp.C:117
Double_t
TMatrixD SimilarityT(TMatrixD &m1)
Definition: RhoError.cxx:278
RhoError(Int_t n, Double_t init=0.0)
Definition: RhoError.cxx:25
TFile * out
Definition: reco_muo.C:20
RhoError Similarity(const TMatrixD &m1) const
Definition: RhoError.cxx:104
TGeoRotation rot
TTree * t
Definition: bump_analys.C:13
RhoError & operator=(const RhoError &v)
Definition: RhoError.cxx:47
TMatrixT< double > TMatrixD
Definition: PndLmdDim.h:52
virtual ~RhoError()
Definition: RhoError.h:56
RhoError & operator-()
Definition: RhoError.cxx:81