TSpectrum::GetPositionX give strange results

I write a small script to search peak in a spectrum.
I use TSpectrum::Search() and then Get position of the peak via TSpectrum::GetPositionX(); But the results that I obtained are not correct? I don’t understand why.

I used root 5.34/32.
My script is peak_search.C peak_search.C (891 Bytes)
Spectrum is 8020cS.txt 8020cS.txt (123 KB)

The result that I obtain is below. I would like to obtain list of found peaks positions.

[quote]root [0] .L peak_search.C
root [1] main()
Info in TCanvas::MakeDefCanvas: created default TCanvas with name c1
5.2951e+027
8.3706e+027
1.54622e+027
6.59106e+027
1.5886e+025
7.75413e+024
1.33828e+027
3.1021e+027
1.03424e+027
7.68424e+025
2.19496e+025
4.42014e+025
8.8312e+026
2.51759e+026
9.95551e+026
3.92145e+025
1.04995e+027
3.92901e+027
9.93254e+027
8.0454e+026
3.75372e+026
3.06161e+026
4.04386e+026
7.80362e+026
2.62821e+027
2.3707e+027
2.20931e+026
1.78075e+027
2.00379e+026
2.31268e+027
1.04187e+023
7.76829e+023
2.08782e+027
1.45676e+027
1.44013e+026
3.32455e+027
3.32832e+025
5.70009e+026
2.12167e+027
1.17417e+026
3.0412e+025
9.7694e+022
1.05025e+026
1.74932e+027
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
[/quote]

Thank you very much,

   Float_t *xpeaks = s->GetPositionX();

Dear Couet,
Could you please explain me why i need to change feom double to float in this case?
In example Peaks.C (root tutorial) , xpeak is double, and it works well.
Thank you.

Yes, I just tried Float_t with ROOT5 and saw it fixes the issue. … i agree it is weird because GetPositionX() returns a Double_t … I must admit I do not have an immediate answer… note that your macro works without modification with ROOT 6

TSpectrum in ROOT 6 uses Double_t, while in ROOT 5 Float_t.

Oh yes of course … :slight_smile:
I did not look in ROOT5 doc.
Thanks Pepe

Here it is:

root.cern.ch/root/html534/TSpec … tPositionX

Dear Couet and Pepe,

It’s very nice, your answer. Thank you very much.

Furthermore, do you know when ROOT 6 will be supported for Window? (7 and 10)

Ngoc Anh,

Dear Ngoc Anh,

The version of clang that ROOT is using internally is not fully compatible with the C++ Windows API. This should be fixed with the latest version of llvm/clang. But there is no timescale yet…

Cheers, Bertrand.