TSpectrum seg fault

From: Roger Mason <rmason_at_esd.mun.ca>
Date: Mon, 20 Jul 2009 09:12:00 -0230


Hello,

I'm trying to use TSpectrum to find peak candidates in a spectrum:

#include <TSpectrum.h>
#include <TGraph.h>
#include <TH1F.h>
#include <TCanvas.h>

void tspectrum () {
  TGraph* file1 = new TGraph("file1_2col_np.dat");   TH1F* file1h = (TH1F*)file1;
  file1h->Draw("ap");
  TSpectrum* s = new TSpectrum(10);
  Int_t nfound = s->Search(file1h,3,"",0.05); }

When I try to compile/run I get a seg fault:

root [0] .x tspectrum.C++
Info in <TUnixSystem::ACLiC>: creating shared library /home/rmason/Research/Projects/CryoSpectra/090706/./tspectrum_C.so In file included from
/home/rmason/Research/Projects/CryoSpectra/090706/./filezJLwq2.h:32,

                 from
                 /home/rmason/Research/Projects/CryoSpectra/090706/./filezJLwq2.cxx:16:
/home/rmason/Research/Projects/CryoSpectra/090706/./tspectrum.C: In function 'void tspectrum()':
/home/rmason/Research/Projects/CryoSpectra/090706/./tspectrum.C:11: warning: unused variable 'nfound'
<TCanvas::MakeDefCanvas>: created default TCanvas with name c1

(no debugging symbols found)
0xb7f4f410 in __kernel_vsyscall ()
#1 0xb6e50f03 in waitpid () from /lib/libc.so.6
#2 0xb6df4b29 in ?? () from /lib/libc.so.6
#3 0xb6f03e5d in system () from /lib/libpthread.so.0
#4 0xb7a6f70b in TUnixSystem::Exec () from
/usr/lib/root/libCore.so.5.20
#5 0xb7a74507 in TUnixSystem::StackTrace () from
/usr/lib/root/libCore.so.5.20
#6 0xb7a73521 in TUnixSystem::DispatchSignals () from
/usr/lib/root/libCore.so.5.20
#7 0xb7a735db in ?? () from /usr/lib/root/libCore.so.5.20
#8 0xb7a6cbb1 in ?? () from /usr/lib/root/libCore.so.5.20
#9 <signal handler called>
#10 0xb6fc26a0 in std::ostream::sentry::sentry () from
/usr/lib/gcc/i686-pc-linux-gnu/4.3.2/libstdc++.so.6
#11 0xb6fc41f9 in std::__ostream_insert<char, std::char_traits<char> >
()

   from /usr/lib/gcc/i686-pc-linux-gnu/4.3.2/libstdc++.so.6
#12 0xb6fc44dc in std::operator<< <std::char_traits<char> > ()

   from /usr/lib/gcc/i686-pc-linux-gnu/4.3.2/libstdc++.so.6
#13 0xb7997672 in TAttLine::SaveLineAttributes () from
/usr/lib/root/libCore.so.5.20
#14 0xb6604652 in TSpectrum::Search () from /usr/lib/root/libSpectrum.so
#15 0xb5808fe1 in tspectrum () from

/home/rmason/Research/Projects/CryoSpectra/090706/./tspectrum_C.so
#16 0xb5809034 in G__filezJLwq2__0_373 ()

   from
   /home/rmason/Research/Projects/CryoSpectra/090706/./tspectrum_C.so
#17 0xb71cee31 in Cint::G__ExceptionWrapper () from
/usr/lib/root/libCint.so.5.20
#18 0xb727b29d in G__execute_call () from /usr/lib/root/libCint.so.5.20
#19 0xb727c2ca in G__call_cppfunc () from /usr/lib/root/libCint.so.5.20
#20 0xb725608e in G__interpret_func () from
/usr/lib/root/libCint.so.5.20
#21 0xb7245707 in G__getfunction () from /usr/lib/root/libCint.so.5.20
#22 0xb72231af in G__getitem () from /usr/lib/root/libCint.so.5.20
#23 0xb7229142 in G__getexpr () from /usr/lib/root/libCint.so.5.20
#24 0xb7231157 in G__calc_internal () from /usr/lib/root/libCint.so.5.20
#25 0xb72b9848 in G__process_cmd () from /usr/lib/root/libCint.so.5.20
#26 0xb7a6237d in TCint::ProcessLine () from
/usr/lib/root/libCore.so.5.20
#27 0xb7a61fde in TCint::ProcessLineSynch () from
/usr/lib/root/libCore.so.5.20
#28 0xb79946a1 in TApplication::ExecuteFile () from
/usr/lib/root/libCore.so.5.20
#29 0xb7994963 in TApplication::ProcessFile () from
/usr/lib/root/libCore.so.5.20
#30 0xb7991b29 in TApplication::ProcessLine () from
/usr/lib/root/libCore.so.5.20
#31 0xb7039f03 in TRint::HandleTermInput () from
/usr/lib/root/libRint.so.5.20
#32 0xb70383c2 in TTermInputHandler::Notify () from
/usr/lib/root/libRint.so.5.20
#33 0xb703a972 in TTermInputHandler::ReadNotify () from
/usr/lib/root/libRint.so.5.20
#34 0xb7a730bf in TUnixSystem::CheckDescriptors () from
/usr/lib/root/libCore.so.5.20
#35 0xb7a736cf in TUnixSystem::DispatchOneEvent () from
/usr/lib/root/libCore.so.5.20
#36 0xb79ed92c in TSystem::InnerLoop () from
/usr/lib/root/libCore.so.5.20
#37 0xb79f0bf3 in TSystem::Run () from /usr/lib/root/libCore.so.5.20
#38 0xb7990709 in TApplication::Run () from
/usr/lib/root/libCore.so.5.20
#39 0xb703a494 in TRint::Run () from /usr/lib/root/libRint.so.5.20
#40 0x08048e3d in main ()

The program is running. Quit anyway (and detach it)? (y or n) [answered Y; input not from terminal]
Detaching from program: /proc/7593/exe, process 7593 Root >

I'm using ROOT 5.20/00 (trunk_at_24524, May 17 2009, 10:14:00 on linux). It might be relevant that Root was compiled with gcc 4.1.2 but I'm compiling this macro with gcc 4.3.2.

Thanks for any help,
Roger Received on Mon Jul 20 2009 - 14:10:48 CEST

This archive was generated by hypermail 2.2.0 : Mon Jul 20 2009 - 17:50:02 CEST