From 0b1c9e53c604ed6e27c41505fefccb4785e7c5bb Mon Sep 17 00:00:00 2001 From: Andreas Suter Date: Mon, 23 Jun 2025 16:02:07 +0200 Subject: [PATCH] (i) make most internal checking functions in the msr handler private. (ii) improved checking of real Fourier for consistency. --- src/classes/PMsrHandler.cpp | 66 +++++++++++++++++++++++++++++-------- src/include/PMsrHandler.h | 17 +++++----- 2 files changed, 61 insertions(+), 22 deletions(-) diff --git a/src/classes/PMsrHandler.cpp b/src/classes/PMsrHandler.cpp index 13a19758..e4f21f4a 100644 --- a/src/classes/PMsrHandler.cpp +++ b/src/classes/PMsrHandler.cpp @@ -316,13 +316,9 @@ Int_t PMsrHandler::ReadMsrFile() CheckLegacyLifetimecorrection(); // check if lifetimecorrection is found in RUN blocks, if yes transfer it to PLOT blocks } - // check if the given phases in the Fourier block are in agreement with the Plot block settings - if ((fFourier.fPhase.size() > 1) && (fPlots.size() > 0)) { - if (fFourier.fPhase.size() != fPlots[0].fRuns.size()) { - std::cerr << std::endl << ">> PMsrHandler::ReadMsrFile: **ERROR** if more than one phase is given in the Fourier block,"; - std::cerr << std::endl << ">> it needs to correspond to the number of runs in the Plot block!" << std::endl; - result = PMUSR_MSR_SYNTAX_ERROR; - } + if (result == PMUSR_SUCCESS) { + if (!CheckRealFFT()) + result = PMUSR_MSR_SYNTAX_ERROR; } // clean up @@ -6070,7 +6066,7 @@ Bool_t PMsrHandler::CheckRunBlockIntegrity() } //-------------------------------------------------------------------------- -// CheckUniquenessOfParamNames (public) +// CheckUniquenessOfParamNames (private) //-------------------------------------------------------------------------- /** *

Checks if all the fit parameters are unique. If not parX, parY will show @@ -6102,7 +6098,7 @@ Bool_t PMsrHandler::CheckUniquenessOfParamNames(UInt_t &parX, UInt_t &parY) } //-------------------------------------------------------------------------- -// CheckMaps (public) +// CheckMaps (private) //-------------------------------------------------------------------------- /** *

Checks if map entries found in the theory- or function-block are also @@ -6212,7 +6208,7 @@ Bool_t PMsrHandler::CheckMaps() } //-------------------------------------------------------------------------- -// CheckFuncs (public) +// CheckFuncs (private) //-------------------------------------------------------------------------- /** *

Checks if fun entries found in the theory- and run-block are also @@ -6307,7 +6303,7 @@ Bool_t PMsrHandler::CheckFuncs() } //-------------------------------------------------------------------------- -// CheckHistoGrouping (public) +// CheckHistoGrouping (private) //-------------------------------------------------------------------------- /** *

Checks if histogram grouping makes any sense. @@ -6353,7 +6349,7 @@ Bool_t PMsrHandler::CheckHistoGrouping() } //-------------------------------------------------------------------------- -// CheckAddRunParameters (public) +// CheckAddRunParameters (private) //-------------------------------------------------------------------------- /** *

In case addrun is present check that if addt0's are given there are as many addt0's than addrun's. @@ -6385,7 +6381,7 @@ Bool_t PMsrHandler::CheckAddRunParameters() } //-------------------------------------------------------------------------- -// CheckMaxLikelihood (public) +// CheckMaxLikelihood (private) //-------------------------------------------------------------------------- /** *

If log max likelihood is requested, make sure that all run blocks are of single histogram type. @@ -6409,7 +6405,7 @@ void PMsrHandler::CheckMaxLikelihood() } //-------------------------------------------------------------------------- -// CheckRRFSettings (public) +// CheckRRFSettings (private) //-------------------------------------------------------------------------- /** *

