13 TString name(Form(
"fft_waveforms_event__%04d", eventnr));
14 TCanvas* fftc =
new TCanvas(name.Data(), name.Data(), 600, 400);
17 TString imname(Form(
"fft_im_waveforms_event__%04d", eventnr));
18 TCanvas* imfftc =
new TCanvas(imname.Data(), imname.Data(), 600, 400);
22 double* xvals =
new double[size];
23 for (
int i = 0; i < size; i++) {
24 xvals[i] =
static_cast<double>(i) / (
SP *
static_cast<double>(size));
27 double* refft =
new double[size];
28 double* imfft =
new double[size];
30 double* yvals =
new double[size];
35 for (
int j = 0; j < size; j++) {
36 if (j <
binNumber) yvals[j] = his->GetBinContent(j + 1);
40 TVirtualFFT* ffthis = TVirtualFFT::FFT(1, &size,
"R2C ES");
41 ffthis->SetPoints(yvals);
43 ffthis->GetPointsComplex(refft, imfft);
45 TGraph* re =
new TGraph(size, xvals, refft);
46 TGraph* im =
new TGraph(size, xvals, imfft);
50 stringstream renamess; renamess <<
"Channel " <<
active_channels[i] <<
", event " << eventnr <<
", Re(FFT(data))";
51 re->SetTitle(renamess.str().c_str());
54 if (xmin != 0. || xmax != 0.) re->GetXaxis()->SetLimits(xmin, xmax);
58 stringstream imnamess; imnamess <<
"Channel " <<
active_channels[i] <<
", event " << eventnr <<
", Im(FFT(data))";
59 im->SetTitle(imnamess.str().c_str());
62 if (xmin != 0. || xmax != 0.) im->GetXaxis()->SetLimits(xmin, xmax);
70 root_out->WriteObject(fftc, name.Data());
71 root_out->WriteObject(imfftc, imname.Data());
static void SplitCanvas(TCanvas *&, vector< int >, vector< int >)
Helper to split canvas according to the number of channels to be plotted.