FFT - Help!


I have recently begun using FFT in root in order to upsample FADC traces. I wish to transform into the frequency domain, pad as required, then transform back into the time domain. If I do not pad the trace, I should recover the original distribution. This is not the case.

My code looks something like this:

//define original histogram
TH1F *h = new TH1F(Form(“h %d %d”, EventId, TankId),“FADC trace”,iter,x[0],x[iter]);
h->GetXaxis()->SetRange(x[0], x[iter]);
for (int i=0;i<iter;i++)
h->GetXaxis()->SetTitle(“t [ns]”);
h->GetYaxis()->SetTitle(“Signal [VEM]”);

//transform into frequency domain

TH1F *hTrans = new TH1F(“h in frequecy space”, “h in frequecy space”, iter, 0, iter);
hTrans = h->FFT(hTrans, “MAG R2C M”);

//transform back into time domain - should recover same trace

TH1F *hInvTrans = new TH1F(“h in time”, “h in time”, iter, x[0],x[iter] );
hInvTrans = hTrans->FFT(hInvTrans, “MAG C2R M”);

I guess I don’t know what should be the x-axis label for hTrans, and then again for hInvTrans. Am I doing this correctly? i.e. does “MAG R2C” actually give the correct frequency domain transform, and “MAG C2R” inversely transform this? From the FFT manual it seemed to suggest this. The full code and ascii input are also attached.

Thank you for any help you can give me,


3000015_651.txt (5.14 KB)
UpSample.C (1.7 KB)