I am in a situation in which I need to extract the values out of RooFit objects as a contiguous sequence. The newly introduced batch interface is perfect for this.
However, I noticed that when my model (a
RooAddPdf) contains a
getValues crashes inside
RooAddPdf::evaluateSpans, either with an assertion (if they are enabled) or with a segfault.
By looking inside I noticed that
RooUniform in case of multiple observables creates a span of size nData^dims instead of just nData, which breaks the assumptions of
Since batchmode fits actually work, I investigated a bit and it appears that in fits this works due to const pdf optimization, which bypasses
RooUniform::evaluateSpan and fills the datastore with cached values. A fit using
Optimize(false) confirmed that this is the case.
A possible very bad workaround that I found is to create a nll, call constOptimizeTestStatistic on it without actually minimizing and then extract the cloned dataset and pdf from there for computation.
I attach here a short script which triggers the failure both on 6.24 and on master (or, to be more precise, dev4 and dev3 from lcg).
testUniformBatch.C (1.7 KB)
Is this a bug? Or am I using the batch interface in the wrong way?
Thank you in advance,