Make sure that if RRF settings are found in the GLOBAL section, the fit types @@ -6505,6 +6501,48 @@ Bool_t PMsrHandler::CheckRRFSettings() return result; } +//-------------------------------------------------------------------------- +// CheckRealFFT (private) +//-------------------------------------------------------------------------- +/** + *

Checks for FOURIER plot REAL, if all necessary parameters are given. + * + * @return true if all necessary parameters are given; false otherwise. + */ +Bool_t PMsrHandler::CheckRealFFT() +{ + // check + if (fFourier.fPlotTag == FOURIER_PLOT_POWER) + return true; + + // check if the given phases in the Fourier block are in agreement with the Plot block settings + if ((fFourier.fPhase.size() > 1) && (fPlots.size() > 0)) { + if (fFourier.fPhase.size() != fPlots[0].fRuns.size()) { + std::cerr << std::endl << ">> PMsrHandler::ReadMsrFile: **ERROR** if more than one phase is given in the Fourier block,"; + std::cerr << std::endl << ">> it needs to correspond to the number of runs in the Plot block!" << std::endl; + std::cerr << std::endl << ">> currently:"; + std::cerr << std::endl << ">> number of runs in the PLOT block: " << fPlots[0].fRuns.size(); + std::cerr << std::endl << ">> number of phases in the FOURIER block: " << fFourier.fPhase.size(); + return false; + } + } + + // make sure that FOURIER phases are defined + if ((fFourier.fPhase.size() == 0) && (fFourier.fPhaseParamNo.size() == 0)) { + std::cerr << std::endl << ">> PMsrHandler::ReadMsrFile: **ERROR** for FOURIER plot != POWER,"; + std::cerr << std::endl << ">> phases need to be defined in the FOURIER block!"; + std::cerr << std::endl << ">> Examples:"; + std::cerr << std::endl << ">> phase parR7 par9 par13 par16"; + std::cerr << std::endl << ">> where parR7 is the reference phase, and the others the relative phases."; + std::cerr << std::endl << ">> I.e. phase of run 2: parR7 + par9, etc."; + std::cerr << std::endl << ">> For further details see the docu."; + return false; + } + + return true; +} + + //-------------------------------------------------------------------------- // GetGroupingString (public) //-------------------------------------------------------------------------- diff --git a/src/include/PMsrHandler.h b/src/include/PMsrHandler.h index cb4117e1..8154395b 100644 --- a/src/include/PMsrHandler.h +++ b/src/include/PMsrHandler.h @@ -99,14 +99,6 @@ class PMsrHandler { return fFuncHandler->Eval(i, map, param, metaData); } virtual UInt_t GetNoOfFitParameters(UInt_t idx); virtual Int_t ParameterInUse(UInt_t paramNo); - virtual Bool_t CheckRunBlockIntegrity(); - virtual Bool_t CheckUniquenessOfParamNames(UInt_t &parX, UInt_t &parY); - virtual Bool_t CheckMaps(); - virtual Bool_t CheckFuncs(); - virtual Bool_t CheckHistoGrouping(); - virtual Bool_t CheckAddRunParameters(); - virtual Bool_t CheckRRFSettings(); - virtual void CheckMaxLikelihood(); virtual void GetGroupingString(Int_t runNo, TString detector, TString &groupingStr); virtual Bool_t EstimateN0(); @@ -163,6 +155,15 @@ class PMsrHandler virtual TString BeautifyFourierPhaseParameterString(); virtual void CheckLegacyLifetimecorrection(); + virtual Bool_t CheckRunBlockIntegrity(); + virtual Bool_t CheckUniquenessOfParamNames(UInt_t &parX, UInt_t &parY); + virtual Bool_t CheckMaps(); + virtual Bool_t CheckFuncs(); + virtual Bool_t CheckHistoGrouping(); + virtual Bool_t CheckAddRunParameters(); + virtual Bool_t CheckRRFSettings(); + virtual Bool_t CheckRealFFT(); + virtual void CheckMaxLikelihood(); }; #endif // _PMSRHANDLER_H_