Merged muonspin/musrfit:root6 into master

This commit is contained in:
Zaher Salman 2020-05-25 21:59:55 +02:00
commit 5cc8722a95
25 changed files with 586 additions and 215 deletions

View File

@ -5,7 +5,7 @@ if (CMAKE_VERSION GREATER_EQUAL 3.12)
cmake_policy(SET CMP0075 NEW)
endif (CMAKE_VERSION GREATER_EQUAL 3.12)
project(musrfit VERSION 1.6.0 LANGUAGES C CXX)
project(musrfit VERSION 1.6.1 LANGUAGES C CXX)
#--- musrfit specific options -------------------------------------------------
option(nexus "build optional NeXus support. Needed for ISIS" OFF)

View File

@ -12,6 +12,11 @@ or
https://bitbucket.org/muonspin/musrfit/commits/all
Release of V1.6.1, 2020/05/25
=============================
For asymmetry fits: allow alpha, beta in the RUN block to be functions.
Release of V1.6.0, 2020/05/16
=============================

View File

@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 90c2680fff90669033f1bce5f6912272
config: 2fd2e79340d6214c8fde0515f4f3fbe3
tags: 645f666f9bcd5a90fca523b33c5a78b7

View File

@ -775,7 +775,7 @@ The FUNCTIONS Block
+++++++++++++++++++
Here some auxiliary functions can be defined. These functions can currently *only* operate on the defined parameters. They can be used in the
:ref:`THEORY block <msr-theory-block>` and for one specific case in the :ref:`RUN block <msr-run-block>`. Supported is the use of basic arithmetic:
:ref:`THEORY block <msr-theory-block>` and for three specific cases in the :ref:`RUN block <msr-run-block>` (`norm`, `alpha`, and `beta`). Supported is the use of basic arithmetic:
:math:`+`
Addition
@ -1064,18 +1064,24 @@ In order to describe the operations needed for fitting and plotting, quite some
.. _msr-alpha-beta:
**alpha, beta** (fit type 2, 3, 5)
These parameters are used to correct the asymmetry for different detector efficiencies, solid angles and initial asymmetries. They are defined as :math:`\alpha = N_{0,b}/N_{0,f}` and :math:`\beta = A_{0,b}/A_{0,f}`. If the parameters are not specified in the :ref:`RUN block <msr-run-block>`, for each one the value of 1 is assumed (for fittype 5, alpha is estimated from the ratio of :math:`\sum_i \left( N_{\mathrm{bp}}(i)+N_{\mathrm{bm}}(i) \right)` and :math:`\sum_i \left( N_{\mathrm{fp}}(i)+N_{\mathrm{fm}}(i) \right)`). Example for alpha with fit parameter number 1:
These parameters are used to correct the asymmetry for different detector efficiencies, solid angles and initial asymmetries. They are defined as :math:`\alpha = N_{0,b}/N_{0,f}` and :math:`\beta = A_{0,b}/A_{0,f}`. If the parameters are not specified in the :ref:`RUN block <msr-run-block>`, for each one the value of 1 is assumed (for fittype 5, alpha is estimated from the ratio of :math:`\sum_i \left( N_{\mathrm{bp}}(i)+N_{\mathrm{bm}}(i) \right)` and :math:`\sum_i \left( N_{\mathrm{fp}}(i)+N_{\mathrm{fm}}(i) \right)`). Both, `alpha` as well as `beta` can be expressed through a function. Example for alpha with fit parameter number 1:
::
alpha 1
Example for an ``alpha`` defined via function number 1:
::
alpha fun1
.. index:: norm
.. _msr-norm:
**norm** (fit type 0)
Number of the fit parameter that represents the normalization constant :math:`N_0` of the histogram; the value of this parameter is given either per nanosecond or per bin (see :ref:`below <msr-commands-block>`).
It is possible to substitute the parameter number by a function here (and only here in a RUN block), for instance to relate :math:`N_0`\'s of different histograms through an :math:`\alpha`
It is possible to substitute the parameter number by a function, for instance to relate :math:`N_0`\'s of different histograms through an :math:`\alpha`
parameter. Example for a ``norm`` defined by fit parameter number 12:
::

View File

