2D simultaneous fit not working

Dear Experts,

I had done a 2D simultaneous fit but unfortunately, my computer crashed and I had to change the root version in the new one. The problem is that, in the new one the same code is not working abd shows segmentation error. The current version that I am using is 6.24/06 and ubuntu 20.04. The code was running smoothly with Root 5.34 and a lower version of root 6 (I am not sure which one it was).

It will be of great help to me if you look into it.

My working directory is :
for_root_forum.zip (2.5 MB). asymmetry_all_params_MC14ri.C. One can directly go to lines, 436 and 437, and change the path to get it running. Here’s the message I receive:

The lines below might hint at the cause of the crash.
You may get help by asking at the ROOT forum https://root.cern.ch/forum
Only if you are really convinced it is a bug in ROOT then please submit a
report at https://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  0x00007fb5bf2b4e14 in __dynamic_cast () from /lib/x86_64-linux-gnu/libstdc++.so.6
#7  0x00007fb5ab2832f5 in RooAbsCollection::insert(RooAbsArg*) () from /home/sanjeeda/root_software/root/lib/libRooFitCore.so
#8  0x00007fb5ab283729 in RooAbsCollection::add(RooAbsArg const&, bool) () from /home/sanjeeda/root_software/root/lib/libRooFitCore.so
#9  0x00007fb5ab28629d in RooAbsCollection::RooAbsCollection(RooAbsCollection const&, char const*) () from /home/sanjeeda/root_software/root/lib/libRooFitCore.so
#10 0x00007fb5ab30c3dd in RooArgSet::RooArgSet(RooArgSet const&, char const*) () from /home/sanjeeda/root_software/root/lib/libRooFitCore.so
#11 0x00007fb5ab3070a6 in RooAddPdf::getNormAndCache(RooArgSet const*) const () from /home/sanjeeda/root_software/root/lib/libRooFitCore.so
#12 0x00007fb5ab30721c in RooAddPdf::evaluate() const () from /home/sanjeeda/root_software/root/lib/libRooFitCore.so
#13 0x00007fb5ab2aca4a in RooAbsPdf::getValV(RooArgSet const*) const () from /home/sanjeeda/root_software/root/lib/libRooFitCore.so
#14 0x00007fb5ab30737c in RooAddPdf::evaluate() const () from /home/sanjeeda/root_software/root/lib/libRooFitCore.so
#15 0x00007fb5ab2accb4 in RooAbsPdf::getValV(RooArgSet const*) const () from /home/sanjeeda/root_software/root/lib/libRooFitCore.so
#16 0x00007fb5ab457c13 in RooRealIntegral::RooRealIntegral(char const*, char const*, RooAbsReal const&, RooArgSet const&, RooArgSet const*, RooNumIntConfig const*, char const*) () from /home/sanjeeda/root_software/root/lib/libRooFitCore.so
#17 0x00007fb5ab2d4cec in RooAbsReal::createIntObj(RooArgSet const&, RooArgSet const*, RooNumIntConfig const*, char const*) const () from /home/sanjeeda/root_software/root/lib/libRooFitCore.so
#18 0x00007fb5ab2d5a86 in RooAbsReal::createIntegral(RooArgSet const&, RooArgSet const*, RooNumIntConfig const*, char const*) const () from /home/sanjeeda/root_software/root/lib/libRooFitCore.so
#19 0x00007fb5ab4390b2 in RooProdPdf::processProductTerm(RooArgSet const*, RooArgSet const*, char const*, RooArgSet const*, RooArgSet const&, RooArgSet const&, bool&, bool) const () from /home/sanjeeda/root_software/root/lib/libRooFitCore.so
#20 0x00007fb5ab43ebc4 in RooProdPdf::getPartIntList(RooArgSet const*, RooArgSet const*, char const*) const () from /home/sanjeeda/root_software/root/lib/libRooFitCore.so
#21 0x00007fb5ab440953 in RooProdPdf::evaluate() const () from /home/sanjeeda/root_software/root/lib/libRooFitCore.so
#22 0x00007fb5ab2aca4a in RooAbsPdf::getValV(RooArgSet const*) const () from /home/sanjeeda/root_software/root/lib/libRooFitCore.so
#23 0x00007fb5ab30737c in RooAddPdf::evaluate() const () from /home/sanjeeda/root_software/root/lib/libRooFitCore.so
#24 0x00007fb5ab2aca4a in RooAbsPdf::getValV(RooArgSet const*) const () from /home/sanjeeda/root_software/root/lib/libRooFitCore.so
#25 0x00007fb5ab2a446d in RooAbsOptTestStatistic::optimizeConstantTerms(bool, bool) () from /home/sanjeeda/root_software/root/lib/libRooFitCore.so
#26 0x00007fb5ab2f143a in RooAbsTestStatistic::constOptimizeTestStatistic(RooAbsArg::ConstOpCode, bool) () from /home/sanjeeda/root_software/root/lib/libRooFitCore.so
#27 0x00007fb5ab2a87ed in RooAbsOptTestStatistic::constOptimizeTestStatistic(RooAbsArg::ConstOpCode, bool) () from /home/sanjeeda/root_software/root/lib/libRooFitCore.so
#28 0x00007fb5ab3eb6ad in RooMinimizer::optimizeConst(int) () from /home/sanjeeda/root_software/root/lib/libRooFitCore.so
#29 0x00007fb5ab2b94ae in RooAbsPdf::fitTo(RooAbsData&, RooLinkedList const&) () from /home/sanjeeda/root_software/root/lib/libRooFitCore.so
#30 0x00007fb5ab2b6d0c in RooAbsPdf::fitTo(RooAbsData&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&) () from /home/sanjeeda/root_software/root/lib/libRooFitCore.so
#31 0x00007fb5b2f3cd36 in ?? ()
#32 0x00007fb5ab6ae3a0 in ?? () from /home/sanjeeda/root_software/root/lib/libRooFitCore.so
#33 0x00007fb5ab6ae3a0 in ?? () from /home/sanjeeda/root_software/root/lib/libRooFitCore.so
#34 0x00007fb5ab6ae3a0 in ?? () from /home/sanjeeda/root_software/root/lib/libRooFitCore.so
#35 0x00007fb5ab6ae3a0 in ?? () from /home/sanjeeda/root_software/root/lib/libRooFitCore.so
#36 0x00007ffc6ff6d280 in ?? ()
#37 0x00007ffc6ff6d130 in ?? ()
#38 0x0000000000000000 in ?? ()
===========================================================


