Mathmore w/ACLIC gives different answers

Hi,

I have written a program to do a multi-dimensional Monte Carlo integration. For this I use the Mathmore libraries, executed with ACLIC (.x tsaimc2.C+). I have found that I get one answer (“a”) when it’s the first time ACLIC has been used in the current session, and another answer (“b”) thereafter. It doesn’t have to do with the presence or absence of the generated library–I can change the script, save and re-run in the same ROOT session and it will give me the “b” answer for the (new) parameters I input. If I quit and restart the first command line will then give the “a” answer for those new parameters. The same is true if I remove the library before I re-run ACLIC.

In the case of tsaimc2.C, I’m pretty sure this has to do with command line #0 because giving “1+1” to ROOT as a first command and then executing with ACLIC on the next line will give the “b” answer. However, testing this with a simple formula (integratortest.C) I still get the same two-result behaviour, but without the dependence on command line 0: I get result “a” the first time I use ACLIC in a session and result “b” thereafter (executing “1+1” first doesn’t get rid of result “a”). Result “b” is more correct than result “a.”

I have attached the file I use. crossdiff is the function to be integrated, crossdiffint does the integrating and tsaimc2 is the main. I am basically interested in finding out how many Monte Carlo calls it will take to accurately evaluate the integral, so I vary the main parameter “kay” and the MC call parameter “calls”. It seems that answer “b” is much closer to the expected integral for a small number of calls and “a” is smaller by a factor 100, but for a large number of calls “a” can be almost as large as “b”.
In the case of the simple script “a” is a little larger than “b.”

In any case, this disparity has me worried. Is this an issue with ACLIC? Should I give ACLIC a simple script to let it warm up at the beginning of every session?
integratortest.C (1.36 KB)
tsaimc2.C (4.65 KB)

Hi,

the problem is due to a bug in setting the VEGAS integration mode in the class GSLMCIntegrator class, nothing to do with ACLIC.
By default the mode was not properly initialized. I have fixed now this in svn.
If in your code you add the line (after creating the class)

ig1.SetMode(ROOT::Math::MCIntegration::kSTRATIFIED);

You will get the consistent result (“b”).

Thank you very much for reporting this
Best Regards

Lorenzo