Printing the selected peak projection value on X-axis

Hallo Rooters,

in the attachment below I have a peak.c macro to find peaks in a histogram and the image represents it, I do not care about fitting because I do it with other macro but I would to know how to print on the terminal the selected peak projection on X-axis. to use it in comparison to the refrence line.


peaks.C (4.5 KB)

Thanks in Advance
Cheers :wink: :slight_smile:

xpeaks = s->GetPositionX();//array with X-positions of the centroids found by TSpectrum

Gives you the peak positions. is that what you need ?

1 Like

Thanks a lot on your reply.

yes This is the position on X but what I want to do, is to print it out to know the exact number of each the selected peak on X-axis.

something like this but it does not work with me
std::cout << " X-Position = " << xp << std::endl;
std::cout << " X-Position = " << xpeaks<< std::endl;

Thanks in Advance

GetPositionX() returns a pointer to an array. You should do a loop to print each individual element of the array.

1 Like

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