Merged muonspin/musrfit:root6 into master

This commit is contained in:
Zaher Salman 2018-11-15 10:08:36 +01:00
commit 42bb8a49b7
9 changed files with 121 additions and 31 deletions

View File

@ -2,7 +2,7 @@ LSCO x=0.02 (224-227), T=12.00 (K), E=5.57 keV, WEW B=~49(G)/8.62(A), Tr=15.02 (
###############################################################
FITPARAMETER
# No Name Value Step Pos_Error Boundaries
1 AsymT 0.05052 -0.00071 0.00072 0 0.33
1 AsymT 0.05053 -0.00071 0.00072 0 0.33
2 Field 48.298 -0.094 0.095
3 RateT 0.129 -0.010 0.010 0 none
4 AsymL 0 0 none 0 0.33
@ -10,15 +10,15 @@ FITPARAMETER
6 AlphaLR 0.9784 -0.0013 0.0013
7 PhaseL 6.6 -1.6 1.6 -40 40
8 BkgL 6.920 -0.048 0.048
9 RelPhaseR 178.7 -1.9 1.9 150 210
10 NormR 419.47 -0.40 0.40
9 RelPhaseR 178.8 -1.9 1.9 150 210
10 NormR 419.46 -0.40 0.40
11 BkgR 8.393 -0.050 0.050
12 AlphaTB 1.1025 -0.0015 0.0015
13 RelPhaseT 269.0 -1.9 1.9 240 300
13 RelPhaseT 269.1 -1.9 1.9 240 300
14 BkgT 7.466 -0.049 0.049
15 NormB 393.08 -0.39 0.38
15 NormB 393.08 -0.39 0.39
16 RelPhaseB 90.7 -2.0 2.0 60 120
17 BkgB 7.091 -0.047 0.048
17 BkgB 7.092 -0.048 0.048
18 One 1 0 none
19 Zero 0 0 none
@ -84,17 +84,17 @@ FOURIER
units Gauss # units either 'Gauss', 'Tesla', 'MHz', or 'Mc/s'
fourier_power 10
apodization STRONG # NONE, WEAK, MEDIUM, STRONG
plot REAL # REAL, IMAG, REAL_AND_IMAG, POWER, PHASE
plot REAL # REAL, IMAG, REAL_AND_IMAG, POWER, PHASE, PHASE_OPT_REAL
dc-corrected true
phase par7
phase parR7, par9, par13, par16
###############################################################
PLOT 0 (single histo plot)
lifetimecorrection
runs 1 3
runs 1 2 3 4
range 0 9 -0.15 0.15
view_packing 500
###############################################################
STATISTIC --- 2015-01-05 13:58:40
STATISTIC --- 2018-11-13 07:58:56
maxLH = 3971.7, NDF = 4001, maxLH/NDF = 0.992668

View File

@ -1516,6 +1516,18 @@ The block starts with the *FOURIER* keyword and may contain the following entrie
.. code-block:: bash
phase par7, par12, par17, par22, par27, par32, par37, par42, par47, par52, par57, par62, par67, par72, par77, par82
One might prefer to express the phases in respect to a reference counter, *e.g.* the forward counter is the reference counter phase (fcp) whereas
the backward counter phase (bcp) is expressed as bcp = fcp + relative_bcp. If the fitting is done along these lines, the phases in the Fourier
block can be expressed the following way
.. code-block:: bash
phase parRX0 sep parX1 sep ... sep parXN
which means that ``X0`` is the reference phase, and all the other phases are relative phases in respect to ``X0``, *i.e.* the absolut phase of
``Xj`` would be the summ of the values of ``parX0`` and ``parXj`` etc. The reference phase in the list is marked by ``parR`` rather than ``par``.
Obviously only *one* reference phase can be defined!
#. Often the phases in the parameter block follow a clear list structure. This allows to write the Fourier phase parameters in a more compact form
@ -1529,6 +1541,13 @@ The block starts with the *FOURIER* keyword and may contain the following entrie
.. code-block:: none
phase par(7, 5, 16)
As in the phase parameter list examples before, also here a reference phase with relative phases might be wished. Differently to the phase parameter
list example, the first parameter number will be the reference phase. The compact notation here is
.. code-block:: none
phase parR(X0, offest, #param)
.. index:: fourier-block-range_for_phase_correction
.. _msr-fourier-block-range_for_phase_correction:

View File

@ -987,7 +987,7 @@
</div>
<div class="footer">
&copy; Copyright 2018, Andreas Suter.
Last updated on Oct 15, 2018.
Last updated on Nov 13, 2018.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
</div>
</body>

View File

@ -185,7 +185,7 @@
</div>
<div class="footer">
&copy; Copyright 2018, Andreas Suter.
Last updated on Oct 15, 2018.
Last updated on Nov 13, 2018.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
</div>
</body>

View File

@ -94,7 +94,7 @@
</div>
<div class="footer">
&copy; Copyright 2018, Andreas Suter.
Last updated on Oct 15, 2018.
Last updated on Nov 13, 2018.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
</div>
</body>

File diff suppressed because one or more lines are too long

View File

@ -1575,6 +1575,15 @@ take the value of parameter number 3. More explicitly</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>phase par7, par12, par17, par22, par27, par32, par37, par42, par47, par52, par57, par62, par67, par72, par77, par82
</pre></div>
</div>
<p>One might prefer to express the phases in respect to a reference counter, <em>e.g.</em> the forward counter is the reference counter phase (fcp) whereas
the backward counter phase (bcp) is expressed as bcp = fcp + relative_bcp. If the fitting is done along these lines, the phases in the Fourier
block can be expressed the following way</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>phase parRX0 sep parX1 sep ... sep parXN
</pre></div>
</div>
<p>which means that <tt class="docutils literal"><span class="pre">X0</span></tt> is the reference phase, and all the other phases are relative phases in respect to <tt class="docutils literal"><span class="pre">X0</span></tt>, <em>i.e.</em> the absolut phase of
<tt class="docutils literal"><span class="pre">Xj</span></tt> would be the summ of the values of <tt class="docutils literal"><span class="pre">parX0</span></tt> and <tt class="docutils literal"><span class="pre">parXj</span></tt> etc. The reference phase in the list is marked by <tt class="docutils literal"><span class="pre">parR</span></tt> rather than <tt class="docutils literal"><span class="pre">par</span></tt>.
Obviously only <em>one</em> reference phase can be defined!</p>
</li>
<li><p class="first">Often the phases in the parameter block follow a clear list structure. This allows to write the Fourier phase parameters in a more compact form</p>
<div class="highlight-none"><div class="highlight"><pre><span></span>phase par(X0, offset, #param)
@ -1585,6 +1594,11 @@ This means that the previous example can be compacted to</p>
<div class="highlight-none"><div class="highlight"><pre><span></span>phase par(7, 5, 16)
</pre></div>
</div>
<p>As in the phase parameter list examples before, also here a reference phase with relative phases might be wished. Differently to the phase parameter
list example, the first parameter number will be the reference phase. The compact notation here is</p>
<div class="highlight-none"><div class="highlight"><pre><span></span>phase parR(X0, offest, #param)
</pre></div>
</div>
</li>
</ol>
</dd>
@ -2195,7 +2209,7 @@ In case this cannot be ensured, the parallelization can be disabled by <em>&#821
</div>
<div class="footer">
&copy; Copyright 2018, Andreas Suter.
Last updated on Oct 15, 2018.
Last updated on Nov 13, 2018.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
</div>
</body>

View File

@ -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,
//--------------------------------------------------------------------------
/**
* <p> 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,13 +4019,25 @@ 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<tok->GetEntries(); i++) {
TObjString *ostr = dynamic_cast<TObjString*>(tok->At(i));
sstr = ostr->GetString();
sstr.Remove(0, 3); // remove 'par' part. Rest should be an integer
rmNoOf = 3;
if (sstr.BeginsWith("parR")) {
rmNoOf++;
}
sstr.Remove(0, rmNoOf); // remove 'par' of 'parR' part. Rest should be an integer
if (sstr.IsDigit()) {
if (rmNoOf == 4) // parR
fourier.fPhaseRef = sstr.Atoi();
fourier.fPhaseParamNo.push_back(sstr.Atoi());
} else {
cerr << ">> PMsrHandler::ParseFourierPhaseParVector: **ERROR** found token '" << ostr->GetString() << "' which is not parX with X an integer." << endl;
@ -4046,9 +4066,9 @@ Bool_t PMsrHandler::ParseFourierPhaseParVector(PMsrFourierStructure &fourier, co
// ParseFourierPhaseParIterVector (private)
//--------------------------------------------------------------------------
/**
* <p> 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.
* <p> 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 +4085,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 +4159,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<noParam; i++)
fourier.fPhaseParamNo.push_back(x0 + i*offset);
@ -4335,11 +4367,16 @@ Bool_t PMsrHandler::HandleFourierEntry(PMsrLines &lines)
}
// if parameter vector is given -> fill corresponding phase values
Double_t phaseRef = 0.0;
if (fourier.fPhaseParamNo.size() > 0) {
// check if a relative parameter phase number is set
if (fourier.fPhaseRef != -1) {
phaseRef = fParam[fourier.fPhaseRef-1].fValue;
}
fourier.fPhase.clear();
UInt_t idx;
for (UInt_t i=0; i<fourier.fPhaseParamNo.size(); i++) {
fourier.fPhase.push_back(fParam[fourier.fPhaseParamNo[i]-1].fValue);
fourier.fPhase.push_back(fParam[fourier.fPhaseParamNo[i]-1].fValue+phaseRef);
}
}
}
@ -6534,14 +6571,21 @@ void PMsrHandler::MakeDetectorGroupingString(TString str, PIntVector &group, TSt
TString PMsrHandler::BeautifyFourierPhaseParameterString()
{
TString str("??");
TString formatStr("par%d, par%d");
if (fFourier.fPhaseParamNo.size() == 0)
return str;
Int_t phaseRef = fFourier.fPhaseRef;
if (fFourier.fPhaseParamNo.size() == 1) {
str = TString::Format("par%d", fFourier.fPhaseParamNo[0]);
} else if (fFourier.fPhaseParamNo.size() == 2) {
str = TString::Format("par%d, par%d", fFourier.fPhaseParamNo[0], fFourier.fPhaseParamNo[1]);
if (phaseRef == fFourier.fPhaseParamNo[0])
formatStr = "parR%d, par%d";
if (phaseRef == fFourier.fPhaseParamNo[1])
formatStr = "par%d, parR%d";
str = TString::Format(formatStr, fFourier.fPhaseParamNo[0], fFourier.fPhaseParamNo[1]);
} else {
Bool_t phaseIter = true;
@ -6555,15 +6599,27 @@ TString PMsrHandler::BeautifyFourierPhaseParameterString()
}
if (phaseIter) {
str = TString::Format("par(%d, %d, %d)", fFourier.fPhaseParamNo[0], offset, fFourier.fPhaseParamNo.size());
if (phaseRef != -1) {
str = TString::Format("parR(%d, %d, %d)", fFourier.fPhaseParamNo[0], offset, fFourier.fPhaseParamNo.size());
} else {
str = TString::Format("par(%d, %d, %d)", fFourier.fPhaseParamNo[0], offset, fFourier.fPhaseParamNo.size());
}
} else {
str = TString("");
for (Int_t i=0; i<fFourier.fPhaseParamNo.size()-1; i++) {
str += "par";
if (phaseRef == fFourier.fPhaseParamNo[i]) {
str += "parR";
} else {
str += "par";
}
str += fFourier.fPhaseParamNo[i];
str += ", ";
}
str += "par";
if (phaseRef == fFourier.fPhaseParamNo[fFourier.fPhaseParamNo.size()-1]) {
str += "parR";
} else {
str += "par";
}
str += fFourier.fPhaseParamNo[fFourier.fPhaseParamNo.size()-1];
}
}

View File

@ -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 *
@ -737,6 +737,7 @@ typedef struct {
Int_t fFourierPower; ///< i.e. zero padding up to 2^fFourierPower, default = 0 which means NO zero padding
Int_t fApodization; ///< tag indicating the kind of apodization wished, 0=no appodization (default), 1=weak, 2=medium, 3=strong (for details see the docu)
Int_t fPlotTag; ///< tag used for initial plot. 0=real, 1=imaginary, 2=real & imaginary (default), 3=power, 4=phase
Int_t fPhaseRef; ///< phase reference for relative phase(s)
PIntVector fPhaseParamNo; ///< parameter number(s) if used instead of a phase value
PDoubleVector fPhase; ///< phase(s)
Double_t fRangeForPhaseCorrection[2]; ///< field/frequency range for automatic phase correction