FFT function crash

I have some data in a tree, which I loaded into histograms which I then pass to the FFT algorithm.

I have done all this via the following:

  //Create tree to store data
     TTree *tapr28 = new TTree("Data", "Magnetic field  readings Apr 28 Start: 1705");
     
  //Read columns from csv file into branches in the tree
      tapr28->ReadFile("/home/tarabostes-delectus/build/PicoLog data/apr_28_1705 to 270 h later11 (csv).csv", "Time::Bx::By::Bz::T::B0x::B0y::B0z" ,',');

  //Create histograms for all the branches of interest
    TH1D *hapr28Bx = new TH1D("hapr28Bx", "Bx readings April 28", 340090 , 0, 340090);
    tapr28->Draw("Bx:Time>> hapr28Bx");
    hapr28Bx->Draw();

  //Pass histogram to FFT
    TH1 *hm =0;
    TVirtualFFT::SetTransform(0);
    hm = hapr28Bx->FFT(hm, "MAGBx");
    hm->SetTitle("Magnitude of the transform for the Bx component");
    hm->Draw();
    hm->SetStats(kFALSE);
    hm->GetXaxis()->SetLabelSize(0.05);
    hm->GetYaxis()->SetLabelSize(0.05);
    
}



However, when I execute the macro I get the following:

