Skip to content

Conversation

@ashlaban
Copy link
Contributor

@ashlaban ashlaban commented Jun 28, 2017

[EDIT]: 2017-07-20 dropped commit (6953483).

See the commit messages for detailed descriptions of the changes. In essence, when comparing some data with the KolmogorovTest an infinite loop was triggered.

(bba95dd) We want to get an approximate solution to the test despite there being some bins with neg. content
(06024c8) To prevent the infinite loop in other cases, calling FillRandom with a histogram with negative content is now an error.
(6953483) The caching inside GetRandom can violate an invariant of the function. (Always return NaN when there is a bin with neg. content in the source histogram). [EDIT] Removed after discussion with Lorenzo. The recomputation of the integral here was deemed too expensive as the function is intended to be called in tight loops.

Since these changes might have far reaching effects I am up for discussion whether any commits should be dropped.

A reproducer in can be found here.

ashlaban added 2 commits June 28, 2017 19:33
When two histograms (A, B) are tested using the "X" method a new
histogram (C) is created which is then subsequently filled using
random data based off of A. If A contains bins with negative
content an infinite loop can occur because of internals of
TH1::GetRandom.

This was discovered using simulated physics data where neg.
weights do occur and a fine binning of a distribution histogram.
As long the negatives are small we should be able to ignore them,
however this can in change the result and so a warning is printed.
When the hist contains negative content, `h->GetRandom()` will
return NaN. (Unless the integral is first computed by
`h->ComputeIntegral(false)` and subsequently cached...). This makes
`fXaxis.FindBin(x=NaN)` return the right-most bin. If this bin has
content 0 an infinite loop will ensue.

This patch makes it an error to call FillRandom with a histgram
containing negative bin content.
@phsft-bot
Copy link

Can one of the admins verify this patch?

@Teemperor
Copy link
Contributor

@phsft-bot build

and stop spamming

@phsft-bot
Copy link

Starting build on gcc49/centos7, native/mac1012, gcc49/slc6, gcc62/slc6, native/ubuntu14 with flags -Dvc=OFF -Dimt=ON -Dccache=ON
How to customize builds

@phsft-bot
Copy link

Build failed on centos7/gcc49.
See console output.

Errors:

  • ninja: error: loading 'build.ninja': No such file or directory

Warnings:

@root-project root-project deleted a comment from phsft-bot Jun 28, 2017
@root-project root-project deleted a comment from phsft-bot Jun 28, 2017
@root-project root-project deleted a comment from phsft-bot Jun 28, 2017
@root-project root-project deleted a comment from phsft-bot Jun 28, 2017
@root-project root-project deleted a comment from phsft-bot Jun 28, 2017
@root-project root-project deleted a comment from phsft-bot Jun 28, 2017
@root-project root-project deleted a comment from phsft-bot Jun 28, 2017
@phsft-bot
Copy link

Build failed on mac1012/native.
See console output.

Warnings:

Failing tests:

@gganis
Copy link
Contributor

gganis commented Jun 29, 2017

Hi, including the patch in my build I have failed to reproduce the problem on the same machine where it occurred (mac1012/native).
Maybe a glitch or some other strange effect.
This said, the developer taking care of TH1 is back next week and I think we need his advise on this change.

@ashlaban
Copy link
Contributor Author

ashlaban commented Jun 29, 2017

Sounds good, thanks for looking into it!

Should I extend the reproducer into a full test case?

@ashlaban
Copy link
Contributor Author

Hi, who is the TH1 developer? I think it is time to check in with him :)

@ashlaban ashlaban force-pushed the 20170628-th1-kolmogorov-inf-loop branch from 0982be1 to fc02c98 Compare July 20, 2017 14:50
@ashlaban
Copy link
Contributor Author

Ping @lmoneta. Updated according to our discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants