55 TCanvas *myc =
new TCanvas(
"myc",
"Fast Fourier Transform", 800, 600);
57 TPad *c1_1 =
new TPad(
"c1_1",
"c1_1",0.01,0.67,0.49,0.99);
58 TPad *c1_2 =
new TPad(
"c1_2",
"c1_2",0.51,0.67,0.99,0.99);
59 TPad *c1_3 =
new TPad(
"c1_3",
"c1_3",0.01,0.34,0.49,0.65);
60 TPad *c1_4 =
new TPad(
"c1_4",
"c1_4",0.51,0.34,0.99,0.65);
61 TPad *c1_5 =
new TPad(
"c1_5",
"c1_5",0.01,0.01,0.49,0.32);
62 TPad *c1_6 =
new TPad(
"c1_6",
"c1_6",0.51,0.01,0.99,0.32);
86 TF1 *fsin =
new TF1(
"fsin",
"sin(x)+sin(2*x)+sin(0.5*x)+1", 0, 4*
TMath::Pi());
94 for (
Int_t i=0; i<=
n; i++){
106 hm = hsin->
FFT(hm,
"MAG");
107 hm->
SetTitle(
"Magnitude of the 1st transform");
118 hp = hsin->
FFT(hp,
"PH");
119 hp->
SetTitle(
"Phase of the 1st transform");
132 printf(
"1st transform: DC component: %f\n", re);
134 printf(
"1st transform: Nyquist harmonic: %f\n", re);
148 hb->
SetTitle(
"The backward transform result");
169 for (
Int_t i=0; i<=
n; i++){
171 in[i] = fsin->
Eval(
x);
184 if (!fft_own)
return;
194 hr->
SetTitle(
"Real part of the 3rd (array) tranfsorm");
202 him->
SetTitle(
"Im. part of the 3rd (array) transform");
212 TF1 *fcos =
new TF1(
"fcos",
"cos(x)+cos(0.5*x)+cos(2*x)+1", 0, 4*
TMath::Pi());
213 for (
Int_t i=0; i<=
n; i++){
215 in[i] = fcos->
Eval(
x);
220 printf(
"2nd transform: DC component: %f\n", re_2);
222 printf(
"2nd transform: Nyquist harmonic: %f\n", re_2);
virtual void SetLabelSize(Float_t size=0.04)
Set size of axis labels.
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
void SetFrameFillColor(Color_t color=1)
TVirtualPad * cd(Int_t subpadnumber=0)
Set current canvas & pad.
TAxis * GetYaxis() const
Get y axis of the function.
virtual void Draw(Option_t *option="")
Draw this function with its current attributes.
virtual Double_t Eval(Double_t x, Double_t y=0, Double_t z=0, Double_t t=0) const
Evaluate this function.
TAxis * GetXaxis() const
Get x axis of the function.
1-D histogram with a double per channel (see TH1 documentation)}
virtual void SetTitle(const char *title)
See GetStatOverflows for more information.
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.
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
virtual TH1 * FFT(TH1 *h_output, Option_t *option)
This function allows to do discrete Fourier transforms of TH1 and TH2.
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content see convention for numbering bins in TH1::GetBin In case the bin number is greater th...
virtual void Draw(Option_t *option="")
Draw this histogram with options.
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.
The most important graphics class in the ROOT system.
virtual void Draw(Option_t *option="")
Draw Pad in Current pad (re-parent pad if necessary).
TVirtualPad * cd(Int_t subpadnumber=0)
Set Current pad.
TVirtualFFT is an interface class for Fast Fourier Transforms.
static void SetTransform(TVirtualFFT *fft)
static: set the current transfrom to parameter
virtual void GetPoints(Double_t *data, Bool_t fromInput=kFALSE) const =0
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
virtual void SetPoints(const Double_t *data)=0
virtual void SetPointsComplex(const Double_t *re, const Double_t *im)=0
virtual void Transform()=0
virtual void GetPointComplex(Int_t ipoint, Double_t &re, Double_t &im, Bool_t fromInput=kFALSE) const =0
virtual void GetPointsComplex(Double_t *re, Double_t *im, Bool_t fromInput=kFALSE) const =0