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