FairRoot/PandaRoot
Public Member Functions | Static Public Attributes | Friends | List of all members
RhoError Class Reference

#include <RhoError.h>

Inheritance diagram for RhoError:

Public Member Functions

 RhoError (Int_t n, Double_t init=0.0)
 
 RhoError (const TMatrixD &p)
 
 RhoError (const RhoError &v)
 
RhoErroroperator= (const RhoError &v)
 
RhoErroroperator= (const TMatrixD &v)
 
virtual ~RhoError ()
 
Double_t DetermineChisq (TVectorD &diff)
 
RhoErroroperator*= (Double_t t)
 
RhoErroroperator- ()
 
RhoError Similarity (const TMatrixD &m1) const
 
RhoErrorSimilarityWith (const RhoError &m, const TMatrixD &m1)
 
RhoError Similarity (const TRotation &rot) const
 
RhoError Similarity (const TLorentzRotation &rot) const
 
Double_t Similarity (TVectorD &m1)
 
TMatrixD SimilarityT (TMatrixD &m1)
 

Static Public Attributes

static const Double_t chisqUndef = -1.
 

Friends

RhoError operator* (Double_t t, const RhoError &m1)
 
RhoError operator* (const RhoError &m1, Double_t t)
 
RhoError operator+ (const RhoError &m1, const RhoError &m2)
 
RhoError operator- (const RhoError &m1, const RhoError &m2)
 
std::ostreamoperator<< (std::ostream &out, const RhoError &mat)
 
std::istreamoperator>> (std::istream &in, RhoError &mat)
 

Detailed Description

Definition at line 34 of file RhoError.h.

Constructor & Destructor Documentation

RhoError::RhoError ( Int_t  n,
Double_t  init = 0.0 
)

Definition at line 25 of file RhoError.cxx.

References init, and n.

26 {
27  TMatrixD::Allocate ( n,n );
28  for ( int i1=0; i1<n; i1++ )
29  for ( int i2=0; i2<n; i2++ ) {
30  TMatrixD::operator() ( i1,i2 ) = init;
31  }
32 }
int n
static int init
Definition: ranlxd.cxx:374
RhoError::RhoError ( const TMatrixD p)

Definition at line 41 of file RhoError.cxx.

42 {
43  TMatrixD::Allocate ( p.GetNrows(),p.GetNcols() );
44  TMatrixD::operator= ( p );
45 }
Double_t p
Definition: anasim.C:58
RhoError::RhoError ( const RhoError v)

Definition at line 34 of file RhoError.cxx.

34  :
35 TMatrixD(v)
36 {
37  TMatrixD::Allocate ( v.GetNrows(),v.GetNcols() );
38  TMatrixD::operator= ( v );
39 }
TMatrixT< double > TMatrixD
Definition: PndLmdDim.h:52
virtual RhoError::~RhoError ( )
inlinevirtual

Definition at line 56 of file RhoError.h.

56 {};

Member Function Documentation

Double_t RhoError::DetermineChisq ( TVectorD &  diff)

Definition at line 166 of file RhoError.cxx.

References Double_t, i, and SimilarityT().

Referenced by RhoVector3Err::DetermineChisq(), and RhoLorentzVectorErr::DetermineChisq().

167 {
168  TMatrixD dMat ( diff.GetNrows(),diff.GetNrows() );
169  dMat.UnitMatrix();
170 
171  for ( int i = 0; i < diff.GetNrows(); i++ ) { dMat ( i,0 ) = diff ( i ); }
172 
173  Invert();
174  Double_t chisq = SimilarityT ( dMat ) ( 0,0 );
175 
176  return chisq;
177 }
Int_t i
Definition: run_full.C:25
Double_t
TMatrixD SimilarityT(TMatrixD &m1)
Definition: RhoError.cxx:278
TMatrixT< double > TMatrixD
Definition: PndLmdDim.h:52
RhoError & RhoError::operator*= ( Double_t  t)

Definition at line 61 of file RhoError.cxx.

References operator*=().

62 {
63  return ( RhoError& ) TMatrixD::operator*= ( t );
64 }
friend void operator*=(F32vec1 &a, const F32vec1 &b)
TTree * t
Definition: bump_analys.C:13
RhoError & RhoError::operator- ( )

Definition at line 81 of file RhoError.cxx.

82 {
83  return *this;
84 }
RhoError & RhoError::operator= ( const RhoError v)

Definition at line 47 of file RhoError.cxx.

48 {
49  TMatrixD::ResizeTo ( v );
50  TMatrixD::operator= ( v );
51  return *this;
52 }
RhoError & RhoError::operator= ( const TMatrixD v)

Definition at line 54 of file RhoError.cxx.

55 {
56  TMatrixD::ResizeTo ( v );
57  TMatrixD::operator= ( v );
58  return *this;
59 }
__m128 v
Definition: P4_F32vec4.h:4
RhoError RhoError::Similarity ( const TMatrixD m1) const

Definition at line 104 of file RhoError.cxx.

References SimilarityWith().

Referenced by RhoCandidate::Set(), Similarity(), RhoVector3Err::Transform(), and RhoLorentzVectorErr::Transform().

105 {
106  RhoError mret ( m1.GetNrows() );
107  mret.ResizeTo ( m1.GetNrows(),m1.GetNrows() );
108  mret.SimilarityWith ( *this, m1 );
109  return mret;
110 }
RhoError & SimilarityWith(const RhoError &m, const TMatrixD &m1)
Definition: RhoError.cxx:140
RhoError RhoError::Similarity ( const TRotation &  rot) const

Definition at line 88 of file RhoError.cxx.

References Similarity().

89 {
90  TMatrixD mat ( 3,3 );
91  mat ( 0,0 ) =rot.XX();
92  mat ( 0,1 ) =rot.XY();
93  mat ( 0,2 ) =rot.XZ();
94  mat ( 1,0 ) =rot.YX();
95  mat ( 1,1 ) =rot.YY();
96  mat ( 1,2 ) =rot.YZ();
97  mat ( 2,0 ) =rot.ZX();
98  mat ( 2,1 ) =rot.ZY();
99  mat ( 2,2 ) =rot.ZZ();
100 
101  return Similarity ( mat );
102 }
RhoError Similarity(const TMatrixD &m1) const
Definition: RhoError.cxx:104
TGeoRotation rot
TMatrixT< double > TMatrixD
Definition: PndLmdDim.h:52
RhoError RhoError::Similarity ( const TLorentzRotation &  rot) const

Definition at line 112 of file RhoError.cxx.

References Similarity().

113 {
114  TMatrixD mat ( 4,4 );
115  mat ( 0,0 ) =rot.XX();
116  mat ( 0,1 ) =rot.XY();
117  mat ( 0,2 ) =rot.XZ();
118  mat ( 0,3 ) =rot.XT();
119  mat ( 1,0 ) =rot.YX();
120  mat ( 1,1 ) =rot.YY();
121  mat ( 1,2 ) =rot.YZ();
122  mat ( 1,3 ) =rot.YT();
123  mat ( 2,0 ) =rot.ZX();
124  mat ( 2,1 ) =rot.ZY();
125  mat ( 2,2 ) =rot.ZZ();
126  mat ( 2,3 ) =rot.ZT();
127  mat ( 3,0 ) =rot.TX();
128  mat ( 3,1 ) =rot.TY();
129  mat ( 3,2 ) =rot.TZ();
130  mat ( 3,3 ) =rot.TT();
131 
132  return Similarity ( mat );
133 }
RhoError Similarity(const TMatrixD &m1) const
Definition: RhoError.cxx:104
TGeoRotation rot
TMatrixT< double > TMatrixD
Definition: PndLmdDim.h:52
Double_t RhoError::Similarity ( TVectorD &  m1)

Definition at line 264 of file RhoError.cxx.

References a, b, and Double_t.

265 {
266  Double_t mret = 0.0;
267  TVectorD temp ( m1 );
268  temp*= ( *this );
269  // If m1*(*this) has correct dimensions, then so will the m1.T multiplication.
270  // So there is no need to check dimensions again.
271  Double_t* a=&temp ( 0 );
272  Double_t* b=&m1 ( 0 );
273  Double_t* e=a+m1.GetNrows();
274  for ( ; a<e; ) { mret += ( * ( a++ ) ) * ( * ( b++ ) ); }
275  return mret;
276 }
TTree * b
Int_t a
Definition: anaLmdDigi.C:126
Double_t
TMatrixD RhoError::SimilarityT ( TMatrixD m1)

Definition at line 278 of file RhoError.cxx.

References c, Double_t, i, n, and r.

Referenced by DetermineChisq().

279 {
280  TMatrixD mret;
281  mret.ResizeTo ( m1 );
282  TMatrixD::Mult ( *this,m1 );
283  int n = m1.GetNcols();
284  Double_t* mrc = &mret ( 0,0 );
285  Double_t* temp1r = &TMatrixD::operator() ( 0,0 );
286  for ( int r=1; r<=mret.GetNrows(); r++ ) {
287  Double_t* m11c = &m1 ( 0,0 );
288  for ( int c=1; c<=r; c++ ) {
289  Double_t tmp = 0.0;
290  Double_t* tempir = temp1r;
291  Double_t* m1ic = m11c;
292  for ( int i=1; i<=m1.GetNrows(); i++ ) {
293  tmp+= ( * ( tempir ) ) * ( * ( m1ic ) );
294  tempir += n;
295  m1ic += n;
296  }
297  * ( mrc++ ) = tmp;
298  m11c++;
299  }
300  temp1r++;
301  }
302  return mret;
303 }
double r
Definition: RiemannTest.C:14
Int_t i
Definition: run_full.C:25
int n
Double_t
TMatrixT< double > TMatrixD
Definition: PndLmdDim.h:52
RhoError & RhoError::SimilarityWith ( const RhoError m,
const TMatrixD m1 
)

