This might be a simple question but I am not very familiar with root yet so I am having trouble figuring this out.
I have a plot with multiple peaks in it. I am using Tspectrum to find the peaks and I need the x axis values for which I am using GetPositionX() command. However, this command is giving me incorrect values to x. Maybe it is giving the channel no but I need the user-defined values i.e. I need to read the values from the plot. I am attaching a pdf of the data. Background subtracted data.pdf (110.5 KB)
So for example, the x value of first peak should give me something like 29 but I am getting 197 which is clearly incorrect. Can anyone help with this? Here is the part of the code -
TSpectrum *mySpec = new TSpectrum();
Int_t npeaksFound = mySpec->Search(hTVsC_backsub, 20," ",0.1);
Double_t *xpeaks = mySpec->GetPositionX();
Double_t x[npeaksFound];
for(Int_t iter = 0; iter<npeaksFound; iter++ ) {
cout << xpeaks[iter] << endl;
}
cout << "No. of Peaks found is = " << npeaksFound << endl;
I really appreciate your help. Thank you for your time
_ ROOT Version:* 6.18/04
Platform:* C++
Compiler:* Visual Studio Code
I get these numbers -
197.158
241.222
221.036
22.6231
287.502
310.396
265.593
353.722
394.093
336.243
152.847
173.525
434.219
447.512
No. of Peaks found is = 14
These are not correct. The actual number should be something
25
152 and so on (Just by reading the graph visually after zooming in)
Wait,
I think it is giving me the correct values but they are not in order of the peaks in the plot. The values check out with reading the x axis by zooming in the plot. It’s just that the first value is not for the first peak. I have no idea how to fix that though. Let me know if you have any suggestions on that!
Ha! Thank you so much @Wile_E_Coyote. I really appreciate your time and help. Thank you again!