Allow multiple ranges in HFitInterface::FillData#10101
Conversation
|
Can one of the admins verify this patch? |
lmoneta
left a comment
There was a problem hiding this comment.
Thank you for this nice contribution.
I think it is important adding the case of overlapping ranges.
You might extend the Range functionality to do this. When adding an overlapping range CleanRangeSet should remove un-needed range and return the minimal set.
I think now it is working deleting a previous existing range if it is smaller than the one provided.
| for (int i=0; i<(int)range.Size(0); ++i) { | ||
| HFitInterface::ExamineRange( hfit->GetXaxis(), range(0, i), hxfirst, hxlast); | ||
| nx += hxlast - hxfirst + 1; | ||
| hxfirst = hfit->GetXaxis()->GetFirst(); |
There was a problem hiding this comment.
I think you don't need to call ExamineRange multiple times. You can call it later when looping on the histogram bins and then get the number of points for each range. In that case you don't call BinData::Initialize(n, dim) but you call BinData::Append(newPoints, dim) for each examined range.
There was a problem hiding this comment.
Ok, that makes sense. I've updated the flow - is that closer to what you had in mind?
There was a problem hiding this comment.
Yes, this is exactly what I asked for !
|
I've updated This shows several behaviors: adding a range fully encapsulated by an existing one, adding a range which fully encapsulates and existing one, extending an existing range by adding an overlapping one, merging two existing ranges by adding one in the middle. Tim |
|
It is great you add the support for overlapping range in DataRange. Thank you for this contribution! |
|
Hi @lmoneta, is this ok now? |
|
Thank you very much @belmakier! This is a very nice PR that should be merged, as these multi-range fits are quite common, e.g. for excluding the signal region. Unfortunately, our CI can't deal with PRs where the PR branch is also called Other changes I did besides rebasing:
|
This Pull request:
Allows multiple (discontinuous) ranges for
HFitInterface::FillData, see here@lmoneta - one thing I didn't implement was checking if the different ranges overlapped at all. If several of the ranges are overlapping (i.e. [0,50], [25, 75]), then at present the bins in both regions will be added twice, not sure what sort of behavior this would cause. I think the best way to get around that is to check when the range are added, I note that one such check is already in place in
DataRange::CleanRangeSet, this could be extended. Wanted to flag with you first before I changed too much though.Example for 1D use:
or 2D use:
Checklist:
This PR fixes #