Definition at line 140 of file RhoError.cxx.

References c, Double_t, and r.

Referenced by Similarity().

141 {
142  assert ( GetNrows() == m1.GetNrows() );
143  TMatrixD temp;
144  temp.ResizeTo ( m1.GetNrows(),m1.GetNrows() );
145  temp.Mult ( m1,mat );
146  Double_t tmp;
147 
148  for ( int r = 0; r < GetNrows(); r++ ) {
149  for ( int c = 0; c <= r; c++ ) {
150  tmp = 0.;
151  for ( int k = 0; k < m1.GetNcols(); k++ ) {
152  tmp += temp ( r,k ) *m1 ( c,k );
153  }
154  ( *this ) ( r,c ) = tmp;
155  }
156  }
157  return *this;
158 }
double r
Definition: RiemannTest.C:14
Double_t
TMatrixT< double > TMatrixD
Definition: PndLmdDim.h:52

Friends And Related Function Documentation

RhoError operator* ( Double_t  t,
const RhoError m1 
)
friend

Definition at line 213 of file RhoError.cxx.

214 {
215  RhoError mret ( m1 );
216  //mret.ResizeTo ( m1 );
217  //mret = m1;
218  mret *= t;
219  return mret;
220 }
TTree * t
Definition: bump_analys.C:13
RhoError operator* ( const RhoError m1,
Double_t  t 
)
friend

Definition at line 222 of file RhoError.cxx.

223 {
224  RhoError mret ( m1 );
225  //mret.ResizeTo ( m1 );
226  //mret = m1;
227  mret *= t;
228  return mret;
229 }
TTree * t
Definition: bump_analys.C:13
RhoError operator+ ( const RhoError m1,
const RhoError m2 
)
friend

Definition at line 245 of file RhoError.cxx.

246 {
247  RhoError mret ( m1 );
248  //mret.ResizeTo ( m1 );
249  //mret = m1;
250  mret += m2;
251  //std::cout<<" -- Adding two matrices: -- m1:"<<&m1<<" m2:"<<&m2<<std::endl;
252  return mret;
253 }
TString m2(TString pts, TString exts="e px py pz")
Definition: invexp.C:117
RhoError operator- ( const RhoError m1,
const RhoError m2 
)
friend

Definition at line 255 of file RhoError.cxx.

256 {
257  RhoError mret ( m1 );
258  //mret.ResizeTo ( m1 );
259  mret -= m2;
260  return mret;
261 }
TString m2(TString pts, TString exts="e px py pz")
Definition: invexp.C:117
std::ostream& operator<< ( std::ostream out,
const RhoError mat 
)
friend

Definition at line 179 of file RhoError.cxx.

180 {
181  out << "Bbr Covariance Matrix:";
182  out << ( TMatrixD& ) mat;
183  return out;
184 }
TFile * out
Definition: reco_muo.C:20
TMatrixT< double > TMatrixD
Definition: PndLmdDim.h:52
std::istream& operator>> ( std::istream in,
RhoError mat 
)
friend

Definition at line 186 of file RhoError.cxx.

187 {
188  // Peek at the next non-space character:
189  char nextChar = ' ';
190  while ( isspace ( nextChar ) ) {
191  nextChar = in.get();
192  }
193  in.putback ( nextChar );
194 
195  if ( EOF != nextChar ) {
196  if ( !isdigit ( nextChar ) ) {
197  // Remove the "Bbr Covariance Matrix:" line:
198  const int DUMMY_SIZE = 1000;
199  char dummy[DUMMY_SIZE];
200  in.getline ( dummy, DUMMY_SIZE );
201  }
202  // Read in the matrix:
203  for ( int row = 1; row <= mat.GetNrows(); ++row ) {
204  for ( int col = 1; col <= mat.GetNcols(); ++col ) {
205  in >> mat ( row, col );
206  }
207  }
208  }
209  return in;
210 }
int row
Definition: anaLmdDigi.C:67
int col
Definition: anaLmdDigi.C:67

Member Data Documentation

const Double_t RhoError::chisqUndef = -1.
static

Definition at line 39 of file RhoError.h.


The documentation for this class was generated from the following files: