diff --git a/src/classes/PMsrHandler.cpp b/src/classes/PMsrHandler.cpp index 793a84be..2ac77c76 100644 --- a/src/classes/PMsrHandler.cpp +++ b/src/classes/PMsrHandler.cpp @@ -8,7 +8,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2007-2016 by Andreas Suter * + * Copyright (C) 2007-2018 by Andreas Suter * * andreas.suter@psi.ch * * * * This program is free software; you can redistribute it and/or modify * @@ -3876,6 +3876,7 @@ void PMsrHandler::InitFourierParameterStructure(PMsrFourierStructure &fourier) fourier.fDCCorrected = false; // dc-corrected FFT, default: false fourier.fApodization = FOURIER_APOD_NOT_GIVEN; // apodization, default: NOT GIVEN fourier.fPlotTag = FOURIER_PLOT_NOT_GIVEN; // initial plot tag, default: NOT GIVEN + fourier.fPhaseRef = -1; // initial phase reference -1 means: use absolute phases fourier.fPhaseParamNo.clear(); // initial phase parameter no vector is empty fourier.fPhase.clear(); // initial phase vector is empty for (UInt_t i=0; i<2; i++) { @@ -3967,8 +3968,10 @@ Bool_t PMsrHandler::ParseFourierPhaseValueVector(PMsrFourierStructure &fourier, //-------------------------------------------------------------------------- /** *
examines if str has the form 'phase parX0 [sep parX1 ... sep parXN]'.
- * If this form is found, fill in parX0 ... parXN to fFourier.fPhaseParamNo
- * and furthermore fill fFourier.fPhase accordingly.
+ * Also allowed is that instead of parXn only one of the parameters could have the
+ * form parRn which markes a reference phase for relative phase fittings.
+ * If this form is found, fill in parX0 ... parXN to fourier.fPhaseParamNo, and
+ * in case a parR is present, set the fourier.fPhaseRef accordingly.
*
* @param fourier msr-file Fourier structure
* @param str string to be analyzed
@@ -3979,6 +3982,7 @@ Bool_t PMsrHandler::ParseFourierPhaseValueVector(PMsrFourierStructure &fourier,
Bool_t PMsrHandler::ParseFourierPhaseParVector(PMsrFourierStructure &fourier, const TString &str, Bool_t &error)
{
Bool_t result = true;
+ Int_t refCount = 0;
TObjArray *tok = str.Tokenize(" ,;\t");
if (tok == 0) {
@@ -4004,6 +4008,10 @@ Bool_t PMsrHandler::ParseFourierPhaseParVector(PMsrFourierStructure &fourier, co
break;
}
+ if (sstr.BeginsWith("parR")) {
+ refCount++;
+ }
+
// rule out par(X, offset, #Param) syntax
if (sstr.BeginsWith("par(")) {
result = false;
@@ -4011,12 +4019,22 @@ Bool_t PMsrHandler::ParseFourierPhaseParVector(PMsrFourierStructure &fourier, co
}
}
+ if (refCount > 1) {
+ cerr << ">> PMsrHandler::ParseFourierPhaseParVector: **ERROR** found multiple parR's! Only one reference phase is accepted." << endl;
+ result = false;
+ }
+
// check that token has the form parX, where X is an int
+ Int_t rmNoOf = 3;
if (result != false) {
for (Int_t i=1; i examines if str has the form 'phase par(X0, offset, #params)'.
- * If this form is found, fill in parX0 ... parXN to fFourier.fPhaseParamNo
- * and furthermore fill fFourier.fPhase accordingly.
+ * examines if str has the form 'phase par(X0, offset, #params)' or 'phase parR(X0, offset, #params)'.
+ * If this form is found, fill in parX0 ... parXN to fourier.fPhaseParamNo, and
+ * in case of 'parR' also set the fourier.fPhaseRef accordingly.
*
* @param fourier msr-file Fourier structure
* @param str string to be analyzed
@@ -4065,12 +4083,18 @@ Bool_t PMsrHandler::ParseFourierPhaseParIterVector(PMsrFourierStructure &fourier
wstr = wstr.Strip(TString::kLeading, ' ');
// remove 'par(' from string if present, otherwise and error is issued
- if (!wstr.BeginsWith("par(")) {
- cout << ">> PMsrHandler::ParseFourierPhaseParIterVector: **ERROR** token should start with 'par(', found: '" << wstr << "' -> ERROR" << endl;
+ if (!wstr.BeginsWith("par(") && !wstr.BeginsWith("parR(")) {
+ cout << ">> PMsrHandler::ParseFourierPhaseParIterVector: **ERROR** token should start with 'par(' or 'parR(', found: '" << wstr << "' -> ERROR" << endl;
error = true;
return false;
}
- wstr.Remove(0, 4);
+ Int_t noOf = 4; // number of characters to be removed
+ Bool_t relativePhase = false; // relative phase handling wished
+ if (wstr.BeginsWith("parR(")) {
+ noOf += 1;
+ relativePhase = true;
+ }
+ wstr.Remove(0, noOf);
// remove trailing white spaces
wstr = wstr.Strip(TString::kTrailing, ' ');
@@ -4133,6 +4157,12 @@ Bool_t PMsrHandler::ParseFourierPhaseParIterVector(PMsrFourierStructure &fourier
return false;
}
+ // set the reference phase parameter number for 'parR'
+ if (relativePhase)
+ fourier.fPhaseRef = x0;
+ else
+ fourier.fPhaseRef = -1;
+
for (Int_t i=0; i