ROOT  6.06/09
Reference Guide
MnGlobalCorrelationCoeff.cxx
Go to the documentation of this file.
1 // @(#)root/minuit2:$Id$
2 // Authors: M. Winkler, F. James, L. Moneta, A. Zsenei 2003-2005
3 
4 /**********************************************************************
5  * *
6  * Copyright (c) 2005 LCG ROOT Math team, CERN/PH-SFT *
7  * *
8  **********************************************************************/
9 
11 #include <cmath>
12 
13 #if defined(DEBUG) || defined(WARNINGMSG)
14 #include "Minuit2/MnPrint.h"
15 #endif
16 
17 
18 namespace ROOT {
19 
20  namespace Minuit2 {
21 
22 
23 MnGlobalCorrelationCoeff::MnGlobalCorrelationCoeff(const MnAlgebraicSymMatrix& cov) : fGlobalCC(std::vector<double>()), fValid(true) {
24  // constructor: calculate global correlation given a symmetric matrix
25 
27  int ifail = Invert(inv);
28  if(ifail != 0) {
29 #ifdef WARNINGMSG
30  MN_INFO_MSG("MnGlobalCorrelationCoeff: inversion of matrix fails.");
31 #endif
32  fValid = false;
33  } else {
34 
35  unsigned int n = cov.Nrow();
36  fGlobalCC.reserve(n);
37  for(unsigned int i = 0; i < n; i++) {
38  double denom = inv(i,i)*cov(i,i);
39  if(denom < 1. && denom > 0.) fGlobalCC.push_back(0.);
40  else fGlobalCC.push_back(std::sqrt(1. - 1./denom));
41  }
42  }
43 }
44 
45  } // namespace Minuit2
46 
47 } // namespace ROOT
int Invert(LASymMatrix &)
Definition: LaInverse.cxx:22
Namespace for new ROOT classes and functions.
Definition: ROOT.py:1
Class describing a symmetric matrix of size n.
Definition: LASymMatrix.h:51
double inv(double x)
For comparisons.
Definition: inv.h:58
unsigned int Nrow() const
Definition: LASymMatrix.h:239
STL namespace.
#define MN_INFO_MSG(str)
Definition: MnPrint.h:110
double sqrt(double)
const Int_t n
Definition: legend1.C:16