fixed range bug and added tstart phase shift correction

This commit is contained in:
nemu 2009-05-05 06:51:06 +00:00
parent 2012c537e8
commit cba83984ee

View File

@ -189,27 +189,20 @@ void PFourier::Transform(unsigned int apodizationTag)
if (!fValid) if (!fValid)
return; return;
//cout << endl << ">> PFourier::Transform (apodizationTag=" << apodizationTag << ") ..." << endl;
PrepareFFTwInputData(apodizationTag); PrepareFFTwInputData(apodizationTag);
/*
if (fNoOfBins < 200) {
for (unsigned int i=0; i<fNoOfBins; i++) {
cout << endl << ">> PFourier::PrepareFFTwInputData: " << i << ": fIn[i][0] = " << fIn[i][0];
}
cout << endl;
}
*/
fftw_execute(fFFTwPlan); fftw_execute(fFFTwPlan);
/* // correct the phase for tstart != 0.0
for (unsigned int i=fNoOfBins-10; i<fNoOfBins; i++) { double phase, re, im;
cout << endl << ">> PFourier::PrepareFFTwInputData: " << i << ": fOut[i][0] = " << fOut[i][0]; for (unsigned int i=0; i<fNoOfBins; i++) {
phase = 2.0*PI/(fTimeResolution*fNoOfBins) * i * fStartTime;
re = fOut[i][0] * cos(phase) + fOut[i][1] * sin(phase);
im = -fOut[i][0] * sin(phase) + fOut[i][1] * cos(phase);
fOut[i][0] = re;
fOut[i][1] = im;
} }
cout << endl;
*/
} }
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
@ -392,14 +385,15 @@ void PFourier::PrepareFFTwInputData(unsigned int apodizationTag)
break; break;
} }
} }
//cout << endl << "t0bin = " << t0bin << endl;
// 2nd fill fIn // 2nd fill fIn
unsigned int start = (unsigned int)(fStartTime/fTimeResolution) + t0bin; unsigned int start = (unsigned int)(fStartTime/fTimeResolution) + t0bin;
for (unsigned int i=0; i<fNoOfData-start; i++) { for (unsigned int i=0; i<fNoOfData; i++) {
fIn[i][0] = fData->GetBinContent(i+start+1); fIn[i][0] = fData->GetBinContent(i+start+1);
fIn[i][1] = 0.0; fIn[i][1] = 0.0;
} }
for (unsigned int i=fNoOfData-start; i<fNoOfBins; i++) { for (unsigned int i=fNoOfData; i<fNoOfBins; i++) {
fIn[i][0] = 0.0; fIn[i][0] = 0.0;
fIn[i][1] = 0.0; fIn[i][1] = 0.0;
} }