[RF] Crash in RooStats::ToyMCSample::GenerateToyData
- [x] Checked for duplicates
Describe the bug
A segmentation violation is encountered when trying to run fit on toys during the toy generation.
To Reproduce
To reproduce the crash, please use the attached (minimal) code and the ROOT file with the RooWorkspace inside: link to cernbox
Setup
Tested on ROOT Version: 6.27/01 Built for linuxx8664gcc on Jul 18 2022, 09:11:00 From heads/master@ffdbbb6d
as well as LCG_101 x86_64-centos7-gcc8-opt
Additional context
Note that the code here tries to reproduce what is done in a bigger framework, It is entirely possible that we are doing something dumb and this is not an actual bug in GenerateToyData, but it is interestingly seen only for "gammas" NPs (i.e. one NP per bin)
Fix here: https://github.com/root-project/root/pull/15902
Compilable reproducer is attached. MWE.zip