improved handling of RRF freq in the msr-file

This commit is contained in:
2016-01-18 16:25:34 +01:00
parent c50a33243d
commit eb482b9671
3 changed files with 11 additions and 11 deletions

View File

@ -2942,7 +2942,7 @@ Bool_t PMsrHandler::HandleGlobalEntry(PMsrLines &lines)
ostr = dynamic_cast<TObjString*>(tokens->At(2)); ostr = dynamic_cast<TObjString*>(tokens->At(2));
str = ostr->GetString(); str = ostr->GetString();
global.SetRRFFreq(dval, str.Data()); global.SetRRFFreq(dval, str.Data());
if (global.GetRRFFreq(str.Data()) == 0.0) if (global.GetRRFFreq(str.Data()) == RRF_FREQ_UNDEF)
error = true; error = true;
} }
} }
@ -5890,7 +5890,7 @@ Bool_t PMsrHandler::CheckRRFSettings()
Int_t fittype = fGlobal.GetFitType(); Int_t fittype = fGlobal.GetFitType();
// first set of tests: if RRF parameters are set, check if RRF fit is chosen. // 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 != -1) { // check if GLOBAL fittype is set
if ((fittype != MSR_FITTYPE_SINGLE_HISTO_RRF) && if ((fittype != MSR_FITTYPE_SINGLE_HISTO_RRF) &&
(fittype != MSR_FITTYPE_ASYM_RRF)) { (fittype != MSR_FITTYPE_ASYM_RRF)) {
@ -5935,7 +5935,7 @@ Bool_t PMsrHandler::CheckRRFSettings()
fittype = fGlobal.GetFitType(); fittype = fGlobal.GetFitType();
if ((fittype == MSR_FITTYPE_SINGLE_HISTO_RRF) || if ((fittype == MSR_FITTYPE_SINGLE_HISTO_RRF) ||
(fittype == MSR_FITTYPE_ASYM_RRF)) { // make sure RRF freq and RRF packing are set (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 << ">> PMsrHandler::CheckRRFSettings: **ERROR** RRF fit chosen, but";
cerr << endl << ">> no RRF frequency found in the GLOBAL section! Fix it."; cerr << endl << ">> no RRF frequency found in the GLOBAL section! Fix it.";
return false; return false;
@ -5959,7 +5959,7 @@ Bool_t PMsrHandler::CheckRRFSettings()
cerr << endl << ">> This is currently not supported."; cerr << endl << ">> This is currently not supported.";
return false; 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 << ">> PMsrHandler::CheckRRFSettings: **ERROR** RRF fit chosen, but";
cerr << endl << ">> no RRF frequency found in the GLOBAL section! Fix it."; cerr << endl << ">> no RRF frequency found in the GLOBAL section! Fix it.";
return false; return false;

View File

@ -710,7 +710,7 @@ void PRawRunData::SetTempError(const UInt_t idx, const Double_t errTemp)
PMsrGlobalBlock::PMsrGlobalBlock() PMsrGlobalBlock::PMsrGlobalBlock()
{ {
fGlobalPresent = false; 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 fRRFUnitTag = RRF_UNIT_UNDEF; // RRF unit tag. Default: undefined
fRRFPhase = 0.0; fRRFPhase = 0.0;
fRRFPacking = -1; // undefined RRF packing/rebinning fRRFPacking = -1; // undefined RRF packing/rebinning
@ -730,7 +730,7 @@ PMsrGlobalBlock::PMsrGlobalBlock()
// GetRRFFreq (public) // GetRRFFreq (public)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> get RRF frequency value in specific units. If units is unknown, 0.0 will be returned. * <p> 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 * \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; unitTag = RRF_UNIT_Mcs;
else if (!unitStr.CompareTo("T", TString::kIgnoreCase)) else if (!unitStr.CompareTo("T", TString::kIgnoreCase))
unitTag = RRF_UNIT_T; unitTag = RRF_UNIT_T;
else { else
cerr << endl << ">> PMsrGlobalBlock::GetRRFFreq: **ERROR** found undefined RRF unit '" << unit << "'!" << endl; return RRF_FREQ_UNDEF;
return freq;
}
// calc the conversion factor // calc the conversion factor
if (unitTag == fRRFUnitTag) if (unitTag == fRRFUnitTag)

View File

@ -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_G 3
#define RRF_UNIT_T 4 #define RRF_UNIT_T 4
#define RRF_FREQ_UNDEF 1.0e10
//------------------------------------------------------------- //-------------------------------------------------------------
/** /**
* <p>typedef to make to code more readable. Definition of a bool vector. * <p>typedef to make to code more readable. Definition of a bool vector.