Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,15 @@ class IDCFourierTransform : public IDCFourierTransformBase<Type>
template <bool IsEnabled = true, typename std::enable_if<(IsEnabled && (std::is_same<Type, IDCFourierTransformBaseAggregator>::value)), int>::type = 0>
IDCFourierTransform(const unsigned int rangeIDC = 200, const unsigned int nFourierCoefficientsStore = 200 + 2) : IDCFourierTransformAggregator(rangeIDC), mFourierCoefficients{1, nFourierCoefficientsStore}, mVal1DIDCs(sNThreads), mCoefficients(sNThreads)
{
initFFTW3Members();
};
}

/// constructor for EPN type
/// \param rangeIDC number of IDCs for each interval which will be used to calculate the fourier coefficients
/// \param nFourierCoefficientsStore number of courier coefficients (real+imag) which will be stored (the maximum can be 'rangeIDC + 2', should be an even number when using naive FT). If less than maximum is setn the inverse fourier transform will not work.
template <bool IsEnabled = true, typename std::enable_if<(IsEnabled && (std::is_same<Type, IDCFourierTransformBaseEPN>::value)), int>::type = 0>
IDCFourierTransform(const unsigned int rangeIDC = 200, const unsigned int nFourierCoefficientsStore = 200 + 2) : IDCFourierTransformEPN(rangeIDC), mFourierCoefficients{1, nFourierCoefficientsStore}, mVal1DIDCs(sNThreads), mCoefficients(sNThreads)
{
initFFTW3Members();
};
}

// Destructor
~IDCFourierTransform();
Expand All @@ -72,6 +70,9 @@ class IDCFourierTransform : public IDCFourierTransformBase<Type>
sNThreads = nThreads;
}

/// initalizing fftw members, e.g. when changing sNThreads via setNThreads after first initialization
void initFFTW3Members();

/// calculate fourier coefficients for one TPC side
template <bool IsEnabled = true, typename std::enable_if<(IsEnabled && (std::is_same<Type, IDCFourierTransformBaseAggregator>::value)), int>::type = 0>
void calcFourierCoefficients(const unsigned int timeFrames = 2000)
Expand Down Expand Up @@ -155,9 +156,6 @@ class IDCFourierTransform : public IDCFourierTransformBase<Type>
/// \return returns maximum numbers of stored real/imag fourier coeffiecients
unsigned int getNMaxCoefficients() const { return this->mRangeIDC / 2 + 1; }

/// initalizing fftw members
void initFFTW3Members();

/// performing of ft using FFTW
void fftwLoop(const std::vector<float>& idcOneExpanded, const std::vector<unsigned int>& offsetIndex, const unsigned int interval, const unsigned int thread);

Expand Down
2 changes: 2 additions & 0 deletions Detectors/TPC/calibration/src/IDCFourierTransform.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ o2::tpc::IDCFourierTransform<Type>::~IDCFourierTransform()
template <class Type>
void o2::tpc::IDCFourierTransform<Type>::initFFTW3Members()
{
mVal1DIDCs.resize(sNThreads);
mCoefficients.resize(sNThreads);
for (int thread = 0; thread < sNThreads; ++thread) {
mVal1DIDCs[thread] = fftwf_alloc_real(this->mRangeIDC);
mCoefficients[thread] = fftwf_alloc_complex(getNMaxCoefficients());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ BOOST_AUTO_TEST_CASE(IDCFourierTransformAggregator_test)
FtType::setNThreads(2);

FtType idcFourierTransform{rangeIDC, nFourierCoeff};
idcFourierTransform.initFFTW3Members();
const auto intervalsPerTF = getIntegrationIntervalsPerTF(integrationIntervals, tfs);
idcFourierTransform.setIDCs(get1DIDCs(intervalsPerTF), intervalsPerTF);
idcFourierTransform.setIDCs(get1DIDCs(intervalsPerTF), intervalsPerTF);
Expand Down Expand Up @@ -105,6 +106,7 @@ BOOST_AUTO_TEST_CASE(IDCFourierTransformEPN_test)
const bool fft = iType == 0 ? false : true;
FtType::setFFT(fft);
FtType idcFourierTransform{rangeIDC, nFourierCoeff};
idcFourierTransform.initFFTW3Members();
const auto intervalsPerTF = getIntegrationIntervalsPerTF(integrationIntervals, tfs);
idcFourierTransform.setIDCs(get1DIDCs(intervalsPerTF));
idcFourierTransform.calcFourierCoefficients();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ class TPCFourierTransformAggregatorSpec : public o2::framework::Task
mEnableFFTCCDB = ic.options().get<bool>("enable-fft-CCDB");
int nthreads = ic.options().get<int>("nthreads");
TPCFourierTransformAggregatorSpec::IDCFType::setNThreads(nthreads);
for (auto& fourierTransform : mIDCFourierTransform) {
fourierTransform.initFFTW3Members();
}
resizeBuffer(mInputLanes);
}

Expand Down