@ -1,6 +1,6 @@
var DOCUMENTATION_OPTIONS = {
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
VERSION: '1.6.0',
VERSION: '1.6.1',
LANGUAGE: 'None',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',

View File

@ -4,7 +4,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Acknowledgements &#8212; musrfit 1.6.0 documentation</title>
<title>Acknowledgements &#8212; musrfit 1.6.1 documentation</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
@ -30,7 +30,7 @@
<li class="right" >
<a href="musr-root.html" title="MusrRoot - an Extensible Open File Format for μSR"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.0 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.1 documentation</a> &#187;</li>
</ul>
</div>
@ -100,12 +100,12 @@ extremely competent way to deal with his projects as well as to deal with the ch
<li class="right" >
<a href="musr-root.html" title="MusrRoot - an Extensible Open File Format for μSR"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.0 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.1 documentation</a> &#187;</li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2020, Andreas Suter.
Last updated on May 14, 2020.
Last updated on May 25, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.2.2.
</div>
</body>

View File

@ -4,7 +4,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>any2many - a Universal μSR-file-format converter &#8212; musrfit 1.6.0 documentation</title>
<title>any2many - a Universal μSR-file-format converter &#8212; musrfit 1.6.1 documentation</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
@ -30,7 +30,7 @@
<li class="right" >
<a href="msr2data.html" title="msr2data - A Program for Automatically Processing Multiple musrfit msr Files"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.0 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.1 documentation</a> &#187;</li>
</ul>
</div>
@ -90,12 +90,12 @@ For a detailed description see <a class="reference internal" href="user-manual.h
<li class="right" >
<a href="msr2data.html" title="msr2data - A Program for Automatically Processing Multiple musrfit msr Files"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.0 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.1 documentation</a> &#187;</li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2020, Andreas Suter.
Last updated on May 14, 2020.
Last updated on May 25, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.2.2.
</div>
</body>

View File

@ -4,7 +4,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Bugtracking &#8212; musrfit 1.6.0 documentation</title>
<title>Bugtracking &#8212; musrfit 1.6.1 documentation</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
@ -26,7 +26,7 @@
<li class="right" >
<a href="acknowledgement.html" title="Acknowledgements"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.0 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.1 documentation</a> &#187;</li>
</ul>
</div>
@ -81,12 +81,12 @@ or send an e-mail to A. Suter at PSI.</p>
<li class="right" >
<a href="acknowledgement.html" title="Acknowledgements"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.0 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.1 documentation</a> &#187;</li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2020, Andreas Suter.
Last updated on May 14, 2020.
Last updated on May 25, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.2.2.
</div>
</body>

View File

@ -4,7 +4,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>How to Cite musrfit? &#8212; musrfit 1.6.0 documentation</title>
<title>How to Cite musrfit? &#8212; musrfit 1.6.1 documentation</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
@ -30,7 +30,7 @@
<li class="right" >
<a href="index.html" title="Welcome to the musrfit documentation!"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.0 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.1 documentation</a> &#187;</li>
</ul>
</div>
@ -102,12 +102,12 @@
<li class="right" >
<a href="index.html" title="Welcome to the musrfit documentation!"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.0 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.1 documentation</a> &#187;</li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2020, Andreas Suter.
Last updated on May 14, 2020.
Last updated on May 25, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.2.2.
</div>
</body>

View File

@ -5,7 +5,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Index &#8212; musrfit 1.6.0 documentation</title>
<title>Index &#8212; musrfit 1.6.1 documentation</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
@ -23,7 +23,7 @@
<li class="right" style="margin-right: 10px">
<a href="#" title="General Index"
accesskey="I">index</a></li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.0 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.1 documentation</a> &#187;</li>
</ul>
</div>
@ -611,12 +611,12 @@
<li class="right" style="margin-right: 10px">
<a href="#" title="General Index"
>index</a></li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.0 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.1 documentation</a> &#187;</li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2020, Andreas Suter.
Last updated on May 15, 2020.
Last updated on May 25, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.2.2.
</div>
</body>

View File

@ -4,7 +4,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Welcome to the musrfit documentation! &#8212; musrfit 1.6.0 documentation</title>
<title>Welcome to the musrfit documentation! &#8212; musrfit 1.6.1 documentation</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
@ -26,7 +26,7 @@
<li class="right" >
<a href="cite.html" title="How to Cite musrfit?"
accesskey="N">next</a> |</li>
<li class="nav-item nav-item-0"><a href="#">musrfit 1.6.0 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="#">musrfit 1.6.1 documentation</a> &#187;</li>
</ul>
</div>
@ -168,12 +168,12 @@
<li class="right" >
<a href="cite.html" title="How to Cite musrfit?"
>next</a> |</li>
<li class="nav-item nav-item-0"><a href="#">musrfit 1.6.0 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="#">musrfit 1.6.1 documentation</a> &#187;</li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2020, Andreas Suter.
Last updated on May 15, 2020.
Last updated on May 25, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.2.2.
</div>
</body>

View File

@ -4,7 +4,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>msr2data - A Program for Automatically Processing Multiple musrfit msr Files &#8212; musrfit 1.6.0 documentation</title>
<title>msr2data - A Program for Automatically Processing Multiple musrfit msr Files &#8212; musrfit 1.6.1 documentation</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
@ -30,7 +30,7 @@
<li class="right" >
<a href="mupp.html" title="mupp - μSR Parameter Plotter"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.0 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.1 documentation</a> &#187;</li>
</ul>
</div>
@ -418,12 +418,12 @@ fit serves as template for the second and so on. The template field stays empty
<li class="right" >
<a href="mupp.html" title="mupp - μSR Parameter Plotter"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.0 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.1 documentation</a> &#187;</li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2020, Andreas Suter.
Last updated on May 14, 2020.
Last updated on May 25, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.2.2.
</div>
</body>

View File

@ -4,7 +4,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>mupp - μSR Parameter Plotter &#8212; musrfit 1.6.0 documentation</title>
<title>mupp - μSR Parameter Plotter &#8212; musrfit 1.6.1 documentation</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
@ -30,7 +30,7 @@
<li class="right" >
<a href="musredit.html" title="musredit: the GUI Based Interface to musrfit"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.0 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.1 documentation</a> &#187;</li>
</ul>
</div>
@ -298,12 +298,12 @@ SCRIPT COMMANDS:
<li class="right" >
<a href="musredit.html" title="musredit: the GUI Based Interface to musrfit"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.0 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.1 documentation</a> &#187;</li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2020, Andreas Suter.
Last updated on May 15, 2020.
Last updated on May 25, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.2.2.
</div>
</body>

View File

@ -4,7 +4,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>MusrRoot - an Extensible Open File Format for μSR &#8212; musrfit 1.6.0 documentation</title>
<title>MusrRoot - an Extensible Open File Format for μSR &#8212; musrfit 1.6.1 documentation</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
@ -30,7 +30,7 @@
<li class="right" >
<a href="any2many.html" title="any2many - a Universal μSR-file-format converter"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.0 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.1 documentation</a> &#187;</li>
</ul>
</div>
@ -910,12 +910,12 @@ the entry has been added. The last token, <code class="docutils literal notransl
<li class="right" >
<a href="any2many.html" title="any2many - a Universal μSR-file-format converter"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.0 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.1 documentation</a> &#187;</li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2020, Andreas Suter.
Last updated on May 14, 2020.
Last updated on May 25, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.2.2.
</div>
</body>

View File

@ -4,7 +4,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>musredit: the GUI Based Interface to musrfit &#8212; musrfit 1.6.0 documentation</title>
<title>musredit: the GUI Based Interface to musrfit &#8212; musrfit 1.6.1 documentation</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
@ -30,7 +30,7 @@
<li class="right" >
<a href="setup-dks.html" title="Setting up musrfit / DKS: High Speed Fitting with GPUs"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.0 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.1 documentation</a> &#187;</li>
</ul>
</div>
@ -531,12 +531,12 @@ the corresponding fit parameter value, except the phases where the step will be
<li class="right" >
<a href="setup-dks.html" title="Setting up musrfit / DKS: High Speed Fitting with GPUs"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.0 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.1 documentation</a> &#187;</li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2020, Andreas Suter.
Last updated on May 14, 2020.
Last updated on May 25, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.2.2.
</div>
</body>

View File

@ -4,7 +4,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Search &#8212; musrfit 1.6.0 documentation</title>
<title>Search &#8212; musrfit 1.6.1 documentation</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
@ -27,7 +27,7 @@
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.0 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.1 documentation</a> &#187;</li>
</ul>
</div>
@ -75,12 +75,12 @@
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.0 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.1 documentation</a> &#187;</li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2020, Andreas Suter.
Last updated on May 15, 2020.
Last updated on May 25, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.2.2.
</div>
</body>

View File

@ -4,7 +4,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Setting up musrfit / DKS: High Speed Fitting with GPUs &#8212; musrfit 1.6.0 documentation</title>
<title>Setting up musrfit / DKS: High Speed Fitting with GPUs &#8212; musrfit 1.6.1 documentation</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
@ -30,7 +30,7 @@
<li class="right" >
<a href="setup-standard.html" title="Setting up musrfit on Different Platforms"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.0 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.1 documentation</a> &#187;</li>
</ul>
</div>
@ -309,12 +309,12 @@ The only thing you need <code class="docutils literal notranslate"><span class="
<li class="right" >
<a href="setup-standard.html" title="Setting up musrfit on Different Platforms"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.0 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.1 documentation</a> &#187;</li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2020, Andreas Suter.
Last updated on May 14, 2020.
Last updated on May 25, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.2.2.
</div>
</body>

View File

@ -4,7 +4,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Setting up musrfit on Different Platforms &#8212; musrfit 1.6.0 documentation</title>
<title>Setting up musrfit on Different Platforms &#8212; musrfit 1.6.1 documentation</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
@ -30,7 +30,7 @@
<li class="right" >
<a href="user-libs.html" title="Documentation of user libs (user functions)"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.0 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.1 documentation</a> &#187;</li>
</ul>
</div>
@ -1293,12 +1293,12 @@ $ musrview test-histo-ROOT-NPP.msr
<li class="right" >
<a href="user-libs.html" title="Documentation of user libs (user functions)"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.0 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.1 documentation</a> &#187;</li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2020, Andreas Suter.
Last updated on May 14, 2020.
Last updated on May 25, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.2.2.
</div>
</body>

View File

@ -4,7 +4,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Tutorial for musrfit &#8212; musrfit 1.6.0 documentation</title>
<title>Tutorial for musrfit &#8212; musrfit 1.6.1 documentation</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
@ -30,7 +30,7 @@
<li class="right" >
<a href="cite.html" title="How to Cite musrfit?"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.0 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.1 documentation</a> &#187;</li>
</ul>
</div>
@ -431,12 +431,12 @@ For a complete description please refer to the manuals of <a class="reference in
<li class="right" >
<a href="cite.html" title="How to Cite musrfit?"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.0 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.1 documentation</a> &#187;</li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2020, Andreas Suter.
Last updated on May 14, 2020.
Last updated on May 25, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.2.2.
</div>
</body>

View File

@ -4,7 +4,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Documentation of user libs (user functions) &#8212; musrfit 1.6.0 documentation</title>
<title>Documentation of user libs (user functions) &#8212; musrfit 1.6.1 documentation</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
@ -30,7 +30,7 @@
<li class="right" >
<a href="user-manual.html" title="User manual"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.0 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.1 documentation</a> &#187;</li>
</ul>
</div>
@ -647,12 +647,12 @@ K(m)&amp;=\int_0^{\pi/2}\frac{\mathrm d\varphi}{\sqrt{1-m^2\sin^2{\varphi}}},\en
<li class="right" >
<a href="user-manual.html" title="User manual"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.0 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.1 documentation</a> &#187;</li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2020, Andreas Suter.
Last updated on May 14, 2020.
Last updated on May 25, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.2.2.
</div>
</body>

View File

@ -4,7 +4,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>User manual &#8212; musrfit 1.6.0 documentation</title>
<title>User manual &#8212; musrfit 1.6.1 documentation</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
@ -30,7 +30,7 @@
<li class="right" >
<a href="tutorial.html" title="Tutorial for musrfit"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.0 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.1 documentation</a> &#187;</li>
</ul>
</div>
@ -897,7 +897,7 @@ instead of specifying the parameters directly.</p>
<div class="section" id="the-functions-block">
<span id="msr-functions-block"></span><span id="index-15"></span><h3>The FUNCTIONS Block<a class="headerlink" href="#the-functions-block" title="Permalink to this headline"></a></h3>
<p>Here some auxiliary functions can be defined. These functions can currently <em>only</em> operate on the defined parameters. They can be used in the
<a class="reference internal" href="#msr-theory-block"><span class="std std-ref">THEORY block</span></a> and for one specific case in the <a class="reference internal" href="#msr-run-block"><span class="std std-ref">RUN block</span></a>. Supported is the use of basic arithmetic:</p>
<a class="reference internal" href="#msr-theory-block"><span class="std std-ref">THEORY block</span></a> and for three specific cases in the <a class="reference internal" href="#msr-run-block"><span class="std std-ref">RUN block</span></a> (<cite>norm</cite>, <cite>alpha</cite>, and <cite>beta</cite>). Supported is the use of basic arithmetic:</p>
<dl class="simple">
<dt><span class="math notranslate nohighlight">\(+\)</span></dt><dd><p>Addition</p>
</dd>
@ -1169,15 +1169,19 @@ a short digression is needed.</p>
</dd>
</dl>
<span id="index-20"></span><dl id="msr-alpha-beta">
<dt><strong>alpha, beta</strong> (fit type 2, 3, 5)</dt><dd><p>These parameters are used to correct the asymmetry for different detector efficiencies, solid angles and initial asymmetries. They are defined as <span class="math notranslate nohighlight">\(\alpha = N_{0,b}/N_{0,f}\)</span> and <span class="math notranslate nohighlight">\(\beta = A_{0,b}/A_{0,f}\)</span>. If the parameters are not specified in the <a class="reference internal" href="#msr-run-block"><span class="std std-ref">RUN block</span></a>, for each one the value of 1 is assumed (for fittype 5, alpha is estimated from the ratio of <span class="math notranslate nohighlight">\(\sum_i \left( N_{\mathrm{bp}}(i)+N_{\mathrm{bm}}(i) \right)\)</span> and <span class="math notranslate nohighlight">\(\sum_i \left( N_{\mathrm{fp}}(i)+N_{\mathrm{fm}}(i) \right)\)</span>). Example for alpha with fit parameter number 1:</p>
<dt><strong>alpha, beta</strong> (fit type 2, 3, 5)</dt><dd><p>These parameters are used to correct the asymmetry for different detector efficiencies, solid angles and initial asymmetries. They are defined as <span class="math notranslate nohighlight">\(\alpha = N_{0,b}/N_{0,f}\)</span> and <span class="math notranslate nohighlight">\(\beta = A_{0,b}/A_{0,f}\)</span>. If the parameters are not specified in the <a class="reference internal" href="#msr-run-block"><span class="std std-ref">RUN block</span></a>, for each one the value of 1 is assumed (for fittype 5, alpha is estimated from the ratio of <span class="math notranslate nohighlight">\(\sum_i \left( N_{\mathrm{bp}}(i)+N_{\mathrm{bm}}(i) \right)\)</span> and <span class="math notranslate nohighlight">\(\sum_i \left( N_{\mathrm{fp}}(i)+N_{\mathrm{fm}}(i) \right)\)</span>). Both, <cite>alpha</cite> as well as <cite>beta</cite> can be expressed through a function. Example for alpha with fit parameter number 1:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">alpha</span> <span class="mi">1</span>
</pre></div>
</div>
<p>Example for an <code class="docutils literal notranslate"><span class="pre">alpha</span></code> defined via function number 1:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">alpha</span> <span class="n">fun1</span>
</pre></div>
</div>
</dd>
</dl>
<span id="index-21"></span><dl id="msr-norm">
<dt><strong>norm</strong> (fit type 0)</dt><dd><p>Number of the fit parameter that represents the normalization constant <span class="math notranslate nohighlight">\(N_0\)</span> of the histogram; the value of this parameter is given either per nanosecond or per bin (see <a class="reference internal" href="#msr-commands-block"><span class="std std-ref">below</span></a>).
It is possible to substitute the parameter number by a function here (and only here in a RUN block), for instance to relate <span class="math notranslate nohighlight">\(N_0\)</span>s of different histograms through an <span class="math notranslate nohighlight">\(\alpha\)</span>
It is possible to substitute the parameter number by a function, for instance to relate <span class="math notranslate nohighlight">\(N_0\)</span>s of different histograms through an <span class="math notranslate nohighlight">\(\alpha\)</span>
parameter. Example for a <code class="docutils literal notranslate"><span class="pre">norm</span></code> defined by fit parameter number 12:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">norm</span> <span class="mi">12</span>
</pre></div>
@ -2429,12 +2433,12 @@ In case this cannot be ensured, the parallelization can be disabled by <em>di
<li class="right" >
<a href="tutorial.html" title="Tutorial for musrfit"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.0 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="index.html">musrfit 1.6.1 documentation</a> &#187;</li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2020, Andreas Suter.
Last updated on May 14, 2020.
Last updated on May 25, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.2.2.
</div>
</body>

View File

@ -819,15 +819,24 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages)
} else if (sstr.BeginsWith("alpha ")) {
fout.width(16);
fout << std::left << "alpha";
// check of alpha is given as a function
if (fRuns[runNo].GetAlphaParamNo() >= MSR_PARAM_FUN_OFFSET)
fout << "fun" << fRuns[runNo].GetAlphaParamNo()-MSR_PARAM_FUN_OFFSET;
else
fout << fRuns[runNo].GetAlphaParamNo() << std::endl;
fout << std::endl;
} else if (sstr.BeginsWith("beta ")) {
fout.width(16);
fout << std::left << "beta";
if (fRuns[runNo].GetBetaParamNo() >= MSR_PARAM_FUN_OFFSET)
fout << "fun" << fRuns[runNo].GetBetaParamNo()-MSR_PARAM_FUN_OFFSET;
else
fout << fRuns[runNo].GetBetaParamNo() << std::endl;
fout << std::endl;
} else if (sstr.BeginsWith("norm")) {
fout.width(16);
fout << std::left << "norm";
// check if norm is give as a function
// check if norm is given as a function
if (fRuns[runNo].GetNormParamNo() >= MSR_PARAM_FUN_OFFSET)
fout << "fun" << fRuns[runNo].GetNormParamNo()-MSR_PARAM_FUN_OFFSET;
else
@ -1939,14 +1948,24 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, std::map<UInt_t, TString
if (fRuns[i].GetAlphaParamNo() != -1) {
fout.width(16);
fout << std::left << "alpha";
fout << fRuns[i].GetAlphaParamNo() << std::endl;
// check if alpha is give as a function
if (fRuns[i].GetAlphaParamNo() >= MSR_PARAM_FUN_OFFSET)
fout << "fun" << fRuns[i].GetAlphaParamNo()-MSR_PARAM_FUN_OFFSET;
else
fout << fRuns[i].GetAlphaParamNo();
fout << std::endl;
}
// beta
if (fRuns[i].GetBetaParamNo() != -1) {
fout.width(16);
fout << std::left << "beta";
fout << fRuns[i].GetBetaParamNo() << std::endl;
// check if beta is give as a function
if (fRuns[i].GetBetaParamNo() >= MSR_PARAM_FUN_OFFSET)
fout << "fun" << fRuns[i].GetBetaParamNo()-MSR_PARAM_FUN_OFFSET;
else
fout << fRuns[i].GetBetaParamNo();
fout << std::endl;
}
// norm
@ -3379,6 +3398,12 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines)
param.SetAlphaParamNo(ival);
else
error = true;
} else if (str.Contains("fun")) {
Int_t no;
if (FilterNumber(str, "fun", MSR_PARAM_FUN_OFFSET, no))
param.SetAlphaParamNo(no);
else
error = true;
} else {
error = true;
}
@ -3401,6 +3426,12 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines)
param.SetBetaParamNo(ival);
else
error = true;
} else if (str.Contains("fun")) {
Int_t no;
if (FilterNumber(str, "fun", MSR_PARAM_FUN_OFFSET, no))
param.SetBetaParamNo(no);
else
error = true;
} else {
error = true;
}
@ -4582,9 +4613,12 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines)
// handle a single PLOT block
while ((iter1 != iter2) && !error) {
TString line = iter1->fLine;
if (line.First('#') != -1) // remove trailing comment before proceed
line.Resize(line.First('#'));
if (iter1->fLine.Contains("PLOT")) { // handle plot header
tokens = iter1->fLine.Tokenize(" \t");
if (line.Contains("PLOT")) { // handle plot header
tokens = line.Tokenize(" \t");
if (!tokens) {
std::cerr << std::endl << ">> PMsrHandler::HandlePlotEntry: **SEVERE ERROR** Couldn't tokenize PLOT in line " << iter1->fLineNo;
std::cerr << std::endl << std::endl;
@ -4605,9 +4639,9 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines)
delete tokens;
tokens = nullptr;
}
} else if (iter1->fLine.Contains("lifetimecorrection", TString::kIgnoreCase)) {
} else if (line.Contains("lifetimecorrection", TString::kIgnoreCase)) {
param.fLifeTimeCorrection = true;
} else if (iter1->fLine.Contains("runs", TString::kIgnoreCase)) { // handle plot runs
} else if (line.Contains("runs", TString::kIgnoreCase)) { // handle plot runs
TComplex run;
PStringNumberList *rl;
std::string errorMsg;
@ -4623,7 +4657,7 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines)
case MSR_PLOT_ASYM_RRF:
case MSR_PLOT_NON_MUSR:
case MSR_PLOT_MU_MINUS:
rl = new PStringNumberList(iter1->fLine.Data());
rl = new PStringNumberList(line.Data());
if (!rl->Parse(errorMsg, true)) {
std::cerr << std::endl << ">> PMsrHandler::HandlePlotEntry: **SEVERE ERROR** Couldn't tokenize PLOT in line " << iter1->fLineNo;
std::cerr << std::endl << ">> Error Message: " << errorMsg;
@ -4643,14 +4677,14 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines)
error = true;
break;
}
} else if (iter1->fLine.Contains("range ", TString::kIgnoreCase)) { // handle plot range
} else if (line.Contains("range ", TString::kIgnoreCase)) { // handle plot range
// remove previous entries
param.fTmin.clear();
param.fTmax.clear();
param.fYmin.clear();
param.fYmax.clear();
tokens = iter1->fLine.Tokenize(" \t");
tokens = line.Tokenize(" \t");
if (!tokens) {
std::cerr << std::endl << ">> PMsrHandler::HandlePlotEntry: **SEVERE ERROR** Couldn't tokenize PLOT in line " << iter1->fLineNo;
std::cerr << std::endl << std::endl;
@ -4700,14 +4734,14 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines)
delete tokens;
tokens = nullptr;
}
} else if (iter1->fLine.Contains("sub_ranges", TString::kIgnoreCase)) {
} else if (line.Contains("sub_ranges", TString::kIgnoreCase)) {
// remove previous entries
param.fTmin.clear();
param.fTmax.clear();
param.fYmin.clear();
param.fYmax.clear();
tokens = iter1->fLine.Tokenize(" \t");
tokens = line.Tokenize(" \t");
if (!tokens) {
std::cerr << std::endl << ">> PMsrHandler::HandlePlotEntry: **SEVERE ERROR** Couldn't tokenize PLOT in line " << iter1->fLineNo;
std::cerr << std::endl << std::endl;
@ -4762,11 +4796,11 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines)
delete tokens;
tokens = nullptr;
}
} else if (iter1->fLine.Contains("use_fit_ranges", TString::kIgnoreCase)) {
} else if (line.Contains("use_fit_ranges", TString::kIgnoreCase)) {
param.fUseFitRanges = true;
// check if y-ranges are given
tokens = iter1->fLine.Tokenize(" \t");
tokens = line.Tokenize(" \t");
if (!tokens) {
std::cerr << std::endl << ">> PMsrHandler::HandlePlotEntry: **SEVERE ERROR** Couldn't tokenize PLOT in line " << iter1->fLineNo;
std::cerr << std::endl << std::endl;
@ -5207,12 +5241,20 @@ UInt_t PMsrHandler::GetNoOfFitParameters(UInt_t idx)
paramVector.push_back(fRuns[idx].GetBkgFitParamNo());
// get alpha parameter if present (asymmetry fit)
if (fRuns[idx].GetAlphaParamNo() != -1)
if (fRuns[idx].GetAlphaParamNo() != -1) {
if (fRuns[idx].GetAlphaParamNo() < MSR_PARAM_FUN_OFFSET) // parameter
paramVector.push_back(fRuns[idx].GetAlphaParamNo());
else // function
funVector.push_back(fRuns[idx].GetAlphaParamNo() - MSR_PARAM_FUN_OFFSET);
}
// get beta parameter if present (asymmetry fit)
if (fRuns[idx].GetBetaParamNo() != -1)
if (fRuns[idx].GetBetaParamNo() != -1) {
if (fRuns[idx].GetBetaParamNo() < MSR_PARAM_FUN_OFFSET) // parameter
paramVector.push_back(fRuns[idx].GetBetaParamNo());
else // function
funVector.push_back(fRuns[idx].GetBetaParamNo() - MSR_PARAM_FUN_OFFSET);
}
// go through the theory block and collect parameters
// possible entries: number -> parameter, fun<number> -> function, map<number> -> maps

View File

@ -111,7 +111,16 @@ PRunAsymmetry::PRunAsymmetry(PMsrHandler *msrInfo, PRunDataHandler *rawData, UIn
return;
}
// check if alpha parameter is within proper bounds
if ((fRunInfo->GetAlphaParamNo() < 0) || (fRunInfo->GetAlphaParamNo() > static_cast<Int_t>(param->size()))) {
if (fRunInfo->GetAlphaParamNo() >= MSR_PARAM_FUN_OFFSET) { // alpha seems to be a function
if ((fRunInfo->GetAlphaParamNo()-MSR_PARAM_FUN_OFFSET < 0) ||
(fRunInfo->GetAlphaParamNo()-MSR_PARAM_FUN_OFFSET > msrInfo->GetNoOfFuncs())) {
std::cerr << std::endl << ">> PRunAsymmetry::PRunAsymmetry(): **ERROR** alpha parameter is a function with no = " << fRunInfo->GetAlphaParamNo();
std::cerr << std::endl << ">> This is out of bound, since there are only " << msrInfo->GetNoOfFuncs() << " functions.";
std::cerr << std::endl;
fValid = false;
return;
}
} else if ((fRunInfo->GetAlphaParamNo() < 0) || (fRunInfo->GetAlphaParamNo() > static_cast<Int_t>(param->size()))) {
std::cerr << std::endl << ">> PRunAsymmetry::PRunAsymmetry(): **ERROR** alpha parameter no = " << fRunInfo->GetAlphaParamNo();
std::cerr << std::endl << ">> This is out of bound, since there are only " << param->size() << " parameters.";
std::cerr << std::endl;
@ -120,10 +129,11 @@ PRunAsymmetry::PRunAsymmetry(PMsrHandler *msrInfo, PRunDataHandler *rawData, UIn
}
// check if alpha is fixed
Bool_t alphaFixedToOne = false;
if (fRunInfo->GetAlphaParamNo() < MSR_PARAM_FUN_OFFSET) { // alpha is parameter
if (((*param)[fRunInfo->GetAlphaParamNo()-1].fStep == 0.0) &&
((*param)[fRunInfo->GetAlphaParamNo()-1].fValue == 1.0))
alphaFixedToOne = true;
}
// check if beta is given
Bool_t betaFixedToOne = false;
if (fRunInfo->GetBetaParamNo() == -1) { // no beta given hence assuming beta == 1
@ -196,6 +206,58 @@ Double_t PRunAsymmetry::CalcChiSquare(const std::vector<Double_t>& par)
Double_t time(1.0);
Int_t i;
// determine alpha/beta
switch (fAlphaBetaTag) {
case 1: // alpha == 1, beta == 1
a = 1.0;
b = 1.0;
break;
case 2: // alpha != 1, beta == 1
if (fRunInfo->GetAlphaParamNo() < MSR_PARAM_FUN_OFFSET) { // alpha is a parameter
a = par[fRunInfo->GetAlphaParamNo()-1];
} else { // alpha is function
// get function number
UInt_t funNo = fRunInfo->GetAlphaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
a = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
b = 1.0;
break;
case 3: // alpha == 1, beta != 1
a = 1.0;
if (fRunInfo->GetBetaParamNo() < MSR_PARAM_FUN_OFFSET) { // beta is a parameter
b = par[fRunInfo->GetBetaParamNo()-1];
} else { // beta is a function
// get function number
UInt_t funNo = fRunInfo->GetBetaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
b = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
break;
case 4: // alpha != 1, beta != 1
if (fRunInfo->GetAlphaParamNo() < MSR_PARAM_FUN_OFFSET) { // alpha is a parameter
a = par[fRunInfo->GetAlphaParamNo()-1];
} else { // alpha is function
// get function number
UInt_t funNo = fRunInfo->GetAlphaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
a = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
if (fRunInfo->GetBetaParamNo() < MSR_PARAM_FUN_OFFSET) { // beta is a parameter
b = par[fRunInfo->GetBetaParamNo()-1];
} else { // beta is a function
// get function number
UInt_t funNo = fRunInfo->GetBetaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
b = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
break;
default:
a = 1.0;
b = 1.0;
break;
}
// Calculate the theory function once to ensure one function evaluation for the current set of parameters.
// This is needed for the LF and user functions where some non-thread-save calculations only need to be calculated once
// for a given set of parameters---which should be done outside of the parallelized loop.
@ -206,34 +268,12 @@ Double_t PRunAsymmetry::CalcChiSquare(const std::vector<Double_t>& par)
Int_t chunk = (fEndTimeBin - fStartTimeBin)/omp_get_num_procs();
if (chunk < 10)
chunk = 10;
#pragma omp parallel for default(shared) private(i,time,diff,asymFcnValue,a,b,f) schedule(dynamic,chunk) reduction(+:chisq)
#pragma omp parallel for default(shared) private(i,time,diff,asymFcnValue,f) schedule(dynamic,chunk) reduction(+:chisq)
#endif
for (i=fStartTimeBin; i<fEndTimeBin; ++i) {
time = fData.GetDataTimeStart() + static_cast<Double_t>(i)*fData.GetDataTimeStep();
switch (fAlphaBetaTag) {
case 1: // alpha == 1, beta == 1
asymFcnValue = fTheory->Func(time, par, fFuncValues);
break;
case 2: // alpha != 1, beta == 1
a = par[fRunInfo->GetAlphaParamNo()-1];
f = fTheory->Func(time, par, fFuncValues);
asymFcnValue = (f*(a+1.0)-(a-1.0))/((a+1.0)-f*(a-1.0));
break;
case 3: // alpha == 1, beta != 1
b = par[fRunInfo->GetBetaParamNo()-1];
f = fTheory->Func(time, par, fFuncValues);
asymFcnValue = f*(b+1.0)/(2.0-f*(b-1.0));
break;
case 4: // alpha != 1, beta != 1
a = par[fRunInfo->GetAlphaParamNo()-1];
b = par[fRunInfo->GetBetaParamNo()-1];
f = fTheory->Func(time, par, fFuncValues);
asymFcnValue = (f*(a*b+1.0)-(a-1.0))/((a+1.0)-f*(a*b-1.0));
break;
default:
asymFcnValue = 0.0;
break;
}
diff = fData.GetValue()->at(i) - asymFcnValue;
chisq += diff*diff / (fData.GetError()->at(i)*fData.GetError()->at(i));
}
@ -429,18 +469,46 @@ void PRunAsymmetry::CalcTheory()
asymFcnValue = fTheory->Func(time, par, fFuncValues);
break;
case 2: // alpha != 1, beta == 1
if (fRunInfo->GetAlphaParamNo() < MSR_PARAM_FUN_OFFSET) { // alpha is a parameter
a = par[fRunInfo->GetAlphaParamNo()-1];
} else { // alpha is function
// get function number
UInt_t funNo = fRunInfo->GetAlphaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
a = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
f = fTheory->Func(time, par, fFuncValues);
asymFcnValue = (f*(a+1.0)-(a-1.0))/((a+1.0)-f*(a-1.0));
break;
case 3: // alpha == 1, beta != 1
if (fRunInfo->GetBetaParamNo() < MSR_PARAM_FUN_OFFSET) { // beta is a parameter
b = par[fRunInfo->GetBetaParamNo()-1];
} else { // beta is a function
// get function number
UInt_t funNo = fRunInfo->GetBetaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
b = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
f = fTheory->Func(time, par, fFuncValues);
asymFcnValue = f*(b+1.0)/(2.0-f*(b-1.0));
break;
case 4: // alpha != 1, beta != 1
if (fRunInfo->GetAlphaParamNo() < MSR_PARAM_FUN_OFFSET) { // alpha is a parameter
a = par[fRunInfo->GetAlphaParamNo()-1];
} else { // alpha is function
// get function number
UInt_t funNo = fRunInfo->GetAlphaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
a = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
if (fRunInfo->GetBetaParamNo() < MSR_PARAM_FUN_OFFSET) { // beta is a parameter
b = par[fRunInfo->GetBetaParamNo()-1];
} else { // beta is a function
// get function number
UInt_t funNo = fRunInfo->GetBetaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
b = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
f = fTheory->Func(time, par, fFuncValues);
asymFcnValue = (f*(a*b+1.0)-(a-1.0))/((a+1.0)-f*(a*b-1.0));
break;
@ -1138,16 +1206,44 @@ Bool_t PRunAsymmetry::PrepareViewData(PRawRunData* runData, UInt_t histoNo[2])
beta = 1.0;
break;
case 2: // alpha != 1, beta == 1
if (fRunInfo->GetAlphaParamNo() < MSR_PARAM_FUN_OFFSET) { // alpha is a parameter
alpha = par[fRunInfo->GetAlphaParamNo()-1];
} else { // alpha is function
// get function number
UInt_t funNo = fRunInfo->GetAlphaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
alpha = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
beta = 1.0;
break;
case 3: // alpha == 1, beta != 1
alpha = 1.0;
if (fRunInfo->GetBetaParamNo() < MSR_PARAM_FUN_OFFSET) { // beta is a parameter
beta = par[fRunInfo->GetBetaParamNo()-1];
} else { // beta is a function
// get function number
UInt_t funNo = fRunInfo->GetBetaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
beta = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
break;
case 4: // alpha != 1, beta != 1
if (fRunInfo->GetAlphaParamNo() < MSR_PARAM_FUN_OFFSET) { // alpha is a parameter
alpha = par[fRunInfo->GetAlphaParamNo()-1];
} else { // alpha is function
// get function number
UInt_t funNo = fRunInfo->GetAlphaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
alpha = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
if (fRunInfo->GetBetaParamNo() < MSR_PARAM_FUN_OFFSET) { // beta is a parameter
beta = par[fRunInfo->GetBetaParamNo()-1];
} else { // beta is a function
// get function number
UInt_t funNo = fRunInfo->GetBetaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
beta = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
break;
default:
break;
@ -1349,16 +1445,44 @@ Bool_t PRunAsymmetry::PrepareRRFViewData(PRawRunData* runData, UInt_t histoNo[2]
beta = 1.0;
break;
case 2: // alpha != 1, beta == 1
if (fRunInfo->GetAlphaParamNo() < MSR_PARAM_FUN_OFFSET) { // alpha is a parameter
alpha = par[fRunInfo->GetAlphaParamNo()-1];
} else { // alpha is function
// get function number
UInt_t funNo = fRunInfo->GetAlphaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
alpha = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
beta = 1.0;
break;
case 3: // alpha == 1, beta != 1
alpha = 1.0;
if (fRunInfo->GetBetaParamNo() < MSR_PARAM_FUN_OFFSET) { // beta is a parameter
beta = par[fRunInfo->GetBetaParamNo()-1];
} else { // beta is a function
// get function number
UInt_t funNo = fRunInfo->GetBetaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
beta = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
break;
case 4: // alpha != 1, beta != 1
if (fRunInfo->GetAlphaParamNo() < MSR_PARAM_FUN_OFFSET) { // alpha is a parameter
alpha = par[fRunInfo->GetAlphaParamNo()-1];
} else { // alpha is function
// get function number
UInt_t funNo = fRunInfo->GetAlphaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
alpha = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
if (fRunInfo->GetBetaParamNo() < MSR_PARAM_FUN_OFFSET) { // beta is a parameter
beta = par[fRunInfo->GetBetaParamNo()-1];
} else { // beta is a function
// get function number
UInt_t funNo = fRunInfo->GetBetaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
beta = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
break;
default:
break;

View File

@ -206,56 +206,90 @@ Double_t PRunAsymmetryBNMR::CalcChiSquare(const std::vector<Double_t>& par)
Double_t time(1.0),alphaest;
Int_t i;
// determine alpha/beta
alphaest = fRunInfo->GetEstimatedAlpha();
switch (fAlphaBetaTag) {
case 1: // alpha == 1, beta == 1
a = 1.0;
b = 1.0;
break;
case 2: // alpha != 1, beta == 1
if (fRunInfo->GetAlphaParamNo() < MSR_PARAM_FUN_OFFSET) { // alpha is a parameter
a = par[fRunInfo->GetAlphaParamNo()-1];
} else { // alpha is function
// get function number
UInt_t funNo = fRunInfo->GetAlphaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
a = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
b = 1.0;
break;
case 3: // alpha == 1, beta != 1
a = 1.0;
if (fRunInfo->GetBetaParamNo() < MSR_PARAM_FUN_OFFSET) { // beta is a parameter
b = par[fRunInfo->GetBetaParamNo()-1];
} else { // beta is a function
// get function number
UInt_t funNo = fRunInfo->GetBetaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
b = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
break;
case 4: // alpha != 1, beta != 1
if (fRunInfo->GetAlphaParamNo() < MSR_PARAM_FUN_OFFSET) { // alpha is a parameter
a = par[fRunInfo->GetAlphaParamNo()-1];
} else { // alpha is function
// get function number
UInt_t funNo = fRunInfo->GetAlphaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
a = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
if (fRunInfo->GetBetaParamNo() < MSR_PARAM_FUN_OFFSET) { // beta is a parameter
b = par[fRunInfo->GetBetaParamNo()-1];
} else { // beta is a function
// get function number
UInt_t funNo = fRunInfo->GetBetaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
b = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
break;
case 5: // alpha ?? , beta == 1
a = alphaest;
b = 1.0;
break;
case 6: // alpha ??, beta != 1
a = alphaest;
if (fRunInfo->GetBetaParamNo() < MSR_PARAM_FUN_OFFSET) { // beta is a parameter
b = par[fRunInfo->GetBetaParamNo()-1];
} else { // beta is a function
// get function number
UInt_t funNo = fRunInfo->GetBetaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
b = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
break;
default:
a = 1.0;
b = 1.0;
break;
}
// Calculate the theory function once to ensure one function evaluation for the current set of parameters.
// This is needed for the LF and user functions where some non-thread-save calculations only need to be calculated once
// for a given set of parameters---which should be done outside of the parallelized loop.
// For all other functions it means a tiny and acceptable overhead.
asymFcnValue = fTheory->Func(time, par, fFuncValues);
alphaest = fRunInfo->GetEstimatedAlpha();
#ifdef HAVE_GOMP
Int_t chunk = (fEndTimeBin - fStartTimeBin)/omp_get_num_procs();
if (chunk < 10)
chunk = 10;
#pragma omp parallel for default(shared) private(i,time,diff,asymFcnValue,a,b,f) schedule(dynamic,chunk) reduction(+:chisq)
#pragma omp parallel for default(shared) private(i,time,diff,asymFcnValue,f) schedule(dynamic,chunk) reduction(+:chisq)
#endif
for (i=fStartTimeBin; i<fEndTimeBin; ++i) {
time = fData.GetDataTimeStart() + static_cast<Double_t>(i)*fData.GetDataTimeStep();
switch (fAlphaBetaTag) {
case 1: // alpha == 1, beta == 1
asymFcnValue = fTheory->Func(time, par, fFuncValues);
break;
case 2: // alpha != 1, beta == 1
a = par[fRunInfo->GetAlphaParamNo()-1];
f = fTheory->Func(time, par, fFuncValues)/2.0;
asymFcnValue = (f*(a+1.0)-(a-1.0))/((a+1.0)-f*(a-1.0)) - (-f*(a+1.0)-(a-1.0))/((a+1.0)+f*(a-1.0));
break;
case 3: // alpha == 1, beta != 1
b = par[fRunInfo->GetBetaParamNo()-1];
f = fTheory->Func(time, par, fFuncValues)/2.0;
asymFcnValue = f*(b+1.0)/(2.0-f*(b-1.0))-f*(b+1.0)/(2.0+f*(b-1.0));
break;
case 4: // alpha != 1, beta != 1
a = par[fRunInfo->GetAlphaParamNo()-1];
b = par[fRunInfo->GetBetaParamNo()-1];
f = fTheory->Func(time, par, fFuncValues)/2.0;
asymFcnValue = (f*(a*b+1.0)-(a-1.0))/((a+1.0)-f*(a*b-1.0))-(-f*(a*b+1.0)-(a-1.0))/((a+1.0)+f*(a*b-1.0));
break;
case 5: // alpha ?? , beta == 1
a = alphaest;
f = fTheory->Func(time, par, fFuncValues)/2.0;
asymFcnValue = (f*(a+1.0)-(a-1.0))/((a+1.0)-f*(a-1.0)) - (-f*(a+1.0)-(a-1.0))/((a+1.0)+f*(a-1.0));
break;
case 6: // alpha ??, beta != 1
a = alphaest;
b = par[fRunInfo->GetBetaParamNo()-1];
f = fTheory->Func(time, par, fFuncValues)/2.0;
asymFcnValue = (f*(a*b+1.0)-(a-1.0))/((a+1.0)-f*(a*b-1.0))-(-f*(a*b+1.0)-(a-1.0))/((a+1.0)+f*(a*b-1.0));
break;
default:
asymFcnValue = 0.0;
break;
}
diff = fData.GetValue()->at(i) - asymFcnValue;
chisq += diff*diff / (fData.GetError()->at(i)*fData.GetError()->at(i));
}
@ -455,18 +489,46 @@ void PRunAsymmetryBNMR::CalcTheory()
asymFcnValue = fTheory->Func(time, par, fFuncValues);
break;
case 2: // alpha != 1, beta == 1
if (fRunInfo->GetAlphaParamNo() < MSR_PARAM_FUN_OFFSET) { // alpha is a parameter
a = par[fRunInfo->GetAlphaParamNo()-1];
} else { // alpha is function
// get function number
UInt_t funNo = fRunInfo->GetAlphaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
a = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
f = fTheory->Func(time, par, fFuncValues);
asymFcnValue = (f*(a+1.0)-(a-1.0))/((a+1.0)-f*(a-1.0)) - (-f*(a+1.0)-(a-1.0))/((a+1.0)+f*(a-1.0));
break;
case 3: // alpha == 1, beta != 1
if (fRunInfo->GetBetaParamNo() < MSR_PARAM_FUN_OFFSET) { // beta is a parameter
b = par[fRunInfo->GetBetaParamNo()-1];
} else { // beta is a function
// get function number
UInt_t funNo = fRunInfo->GetBetaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
b = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
f = fTheory->Func(time, par, fFuncValues);
asymFcnValue = f*(b+1.0)/(2.0-f*(b-1.0))-f*(b+1.0)/(2.0+f*(b-1.0));
break;
case 4: // alpha != 1, beta != 1
if (fRunInfo->GetAlphaParamNo() < MSR_PARAM_FUN_OFFSET) { // alpha is a parameter
a = par[fRunInfo->GetAlphaParamNo()-1];
} else { // alpha is function
// get function number
UInt_t funNo = fRunInfo->GetAlphaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
a = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
if (fRunInfo->GetBetaParamNo() < MSR_PARAM_FUN_OFFSET) { // beta is a parameter
b = par[fRunInfo->GetBetaParamNo()-1];
} else { // beta is a function
// get function number
UInt_t funNo = fRunInfo->GetBetaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
b = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
f = fTheory->Func(time, par, fFuncValues);
asymFcnValue = (f*(a*b+1.0)-(a-1.0))/((a+1.0)-f*(a*b-1.0))-(-f*(a*b+1.0)-(a-1.0))/((a+1.0)+f*(a*b-1.0));
break;
@ -477,7 +539,14 @@ void PRunAsymmetryBNMR::CalcTheory()
break;
case 6: // alpha ??, beta != 1
a = alphaest;
if (fRunInfo->GetBetaParamNo() < MSR_PARAM_FUN_OFFSET) { // beta is a parameter
b = par[fRunInfo->GetBetaParamNo()-1];
} else { // beta is a function
// get function number
UInt_t funNo = fRunInfo->GetBetaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
b = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
f = fTheory->Func(time, par, fFuncValues);
asymFcnValue = (f*(a*b+1.0)-(a-1.0))/((a+1.0)-f*(a*b-1.0))-(-f*(a*b+1.0)-(a-1.0))/((a+1.0)+f*(a*b-1.0));
break;
@ -1287,16 +1356,44 @@ Bool_t PRunAsymmetryBNMR::PrepareViewData(PRawRunData* runData, UInt_t histoNo[2
beta = 1.0;
break;
case 2: // alpha != 1, beta == 1
if (fRunInfo->GetAlphaParamNo() < MSR_PARAM_FUN_OFFSET) { // alpha is a parameter
alpha = par[fRunInfo->GetAlphaParamNo()-1];
} else { // alpha is function
// get function number
UInt_t funNo = fRunInfo->GetAlphaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
alpha = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
beta = 1.0;
break;
case 3: // alpha == 1, beta != 1
alpha = 1.0;
if (fRunInfo->GetBetaParamNo() < MSR_PARAM_FUN_OFFSET) { // beta is a parameter
beta = par[fRunInfo->GetBetaParamNo()-1];
} else { // beta is a function
// get function number
UInt_t funNo = fRunInfo->GetBetaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
beta = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
break;
case 4: // alpha != 1, beta != 1
if (fRunInfo->GetAlphaParamNo() < MSR_PARAM_FUN_OFFSET) { // alpha is a parameter
alpha = par[fRunInfo->GetAlphaParamNo()-1];
} else { // alpha is function
// get function number
UInt_t funNo = fRunInfo->GetAlphaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
alpha = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
if (fRunInfo->GetBetaParamNo() < MSR_PARAM_FUN_OFFSET) { // beta is a parameter
beta = par[fRunInfo->GetBetaParamNo()-1];
} else { // beta is a function
// get function number
UInt_t funNo = fRunInfo->GetBetaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
beta = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
break;
case 5: // alpha ?? , beta == 1
// use estimated value
@ -1304,7 +1401,14 @@ Bool_t PRunAsymmetryBNMR::PrepareViewData(PRawRunData* runData, UInt_t histoNo[2
break;
case 6: // alpha ??, beta != 1
// use estimated value
if (fRunInfo->GetBetaParamNo() < MSR_PARAM_FUN_OFFSET) { // beta is a parameter
beta = par[fRunInfo->GetBetaParamNo()-1];
} else { // beta is a function
// get function number
UInt_t funNo = fRunInfo->GetBetaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
beta = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
break;
default:
break;

View File

@ -188,6 +188,58 @@ Double_t PRunAsymmetryRRF::CalcChiSquare(const std::vector<Double_t>& par)
Double_t time(1.0);
Int_t i;
// determine alpha/beta
switch (fAlphaBetaTag) {
case 1: // alpha == 1, beta == 1
a = 1.0;
b = 1.0;
break;
case 2: // alpha != 1, beta == 1
if (fRunInfo->GetAlphaParamNo() < MSR_PARAM_FUN_OFFSET) { // alpha is a parameter
a = par[fRunInfo->GetAlphaParamNo()-1];
} else { // alpha is function
// get function number
UInt_t funNo = fRunInfo->GetAlphaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
a = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
b = 1.0;
break;
case 3: // alpha == 1, beta != 1
a = 1.0;
if (fRunInfo->GetBetaParamNo() < MSR_PARAM_FUN_OFFSET) { // beta is a parameter
b = par[fRunInfo->GetBetaParamNo()-1];
} else { // beta is a function
// get function number
UInt_t funNo = fRunInfo->GetBetaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
b = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
break;
case 4: // alpha != 1, beta != 1
if (fRunInfo->GetAlphaParamNo() < MSR_PARAM_FUN_OFFSET) { // alpha is a parameter
a = par[fRunInfo->GetAlphaParamNo()-1];
} else { // alpha is function
// get function number
UInt_t funNo = fRunInfo->GetAlphaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
a = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
if (fRunInfo->GetBetaParamNo() < MSR_PARAM_FUN_OFFSET) { // beta is a parameter
b = par[fRunInfo->GetBetaParamNo()-1];
} else { // beta is a function
// get function number
UInt_t funNo = fRunInfo->GetBetaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
b = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
break;
default:
a = 1.0;
b = 1.0;
break;
}
// Calculate the theory function once to ensure one function evaluation for the current set of parameters.
// This is needed for the LF and user functions where some non-thread-save calculations only need to be calculated once
// for a given set of parameters---which should be done outside of the parallelized loop.
@ -198,34 +250,12 @@ Double_t PRunAsymmetryRRF::CalcChiSquare(const std::vector<Double_t>& par)
Int_t chunk = (fEndTimeBin - fStartTimeBin)/omp_get_num_procs();
if (chunk < 10)
chunk = 10;
#pragma omp parallel for default(shared) private(i,time,diff,asymFcnValue,a,b,f) schedule(dynamic,chunk) reduction(+:chisq)
#pragma omp parallel for default(shared) private(i,time,diff,asymFcnValue,f) schedule(dynamic,chunk) reduction(+:chisq)
#endif
for (i=fStartTimeBin; i<fEndTimeBin; ++i) {
time = fData.GetDataTimeStart() + static_cast<Double_t>(i)*fData.GetDataTimeStep();
switch (fAlphaBetaTag) {
case 1: // alpha == 1, beta == 1
asymFcnValue = fTheory->Func(time, par, fFuncValues);
break;
case 2: // alpha != 1, beta == 1
a = par[fRunInfo->GetAlphaParamNo()-1];
f = fTheory->Func(time, par, fFuncValues);
asymFcnValue = (f*(a+1.0)-(a-1.0))/((a+1.0)-f*(a-1.0));
break;
case 3: // alpha == 1, beta != 1
b = par[fRunInfo->GetBetaParamNo()-1];
f = fTheory->Func(time, par, fFuncValues);
asymFcnValue = f*(b+1.0)/(2.0-f*(b-1.0));
break;
case 4: // alpha != 1, beta != 1
a = par[fRunInfo->GetAlphaParamNo()-1];
b = par[fRunInfo->GetBetaParamNo()-1];
f = fTheory->Func(time, par, fFuncValues);
asymFcnValue = (f*(a*b+1.0)-(a-1.0))/((a+1.0)-f*(a*b-1.0));
break;
default:
asymFcnValue = 0.0;
break;
}
diff = fData.GetValue()->at(i) - asymFcnValue;
chisq += diff*diff / (fData.GetError()->at(i)*fData.GetError()->at(i));
}
@ -421,18 +451,46 @@ void PRunAsymmetryRRF::CalcTheory()
asymFcnValue = fTheory->Func(time, par, fFuncValues);
break;
case 2: // alpha != 1, beta == 1
if (fRunInfo->GetAlphaParamNo() < MSR_PARAM_FUN_OFFSET) { // alpha is a parameter
a = par[fRunInfo->GetAlphaParamNo()-1];
} else { // alpha is function
// get function number
UInt_t funNo = fRunInfo->GetAlphaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
a = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
f = fTheory->Func(time, par, fFuncValues);
asymFcnValue = (f*(a+1.0)-(a-1.0))/((a+1.0)-f*(a-1.0));
break;
case 3: // alpha == 1, beta != 1
if (fRunInfo->GetBetaParamNo() < MSR_PARAM_FUN_OFFSET) { // beta is a parameter
b = par[fRunInfo->GetBetaParamNo()-1];
} else { // beta is a function
// get function number
UInt_t funNo = fRunInfo->GetBetaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
b = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
f = fTheory->Func(time, par, fFuncValues);
asymFcnValue = f*(b+1.0)/(2.0-f*(b-1.0));
break;
case 4: // alpha != 1, beta != 1
if (fRunInfo->GetAlphaParamNo() < MSR_PARAM_FUN_OFFSET) { // alpha is a parameter
a = par[fRunInfo->GetAlphaParamNo()-1];
} else { // alpha is function
// get function number
UInt_t funNo = fRunInfo->GetAlphaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
a = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
if (fRunInfo->GetBetaParamNo() < MSR_PARAM_FUN_OFFSET) { // beta is a parameter
b = par[fRunInfo->GetBetaParamNo()-1];
} else { // beta is a function
// get function number
UInt_t funNo = fRunInfo->GetBetaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
b = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
f = fTheory->Func(time, par, fFuncValues);
asymFcnValue = (f*(a*b+1.0)-(a-1.0))/((a+1.0)-f*(a*b-1.0));
break;
@ -1034,16 +1092,44 @@ Bool_t PRunAsymmetryRRF::PrepareViewData(PRawRunData* runData, UInt_t histoNo[2]
beta = 1.0;
break;
case 2: // alpha != 1, beta == 1
if (fRunInfo->GetAlphaParamNo() < MSR_PARAM_FUN_OFFSET) { // alpha is a parameter
alpha = par[fRunInfo->GetAlphaParamNo()-1];
} else { // alpha is function
// get function number
UInt_t funNo = fRunInfo->GetAlphaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
alpha = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
beta = 1.0;
break;
case 3: // alpha == 1, beta != 1
alpha = 1.0;
if (fRunInfo->GetBetaParamNo() < MSR_PARAM_FUN_OFFSET) { // beta is a parameter
beta = par[fRunInfo->GetBetaParamNo()-1];
} else { // beta is a function
// get function number
UInt_t funNo = fRunInfo->GetBetaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
beta = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
break;
case 4: // alpha != 1, beta != 1
if (fRunInfo->GetAlphaParamNo() < MSR_PARAM_FUN_OFFSET) { // alpha is a parameter
alpha = par[fRunInfo->GetAlphaParamNo()-1];
} else { // alpha is function
// get function number
UInt_t funNo = fRunInfo->GetAlphaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
alpha = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
if (fRunInfo->GetBetaParamNo() < MSR_PARAM_FUN_OFFSET) { // beta is a parameter
beta = par[fRunInfo->GetBetaParamNo()-1];
} else { // beta is a function
// get function number
UInt_t funNo = fRunInfo->GetBetaParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
beta = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par);
}
break;
default:
break;