Increase resolution for FFT

I am trying to extract the frequency spectrum using the FFT functions. I followed the tutorial to fill an histogram from my input TGraph. I have 1e5 entries. Then I calculate the FFT:

``````TH1 *fourier = 0;
TVirtualFFT::SetTransform(0);
fourier = hprojection->FFT(fourier, "MAG R2C");

TH1D *h1dMag = new TH1D("h1dMag", "Magnitude (i.e., Power Spectrum)", fourier->GetNbinsX(), 0, fourier->GetXaxis()->GetXmax()/hprojection->GetXaxis()->GetXmax());
// rescale axis to get real units
for (int bin = 1; bin <= tree->GetEntries(); bin++){
h1dMag->SetBinContent(bin, fourier->GetBinContent(bin));
}
``````

I get a reasonable result:

but I need more resolution around the peak, i.e., I need to know with more accuracy where the maximum is, and the width of the distribution.

In case it is useful, my function is basically a cosine function with some initial phase, and the nominal frequency changes slightly with time.

@couet, can you take a look please here?

Thanks,
Oksana.

You mean more bins ?

Yes, that is what I need. I know what the nominal value is going to be more or less, so instead of having more example 1000 bins from 0 to 1000, I could have 1000 bins between 220 and 240.

May be the variable bin size histogram is a solution in your case ?

The problem is that I want more bins in the `fourier` histogram, but the bins of this histogram will be determined by the bins of the original histogram by the function `fourier = hprojection->FFT(fourier, "MAG R2C");`
I understand that it is after this step that the binning, i.e., the resolution, is defined. I can’t increase the number of bins of `hprojection` since this is given by the data.

My question would be: is it possible to have more bins for the histogram where the FFT is stored? It would be even better if I can define the range of that histogram around the known nominal value, in order to improve even more the accuracy.