===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0  0x00007f9157ea458a in waitpid () from /lib64/libc.so.6
#1  0x00007f9157e1d42b in do_system () from /lib64/libc.so.6
#2  0x00007f9158f3aa82 in TUnixSystem::Exec (shellcmd=<optimized out>, this=0x20854f0) at /home/tarabostes-delectus/root/core/unix/src/TUnixSystem.cxx:2118
#3  TUnixSystem::StackTrace (this=0x20854f0) at /home/tarabostes-delectus/root/core/unix/src/TUnixSystem.cxx:2412
#4  0x00007f9158f3cf0c in TUnixSystem::DispatchSignals (this=0x20854f0, sig=kSigSegmentationViolation) at /home/tarabostes-delectus/root/core/unix/src/TUnixSystem.cxx:3632
#5  <signal handler called>
#6  0x00007f9158198f68 in main_arena () from /lib64/libc.so.6
#7  0x00007f9144b83bfe in ?? ()
#8  0x00000000417cdbd0 in ?? ()
#9  0x00000000417ce560 in ?? ()
#10 0x00000000417cf0a0 in ?? ()
#11 0x000000000731dbe0 in ?? ()
#12 0x000000004527d4e0 in ?? ()
#13 0x000000004527d790 in ?? ()
#14 0x00000000417cd7e0 in ?? ()
#15 0x00000000417cdfc0 in ?? ()
#16 0x00000000417ceb00 in ?? ()
#17 0x000000004527da40 in ?? ()
#18 0x000000004527e250 in ?? ()
#19 0x000000004527ed10 in ?? ()
#20 0x000000004527ea60 in ?? ()
#21 0x000000004527f270 in ?? ()
#22 0x3fe051eb851eb852 in ?? ()
#23 0x000000004527dcf0 in ?? ()
#24 0x000000004527dfa0 in ?? ()
#25 0x000000004527e7b0 in ?? ()
#26 0x3f847ae147ae147b in ?? ()
#27 0x000000004527e500 in ?? ()
#28 0x3fc47ae147ae147b in ?? ()
#29 0x000000004527efc0 in ?? ()
#30 0x3fefae147ae147ae in ?? ()
#31 0x00007f914bd5a000 in ?? ()
#32 0x00007ffd4d89ed20 in ?? ()
#33 0x00007ffd4d89ed50 in ?? ()
#34 0x000000002e0a8810 in ?? ()
#35 0x00007ffd4d89f320 in ?? ()
#36 0x00007ffd4d89ed70 in ?? ()
#37 0x00007f9153b1a649 in cling::Interpreter::RunFunction(clang::FunctionDecl const*, cling::Value*) [clone .part.279] () from /home/tarabostes-delectus/build/lib/libCling.so
#38 0x00007f9153b1d9ed 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) () from /home/tarabostes-delectus/build/lib/libCling.so
#39 0x00007f9153b1dc41 in cling::Interpreter::echo(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cling::Value*) () from /home/tarabostes-delectus/build/lib/libCling.so
#40 0x00007f9153bab64a in cling::MetaSema::actOnxCommand(llvm::StringRef, llvm::StringRef, cling::Value*) () from /home/tarabostes-delectus/build/lib/libCling.so
#41 0x00007f9153bb6dc6 in cling::MetaParser::isXCommand(cling::MetaSema::ActionResult&, cling::Value*) () from /home/tarabostes-delectus/build/lib/libCling.so
#42 0x00007f9153bb7e7e in cling::MetaParser::isCommand(cling::MetaSema::ActionResult&, cling::Value*) () from /home/tarabostes-delectus/build/lib/libCling.so
#43 0x00007f9153ba5039 in cling::MetaProcessor::process(char const*, cling::Interpreter::CompilationResult&, cling::Value*, bool) () from /home/tarabostes-delectus/build/lib/libCling.so
#44 0x00007f9153aa9249 in HandleInterpreterException (metaProcessor=<optimized out>, input_line=<optimized out>, compRes=
0x7ffd4d89f1fc: cling::Interpreter::kSuccess, result=result
entry=0x7ffd4d89f320) at /home/tarabostes-delectus/root/core/metacling/src/TCling.cxx:1886
#45 0x00007f9153ab8fe6 in TCling::ProcessLine (this=0x20e0250, line=<optimized out>, error=0x7ffd4d8a029c) at /home/tarabostes-delectus/root/core/metacling/src/TCling.cxx:2033
#46 0x00007f9153aabfdd in TCling::ProcessLineSynch (this=0x20e0250, line=0x3a7ec720 ".X  /home/tarabostes-delectus/build/macros/TEST.C", error=0x7ffd4d8a029c) at /home/tarabostes-delectus/root/core/metacling/src/TCling.cxx:2885
#47 0x00007f9158e29197 in TApplication::ExecuteFile (file=<optimized out>, error=0x7ffd4d8a029c, keep=<optimized out>) at /home/tarabostes-delectus/root/core/base/src/TApplication.cxx:1137
#48 0x00007f9158e2b183 in TApplication::ProcessLine (this=0x20d0820, line=<optimized out>, sync=<optimized out>, err=0x7ffd4d8a029c) at /home/tarabostes-delectus/root/core/base/src/TApplication.cxx:982
#49 0x00007f915925959e in TRint::ProcessLineNr (this=this
entry=0x20d0820, filestem=filestem
entry=0x7f9159269355 "ROOT_prompt_", line=0x7ffd4d8a0359 ".x TEST.C", error=0x7ffd4d8a029c, error
entry=0x0) at /home/tarabostes-delectus/root/core/rint/src/TRint.cxx:756
#50 0x00007f915925983f in TRint::HandleTermInput (this=0x20d0820) at /home/tarabostes-delectus/root/core/rint/src/TRint.cxx:602
#51 0x00007f9158f3c4cd in TUnixSystem::CheckDescriptors (this=this
entry=0x20854f0) at /home/tarabostes-delectus/root/core/unix/src/TUnixSystem.cxx:1321
#52 0x00007f9158f3d79b in TUnixSystem::DispatchOneEvent (this=0x20854f0, pendingOnly=<optimized out>) at /home/tarabostes-delectus/root/core/unix/src/TUnixSystem.cxx:1076
#53 0x00007f9158e8a994 in TSystem::InnerLoop (this=0x20854f0) at /home/tarabostes-delectus/root/core/base/src/TSystem.cxx:410
#54 0x00007f9158e895af in TSystem::Run (this=0x20854f0) at /home/tarabostes-delectus/root/core/base/src/TSystem.cxx:360
#55 0x00007f9158e2744f in TApplication::Run (this=this
entry=0x20d0820, retrn=retrn
entry=false) at /home/tarabostes-delectus/root/core/base/src/TApplication.cxx:1153
#56 0x00007f915925ad62 in TRint::Run (this=this
entry=0x20d0820, retrn=retrn
entry=false) at /home/tarabostes-delectus/root/core/rint/src/TRint.cxx:455
#57 0x0000000000400bbc in main (argc=<optimized out>, argv=0x7ffd4d8a26e8) at /home/tarabostes-delectus/root/main/src/rmain.cxx:30
===========================================================


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  0x00007f9158198f68 in main_arena () from /lib64/libc.so.6
#7  0x00007f9144b83bfe in ?? ()
#8  0x00000000417cdbd0 in ?? ()
#9  0x00000000417ce560 in ?? ()
#10 0x00000000417cf0a0 in ?? ()
#11 0x000000000731dbe0 in ?? ()
#12 0x000000004527d4e0 in ?? ()
#13 0x000000004527d790 in ?? ()
#14 0x00000000417cd7e0 in ?? ()
#15 0x00000000417cdfc0 in ?? ()
#16 0x00000000417ceb00 in ?? ()
#17 0x000000004527da40 in ?? ()
#18 0x000000004527e250 in ?? ()
#19 0x000000004527ed10 in ?? ()
#20 0x000000004527ea60 in ?? ()
#21 0x000000004527f270 in ?? ()
#22 0x3fe051eb851eb852 in ?? ()
#23 0x000000004527dcf0 in ?? ()
#24 0x000000004527dfa0 in ?? ()
#25 0x000000004527e7b0 in ?? ()
#26 0x3f847ae147ae147b in ?? ()
#27 0x000000004527e500 in ?? ()
#28 0x3fc47ae147ae147b in ?? ()
#29 0x000000004527efc0 in ?? ()
#30 0x3fefae147ae147ae in ?? ()
#31 0x00007f914bd5a000 in ?? ()
#32 0x00007ffd4d89ed20 in ?? ()
#33 0x00007ffd4d89ed50 in ?? ()
#34 0x000000002e0a8810 in ?? ()
#35 0x00007ffd4d89f320 in ?? ()
#36 0x00007ffd4d89ed70 in ?? ()
#37 0x00007f9153b1a649 in cling::Interpreter::RunFunction(clang::FunctionDecl const*, cling::Value*) [clone .part.279] () from /home/tarabostes-delectus/build/lib/libCling.so
#38 0x00007f9153b1d9ed 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) () from /home/tarabostes-delectus/build/lib/libCling.so
#39 0x00007f9153b1dc41 in cling::Interpreter::echo(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cling::Value*) () from /home/tarabostes-delectus/build/lib/libCling.so
#40 0x00007f9153bab64a in cling::MetaSema::actOnxCommand(llvm::StringRef, llvm::StringRef, cling::Value*) () from /home/tarabostes-delectus/build/lib/libCling.so
#41 0x00007f9153bb6dc6 in cling::MetaParser::isXCommand(cling::MetaSema::ActionResult&, cling::Value*) () from /home/tarabostes-delectus/build/lib/libCling.so
#42 0x00007f9153bb7e7e in cling::MetaParser::isCommand(cling::MetaSema::ActionResult&, cling::Value*) () from /home/tarabostes-delectus/build/lib/libCling.so
#43 0x00007f9153ba5039 in cling::MetaProcessor::process(char const*, cling::Interpreter::CompilationResult&, cling::Value*, bool) () from /home/tarabostes-delectus/build/lib/libCling.so
#44 0x00007f9153aa9249 in HandleInterpreterException (metaProcessor=<optimized out>, input_line=<optimized out>, compRes=
0x7ffd4d89f1fc: cling::Interpreter::kSuccess, result=result
entry=0x7ffd4d89f320) at /home/tarabostes-delectus/root/core/metacling/src/TCling.cxx:1886
===========================================================

Thanks in advance

The problem I see is that you are calling TVirtualFFT::SetTransform(0);. This function takes a pointer to a transform, so you are setting the transform to nullptr, and that is probably dereferenced later.

Here is the link to the code of that function: https://root.cern.ch/doc/master/TVirtualFFT_8cxx_source.html#l00362

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