Error when trying to plot chi square contour

I am trying to plot the chi square contour but I got the following error

 0x00007fc1ed6987e7 in <unknown> from /home/hugo/bin/lib/libCling.so
 0x00007fc1ed698c3f in cling::Interpreter::EvaluateInternal(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cling::CompilationOptions, cling::Value*, cling::Transaction**, unsigned long) + 0x1df from /home/hugo/bin/lib/libCling.so
 0x00007fc1ed7502a2 in cling::MetaSema::actOnxCommand(llvm::StringRef, llvm::StringRef, cling::Value*) + 0x592 from /home/hugo/bin/lib/libCling.so
 0x00007fc1ed75ff17 in cling::MetaParser::isXCommand(cling::MetaSema::ActionResult&, cling::Value*) + 0x177 from /home/hugo/bin/lib/libCling.so
 0x00007fc1ed761186 in cling::MetaParser::isCommand(cling::MetaSema::ActionResult&, cling::Value*) + 0xa6 from /home/hugo/bin/lib/libCling.so
 0x00007fc1ed74976b in cling::MetaProcessor::process(llvm::StringRef, cling::Interpreter::CompilationResult&, cling::Value*, bool) + 0x10b from /home/hugo/bin/lib/libCling.so
 0x00007fc1ed5edc7e in <unknown> from /home/hugo/bin/lib/libCling.so
 0x00007fc1ed603512 in <unknown> from /home/hugo/bin/lib/libCling.so
 0x00007fc1ed5f4ff7 in <unknown> from /home/hugo/bin/lib/libCling.so
 0x00007fc1f2d19318 in TApplication::ExecuteFile(char const*, int*, bool) at /home/hugo/root-6.14.02/core/base/src/TApplication.cxx:1151 from /home/hugo/bin/lib/libCore.so
 0x00007fc1f2d18ad5 in TApplication::ProcessLine(char const*, bool, int*) at /home/hugo/root-6.14.02/core/base/src/TApplication.cxx:1002 from /home/hugo/bin/lib/libCore.so
 0x00007fc1f31e06b2 in TRint::ProcessLineNr(char const*, char const*, int*) at /home/hugo/root-6.14.02/core/rint/src/TRint.cxx:757 from /home/hugo/bin/lib/libRint.so
 0x00007fc1f31e1f58 in TRint::Run(bool) at /home/hugo/root-6.14.02/core/rint/src/TRint.cxx:416 from /home/hugo/bin/lib/libRint.so
 0x00007fc1f38009fc in <unknown> from /home/hugo/bin/bin/root.exe
 0x00007fc1f2191b97 in __libc_start_main + 0xe7 from /lib/x86_64-linux-gnu/libc.so.6
 0x00007fc1f3800a5a in _start + 0x2a from /home/hugo/bin/bin/root.exe
Error in <HandleInterpreterException>: Trying to dereference null pointer or trying to call routine taking non-null arguments.
Execution of your code was aborted.
In file included from input_line_10:1:
/home/hugo/trial_fit.c:37:25: warning: null passed to a callee that requires a non-null argument [-Wnonnull]
        TGraph *gr1 = (TGraph*)gMinuit->Contour(40,0,1);
                               ^~~~~~~

I should I fix it?

trial_fit.c (889 Bytes)

Hi,

You should just use option “F”, when calling TH1::Fit. You are fitting a polynomial function and by default in this case you are using a linear fitter and in that case gMinuit is not created.
If you change line 31 to be:
h1->Fit("pol1","F");

your macro will work fine

Lorenzo

1 Like