Fit fault due to a prossible memory corruption(?)

Hello,
I want to run a Root (Roofit) application using the grid.

People from my experiment suggest to define a compiled library containing the code (pdf / generation / fit) that is loaded from a macro and run.

The general use case works perfectly, but I have a slightly different problem.
I want to generate with a pdf(pdf1) and fit with another one (pdf2)

for this reason in my library there are two sections: one for each pdf

From my macro first (step1) I call pdf1 that writes the data,
then (step2) I call pdf2 that reads and fits the data.

Step1 works as expected, but Step2 fails with errors like:
Symbol G__exception is not defined in current scope /pool/grid/lhbplt01/38065669/globus-tmp.lxbra6507.26700.0/https_3a_2f_2frb03.pic.es_3a9000_2fVLiUxf0XsR4PbJUAM40nSA/3870505/./././runMain.C:50:

I also notice that the few minimization steps it does, the most robust parameters gets absurd values.
I suspect that I have a memory corruption (inside each step the pdf/variables have the same name… I bet that this might be a problem…??).

I also tried adding a gROOT->Reset() in the macro
between step1 and step2, without success.

Step2 alone works.

The same code, splitted in 2 different executables run without any problems on the batch queues

Can you give me some advise on how to understand better (and prevent) this memory problem?

The files are attached.
runMain.C is the CINT macro that is executed,
Main.cpp(h) and library.cpp is the library.

Many thanks for any advise,
Main.cpp (1.4 KB)
Main.h (382 Bytes)
library.cpp (24.3 KB)
runMain.C (1.32 KB)

Hi Stefania,

I just tried to run your attached example, but I do not manage to compile them,
so files seem to be missing, e.g.

root>.L library.cpp+
/user/verkerke/roofit/workdir/./library.cpp:43:31: RooBVVSinhCoefVar.h: No such file or directory
/user/verkerke/roofit/workdir/./library.cpp:44:30: RooBVVSinCoefVar.h: No such file or directory
/user/verkerke/roofit/workdir/./library.cpp:45:31: RooBVVCoshCoefVar.h: No such file or directory
/user/verkerke/roofit/workdir/./library.cpp:46:30: RooBVVCosCoefVar.h: No such file or directory

Can you provide those?

What is generaly very useful in finding memory corruption issues is to run your application instrumented with valgrind and attach the log of that (e.g. ‘valgrind --trace-children-yes root -l -b driverMacro.C’ or simply ‘valgrind myExecutable’)

Wouter