Fix the way systematics in different groups get applied in BinnedEDManager #59
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There's a few changes here, building on previous PRs because I think Po-Wei and I will want to work off a branch on a shorter timescale than it's reasonable to expect a review! I'll lay out the changes then explain the big change in more detail
SystematicManager::Add
after using the alternative overloaded method, otherwise systematics get added tofGroups[""]
twice and it rightfully complainsSo the big problem this fixes is for applying both at least one systematic in the global group, and at least one systematic in at least one other group. Firstly, previously, systematics were always applied to the OrignalEDs_, so when applying more than group to a PDF we'd do:
WorkingEDs_[j].SetBinContents(GetTotalResponse(groupName).operator()(OrignalEDs_.at(j).GetBinContents()));
then loop to the next
groupName
, and again do:WorkingEDs_[j].SetBinContents(GetTotalResponse(groupName).operator()(OrignalEDs_.at(j).GetBinContents()));
So the last group is the only one that would be applied!
Also there was some funky logic with the global "" group. Previously if there were any systematics in the global group, these would get applied at the same time as applying any other group. So the global systematics could get applied more than once - if it weren't for the above bug meaning only last group's application would be used!
I've simplified (and hopefully corrected) the logic so we first apply the global group if there is anything in it, and then loop through groups applying them to the
WorkingEDs_
so that each successive group is still used.Some of the new unit tests fail when using OXO as it was before this PR. However, part of that is for other reasons than what they're trying to catch. If you take the current master branch, implement the
return
inSystematicManager::Add
from this PR. Then take theBinnedNLLHTest
from this PR, but remove theConsistent Probability with Buffer
which is from #55 so will fail prior to that. Then if you run thatBinnedNLLHTest
on the current master some of the new tests will fail because the returned LLH is incorrect, whereas they now pass after this PR. That highlights what the problem was and how it is fixed I thinkSorry this is all in one PR. Having laid it out, I think I'll make separate PRs for each bit. But this gives us something to work on with it all in one place, particularly because we want what's in #55 but that won't be sorted immediately.