44 TCanvas *myc =
new TCanvas(
"myc",
"Fast Fourier Transform", 800, 600);
46 TPad *c1_1 =
new TPad(
"c1_1",
"c1_1",0.01,0.67,0.49,0.99);
47 TPad *c1_2 =
new TPad(
"c1_2",
"c1_2",0.51,0.67,0.99,0.99);
48 TPad *c1_3 =
new TPad(
"c1_3",
"c1_3",0.01,0.34,0.49,0.65);
49 TPad *c1_4 =
new TPad(
"c1_4",
"c1_4",0.51,0.34,0.99,0.65);
50 TPad *c1_5 =
new TPad(
"c1_5",
"c1_5",0.01,0.01,0.49,0.32);
51 TPad *c1_6 =
new TPad(
"c1_6",
"c1_6",0.51,0.01,0.99,0.32);
75 TF1 *fsin =
new TF1(
"fsin",
"sin(x)+sin(2*x)+sin(0.5*x)+1", 0, 4*
TMath::Pi());
83 for (
Int_t i=0; i<=
n; i++){
95 hm = hsin->
FFT(hm,
"MAG");
96 hm->
SetTitle(
"Magnitude of the 1st transform");
107 hp = hsin->
FFT(hp,
"PH");
108 hp->
SetTitle(
"Phase of the 1st transform");
121 printf(
"1st transform: DC component: %f\n", re);
123 printf(
"1st transform: Nyquist harmonic: %f\n", re);
137 hb->
SetTitle(
"The backward transform result");
157 for (
Int_t i=0; i<=
n; i++){
159 in[i] = fsin->
Eval(x);
172 if (!fft_own)
return;
182 hr->
SetTitle(
"Real part of the 3rd (array) tranfsorm");
190 him->
SetTitle(
"Im. part of the 3rd (array) transform");
200 TF1 *fcos =
new TF1(
"fcos",
"cos(x)+cos(0.5*x)+cos(2*x)+1", 0, 4*
TMath::Pi());
201 for (
Int_t i=0; i<=
n; i++){
203 in[i] = fcos->
Eval(x);
208 printf(
"2nd transform: DC component: %f\n", re_2);
210 printf(
"2nd transform: Nyquist harmonic: %f\n", re_2);
static void SetTransform(TVirtualFFT *fft)
static: set the current transfrom to parameter
virtual void SetPointsComplex(const Double_t *re, const Double_t *im)=0
static TVirtualFFT * GetCurrentTransform()
static: return current fgFFT
TVirtualPad * cd(Int_t subpadnumber=0)
Set current canvas & pad.
virtual void Draw(Option_t *option="")
Draw this function with its current attributes.
static void AddDirectory(Bool_t add=kTRUE)
Sets the flag controlling the automatic add of histograms in memory.
TVirtualPad * cd(Int_t subpadnumber=0)
Set Current pad.
virtual void Draw(Option_t *option="")
Draw Pad in Current pad (re-parent pad if necessary).
virtual TH1 * FFT(TH1 *h_output, Option_t *option)
This function allows to do discrete Fourier transforms of TH1 and TH2.
virtual void Draw(Option_t *option="")
Draw this histogram with options.
virtual void SetFillColor(Color_t fcolor)
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 TVirtualFFT * FFT(Int_t ndim, Int_t *n, Option_t *option)
Returns a pointer to the FFT of requested size and type.
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...
The most important graphics class in the ROOT system.
virtual void Transform()=0
virtual void GetPointsComplex(Double_t *re, Double_t *im, Bool_t fromInput=kFALSE) const =0
1-D histogram with a double per channel (see TH1 documentation)}
virtual void SetLabelSize(Float_t size=0.04)
Set size of axis labels The size is expressed in per cent of the pad width.
TAxis * GetYaxis() const
Get y axis of the function.
virtual void SetPoints(const Double_t *data)=0
TVirtualFFT is an interface class for Fast Fourier Transforms.
virtual void GetPoints(Double_t *data, Bool_t fromInput=kFALSE) const =0
virtual void GetPointComplex(Int_t ipoint, Double_t &re, Double_t &im, Bool_t fromInput=kFALSE) const =0
ClassImp(TMCParticle) void TMCParticle printf(": p=(%7.3f,%7.3f,%9.3f) ;", fPx, fPy, fPz)
TAxis * GetXaxis() const
Get x axis of the function.
virtual Double_t Eval(Double_t x, Double_t y=0, Double_t z=0, Double_t t=0) const
Evaluate this function.
void SetFrameFillColor(Color_t color=1)
virtual void SetTitle(const char *title)
Change (i.e.
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.