DAS  3.0
Das Analysis System
DAS::Unfolding::Migrations Namespace Reference

Functions

double Condition (const unique_ptr< TH2 > &RM)
 

Function Documentation

◆ Condition()

double DAS::Unfolding::Migrations::Condition ( const unique_ptr< TH2 > &  RM)

Condition of the Probability Matrix

Calculates the condition of the probability matrix with the gen binning.

Note: we do not include the miss entries in the normalisation since they are not included in inverted probability matrix

84 {
85  cout << __LINE__ << "\tCalculating condition" << endl;
86  const int Nx = RM->GetNbinsX(),
87  Ny = RM->GetNbinsY();
88 
89  auto RMx = unique_ptr<TH1>(RM->ProjectionX("RMx", 0, -1));
90 
91  // normalisation & condition
92  TMatrixD m(Ny,Nx); // unfortunately, we have to swap the axes...
93  for (int i = 1; i <= Nx; ++i) {
94  double normalisation = RMx->GetBinContent(i);
95  if (normalisation > 0)
96  for (int j = 1; j <= Ny; ++j)
97  m(j-1,i-1) = RM->GetBinContent(i,j) / normalisation;
98  }
99  TDecompSVD svd(m);
100  TVectorD v = svd.GetSig();
101 
102  double Max = v[0], Min = v[0];
103  for(int k = 0; k < Nx; ++k) {
104  if (abs(v[k]) < 1e-5) break;
105  Min = v[k];
106  cout << setw(5) << k << setw(15) << v[k] << setw(15) << Max/Min << '\n';
107  }
108  if (Min > 0) return Max/Min;
109  else return -numeric_limits<double>::infinity();
110 }