(i) make most internal checking functions in the msr handler private. (ii) improved checking of real Fourier for consistency.

This commit is contained in:
2025-06-23 16:02:07 +02:00
parent 18bf65a231
commit 0b1c9e53c6
2 changed files with 61 additions and 22 deletions

View File

@ -316,13 +316,9 @@ Int_t PMsrHandler::ReadMsrFile()
CheckLegacyLifetimecorrection(); // check if lifetimecorrection is found in RUN blocks, if yes transfer it to PLOT blocks 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 (result == PMUSR_SUCCESS) {
if ((fFourier.fPhase.size() > 1) && (fPlots.size() > 0)) { if (!CheckRealFFT())
if (fFourier.fPhase.size() != fPlots[0].fRuns.size()) { result = PMUSR_MSR_SYNTAX_ERROR;
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;
}
} }
// clean up // clean up
@ -6070,7 +6066,7 @@ Bool_t PMsrHandler::CheckRunBlockIntegrity()
} }
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
// CheckUniquenessOfParamNames (public) // CheckUniquenessOfParamNames (private)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p>Checks if all the fit parameters are unique. If not parX, parY will show * <p>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)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p>Checks if map entries found in the theory- or function-block are also * <p>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)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p>Checks if fun entries found in the theory- and run-block are also * <p>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)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p>Checks if histogram grouping makes any sense. * <p>Checks if histogram grouping makes any sense.
@ -6353,7 +6349,7 @@ Bool_t PMsrHandler::CheckHistoGrouping()
} }
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
// CheckAddRunParameters (public) // CheckAddRunParameters (private)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p>In case addrun is present check that if addt0's are given there are as many addt0's than addrun's. * <p>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)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p>If log max likelihood is requested, make sure that all run blocks are of single histogram type. * <p>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)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p>Make sure that if RRF settings are found in the GLOBAL section, the fit types * <p>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; return result;
} }
//--------------------------------------------------------------------------
// CheckRealFFT (private)
//--------------------------------------------------------------------------
/**
* <p>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) // GetGroupingString (public)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------

View File

@ -99,14 +99,6 @@ class PMsrHandler
{ return fFuncHandler->Eval(i, map, param, metaData); } { return fFuncHandler->Eval(i, map, param, metaData); }
virtual UInt_t GetNoOfFitParameters(UInt_t idx); virtual UInt_t GetNoOfFitParameters(UInt_t idx);
virtual Int_t ParameterInUse(UInt_t paramNo); 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 void GetGroupingString(Int_t runNo, TString detector, TString &groupingStr);
virtual Bool_t EstimateN0(); virtual Bool_t EstimateN0();
@ -163,6 +155,15 @@ class PMsrHandler
virtual TString BeautifyFourierPhaseParameterString(); virtual TString BeautifyFourierPhaseParameterString();
virtual void CheckLegacyLifetimecorrection(); 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_ #endif // _PMSRHANDLER_H_