From 9c700a377391635374fa85026379ec0408f81fe6 Mon Sep 17 00:00:00 2001 From: Suter Andreas Date: Wed, 11 Nov 2015 10:30:16 +0100 Subject: [PATCH] Fixes the crash of Fourier if the maximal range given in the Fourier block is larger than the available. --- ChangeLog | 2 ++ src/classes/PFourier.cpp | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index ecbaf0fc..e62c7c74 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,8 @@ FIXED 2015-10-29 TMusrRunHeader didn't map a double vector properly into a string. The last element was a copy of the 2nd last instead if the proper last. This is now fixed. Fixed also some comment typo. +FIXED 2015-11-11 Fixes the crash of Fourier if the maximal range given in the + Fourier block is larger than the available. changes since 0.14.0 =================================== diff --git a/src/classes/PFourier.cpp b/src/classes/PFourier.cpp index ea08370b..bbfbf542 100644 --- a/src/classes/PFourier.cpp +++ b/src/classes/PFourier.cpp @@ -299,6 +299,10 @@ TH1F* PFourier::GetPhaseOptRealFourier(Double_t &phase, const Double_t scale, co // check if maximum frequency is given. If yes, get the proper maxBin if (max != -1.0) { maxBin = (UInt_t)(max/fResolution); + if (maxBin >= noOfFourierBins) { + maxBin = noOfFourierBins; + cerr << "**WARNING** maximum frequency/field out of range. Will adopted it." << endl; + } } // copy the real/imag Fourier from min to max