There may or may not be other issues, but try at least:

  TString dirname("/your/path");
  TString ext(".txt");
  TSystemDirectory dir("",dirname.Data());
  //... and use .Data for dirname and ext as needed

Thank you very much @dastudillo. But the error still persists. I also tried the same thing in root 6.20/06 and Ubuntu 20.04.5 , the error is different:

> terminate called after throwing an instance of 'std::regex_error'
>   what():  Unexpected character in brace expression.

If at least one of the error is solved, I am good to go.

For me it worked with the changes I made (and using my own path), on Ubuntu 20.04 (WSL) and ROOT 6.26/06, so maybe you are missing something; the regex_error maybe means you have some strange symbol in the path or in some text variable (by the way, the output files I got from your macro had strange symbols in their file names, so this may be an issue for you, even though it did run for me).

Thanks , I am checking this. I have another macro which does not have those pathssimFit_KK.C (22.2 KB). But crashes with similar messages.
Will you please let me know if this too works for you?

Works for me. I only get warnings at the beginning:

Processing simFit_KK.C...
[#0] WARNING:InputArguments -- The parameter '#sigma_{G1sig}' with range [-1e+30, 1e+30] of the RooGaussian 'gauss1_sig' exceeds the safe range of (0, inf). Advise to limit its range.
[#0] WARNING:InputArguments -- The parameter '#sigma_{G2sig' with range [-1e+30, 1e+30] of the RooGaussian 'gauss2_sig' exceeds the safe range of (0, inf). Advise to limit its range.
[#0] WARNING:InputArguments -- The parameter '#sigma_{G1}_sig_d0' with range [-1e+30, 1e+30] of the RooGaussian 'gauss1_sig_d0' exceeds the safe range of (0, inf). Advise to limit its range.
[#0] WARNING:InputArguments -- The parameter '#sigma_{G2}_sig_d0' with range [-1e+30, 1e+30] of the RooGaussian 'gauss2_sig_d0' exceeds the safe range of (0, inf). Advise to limit its range.
[#0] WARNING:InputArguments -- The parameter '#sigma_{G}d0kpi' with range [-1e+30, 1e+30] of the RooGaussian 'gauss_d0kpi' exceeds the safe range of (0, inf). Advise to limit its range.

1 Like

Dear @couet,

Thank you very much for your reply. Will you please tell me the which version of root you are using. I will try also install it. Also, I am sending you the final code with a few minor changes simFit_KK_final.C (23.5 KB).

Will you please send me the 4 plots, which will be automatically produced (saved in .root fromat) when you run this macro? It will be very kind of you.

6.27 (master) but 6.26 should be ok.

can you please fix these errors:

Processing simFit_KK_final.C...
In file included from input_line_9:1:
/Users/couet/Downloads/for_root_forum/simFit_KK_final.C:268:22: error: use of undeclared identifier 'GetXaxis'
  pullplotx_d0_mkk-->GetXaxis()->CenterTitle();
                     ^
/Users/couet/Downloads/for_root_forum/simFit_KK_final.C:299:16: error: member reference type 'TCanvas *' is a pointer; did you mean to use '->'?
  c1->SaveAs(c1.root);
             ~~^
               ->
/Users/couet/Downloads/for_root_forum/simFit_KK_final.C:299:17: error: no member named 'root' in 'TCanvas'
  c1->SaveAs(c1.root);
             ~~ ^
/Users/couet/Downloads/for_root_forum/simFit_KK_final.C:349:10: error: use of undeclared identifier 'SetLogy'
  upPad2>SetLogy();
         ^
/Users/couet/Downloads/for_root_forum/simFit_KK_final.C:353:16: error: member reference type 'TCanvas *' is a pointer; did you mean to use '->'?
  c2->SaveAs(c2.root);
             ~~^
               ->
/Users/couet/Downloads/for_root_forum/simFit_KK_final.C:353:17: error: no member named 'root' in 'TCanvas'
  c2->SaveAs(c2.root);
             ~~ ^
/Users/couet/Downloads/for_root_forum/simFit_KK_final.C:401:10: error: use of undeclared identifier 'SetLogy'
  upPad3>SetLogy();
         ^
/Users/couet/Downloads/for_root_forum/simFit_KK_final.C:405:16: error: member reference type 'TCanvas *' is a pointer; did you mean to use '->'?
  c3->SaveAs(c3.root);
             ~~^
               ->
/Users/couet/Downloads/for_root_forum/simFit_KK_final.C:405:17: error: no member named 'root' in 'TCanvas'
  c3->SaveAs(c3.root);
             ~~ ^
/Users/couet/Downloads/for_root_forum/simFit_KK_final.C:453:10: error: use of undeclared identifier 'SetLogy'
  upPad4>SetLogy();
         ^
/Users/couet/Downloads/for_root_forum/simFit_KK_final.C:457:15: error: member reference type 'TCanvas *' is a pointer; did you mean to use '->'?
  c4>SaveAs(c4.root);
            ~~^
              ->
/Users/couet/Downloads/for_root_forum/simFit_KK_final.C:457:16: error: no member named 'root' in 'TCanvas'
  c4>SaveAs(c4.root);
            ~~ ^

Thanks and here it issimFit_KK_final_2.C (23.6 KB).

c1_mKK_d0.root (21.5 KB)
c2_mKK_d0bar.root (21.5 KB)
c3_md0pi_d0.root (22.4 KB)
c4_md0pi_d0bar.root (23.0 KB)

1 Like

Dear @couet, Thanksa lot, that is indeed very kind of you,

Sincrely,
Sanjeeda

1 Like

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