51      const TH1* h1 = 
dynamic_cast<const TH1*
>(o1);
 
   52      const TH1* h2 = 
dynamic_cast<const TH1*
>(o2);
 
   54      if (h1 == NULL || h2 == NULL) {
 
   58      const int nx1 = h1->GetNbinsX();
 
   59      const int nx2 = h2->GetNbinsX();      
 
   60      const int ny1 = h1->GetNbinsY();
 
   61      const int ny2 = h2->GetNbinsY();
 
   62      const int nz1 = h1->GetNbinsZ();
 
   63      const int nz2 = h2->GetNbinsZ();
 
   65      const double M = h1->GetSumOfWeights();
 
   66      const double N = h2->GetSumOfWeights();
 
   68      if(nx1 != nx2 || ny1 != ny2 || nz1 != nz2 || M == 0 || N == 0) {
 
   69        THROW(
JValueOutOfRange, 
"JTestChi2_t::test(): Histograms with different binning or with zero entries.");
 
   72      TH1* h3 = (TH1*) h1->Clone(h1->GetName() == h2->GetName() ?
 
   80      for (
int i=1 ; i<nx1 ; ++i) {
 
   81        for (
int j=1 ; j<ny1 ; ++j) {
 
   82          for (
int k=1 ; k<nz1 ; ++k) {
 
   84            const double m = h1->GetBinContent(i,j,k);
 
   85            const double n = h2->GetBinContent(i,j,k);
 
   87            const double em = h1->GetBinError(i,j,k);
 
   88            const double en = h2->GetBinError(i,j,k);
 
   90            if (n > 0.0 && m > 0.0 && em > 0.0 && en > 0.0) {
 
   92              const double delta = N*m - M*n;
 
   93              const double sigma = M*M*en*en + N*N*em*em;
 
   94              const double chi2  = delta*delta / sigma;
 
   97                outliers += 1./(nx1*ny1);
 
  100              h3->SetBinContent(i,j,k,chi2);
 
  110      h3->SetTitle(title.
getTitle().c_str());
 
  112      const int Ndims = h3->GetDimension();
 
  116      } 
else if (Ndims == 2) {