# GOLD Algorithm - shift in start times by 1 bin

Hi,

I have been using the GOLD algorithm to deconvolve the response of a detector from signals measured in an FADC. I have found that the start time of the signal is shifted by 1 bin in time, to larger times, after the deconvolution. This is unphysical as it suggests the repsonse of the detector spreads the signal both forwards and backwards in time. My code looks like this:

//set SPR in an array;
float SPR = new float[NoBins];//define the response function of the system
for (int j = 0; j < NoBins; ++j)
//this is the response function
SPR[j]=1
(exp(-1*((j25)+12.5)/67.0) - exp(-1((j*25)+12.5)/13.0));

//deconvolute SPR from trace
float *yf = new float[NoBins];
for (int i=0;i<NoBins;i++)
yf[i] = y[i];

spec->Deconvolution(yf,SPR, NoBins, 100,20,1.5);//50,10,20.0

If i shift the resulting array, yf, by 1 bin and re-convolve the signal I recover roughly what I started with.

Is this because the number of bins I use, NoBins, is not an even number?

Many thanks,

Ben

Could you send a running script that we can use to investigate your problem?
and indicate your version of ROOT

Rene

Hi,

My script is attached along with the relevant .txt file.

Cheers

Ben
Forum_GOLD.C (2.1 KB)
1585422_511.txt (7.27 KB)

I do not see any problem with your script. Which version are you using?
In case of an old version, could you try with 5.17/08 or newer ?

Rene

I am now using 5.17/08 and I still get the same problem. Attached is another script which deonvolves then re-convolves the trace. The re-convolved trace (in blue) is shifted 1 bin to the left and matches the original trace (black) well.

Cheers

Ben
Forum_GOLD.C (3.6 KB)
1178901_149.txt (14.2 KB)

Replace the line

``` h3->SetBinContent(i,y[i]/SPRSignal); ```by

``` h3->SetBinContent(i+1,y[i]/SPRSignal); ```
In ROOT histograms, bin 0 is the underflow bin

Rene

Hi Rene,

I have used the underflow bin on purpose as doing this makes the two histograms line up. If I make the replacement you suggest, the alignment is lost. After all, one would expect the distributions before deconvolution and after re-convolution to be roughly the same.

Cheers

Ben

Could you send your picture of the deconvoluted histogram? I do not see any problem in my case.

Rene

Hi,

the blue line shows the re-convolved trace, the black the original trace and the red the deconvolved trace.

The blue should roughly match the black, but there is a 1 bin offset.

Cheers

Ben
1178901_149.ps (11.4 KB)

Sorry, wrong attachment! This is the correct one.
1178901_149.ps (12.9 KB)