From 396792a43c7df3ea3882169eded78c2e950e20fd Mon Sep 17 00:00:00 2001 From: Ernst Hellbar Date: Thu, 18 Jun 2026 14:02:05 +0200 Subject: [PATCH 1/2] TPC: fix initialization of FFTW arrays in aggregator-ft --- .../include/TPCCalibration/IDCFourierTransform.h | 16 +++++----------- .../TPC/calibration/src/IDCFourierTransform.cxx | 2 ++ .../TPCFourierTransformAggregatorSpec.h | 3 +++ 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Detectors/TPC/calibration/include/TPCCalibration/IDCFourierTransform.h b/Detectors/TPC/calibration/include/TPCCalibration/IDCFourierTransform.h index 8a27321e131f3..4e0e176c87db8 100644 --- a/Detectors/TPC/calibration/include/TPCCalibration/IDCFourierTransform.h +++ b/Detectors/TPC/calibration/include/TPCCalibration/IDCFourierTransform.h @@ -43,19 +43,13 @@ class IDCFourierTransform : public IDCFourierTransformBase /// \param timeFrames number of time frames which will be stored /// \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 ::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(); - }; + IDCFourierTransform(const unsigned int rangeIDC = 200, const unsigned int nFourierCoefficientsStore = 200 + 2) : IDCFourierTransformAggregator(rangeIDC), mFourierCoefficients{1, nFourierCoefficientsStore}, mVal1DIDCs(sNThreads), mCoefficients(sNThreads) {} /// 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 ::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(); - }; + IDCFourierTransform(const unsigned int rangeIDC = 200, const unsigned int nFourierCoefficientsStore = 200 + 2) : IDCFourierTransformEPN(rangeIDC), mFourierCoefficients{1, nFourierCoefficientsStore}, mVal1DIDCs(sNThreads), mCoefficients(sNThreads) {} // Destructor ~IDCFourierTransform(); @@ -72,6 +66,9 @@ class IDCFourierTransform : public IDCFourierTransformBase 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 ::value)), int>::type = 0> void calcFourierCoefficients(const unsigned int timeFrames = 2000) @@ -155,9 +152,6 @@ class IDCFourierTransform : public IDCFourierTransformBase /// \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& idcOneExpanded, const std::vector& offsetIndex, const unsigned int interval, const unsigned int thread); diff --git a/Detectors/TPC/calibration/src/IDCFourierTransform.cxx b/Detectors/TPC/calibration/src/IDCFourierTransform.cxx index c4b92b57c17ab..437fa4b8f1991 100644 --- a/Detectors/TPC/calibration/src/IDCFourierTransform.cxx +++ b/Detectors/TPC/calibration/src/IDCFourierTransform.cxx @@ -35,6 +35,8 @@ o2::tpc::IDCFourierTransform::~IDCFourierTransform() template void o2::tpc::IDCFourierTransform::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()); diff --git a/Detectors/TPC/workflow/include/TPCWorkflow/TPCFourierTransformAggregatorSpec.h b/Detectors/TPC/workflow/include/TPCWorkflow/TPCFourierTransformAggregatorSpec.h index 7facee78fb3d6..9c64634b438d9 100644 --- a/Detectors/TPC/workflow/include/TPCWorkflow/TPCFourierTransformAggregatorSpec.h +++ b/Detectors/TPC/workflow/include/TPCWorkflow/TPCFourierTransformAggregatorSpec.h @@ -66,6 +66,9 @@ class TPCFourierTransformAggregatorSpec : public o2::framework::Task mEnableFFTCCDB = ic.options().get("enable-fft-CCDB"); int nthreads = ic.options().get("nthreads"); TPCFourierTransformAggregatorSpec::IDCFType::setNThreads(nthreads); + for (auto& fourierTransform : mIDCFourierTransform) { + fourierTransform.initFFTW3Members(); + } resizeBuffer(mInputLanes); } From 82267904d4a1ba55654fe5f0c389272b514df42a Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Thu, 18 Jun 2026 12:20:40 +0000 Subject: [PATCH 2/2] Please consider the following formatting changes --- .../include/TPCCalibration/IDCFourierTransform.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Detectors/TPC/calibration/include/TPCCalibration/IDCFourierTransform.h b/Detectors/TPC/calibration/include/TPCCalibration/IDCFourierTransform.h index 4e0e176c87db8..db79695ce9834 100644 --- a/Detectors/TPC/calibration/include/TPCCalibration/IDCFourierTransform.h +++ b/Detectors/TPC/calibration/include/TPCCalibration/IDCFourierTransform.h @@ -43,13 +43,17 @@ class IDCFourierTransform : public IDCFourierTransformBase /// \param timeFrames number of time frames which will be stored /// \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 ::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) {} + IDCFourierTransform(const unsigned int rangeIDC = 200, const unsigned int nFourierCoefficientsStore = 200 + 2) : IDCFourierTransformAggregator(rangeIDC), mFourierCoefficients{1, nFourierCoefficientsStore}, mVal1DIDCs(sNThreads), mCoefficients(sNThreads) + { + } /// 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 ::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) {} + IDCFourierTransform(const unsigned int rangeIDC = 200, const unsigned int nFourierCoefficientsStore = 200 + 2) : IDCFourierTransformEPN(rangeIDC), mFourierCoefficients{1, nFourierCoefficientsStore}, mVal1DIDCs(sNThreads), mCoefficients(sNThreads) + { + } // Destructor ~IDCFourierTransform();