Skip to content

Unexpected behaviour of KSTest with toys ("X" option) for identical histograms #13697

Description

@TomasDado

Check duplicate issues.

  • Checked for duplicates

Description

When passing some identical histograms to KSTest of TH1, the code return probability 0 in case of the "X" option (runing toys) while the probablity of the default KS test is 1 (as expected).

Reproducer

running the following macro reproduces the issue:

void kstest() {

  TFile* f = TFile::Open("kstest.root", "READ");

  TH1D* h1 = f->Get<TH1D>("SR2_2L_el/tt_Conv/nominal/SR2_2L_el_tt_Conv");
  TH1D* h2 = f->Get<TH1D>("SR2_2L_el/tt_Conv/FSRAlphaS_ttbar/SR2_2L_el_tt_Conv_FSRAlphaS_ttbar_Shape_Down");

  std::cout << "integral h1: " << h1->Integral() << ", h2: " << h2->Integral() << "\n";

  const double probX = h1->KolmogorovTest(h2, "X");
  const double prob  = h1->KolmogorovTest(h2);
  std::cout << "KS probability using toys is: " << probX << ", without toys it is: " << prob << "\n";
}

with the input file available in this public afs repository: /afs/cern.ch/user/t/tdado/public/kstest.root

I could not reproduce it with a dummy histograms, so it must be somehow related to the actual values in the bins?

ROOT version

ROOT Version: 6.28/04
Built for linuxx8664gcc on Jul 10 2023, 18:22:00
From v6-28-04@v6-28-04

Installation method

source from LCG

Operating system

CentOS7 (lxplus)

Additional context

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions