Applies Kolmogorov test for two ROOT TH1 histograms. 
   52    {    
   55 
   56      const TH1* h1 =  dynamic_cast<const TH1*>(o1);
   57      const TH1* h2 =  dynamic_cast<const TH1*>(o2);
   58    
   59      if (h1->GetDimension() != 1 || h2->GetDimension() != 1) {
   61      }
   62 
   63      const int n1 = h1 -> GetNbinsX();
   64      const int n2 = h2 -> GetNbinsX();
   65 
   66      if(n1 != n2) {
   67        THROW(
JValueOutOfRange, 
"JTestKolmogorov_1D::test(): Histograms with different bining. The objects: " <<
 
   68              h1->GetName() << " and " << h2->GetName() << " can not be compared." << endl);
   69      }
   70 
   71      TH1* h3 = (TH1*) h1->Clone(h1->GetName() == h2->GetName() ?
   74      
   75      const double s1 = 1./h1->Integral();
   76      const double s2 = 1./h2->Integral();
   77 
   78      double ew1, ew2, w1 = 0, w2 = 0;
   79 
   80      for (int bin = 1; bin <= n1; ++bin){
   81        ew1 = h1->GetBinError(bin);
   82        ew2 = h2->GetBinError(bin);
   83        w1 += ew1*ew1;
   84        w2 += ew2*ew2;
   85      }
   86 
   87      bool afunc1 = false;
   88      bool afunc2 = false;
   89    
   90      double esum1 = 0, esum2 = 0;
   91      
   92      if (w1 > 0) {
   93        esum1 = 1./s1/s1/w1;
   94      } else {
   95        afunc1 = true;
   96      }
   97      
   98      if (w2 > 0) {
   99        esum2 = 1./s2/s2/w2;
  100      } else {
  101        afunc2 = true;
  102      }
  103      
  104      if (afunc2 && afunc1) {
  106      }
  107 
  108      double dmax = 0, 
c1 = 0, c2 = 0;
 
  109      
  110      for (int bin=1 ; bin<=n1 ; ++bin) {
  111        
  112        c1 += s1*h1->GetBinContent(bin);
 
  113        c2 += s2*h2->GetBinContent(bin);
  114        
  115        double d = TMath::Abs(
c1-c2)*TMath::Sqrt(esum1*esum2/(esum1+esum2));
 
  116        double p = TMath::KolmogorovProb(d);
  117        
  118        dmax = TMath::Max(dmax,TMath::Abs(
c1-c2));
 
  119        
  120        h3->SetBinContent(bin,p);
  121      }
  122 
  123      double z;
  124    
  125      if  (afunc1) {
  126        z = dmax*TMath::Sqrt(esum2);
  127      } else if (afunc2) {
  128        z = dmax*TMath::Sqrt(esum1);
  129      } else {
  130        z = dmax*TMath::Sqrt(esum1*esum2/(esum1+esum2));
  131      }
  132    
  133      const double pValue = TMath::KolmogorovProb(z);
  134 
  135      const bool passed = (pValue > 
threshold);
 
  136 
  138      
  139      h3->SetTitle(title.getTitle().c_str());
  141    
  146  
  147      this->push_back(r);
  148    }
TCanvas * c1
Global variables to handle mouse events.
 
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
 
#define MAKE_CSTRING(A)
Make C-string.
 
#define MAKE_STRING(A)
Make string.
 
Class dedicated to standardize the title of the graphical objects produced by the JTest_t() derived c...
 
double threshold
threshold p-value to decide if test is passed.
 
const std::string resultType
test result type
 
const std::string testName
test name
 
Auxiliary class to handle file name, ROOT directory and object name.
 
Exception for accessing a value in a collection that is outside of its range.
 
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
 
Structure containing the result of the test.