Problem with RooFit in ROOT 5.21.04 (works in 5.21.02)

Dear ROOT experts,

My RooFit macro that runs fine in ROOT 5.21.02 crashes in ROOT 5.21.04.
In my macro (see attachement), I use RooDataHist to create PDFs from histograms which I stored in a root file (also attached). Then I create a model from these PDF and use RooMCStudy to do toy MC studies using extended maximum likelihood method. The crash happens at the line where I use RooMCStudy.

I wonder if something important has changed in RooFit from 5.21.02 to 5.21.04 that might cause this problem?

Also, I note that when I try to run the tutorial macros rf801 to rf804 in $ROOTSYS/tutorials/roofit directory. All runs fine in 5.21.02 on lxplus but when I use 5.21.04, two of them crash, ie rf801 and rf803.

For information, I am using ROOT both on lxplus and my Mac computer (10.5.5):
lxplus: /afs/
and /afs/

on my mac: I am using binaries of ROOT for v5.21.04.macosx105-i386-gcc-4.0

Many thanks. Any help is greatly appreciated.

Best wishes
Teh Lee
m3.root (9.05 KB)
learn_toymc_test.C (1.96 KB)


Not much changes between .02 and .04 in RooFit, a couple of small fixes only. I will investigate the problem and get back to you.