fixed wrong Fourier vector size for DKS.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2015 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@@ -99,6 +99,7 @@ PFourier::PFourier(TH1F *data, Int_t unitTag, Double_t startTime, Double_t endTi
|
||||
|
||||
// calculate start and end bin
|
||||
fNoOfData = (UInt_t)((fEndTime-fStartTime)/fTimeResolution);
|
||||
cout << "debug> fStartTime=" << fStartTime << ", fEndTime=" << fEndTime << ", fTimeResolution=" << fTimeResolution << ", fNoOfData=" << fNoOfData << endl;
|
||||
|
||||
// check if zero padding is whished
|
||||
if (fZeroPaddingPower > 0) {
|
||||
@@ -139,9 +140,7 @@ PFourier::PFourier(TH1F *data, Int_t unitTag, Double_t startTime, Double_t endTi
|
||||
} else { // try DKS
|
||||
#ifdef HAVE_DKS
|
||||
fInDKS = new double[fNoOfBins];
|
||||
unsigned int size=fNoOfBins/2;
|
||||
if (fNoOfBins % 2 == 1)
|
||||
size++;
|
||||
unsigned int size=fNoOfBins/2+1;
|
||||
fOutDKS = new complex<double>[size];
|
||||
#endif
|
||||
}
|
||||
@@ -182,9 +181,7 @@ PFourier::PFourier(TH1F *data, Int_t unitTag, Double_t startTime, Double_t endTi
|
||||
fDks.setupFFT(1, dimsize);
|
||||
// allocate memory on accelerator
|
||||
int ierr;
|
||||
unsigned int size=fNoOfBins/2;
|
||||
if (fNoOfBins % 2 == 1)
|
||||
size++;
|
||||
unsigned int size=fNoOfBins/2+1;
|
||||
fReal_ptr = 0;
|
||||
fComp_ptr = 0;
|
||||
fReal_ptr = fDks.allocateMemory<double>(fNoOfBins, ierr);
|
||||
@@ -216,9 +213,7 @@ PFourier::~PFourier()
|
||||
#ifdef HAVE_DKS
|
||||
// free accelerator memory
|
||||
fDks.freeMemory<double>(fReal_ptr, (int)fNoOfBins);
|
||||
int size = fNoOfBins/2;
|
||||
if (fNoOfBins % 2 == 1)
|
||||
size++;
|
||||
int size = fNoOfBins/2+1;
|
||||
fDks.freeMemory< complex<double> >(fComp_ptr, size);
|
||||
if (fIn)
|
||||
delete [] fInDKS;
|
||||
@@ -249,9 +244,7 @@ void PFourier::Transform(UInt_t apodizationTag)
|
||||
} else {
|
||||
#ifdef HAVE_DKS
|
||||
int dimsize[3] = {fNoOfBins, 1, 1};
|
||||
int status=0, size=fNoOfBins/2;
|
||||
if (fNoOfBins % 2 == 1)
|
||||
size++;
|
||||
int status=0, size=fNoOfBins/2+1;
|
||||
// write data to the accelerator
|
||||
status=fDks.writeData<double>(fReal_ptr, fInDKS, fNoOfBins);
|
||||
cout << "debug> status=" << status << ": write" << endl;
|
||||
|
||||
Reference in New Issue
Block a user