Using TSpectrum to extract peak positions

I am using TSpectrum to find the peaks in a spectrum (HPGe detector). When I attempt to grab the x-positions of the spectrum the vector that is supposed to hold the values gives nonsense.

I am using ROOT 5.34/05. And no, I can’t upgrade to ROOT 6 without significant effort. I would like to know if this is a bug for this version 5.34/05 of ROOT or I am just using this incorrectly.

I have test code here including a histogram that I am using the functions with. Execute the test() function of SpectrumTest.C with hist.root in the working directory.

SpectrumTest.C (653 Bytes)
hist.root (17.5 KB)

The output I get is:

24 peaks found. 

Peak 1: 7.17124e+15
Peak 2: 1.74212e+19
Peak 3: 5.06021e+16
Peak 4: 3.38557e+20
Peak 5: 5.46058e+20
Peak 6: 2.4391e+24
Peak 7: 2.03639e+21
Peak 8: 2.37242e+14
Peak 9: 1.49361e+18
Peak 10: 3.29603e+22
Peak 11: 2.86056e+23
Peak 12: 6.03089e+22
Peak 13: 878.393
Peak 14: 969.382
Peak 15: 1383.33
Peak 16: 361.456
Peak 17: 569.43
Peak 18: 1247.35
Peak 19: 601.427
Peak 20: 1650.3
Peak 21: 1729.29
Peak 22: 1356.33
Peak 23: 9.48606e-322
Peak 24: 3.21143e-322
  TH1F *h; f->GetObject("gSpecOut", h); // it's TH1F and not TH1D
#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,00)
  Double_t *peakx; // ROOT 6
#else
  Float_t *peakx; // ROOT 5
#endif
  peakx = ts->GetPositionX();

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