RooSimultaneous::generate Segm.Violation in ROOTv>= 5.32

Dear experts,

I am generating some data sample with RooSimultaneous but for ROOT versions 5.32 or later I get a segmentation violation (while for ROOT 5.30 it seems to work properly).
Before the crash I get errors like:

[#0] ERROR:Generation – RooAddGenContext::bin4:generate: cannot calculate expected number of events

which are due to the fact that the number of events I am generating is not sufficient to have at least one event for each bin (category).
I report down the stack trace.

Thanks in advance,

Francesco

===========================================================
There was a crash.
This is the entire stack trace of all threads:

#0 0x00002ad539ca8df5 in waitpid () from /lib64/libc.so.6
#1 0x00002ad539c4c491 in do_system () from /lib64/libc.so.6
#2 0x00002ad532ffd746 in TUnixSystem::StackTrace() ()
from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.34.00-rc1/x86_64-slc5-gcc43-opt/root/lib/libCore.so
#3 0x00002ad532ffd01c in TUnixSystem::DispatchSignals(ESignals) ()
from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.34.00-rc1/x86_64-slc5-gcc43-opt/root/lib/libCore.so
#4
#5 0x00002ad53839a9c0 in RooDataSet::RooDataSet(char const*, char const*, RooArgSet const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&) ()
from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.34.00-rc1/x86_64-slc5-gcc43-opt/root/lib/libRooFitCore.so
#6 0x00002ad5384926ad in RooSimSplitGenContext::generate(int, bool, bool) ()
from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.34.00-rc1/x86_64-slc5-gcc43-opt/root/lib/libRooFitCore.so
#7 0x00002ad53830a2b7 in RooAbsPdf::generate(RooArgSet const&, int, bool, bool, char const*, bool) const ()
from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.34.00-rc1/x86_64-slc5-gcc43-opt/root/lib/libRooFitCore.so
#8 0x00002ad53830e640 in RooAbsPdf::generate(RooArgSet const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&) ()
from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.34.00-rc1/x86_64-slc5-gcc43-opt/root/lib/libRooFitCore.so
#9 0x00002ad53830e7b3 in RooAbsPdf::generate(RooArgSet const&, int, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&)
()
from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.34.00-rc1/x86_64-slc5-gcc43-opt/root/lib/libRooFitCore.so
#10 0x000000000040f076 in confinte::addRandom (this=0x7fff2b15a570,
n_events=10, pdf_name=) at confinte.cpp:86
#11 0x0000000000408a1e in main (argc=12, argv=0x7fff2b15ca48) at calca.C:210

The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug report at
root.cern.ch/bugs. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.

#5 0x00002ad53839a9c0 in RooDataSet::RooDataSet(char const*, char const*, RooArgSet const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&) ()
from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.34.00-rc1/x86_64-slc5-gcc43-opt/root/lib/libRooFitCore.so
#6 0x00002ad5384926ad in RooSimSplitGenContext::generate(int, bool, bool) ()
from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.34.00-rc1/x86_64-slc5-gcc43-opt/root/lib/libRooFitCore.so
#7 0x00002ad53830a2b7 in RooAbsPdf::generate(RooArgSet const&, int, bool, bool, char const*, bool) const ()
from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.34.00-rc1/x86_64-slc5-gcc43-opt/root/lib/libRooFitCore.so
#8 0x00002ad53830e640 in RooAbsPdf::generate(RooArgSet const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&) ()
from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.34.00-rc1/x86_64-slc5-gcc43-opt/root/lib/libRooFitCore.so
#9 0x00002ad53830e7b3 in RooAbsPdf::generate(RooArgSet const&, int, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&)
()
from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.34.00-rc1/x86_64-slc5-gcc43-opt/root/lib/libRooFitCore.so
#10 0x000000000040f076 in confinte::addRandom (this=0x7fff2b15a570,
n_events=10, pdf_name=) at confinte.cpp:86
#11 0x0000000000408a1e in main (argc=12, argv=0x7fff2b15ca48) at calca.C:210

Hi,

Can you please post a example reproducing this problem or send us a workspace file containing your pdf ?
Thank you

Lorenzo

Hi Lorenzo,

I attach the workspace containing my pdfs.
The one giving this crash is “simBsPdf”.

Thank you,
Francesco
RootWorksp_FD_outp.root (199 KB)

Hi,

Thank you for the workspace. Which command exactly did you use for generating ? Did you include the categories in the observables ?

For me doing

simPdf->generate(allobs, 0, RooFit::Extended() )

where allobs is

root [37] allobs.Print("V")
  1) RooRealVar:: m_{#mu#mu} = 5300
  2) RooCategory::    binning = bin1(idx = 0)

works fine

Lorenzo

Hi,
I use the following code:

RooDataSet * datasig = 
    pdf_sig->generate(*m_ws->set(m_obs_set), n_events, Name("mysignal"+pdf_name)); 

where of course “m_obs_set” is the name of the set of observables which includes the two that you mention (so including the category).
With or without the Extended option it does not change, I get always the same error.

cheers,
Francesco

Strange, because this code works fine for me:

{
   TFile f("RootWorksp_FD_outp.root");
   RooAbsPdf * simPdf = w->pdf("simPdf");
   RooArgSet * obs = simPdf->getObservables(w->data("combData"));
   RooAbsData * data = simPdf->generate( *obs, 0, RooFit::Extended, RooFit::Name("mydata") );
   RooPlot * pl = ((RooRealVar*) obs->first())->frame();
   data->plotOn(pl, RooFit::Cut("binning == binning::bin1"));
   pl->Draw();
}                                                                                                                                                                                             

Please past your full code showing your problem
Cheers
Lorenzo

Hi,

your test works because you are using the wrong pdf.
The crash is with the pdf named “simBsPdf”, while you are using “simPdf”.
If I use your code I can reproduce the problem with the first but not with the second pdf, as expected.

cheers,
Francesco

Hi,

Sorry, I have not read carefully your post.
yes, I can reproduce now your problem with 5.34, but I have already the fix, which I am going to commit soon in the trunk and the patch releases. The problem is due to a rounding in the number of events and it has been reported few days ago in the RooStats mailing list, see
groups.cern.ch/group/roostats-d … 3A416E9071

Thank you for your report

Lorenzo

Hi Lorenzo,

thanks for this.
I have subscribed to the mailing list to be able to see the thread, and I will update to the trunk.

cheers,
Francesco

Hi Francesco,

The fix is now committed in the trunk (revision 44630 and also in 5.32 and 5.34 patches)

Lorenzo

Thanks a lot for the prompt reply and reaction! :slight_smile:

cheers,
Francesco