[ROOT] seg fault using TSpectrum::Search

From: steve udriot (Steve.Udriot@cern.ch)
Date: Fri Nov 24 2000 - 16:00:23 MET


Hi rooters,

I am using the TSpectrum::Search method to find peaks in 1D histograms.
The following macro ends up with no result for a sigma below 170 and a
seg fault for a sigma above. Why ?

#include <iomanip.h>

void main (char *runname="run000011",char
*filename="../PSI_data_ASC.root"){

  TFile *f = new TFile(filename);
  TTree *tree = (TTree*)gROOT->FindObject(runname);

  TH1D *h = new TH1D("histo","title", 1950,0,1950);
  tree->Draw("fCount>>histo","","goff");
  h->Draw();

  TSpectrum *spec = new TSpectrum();
  spec->Search(h,171);
  float *parray = spec->GetPositionX();

  cout << spec->GetNPeaks() <<" Peak(s) found in " << runname << " : "
<< endl;
  for (int i = 0;  i < spec->GetNPeaks(); i++)
    cout << setw(10) << "Peak #" << setw(2)<< i+1 << " @ " << parray[i]
<<endl;
  
}

Many thanks,

Steve




This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:37 MET