This tutorial illustrates the Fast Fourier Transforms interface in ROOT.
FFT transform types provided in ROOT:
- "C2CFORWARD" - a complex input/output discrete Fourier transform (DFT) in one or more dimensions, -1 in the exponent
- "C2CBACKWARD"- a complex input/output discrete Fourier transform (DFT) in one or more dimensions, +1 in the exponent
- "R2C" - a real-input/complex-output discrete Fourier transform (DFT) in one or more dimensions,
- "C2R" - inverse transforms to "R2C", taking complex input (storing the non-redundant half of a logically Hermitian array) to real output
- "R2HC" - a real-input DFT with output in "halfcomplex" format, i.e. real and imaginary parts for a transform of size n stored as r0, r1, r2, ..., rn/2, i(n+1)/2-1, ..., i2, i1
- "HC2R" - computes the reverse of FFTW_R2HC, above
- "DHT" - computes a discrete Hartley transform
Sine/cosine transforms:
- DCT-I (REDFT00 in FFTW3 notation)
- DCT-II (REDFT10 in FFTW3 notation)
- DCT-III(REDFT01 in FFTW3 notation)
- DCT-IV (REDFT11 in FFTW3 notation)
- DST-I (RODFT00 in FFTW3 notation)
- DST-II (RODFT10 in FFTW3 notation)
- DST-III(RODFT01 in FFTW3 notation)
- DST-IV (RODFT11 in FFTW3 notation)
First part of the tutorial shows how to transform the histograms Second part shows how to transform the data arrays directly
1st transform: DC component: 26.000000
1st transform: Nyquist harmonic: -0.932840
2nd transform: DC component: 29.000000
2nd transform: Nyquist harmonic: -0.000000
void FFT()
{
c1_1->SetFrameFillColor(42);
c1_2->SetFrameFillColor(42);
c1_3->SetFrameFillColor(42);
c1_4->SetFrameFillColor(42);
c1_5->SetFrameFillColor(42);
c1_6->SetFrameFillColor(42);
}
fsin->GetXaxis()->SetLabelSize(0.05);
fsin->GetYaxis()->SetLabelSize(0.05);
hm->SetTitle(
"Magnitude of the 1st transform");
hm->GetXaxis()->SetLabelSize(0.05);
hm->GetYaxis()->SetLabelSize(0.05);
hp->SetTitle(
"Phase of the 1st transform");
hp->GetXaxis()->SetLabelSize(0.05);
hp->GetYaxis()->SetLabelSize(0.05);
fft->GetPointComplex(0, re,
im);
printf(
"1st transform: DC component: %f\n", re);
fft->GetPointComplex(
n/2+1, re,
im);
printf(
"1st transform: Nyquist harmonic: %f\n", re);
hb->SetTitle(
"The backward transform result");
hb->GetXaxis()->SetLabelSize(0.05);
hb->GetYaxis()->SetLabelSize(0.05);
}
hr->SetTitle(
"Real part of the 3rd (array) transform");
hr->GetXaxis()->SetLabelSize(0.05);
hr->GetYaxis()->SetLabelSize(0.05);
him->SetTitle(
"Im. part of the 3rd (array) transform");
him->GetXaxis()->SetLabelSize(0.05);
him->GetYaxis()->SetLabelSize(0.05);
}
printf(
"2nd transform: DC component: %f\n",
re_2);
printf(
"2nd transform: Nyquist harmonic: %f\n",
re_2);
delete [] in;
}
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
1-D histogram with a double per channel (see TH1 documentation)
TH1 is the base class of all histogram classes in ROOT.
static TH1 * TransformHisto(TVirtualFFT *fft, TH1 *h_output, Option_t *option)
For a given transform (first parameter), fills the histogram (second parameter) with the transform ou...
static void AddDirectory(Bool_t add=kTRUE)
Sets the flag controlling the automatic add of histograms in memory.
The most important graphics class in the ROOT system.
TVirtualFFT is an interface class for Fast Fourier Transforms.
static void SetTransform(TVirtualFFT *fft)
static: set the current transfrom to parameter
static TVirtualFFT * FFT(Int_t ndim, Int_t *n, Option_t *option)
Returns a pointer to the FFT of requested size and type.
static TVirtualFFT * GetCurrentTransform()
static: return current fgFFT
- Authors
- Anna Kreshuk, Jens Hoffmann
Definition in file FFT.C.