I am trying to execute a script in order to deconvolve my spectrum in 2 dimensions like in the example 6 : https://root.cern.ch/doc/v608/classTSpectrum2.html. But I got a message that I have a segmentation violation.
I analyse the source code of deconvolution (https://root.cern.ch/doc/v608/TSpectrum2_8cxx_source.html), at the line 1222, it look like the tab working_space has not enough space to stock the data. I solve this problem by increasing the size of the tab working_space at the line 1149-1150 and it works now.
I would like to know if you have the same problem.
I just copy the example 6 and apply to my problem. I have a PSF.txt and a source.txt, I try to execute directly the Deconvolution function but I have a segmentation violation. So I used directly the function source and change the size of the tab working_space.
Thanks for your code but it is not clear to me how it is related to the lines 1222 and 1149 in the orignal code of TSpectrum2.cxx. I thought you had found a bug in that file and wanted us to check/apply a fix you have.
At the line 1149-1150 in the orignal code of TSpectrum2.cxx , the program declares the tab working_space with the size X and Y. I execute the program, and I find a segmentation. I try debug by putting some “printf” in the loop, and at the line 1222 in the orignal code of TSpectrum2.cxx, the segmentation appears here : working_space[i1 - i1min][i2 - i2min + 2 * ssizey ].
The value [i1 - i1min] and [i2 - i2min + 2 * ssizey] exceed the size X and Y.
In my code, at the line 210, I increase it, but I don’t know if this fix could have an impact in the calculation.
In the original code, we have :
Double_t **working_space = new Double_t *[ssizex];
for (i = 0; i < ssizex; i++)
working_space[i] = new Double_t[5 * ssizey];
I change it :
Double_t **working_space = new Double_t [2 * ssizex];
for (i = 0; i < 2ssizex; i++)
working_space[i] = new Double_t[10 * ssizey];
I am not the author of this code so I cannot give you an absolute answer.Can you send me the original small macro you wrote producing the Set Fault ? then I can try it with my ROOT and see I see it also.
I think there is a serious problem with this TSpectrum2::Deconvolution … if you look at the examples they instantiate TSpectrum not TSpectrum2… that’s obviously wrong… So I am afraid this method is not tested.