From eb482b9671c9ecf1adce368280210791adc89978 Mon Sep 17 00:00:00 2001 From: Suter Andreas Date: Mon, 18 Jan 2016 16:25:34 +0100 Subject: [PATCH] improved handling of RRF freq in the msr-file --- src/classes/PMsrHandler.cpp | 10 +++++----- src/classes/PMusr.cpp | 10 ++++------ src/include/PMusr.h | 2 ++ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/classes/PMsrHandler.cpp b/src/classes/PMsrHandler.cpp index 81b8095b..d6d4e049 100644 --- a/src/classes/PMsrHandler.cpp +++ b/src/classes/PMsrHandler.cpp @@ -353,7 +353,7 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) { const UInt_t prec = 6; // default output precision for float/doubles UInt_t neededPrec = 0; - UInt_t neededWidth = 9; + UInt_t neededWidth = 9; Int_t tag, lineNo = 0, number; Int_t runNo = -1, addRunNo = 0; @@ -2942,7 +2942,7 @@ Bool_t PMsrHandler::HandleGlobalEntry(PMsrLines &lines) ostr = dynamic_cast(tokens->At(2)); str = ostr->GetString(); global.SetRRFFreq(dval, str.Data()); - if (global.GetRRFFreq(str.Data()) == 0.0) + if (global.GetRRFFreq(str.Data()) == RRF_FREQ_UNDEF) error = true; } } @@ -5890,7 +5890,7 @@ Bool_t PMsrHandler::CheckRRFSettings() Int_t fittype = fGlobal.GetFitType(); // first set of tests: if RRF parameters are set, check if RRF fit is chosen. - if (fGlobal.GetRRFFreq(fGlobal.GetRRFUnit().Data()) != 0.0) { + if (fGlobal.GetRRFFreq(fGlobal.GetRRFUnit().Data()) != RRF_FREQ_UNDEF) { if (fittype != -1) { // check if GLOBAL fittype is set if ((fittype != MSR_FITTYPE_SINGLE_HISTO_RRF) && (fittype != MSR_FITTYPE_ASYM_RRF)) { @@ -5935,7 +5935,7 @@ Bool_t PMsrHandler::CheckRRFSettings() fittype = fGlobal.GetFitType(); if ((fittype == MSR_FITTYPE_SINGLE_HISTO_RRF) || (fittype == MSR_FITTYPE_ASYM_RRF)) { // make sure RRF freq and RRF packing are set - if (fGlobal.GetRRFFreq(fGlobal.GetRRFUnit().Data()) == 0.0) { + if (fGlobal.GetRRFFreq(fGlobal.GetRRFUnit().Data()) == RRF_FREQ_UNDEF) { cerr << endl << ">> PMsrHandler::CheckRRFSettings: **ERROR** RRF fit chosen, but"; cerr << endl << ">> no RRF frequency found in the GLOBAL section! Fix it."; return false; @@ -5959,7 +5959,7 @@ Bool_t PMsrHandler::CheckRRFSettings() cerr << endl << ">> This is currently not supported."; return false; } - if (fGlobal.GetRRFFreq(fGlobal.GetRRFUnit().Data()) == 0.0) { + if (fGlobal.GetRRFFreq(fGlobal.GetRRFUnit().Data()) == RRF_FREQ_UNDEF) { cerr << endl << ">> PMsrHandler::CheckRRFSettings: **ERROR** RRF fit chosen, but"; cerr << endl << ">> no RRF frequency found in the GLOBAL section! Fix it."; return false; diff --git a/src/classes/PMusr.cpp b/src/classes/PMusr.cpp index 8cde496b..a84f4765 100644 --- a/src/classes/PMusr.cpp +++ b/src/classes/PMusr.cpp @@ -710,7 +710,7 @@ void PRawRunData::SetTempError(const UInt_t idx, const Double_t errTemp) PMsrGlobalBlock::PMsrGlobalBlock() { fGlobalPresent = false; - fRRFFreq = 0.0; // rotating reference frequency in units given by fRRFUnitTag. Only needed for fittype 1 + fRRFFreq = RRF_FREQ_UNDEF; // rotating reference frequency in units given by fRRFUnitTag. Only needed for fittype 1 fRRFUnitTag = RRF_UNIT_UNDEF; // RRF unit tag. Default: undefined fRRFPhase = 0.0; fRRFPacking = -1; // undefined RRF packing/rebinning @@ -730,7 +730,7 @@ PMsrGlobalBlock::PMsrGlobalBlock() // GetRRFFreq (public) //-------------------------------------------------------------------------- /** - *

get RRF frequency value in specific units. If units is unknown, 0.0 will be returned. + *

get RRF frequency value in specific units. If units is unknown, RRF_UNDEF_FREQ will be returned. * * \param unit unit string in which the units shall be given */ @@ -747,10 +747,8 @@ Double_t PMsrGlobalBlock::GetRRFFreq(const char *unit) unitTag = RRF_UNIT_Mcs; else if (!unitStr.CompareTo("T", TString::kIgnoreCase)) unitTag = RRF_UNIT_T; - else { - cerr << endl << ">> PMsrGlobalBlock::GetRRFFreq: **ERROR** found undefined RRF unit '" << unit << "'!" << endl; - return freq; - } + else + return RRF_FREQ_UNDEF; // calc the conversion factor if (unitTag == fRRFUnitTag) diff --git a/src/include/PMusr.h b/src/include/PMusr.h index 46078aa6..96df487f 100644 --- a/src/include/PMusr.h +++ b/src/include/PMusr.h @@ -146,6 +146,8 @@ typedef struct { char a[7]; } __float128; // needed since cint doesn't know it #define RRF_UNIT_G 3 #define RRF_UNIT_T 4 +#define RRF_FREQ_UNDEF 1.0e10 + //------------------------------------------------------------- /** *

typedef to make to code more readable. Definition of a bool vector.