Combined fit with user defined fit functions

Hi,
I rewrote the https://root.cern.ch/root/html/tutorials/fit/combinedFit.C.html macro to simultaneously fit two different dataset with measurement errors using user defined functions which have common parameters, however some problems occurred. I obtained the following error message:

 *** Break *** segmentation violation



===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0  0x00007f3e96d4f07a in __GI___waitpid (pid=12306, stat_loc=stat_loc
entry=0x7ffe3e877f40, options=options
entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:29
#1  0x00007f3e96cc7fbb in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:148
#2  0x00007f3e9790451d in TUnixSystem::Exec (shellcmd=<optimized out>, this=0x1d25570) at /home/szanyi/Letöltések/root-6.12.04/core/unix/src/TUnixSystem.cxx:2118
#3  TUnixSystem::StackTrace (this=0x1d25570) at /home/user/download/root-6.12.04/core/unix/src/TUnixSystem.cxx:2412
#4  0x00007f3e97906b5c in TUnixSystem::DispatchSignals (this=0x1d25570, sig=kSigSegmentationViolation) at /home/user/download/root-6.12.04/core/unix/src/TUnixSystem.cxx:3643
#5  <signal handler called>
#6  0x00007f3e980c1033 in ?? ()
#7  0x00000000ec0e61f4 in ?? ()
#8  0x0000000003b03987 in ?? ()
#9  0x0000000000000034 in ?? ()
#10 0x00007ffe3e87a820 in ?? ()
#11 0x00007f3e9728b2c8 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#12 0x00007f3e9726b4f8 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#13 0x00007ffe3e87a744 in ?? ()
#14 0x0000000000000a57 in ?? ()
#15 0x0000000002698920 in ?? ()
#16 0x00007f3e8caad4d8 in ?? () from /home/user/download/test_build/lib/libMathCore.so
#17 0x00007f3e8cac1c50 in ?? () from /home/user/download/test_build/lib/libMathCore.so
#18 0x00007f3e97eb564b in do_lookup_x (undef_name=0x7f3e8cad119f "_ZN4ROOT3Fit7FitUtil12EvaluateChi2ERKNS_4Math32IParametricFunctionMultiDimTemplIdEERKNS0_7BinDataEPKdRjNS0_15ExecutionPolicyEj", new_hash=2353620268, old_hash=0x7f3e8c2a88e4 <TF1::EvalPar(double const*, double const*)+404>, ref=0x7f3e8cabcd00, result=0x7ffe3e87a8d0, scope=<optimized out>, i=0, version=0xd110eb658f6a3a00, flags=1, skip=0x73, type_class=0, undef_map=0x7ffe3e87a960) at dl-lookup.c:423
#19 0x0000000000000000 in ?? ()
===========================================================


The lines below might hint at the cause of the crash.
You may get help by asking at the ROOT forum http://root.cern.ch/forum.
Only if you are really convinced it is a bug in ROOT then please submit a
report at http://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.
===========================================================
#6  0x00007f3e980c1033 in ?? ()
#7  0x00000000ec0e61f4 in ?? ()
#8  0x0000000003b03987 in ?? ()
#9  0x0000000000000034 in ?? ()
#10 0x00007ffe3e87a820 in ?? ()
#11 0x00007f3e9728b2c8 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#12 0x00007f3e9726b4f8 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#13 0x00007ffe3e87a744 in ?? ()
#14 0x0000000000000a57 in ?? ()
#15 0x0000000002698920 in ?? ()
#16 0x00007f3e8caad4d8 in ?? () from /home/user/download/test_build/lib/libMathCore.so
#17 0x00007f3e8cac1c50 in ?? () from /home/user/download/test_build/lib/libMathCore.so
#18 0x00007f3e97eb564b in do_lookup_x (undef_name=0x7f3e8cad119f "_ZN4ROOT3Fit7FitUtil12EvaluateChi2ERKNS_4Math32IParametricFunctionMultiDimTemplIdEERKNS0_7BinDataEPKdRjNS0_15ExecutionPolicyEj", new_hash=2353620268, old_hash=0x7f3e8c2a88e4 <TF1::EvalPar(double const*, double const*)+404>, ref=0x7f3e8cabcd00, result=0x7ffe3e87a8d0, scope=<optimized out>, i=0, version=0xd110eb658f6a3a00, flags=1, skip=0x73, type_class=0, undef_map=0x7ffe3e87a960) at dl-lookup.c:423
#19 0x0000000000000000 in ?? ()
===========================================================

The rewritten macro is tr.C (4.0 KB)
Both of the models (fit functions) have 4-4 free parameters and each are common.
The corresponding data sets can be found here: data.zip (1.6 KB) .

How could be solved this problem? Thank you in advance for any help you can provide!
Steven

TF1 *sigma = new TF1("sigma", sigma_base, 1, 100000, 4);
TF1 *rho = new TF1("rho", rho_base, 1, 100000, 4);

BTW. When you post “source code” or “output” here, do remember to enclose them into two lines which contain just three characters ``` (see how your post has been edited above).

Thank you! It works with this corrections. However my personal computer is not compatible with Linux. If i try to run this code simply on Windows I obtain the next error message:

root [0] .x tr.C()
Error: Can’t call Chi2FCNROOT::Math::IBaseFunctionMultiDim::Chi2FCNROOT::Math::IBaseFunctionMultiDim(dataS,wsigma) in current scope C:\root_v5.34.36\macros\tr.C(117)
Possible candidates are…
filename line:size busy function type and name
*** Interpreter error recovered ***

Then if I try to run with ACLiC I obtain the following one:

root [1] .x tr.C+
Info in : script has already been loaded in interpreted mode
Info in : unloading C:\root_v5.34.36\macros\tr.C and compiling it
Info in TWinNTSystem::ACLiC: creating shared library C:\root_v5.34.36\macros\tr_C.dll
’cl.exe’ is not recognized as an internal or external command,
operable program or batch file.
Error: external preprocessing failed. (0)
!!!Removing C:\root_v5.34.36\macros\tr_C_ACLiC_dict.cxx C:\root_v5.34.36\macros\tr_C_ACLiC_dict.h !!!
Error: C:\root_v5.34.36\bin\rootcint: error loading headers…
Error in : Dictionary generation failed!
Info in : Invoking compiler to check macro’s validity
Error: Function tr() is not defined in current scope C:\root_v5.34.36\bin\libRIO.dll(1)
*** Interpreter error recovered ***

Could this problem be solved? Thank you in advance for any help you can provide!
Steven

https://root-forum.cern.ch/search?q=windows%20internal%20external%20command

Thank you very much! It helped a lot!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.