27 Commits

Author SHA1 Message Date
76f4e6846a increase version number from 1.7.4 -> 1.7.5 2021-09-22 08:09:46 +02:00
00398c7fa9 fix phases to +-360 degree. 2021-09-22 08:09:18 +02:00
d357b9ad2f add missing include directory path in cmake. Thank's to Akihiro Koda for reporting the bug and proposing the fix. 2021-09-21 07:52:58 +02:00
4cc1dbecd1 increased the PippardFitter version number. 2021-08-19 07:53:11 +02:00
5f4125bca9 added some necessary include paths. 2021-08-19 07:52:22 +02:00
ef4fae3ef7 adopt for proper git-info handling. 2021-08-18 19:17:57 +02:00
d332bffd29 added some docu. 2021-08-18 19:17:18 +02:00
4a2d865282 add the option to dump the nonlocal field values for the ASlibs via the programm dump_nonlocal_field. 2021-08-18 16:57:29 +02:00
c6c7deec9c make PSI bulk MusrRoot files accessible if the file name is generated from the run-number, year, etc. 2021-07-28 13:22:42 +02:00
341fa9f77c Removed MuTransistion from tests directory. 2021-07-20 10:51:10 +02:00
ef1f323f07 fixed another git-revision.h which was forgotten. 2021-07-12 16:30:31 +02:00
47e7ba2c70 some fixes on the qt5 side for a none-git project source. 2021-07-12 16:23:33 +02:00
8faa501db7 more work on the none git source version. 2021-07-12 16:00:19 +02:00
2f11d131c7 some more work on the none git source version. 2021-07-12 15:49:01 +02:00
daa2ea1347 make sure that git repo info is only added if the musrfit project source is indeed a git repo, and not e.g. a download. 2021-07-12 15:34:07 +02:00
f41c633bfe add mupp plotter export function. 2021-07-05 17:43:32 +02:00
5bebe4062d adopted version info for the docu. 2021-06-17 10:28:16 +02:00
a0dd51e1b7 updated the ChangeLog. 2021-06-16 19:57:00 +02:00
dd08eeae12 increased version number. 2021-06-16 19:56:30 +02:00
66fee6a1b3 lift #forward == #backward restriction. 2021-06-16 19:55:43 +02:00
ab29dedb77 lift #forward == #backward restriction. 2021-06-16 17:58:40 +02:00
b2bb863e9d remove obsolete test. 2021-06-16 17:57:28 +02:00
927f2e83c2 improve the readability of the time with packing in the code. 2021-06-07 18:34:36 +02:00
5bd5c08f39 adopted to the not quite standard ISIS NeXus files. 2021-06-05 10:51:19 +02:00
f4232057b8 perform a more robust casting. 2021-06-02 12:29:00 +02:00
90725dbf58 removed unnecessary check. 2021-06-02 12:28:24 +02:00
3b24d512be increased the version number. 2021-06-01 17:31:37 +02:00
79 changed files with 1618 additions and 1822 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.7.2 LANGUAGES C CXX)
project(musrfit VERSION 1.7.5 LANGUAGES C CXX)
#--- musrfit specific options -------------------------------------------------
option(nexus "build optional NeXus support. Needed for ISIS" OFF)
@ -220,6 +220,15 @@ endif (nexus)
set(HAVE_CONFIG_H 1 CACHE INTERNAL "config.h is available")
configure_file(${CMAKE_SOURCE_DIR}/cmake/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
#--- check if project source is a git repo ------------------------------------
if (EXISTS "${CMAKE_SOURCE_DIR}/.git/HEAD")
message(STATUS "is a git repo")
set(IS_GIT_REPO 1)
else ()
message(STATUS "is NOT a git repo")
set(IS_GIT_REPO 0)
endif ()
#--- propagate to the sub-directories -----------------------------------------
add_subdirectory(src)

View File

@ -12,6 +12,17 @@ or
https://bitbucket.org/muonspin/musrfit/commits/all
Release of V1.7.4, 2021/06/16
=============================
allow in asymmetry fits #forward groups != #backward groups
Release of V1.7.3, 2021/06/01
=============================
making musrfit Apple Silicon M1 ready. Currently there is still an open issue
with NeXus (HDF4 only).
Release of V1.7.2, 2021/04/16
=============================

View File

@ -6,7 +6,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Acknowledgements &mdash; musrfit 1.7.1 documentation</title>
<title>Acknowledgements &mdash; musrfit 1.7.4 documentation</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
@ -14,7 +14,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '1.7.1',
VERSION: '1.7.4',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -24,7 +24,7 @@
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="top" title="musrfit 1.7.1 documentation" href="index.html" />
<link rel="top" title="musrfit 1.7.4 documentation" href="index.html" />
<link rel="next" title="Bugtracking" href="bugtracking.html" />
<link rel="prev" title="MusrRoot - an Extensible Open File Format for μSR" href="musr-root.html" />
</head>
@ -41,7 +41,7 @@
<li class="right" >
<a href="musr-root.html" title="MusrRoot - an Extensible Open File Format for μSR"
accesskey="P">previous</a> |</li>
<li><a href="index.html">musrfit 1.7.1 documentation</a> &raquo;</li>
<li><a href="index.html">musrfit 1.7.4 documentation</a> &raquo;</li>
</ul>
</div>
@ -112,7 +112,7 @@ 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><a href="index.html">musrfit 1.7.1 documentation</a> &raquo;</li>
<li><a href="index.html">musrfit 1.7.4 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">

View File

@ -6,7 +6,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>any2many - a Universal μSR-file-format converter &mdash; musrfit 1.7.1 documentation</title>
<title>any2many - a Universal μSR-file-format converter &mdash; musrfit 1.7.4 documentation</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
@ -14,7 +14,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '1.7.1',
VERSION: '1.7.4',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -24,7 +24,7 @@
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="top" title="musrfit 1.7.1 documentation" href="index.html" />
<link rel="top" title="musrfit 1.7.4 documentation" href="index.html" />
<link rel="next" title="MusrRoot - an Extensible Open File Format for μSR" href="musr-root.html" />
<link rel="prev" title="msr2data - A Program for Automatically Processing Multiple musrfit msr Files" href="msr2data.html" />
</head>
@ -41,7 +41,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><a href="index.html">musrfit 1.7.1 documentation</a> &raquo;</li>
<li><a href="index.html">musrfit 1.7.4 documentation</a> &raquo;</li>
</ul>
</div>
@ -102,7 +102,7 @@ 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><a href="index.html">musrfit 1.7.1 documentation</a> &raquo;</li>
<li><a href="index.html">musrfit 1.7.4 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">

View File

@ -6,7 +6,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Bugtracking &mdash; musrfit 1.7.1 documentation</title>
<title>Bugtracking &mdash; musrfit 1.7.4 documentation</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
@ -14,7 +14,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '1.7.1',
VERSION: '1.7.4',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -24,7 +24,7 @@
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="top" title="musrfit 1.7.1 documentation" href="index.html" />
<link rel="top" title="musrfit 1.7.4 documentation" href="index.html" />
<link rel="prev" title="Acknowledgements" href="acknowledgement.html" />
</head>
<body>
@ -37,7 +37,7 @@
<li class="right" >
<a href="acknowledgement.html" title="Acknowledgements"
accesskey="P">previous</a> |</li>
<li><a href="index.html">musrfit 1.7.1 documentation</a> &raquo;</li>
<li><a href="index.html">musrfit 1.7.4 documentation</a> &raquo;</li>
</ul>
</div>
@ -93,7 +93,7 @@ or send an e-mail to A. Suter at PSI.</p>
<li class="right" >
<a href="acknowledgement.html" title="Acknowledgements"
>previous</a> |</li>
<li><a href="index.html">musrfit 1.7.1 documentation</a> &raquo;</li>
<li><a href="index.html">musrfit 1.7.4 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">

View File

@ -6,7 +6,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>How to Cite musrfit? &mdash; musrfit 1.7.1 documentation</title>
<title>How to Cite musrfit? &mdash; musrfit 1.7.4 documentation</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
@ -14,7 +14,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '1.7.1',
VERSION: '1.7.4',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -24,7 +24,7 @@
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="top" title="musrfit 1.7.1 documentation" href="index.html" />
<link rel="top" title="musrfit 1.7.4 documentation" href="index.html" />
<link rel="next" title="Tutorial for musrfit" href="tutorial.html" />
<link rel="prev" title="Welcome to the musrfit documentation!" href="index.html" />
</head>
@ -41,7 +41,7 @@
<li class="right" >
<a href="index.html" title="Welcome to the musrfit documentation!"
accesskey="P">previous</a> |</li>
<li><a href="index.html">musrfit 1.7.1 documentation</a> &raquo;</li>
<li><a href="index.html">musrfit 1.7.4 documentation</a> &raquo;</li>
</ul>
</div>
@ -114,7 +114,7 @@
<li class="right" >
<a href="index.html" title="Welcome to the musrfit documentation!"
>previous</a> |</li>
<li><a href="index.html">musrfit 1.7.1 documentation</a> &raquo;</li>
<li><a href="index.html">musrfit 1.7.4 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">

View File

@ -7,7 +7,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Index &mdash; musrfit 1.7.1 documentation</title>
<title>Index &mdash; musrfit 1.7.4 documentation</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
@ -15,7 +15,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '1.7.1',
VERSION: '1.7.4',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="top" title="musrfit 1.7.1 documentation" href="index.html" />
<link rel="top" title="musrfit 1.7.4 documentation" href="index.html" />
</head>
<body>
<div class="related">
@ -34,7 +34,7 @@
<li class="right" style="margin-right: 10px">
<a href="#" title="General Index"
accesskey="I">index</a></li>
<li><a href="index.html">musrfit 1.7.1 documentation</a> &raquo;</li>
<li><a href="index.html">musrfit 1.7.4 documentation</a> &raquo;</li>
</ul>
</div>
@ -994,7 +994,7 @@
<li class="right" style="margin-right: 10px">
<a href="#" title="General Index"
>index</a></li>
<li><a href="index.html">musrfit 1.7.1 documentation</a> &raquo;</li>
<li><a href="index.html">musrfit 1.7.4 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">

View File

@ -6,7 +6,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Welcome to the musrfit documentation! &mdash; musrfit 1.7.1 documentation</title>
<title>Welcome to the musrfit documentation! &mdash; musrfit 1.7.4 documentation</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
@ -14,7 +14,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '1.7.1',
VERSION: '1.7.4',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -24,7 +24,7 @@
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="top" title="musrfit 1.7.1 documentation" href="#" />
<link rel="top" title="musrfit 1.7.4 documentation" href="#" />
<link rel="next" title="How to Cite musrfit?" href="cite.html" />
</head>
<body>
@ -37,7 +37,7 @@
<li class="right" >
<a href="cite.html" title="How to Cite musrfit?"
accesskey="N">next</a> |</li>
<li><a href="#">musrfit 1.7.1 documentation</a> &raquo;</li>
<li><a href="#">musrfit 1.7.4 documentation</a> &raquo;</li>
</ul>
</div>
@ -180,7 +180,7 @@
<li class="right" >
<a href="cite.html" title="How to Cite musrfit?"
>next</a> |</li>
<li><a href="#">musrfit 1.7.1 documentation</a> &raquo;</li>
<li><a href="#">musrfit 1.7.4 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">

View File

@ -6,7 +6,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>msr2data - A Program for Automatically Processing Multiple musrfit msr Files &mdash; musrfit 1.7.1 documentation</title>
<title>msr2data - A Program for Automatically Processing Multiple musrfit msr Files &mdash; musrfit 1.7.4 documentation</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
@ -14,7 +14,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '1.7.1',
VERSION: '1.7.4',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -24,7 +24,7 @@
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="top" title="musrfit 1.7.1 documentation" href="index.html" />
<link rel="top" title="musrfit 1.7.4 documentation" href="index.html" />
<link rel="next" title="any2many - a Universal μSR-file-format converter" href="any2many.html" />
<link rel="prev" title="mupp - μSR Parameter Plotter" href="mupp.html" />
</head>
@ -41,7 +41,7 @@
<li class="right" >
<a href="mupp.html" title="mupp - μSR Parameter Plotter"
accesskey="P">previous</a> |</li>
<li><a href="index.html">musrfit 1.7.1 documentation</a> &raquo;</li>
<li><a href="index.html">musrfit 1.7.4 documentation</a> &raquo;</li>
</ul>
</div>
@ -434,7 +434,7 @@ 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><a href="index.html">musrfit 1.7.1 documentation</a> &raquo;</li>
<li><a href="index.html">musrfit 1.7.4 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">

View File

@ -6,7 +6,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>mupp - μSR Parameter Plotter &mdash; musrfit 1.7.1 documentation</title>
<title>mupp - μSR Parameter Plotter &mdash; musrfit 1.7.4 documentation</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
@ -14,7 +14,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '1.7.1',
VERSION: '1.7.4',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -24,7 +24,7 @@
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="top" title="musrfit 1.7.1 documentation" href="index.html" />
<link rel="top" title="musrfit 1.7.4 documentation" href="index.html" />
<link rel="next" title="msr2data - A Program for Automatically Processing Multiple musrfit msr Files" href="msr2data.html" />
<link rel="prev" title="musredit: the GUI Based Interface to musrfit" href="musredit.html" />
</head>
@ -41,7 +41,7 @@
<li class="right" >
<a href="musredit.html" title="musredit: the GUI Based Interface to musrfit"
accesskey="P">previous</a> |</li>
<li><a href="index.html">musrfit 1.7.1 documentation</a> &raquo;</li>
<li><a href="index.html">musrfit 1.7.4 documentation</a> &raquo;</li>
</ul>
</div>
@ -324,7 +324,7 @@ SCRIPT COMMANDS:
<li class="right" >
<a href="musredit.html" title="musredit: the GUI Based Interface to musrfit"
>previous</a> |</li>
<li><a href="index.html">musrfit 1.7.1 documentation</a> &raquo;</li>
<li><a href="index.html">musrfit 1.7.4 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">

View File

@ -6,7 +6,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>MusrRoot - an Extensible Open File Format for μSR &mdash; musrfit 1.7.1 documentation</title>
<title>MusrRoot - an Extensible Open File Format for μSR &mdash; musrfit 1.7.4 documentation</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
@ -14,7 +14,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '1.7.1',
VERSION: '1.7.4',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -24,7 +24,7 @@
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="top" title="musrfit 1.7.1 documentation" href="index.html" />
<link rel="top" title="musrfit 1.7.4 documentation" href="index.html" />
<link rel="next" title="Acknowledgements" href="acknowledgement.html" />
<link rel="prev" title="any2many - a Universal μSR-file-format converter" href="any2many.html" />
</head>
@ -41,7 +41,7 @@
<li class="right" >
<a href="any2many.html" title="any2many - a Universal μSR-file-format converter"
accesskey="P">previous</a> |</li>
<li><a href="index.html">musrfit 1.7.1 documentation</a> &raquo;</li>
<li><a href="index.html">musrfit 1.7.4 documentation</a> &raquo;</li>
</ul>
</div>
@ -923,7 +923,7 @@ the entry has been added. The last token, <tt class="docutils literal"><span cla
<li class="right" >
<a href="any2many.html" title="any2many - a Universal μSR-file-format converter"
>previous</a> |</li>
<li><a href="index.html">musrfit 1.7.1 documentation</a> &raquo;</li>
<li><a href="index.html">musrfit 1.7.4 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">

View File

@ -6,7 +6,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>musredit: the GUI Based Interface to musrfit &mdash; musrfit 1.7.1 documentation</title>
<title>musredit: the GUI Based Interface to musrfit &mdash; musrfit 1.7.4 documentation</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
@ -14,7 +14,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '1.7.1',
VERSION: '1.7.4',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -24,7 +24,7 @@
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="top" title="musrfit 1.7.1 documentation" href="index.html" />
<link rel="top" title="musrfit 1.7.4 documentation" href="index.html" />
<link rel="next" title="mupp - μSR Parameter Plotter" href="mupp.html" />
<link rel="prev" title="Setting up musrfit / DKS: High Speed Fitting with GPUs" href="setup-dks.html" />
</head>
@ -41,7 +41,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><a href="index.html">musrfit 1.7.1 documentation</a> &raquo;</li>
<li><a href="index.html">musrfit 1.7.4 documentation</a> &raquo;</li>
</ul>
</div>
@ -550,7 +550,7 @@ 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><a href="index.html">musrfit 1.7.1 documentation</a> &raquo;</li>
<li><a href="index.html">musrfit 1.7.4 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">

View File

@ -6,7 +6,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Search &mdash; musrfit 1.7.1 documentation</title>
<title>Search &mdash; musrfit 1.7.4 documentation</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
@ -14,7 +14,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '1.7.1',
VERSION: '1.7.4',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="_static/searchtools.js"></script>
<link rel="top" title="musrfit 1.7.1 documentation" href="index.html" />
<link rel="top" title="musrfit 1.7.4 documentation" href="index.html" />
<script type="text/javascript">
jQuery(function() { Search.loadIndex("searchindex.js"); });
</script>
@ -41,7 +41,7 @@
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li><a href="index.html">musrfit 1.7.1 documentation</a> &raquo;</li>
<li><a href="index.html">musrfit 1.7.4 documentation</a> &raquo;</li>
</ul>
</div>
@ -89,7 +89,7 @@
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li><a href="index.html">musrfit 1.7.1 documentation</a> &raquo;</li>
<li><a href="index.html">musrfit 1.7.4 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">

View File

@ -6,7 +6,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Setting up musrfit / DKS: High Speed Fitting with GPUs &mdash; musrfit 1.7.1 documentation</title>
<title>Setting up musrfit / DKS: High Speed Fitting with GPUs &mdash; musrfit 1.7.4 documentation</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
@ -14,7 +14,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '1.7.1',
VERSION: '1.7.4',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -24,7 +24,7 @@
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="top" title="musrfit 1.7.1 documentation" href="index.html" />
<link rel="top" title="musrfit 1.7.4 documentation" href="index.html" />
<link rel="next" title="musredit: the GUI Based Interface to musrfit" href="musredit.html" />
<link rel="prev" title="Setting up musrfit on Different Platforms" href="setup-standard.html" />
</head>
@ -41,7 +41,7 @@
<li class="right" >
<a href="setup-standard.html" title="Setting up musrfit on Different Platforms"
accesskey="P">previous</a> |</li>
<li><a href="index.html">musrfit 1.7.1 documentation</a> &raquo;</li>
<li><a href="index.html">musrfit 1.7.4 documentation</a> &raquo;</li>
</ul>
</div>
@ -321,7 +321,7 @@ The only thing you need <tt class="docutils literal"><span class="pre">DKS</span
<li class="right" >
<a href="setup-standard.html" title="Setting up musrfit on Different Platforms"
>previous</a> |</li>
<li><a href="index.html">musrfit 1.7.1 documentation</a> &raquo;</li>
<li><a href="index.html">musrfit 1.7.4 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">

View File

@ -6,7 +6,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Setting up musrfit on Different Platforms &mdash; musrfit 1.7.1 documentation</title>
<title>Setting up musrfit on Different Platforms &mdash; musrfit 1.7.4 documentation</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
@ -14,7 +14,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '1.7.1',
VERSION: '1.7.4',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -24,7 +24,7 @@
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="top" title="musrfit 1.7.1 documentation" href="index.html" />
<link rel="top" title="musrfit 1.7.4 documentation" href="index.html" />
<link rel="next" title="Setting up musrfit / DKS: High Speed Fitting with GPUs" href="setup-dks.html" />
<link rel="prev" title="Documentation of user libs (user functions)" href="user-libs.html" />
</head>
@ -41,7 +41,7 @@
<li class="right" >
<a href="user-libs.html" title="Documentation of user libs (user functions)"
accesskey="P">previous</a> |</li>
<li><a href="index.html">musrfit 1.7.1 documentation</a> &raquo;</li>
<li><a href="index.html">musrfit 1.7.4 documentation</a> &raquo;</li>
</ul>
</div>
@ -1302,7 +1302,7 @@ $ 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><a href="index.html">musrfit 1.7.1 documentation</a> &raquo;</li>
<li><a href="index.html">musrfit 1.7.4 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">

View File

@ -6,7 +6,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Tutorial for musrfit &mdash; musrfit 1.7.1 documentation</title>
<title>Tutorial for musrfit &mdash; musrfit 1.7.4 documentation</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
@ -14,7 +14,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '1.7.1',
VERSION: '1.7.4',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -24,7 +24,7 @@
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="top" title="musrfit 1.7.1 documentation" href="index.html" />
<link rel="top" title="musrfit 1.7.4 documentation" href="index.html" />
<link rel="next" title="User manual" href="user-manual.html" />
<link rel="prev" title="How to Cite musrfit?" href="cite.html" />
</head>
@ -41,7 +41,7 @@
<li class="right" >
<a href="cite.html" title="How to Cite musrfit?"
accesskey="P">previous</a> |</li>
<li><a href="index.html">musrfit 1.7.1 documentation</a> &raquo;</li>
<li><a href="index.html">musrfit 1.7.4 documentation</a> &raquo;</li>
</ul>
</div>
@ -443,7 +443,7 @@ 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><a href="index.html">musrfit 1.7.1 documentation</a> &raquo;</li>
<li><a href="index.html">musrfit 1.7.4 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">

View File

@ -6,7 +6,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documentation of user libs (user functions) &mdash; musrfit 1.7.1 documentation</title>
<title>Documentation of user libs (user functions) &mdash; musrfit 1.7.4 documentation</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
@ -14,7 +14,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '1.7.1',
VERSION: '1.7.4',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -24,7 +24,7 @@
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="top" title="musrfit 1.7.1 documentation" href="index.html" />
<link rel="top" title="musrfit 1.7.4 documentation" href="index.html" />
<link rel="next" title="Setting up musrfit on Different Platforms" href="setup-standard.html" />
<link rel="prev" title="User manual" href="user-manual.html" />
</head>
@ -41,7 +41,7 @@
<li class="right" >
<a href="user-manual.html" title="User manual"
accesskey="P">previous</a> |</li>
<li><a href="index.html">musrfit 1.7.1 documentation</a> &raquo;</li>
<li><a href="index.html">musrfit 1.7.4 documentation</a> &raquo;</li>
</ul>
</div>
@ -662,7 +662,7 @@ 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><a href="index.html">musrfit 1.7.1 documentation</a> &raquo;</li>
<li><a href="index.html">musrfit 1.7.4 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">

View File

@ -6,7 +6,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>User manual &mdash; musrfit 1.7.1 documentation</title>
<title>User manual &mdash; musrfit 1.7.4 documentation</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
@ -14,7 +14,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '1.7.1',
VERSION: '1.7.4',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -24,7 +24,7 @@
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="top" title="musrfit 1.7.1 documentation" href="index.html" />
<link rel="top" title="musrfit 1.7.4 documentation" href="index.html" />
<link rel="next" title="Documentation of user libs (user functions)" href="user-libs.html" />
<link rel="prev" title="Tutorial for musrfit" href="tutorial.html" />
</head>
@ -41,7 +41,7 @@
<li class="right" >
<a href="tutorial.html" title="Tutorial for musrfit"
accesskey="P">previous</a> |</li>
<li><a href="index.html">musrfit 1.7.1 documentation</a> &raquo;</li>
<li><a href="index.html">musrfit 1.7.4 documentation</a> &raquo;</li>
</ul>
</div>
@ -1297,7 +1297,7 @@ any information on a background line are ignored.</dd>
</dl>
<span id="index-24"></span><dl class="docutils" id="msr-lifetime">
<dt><strong>lifetime</strong> (fit type 0)</dt>
<dd>Fit parameter representing the lifetime of the muon. If it is not specified the value <span class="math">\(\tau_\mu=2.197019~ \mu\mathrm{s}\)</span> is used in the calculations.</dd>
<dd>Fit parameter representing the lifetime of the muon. If it is not specified the value <span class="math">\(\tau_\mu=2.1.7.49~ \mu\mathrm{s}\)</span> is used in the calculations.</dd>
<dt><strong>lifetimecorrection</strong> (fit type 0) <em>obsolete</em></dt>
<dd>Does not accept any arguments. If present, the output in <tt class="docutils literal"><span class="pre">musrview</span></tt> is corrected for the exponential decay of the muon. This item is <em>obsolete</em> in the RUN block
and will be transferred to the <a class="reference internal" href="#msr-plot-block"><em>PLOT block</em></a>, which allows switching between histogram view and asymmetry view much quicker.</dd>
@ -2696,7 +2696,7 @@ here:</p>
<li class="right" >
<a href="tutorial.html" title="Tutorial for musrfit"
>previous</a> |</li>
<li><a href="index.html">musrfit 1.7.1 documentation</a> &raquo;</li>
<li><a href="index.html">musrfit 1.7.4 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">

View File

@ -23,32 +23,40 @@ endif (nexus)
set(MUSRFIT_LIBS ${MUSRFIT_LIBS} PMusr)
#--- start create git-revision.h ----------------------------------------------
configure_file(
${CMAKE_SOURCE_DIR}/cmake/configure_musrfit_version_file.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/configure_musrfit_version_file.cmake
@ONLY
)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/git-revision.h
COMMAND ${CMAKE_COMMAND} -P
if (IS_GIT_REPO)
configure_file(
${CMAKE_SOURCE_DIR}/cmake/configure_musrfit_version_file.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/configure_musrfit_version_file.cmake
DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/configure_musrfit_version_file.cmake
${CMAKE_SOURCE_DIR}/cmake/git-revision.h.in
COMMENT "Configuring git-revision.h"
VERBATIM
)
@ONLY
)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/git-revision.h
COMMAND ${CMAKE_COMMAND} -P
${CMAKE_CURRENT_BINARY_DIR}/configure_musrfit_version_file.cmake
DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/configure_musrfit_version_file.cmake
${CMAKE_SOURCE_DIR}/cmake/git-revision.h.in
COMMENT "Configuring git-revision.h"
VERBATIM
)
add_custom_target(
configure_musrfit_version ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/git-revision.h
)
set(HAVE_GIT_REV_H "-DHAVE_GIT_REV_H")
set(GIT_REV_H "git-revision.h")
else (IS_GIT_REPO)
set(HAVE_GIT_REV_H "")
set(GIT_REV_H "")
endif (IS_GIT_REPO)
add_custom_target(
configure_musrfit_version ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/git-revision.h
)
#--- end create git-revision.h ------------------------------------------------
#--- add all executables ------------------------------------------------------
add_executable(any2many git-revision.h any2many.cpp)
target_compile_options(any2many BEFORE PRIVATE "-DHAVE_CONFIG_H")
add_executable(any2many ${GIT_REV_H} any2many.cpp)
target_compile_options(any2many BEFORE PRIVATE "-DHAVE_CONFIG_H" "${HAVE_GIT_REV_H}")
target_include_directories(any2many
BEFORE PRIVATE
$<BUILD_INTERFACE:${Boost_INCLUDE_DIR}>
@ -59,8 +67,8 @@ target_include_directories(any2many
)
target_link_libraries(any2many ${ROOT_LIBRARIES} ${MUSRFIT_LIBS})
add_executable(dump_header git-revision.h dump_header.cpp)
target_compile_options(dump_header BEFORE PRIVATE "-DHAVE_CONFIG_H")
add_executable(dump_header ${GIT_REV_H} dump_header.cpp)
target_compile_options(dump_header BEFORE PRIVATE "-DHAVE_CONFIG_H" "${HAVE_GIT_REV_H}")
target_include_directories(dump_header
BEFORE PRIVATE
$<BUILD_INTERFACE:${Boost_INCLUDE_DIRS}>
@ -77,8 +85,8 @@ target_include_directories(dump_header
)
target_link_libraries(dump_header ${ROOT_LIBRARIES} ${MUSRFIT_LIBS})
add_executable(msr2data git-revision.h msr2data.cpp)
target_compile_options(msr2data BEFORE PRIVATE "-DHAVE_CONFIG_H")
add_executable(msr2data ${GIT_REV_H} msr2data.cpp)
target_compile_options(msr2data BEFORE PRIVATE "-DHAVE_CONFIG_H" "${HAVE_GIT_REV_H}")
target_include_directories(msr2data
BEFORE PRIVATE
$<BUILD_INTERFACE:${Boost_INCLUDE_DIRS}>
@ -92,8 +100,8 @@ target_link_libraries(msr2data ${ROOT_LIBRARIES} ${MUSRFIT_LIBS})
add_executable(msr2msr msr2msr.cpp)
target_link_libraries(msr2msr ${ROOT_LIBRARIES})
add_executable(musrfit git-revision.h musrfit.cpp)
target_compile_options(musrfit BEFORE PRIVATE "-DHAVE_CONFIG_H")
add_executable(musrfit ${GIT_REV_H} musrfit.cpp)
target_compile_options(musrfit BEFORE PRIVATE "-DHAVE_CONFIG_H" "${HAVE_GIT_REV_H}")
target_include_directories(musrfit
BEFORE PRIVATE
$<BUILD_INTERFACE:${Boost_INCLUDE_DIR}>
@ -104,8 +112,8 @@ target_include_directories(musrfit
)
target_link_libraries(musrfit ${ROOT_LIBRARIES} ${MUSRFIT_LIBS})
add_executable(musrFT git-revision.h musrFT.cpp)
target_compile_options(musrFT BEFORE PRIVATE "-DHAVE_CONFIG_H")
add_executable(musrFT ${GIT_REV_H} musrFT.cpp)
target_compile_options(musrFT BEFORE PRIVATE "-DHAVE_CONFIG_H" "${HAVE_GIT_REV_H}")
target_include_directories(musrFT
BEFORE PRIVATE
$<BUILD_INTERFACE:${Boost_INCLUDE_DIR}>
@ -116,8 +124,8 @@ target_include_directories(musrFT
)
target_link_libraries(musrFT ${FFTW3_LIBRARY} ${ROOT_LIBRARIES} ${MUSRFIT_LIBS})
add_executable(musrRootValidation git-revision.h musrRootValidation.cpp)
target_compile_options(musrRootValidation BEFORE PRIVATE "-DHAVE_CONFIG_H")
add_executable(musrRootValidation ${GIT_REV_H} musrRootValidation.cpp)
target_compile_options(musrRootValidation BEFORE PRIVATE "-DHAVE_CONFIG_H" "${HAVE_GIT_REV_H}")
target_include_directories(musrRootValidation
BEFORE PRIVATE
$<BUILD_INTERFACE:${FFTW3_INCLUDE_DIR}>
@ -128,8 +136,8 @@ target_include_directories(musrRootValidation
)
target_link_libraries(musrRootValidation ${ROOT_LIBRARIES} ${MUSRFIT_LIBS} ${LIBXML2_LIBRARIES})
add_executable(musrt0 git-revision.h musrt0.cpp)
target_compile_options(musrt0 BEFORE PRIVATE "-DHAVE_CONFIG_H")
add_executable(musrt0 ${GIT_REV_H} musrt0.cpp)
target_compile_options(musrt0 BEFORE PRIVATE "-DHAVE_CONFIG_H" "${HAVE_GIT_REV_H}")
target_include_directories(musrt0
BEFORE PRIVATE
$<BUILD_INTERFACE:${Boost_INCLUDE_DIR}>
@ -140,8 +148,8 @@ target_include_directories(musrt0
)
target_link_libraries(musrt0 ${ROOT_LIBRARIES} ${MUSRFIT_LIBS})
add_executable(musrview git-revision.h musrview.cpp)
target_compile_options(musrview BEFORE PRIVATE "-DHAVE_CONFIG_H")
add_executable(musrview ${GIT_REV_H} musrview.cpp)
target_compile_options(musrview BEFORE PRIVATE "-DHAVE_CONFIG_H" "${HAVE_GIT_REV_H}")
target_include_directories(musrview
BEFORE PRIVATE
$<BUILD_INTERFACE:${Boost_INCLUDE_DIR}>
@ -152,8 +160,8 @@ target_include_directories(musrview
)
target_link_libraries(musrview ${FFTW3_LIBRARY} ${ROOT_LIBRARIES} ${MUSRFIT_LIBS})
add_executable(write_musrRoot_runHeader git-revision.h write_musrRoot_runHeader.cpp)
target_compile_options(write_musrRoot_runHeader BEFORE PRIVATE "-DHAVE_CONFIG_H")
add_executable(write_musrRoot_runHeader ${GIT_REV_H} write_musrRoot_runHeader.cpp)
target_compile_options(write_musrRoot_runHeader BEFORE PRIVATE "-DHAVE_CONFIG_H" "${HAVE_GIT_REV_H}")
target_include_directories(write_musrRoot_runHeader
BEFORE PRIVATE
$<BUILD_INTERFACE:${FFTW3_INCLUDE_DIR}>

View File

@ -41,7 +41,10 @@
#include <TString.h>
#include <TSAXParser.h>
#ifdef HAVE_GIT_REV_H
#include "git-revision.h"
#endif
#include "PMusr.h"
#include "PStartupHandler.h"
#include "PRunDataHandler.h"
@ -197,9 +200,17 @@ int main(int argc, char *argv[])
any2many_syntax();
else if (strstr(argv[1], "--v")) {
#ifdef HAVE_CONFIG_H
#ifdef HAVE_GIT_REV_H
std::cout << std::endl << "any2many version: " << PACKAGE_VERSION << ", git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << " (" << BUILD_TYPE << "), ROOT version: " << ROOT_VERSION_USED << std::endl << std::endl;
#else
std::cout << std::endl << "any2many version: " << PACKAGE_VERSION << " (" << BUILD_TYPE << "), ROOT version: " << ROOT_VERSION_USED << std::endl << std::endl;
#endif
#else
#ifdef HAVE_GIT_REV_H
std::cout << std::endl << "any2many git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << std::endl << std::endl;
#else
std::cout << std::endl << "any2many version: unkown." << std::endl << std::endl;
#endif
#endif
} else {
any2many_syntax();

View File

@ -59,6 +59,7 @@ root_generate_dictionary(
OPTIONS
-I${NONLOCAL_INC}
-I${MUSRFIT_INC}
-I${FFTW3_INCLUDE_DIR}
-I${CMAKE_CURRENT_SOURCE_DIR}
-inlineInputHeader
LINKDEF ${MUSRFIT_INC}/PRgeHandlerLinkDef.h

View File

@ -313,6 +313,9 @@ PFitter::PFitter(PMsrHandler *runInfo, PRunListCollection *runListCollection, Bo
return;
}
// create phase bool array
GetPhaseParams();
// create fit function object
fFitterFcn = new PFitterFcn(runListCollection, fUseChi2);
if (!fFitterFcn) {
@ -346,6 +349,226 @@ PFitter::~PFitter()
}
}
//--------------------------------------------------------------------------
// GetPhaseParams (private)
//--------------------------------------------------------------------------
/**
* <p>Checks which parameters are phases. This information is needed to
* restrict the phases to the intervall -360 to +360 degrees.
*/
void PFitter::GetPhaseParams()
{
fPhase.resize(fRunInfo->GetNoOfParams());
for (unsigned int i=0; i<fPhase.size(); i++)
fPhase[i] = false;
std::cout << "debug> fPhase.size()=" << fPhase.size() << std::endl;
// analyze theory block for parameters. Phases are present in the following
// default functions:
// user functions cannot be checked!
PMsrLines *theo = fRunInfo->GetMsrTheory();
TObjArray *tok = nullptr;
TObjString *ostr = nullptr;
TString str;
int pos = -1;
for (unsigned int i=0; i<theo->size(); i++) {
pos = -1;
TString line = theo->at(i).fLine;
if (line.Contains("TFieldCos") || line.Contains("tf ") ||
line.Contains("bessel") || line.Contains("b ") ||
line.Contains("skewedGss") || line.Contains("skg ") ||
line.Contains("staticNKTF") || line.Contains("snktf ") ||
line.Contains("dynamicNKTF") || line.Contains("dnktf ")) { // phase is 1st param
std::cout << "debug> line: " << line.View() << std::endl;
pos = 1;
}
if (line.Contains("internFld") || line.Contains("if ") ||
line.Contains("internBsl") || line.Contains("ib ")) { // phase is 2nd param
std::cout << "debug> line: " << line.View() << std::endl;
pos = 2;
}
if (line.Contains("muMinusExpTF") || line.Contains("mmsetf ")) { // phase is 5th param
std::cout << "debug> line: " << line.View() << std::endl;
pos = 5;
}
if (pos == -1)
continue;
// extract phase token
tok = line.Tokenize(" \t");
if (tok == nullptr) {
std::cerr << "PFitter::GetPhaseParams(): **ERROR** couldn't tokenize theory line string." << std::endl;
return;
}
if (tok->GetEntries() > pos) {
ostr = dynamic_cast<TObjString*>(tok->At(pos));
str = ostr->GetString();
std::cout << "debug>> ostr=" << str.View() << std::endl;
}
// clean up
delete tok;
tok = nullptr;
// decode phase token. It can be funX, mapX, or a number
if (str.Contains("fun")) { // function
PIntVector parVec = GetParFromFun(str);
for (int i=0; i<parVec.size(); i++) {
std::cout << "debug> par from fun: " << parVec[i] << std::endl;
if (parVec[i] <= fRunInfo->GetNoOfParams())
fPhase[parVec[i]-1] = true;
}
} else if (str.Contains("map")) { // map
PIntVector parVec = GetParFromMap(str);
for (int i=0; i<parVec.size(); i++) {
std::cout << "debug> par from map: " << parVec[i] << std::endl;
if (parVec[i] <= fRunInfo->GetNoOfParams())
fPhase[parVec[i]-1] = true;
}
} else { // must be a number
int idx = str.Atoi();
std::cout << "debug> idx=" << idx << std::endl;
if (idx == 0) { // something went wrong, str is not an integer
std::cerr << "PFitter::GetPhaseParams(): **ERROR** str=" << str.View() << " is not an integer!" << std::endl;
return;
}
idx -= 1; // param start at 1, vector at 0
if (idx >= fRunInfo->GetNoOfParams()) { // idx is out-of-range
std::cerr << "PFitter::GetPhaseParams(): **ERROR** idx=" << idx << " is > #param = " << fRunInfo->GetNoOfParams() << "!" << std::endl;
return;
}
fPhase[idx] = true;
}
}
for (int i=0; i<fPhase.size(); i++)
std::cout << i+1 << ": " << fPhase[i] << std::endl;
}
//--------------------------------------------------------------------------
// GetParFromFun (private)
//--------------------------------------------------------------------------
/**
* <p>Extract from string funX the function number. Base on the function number
* the paramter numbers will be collected.
*
* @param funStr string of the form funX, where X is the function number
* @return a vector of all the parameter numbers related to funX
*/
PIntVector PFitter::GetParFromFun(const TString funStr)
{
PIntVector parVec;
PMsrLines *funList = fRunInfo->GetMsrFunctions();
TObjArray *tok = nullptr;
TObjString *ostr = nullptr;
TString str;
for (int i=0; i<funList->size(); i++) {
if (funList->at(i).fLine.Contains(funStr)) {
std::cout << "debug> funList " << i << ": " << funList->at(i).fLine.View() << std::endl;
// tokenize function string
tok = funList->at(i).fLine.Tokenize(" =+-*/");
if (tok == nullptr) {
std::cerr << "PFitter::GetParFromFun(): **ERROR** couldn't tokenize function string." << std::endl;
return parVec;
}
for (int j=1; j<tok->GetEntries(); j++) {
ostr = dynamic_cast<TObjString*>(tok->At(j));
str = ostr->GetString();
// parse tok for parX
if (str.Contains("par")) {
std::cout << "debug> fun tok contains par: " << str.View() << std::endl;
// find start idx of par in token
Ssiz_t idx = str.Index("par");
idx += 3;
TString parStr("");
do {
parStr += str[idx];
} while (isdigit(str[idx++]));
std::cout << "debug> par idx = " << parStr.View() << std::endl;
parVec.push_back(parStr.Atoi());
}
// parse tok for mapX
if (str.Contains("map")) {
std::cout << "debug> fun tok contains map: " << str.View() << std::endl;
// find start idx of par in token
Ssiz_t idx = str.Index("map");
idx += 3;
TString mapStr("map");
do {
mapStr += str[idx];
} while (isdigit(str[idx++]));
std::cout << "debug> map string from fun: " << mapStr.View() << std::endl;
PIntVector mapParVec = GetParFromMap(mapStr);
for (int k=0; k<mapParVec.size(); k++) {
parVec.push_back(mapParVec[k]);
}
}
}
// clean up
delete tok;
tok = nullptr;
}
}
return parVec;
}
//--------------------------------------------------------------------------
// GetParFromMap (private)
//--------------------------------------------------------------------------
/**
* <p>Extract from string mapX the map number. Based on the map number the
* parameter numbers will be collected.
*
* @param mapStr string of the form mapX, where X is the map number
* @return a vector of all the parameter numbers related to mapX
*/
PIntVector PFitter::GetParFromMap(const TString mapStr)
{
PIntVector parVec;
TString str = mapStr;
str.Remove(0,3); // remove map from string
std::cout << "debug> mapX: X=" << str << std::endl;
int idx=str.Atoi();
if (idx == 0) {
std::cerr << "PFitter::GetParFromMap(): **ERROR** couldn't get propper index from mapX!" << std::endl;
return parVec;
}
idx -= 1; // map starts at 1, map vector at 0
// go through all the runs and collect the parameters from the map vectors
PMsrRunList *runList = fRunInfo->GetMsrRunList();
if (runList == nullptr) {
std::cerr << "PFitter::GetParFromMap(): **ERROR** couldn't get required run list information!" << std::endl;
return parVec;
}
PIntVector *map = nullptr;
for (int i=0; i<runList->size(); i++) {
map = runList->at(i).GetMap();
if (map == nullptr) {
std::cerr << "PFitter::GetParFromMap(): **ERROR** couldn't get required map information (idx=" << i << ")!" << std::endl;
parVec.clear();
return parVec;
}
if (idx >= map->size()) {
std::cerr << "PFitter::GetParFromMap(): **ERROR** requested map index (idx=" << idx << ") out-of-range (" << map->size() << ")!" << std::endl;
parVec.clear();
return parVec;
}
parVec.push_back(map->at(idx));
}
return parVec;
}
//--------------------------------------------------------------------------
// DoFit
//--------------------------------------------------------------------------
@ -1608,7 +1831,12 @@ Bool_t PFitter::ExecuteMigrad()
// fill run info
for (UInt_t i=0; i<fParams.size(); i++) {
fRunInfo->SetMsrParamValue(i, min.UserState().Value(i));
Double_t dval = min.UserState().Value(i);
if (fPhase[i]) {
Int_t m = (Int_t)(dval/360.0);
dval = dval - m*360.0;
}
fRunInfo->SetMsrParamValue(i, dval);
fRunInfo->SetMsrParamStep(i, min.UserState().Error(i));
fRunInfo->SetMsrParamPosErrorPresent(i, false);
}
@ -1684,7 +1912,12 @@ Bool_t PFitter::ExecuteMinimize()
// fill run info
for (UInt_t i=0; i<fParams.size(); i++) {
fRunInfo->SetMsrParamValue(i, min.UserState().Value(i));
Double_t dval = min.UserState().Value(i);
if (fPhase[i]) {
Int_t m = (Int_t)(dval/360.0);
dval = dval - m*360.0;
}
fRunInfo->SetMsrParamValue(i, dval);
fRunInfo->SetMsrParamStep(i, min.UserState().Error(i));
fRunInfo->SetMsrParamPosErrorPresent(i, false);
}
@ -2392,7 +2625,12 @@ Bool_t PFitter::ExecuteSimplex()
// fill run info
for (UInt_t i=0; i<fParams.size(); i++) {
fRunInfo->SetMsrParamValue(i, min.UserState().Value(i));
Double_t dval = min.UserState().Value(i);
if (fPhase[i]) {
Int_t m = (Int_t)(dval/360.0);
dval = dval - m*360.0;
}
fRunInfo->SetMsrParamValue(i, dval);
fRunInfo->SetMsrParamStep(i, min.UserState().Error(i));
fRunInfo->SetMsrParamPosErrorPresent(i, false);
}

View File

@ -6334,16 +6334,7 @@ Bool_t PMsrHandler::CheckHistoGrouping()
{
Bool_t result = true;
for (UInt_t i=0; i<fRuns.size(); i++) {
if (fRuns[i].GetFitType() == MSR_FITTYPE_ASYM || fRuns[i].GetFitType() == MSR_FITTYPE_BNMR) {
if (fRuns[i].GetForwardHistoNoSize() != fRuns[i].GetBackwardHistoNoSize()) {
std::cerr << std::endl << ">> PMsrHandler::CheckHistoGrouping: **ERROR** # of forward histos != # of backward histos.";
std::cerr << std::endl << ">> Run #" << i+1;
std::cerr << std::endl;
result = false;
break;
}
}
for (UInt_t i=0; i<fRuns.size(); i++) {
// check grouping entries are not identical, e.g. forward 1 1 2
if (fRuns[i].GetForwardHistoNoSize() > 1) {
for (UInt_t j=0; j<fRuns[i].GetForwardHistoNoSize(); j++) {

View File

@ -602,17 +602,7 @@ Bool_t PRunAsymmetry::PrepareData()
return false;
}
}
if (forwardHistoNo.size() != backwardHistoNo.size()) {
std::cerr << std::endl << ">> PRunAsymmetry::PrepareData(): **PANIC ERROR**:";
std::cerr << std::endl << ">> # of forward histograms different from # of backward histograms.";
std::cerr << std::endl << ">> Will quit :-(";
std::cerr << std::endl;
// clean up
forwardHistoNo.clear();
backwardHistoNo.clear();
return false;
}
// keep the time resolution in (us)
fTimeResolution = runData->GetTimeResolution()/1.0e3;
std::cout.precision(10);
@ -626,11 +616,13 @@ Bool_t PRunAsymmetry::PrepareData()
// keep the histo of each group at this point (addruns handled below)
std::vector<PDoubleVector> forward, backward;
forward.resize(forwardHistoNo.size()); // resize to number of groups
backward.resize(backwardHistoNo.size()); // resize to numer of groups
for (UInt_t i=0; i<forwardHistoNo.size(); i++) {
forward[i].resize(runData->GetDataBin(forwardHistoNo[i])->size());
backward[i].resize(runData->GetDataBin(backwardHistoNo[i])->size());
forward[i] = *runData->GetDataBin(forwardHistoNo[i]);
}
backward.resize(backwardHistoNo.size()); // resize to number of groups
for (UInt_t i=0; i<backwardHistoNo.size(); i++) {
backward[i].resize(runData->GetDataBin(backwardHistoNo[i])->size());
backward[i] = *runData->GetDataBin(backwardHistoNo[i]);
}
@ -676,9 +668,11 @@ Bool_t PRunAsymmetry::PrepareData()
// set forward/backward histo data of the first group
fForward.resize(forward[0].size());
fBackward.resize(backward[0].size());
for (UInt_t i=0; i<fForward.size(); i++) {
fForward[i] = forward[0][i];
}
fBackward.resize(backward[0].size());
for (UInt_t i=0; i<fBackward.size(); i++) {
fBackward[i] = backward[0][i];
}
@ -781,7 +775,21 @@ Bool_t PRunAsymmetry::PrepareData()
*/
Bool_t PRunAsymmetry::SubtractFixBkg()
{
if (fRunInfo->GetBkgFix(0) == PMUSR_UNDEFINED) {
std::cerr << "PRunAsymmetry::SubtractFixBkg(): **ERROR** no fixed bkg for forward set. Will do nothing here." << std::endl;
return false;
}
if (fRunInfo->GetBkgFix(1) == PMUSR_UNDEFINED) {
std::cerr << "PRunAsymmetry::SubtractFixBkg(): **ERROR** no fixed bkg for backward set. Will do nothing here." << std::endl;
std::cerr << " you need an entry like:" << std::endl;
std::cerr << " backgr.fix 2 3" << std::endl;
std::cerr << " i.e. two entries for forward and backward." << std::endl;
return false;
}
Double_t dval;
for (UInt_t i=0; i<fForward.size(); i++) {
// keep the error, and make sure that the bin is NOT empty
if (fForward[i] != 0.0)
@ -1005,8 +1013,8 @@ Bool_t PRunAsymmetry::PrepareFitData()
Double_t asym;
Double_t f, b, ef, eb;
// fill data time start, and step
// data start at data_start-t0 shifted by (pack-1)/2
fData.SetDataTimeStart(fTimeResolution*(static_cast<Double_t>(fGoodBins[0])-fT0s[0]+static_cast<Double_t>(fPacking-1)/2.0));
// data start time = (binStart - 0.5) + pack/2 - t0, with pack and binStart used as double
fData.SetDataTimeStart(fTimeResolution*((static_cast<Double_t>(fGoodBins[0])-0.5) + static_cast<Double_t>(fPacking)/2.0 - static_cast<Double_t>(fT0s[0])));
fData.SetDataTimeStep(fTimeResolution*static_cast<Double_t>(fPacking));
for (UInt_t i=0; i<noOfBins; i++) {
// to make the formulae more readable
@ -1207,8 +1215,8 @@ Bool_t PRunAsymmetry::PrepareViewData(PRawRunData* runData, UInt_t histoNo[2])
Double_t asym;
Double_t f, b, ef, eb, alpha = 1.0, beta = 1.0;
// set data time start, and step
// data start at data_start-t0
fData.SetDataTimeStart(fTimeResolution*(static_cast<Double_t>(start[0])-t0[0]+static_cast<Double_t>(packing-1)/2.0));
// data start time = (binStart - 0.5) + pack/2 - t0, with pack and binStart used as double
fData.SetDataTimeStart(fTimeResolution*((static_cast<Double_t>(start[0])-0.5) + static_cast<Double_t>(packing)/2.0 - static_cast<Double_t>(t0[0])));
fData.SetDataTimeStep(fTimeResolution*static_cast<Double_t>(packing));
// get the proper alpha and beta
@ -1586,8 +1594,8 @@ Bool_t PRunAsymmetry::PrepareRRFViewData(PRawRunData* runData, UInt_t histoNo[2]
}
// set data time start, and step
// data start at data_start-t0
fData.SetDataTimeStart(fTimeResolution*(start[0]-t0[0]+static_cast<Double_t>(packing-1)/2.0));
// data start time = (binStart - 0.5) + pack/2 - t0, with pack and binStart used as double
fData.SetDataTimeStart(fTimeResolution*((static_cast<Double_t>(start[0])-0.5) + static_cast<Double_t>(packing)/2.0 - static_cast<Double_t>(t0[0])));
fData.SetDataTimeStep(fTimeResolution*static_cast<Double_t>(packing));
// ------------------------------------------------------------
@ -1663,7 +1671,7 @@ Bool_t PRunAsymmetry::PrepareRRFViewData(PRawRunData* runData, UInt_t histoNo[2]
//--------------------------------------------------------------------------
/**
* <p>Get the proper t0 for the single histogram run.
* -# the t0 vector size = number of detectors (grouping) for forward.
* -# the t0 vector size = number of detectors (grouping) for forward + backward.
* -# initialize t0's with -1
* -# fill t0's from RUN block
* -# if t0's are missing (i.e. t0 == -1), try to fill from the GLOBAL block.
@ -1684,7 +1692,11 @@ Bool_t PRunAsymmetry::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *globalB
// feed all T0's
// first init T0's, T0's are stored as (forward T0, backward T0, etc.)
fT0s.clear();
fT0s.resize(2*forwardHistoNo.size());
// this strange fT0 size estimate is needed in case #forw histos != #back histos
size_t size = 2*forwardHistoNo.size();
if (backwardHistoNo.size() > forwardHistoNo.size())
size = 2*backwardHistoNo.size();
fT0s.resize(size);
for (UInt_t i=0; i<fT0s.size(); i++) {
fT0s[i] = -1.0;
}
@ -1751,6 +1763,8 @@ Bool_t PRunAsymmetry::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *globalB
std::cerr << std::endl;
return false;
}
}
for (UInt_t i=0; i<backwardHistoNo.size(); i++) {
if ((fT0s[2*i+1] < 0) || (fT0s[2*i+1] > static_cast<Int_t>(runData->GetDataBin(backwardHistoNo[i])->size()))) {
std::cerr << std::endl << ">> PRunAsymmetry::PrepareData(): **ERROR** t0 data bin (" << fT0s[2*i+1] << ") doesn't make any sense!";
std::cerr << std::endl << ">> backwardHistoNo " << backwardHistoNo[i];

View File

@ -640,6 +640,7 @@ Bool_t PRunAsymmetryBNMR::PrepareData()
return false;
}
}
/* //as35
if (forwardHistoNo.size() != backwardHistoNo.size()) {
std::cerr << std::endl << ">> PRunAsymmetryBNMR::PrepareData(): **PANIC ERROR**:";
std::cerr << std::endl << ">> # of forward histograms different from # of backward histograms.";
@ -650,7 +651,8 @@ Bool_t PRunAsymmetryBNMR::PrepareData()
backwardHistoNo.clear();
return false;
}
*/ //as35
// keep the time resolution in (s)
fTimeResolution = runData->GetTimeResolution()/1.0e3;
std::cout.precision(10);
@ -664,11 +666,13 @@ Bool_t PRunAsymmetryBNMR::PrepareData()
// keep the histo of each group at this point (addruns handled below)
std::vector<PDoubleVector> forward, backward;
forward.resize(forwardHistoNo.size()); // resize to number of groups
backward.resize(backwardHistoNo.size()); // resize to numer of groups
for (UInt_t i=0; i<forwardHistoNo.size(); i++) {
forward[i].resize(runData->GetDataBin(forwardHistoNo[i])->size());
backward[i].resize(runData->GetDataBin(backwardHistoNo[i])->size());
forward[i] = *runData->GetDataBin(forwardHistoNo[i]);
}
backward.resize(backwardHistoNo.size()); // resize to number of groups
for (UInt_t i=0; i<backwardHistoNo.size(); i++) {
backward[i].resize(runData->GetDataBin(backwardHistoNo[i])->size());
backward[i] = *runData->GetDataBin(backwardHistoNo[i]);
}
@ -712,15 +716,18 @@ Bool_t PRunAsymmetryBNMR::PrepareData()
}
}
// set forward/backward histo data of the first group
// set forward histo data of the first group
fForwardp.resize(forward[0].size());
fBackwardp.resize(backward[0].size());
fForwardm.resize(forward[0].size());
fBackwardm.resize(backward[0].size());
for (UInt_t i=0; i<fForwardp.size(); i++) {
fForwardp[i] = forward[0][i];
fBackwardp[i] = backward[0][i];
fForwardm[i] = forward[1][i];
}
// set backward histo data of the first group
fBackwardp.resize(backward[0].size());
fBackwardm.resize(backward[0].size());
for (UInt_t i=0; i<fBackwardp.size(); i++) {
fBackwardp[i] = backward[0][i];
fBackwardm[i] = backward[1][i];
}
@ -1529,7 +1536,11 @@ Bool_t PRunAsymmetryBNMR::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *glo
// feed all T0's
// first init T0's, T0's are stored as (forward T0, backward T0, etc.)
fT0s.clear();
fT0s.resize(2*forwardHistoNo.size());
// this strange fT0 size estimate is needed in case #forw histos != #back histos
size_t size = 2*forwardHistoNo.size();
if (backwardHistoNo.size() > forwardHistoNo.size())
size = 2*backwardHistoNo.size();
fT0s.resize(size);
for (UInt_t i=0; i<fT0s.size(); i++) {
fT0s[i] = -1.0;
}
@ -1596,6 +1607,8 @@ Bool_t PRunAsymmetryBNMR::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *glo
std::cerr << std::endl;
return false;
}
}
for (UInt_t i=0; i<backwardHistoNo.size(); i++) {
if ((fT0s[2*i+1] < 0) || (fT0s[2*i+1] > static_cast<Int_t>(runData->GetDataBin(backwardHistoNo[i])->size()))) {
std::cerr << std::endl << ">> PRunAsymmetryBNMR::PrepareData(): **ERROR** t0 data bin (" << fT0s[2*i+1] << ") doesn't make any sense!";
std::cerr << std::endl << ">> backwardHistoNo " << backwardHistoNo[i];

View File

@ -584,16 +584,6 @@ Bool_t PRunAsymmetryRRF::PrepareData()
return false;
}
}
if (forwardHistoNo.size() != backwardHistoNo.size()) {
std::cerr << std::endl << ">> PRunAsymmetryRRF::PrepareData(): **PANIC ERROR**:";
std::cerr << std::endl << ">> # of forward histograms different from # of backward histograms.";
std::cerr << std::endl << ">> Will quit :-(";
std::cerr << std::endl;
// clean up
forwardHistoNo.clear();
backwardHistoNo.clear();
return false;
}
// keep the time resolution in (us)
fTimeResolution = runData->GetTimeResolution()/1.0e3;
@ -608,11 +598,13 @@ Bool_t PRunAsymmetryRRF::PrepareData()
// keep the histo of each group at this point (addruns handled below)
std::vector<PDoubleVector> forward, backward;
forward.resize(forwardHistoNo.size()); // resize to number of groups
backward.resize(backwardHistoNo.size()); // resize to numer of groups
for (UInt_t i=0; i<forwardHistoNo.size(); i++) {
forward[i].resize(runData->GetDataBin(forwardHistoNo[i])->size());
backward[i].resize(runData->GetDataBin(backwardHistoNo[i])->size());
forward[i] = *runData->GetDataBin(forwardHistoNo[i]);
}
backward.resize(backwardHistoNo.size()); // resize to number of groups
for (UInt_t i=0; i<backwardHistoNo.size(); i++) {
backward[i].resize(runData->GetDataBin(backwardHistoNo[i])->size());
backward[i] = *runData->GetDataBin(backwardHistoNo[i]);
}
@ -1281,7 +1273,11 @@ Bool_t PRunAsymmetryRRF::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *glob
// feed all T0's
// first init T0's, T0's are stored as (forward T0, backward T0, etc.)
fT0s.clear();
fT0s.resize(2*forwardHistoNo.size());
// this strange fT0 size estimate is needed in case #forw histos != #back histos
size_t size = 2*forwardHistoNo.size();
if (backwardHistoNo.size() > forwardHistoNo.size())
size = 2*backwardHistoNo.size();
fT0s.resize(size);
for (UInt_t i=0; i<fT0s.size(); i++) {
fT0s[i] = -1.0;
}
@ -1348,6 +1344,8 @@ Bool_t PRunAsymmetryRRF::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *glob
std::cerr << std::endl;
return false;
}
}
for (UInt_t i=0; i<backwardHistoNo.size(); i++) {
if ((fT0s[2*i+1] < 0) || (fT0s[2*i+1] > static_cast<Int_t>(runData->GetDataBin(backwardHistoNo[i])->size()))) {
std::cerr << std::endl << ">> PRunAsymmetryRRF::PrepareData(): **ERROR** t0 data bin (" << fT0s[2*i+1] << ") doesn't make any sense!";
std::cerr << std::endl << ">> backwardHistoNo " << backwardHistoNo[i];

View File

@ -604,8 +604,8 @@ Bool_t PRunMuMinus::PrepareFitData(PRawRunData* runData, const UInt_t histoNo)
Int_t t0 = static_cast<Int_t>(fT0s[0]);
Double_t value = 0.0;
// data start at data_start-t0
// time shifted so that packing is included correctly, i.e. t0 == t0 after packing
fData.SetDataTimeStart(fTimeResolution*(static_cast<Double_t>(fGoodBins[0])-static_cast<Double_t>(t0)+static_cast<Double_t>(fPacking-1)/2.0));
// data start time = (binStart - 0.5) + pack/2 - t0, with pack and binStart used as double
fData.SetDataTimeStart(fTimeResolution*((static_cast<Double_t>(fGoodBins[0])-0.5) + static_cast<Double_t>(fPacking)/2.0 - static_cast<Double_t>(t0)));
fData.SetDataTimeStep(fTimeResolution*fPacking);
for (Int_t i=fGoodBins[0]; i<fGoodBins[1]; i++) {
if (fPacking == 1) {
@ -710,9 +710,8 @@ Bool_t PRunMuMinus::PrepareRawViewData(PRawRunData* runData, const UInt_t histoN
// everything looks fine, hence fill data set
Int_t t0 = static_cast<Int_t>(fT0s[0]);
Double_t value = 0.0;
// data start at data_start-t0
// time shifted so that packing is included correctly, i.e. t0 == t0 after packing
fData.SetDataTimeStart(fTimeResolution*(static_cast<Double_t>(start)-static_cast<Double_t>(t0)+static_cast<Double_t>(packing-1)/2.0));
// data start time = (binStart - 0.5) + pack/2 - t0, with pack and binStart used as double
fData.SetDataTimeStart(fTimeResolution*((static_cast<Double_t>(start)-0.5) + static_cast<Double_t>(packing)/2.0 - static_cast<Double_t>(t0)));
fData.SetDataTimeStep(fTimeResolution*packing);
for (Int_t i=start; i<end; i++) {

View File

@ -888,7 +888,7 @@ Bool_t PRunSingleHisto::PrepareFitData(PRawRunData* runData, const UInt_t histoN
normalizer = fPacking * (fTimeResolution * 1.0e3); // fTimeResolution us->ns
// data start at data_start-t0
// time shifted so that packing is included correctly, i.e. t0 == t0 after packing
fData.SetDataTimeStart(fTimeResolution*(static_cast<Double_t>(fGoodBins[0])-static_cast<Double_t>(t0)+static_cast<Double_t>(fPacking-1)/2.0));
fData.SetDataTimeStart(fTimeResolution*((static_cast<Double_t>(fGoodBins[0])-0.5) + static_cast<Double_t>(fPacking)/2.0 - static_cast<Double_t>(t0)));
fData.SetDataTimeStep(fTimeResolution*fPacking);
for (Int_t i=fGoodBins[0]; i<fGoodBins[1]; i++) {
if (fPacking == 1) {
@ -991,9 +991,8 @@ Bool_t PRunSingleHisto::PrepareRawViewData(PRawRunData* runData, const UInt_t hi
// everything looks fine, hence fill data set
Int_t t0 = static_cast<Int_t>(fT0s[0]);
Double_t value = 0.0;
// data start at data_start-t0
// time shifted so that packing is included correctly, i.e. t0 == t0 after packing
fData.SetDataTimeStart(fTimeResolution*(static_cast<Double_t>(start)-static_cast<Double_t>(t0)+static_cast<Double_t>(packing-1)/2.0));
// data start time = (binStart - 0.5) + pack/2 - t0, with pack and binStart used as double
fData.SetDataTimeStart(fTimeResolution*((static_cast<Double_t>(start)-0.5) + static_cast<Double_t>(packing)/2.0 - static_cast<Double_t>(t0)));
fData.SetDataTimeStep(fTimeResolution*packing);
for (Int_t i=start; i<end; i++) {
@ -1247,8 +1246,8 @@ Bool_t PRunSingleHisto::PrepareViewData(PRawRunData* runData, const UInt_t histo
Double_t rrf_val = 0.0;
Double_t time = 0.0;
// data start at data_start-t0 shifted by (pack-1)/2
fData.SetDataTimeStart(fTimeResolution*(static_cast<Double_t>(start)-static_cast<Double_t>(t0)+static_cast<Double_t>(packing-1)/2.0));
// data start time = (binStart - 0.5) + pack/2 - t0, with pack and binStart used as double
fData.SetDataTimeStart(fTimeResolution*((static_cast<Double_t>(start)-0.5) + static_cast<Double_t>(packing)/2.0 - static_cast<Double_t>(t0)));
fData.SetDataTimeStep(fTimeResolution*packing);
// data is always normalized to (per nsec!!)
@ -1257,7 +1256,8 @@ Bool_t PRunSingleHisto::PrepareViewData(PRawRunData* runData, const UInt_t histo
for (Int_t i=start; i<end; i++) {
if (((i-start) % packing == 0) && (i != start)) { // fill data
value *= dataNorm;
time = ((static_cast<Double_t>(i)-static_cast<Double_t>(packing-1)/2.0)-t0)*fTimeResolution;
// since the packing counter is already at the end of the bin, the time needs be shifted back by pack*time_resolution
time = (((static_cast<Double_t>(i)-0.5) + static_cast<Double_t>(packing)/2.0 - static_cast<Double_t>(t0)))*fTimeResolution - static_cast<Double_t>(packing)*fTimeResolution;
expval = TMath::Exp(+time/tau)/N0;
fData.AppendValue(-1.0+expval*(value-bkg));
fData.AppendErrorValue(expval*TMath::Sqrt(value*dataNorm));
@ -1316,7 +1316,7 @@ Bool_t PRunSingleHisto::PrepareViewData(PRawRunData* runData, const UInt_t histo
// calculate theory
Double_t theoryValue;
UInt_t size = fForward.size()/packing;
Int_t factor = 8; // 8 times more points for the theory (if fTheoAsData == false)
const Int_t factor = 8; // 8 times more points for the theory (if fTheoAsData == false)
UInt_t rebinRRF = 0;
if (wRRF == 0) { // no RRF

View File

@ -53,7 +53,10 @@
#include <TFolder.h>
#include <TString.h>
#ifdef HAVE_GIT_REV_H
#include "git-revision.h"
#endif
#include "PStartupHandler.h"
#include "TMusrRunHeader.h"
#include "TLemRunHeader.h"
@ -447,7 +450,8 @@ int dump_header_mud(const std::string fileName, const std::string fileFormat)
// start time
time_t tval;
struct tm *dt;
success = MUD_getTimeBegin( fh, (UINT32*)&tval );
success = MUD_getTimeBegin( fh, &val );
tval = static_cast<time_t>(val);
if (success) {
dt = localtime(static_cast<const time_t*>(&tval));
assert(dt);
@ -457,7 +461,8 @@ int dump_header_mud(const std::string fileName, const std::string fileFormat)
std::cout << std::endl << "Run Start Time : ???";
}
// stop time
success = MUD_getTimeEnd( fh, (UINT32*)&tval );
success = MUD_getTimeEnd( fh, &val );
tval = static_cast<time_t>(val);
if (success) {
dt = localtime(static_cast<const time_t*>(&tval));
assert(dt);
@ -699,12 +704,16 @@ std::string dump_create_fln(std::string runNo, std::string year, std::string fil
char fln[64];
char ptatdc[8];
memset(ptatdc, '\0', sizeof(ptatdc));
if (pta)
strcpy(ptatdc, "pta");
else
strcpy(ptatdc, "tdc");
if (boost::iequals(fileFormat, "MusrRoot") || boost::iequals(fileFormat, "ROOT")) {
snprintf(fln, sizeof(fln), "lem%02d_his_%04d.root", yearShort, iRunNo);
if (instrument == "") // i.e. LEM
snprintf(fln, sizeof(fln), "lem%02d_his_%04d.root", yearShort, iRunNo);
else
snprintf(fln, sizeof(fln), "deltat_%s_%s_%s_%04d.root", ptatdc, instrument.c_str(), year.c_str(), iRunNo);
} else if (boost::iequals(fileFormat, "NeXus")) {
snprintf(fln, sizeof(fln), "%s.nxs", runNo.c_str());
} else if (boost::iequals(fileFormat, "PSI-BIN")) {
@ -776,9 +785,17 @@ int main(int argc, char *argv[])
return 0;
} else if (!strcmp(argv[i], "--version") || !strcmp(argv[i], "-v")) {
#ifdef HAVE_CONFIG_H
#ifdef HAVE_GIT_REV_H
std::cout << std::endl << "dump_header version: " << PACKAGE_VERSION << ", git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << " (" << BUILD_TYPE << "), ROOT version: " << ROOT_VERSION_USED << std::endl << std::endl;
#else
std::cout << std::endl << "dump_header version: " << PACKAGE_VERSION << " (" << BUILD_TYPE << "), ROOT version: " << ROOT_VERSION_USED << std::endl << std::endl;
#endif
#else
#ifdef HAVE_GIT_REV_H
std::cout << std::endl << "dump_header git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << std::endl << std::endl;
#else
std::cout << std::endl << "dump_header version: unknown" << std::endl << std::endl;
#endif
#endif
return 0;
} else if (!strcmp(argv[i], "-rn") || !strcmp(argv[i], "--runNo")) {
@ -962,7 +979,10 @@ int main(int argc, char *argv[])
for (unsigned int i=0; i<pathList.size(); i++) {
if (boost::iequals(fileFormat, "MusrRoot") || boost::iequals(fileFormat, "ROOT") ||
boost::iequals(fileFormat, "WKM")) {
pathFln = pathList[i] + "/" + year + "/" + fileName;
if (instrument == "") // i.e. LEM
pathFln = pathList[i] + "/" + year + "/" + fileName;
else
pathFln = pathList[i] + "/d" + year + "/tdc/root/" + fileName;
} else {
if (pta)
pathFln = pathList[i] + "/d" + year + "/pta/" + fileName;

View File

@ -1,5 +1,7 @@
# - Nonlocal library ----------------------------------------------------------
add_subdirectory(prog)
#--- generate necessary dictionaries ------------------------------------------
set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include)
set(NONLOCAL_INC ${CMAKE_SOURCE_DIR}/src/external/Nonlocal)
@ -36,7 +38,7 @@ set(prefix "${CMAKE_INSTALL_PREFIX}")
set(exec_prefix "\$\{prefix\}")
set(libdir "\$\{exec_prefix\}/lib")
set(includedir "\$\{prefix\}/include")
set(PNL_PIPPARDFITTER_VERSION "1.1.0")
set(PNL_PIPPARDFITTER_VERSION "1.2.0")
set(PNL_PIPPARDFITTER_LIBRARY_NAME "PNL_PippardFitter")
configure_file("PNL_PippardFitter.pc.in" "PNL_PippardFitter.pc" @ONLY)

View File

@ -0,0 +1,4 @@
// dnlf_config.h
#define PROJECT_VERSION "@PROJECT_VERSION@"

View File

@ -0,0 +1,39 @@
#--- dump_nonlocal_field ------------------------------------------------------
project(dump_nonlocal_field VERSION 1.0.0 LANGUAGES C CXX)
#--- feed dnlf_config.h -----------------------------------------
set(HAVE_DNLF_CONFIG_H 1 CACHE INTERNAL "dnlf_config.h is available")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/dnlf_config.h.in ${CMAKE_CURRENT_BINARY_DIR}/dnlf_config.h)
#--- start create git-revision.h ----------------------------------------------
if (IS_GIT_REPO)
set(HAVE_GIT_REV_H "-DHAVE_GIT_REV_H")
else (IS_GIT_REPO)
set(HAVE_GIT_REV_H "")
endif (IS_GIT_REPO)
add_executable(dump_nonlocal_field dump_nonlocal_field.cpp)
target_compile_options(dump_nonlocal_field BEFORE PRIVATE "-DHAVE_CONFIG_H" "-DHAVE_DNLF_CONFIG_H" "${HAVE_GIT_REV_H}")
target_include_directories(dump_nonlocal_field
BEFORE PRIVATE
$<BUILD_INTERFACE:${Boost_INCLUDE_DIR}>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/..>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/include>
)
target_link_libraries(dump_nonlocal_field ${ROOT_LIBRARIES} ${MUSRFIT_LIBS} PNL_PippardFitter)
#--- installation info --------------------------------------------------------
install(
TARGETS
dump_nonlocal_field
RUNTIME DESTINATION
bin
)

View File

@ -0,0 +1,299 @@
/***************************************************************************
dump_nonlocal_field.cpp
Author: Andreas Suter
e-mail: andreas.suter@psi.ch
***************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2021 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <cstring>
#include <boost/algorithm/string.hpp>
#include "PNL_PippardFitter.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef HAVE_DNLF_CONFIG_H
#include "dnlf_config.h"
#endif
#ifdef HAVE_GIT_REV_H
#include "git-revision.h"
#endif
//-----------------------------------------------------------------------------
/**
* <p>dump_nonlocal_field synatx console output.
*/
void dnlf_syntax()
{
std::cout << std::endl;
std::cout << "usage: dump_nonlocal_field [<msr-file> --out <field-dump> [--step <stepVal>] | --version | --help]" << std::endl;
std::cout << " <msr-file> : nonlocal msr-file name." << std::endl;
std::cout << " --out <field-dump> : ascii field dump output file name." << std::endl;
std::cout << " --step <stepVal> : this optional parameters allows to define the z-value step size in (nm)." << std::endl;
std::cout << " --version : dumps the version" << std::endl;
std::cout << " --help : will dump this help" << std::endl;
std::cout << std::endl << std::endl;
}
//-----------------------------------------------------------------------------
/**
* <p> reads the msr-file and estracts the necessary parameter information.
*
* @param fln msr-file name
* @param param parameter vector needed to calculate the magnetic field
*
* @return true, if everything went smoothly, false otherwise.
*/
bool dnlf_read_msr(const std::string fln, std::vector<double> &param)
{
std::ifstream fin(fln.c_str(), std::ifstream::in);
if (!fin.is_open()) {
std::cerr << std::endl;
std::cerr << "**ERROR** couldn't open msr-file: " << fln << std::endl;
std::cerr << std::endl;
return false;
}
std::vector<std::string> msrData;
std::string line;
while (fin.good()) {
std::getline(fin, line);
msrData.push_back(line);
}
fin.close();
// find userFcn line
line = "";
for (int i=0; i<msrData.size(); i++) {
if (msrData[i].find("userFcn") != std::string::npos) {
line = msrData[i];
if (line.find("PNL_PippardFitter") != std::string::npos)
break;
line = "";
}
}
if (line.empty()) {
std::cerr << std::endl;
std::cerr << "**ERROR** msr-file: " << fln << " seems not a proper nonlocal fit file." << std::endl;
std::cerr << std::endl;
return false;
}
// tokenize parameter part.
size_t pos=0;
pos = line.find(" PNL_PippardFitter");
line = line.substr(pos+18); // remove the 'userFcn libPNL_PippardFitter PNL_PippardFitter' part
boost::algorithm::trim(line); // remove leading/trailing whitespaces
std::vector<std::string> tok;
boost::split(tok, line, boost::is_any_of(" \t"), boost::token_compress_on);
std::vector<int> paramIdx;
int ival;
for (int i=0; i<tok.size(); i++) {
try {
ival = std::stoi(tok[i]);
}
catch(std::exception& e) {
ival = 0;
}
paramIdx.push_back(ival);
}
// find parameter value which corresponds to param index
bool inFitParamBlock(false);
std::map<int, double> paramMap;
double dval;
for (int i=0; i<msrData.size(); i++) {
if (inFitParamBlock) {
if (msrData[i].empty()) {
continue;
} else if (msrData[i][0] == '#') {
continue;
} else if (msrData[i].find("THEORY") != std::string::npos) {
inFitParamBlock = false;
break;
} else {
tok.clear();
line = msrData[i];
boost::algorithm::trim(line); // remove leading/trailing whitespaces
boost::split(tok, line, boost::is_any_of(" \t"), boost::token_compress_on);
if (tok.size() < 3) {
std::cerr << "**ERROR** bug in the fit parameter block!" << std::endl;
std::cerr << "'" << msrData[i] << "'" << std::endl;
return false;
}
// param index
try {
ival = std::stoi(tok[0]);
}
catch(std::exception& e) {
ival = 0;
}
// param value
try {
dval = std::stod(tok[2]);
}
catch(std::exception& e) {
dval = 0.0;
}
paramMap[ival] = dval;
}
} else {
if (msrData[i].find("FITPARAMETER") != std::string::npos) {
inFitParamBlock = true;
}
}
}
for (int i=0; i<paramIdx.size(); i++) {
if (paramIdx[i] != 0)
dval = paramMap.find(paramIdx[i])->second;
else
dval = 0.0;
param.push_back(dval);
}
return true;
}
int main(int argc, char* argv[])
{
std::string msrFileName("");
std::string outFileName("");
double step(0.0);
bool show_syntax(false);
if (argc == 1) {
dnlf_syntax();
return 0;
}
for (int i=0; i<argc; i++) {
if (argv[i][0] != '-') { // must be the msr-file name
msrFileName = argv[i];
} else if (!strcmp(argv[i], "--version")) {
#ifdef HAVE_CONFIG_H
#ifdef HAVE_GIT_REV_H
std::cout << std::endl << "dump_nonlocal_field version: " << PROJECT_VERSION << " (" << PACKAGE_VERSION << "), git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << " (" << BUILD_TYPE << "), ROOT version: " << ROOT_VERSION_USED << std::endl << std::endl;
#else
std::cout << std::endl << "dump_nonlocal_field version: " << PROJECT_VERSION << " (" << PACKAGE_VERSION << "/" << BUILD_TYPE << "), ROOT version: " << ROOT_VERSION_USED << std::endl << std::endl;
#endif
#else
#ifdef HAVE_GIT_REV_H
std::cout << std::endl << "dump_nonlocal_field git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << std::endl << std::endl;
#else
std::cout << std::endl << "dump_nonlocal_field version: unknown" << std::endl << std::endl;
#endif
#endif
return 0;
} else if (!strcmp(argv[i], "--help")) {
dnlf_syntax();
return 0;
} else if (!strcmp(argv[i], "--out")) {
if (i < argc-1) {
outFileName = argv[i+1];
i++;
} else {
std::cerr << std::endl << "dump_nonlocal_field: **ERROR** found option --out without <field-dump>" << std::endl;
show_syntax = true;
break;
}
} else if (!strcmp(argv[i], "--step")) {
if (i < argc-1) {
try {
step = std::stod(argv[i+1]);
}
catch(std::exception& e) {
std::cout << "dump_nonlocal_field: **ERROR** <stepVal> '" << argv[i+1] << "' seems not to be a double." << std::endl;
show_syntax = true;
break;
}
i++;
} else {
std::cerr << std::endl << "dump_nonlocal_field: **ERROR** found option --step without <stepVal>" << std::endl;
show_syntax = true;
break;
}
}
}
if (show_syntax) {
dnlf_syntax();
return -1;
}
std::vector<double> param;
if (!dnlf_read_msr(msrFileName, param)) {
return -2;
}
// calculate field and write it to file
PNL_PippardFitterGlobal pip;
pip.CalculateField(param);
std::ofstream fout(outFileName.c_str(), std::ofstream::out);
if (!fout.is_open()) {
std::cout << std::endl;
std::cerr << "**ERROR** can not write to file '" << outFileName << "'." << std::endl;
std::cout << std::endl;
return -3;
}
// write header
fout << "% z (nm), field (G)" << std::endl;
// write data
double z=0.0;
if (step == 0.0)
step = 0.1;
double prevField=0.0, field=0.0;
bool done(false);
double deadLayer = param[8];
double b0 = param[6];
do {
if (z < deadLayer) {
fout << z << ", " << b0 << std::endl;
} else {
field = pip.GetMagneticField(z-deadLayer);
fout << z << ", " << b0*field << std::endl;
if (fabs(prevField-field) < 1.0e-10)
done = true;
prevField = field;
}
z += step;
} while (!done);
fout.close();
return 0;
}

View File

@ -422,9 +422,7 @@ MUD_read( FILE* fin, MUD_IO_OPT io_opt )
*/
if( ( pos = ftell( fin ) ) == EOF ) return( NULL );
if( fread( &size, 4, 1, fin ) == 0 ) return( NULL );
#if !defined(__arm64)
bdecode_4( &size, &size ); /* byte ordering !!! */
#endif // !defined(__arm64)
if( fseek( fin, pos, 0 ) == EOF ) return( NULL );
#ifdef DEBUG

View File

@ -818,10 +818,10 @@ PNeXusDetector2::PNeXusDetector2()
fNoOfBins = -1;
fT0Tag = -1;
fT0 = 0;
fFirstGoodBin = 0;
fLastGoodBin = 0;
fHisto = 0;
fT0 = nullptr;
fFirstGoodBin = nullptr;
fLastGoodBin = nullptr;
fHisto = nullptr;
}
//------------------------------------------------------------------------------------------
@ -837,19 +837,19 @@ PNeXusDetector2::~PNeXusDetector2()
if (fT0) {
delete [] fT0;
fT0 = 0;
fT0 = nullptr;
}
if (fFirstGoodBin) {
delete [] fFirstGoodBin;
fFirstGoodBin = 0;
fFirstGoodBin = nullptr;
}
if (fLastGoodBin) {
delete [] fLastGoodBin;
fLastGoodBin = 0;
fLastGoodBin = nullptr;
}
if (fHisto) {
delete [] fHisto;
fHisto = 0;
fHisto = nullptr;
}
}
@ -919,10 +919,16 @@ bool PNeXusDetector2::IsValid(bool strict)
*/
int PNeXusDetector2::GetT0(int idxp, int idxs)
{
int result = -1;
int result = -1;
if (fT0Tag == 1) { // there is only ONE t0 present
if (fT0 != nullptr)
result = *fT0;
return result;
}
if ((idxp < 0) && (idxs < 0)) { // assumption: there is only ONE t0 for all spectra
if (fT0 != 0) {
if (fT0 != nullptr) {
result = *fT0;
}
} else if ((idxp < 0) && (idxs >= 0)) { // assumption: t0's are represented as t0[ns]
@ -1031,17 +1037,24 @@ int PNeXusDetector2::GetFirstGoodBin(int idxp, int idxs)
{
int result = -1;
if (fT0Tag == 1) { // there is only ONE t0 present
if (fT0 != nullptr)
result = *fFirstGoodBin;
return result;
}
if ((idxp < 0) && (idxs < 0)) { // assumption: there is only ONE t0 for all spectra
if (fFirstGoodBin != 0) {
if (fFirstGoodBin != nullptr) {
result = *fFirstGoodBin;
}
} else if ((idxp < 0) && (idxs >= 0)) { // assumptions: fgb's are represented as fgb[ns]
if (idxs < fNoOfSpectra) {
if ((idxs < fNoOfSpectra) && (fFirstGoodBin != nullptr)) {
result = *(fFirstGoodBin+idxs);
}
} else if ((idxp >= 0) && (idxs >= 0)) { // assumption: fgb's are represented as fgb[np][ns]
if ((idxp < fNoOfPeriods) || (idxs < fNoOfSpectra)) {
result = *(fFirstGoodBin+idxp*fNoOfSpectra+idxs);
if (fFirstGoodBin != nullptr)
result = *(fFirstGoodBin+idxp*fNoOfSpectra+idxs);
}
} else {
result = -1;
@ -1141,17 +1154,24 @@ int PNeXusDetector2::GetLastGoodBin(int idxp, int idxs)
{
int result = -1;
if (fT0Tag == 1) { // there is only ONE t0 present
if (fT0 != nullptr)
result = *fLastGoodBin;
return result;
}
if ((idxp < 0) && (idxs < 0)) { // assumption: there is only ONE t0 for all spectra
if (fLastGoodBin != 0) {
if (fLastGoodBin != nullptr) {
result = *fLastGoodBin;
}
} else if ((idxp < 0) && (idxs >= 0)) { // assumption: lgb's are represented as lgb[ns]
if (idxs < fNoOfSpectra) {
if ((idxs < fNoOfSpectra) && (fLastGoodBin != nullptr)) {
result = *(fLastGoodBin+idxs);
}
} else if ((idxp >= 0) && (idxs >= 0)) { // assumption: lgb's are represented as lgb[np][ns]
if ((idxp < fNoOfPeriods) || (idxs < fNoOfSpectra)) {
result = *(fLastGoodBin+idxp*fNoOfSpectra+idxs);
if (fLastGoodBin != nullptr)
result = *(fLastGoodBin+idxp*fNoOfSpectra+idxs);
}
} else {
result = -1;
@ -3398,6 +3418,14 @@ int PNeXus::ReadFileIdf2()
return NX_ERROR;
}
// beamline
if (SearchInGroup("beamline", "name", nxname, nxclass, dataType)) {
if (!ErrorHandler(NXopendata(fFileHandle, "beamline"), PNEXUS_OPEN_DATA_ERROR, "couldn't open 'beamline' data in NXentry!")) return NX_ERROR;
if (!ErrorHandler(GetStringData(str), PNEXUS_GET_DATA_ERROR, "couldn't read 'beamline' data in NXentry!")) return NX_ERROR;
if (!ErrorHandler(NXclosedata(fFileHandle), PNEXUS_CLOSE_DATA_ERROR, "couldn't close 'beamline' data in NXentry!")) return NX_ERROR;
fNxEntry2->GetInstrument()->GetBeamline()->SetName(str);
}
// definition
if (!ErrorHandler(NXopendata(fFileHandle, "definition"), PNEXUS_OPEN_DATA_ERROR, "couldn't open 'definition' data in NXentry!")) return NX_ERROR;
if (!ErrorHandler(GetStringData(str), PNEXUS_GET_DATA_ERROR, "couldn't read 'definition' data in NXentry!")) return NX_ERROR;
@ -3576,26 +3604,37 @@ int PNeXus::ReadFileIdf2()
// close group NXsource
NXclosegroup(fFileHandle);
// open group NXbeamline
if (!ErrorHandler(NXopengroup(fFileHandle, "beamline", "NXbeamline"), PNEXUS_GROUP_OPEN_ERROR, "couldn't open NeXus subgroup beamline in NXinstrument!")) return NX_ERROR;
if (SearchInGroup("beamline", "name", nxname, nxclass, dataType)) {
if (!ErrorHandler(NXopengroup(fFileHandle, "beamline", "NXbeamline"), PNEXUS_GROUP_OPEN_ERROR, "couldn't open NeXus subgroup beamline in NXinstrument!")) return NX_ERROR;
// beamline name
if (!ErrorHandler(NXopendata(fFileHandle, "beamline"), PNEXUS_OPEN_DATA_ERROR, "couldn't open 'beamline' data in NXbeamline!")) return NX_ERROR;
if (!ErrorHandler(GetStringData(str), PNEXUS_GET_DATA_ERROR, "couldn't read 'beamline' data in NXbeamline!")) return NX_ERROR;
if (!ErrorHandler(NXclosedata(fFileHandle), PNEXUS_CLOSE_DATA_ERROR, "couldn't close 'beamline' data in NXbeamline!")) return NX_ERROR;
fNxEntry2->GetInstrument()->GetBeamline()->SetName(str);
// beamline name
if (!ErrorHandler(NXopendata(fFileHandle, "beamline"), PNEXUS_OPEN_DATA_ERROR, "couldn't open 'beamline' data in NXbeamline!")) return NX_ERROR;
if (!ErrorHandler(GetStringData(str), PNEXUS_GET_DATA_ERROR, "couldn't read 'beamline' data in NXbeamline!")) return NX_ERROR;
if (!ErrorHandler(NXclosedata(fFileHandle), PNEXUS_CLOSE_DATA_ERROR, "couldn't close 'beamline' data in NXbeamline!")) return NX_ERROR;
fNxEntry2->GetInstrument()->GetBeamline()->SetName(str);
// close group NXbeamline
NXclosegroup(fFileHandle);
// close group NXbeamline
NXclosegroup(fFileHandle);
} else {
std::cerr << "**WARNING** in class NXinstrument the object NXbeamline with name 'beamline' is missing!" << std::endl;
std::cerr << " Complain at the facility where you got this data file from!" << std::endl;
}
// open group NXdetector
// open group NXdetector in instrument (NXinstrument)
if (!ErrorHandler(NXopengroup(fFileHandle, "detector_1", "NXdetector"), PNEXUS_GROUP_OPEN_ERROR, "couldn't open NeXus subgroup detector_1 in NXinstrument!")) return NX_ERROR;
// description
if (!ErrorHandler(NXopendata(fFileHandle, "description"), PNEXUS_OPEN_DATA_ERROR, "couldn't open 'description' data in NXdetector!")) return NX_ERROR;
if (!ErrorHandler(GetStringData(str), PNEXUS_GET_DATA_ERROR, "couldn't read 'description' data in NXdetector!")) return NX_ERROR;
if (!ErrorHandler(NXclosedata(fFileHandle), PNEXUS_CLOSE_DATA_ERROR, "couldn't close 'description' data in NXdetector!")) return NX_ERROR;
fNxEntry2->GetInstrument()->GetDetector()->SetDescription(str);
if (SearchInGroup("description", "name", nxname, nxclass, dataType)) {
if (!ErrorHandler(NXopendata(fFileHandle, "description"), PNEXUS_OPEN_DATA_ERROR, "couldn't open 'description' data in NXdetector!")) return NX_ERROR;
if (!ErrorHandler(GetStringData(str), PNEXUS_GET_DATA_ERROR, "couldn't read 'description' data in NXdetector!")) return NX_ERROR;
if (!ErrorHandler(NXclosedata(fFileHandle), PNEXUS_CLOSE_DATA_ERROR, "couldn't close 'description' data in NXdetector!")) return NX_ERROR;
fNxEntry2->GetInstrument()->GetDetector()->SetDescription(str);
} else {
std::cerr << "**WARNING** in class NXdetector to object NX_CHAR with name 'description' is missing!" << std::endl;
std::cerr << " Complain at the facility where you got this data file from!" << std::endl;
}
// get the time resolution. This is a little bit complicated since it is either present as 'histogram_resolution' or needs to be extracted from the 'raw_time' vector
// 1st check if 'histogram_resolution' is found
@ -3607,10 +3646,10 @@ int PNeXus::ReadFileIdf2()
fNxEntry2->GetInstrument()->GetDetector()->SetTimeResolution((double)fval, str);
} else if (SearchInGroup("resolution", "name", nxname, nxclass, dataType)) { // 2nd check if 'resolution' is found
if (!ErrorHandler(NXopendata(fFileHandle, "resolution"), PNEXUS_OPEN_DATA_ERROR, "couldn't open 'resolution' data in NXdetector!")) return NX_ERROR;
if (!ErrorHandler(NXgetdata(fFileHandle, &fval), PNEXUS_GET_DATA_ERROR, "couldn't read 'resolution' data in NXdetector!")) return NX_ERROR;
if (!ErrorHandler(NXgetdata(fFileHandle, &ival), PNEXUS_GET_DATA_ERROR, "couldn't read 'resolution' data in NXdetector!")) return NX_ERROR;
if (!ErrorHandler(GetStringAttr("units", str), PNEXUS_GET_ATTR_ERROR, "couldn't read time resolution units in NXdetector!")) return NX_ERROR;
if (!ErrorHandler(NXclosedata(fFileHandle), PNEXUS_CLOSE_DATA_ERROR, "couldn't close 'resolution' data in NXdetector!")) return NX_ERROR;
fNxEntry2->GetInstrument()->GetDetector()->SetTimeResolution((double)fval, str);
fNxEntry2->GetInstrument()->GetDetector()->SetTimeResolution((double)ival, str);
} else { // 3nd 'histogram_resolution' is not present, hence extract the time resolution from the 'raw_time' vector
if (!ErrorHandler(NXopendata(fFileHandle, "raw_time"), PNEXUS_OPEN_DATA_ERROR, "couldn't open 'raw_time' data in NXdetector!")) return NX_ERROR;
std::vector<double> rawTime;
@ -3626,6 +3665,51 @@ int PNeXus::ReadFileIdf2()
// check the dimensions of 'counts'
if (!ErrorHandler(NXgetinfo(fFileHandle, &rank, dims, &type), PNEXUS_GET_META_INFO_ERROR, "couldn't get 'counts' info in NXdetector!")) return NX_ERROR;
// check if last_good_bin, first_good_bin, and t0_bins are defined as attributes
int attLen = 1, attType = NX_INT32;
if (SearchAttrInData("first_good_bin", attLen, attType)) {
char cstr[1204];
memset(cstr, '\0', sizeof(cstr));
strncpy(cstr, "first_good_bin", sizeof(cstr));
status = NXgetattr(fFileHandle, cstr, (void*)&ival, &attLen, &attType);
fNxEntry2->GetInstrument()->GetDetector()->SetT0Tag(1); // a single set for t0, fgb, lgb is likely given
int *i_data_ptr = new int;
*i_data_ptr = ival;
if (!fNxEntry2->GetInstrument()->GetDetector()->SetFirstGoodBin(i_data_ptr)) {
std::cerr << std::endl << ">> **ERROR** " << fNxEntry2->GetInstrument()->GetDetector()->GetErrorMsg() << std::endl;
return NX_ERROR;
}
}
if (SearchAttrInData("last_good_bin", attLen, attType)) {
char cstr[1204];
memset(cstr, '\0', sizeof(cstr));
strncpy(cstr, "last_good_bin", sizeof(cstr));
status = NXgetattr(fFileHandle, cstr, (void*)&ival, &attLen, &attType);
fNxEntry2->GetInstrument()->GetDetector()->SetT0Tag(1); // a single set for t0, fgb, lgb is likely given
int *i_data_ptr = new int;
*i_data_ptr = ival;
if (!fNxEntry2->GetInstrument()->GetDetector()->SetLastGoodBin(i_data_ptr)) {
std::cerr << std::endl << ">> **ERROR** " << fNxEntry2->GetInstrument()->GetDetector()->GetErrorMsg() << std::endl;
return NX_ERROR;
}
}
if (SearchAttrInData("t0_bin", attLen, attType)) {
char cstr[1204];
memset(cstr, '\0', sizeof(cstr));
strncpy(cstr, "t0_bin", sizeof(cstr));
status = NXgetattr(fFileHandle, cstr, (void*)&ival, &attLen, &attType);
fNxEntry2->GetInstrument()->GetDetector()->SetT0Tag(1); // a single set for t0, fgb, lgb is likely given
int *i_data_ptr = new int;
*i_data_ptr = ival;
if (!fNxEntry2->GetInstrument()->GetDetector()->SetT0(i_data_ptr)) {
std::cerr << std::endl << ">> **ERROR** " << fNxEntry2->GetInstrument()->GetDetector()->GetErrorMsg() << std::endl;
return NX_ERROR;
}
}
// calculate the needed size
size = dims[0];
for (int i=1; i<rank; i++)
@ -3713,320 +3797,323 @@ int PNeXus::ReadFileIdf2()
if (!ErrorHandler(NXclosedata(fFileHandle), PNEXUS_CLOSE_DATA_ERROR, "couldn't close 'spectrum_index' data in NXdetector!")) return NX_ERROR;
// handle t0's
if (SearchInGroup("time_zero_bin", "name", nxname, nxclass, dataType)) { // check for 'time_zero_bin'
if (!ErrorHandler(NXopendata(fFileHandle, "time_zero_bin"), PNEXUS_OPEN_DATA_ERROR, "couldn't open 'time_zero_bin' data in NXdetector!")) return NX_ERROR;
// only handle t0, fgb, lgb, if they are not already set as an attribute of /raw_data_1/instrument/detector_1/counts
if (fNxEntry2->GetInstrument()->GetDetector()->GetT0Tag() == -1) {
// handle t0's
if (SearchInGroup("time_zero_bin", "name", nxname, nxclass, dataType)) { // check for 'time_zero_bin'
if (!ErrorHandler(NXopendata(fFileHandle, "time_zero_bin"), PNEXUS_OPEN_DATA_ERROR, "couldn't open 'time_zero_bin' data in NXdetector!")) return NX_ERROR;
// check the dimensions of the 'time_zero_bin' vector
if (!ErrorHandler(NXgetinfo(fFileHandle, &rank, dims, &type), PNEXUS_GET_META_INFO_ERROR, "couldn't get 'time_zero_bin' info in NXdetector!")) return NX_ERROR;
// check the dimensions of the 'time_zero_bin' vector
if (!ErrorHandler(NXgetinfo(fFileHandle, &rank, dims, &type), PNEXUS_GET_META_INFO_ERROR, "couldn't get 'time_zero_bin' info in NXdetector!")) return NX_ERROR;
if ((rank == 1) && (dims[0] == 1)) { // single t0 entry
fNxEntry2->GetInstrument()->GetDetector()->SetT0Tag(1);
} else if ((rank == 1) && (dims[0] > 1)) { // t0 of the form t0[ns]
fNxEntry2->GetInstrument()->GetDetector()->SetT0Tag(2);
} else if (rank == 2) { // t0 of the form t0[np][ns]
fNxEntry2->GetInstrument()->GetDetector()->SetT0Tag(3);
if ((rank == 1) && (dims[0] == 1)) { // single t0 entry
fNxEntry2->GetInstrument()->GetDetector()->SetT0Tag(1);
} else if ((rank == 1) && (dims[0] > 1)) { // t0 of the form t0[ns]
fNxEntry2->GetInstrument()->GetDetector()->SetT0Tag(2);
} else if (rank == 2) { // t0 of the form t0[np][ns]
fNxEntry2->GetInstrument()->GetDetector()->SetT0Tag(3);
} else {
std::cerr << std::endl << ">> **ERROR** found 'time_zero_bin' info in NXdetector with rank=" << rank << ". Do not know how to handle." << std::endl;
return NX_ERROR;
}
// calculate the needed size
size = dims[0];
for (int i=1; i<rank; i++)
size *= dims[i];
noOfElements = size;
size *= GetDataSize(type);
// allocate locale memory to get the data
char *data_ptr = new char[size];
if (data_ptr == nullptr) {
return NX_ERROR;
}
// get the data
int *i_data_ptr = (int*) data_ptr;
int status = NXgetdata(fFileHandle, i_data_ptr);
if (status != NX_OK) {
return NX_ERROR;
}
if (!fNxEntry2->GetInstrument()->GetDetector()->SetT0(i_data_ptr)) {
std::cerr << std::endl << ">> **ERROR** " << fNxEntry2->GetInstrument()->GetDetector()->GetErrorMsg() << std::endl;
return NX_ERROR;
}
// clean up
if (data_ptr) {
delete [] data_ptr;
data_ptr = nullptr;
}
if (!ErrorHandler(NXclosedata(fFileHandle), PNEXUS_CLOSE_DATA_ERROR, "couldn't close 'time_zero_bin' data in NXdetector!")) return NX_ERROR;
} else if (SearchInGroup("time_zero", "name", nxname, nxclass, dataType)) { // check for 'time_zero'
if (!ErrorHandler(NXopendata(fFileHandle, "time_zero"), PNEXUS_OPEN_DATA_ERROR, "couldn't open 'time_zero' data in NXdetector!")) return NX_ERROR;
// check the dimensions of the 'time_zero' vector
if (!ErrorHandler(NXgetinfo(fFileHandle, &rank, dims, &type), PNEXUS_GET_META_INFO_ERROR, "couldn't get 'time_zero' info in NXdetector!")) return NX_ERROR;
if ((rank == 1) && (dims[0] == 1)) { // single t0 entry
fNxEntry2->GetInstrument()->GetDetector()->SetT0Tag(1);
} else if ((rank == 1) && (dims[0] > 1)) { // t0 of the form t0[ns]
fNxEntry2->GetInstrument()->GetDetector()->SetT0Tag(2);
} else if (rank == 2) { // t0 of the form t0[np][ns]
fNxEntry2->GetInstrument()->GetDetector()->SetT0Tag(3);
} else {
std::cerr << std::endl << ">> **ERROR** found 'time_zero' info in NXdetector with rank=" << rank << ". Do not know how to handle." << std::endl;
return NX_ERROR;
}
// calculate the needed size
size = dims[0];
for (int i=1; i<rank; i++)
size *= dims[i];
noOfElements = size;
size *= GetDataSize(type);
// allocate locale memory to get the data
char *data_ptr = new char[size];
if (data_ptr == nullptr) {
return NX_ERROR;
}
// get the data
float *f_data_ptr = (float*) data_ptr;
int status = NXgetdata(fFileHandle, f_data_ptr);
if (status != NX_OK) {
return NX_ERROR;
}
if (!ErrorHandler(GetStringAttr("units", str), PNEXUS_GET_ATTR_ERROR, "couldn't read 'time_zero' units in NXdetector!")) return NX_ERROR;
// Set T0's
// check that the necessary time resolution is present
if (fNxEntry2->GetInstrument()->GetDetector()->GetTimeResolution(str) == 0.0) {
std::cerr << std::endl << ">> **ERROR** trying to set T0's based on 'time_zero'. Need a valid time resolution to do so, but this is not given." << std::endl;
return NX_ERROR;
}
// set the t0's based on the t0 time stamp and the time resolution
int *pt0 = nullptr;
if (rank == 1) {
pt0 = new int;
*pt0 = (int)(*f_data_ptr / (float)fNxEntry2->GetInstrument()->GetDetector()->GetTimeResolution(str));
} else { // rank == 2
pt0 = new int[noOfElements];
for (int i=0; i<noOfElements; i++) {
*(pt0+i) = (int)(*(f_data_ptr+i) / (float)fNxEntry2->GetInstrument()->GetDetector()->GetTimeResolution(str));
}
}
if (!fNxEntry2->GetInstrument()->GetDetector()->SetT0(pt0)) {
std::cerr << std::endl << ">> **ERROR** " << fNxEntry2->GetInstrument()->GetDetector()->GetErrorMsg() << std::endl;
return NX_ERROR;
}
// clean up
if (data_ptr) {
delete [] data_ptr;
data_ptr = nullptr;
}
std::cerr << std::endl << ">> **WARNING** found only 'time_zero' will convert it to 'time_zero_bin' values" << std::endl;
if (!ErrorHandler(NXclosedata(fFileHandle), PNEXUS_CLOSE_DATA_ERROR, "couldn't close 'time_zero' data in NXdetector!")) return NX_ERROR;
} else {
std::cerr << std::endl << ">> **ERROR** found 'time_zero_bin' info in NXdetector with rank=" << rank << ". Do not know how to handle." << std::endl;
return NX_ERROR;
std::cerr << std::endl << ">> **WARNING** found neither 'time_zero_bin' nor 'time_zero' values ..." << std::endl;
}
// calculate the needed size
size = dims[0];
for (int i=1; i<rank; i++)
size *= dims[i];
noOfElements = size;
size *= GetDataSize(type);
// handle first good bin
if (SearchInGroup("first_good_bin", "name", nxname, nxclass, dataType)) {
if (!ErrorHandler(NXopendata(fFileHandle, "first_good_bin"), PNEXUS_OPEN_DATA_ERROR, "couldn't open 'first_good_bin' data in NXdetector!")) return NX_ERROR;
// allocate locale memory to get the data
char *data_ptr = new char[size];
if (data_ptr == nullptr) {
return NX_ERROR;
}
// check the dimensions of the 'first_good_bin' vector
if (!ErrorHandler(NXgetinfo(fFileHandle, &rank, dims, &type), PNEXUS_GET_META_INFO_ERROR, "couldn't get 'first_good_bin' info in NXdetector!")) return NX_ERROR;
// get the data
int *i_data_ptr = (int*) data_ptr;
int status = NXgetdata(fFileHandle, i_data_ptr);
if (status != NX_OK) {
return NX_ERROR;
}
// calculate the needed size
size = dims[0];
for (int i=1; i<rank; i++)
size *= dims[i];
noOfElements = size;
size *= GetDataSize(type);
if (!fNxEntry2->GetInstrument()->GetDetector()->SetT0(i_data_ptr)) {
std::cerr << std::endl << ">> **ERROR** " << fNxEntry2->GetInstrument()->GetDetector()->GetErrorMsg() << std::endl;
return NX_ERROR;
}
// allocate locale memory to get the data
char *data_ptr = new char[size];
if (data_ptr == nullptr) {
return NX_ERROR;
}
// clean up
if (data_ptr) {
delete [] data_ptr;
data_ptr = nullptr;
}
// get the data
int *i_data_ptr = (int*) data_ptr;
int status = NXgetdata(fFileHandle, i_data_ptr);
if (status != NX_OK) {
return NX_ERROR;
}
if (!ErrorHandler(NXclosedata(fFileHandle), PNEXUS_CLOSE_DATA_ERROR, "couldn't close 'time_zero_bin' data in NXdetector!")) return NX_ERROR;
} else if (SearchInGroup("time_zero", "name", nxname, nxclass, dataType)) { // check for 'time_zero'
if (!ErrorHandler(NXopendata(fFileHandle, "time_zero"), PNEXUS_OPEN_DATA_ERROR, "couldn't open 'time_zero' data in NXdetector!")) return NX_ERROR;
// check the dimensions of the 'time_zero' vector
if (!ErrorHandler(NXgetinfo(fFileHandle, &rank, dims, &type), PNEXUS_GET_META_INFO_ERROR, "couldn't get 'time_zero' info in NXdetector!")) return NX_ERROR;
if (!fNxEntry2->GetInstrument()->GetDetector()->SetFirstGoodBin(i_data_ptr)) {
std::cerr << std::endl << ">> **ERROR** " << fNxEntry2->GetInstrument()->GetDetector()->GetErrorMsg() << std::endl;
return NX_ERROR;
}
if ((rank == 1) && (dims[0] == 1)) { // single t0 entry
fNxEntry2->GetInstrument()->GetDetector()->SetT0Tag(1);
} else if ((rank == 1) && (dims[0] > 1)) { // t0 of the form t0[ns]
fNxEntry2->GetInstrument()->GetDetector()->SetT0Tag(2);
} else if (rank == 2) { // t0 of the form t0[np][ns]
fNxEntry2->GetInstrument()->GetDetector()->SetT0Tag(3);
if (data_ptr) {
delete [] data_ptr;
data_ptr = nullptr;
}
if (!ErrorHandler(NXclosedata(fFileHandle), PNEXUS_CLOSE_DATA_ERROR, "couldn't close 'first_good_bin' data in NXdetector!")) return NX_ERROR;
} else if (SearchInGroup("first_good_time", "name", nxname, nxclass, dataType)) {
if (!ErrorHandler(NXopendata(fFileHandle, "first_good_time"), PNEXUS_OPEN_DATA_ERROR, "couldn't open 'first_good_time' data in NXdetector!")) return NX_ERROR;
// check the dimensions of the 'first_good_time' vector
if (!ErrorHandler(NXgetinfo(fFileHandle, &rank, dims, &type), PNEXUS_GET_META_INFO_ERROR, "couldn't get 'first_good_time' info in NXdetector!")) return NX_ERROR;
// calculate the needed size
size = dims[0];
for (int i=1; i<rank; i++)
size *= dims[i];
noOfElements = size;
size *= GetDataSize(type);
// allocate locale memory to get the data
char *data_ptr = new char[size];
if (data_ptr == nullptr) {
return NX_ERROR;
}
// get the data
float *f_data_ptr = (float*) data_ptr;
int status = NXgetdata(fFileHandle, f_data_ptr);
if (status != NX_OK) {
return NX_ERROR;
}
// set the fgb's based on the fgb time stamp and the time resolution
int *p_fgb = nullptr;
if (rank == 1) {
p_fgb = new int;
*p_fgb = (int)(*f_data_ptr / (float)fNxEntry2->GetInstrument()->GetDetector()->GetTimeResolution(str));
} else { // rank == 2
p_fgb = new int[noOfElements];
for (int i=0; i<noOfElements; i++) {
*(p_fgb+i) = (int)(*(f_data_ptr+i) / (float)fNxEntry2->GetInstrument()->GetDetector()->GetTimeResolution(str));
}
}
if (!fNxEntry2->GetInstrument()->GetDetector()->SetFirstGoodBin(p_fgb)) {
std::cerr << std::endl << ">> **ERROR** " << fNxEntry2->GetInstrument()->GetDetector()->GetErrorMsg() << std::endl;
return NX_ERROR;
}
// clean up
if (p_fgb) {
delete [] p_fgb;
p_fgb = 0;
}
if (data_ptr) {
delete [] data_ptr;
data_ptr = nullptr;
}
if (!ErrorHandler(NXclosedata(fFileHandle), PNEXUS_CLOSE_DATA_ERROR, "couldn't close 'first_good_time' data in NXdetector!")) return NX_ERROR;
} else {
std::cerr << std::endl << ">> **ERROR** found 'time_zero' info in NXdetector with rank=" << rank << ". Do not know how to handle." << std::endl;
return NX_ERROR;
std::cerr << std::endl << ">> **WARNING** found neither 'first_good_bin' nor 'first_good_time' values ..." << std::endl;
}
// calculate the needed size
size = dims[0];
for (int i=1; i<rank; i++)
size *= dims[i];
noOfElements = size;
size *= GetDataSize(type);
// handle last good bin
if (SearchInGroup("last_good_bin", "name", nxname, nxclass, dataType)) {
if (!ErrorHandler(NXopendata(fFileHandle, "last_good_bin"), PNEXUS_OPEN_DATA_ERROR, "couldn't open 'last_good_bin' data in NXdetector!")) return NX_ERROR;
// allocate locale memory to get the data
char *data_ptr = new char[size];
if (data_ptr == nullptr) {
return NX_ERROR;
}
// check the dimensions of the 'last_good_bin' vector
if (!ErrorHandler(NXgetinfo(fFileHandle, &rank, dims, &type), PNEXUS_GET_META_INFO_ERROR, "couldn't get 'last_good_bin' info in NXdetector!")) return NX_ERROR;
// get the data
float *f_data_ptr = (float*) data_ptr;
int status = NXgetdata(fFileHandle, f_data_ptr);
if (status != NX_OK) {
return NX_ERROR;
}
// calculate the needed size
size = dims[0];
for (int i=1; i<rank; i++)
size *= dims[i];
noOfElements = size;
size *= GetDataSize(type);
if (!ErrorHandler(GetStringAttr("units", str), PNEXUS_GET_ATTR_ERROR, "couldn't read 'time_zero' units in NXdetector!")) return NX_ERROR;
// Set T0's
// check that the necessary time resolution is present
if (fNxEntry2->GetInstrument()->GetDetector()->GetTimeResolution(str) == 0.0) {
std::cerr << std::endl << ">> **ERROR** trying to set T0's based on 'time_zero'. Need a valid time resolution to do so, but this is not given." << std::endl;
return NX_ERROR;
}
// set the t0's based on the t0 time stamp and the time resolution
int *pt0 = nullptr;
if (rank == 1) {
pt0 = new int;
*pt0 = (int)(*f_data_ptr / (float)fNxEntry2->GetInstrument()->GetDetector()->GetTimeResolution(str));
} else { // rank == 2
pt0 = new int[noOfElements];
for (int i=0; i<noOfElements; i++) {
*(pt0+i) = (int)(*(f_data_ptr+i) / (float)fNxEntry2->GetInstrument()->GetDetector()->GetTimeResolution(str));
// allocate locale memory to get the data
char *data_ptr = new char[size];
if (data_ptr == nullptr) {
return NX_ERROR;
}
}
if (!fNxEntry2->GetInstrument()->GetDetector()->SetT0(pt0)) {
std::cerr << std::endl << ">> **ERROR** " << fNxEntry2->GetInstrument()->GetDetector()->GetErrorMsg() << std::endl;
return NX_ERROR;
}
// clean up
if (data_ptr) {
delete [] data_ptr;
data_ptr = nullptr;
}
std::cerr << std::endl << ">> **WARNING** found only 'time_zero' will convert it to 'time_zero_bin' values" << std::endl;
if (!ErrorHandler(NXclosedata(fFileHandle), PNEXUS_CLOSE_DATA_ERROR, "couldn't close 'time_zero' data in NXdetector!")) return NX_ERROR;
} else {
std::cerr << std::endl << ">> **WARNING** found neither 'time_zero_bin' nor 'time_zero' values ..." << std::endl;
}
// handle first good bin
if (SearchInGroup("first_good_bin", "name", nxname, nxclass, dataType)) {
if (!ErrorHandler(NXopendata(fFileHandle, "first_good_bin"), PNEXUS_OPEN_DATA_ERROR, "couldn't open 'first_good_bin' data in NXdetector!")) return NX_ERROR;
// check the dimensions of the 'first_good_bin' vector
if (!ErrorHandler(NXgetinfo(fFileHandle, &rank, dims, &type), PNEXUS_GET_META_INFO_ERROR, "couldn't get 'first_good_bin' info in NXdetector!")) return NX_ERROR;
// calculate the needed size
size = dims[0];
for (int i=1; i<rank; i++)
size *= dims[i];
noOfElements = size;
size *= GetDataSize(type);
// allocate locale memory to get the data
char *data_ptr = new char[size];
if (data_ptr == nullptr) {
return NX_ERROR;
}
// get the data
int *i_data_ptr = (int*) data_ptr;
int status = NXgetdata(fFileHandle, i_data_ptr);
if (status != NX_OK) {
return NX_ERROR;
}
if (!fNxEntry2->GetInstrument()->GetDetector()->SetFirstGoodBin(i_data_ptr)) {
std::cerr << std::endl << ">> **ERROR** " << fNxEntry2->GetInstrument()->GetDetector()->GetErrorMsg() << std::endl;
return NX_ERROR;
}
if (data_ptr) {
delete [] data_ptr;
data_ptr = nullptr;
}
if (!ErrorHandler(NXclosedata(fFileHandle), PNEXUS_CLOSE_DATA_ERROR, "couldn't close 'first_good_bin' data in NXdetector!")) return NX_ERROR;
} else if (SearchInGroup("first_good_time", "name", nxname, nxclass, dataType)) {
if (!ErrorHandler(NXopendata(fFileHandle, "first_good_time"), PNEXUS_OPEN_DATA_ERROR, "couldn't open 'first_good_time' data in NXdetector!")) return NX_ERROR;
// check the dimensions of the 'first_good_time' vector
if (!ErrorHandler(NXgetinfo(fFileHandle, &rank, dims, &type), PNEXUS_GET_META_INFO_ERROR, "couldn't get 'first_good_time' info in NXdetector!")) return NX_ERROR;
// calculate the needed size
size = dims[0];
for (int i=1; i<rank; i++)
size *= dims[i];
noOfElements = size;
size *= GetDataSize(type);
// allocate locale memory to get the data
char *data_ptr = new char[size];
if (data_ptr == nullptr) {
return NX_ERROR;
}
// get the data
float *f_data_ptr = (float*) data_ptr;
int status = NXgetdata(fFileHandle, f_data_ptr);
if (status != NX_OK) {
return NX_ERROR;
}
// set the fgb's based on the fgb time stamp and the time resolution
int *p_fgb = nullptr;
if (rank == 1) {
p_fgb = new int;
*p_fgb = (int)(*f_data_ptr / (float)fNxEntry2->GetInstrument()->GetDetector()->GetTimeResolution(str));
} else { // rank == 2
p_fgb = new int[noOfElements];
for (int i=0; i<noOfElements; i++) {
*(p_fgb+i) = (int)(*(f_data_ptr+i) / (float)fNxEntry2->GetInstrument()->GetDetector()->GetTimeResolution(str));
// get the data
int *i_data_ptr = (int*) data_ptr;
int status = NXgetdata(fFileHandle, i_data_ptr);
if (status != NX_OK) {
return NX_ERROR;
}
}
if (!fNxEntry2->GetInstrument()->GetDetector()->SetFirstGoodBin(p_fgb)) {
std::cerr << std::endl << ">> **ERROR** " << fNxEntry2->GetInstrument()->GetDetector()->GetErrorMsg() << std::endl;
return NX_ERROR;
}
// clean up
if (p_fgb) {
delete [] p_fgb;
p_fgb = 0;
}
if (data_ptr) {
delete [] data_ptr;
data_ptr = nullptr;
}
if (!ErrorHandler(NXclosedata(fFileHandle), PNEXUS_CLOSE_DATA_ERROR, "couldn't close 'first_good_time' data in NXdetector!")) return NX_ERROR;
} else {
std::cerr << std::endl << ">> **WARNING** found neither 'first_good_bin' nor 'first_good_time' values ..." << std::endl;
}
// handle last good bin
if (SearchInGroup("last_good_bin", "name", nxname, nxclass, dataType)) {
if (!ErrorHandler(NXopendata(fFileHandle, "last_good_bin"), PNEXUS_OPEN_DATA_ERROR, "couldn't open 'last_good_bin' data in NXdetector!")) return NX_ERROR;
// check the dimensions of the 'last_good_bin' vector
if (!ErrorHandler(NXgetinfo(fFileHandle, &rank, dims, &type), PNEXUS_GET_META_INFO_ERROR, "couldn't get 'last_good_bin' info in NXdetector!")) return NX_ERROR;
// calculate the needed size
size = dims[0];
for (int i=1; i<rank; i++)
size *= dims[i];
noOfElements = size;
size *= GetDataSize(type);
// allocate locale memory to get the data
char *data_ptr = new char[size];
if (data_ptr == nullptr) {
return NX_ERROR;
}
// get the data
int *i_data_ptr = (int*) data_ptr;
int status = NXgetdata(fFileHandle, i_data_ptr);
if (status != NX_OK) {
return NX_ERROR;
}
if (!fNxEntry2->GetInstrument()->GetDetector()->SetLastGoodBin(i_data_ptr)) {
std::cerr << std::endl << ">> **ERROR** " << fNxEntry2->GetInstrument()->GetDetector()->GetErrorMsg() << std::endl;
return NX_ERROR;
}
// clean up
if (data_ptr) {
delete [] data_ptr;
data_ptr = nullptr;
}
if (!ErrorHandler(NXclosedata(fFileHandle), PNEXUS_CLOSE_DATA_ERROR, "couldn't close 'last_good_bin' data in NXdetector!")) return NX_ERROR;
} else if (SearchInGroup("last_good_time", "name", nxname, nxclass, dataType)) {
if (!ErrorHandler(NXopendata(fFileHandle, "last_good_time"), PNEXUS_OPEN_DATA_ERROR, "couldn't open 'last_good_time' data in NXdetector!")) return NX_ERROR;
// check the dimensions of the 'last_good_time' vector
if (!ErrorHandler(NXgetinfo(fFileHandle, &rank, dims, &type), PNEXUS_GET_META_INFO_ERROR, "couldn't get 'last_good_time' info in NXdetector!")) return NX_ERROR;
// calculate the needed size
size = dims[0];
for (int i=1; i<rank; i++)
size *= dims[i];
noOfElements = size;
size *= GetDataSize(type);
// allocate locale memory to get the data
char *data_ptr = new char[size];
if (data_ptr == nullptr) {
return NX_ERROR;
}
// get the data
float *f_data_ptr = (float*) data_ptr;
int status = NXgetdata(fFileHandle, f_data_ptr);
if (status != NX_OK) {
return NX_ERROR;
}
// set the lgb's based on the lgb time stamp and the time resolution
int *p_lgb = nullptr;
if (rank == 1) {
p_lgb = new int;
*p_lgb = (int)(*f_data_ptr / (float)fNxEntry2->GetInstrument()->GetDetector()->GetTimeResolution(str));
} else { // rank == 2
p_lgb = new int[noOfElements];
for (int i=0; i<noOfElements; i++) {
*(p_lgb+i) = (int)(*(f_data_ptr+i) / (float)fNxEntry2->GetInstrument()->GetDetector()->GetTimeResolution(str));
if (!fNxEntry2->GetInstrument()->GetDetector()->SetLastGoodBin(i_data_ptr)) {
std::cerr << std::endl << ">> **ERROR** " << fNxEntry2->GetInstrument()->GetDetector()->GetErrorMsg() << std::endl;
return NX_ERROR;
}
}
if (fNxEntry2->GetInstrument()->GetDetector()->SetFirstGoodBin(p_lgb)) {
std::cerr << std::endl << ">> **ERROR** " << fNxEntry2->GetInstrument()->GetDetector()->GetErrorMsg() << std::endl;
return NX_ERROR;
}
// clean up
if (data_ptr) {
delete [] data_ptr;
data_ptr = nullptr;
}
// clean up
if (p_lgb) {
delete [] p_lgb;
p_lgb = 0;
}
if (data_ptr) {
delete [] data_ptr;
data_ptr = nullptr;
}
if (!ErrorHandler(NXclosedata(fFileHandle), PNEXUS_CLOSE_DATA_ERROR, "couldn't close 'last_good_bin' data in NXdetector!")) return NX_ERROR;
} else if (SearchInGroup("last_good_time", "name", nxname, nxclass, dataType)) {
if (!ErrorHandler(NXopendata(fFileHandle, "last_good_time"), PNEXUS_OPEN_DATA_ERROR, "couldn't open 'last_good_time' data in NXdetector!")) return NX_ERROR;
if (!ErrorHandler(NXclosedata(fFileHandle), PNEXUS_CLOSE_DATA_ERROR, "couldn't close 'last_good_time' data in NXdetector!")) return NX_ERROR;
} else {
std::cerr << std::endl << ">> **WARNING** found neither 'last_good_bin' nor 'last_good_time' values ..." << std::endl;
// check the dimensions of the 'last_good_time' vector
if (!ErrorHandler(NXgetinfo(fFileHandle, &rank, dims, &type), PNEXUS_GET_META_INFO_ERROR, "couldn't get 'last_good_time' info in NXdetector!")) return NX_ERROR;
// calculate the needed size
size = dims[0];
for (int i=1; i<rank; i++)
size *= dims[i];
noOfElements = size;
size *= GetDataSize(type);
// allocate locale memory to get the data
char *data_ptr = new char[size];
if (data_ptr == nullptr) {
return NX_ERROR;
}
// get the data
float *f_data_ptr = (float*) data_ptr;
int status = NXgetdata(fFileHandle, f_data_ptr);
if (status != NX_OK) {
return NX_ERROR;
}
// set the lgb's based on the lgb time stamp and the time resolution
int *p_lgb = nullptr;
if (rank == 1) {
p_lgb = new int;
*p_lgb = (int)(*f_data_ptr / (float)fNxEntry2->GetInstrument()->GetDetector()->GetTimeResolution(str));
} else { // rank == 2
p_lgb = new int[noOfElements];
for (int i=0; i<noOfElements; i++) {
*(p_lgb+i) = (int)(*(f_data_ptr+i) / (float)fNxEntry2->GetInstrument()->GetDetector()->GetTimeResolution(str));
}
}
if (fNxEntry2->GetInstrument()->GetDetector()->SetFirstGoodBin(p_lgb)) {
std::cerr << std::endl << ">> **ERROR** " << fNxEntry2->GetInstrument()->GetDetector()->GetErrorMsg() << std::endl;
return NX_ERROR;
}
// clean up
if (p_lgb) {
delete [] p_lgb;
p_lgb = 0;
}
if (data_ptr) {
delete [] data_ptr;
data_ptr = nullptr;
}
if (!ErrorHandler(NXclosedata(fFileHandle), PNEXUS_CLOSE_DATA_ERROR, "couldn't close 'last_good_time' data in NXdetector!")) return NX_ERROR;
} else {
std::cerr << std::endl << ">> **WARNING** found neither 'last_good_bin' nor 'last_good_time' values ..." << std::endl;
}
}
// close group NXdetector

View File

@ -155,6 +155,13 @@ class PFitter
Bool_t fSectorFlag; ///< sector command present flag
std::vector<PSectorChisq> fSector; ///< stores all chisq/maxLH sector information
std::vector<bool> fPhase; ///< flag array in which an entry is true if the related parameter value is a phase
// phase related functions
void GetPhaseParams();
PIntVector GetParFromFun(const TString funStr);
PIntVector GetParFromMap(const TString mapStr);
// commands
Bool_t CheckCommands();
Bool_t SetParameters();

View File

@ -36,7 +36,10 @@
#include "config.h"
#endif
#ifdef HAVE_GIT_REV_H
#include "git-revision.h"
#endif
#include "PMusr.h"
#include "PMsr2Data.h"
@ -512,9 +515,17 @@ int main(int argc, char *argv[])
return 0;
} else if (!strcmp(argv[1], "--version")) {
#ifdef HAVE_CONFIG_H
#ifdef HAVE_GIT_REV_H
std::cout << std::endl << "msr2data version: " << PACKAGE_VERSION << ", git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << " (" << BUILD_TYPE << "), ROOT version: " << ROOT_VERSION_USED << std::endl << std::endl;
#else
std::cout << std::endl << "msr2data version: " << PACKAGE_VERSION << " (" << BUILD_TYPE << "), ROOT version: " << ROOT_VERSION_USED << std::endl << std::endl;
#endif
#else
#ifdef HAVE_GIT_REV_H
std::cout << std::endl << "msr2data git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << std::endl << std::endl;
#else
std::cout << std::endl << "msr2data version: unknown." << std::endl << std::endl;
#endif
#endif
return 0;
} else {

View File

@ -44,7 +44,10 @@
#include <TObjString.h>
#include <TSAXParser.h>
#ifdef HAVE_GIT_REV_H
#include "git-revision.h"
#endif
#include "PMusr.h"
#include "PStartupHandler.h"
#include "PMsrHandler.h"
@ -297,9 +300,17 @@ Int_t musrFT_parse_options(Int_t argc, Char_t *argv[], musrFT_startup_param &sta
tstr = argv[i];
if (tstr.BeginsWith("--version")) {
#ifdef HAVE_CONFIG_H
#ifdef HAVE_GIT_REV_H
std::cout << std::endl << "musrFT version: " << PACKAGE_VERSION << ", git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << " (" << BUILD_TYPE << "), ROOT version: " << ROOT_VERSION_USED << std::endl << std::endl;
#else
std::cout << std::endl << "musrFT version: " << PACKAGE_VERSION << " (" << BUILD_TYPE << "), ROOT version: " << ROOT_VERSION_USED << std::endl << std::endl;
#endif
#else
#ifdef HAVE_GIT_REV_H
std::cout << std::endl << "musrFT git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << std::endl << std::endl;
#else
std::cout << std::endl << "musrFT version: unknown." << std::endl << std::endl;
#endif
#endif
return 1;
} else if (tstr.BeginsWith("--help")) {

View File

@ -48,7 +48,10 @@
#include <libxml/parser.h>
#include <libxml/xmlschemas.h>
#ifdef HAVE_GIT_REV_H
#include "git-revision.h"
#endif
#include "PMusr.h"
//-----------------------------------------------------------------------
@ -574,9 +577,17 @@ int main(int argc, char *argv[])
} else if (argc==2) {
if (!strcmp(argv[1], "--version")) {
#ifdef HAVE_CONFIG_H
#ifdef HAVE_GIT_REV_H
std::cout << std::endl << "musrRootValidation version: " << PACKAGE_VERSION << ", git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << " (" << BUILD_TYPE << "), ROOT version: " << ROOT_VERSION_USED << std::endl << std::endl;
#else
std::cout << std::endl << "musrRootValidation version: " << PACKAGE_VERSION << " (" << BUILD_TYPE << "), ROOT version: " << ROOT_VERSION_USED << std::endl << std::endl;
#endif
#else
#ifdef HAVE_GIT_REV_H
std::cout << std::endl << "musrRootValidation git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << std::endl << std::endl;
#else
std::cout << std::endl << "musrRootValidation version: unknown." << std::endl << std::endl;
#endif
#endif
return 0;
} else {

View File

@ -32,7 +32,9 @@ using namespace std;
#include <QApplication>
#ifdef HAVE_GIT_REV_H
#include "../include/git-revision.h"
#endif
#include "PTextEdit.h"
#include "PFitOutputHandler.h"
@ -53,7 +55,11 @@ int main( int argc, char ** argv )
cout << endl << endl;
return 0;
} else if (!strcmp(argv[1], "--version") || !strcmp(argv[1], "-v")) {
#ifdef HAVE_GIT_REV_H
cout << endl << "musredit git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1;
#else
cout << endl << "musredit version: unknown. ";
#endif
cout << endl << endl;
return 0;
}

View File

@ -61,11 +61,19 @@ else (APPLE)
add_executable(mupp ${GENERATED_HEADER_FILES} ${MUPP_SOURCE_FILES} qrc_mupp.cpp)
endif (APPLE)
#--- check if project source is repo ------------------------------------------
if (IS_GIT_REPO)
set(HAVE_GIT_REV_H "-DHAVE_GIT_REV_H")
else (IS_GIT_REPO)
set(HAVE_GIT_REV_H "")
endif (IS_GIT_REPO)
#--- compiler option to workaround a little cast problem for some
#--- boost/compiler combinations ----------------------------------------------
target_compile_options(mupp
PRIVATE
"-fpermissive"
"-fpermissive"
"${HAVE_GIT_REV_H}"
)
#--- add the variable related sources -----------------------------------------
@ -75,6 +83,7 @@ add_subdirectory(var)
target_include_directories(mupp
BEFORE PRIVATE
$<BUILD_INTERFACE:${Boost_INCLUDE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/../..>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/var/include>
)

View File

@ -58,6 +58,9 @@
#include <QtDebug>
#include "mupp_version.h"
#ifdef HAVE_GIT_REV_H
#include "git-revision.h"
#endif
#include "PmuppGui.h"
//----------------------------------------------------------------------------------------------------
@ -779,7 +782,11 @@ void PmuppGui::helpCmds()
*/
void PmuppGui::helpAbout()
{
QMessageBox::information(this, "about", QString("mupp: created by Andreas Suter.\nVersion: %1\nBranch: %2\nHash: %3").arg(MUPP_VERSION).arg(GIT_BRANCH).arg(GIT_COMMIT_HASH));
#ifdef HAVE_GIT_REV_H
QMessageBox::information(this, "about", QString("mupp: created by Andreas Suter.\nVersion: %1\nBranch: %2\nHash: %3").arg(MUPP_VERSION).arg(GIT_BRANCH).arg(GIT_CURRENT_SHA1));
#else
QMessageBox::information(this, "about", QString("mupp: created by Andreas Suter.\nVersion: %1").arg(MUPP_VERSION));
#endif
}
//-----------------------------------------------------------------------------

View File

@ -6,22 +6,6 @@ set(BIN_DIR "@CMAKE_CURRENT_BINARY_DIR@")
set(CMAKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@")
set(MUPP_VERSION "@mupp_VERSION@")
# Get the current working branch
execute_process(
COMMAND git rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Get the latest abbreviated commit hash of the working branch
execute_process(
COMMAND git log -1 --pretty="%h, %ci"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
configure_file(
${SRC_DIR}/cmake/mupp_version.h.in
${BIN_DIR}/mupp_version.h

View File

@ -4,8 +4,5 @@
#define MUPP_PREFIX "@CMAKE_INSTALL_PREFIX@"
#define MUPP_VERSION "@MUPP_VERSION@"
#define GIT_BRANCH "@GIT_BRANCH@"
#define GIT_COMMIT_HASH @GIT_COMMIT_HASH@
#endif

View File

@ -41,6 +41,9 @@
#include <QTimer>
#include "mupp_version.h"
#ifdef HAVE_GIT_REV_H
#include "git-revision.h"
#endif
#include "PmuppScript.h"
#include "PmuppGui.h"
@ -525,7 +528,11 @@ int main(int argc, char *argv[])
mupp_syntax();
return 0;
} else if (!qstrcmp(argv[1], "-v") || !qstrcmp(argv[1], "--version")) {
std::cout << std::endl << "mupp version: " << MUPP_VERSION << ", git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_COMMIT_HASH << std::endl << std::endl;
#ifdef HAVE_GIT_REV_H
std::cout << std::endl << "mupp version: " << MUPP_VERSION << ", git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << std::endl << std::endl;
#else
std::cout << std::endl << "mupp version: " << MUPP_VERSION << std::endl << std::endl;
#endif
return 0;
} else if (!qstrcmp(argv[1], "-s") || !qstrcmp(argv[1], "--script")) {
if (argc != 3) {

View File

@ -651,7 +651,51 @@ void PMuppCanvas::ExportData()
fi.fOverwrite = true;
new TGFileDialog(0, fImp, kFDSave, &fi);
if (fi.fFilename && strlen(fi.fFilename)) {
// still missing, as35
new TGMsgBox(gClient->GetRoot(), 0, "ExportData", "NOT YET IMPLEMENTED", kMBIconAsterisk);
std::ofstream fout(fi.fFilename, std::ios_base::out);
// write header
fout << "% ";
for (int i=0; i<fPlotData.size(); i++) {
fout << fPlotData[i].xLabel.Data() << ", ";
for (int j=0; j<fPlotData[i].yLabel.size(); j++) {
if ((i == fPlotData.size()-1) && (j == fPlotData[i].yLabel.size()-1))
fout << fPlotData[i].yLabel[j].Data() << ", " << fPlotData[i].yLabel[j].Data() << "ErrPos, " << fPlotData[i].yLabel[j].Data() << "ErrNeg";
else
fout << fPlotData[i].yLabel[j].Data() << ", " << fPlotData[i].yLabel[j].Data() << "ErrPos, " << fPlotData[i].yLabel[j].Data() << "ErrNeg, ";
}
}
fout << std::endl;
// search the longest data set
Int_t maxLength=0;
for (int i=0; i<fPlotData.size(); i++) {
if (maxLength < fPlotData[i].xValue.size())
maxLength = fPlotData[i].xValue.size();
}
// write data
for (int i=0; i<maxLength; i++) { // maximal data set length
for (int j=0; j<fPlotData.size(); j++) { // number of x-data sets
// write x-value
if (i < fPlotData[j].xValue.size()) // make sure that the entry exists
fout << fPlotData[j].xValue[i] << ", ";
else
fout << " , ";
// write y-value and y-value error
for (int k=0; k<fPlotData[j].yValue.size(); k++) { // number of y-data sets
if ((j == fPlotData.size()-1) && (k == fPlotData[j].yValue.size()-1))
if (i < fPlotData[j].yValue[k].size())
fout << fPlotData[j].yValue[k][i].y << ", " << fPlotData[j].yValue[k][i].eYpos << ", " << fPlotData[j].yValue[k][i].eYneg;
else
fout << ", , , ";
else
if (i < fPlotData[j].yValue[k].size())
fout << fPlotData[j].yValue[k][i].y << ", " << fPlotData[j].yValue[k][i].eYpos << ", " << fPlotData[j].yValue[k][i].eYneg << ", ";
else
fout << ", , , ";
}
}
fout << std::endl;
}
fout.close();
}
}

View File

@ -1,5 +1,12 @@
#--- musrStep for Qt > 5.0 ----------------------------------------------------
#--- check if project source is repo ------------------------------------------
if (IS_GIT_REPO)
set(HAVE_GIT_REV_H "-DHAVE_GIT_REV_H")
else (IS_GIT_REPO)
set(HAVE_GIT_REV_H "")
endif (IS_GIT_REPO)
set(qt_libs Qt5::Core Qt5::Widgets Qt5::Svg)
set(musrStep_src
@ -47,6 +54,11 @@ target_include_directories(musrStep
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../include>
)
target_compile_options(musrStep
PRIVATE
"${HAVE_GIT_REV_H}"
)
target_link_libraries(musrStep ${qt_libs})
#--- installation info --------------------------------------------------------

View File

@ -5,7 +5,9 @@
#include <QtDebug>
#ifdef HAVE_GIT_REV_H
#include "git-revision.h"
#endif
#include "PMusrStep.h"
//-------------------------------------------------------------------------
@ -29,7 +31,11 @@ int main(int argc, char *argv[])
return 1;
} else {
if (!strcmp(argv[1], "--version") || (!strcmp(argv[1], "-v"))) {
std::cout << std::endl << "musrStep git-rev: " << GIT_CURRENT_SHA1 << std::endl << std::endl;
#ifdef HAVE_GIT_REV_H
std::cout << std::endl << "musrStep - git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << std::endl << std::endl;
#else
std::cout << std::endl << "musrStep - git-branch: unknown, git-rev: unknown" << std::endl << std::endl;
#endif
return 0;
} else if (!strcmp(argv[1], "--help") || (!strcmp(argv[1], "-h"))) {
musrStep_syntax();

View File

@ -1,5 +1,12 @@
#--- musrWiz for Qt > 5.0 -----------------------------------------------------
#--- check if project source is repo ------------------------------------------
if (IS_GIT_REPO)
set(HAVE_GIT_REV_H "-DHAVE_GIT_REV_H")
else (IS_GIT_REPO)
set(HAVE_GIT_REV_H "")
endif (IS_GIT_REPO)
set(qt_libs Qt5::Core Qt5::Widgets Qt5::Svg Qt5::Xml)
set(musrWiz_src
@ -51,6 +58,11 @@ target_include_directories(musrWiz
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../include>
)
target_compile_options(musrWiz
PRIVATE
"${HAVE_GIT_REV_H}"
)
target_link_libraries(musrWiz ${qt_libs})
#--- installation info --------------------------------------------------------

View File

@ -6,7 +6,10 @@
#include <QMessageBox>
#include <QObject>
#ifdef HAVE_GIT_REV_H
#include "git-revision.h"
#endif
#include "musrWiz.h"
#include "PAdmin.h"
#include "PMusrWiz.h"
@ -53,7 +56,11 @@ int main(int argc, char *argv[])
if (argc == 2) {
if (!strcmp(argv[1], "--version") || (!strcmp(argv[1], "-v"))) {
#ifdef HAVE_GIT_REV_H
std::cout << std::endl << "musrWiz - git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << std::endl << std::endl;
#else
std::cout << std::endl << "musrWiz - git-branch: unknown, git-rev: unknown" << std::endl << std::endl;
#endif
return 0;
} else if (!strcmp(argv[1], "--help")) {
musrWiz_syntax();

View File

@ -1,5 +1,12 @@
#--- musredit for Qt > 5.0 ----------------------------------------------------
#--- check if project source is repo ------------------------------------------
if (IS_GIT_REPO)
set(HAVE_GIT_REV_H "-DHAVE_GIT_REV_H")
else (IS_GIT_REPO)
set(HAVE_GIT_REV_H "")
endif (IS_GIT_REPO)
set(qt_libs Qt5::Core Qt5::Widgets Qt5::Network Qt5::Xml Qt5::Svg Qt5::PrintSupport)
set(musredit_src
@ -116,6 +123,11 @@ target_include_directories(musredit
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../include>
)
target_compile_options(musredit
PRIVATE
"${HAVE_GIT_REV_H}"
)
target_link_libraries(musredit ${qt_libs})
#--- installation info --------------------------------------------------------

View File

@ -28,7 +28,9 @@
***************************************************************************/
#include "config.h"
#ifdef HAVE_GIT_REV_H
#include "git-revision.h"
#endif
#include "PMusrEditAbout.h"
//---------------------------------------------------------------------------
@ -39,8 +41,13 @@ PMusrEditAbout::PMusrEditAbout(QWidget *parent) : QDialog(parent)
{
setupUi(this);
#ifdef HAVE_GIT_REV_H
fGitBranch_label->setText(QString("git-branch: %1").arg(GIT_BRANCH));
fGitRev_label->setText(QString("git-rev: %1").arg(GIT_CURRENT_SHA1));
#else
fGitBranch_label->setText(QString("git-branch: unknown"));
fGitRev_label->setText(QString("git-rev: unknown"));
#endif
fMusrfitVersion_label->setText(QString("musrfit-version: %1 (%2)").arg(PACKAGE_VERSION).arg(BUILD_TYPE));
fRootVersion_label->setText(QString("ROOT-version: %1").arg(ROOT_VERSION_USED));

View File

@ -31,7 +31,10 @@
#include <QApplication>
#ifdef HAVE_GIT_REV_H
#include "git-revision.h"
#endif
#include "PTextEdit.h"
#include "PFitOutputHandler.h"
@ -52,7 +55,11 @@ int main( int argc, char ** argv )
std::cout << std::endl << std::endl;
return 0;
} else if (!strcmp(argv[1], "--version") || !strcmp(argv[1], "-v")) {
#ifdef HAVE_GIT_REV_H
std::cout << std::endl << "musredit git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1;
#else
std::cout << std::endl << "musredit git-branch: unknown, git-rev: unknown.";
#endif
std::cout << std::endl << std::endl;
return 0;
}

View File

@ -61,11 +61,19 @@ else (APPLE)
add_executable(mupp ${GENERATED_HEADER_FILES} ${MUPP_SOURCE_FILES} qrc_mupp.cpp)
endif (APPLE)
#--- check if project source is repo ------------------------------------------
if (IS_GIT_REPO)
set(HAVE_GIT_REV_H "-DHAVE_GIT_REV_H")
else (IS_GIT_REPO)
set(HAVE_GIT_REV_H "")
endif (IS_GIT_REPO)
#--- compiler option to workaround a little cast problem for some
#--- boost/compiler combinations ----------------------------------------------
target_compile_options(mupp
PRIVATE
"-fpermissive"
"-fpermissive"
"${HAVE_GIT_REV_H}"
)
#--- add the variable related sources -----------------------------------------
@ -75,6 +83,7 @@ add_subdirectory(var)
target_include_directories(mupp
BEFORE PRIVATE
$<BUILD_INTERFACE:${Boost_INCLUDE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/../..>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/var/include>
)

View File

@ -58,6 +58,9 @@
#include <QtDebug>
#include "mupp_version.h"
#ifdef HAVE_GIT_REV_H
#include "git-revision.h"
#endif
#include "PmuppGui.h"
//----------------------------------------------------------------------------------------------------
@ -779,7 +782,11 @@ void PmuppGui::helpCmds()
*/
void PmuppGui::helpAbout()
{
QMessageBox::information(this, "about", QString("mupp: created by Andreas Suter.\nVersion: %1\nBranch: %2\nHash: %3").arg(MUPP_VERSION).arg(GIT_BRANCH).arg(GIT_COMMIT_HASH));
#ifdef HAVE_GIT_REV_H
QMessageBox::information(this, "about", QString("mupp: created by Andreas Suter.\nVersion: %1\nBranch: %2\nHash: %3").arg(MUPP_VERSION).arg(GIT_BRANCH).arg(GIT_CURRENT_SHA1));
#else
QMessageBox::information(this, "about", QString("mupp: created by Andreas Suter.\nVersion: %1").arg(MUPP_VERSION));
#endif
}
//-----------------------------------------------------------------------------

View File

@ -6,22 +6,6 @@ set(BIN_DIR "@CMAKE_CURRENT_BINARY_DIR@")
set(CMAKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@")
set(MUPP_VERSION "@mupp_VERSION@")
# Get the current working branch
execute_process(
COMMAND git rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Get the latest abbreviated commit hash of the working branch
execute_process(
COMMAND git log -1 --pretty="%h, %ci"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
configure_file(
${SRC_DIR}/cmake/mupp_version.h.in
${BIN_DIR}/mupp_version.h

View File

@ -4,8 +4,5 @@
#define MUPP_PREFIX "@CMAKE_INSTALL_PREFIX@"
#define MUPP_VERSION "@MUPP_VERSION@"
#define GIT_BRANCH "@GIT_BRANCH@"
#define GIT_COMMIT_HASH @GIT_COMMIT_HASH@
#endif

View File

@ -41,6 +41,9 @@
#include <QTimer>
#include "mupp_version.h"
#ifdef HAVE_GIT_REV_H
#include "git-revision.h"
#endif
#include "PmuppScript.h"
#include "PmuppGui.h"
@ -477,7 +480,11 @@ int main(int argc, char *argv[])
mupp_syntax();
return 0;
} else if (!qstrcmp(argv[1], "-v") || !qstrcmp(argv[1], "--version")) {
std::cout << std::endl << "mupp version: " << MUPP_VERSION << ", git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_COMMIT_HASH << std::endl << std::endl;
#ifdef HAVE_GIT_REV_H
std::cout << std::endl << "mupp version: " << MUPP_VERSION << ", git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << std::endl << std::endl;
#else
std::cout << std::endl << "mupp version: " << MUPP_VERSION << std::endl << std::endl;
#endif
return 0;
} else if (!qstrcmp(argv[1], "-s") || !qstrcmp(argv[1], "--script")) {
if (argc != 3) {

View File

@ -651,7 +651,51 @@ void PMuppCanvas::ExportData()
fi.fOverwrite = true;
new TGFileDialog(0, fImp, kFDSave, &fi);
if (fi.fFilename && strlen(fi.fFilename)) {
// still missing, as35
new TGMsgBox(gClient->GetRoot(), 0, "ExportData", "NOT YET IMPLEMENTED", kMBIconAsterisk);
std::ofstream fout(fi.fFilename, std::ios_base::out);
// write header
fout << "% ";
for (int i=0; i<fPlotData.size(); i++) {
fout << fPlotData[i].xLabel.Data() << ", ";
for (int j=0; j<fPlotData[i].yLabel.size(); j++) {
if ((i == fPlotData.size()-1) && (j == fPlotData[i].yLabel.size()-1))
fout << fPlotData[i].yLabel[j].Data() << ", " << fPlotData[i].yLabel[j].Data() << "ErrPos, " << fPlotData[i].yLabel[j].Data() << "ErrNeg";
else
fout << fPlotData[i].yLabel[j].Data() << ", " << fPlotData[i].yLabel[j].Data() << "ErrPos, " << fPlotData[i].yLabel[j].Data() << "ErrNeg, ";
}
}
fout << std::endl;
// search the longest data set
Int_t maxLength=0;
for (int i=0; i<fPlotData.size(); i++) {
if (maxLength < fPlotData[i].xValue.size())
maxLength = fPlotData[i].xValue.size();
}
// write data
for (int i=0; i<maxLength; i++) { // maximal data set length
for (int j=0; j<fPlotData.size(); j++) { // number of x-data sets
// write x-value
if (i < fPlotData[j].xValue.size()) // make sure that the entry exists
fout << fPlotData[j].xValue[i] << ", ";
else
fout << " , ";
// write y-value and y-value error
for (int k=0; k<fPlotData[j].yValue.size(); k++) { // number of y-data sets
if ((j == fPlotData.size()-1) && (k == fPlotData[j].yValue.size()-1))
if (i < fPlotData[j].yValue[k].size())
fout << fPlotData[j].yValue[k][i].y << ", " << fPlotData[j].yValue[k][i].eYpos << ", " << fPlotData[j].yValue[k][i].eYneg;
else
fout << ", , , ";
else
if (i < fPlotData[j].yValue[k].size())
fout << fPlotData[j].yValue[k][i].y << ", " << fPlotData[j].yValue[k][i].eYpos << ", " << fPlotData[j].yValue[k][i].eYneg << ", ";
else
fout << ", , , ";
}
}
fout << std::endl;
}
fout.close();
}
}

View File

@ -1,5 +1,12 @@
#--- musrStep for Qt > 6.0 ----------------------------------------------------
#--- check if project source is repo ------------------------------------------
if (IS_GIT_REPO)
set(HAVE_GIT_REV_H "-DHAVE_GIT_REV_H")
else (IS_GIT_REPO)
set(HAVE_GIT_REV_H "")
endif (IS_GIT_REPO)
set(qt_libs Qt6::Core Qt6::Widgets Qt6::Svg)
set(musrStep_src
@ -47,6 +54,11 @@ target_include_directories(musrStep
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../include>
)
target_compile_options(musrStep
PRIVATE
"${HAVE_GIT_REV_H}"
)
target_link_libraries(musrStep ${qt_libs})
#--- installation info --------------------------------------------------------

View File

@ -5,7 +5,9 @@
#include <QtDebug>
#ifdef HAVE_GIT_REV_H
#include "git-revision.h"
#endif
#include "PMusrStep.h"
//-------------------------------------------------------------------------
@ -29,7 +31,11 @@ int main(int argc, char *argv[])
return 1;
} else {
if (!strcmp(argv[1], "--version") || (!strcmp(argv[1], "-v"))) {
std::cout << std::endl << "musrStep git-rev: " << GIT_CURRENT_SHA1 << std::endl << std::endl;
#ifdef HAVE_GIT_REV_H
std::cout << std::endl << "musrStep - git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << std::endl << std::endl;
#else
std::cout << std::endl << "musrStep - git-branch: unknown, git-rev: unknown" << std::endl << std::endl;
#endif
return 0;
} else if (!strcmp(argv[1], "--help") || (!strcmp(argv[1], "-h"))) {
musrStep_syntax();

View File

@ -1,5 +1,12 @@
#--- musrWiz for Qt > 6.0 -----------------------------------------------------
#--- check if project source is repo ------------------------------------------
if (IS_GIT_REPO)
set(HAVE_GIT_REV_H "-DHAVE_GIT_REV_H")
else (IS_GIT_REPO)
set(HAVE_GIT_REV_H "")
endif (IS_GIT_REPO)
set(qt_libs Qt6::Core Qt6::Widgets Qt6::Svg Qt6::Xml)
set(musrWiz_src
@ -51,6 +58,11 @@ target_include_directories(musrWiz
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../include>
)
target_compile_options(musrWiz
PRIVATE
"${HAVE_GIT_REV_H}"
)
target_link_libraries(musrWiz ${qt_libs})
#--- installation info --------------------------------------------------------

View File

@ -6,7 +6,10 @@
#include <QMessageBox>
#include <QObject>
#ifdef HAVE_GIT_REV_H
#include "git-revision.h"
#endif
#include "musrWiz.h"
#include "PAdmin.h"
#include "PMusrWiz.h"
@ -53,7 +56,11 @@ int main(int argc, char *argv[])
if (argc == 2) {
if (!strcmp(argv[1], "--version") || (!strcmp(argv[1], "-v"))) {
#ifdef HAVE_GIT_REV_H
std::cout << std::endl << "musrWiz - git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << std::endl << std::endl;
#else
std::cout << std::endl << "musrWiz - git-branch: unknown, git-rev: unknown." << std::endl << std::endl;
#endif
return 0;
} else if (!strcmp(argv[1], "--help")) {
musrWiz_syntax();

View File

@ -1,5 +1,12 @@
#--- musredit for Qt > 6.0 ----------------------------------------------------
#--- check if project source is repo ------------------------------------------
if (IS_GIT_REPO)
set(HAVE_GIT_REV_H "-DHAVE_GIT_REV_H")
else (IS_GIT_REPO)
set(HAVE_GIT_REV_H "")
endif (IS_GIT_REPO)
set(qt_libs Qt6::Core Qt6::Widgets Qt6::Network Qt6::Xml Qt6::Svg Qt6::PrintSupport)
set(musredit_src
@ -115,6 +122,11 @@ target_include_directories(musredit
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../include>
)
target_compile_options(musredit
PRIVATE
"${HAVE_GIT_REV_H}"
)
target_link_libraries(musredit ${qt_libs})
#--- installation info --------------------------------------------------------

View File

@ -28,7 +28,9 @@
***************************************************************************/
#include "config.h"
#ifdef HAVE_GIT_REV_H
#include "git-revision.h"
#endif
#include "PMusrEditAbout.h"
//---------------------------------------------------------------------------
@ -39,8 +41,13 @@ PMusrEditAbout::PMusrEditAbout(QWidget *parent) : QDialog(parent)
{
setupUi(this);
#ifdef HAVE_GIT_REV_H
fGitBranch_label->setText(QString("git-branch: %1").arg(GIT_BRANCH));
fGitRev_label->setText(QString("git-rev: %1").arg(GIT_CURRENT_SHA1));
#else
fGitBranch_label->setText(QString("git-branch: unknown"));
fGitRev_label->setText(QString("git-rev: unknown"));
#endif
fMusrfitVersion_label->setText(QString("musrfit-version: %1 (%2)").arg(PACKAGE_VERSION).arg(BUILD_TYPE));
fRootVersion_label->setText(QString("ROOT-version: %1").arg(ROOT_VERSION_USED));

View File

@ -31,7 +31,9 @@
#include <QApplication>
#ifdef HAVE_GIT_REV_H
#include "git-revision.h"
#endif
#include "PTextEdit.h"
#include "PFitOutputHandler.h"
@ -52,7 +54,11 @@ int main( int argc, char ** argv )
std::cout << std::endl << std::endl;
return 0;
} else if (!strcmp(argv[1], "--version") || !strcmp(argv[1], "-v")) {
#ifdef HAVE_GIT_REV_H
std::cout << std::endl << "musredit git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1;
#else
std::cout << std::endl << "musredit git-branch: unknown, git-rev: unknown.";
#endif
std::cout << std::endl << std::endl;
return 0;
}

View File

@ -50,7 +50,10 @@
#include <TSystemFile.h>
#include <TThread.h>
#ifdef HAVE_GIT_REV_H
#include "git-revision.h"
#endif
#include "PMusr.h"
#include "PStartupHandler.h"
#include "PMsrHandler.h"
@ -464,9 +467,17 @@ int main(int argc, char *argv[])
if (argc == 2) {
if (!strcmp(argv[1], "--version")) {
#ifdef HAVE_CONFIG_H
#ifdef HAVE_GIT_REV_H
std::cout << std::endl << "musrfit version: " << PACKAGE_VERSION << ", git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << " (" << BUILD_TYPE << "), ROOT version: " << ROOT_VERSION_USED << std::endl << std::endl;
#else
std::cout << std::endl << "musrfit version: " << PACKAGE_VERSION << " (" << BUILD_TYPE << "), ROOT version: " << ROOT_VERSION_USED << std::endl << std::endl;
#endif
#else
#ifdef HAVE_GIT_REV_H
std::cout << std::endl << "musrfit git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << std::endl << std::endl;
#else
std::cout << std::endl << "musrfit version: unknown" << std::endl << std::endl;
#endif
#endif
return PMUSR_SUCCESS;
} else if (!strcmp(argv[1], "--nexus-support")) {

View File

@ -42,7 +42,10 @@
#include <TROOT.h>
#include <TSystem.h>
#ifdef HAVE_GIT_REV_H
#include "git-revision.h"
#endif
#include "PMusr.h"
#include "PStartupHandler.h"
#include "PMsrHandler.h"
@ -237,9 +240,17 @@ Int_t main(Int_t argc, Char_t *argv[])
for (int i=1; i<argc; i++) {
if (!strcmp(argv[i], "--version")) {
#ifdef HAVE_CONFIG_H
#ifdef HAVE_GIT_REV_H
std::cout << std::endl << "musrt0 version: " << PACKAGE_VERSION << ", git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << " (" << BUILD_TYPE << "), ROOT version: " << ROOT_VERSION_USED << std::endl << std::endl;
#else
std::cout << std::endl << "musrt0 version: " << PACKAGE_VERSION << " (" << BUILD_TYPE << "), ROOT version: " << ROOT_VERSION_USED << std::endl << std::endl;
#endif
#else
#ifdef HAVE_GIT_REV_H
std::cout << std::endl << "musrt0 git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << std::endl << std::endl;
#else
std::cout << std::endl << "musrt0 version: unknown." << std::endl << std::endl;
#endif
#endif
return PMUSR_SUCCESS;
} else if (!strcmp(argv[i], "--help")) {

View File

@ -41,7 +41,10 @@
#include <TSAXParser.h>
#include <TROOT.h>
#ifdef HAVE_GIT_REV_H
#include "git-revision.h"
#endif
#include "PMusr.h"
#include "PStartupHandler.h"
#include "PMsrHandler.h"
@ -135,9 +138,17 @@ int main(int argc, char *argv[])
}
} else if (!strcmp(argv[i], "--version")) {
#ifdef HAVE_CONFIG_H
#ifdef HAVE_GIT_REV_H
std::cout << std::endl << "musrview version: " << PACKAGE_VERSION << ", git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << " (" << BUILD_TYPE << "), ROOT version: " << ROOT_VERSION_USED << std::endl << std::endl;
#else
std::cout << std::endl << "musrview version: " << PACKAGE_VERSION << " (" << BUILD_TYPE << "), ROOT version: " << ROOT_VERSION_USED << std::endl << std::endl;
#endif
#else
#ifdef HAVE_GIT_REV_H
std::cout << std::endl << "musrview git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << std::endl << std::endl;
#else
std::cout << std::endl << "musrview version: unknown." << std::endl << std::endl;
#endif
#endif
return PMUSR_SUCCESS;
} else if (!strcmp(argv[i], "--show-dynamic-path")) {

View File

@ -1,78 +0,0 @@
07700- complexMuPol, A0 100MHz, Mu-frac 1.00, Mu12 40.43 MHz(0.49), Mu23 256.25 MHz(0.01), ionRate 0.000 MHz, capRate 0.000 MHz, SF rate 0.010 MHz, 106.5 G
###############################################################
FITPARAMETER
# Nr. Name Value Step Pos_Error Boundaries
1 alpha 0.99961 -0.00091 0.00091 0 none
2 asy 0 0 none 0 0.33
3 phase 0 0 none
4 field 106.5 0 none 0 none
5 rate 0 0 none 0 150
6 asyMu12 0.135 0 none
7 phaseMu12 0.68 -0.42 0.42
8 freqMu12 40.43248 -0.00045 0.00045
9 rateMu12 0.0104 -0.0019 0.0019 0 100
10 asyMu34 0.135 0 none
11 phaseMu34 -0.01 -0.43 0.43
12 freqMu34 59.56737 -0.00046 0.00046
13 rateMu34 0.0164 -0.0019 0.0019 0 100
###############################################################
THEORY
asymmetry 2
TFieldCos 3 fun1 (phase frequency)
simplExpo 5 (rate)
+
asymmetry 6
TFieldCos 7 8 (phase frequency)
simplExpo 9 (rate)
+
asymmetry 10
TFieldCos 11 12 (phase frequency)
simplExpo 13 (rate)
###############################################################
FUNCTIONS
fun1 = par4 * gamma_mu
fun2 = par8 * gamma_mu
###############################################################
GLOBAL
fittype 2 (asymmetry fit)
data 1 18000 1 18000
fit 0.005 8
packing 1
###############################################################
RUN 07700 MUE4 PSI MUSR-ROOT (name beamline institute data-file-format)
#ADDRUN 07701 MUE4 PSI MUSR-ROOT (name beamline institute data-file-format)
alpha 1
map 0 0 0 0 0 0 0 0 0 0
forward 1
backward 2
backgr.fix 0.000000 0.000000
###############################################################
COMMANDS
MINIMIZE
MINOS
SAVE
###############################################################
FOURIER
units MHz # units either 'Gauss', 'Tesla', 'MHz', or 'Mc/s'
fourier_power 12
apodization STRONG # NONE, WEAK, MEDIUM, STRONG
plot POWER # REAL, IMAG, REAL_AND_IMAG, POWER, PHASE
phase 8.000000
#range_for_phase_correction 50.0 70.0
#range 0 200
###############################################################
PLOT 2 (asymmetry plot)
runs 1
range 0 8
view_packing 2
###############################################################
STATISTIC --- 2016-03-03 17:25:40
chisq = 8091.8, NDF = 7988, chisq/NDF = 1.012996

View File

@ -1,67 +0,0 @@
09102, Mu-frac 0.5, Mu 41MHz (0.42), Mu -35MHz(0.32), Ion. 250MHz, Capt. 1.5MHz, 0.1kG,
###############################################################
FITPARAMETER
# Nr. Name Value Step Pos_Error Boundaries
1 alpha 0.9998 0.000655606 none 0 none
2 asy 0.222118 0.00114398 none 0 0.33
3 phase 1.95348 0.308634 none
4 field 100.706 0.0663548 none 0 none
5 rate 0.526345 0.00550619 none 0 100
6 asyMu 0 0 none
7 phaseMu 0 0 none
8 freqMu 35 0 none
9 rateMu 0 0 none
###############################################################
THEORY
asymmetry 2
TFieldCos 3 fun1 (phase frequency)
simplExpo 5 (rate)
+
asymmetry 6
TFieldCos 7 8 (phase frequency)
simplExpo 9 (rate)
###############################################################
FUNCTIONS
fun1 = par4 * gamma_mu
###############################################################
RUN 09102 MUE4 PSI ROOT-NPP (name beamline institute data-file-format)
fittype 2 (asymmetry fit)
alpha 1
map 0 0 0 0 0 0 0 0 0 0
forward 1
backward 2
backgr.fix 0 0
data 1 12000 1 12000
t0 1 1
fit 0.00 8.00
packing 5
###############################################################
COMMANDS
SET BATCH
MINIMIZE
#MINOS
SAVE
END RETURN
###############################################################
FOURIER
units MHz # units either 'Gauss', 'MHz', or 'Mc/s'
fourier_power 12
apodization STRONG # NONE, WEAK, MEDIUM, STRONG
plot POWER # REAL, IMAG, REAL_AND_IMAG, POWER, PHASE
phase 8.50
#range_for_phase_correction 50.0 70.0
range 0.00 200.00
###############################################################
PLOT 2 (asymmetry plot)
runs 1
range 0.00 8.00 -0.30 0.30
###############################################################
STATISTIC --- 2010-03-06 18:19:16
chisq = 1666.28948, NDF = 1595, chisq/NDF = 1.0446956

View File

@ -1,67 +0,0 @@
09900- Mu-frac 1.00, Mu12 134.86 MHz(0.27), Mu23 143.71 MHz(0.23), ionRate 608086.30 MHz, capRate 1.00 MHz, SF rate 0.00, 100 G
###############################################################
FITPARAMETER
# Nr. Name Value Step Pos_Error Boundaries
1 alpha 1.0008 -0.0021 0.0021 0 none
2 asy 0.2717 -0.0014 0.0014 0 0.33
3 phase 1.78 -0.46 0.46
4 field 100.418 -0.035 0.035 0 none
5 rate 0.0000000072 -0.0000000072 0.0013386264 0 100
6 asyMu 0 0 none
7 phaseMu 0 0 none
8 freqMu 35 0 none
9 rateMu 0 0 none
###############################################################
THEORY
asymmetry 2
TFieldCos 3 fun1 (phase frequency)
simplExpo 5 (rate)
+
asymmetry 6
TFieldCos 7 8 (phase frequency)
simplExpo 9 (rate)
###############################################################
FUNCTIONS
fun1 = par4 * gamma_mu
###############################################################
RUN 09900 MUE4 PSI MUSR-ROOT (name beamline institute data-file-format)
fittype 2 (asymmetry fit)
alpha 1
map 0 0 0 0 0 0 0 0 0 0
forward 1
backward 2
backgr.fix 0 0
data 1 12000 1 12000
t0 0.0 0.0
fit 0 8
packing 5
###############################################################
COMMANDS
SET BATCH
MINIMIZE
MINOS
SAVE
END RETURN
###############################################################
FOURIER
units MHz # units either 'Gauss', 'Tesla', 'MHz', or 'Mc/s'
fourier_power 12
apodization STRONG # NONE, WEAK, MEDIUM, STRONG
plot POWER # REAL, IMAG, REAL_AND_IMAG, POWER, PHASE
phase 8
#range_for_phase_correction 50.0 70.0
range 0 200
###############################################################
PLOT 2 (asymmetry plot)
runs 1
range 0 8 -0.35 0.35
###############################################################
STATISTIC --- 2016-02-17 20:38:53
chisq = 1457.5, NDF = 1595, chisq/NDF = 0.913780

View File

@ -1,105 +0,0 @@
#---------------------------------------------------
# Makefile.PSimulateMuTransition
#
# Author: Thomas Prokscha
# Date: 25-Feb-2010
#
# $Id:$
#
#---------------------------------------------------
#---------------------------------------------------
# get compilation and library flags from root-config
ROOTCFLAGS = $(shell $(ROOTSYS)/bin/root-config --cflags)
ROOTLIBS = $(shell $(ROOTSYS)/bin/root-config --libs)
ROOTGLIBS = $(shell $(ROOTSYS)/bin/root-config --glibs)
#---------------------------------------------------
# depending on the architecture, choose the compiler,
# linker, and the flags to use
#
OSTYPE = $(shell uname)
ifeq ($(OSTYPE),Linux)
OS = LINUX
endif
ifeq ($(OSTYPE),Linux-gnu)
OS = LINUX
endif
ifeq ($(OSTYPE),darwin)
OS = DARWIN
endif
# -- Linux
ifeq ($(OS),LINUX)
CXX = g++
CXXFLAGS = -Wall -Wno-trigraphs -fPIC
INCLUDES = -I../include
LD = g++
LDFLAGS = -g
SOFLAGS = -O -shared
endif
# -- Darwin
ifeq ($(OS),DARWIN)
CXX = g++
CXXFLAGS = -Wall -Wno-trigraphs -fPIC
INCLUDES = -I../include
LD = g++
LDFLAGS = -g
SOFLAGS = -dynamic
endif
# installation directory
INSTALL_DIR = /usr/local
# the output from the root-config script:
CXXFLAGS += $(ROOTCFLAGS)
LDFLAGS +=
# the ROOT libraries (G = graphic)
LIBS = $(ROOTLIBS) -lXMLParser
GLIBS = $(ROOTGLIBS) -lXMLParser
# some definitions: headers (used to generate *Dict* stuff), sources, objects,...
OBJS =
OBJS += PSimulateMuTransition.o PSimulateMuTransitionDict.o
SHLIB = libPSimulateMuTransition.so
# make the shared lib:
#
all: $(SHLIB)
$(SHLIB): $(OBJS)
@echo "---> Building shared library $(SHLIB) ..."
/bin/rm -f $(SHLIB)
$(LD) $(OBJS) $(SOFLAGS) -o $(SHLIB) $(LIBS)
@echo "done"
# clean up: remove all object file (and core files)
# semicolon needed to tell make there is no source
# for this target!
#
clean:; @rm -f $(OBJS) *Dict* core*
@echo "---> removing $(OBJS)"
@echo "---> removing *~"
@rm -f *~
#
$(OBJS): %.o: %.cpp
$(CXX) $(INCLUDES) $(CXXFLAGS) -c $<
PSimulateMuTransitionDict.cpp: PSimulateMuTransition.h PSimulateMuTransitionLinkDef.h
@echo "Generating dictionary $@..."
rootcint -f $@ -c -p $^
install: all
@echo "Installing shared lib: libPSimulateMuTransition.so"
ifeq ($(OS),LINUX)
cp -pv $(SHLIB) $(INSTALL_DIR)/lib
cp -pv PSimulateMuTransition.h $(INSTALL_DIR)/include
# for root6
cp -pv PSimulateMuTransitionDict_rdict.pcm $(INSTALL_DIR)/lib
endif

View File

@ -1,452 +0,0 @@
/***************************************************************************
PSimulateMuTransition.cpp
Author: Thomas Prokscha
Date: 25-Feb-2010, 14-Apr-2016
Use root macros runMuSimulation.C and testAnalysis.C to run the simulation
and to get a quick look on the data. Data are saved to a root histogram file
with a structure similar to LEM histogram files; musrfit can be used to
analyze the simulated data.
Description:
Root class to simulate muon spin polarization under successive Mu+/Mu0 charge-exchange
or Mu0 spin-flip processes by a Monte-Carlo method. Consider transverse field geometry,
and assume initial muon spin direction in x, and field applied along z. For PxMu(t) in
muonium use the complex expression of
equation (4) in the paper of M. Senba, J. Phys. B 23, 1545 (1990), or
equation (7) in the paper of M. Senba, J. Phys. B 24, 3531 (1991);
note that PxMu(t) is given by a superposition of the four frequencies "nu_12", "nu_34",
"nu_23", "nu_14". These frequencies and the corresponding probabilities ("SetMuFractionState12"
for transitions 12 and 34, "SetMuFractionState23" for states 23 and 14) can be calculated
for a given field with the root macro AnisotropicMu.C
Parameters:
1) Precession frequencies of "nu_12", "nu_34", "nu_23", "nu_14"
2) fractions of nu_12, nu_34; and nu_23 and nu_14
3) total Mu0 fraction
4) Mu+ electron-capture rate
5) Mu0 ionization rate
6) Mu0 spin-flip rate
7) initial muon spin phase
9) total muon decay asymmetry
9) number of muon decays to be generated.
10) debug flag: if TRUE print capture/ionization events on screen
Output:
Two histograms ("forward" and "backward") are written to a root file.
The muon event simulation with a sequence of charge-changing processes is
done in Event():
simulate muon spin phase under charge-exchange with "4 Mu transitions"
1) according to Mu+/Mu0 fraction begin either with a Mu+ state or Mu state
2) Mu+: determine next electron-capture time t_c. If t_c is larger than decay time t_d
calculate muon spin precession for t_d; else calculate spin precession for t_c.
3) Determine next ionization time t_i; calculate Px(t_i) in Muonium; calculate the total
muon spin polarization Px(t_i)*Px(t_c).
4) get the next electron capture time, continue until t_d is reached, and calculate
the resulting polarization.
The Mu0 spin-flip processes are calculated in GTSpinFlip(), using eq. (17) of
M. Senba, J. Phys. B 24, 3531 (1991).
***************************************************************************/
/***************************************************************************
* Copyright (C) 2010 by Thomas Prokscha, Paul Scherrer Institut *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <iostream>
using namespace std;
#include <TMath.h>
#include <TComplex.h>
#include "PSimulateMuTransition.h"
ClassImp(PSimulateMuTransition)
//--------------------------------------------------------------------------
// Constructor
//--------------------------------------------------------------------------
/**
* <p> Constructor.
*
* \param seed for the random number generator
*/
PSimulateMuTransition::PSimulateMuTransition(UInt_t seed)
{
fValid = true;
fRandom = new TRandom2(seed);
if (fRandom == 0) {
fValid = false;
}
fNmuons = 100; // number of muons to simulate
fNshowProgress = 100; // print progress on screen every fNshowProgress events
fMuPrecFreq34 = 4463.; // vacuum Mu hyperfine coupling constant
fMuPrecFreq12 = 0.; // Mu precession frequency of a 12 transition
fMuPrecFreq23 = 0.; // Mu precession frequency of a 23 transition
fMuPrecFreq14 = 0.; // Mu precession frequency of a 14 transition
fMuPrecFreq13 = 0.; // Mu precession frequency of a 13 transition
fMuPrecFreq24 = 0.; // Mu precession frequency of a 24 transition
fMuonPrecFreq = 0.; // muon precession frequency
fBfield = 0.01; // magnetic field (T)
fCaptureRate = 0.01; // Mu+ capture rate (MHz)
fIonizationRate = 10.; // Mu0 ionization rate (MHz)
fSpinFlipRate = 0.001; // Mu0 spin flip rate (MHz)
fInitialPhase = 0.;
fMuonPhase = fInitialPhase;
fMuonDecayTime = 0.;
fAsymmetry = 0.27;
fMuFraction = 0.;
fMuFractionState12 = 0.25;
fMuFractionState34 = 0.25;
fMuFractionState23 = 0.25;
fMuFractionState14 = 0.25;
fMuFractionState13 = 0.;
fMuFractionState24 = 0.;
fDebugFlag = kFALSE;
}
//--------------------------------------------------------------------------
// Destructor
//--------------------------------------------------------------------------
/**
* <p> Destructor.
*
*/
PSimulateMuTransition::~PSimulateMuTransition()
{
if (fRandom) {
delete fRandom;
fRandom = 0;
}
}
//--------------------------------------------------------------------------
// Output of current settings
//--------------------------------------------------------------------------
/*!
* <p>Prints the current settings onto std output.
*/
void PSimulateMuTransition::PrintSettings() const
{
cout << endl << "Mu0 precession frequency 12 (MHz) = " << fMuPrecFreq12;
cout << endl << "Mu0 precession frequency 34 (MHz) = " << fMuPrecFreq34;
cout << endl << "Mu0 precession frequency 23 (MHz) = " << fMuPrecFreq23;
cout << endl << "Mu0 precession frequency 14 (MHz) = " << fMuPrecFreq14;
cout << endl << "Mu0 precession frequency 13 (MHz) = " << fMuPrecFreq13;
cout << endl << "Mu0 precession frequency 24 (MHz) = " << fMuPrecFreq24;
cout << endl << "Mu+ precession frequency (MHz) = " << fMuonGyroRatio * fBfield;
cout << endl << "B field (T) = " << fBfield;
cout << endl << "Mu+ electron capture rate (MHz) = " << fCaptureRate;
cout << endl << "Mu0 ionizatioan rate (MHz) = " << fIonizationRate;
cout << endl << "Mu0 spin-flip rate (MHz) = " << fSpinFlipRate;
if (fSpinFlipRate > 0.001)
cout << endl << "!!! Note: spin-flip rate > 0.001 only spin-flip processes are considered!!!";
else{
cout << endl << "!!! spin-flip rate <= 0.001: only charge-exchange cycles are considered!!!";
cout << endl << "!!! if spin-flip rate > 0.001, only spin-flip processes are considered!!!";
}
cout << endl << "Decay asymmetry = " << fAsymmetry;
cout << endl << "Muonium fraction = " << fMuFraction;
cout << endl << "Muonium fraction state12 = " << fMuFractionState12;
cout << endl << "Muonium fraction state34 = " << fMuFractionState34;
cout << endl << "Muonium fraction state23 = " << fMuFractionState23;
cout << endl << "Muonium fraction state14 = " << fMuFractionState14;
cout << endl << "Muonium fraction state13 = " << fMuFractionState13;
cout << endl << "Muonium fraction state24 = " << fMuFractionState24;
cout << endl << "Number of particles to simulate = " << fNmuons;
cout << endl << "Print progress on screen frequency = " << fNshowProgress;
cout << endl << "Initial muon spin phase (degree) = " << fInitialPhase;
cout << endl << "Debug flag = " << fDebugFlag;
cout << endl << endl;
}
//--------------------------------------------------------------------------
// SetSeed (public)
//--------------------------------------------------------------------------
/**
* <p>Sets the seed of the random generator.
*
* \param seed for the random number generator
*/
void PSimulateMuTransition::SetSeed(UInt_t seed)
{
if (!fValid)
return;
fRandom->SetSeed(seed);
}
//--------------------------------------------------------------------------
// Run (public)
//--------------------------------------------------------------------------
/**
* \param histoForward
*/
void PSimulateMuTransition::Run(TH1F *histoForward, TH1F *histoBackward)
{
// Double_t muoniumPolX = 1.0; //polarization in x direction
Int_t i;
if (histoForward == 0 || histoBackward == 0)
return;
fMuonPrecFreq = fMuonGyroRatio * fBfield;
for (i = 0; i<fNmuons; i++){
fMuonPhase = TMath::TwoPi() * fInitialPhase/360.; // transform to radians
fMuonDecayTime = NextEventTime(fMuonDecayRate);
if (fSpinFlipRate > 0.001){// consider only Mu0 spin-flip in this case
fMuonPhase += TMath::ACos(GTSpinFlip(fMuonDecayTime));
}
else{
// initial muon state Mu+ or Mu0?
if (fRandom->Rndm() <= 1.-fMuFraction)
fMuonPhase += TMath::ACos(Event("Mu+"));
else
fMuonPhase += TMath::ACos(Event("Mu0"));
}
// fill 50% in "forward", and 50% in "backward" detector to get independent
// events in "forward" and "backward" histograms. This allows "normal" uSR
// analysis of the data
// change muon decay time to ns
if (fRandom->Rndm() <= 0.5)
histoForward->Fill(fMuonDecayTime*1000., 1. + fAsymmetry*TMath::Cos(fMuonPhase));
else
histoBackward->Fill(fMuonDecayTime*1000., 1. - fAsymmetry*TMath::Cos(fMuonPhase));
if ( (i%fNshowProgress) == 0) cout << "number of events processed: " << i << endl;
}
cout << "number of events processed: " << i << endl;
return;
}
//--------------------------------------------------------------------------
// NextEventTime (private)
//--------------------------------------------------------------------------
/**
* <p>Determine time of next event, assuming "Poisson" distribution in time
*
* \param EventRate event rate in MHz; returns next event time in micro-seconds
*/
Double_t PSimulateMuTransition::NextEventTime(const Double_t &EventRate)
{
if (EventRate <= 0.)
return -1.; // signal error
return -1./EventRate * TMath::Log(fRandom->Rndm());
}
//--------------------------------------------------------------------------
// Phase (private)
//--------------------------------------------------------------------------
// /**
/* * <p>Determines phase of the muon spin
*
* \param time duration of precession (us);
* \param chargeState charge state of Mu ("Mu+" or "Mu0")
*/
// Double_t PSimulateMuTransition::PrecessionPhase(const Double_t &time, const TString chargeState)
// {
// Double_t muonPhaseX;
// Double_t muoniumPolX = 0;
//
// if (chargeState == "Mu+")
// muonPhaseX = TMath::TwoPi()*fMuonPrecFreq*time;
// else if (chargeState == "Mu0"){
// muoniumPolX = GTFunction(time).Re();
// if (fDebugFlag) cout << "muoniumPolX = " << muoniumPolX << endl;
// muonPhaseX = TMath::ACos(muoniumPolX);
// }
// else
// muonPhaseX = 0.;
//
// return muonPhaseX;
// }
//--------------------------------------------------------------------------
// Mu0 transverse field polarization function (private)
//--------------------------------------------------------------------------
/**
* <p>Calculates Mu0 polarization in x direction by superposition of four Mu0 frequencies
*
* \param time (us);
*/
TComplex PSimulateMuTransition::GTFunction(const Double_t &time, const TString chargeState)
{
Double_t twoPi = TMath::TwoPi();
TComplex complexPol = 0;
if (chargeState == "Mu+")
complexPol = TComplex::Exp(-TComplex::I()*twoPi*fMuonPrecFreq*time);
else{
complexPol =
(fMuFractionState12 * TComplex::Exp(+TComplex::I()*twoPi*fMuPrecFreq12*time) +
fMuFractionState34 * TComplex::Exp(-TComplex::I()*twoPi*fMuPrecFreq34*time))
+
(fMuFractionState23 * TComplex::Exp(+TComplex::I()*twoPi*fMuPrecFreq23*time) +
fMuFractionState14 * TComplex::Exp(+TComplex::I()*twoPi*fMuPrecFreq14*time))
+
(fMuFractionState13 * TComplex::Exp(+TComplex::I()*twoPi*fMuPrecFreq13*time) +
fMuFractionState24 * TComplex::Exp(+TComplex::I()*twoPi*fMuPrecFreq24*time));
}
return complexPol;
}
//--------------------------------------------------------------------------
// Mu0 transverse field polarization function after n spin-flip collisions (private)
//--------------------------------------------------------------------------
/**
* <p>Calculates Mu0 polarization in x direction after n spin flip collisions.
* See M. Senba, J.Phys. B24, 3531 (1991), equation (17)
*
* \param time (us);
*/
Double_t PSimulateMuTransition::GTSpinFlip(const Double_t &time)
{
TComplex complexPolX = 1.0;
Double_t muoniumPolX = 1.0; //initial polarization in x direction
Double_t eventTime = 0;
Double_t eventDiffTime = 0;
Double_t lastEventTime = 0;
eventTime += NextEventTime(fSpinFlipRate);
if (eventTime >= time){
muoniumPolX = GTFunction(time, "Mu0").Re();
}
else{
while (eventTime < time){
eventDiffTime = eventTime - lastEventTime;
complexPolX = complexPolX * GTFunction(eventDiffTime, "Mu0");
lastEventTime = eventTime;
eventTime += NextEventTime(fSpinFlipRate);
}
// calculate for the last collision
eventDiffTime = time - lastEventTime;
complexPolX = complexPolX * GTFunction(eventDiffTime, "Mu0");
muoniumPolX = complexPolX.Re();
}
return muoniumPolX;
}
//--------------------------------------------------------------------------
// Event (private)
//--------------------------------------------------------------------------
/**
* <p> Generates "muon event": simulate muon spin polarization under charge-exchange with
* a neutral muonium state in transverse field, where the polarization evolution
* PxMu(t) of the muon spin in muonium is determined by a superposition of the
* four "Mu transitions" nu_12, nu_34, nu_23, and nu_14. Use complex polarization
* functions.
* 1) according to Mu+/Mu0 fraction begin either with a Mu+ state or Mu state
* 2) Mu+: determine next electron-capture time t_c. If t_c is larger than decay time t_d
* calculate muon spin precession for t_d, Px(t_i); else calculate spin precession for t_c.
* 3) Determine next ionization time t_i+1; calculate Px(t_i+1) in Muonium. Polarization
* after ionization process is given by Px(t_i+1)*Px(t_i).
* 4) get the next electron capture time, continue until t_d is reached.
*
*
* <p>Calculates Mu0 polarization in x direction during cyclic charge exchange.
* See M. Senba, J.Phys. B23, 1545 (1990), equations (9), (11)
* \param muonString if eq. "Mu+" begin with Mu+ precession
*/
Double_t PSimulateMuTransition::Event(const TString muonString)
{
TComplex complexPolX = 1.0;
Double_t muoniumPolX = 1.0; //initial polarization in x direction
Double_t eventTime, eventDiffTime, captureTime, ionizationTime;
eventTime = 0.;
eventDiffTime = 0.;
if (fDebugFlag) cout << "Decay time = " << fMuonDecayTime << endl;
// charge-exchange loop until muon decays
while (1) {
if (muonString == "Mu+"){// Mu+ initial state; get next electron capture time
captureTime = NextEventTime(fCaptureRate);
eventTime += captureTime;
if (fDebugFlag) cout << "Capture time = " << captureTime << " PolX = " << complexPolX.Re() << endl;
if (eventTime < fMuonDecayTime)
complexPolX *= GTFunction(captureTime, "Mu+");
else{ //muon decays; handle precession prior to muon decay
eventDiffTime = fMuonDecayTime - (eventTime - captureTime);
complexPolX *= GTFunction(eventDiffTime, "Mu+");
break;
}
// now, we have Mu0; get next ionization time
ionizationTime = NextEventTime(fIonizationRate);
eventTime += ionizationTime;
if (fDebugFlag) cout << "Ioniza. time = " << ionizationTime << " PolX = " << complexPolX.Re() << endl;
if (eventTime < fMuonDecayTime)
complexPolX *= GTFunction(ionizationTime, "Mu0");
else{ //muon decays; handle precession prior to muon decay
eventDiffTime = fMuonDecayTime - (eventTime - ionizationTime);
complexPolX *= GTFunction(eventDiffTime, "Mu0");
break;
}
}
else{// Mu0 as initial state; get next ionization time
ionizationTime = NextEventTime(fIonizationRate);
eventTime += ionizationTime;
if (fDebugFlag)
cout << "Mu Ioniza. time = " << ionizationTime << " PolX = " << complexPolX.Re() << endl;
if (eventTime < fMuonDecayTime)
complexPolX *= GTFunction(ionizationTime, "Mu0");
else{ //muon decays; handle precession prior to muon decay
eventDiffTime = fMuonDecayTime - (eventTime - ionizationTime);
complexPolX *= GTFunction(eventDiffTime, "Mu0");
break;
}
// Mu+ state; get next electron capture time
captureTime = NextEventTime(fCaptureRate);
eventTime += captureTime;
if (fDebugFlag) cout << "Capture time = " << captureTime << " PolX = " << complexPolX.Re() << endl;
if (eventTime < fMuonDecayTime)
complexPolX *= GTFunction(captureTime, "Mu+");
else{ //muon decays; handle precession prior to muon decay
eventDiffTime = fMuonDecayTime - (eventTime - captureTime);
complexPolX *= GTFunction(eventDiffTime, "Mu+");
break;
}
}
}
muoniumPolX = complexPolX.Re();
if (fDebugFlag) cout << " Final PolX = " << muoniumPolX << endl;
return muoniumPolX;
}

View File

@ -1,119 +0,0 @@
/***************************************************************************
PSimulateMuTransition.h
Author: Thomas Prokscha
Date: 25-Feb-2010
$Id$
***************************************************************************/
/***************************************************************************
* Copyright (C) 2010 by Thomas Prokscha, Paul Scherrer Institut *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef _PSIMULATEMUTRANSITION_H_
#define _PSIMULATEMUTRANSITION_H_
#include <TObject.h>
#include <TH1F.h>
#include <TRandom2.h>
#include <TComplex.h>
// global constants
const Double_t fMuonGyroRatio = 135.54; //!< muon gyromagnetic ratio (MHz/T)
const Double_t fMuonDecayRate = 0.4551; //!< muon decay rate (1/tau_mu, MHz)
class PSimulateMuTransition : public TObject
{
public:
PSimulateMuTransition(UInt_t seed = 0);
virtual ~PSimulateMuTransition();
virtual void PrintSettings() const;
virtual void SetNmuons(Int_t value) { fNmuons = value; } //!< number of muons
virtual void SetNshowProgress(Int_t value) { fNshowProgress = value; } //!< frequency of output on screen how many muons have been processed
virtual void SetDebugFlag(Bool_t value) { fDebugFlag = value; } //!< debug flag
virtual void SetBfield(Double_t value) { fBfield = value; } //!< sets magnetic field (T)
virtual void SetMuPrecFreq12(Double_t value) { fMuPrecFreq12 = value; } //!< sets Mu transition frequency (MHz)
virtual void SetMuPrecFreq34(Double_t value) { fMuPrecFreq34 = value; } //!< sets Mu transition frequency (MHz)
virtual void SetMuPrecFreq23(Double_t value) { fMuPrecFreq23 = value; } //!< sets Mu transition frequency (MHz)
virtual void SetMuPrecFreq14(Double_t value) { fMuPrecFreq14 = value; } //!< sets Mu transition frequency (MHz)
virtual void SetMuPrecFreq13(Double_t value) { fMuPrecFreq13 = value; } //!< sets Mu transition frequency (MHz)
virtual void SetMuPrecFreq24(Double_t value) { fMuPrecFreq24 = value; } //!< sets Mu transition frequency (MHz)
virtual void SetCaptureRate(Double_t value){ fCaptureRate = value; } //!< sets Mu+ electron capture rate (MHz)
virtual void SetIonizationRate(Double_t value){ fIonizationRate = value; } //!< sets Mu0 ionization rate (MHz)
virtual void SetSpinFlipRate(Double_t value){ fSpinFlipRate = value; } //!< sets Mu0 spin flip rate (MHz)
virtual void SetDecayAsymmetry(Double_t value){ fAsymmetry = value; } //!< muon decay asymmetry
virtual void SetMuFraction(Double_t value){ fMuFraction = value; } //!< Muonium fraction
virtual void SetMuFractionState12(Double_t value){ fMuFractionState12 = value; }
virtual void SetMuFractionState34(Double_t value){ fMuFractionState34 = value; }
virtual void SetMuFractionState23(Double_t value){ fMuFractionState23 = value; }
virtual void SetMuFractionState14(Double_t value){ fMuFractionState14 = value; }
virtual void SetMuFractionState13(Double_t value){ fMuFractionState13 = value; }
virtual void SetMuFractionState24(Double_t value){ fMuFractionState24 = value; }
virtual Bool_t IsValid() { return fValid; }
virtual void SetSeed(UInt_t seed);
virtual Double_t GetBfield() { return fBfield; } //!< returns the magnetic field (T)
virtual Double_t GetCaptureRate() { return fCaptureRate; } //!< returns Mu+ electron capture rate (MHz)
virtual Double_t GetIonizationRate() { return fIonizationRate; } //!< returns Mu0 ionization rate (MHz)
virtual void Run(TH1F *histoForward, TH1F *histoBackward);
private:
Bool_t fValid;
TRandom2 *fRandom;
Double_t fBfield; //!< magnetic field (T)
Double_t fMuPrecFreq12; //!< Mu transition frequency 12 (MHz)
Double_t fMuPrecFreq34; //!< Mu transition frequency 34 (MHz)
Double_t fMuPrecFreq23; //!< Mu transition frequency 23 (MHz)
Double_t fMuPrecFreq14; //!< Mu transition frequency 14 (MHz)
Double_t fMuPrecFreq13; //!< Mu transition frequency 13 (MHz)
Double_t fMuPrecFreq24; //!< Mu transition frequency 24 (MHz)
Double_t fMuonPrecFreq; //!< muon precession frequency (MHz)
Double_t fCaptureRate; //!< Mu+ electron capture rate (MHz)
Double_t fIonizationRate; //!< Mu0 ionization rate (MHz)
Double_t fSpinFlipRate; //!< Mu0 spin-flip rate (MHz)
Double_t fInitialPhase; //!< initial muon spin phase
Double_t fMuonDecayTime; //!< muon decay time (us)
Double_t fMuonPhase; //!< phase of muon spin
Double_t fAsymmetry; //!< muon decay asymmetry
Double_t fMuFraction; //!< total Mu fraction [0,1]
Double_t fMuFractionState12; //!< fraction of Mu in state 12
Double_t fMuFractionState34; //!< fraction of Mu in state 34
Double_t fMuFractionState23; //!< fraction of Mu in state 23
Double_t fMuFractionState14; //!< fraction of Mu in state 14
Double_t fMuFractionState13; //!< fraction of Mu in state 13
Double_t fMuFractionState24; //!< fraction of Mu in state 24
Int_t fNmuons; //!< number of muons to simulate
Int_t fNshowProgress; //!< output on screen how many muons have been processed
Bool_t fDebugFlag; //!< debug flag
virtual Double_t NextEventTime(const Double_t &EventRate);
// virtual Double_t PrecessionPhase(const Double_t &time, const TString chargeState);
virtual TComplex GTFunction(const Double_t &time, const TString chargeState); //!< transverse field polarization function of Mu0 or Mu+
virtual Double_t GTSpinFlip(const Double_t &time); //!< transverse field polarization function after spin-flip collisions
virtual Double_t Event(const TString muonString);
ClassDef(PSimulateMuTransition, 0)
};
#endif // _PSIMULATEMUTRANSITION_H_

View File

@ -1,40 +0,0 @@
/***************************************************************************
PSimulateMuTransitionLinkDef.h
Author: Thomas Prokscha
Date: 25-Feb-2010
$Id$
***************************************************************************/
/***************************************************************************
* Copyright (C) 2010 by Thomas Prokscha, Paul Scherrer Institut *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
// changed for root6
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class PSimulateMuTransition+;
#endif

View File

@ -1,270 +0,0 @@
/***************************************************************************
runMuSimulation.C
Author: Thomas Prokscha
Date: 25-Feb-2010
$Id$
***************************************************************************/
/***************************************************************************
* Copyright (C) 2010 by Thomas Prokscha, Paul Scherrer Institut *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
//
// either do
// root> .L runMuSimulation.C
// root> runMuSimulation()
//
// or
// root> .x runMuSimulation.C
//
#include "TMusrRunHeader.h"
#include "PSimulateMuTransition.h"
#define NDECAYHISTS 2
void runMuSimulation()
{
// load libraries during root startup, defined in rootlogon.C
// gSystem->Load("$ROOTSYS/lib/libPSimulateMuTransition");
// gSystem->Load("$ROOTSYS/lib/libTMusrRunHeader.so");
char titleStr[256];
TFolder *histosFolder;
TFolder *decayAnaModule, *scAnaModule;
TFolder *gRunHeader;
TString runTitle;
TString histogramFileName;
TObjArray Slist(0);
TMusrRunPhysicalQuantity prop;
//prepare to run simulation; here: isotropic Mu with A0 = 100.0 MHz
UInt_t runNo = 7701;
Double_t T = 300.; //temperature
Double_t EA = 100; //activation energy (meV)
Double_t spinFlipRate = 0.01; //if spinFlipRate > 0.001 only spin-flip processes will be simulated
Double_t capRate = 0.001;//*sqrt(T/200.); //assume that capture rate varies as sqrt(T), capRate = sigma*v*p , v ~ sqrt(T)
Double_t preFac = 6.7e7;
Double_t ionRate; //assume Arrhenius behaviour ionRate = preFac*exp(-EA/kT)
ionRate = 0.001; //preFac * exp(-EA/(0.08625*T)); // Ge: 2.9*10^7MHz "attempt" frequency; 1K = 0.08625 meV
Double_t B = 100.0; //field in G
Double_t Bvar = 0.; //field variance
Double_t Freq12 = 40.023; //Mu freq of the 12 transition
Double_t Freq34 = 59.977; //Mu freq of the 34 transition
Double_t Freq23 = 238.549; //Mu freq of the 23 transition
Double_t Freq14 = 338.549; //Mu freq of the 14 transition
Double_t Freq13 = 278.571; //Mu freq of the 23 transition
Double_t Freq24 = 325.165; //Mu freq of the 14 transition
Double_t MuFrac = 1.0; //total Mu fraction
Double_t MuFrac12 = 0.486; //weight of transition 12
Double_t MuFrac34 = 0.486; //weight of transition 34
Double_t MuFrac23 = 0.014; //weight of transition 23
Double_t MuFrac14 = 0.014; //weight of transition 14
Double_t MuFrac13 = 0.0; //weight of transition 13
Double_t MuFrac24 = 0.0; //weight of transition 24
Int_t Nmuons = 5e6; //number of muons
Int_t NshowProgress = 1e4; //frequency to show progress on screen
Double_t Asym = 0.27; //muon decay asymmetry
Int_t debugFlag = 0; //print debug information on screen
TTimeStamp *timeStampStart = new TTimeStamp();
cout << endl << "Simulation started on:" << endl;
timeStampStart->Print("l");
cout << endl;
histogramFileName = TString("0");
histogramFileName += runNo;
histogramFileName += TString(".root");
sprintf(titleStr,"- complexMuPol, A0 100MHz, Mu-frac %3.2f, Mu12 %6.2f MHz(%3.2f), Mu23 %6.2f MHz(%3.2f), ionRate %8.3f MHz, capRate %6.3f MHz, SF rate %6.3f MHz, %5.1f G", MuFrac, Freq12, MuFrac12, Freq23, MuFrac23, ionRate, capRate, spinFlipRate, B);
runTitle = TString("0");
runTitle += runNo;
runTitle += TString(titleStr);
cout << runTitle << endl << endl;
PSimulateMuTransition *simulateMuTransition = new PSimulateMuTransition();
if (!simulateMuTransition->IsValid()){
cerr << endl << "**ERROR** while invoking PSimulateTransition" << endl;
return;
}
simulateMuTransition->SetMuPrecFreq12(Freq12); // MHz
simulateMuTransition->SetMuPrecFreq34(Freq34); // MHz
simulateMuTransition->SetMuPrecFreq23(Freq23); // MHz
simulateMuTransition->SetMuPrecFreq14(Freq14); // MHz
simulateMuTransition->SetMuPrecFreq13(Freq13); // MHz
simulateMuTransition->SetMuPrecFreq24(Freq24); // MHz
simulateMuTransition->SetMuFraction(MuFrac); // initial Mu fraction
simulateMuTransition->SetMuFractionState12(MuFrac12);
simulateMuTransition->SetMuFractionState34(MuFrac34);
simulateMuTransition->SetMuFractionState23(MuFrac23);
simulateMuTransition->SetMuFractionState14(MuFrac14);
simulateMuTransition->SetMuFractionState13(MuFrac13);
simulateMuTransition->SetMuFractionState24(MuFrac24);
simulateMuTransition->SetBfield(B/10000.); // Tesla
simulateMuTransition->SetCaptureRate(capRate); // MHz
simulateMuTransition->SetIonizationRate(ionRate); // MHz
simulateMuTransition->SetSpinFlipRate(spinFlipRate); // MHz
simulateMuTransition->SetNshowProgress(NshowProgress);
simulateMuTransition->SetNmuons(Nmuons);
simulateMuTransition->SetDecayAsymmetry(Asym);
simulateMuTransition->SetDebugFlag(debugFlag); // to print time and phase during charge-changing cycle
// feed run info header
gRunHeader = gROOT->GetRootFolder()->AddFolder("RunHeader", "MuTransition Simulation Header Info");
gROOT->GetListOfBrowsables()->Add(gRunHeader, "RunHeader");
// header = new TLemRunHeader();
TMusrRunHeader *header = new TMusrRunHeader(true);
header->Set("RunInfo/Generic Validator URL", "http://lmu.web.psi.ch/facilities/software/MusrRoot/validation/MusrRoot.xsd");
header->Set("RunInfo/Specific Validator URL", "http://lmu.web.psi.ch/facilities/software/MusrRoot/validation/MusrRootLEM.xsd");
header->Set("RunInfo/Generator", "runMuSimulation");
header->Set("RunInfo/File Name", histogramFileName.Data());
header->Set("RunInfo/Run Title", runTitle.Data());
header->Set("RunInfo/Run Number", (Int_t) runNo);
header->Set("RunInfo/Run Start Time", "2016-03-01 06:20:00");
header->Set("RunInfo/Run Stop Time", "2016-03-01 06:20:11");
prop.Set("Run Duration", 11.0, "sec");
header->Set("RunInfo/Run Duration", prop);
header->Set("RunInfo/Laboratory", "PSI");
header->Set("RunInfo/Instrument", "MC-Simulation");
prop.Set("Muon Beam Momentum", 0.0, "MeV/c");
header->Set("RunInfo/Muon Beam Momentum", prop);
header->Set("RunInfo/Muon Species", "positive muon and muonium");
header->Set("RunInfo/Muon Source", "Simulation");
header->Set("RunInfo/Setup", "Monte-Carlo setup");
header->Set("RunInfo/Comment", "Testing effect of charge-exchange or Mu0 spin flip processes on uSR signal");
header->Set("RunInfo/Sample Name", "Monte-Carlo");
prop.Set("Sample Temperature", MRH_UNDEFINED, T, 0.01, "K");
header->Set("RunInfo/Sample Temperature", prop);
prop.Set("Sample Magnetic Field", MRH_UNDEFINED, B, Bvar, "G");
header->Set("RunInfo/Sample Magnetic Field", prop);
header->Set("RunInfo/No of Histos", 2);
prop.Set("Time Resolution", 1.0, "ns", "Simulation");
header->Set("RunInfo/Time Resolution", prop);
prop.Set("Implantation Energy", 0, "keV");
header->Set("RunInfo/Implantation Energy", prop);
prop.Set("Muon Spin Angle", 0, "degree along x");
header->Set("RunInfo/Muon Spin Angle", prop);
header->Set("DetectorInfo/Detector001/Name", "e+ forward");
header->Set("DetectorInfo/Detector001/Histo Number", 1);
header->Set("DetectorInfo/Detector001/Histo Length", 18001);
header->Set("DetectorInfo/Detector001/Time Zero Bin", 0.001); //doesn't like 0.0 as time zero
header->Set("DetectorInfo/Detector001/First Good Bin", 1);
header->Set("DetectorInfo/Detector001/Last Good Bin", 18000);
header->Set("DetectorInfo/Detector002/Name", "e+ backward");
header->Set("DetectorInfo/Detector002/Histo Number", 2);
header->Set("DetectorInfo/Detector002/Histo Length", 18001);
header->Set("DetectorInfo/Detector002/Time Zero Bin", 0.001);
header->Set("DetectorInfo/Detector002/First Good Bin", 1);
header->Set("DetectorInfo/Detector002/Last Good Bin", 18000);
// simulation parameters
header->Set("Simulation/Mu0 Precession frequency 12", Freq12);
header->Set("Simulation/Mu0 Precession frequency 34", Freq34);
header->Set("Simulation/Mu0 Precession frequency 23", Freq23);
header->Set("Simulation/Mu0 Precession frequency 14", Freq14);
header->Set("Simulation/Mu0 Precession frequency 13", Freq13);
header->Set("Simulation/Mu0 Precession frequency 24", Freq24);
header->Set("Simulation/Mu0 Fraction", MuFrac);
header->Set("Simulation/Mu0 Fraction 12", MuFrac12);
header->Set("Simulation/Mu0 Fraction 34", MuFrac34);
header->Set("Simulation/Mu0 Fraction 23", MuFrac23);
header->Set("Simulation/Mu0 Fraction 14", MuFrac14);
header->Set("Simulation/Mu0 Fraction 13", MuFrac13);
header->Set("Simulation/Mu0 Fraction 24", MuFrac24);
header->Set("Simulation/Mu0 Activation Energy", EA);
header->Set("Simulation/Mu0 Activation PreFactor", preFac);
header->Set("Simulation/Mux Capture Rate", capRate);
header->Set("Simulation/Mu0 Ionization Rate", ionRate);
header->Set("Simulation/Mu0 Spin Flip Rate", spinFlipRate);
header->Set("Simulation/Number of Muons", Nmuons);
header->Set("Simulation/Decay Asymmetry", Asym);
header->Set("SampleEnvironmentInfo/Cryo", "no cryostat");
header->Set("MagneticFieldEnvironmentInfo/Magnet Name", "Field along z");
header->Set("BeamlineInfo/Name", "Monte-Carlo setup");
histosFolder = gROOT->GetRootFolder()->AddFolder("histos", "Histograms");
gROOT->GetListOfBrowsables()->Add(histosFolder, "histos");
decayAnaModule = histosFolder->AddFolder("DecayAnaModule", "muSR decay histograms");
scAnaModule = histosFolder->AddFolder("SCAnaModule", "SlowControl histograms");
TH1F *histo[NDECAYHISTS];
char str[128];
for (UInt_t i=0; i<NDECAYHISTS; i++) {
sprintf(str, "hDecay00%d", (Int_t)i+1);
histo[i] = new TH1F(str, str, 18001, -0.5, 18000.5);
}
for (UInt_t i=0; i<NDECAYHISTS; i++)
decayAnaModule->Add(histo[i]);
// run simulation
simulateMuTransition->PrintSettings();
simulateMuTransition->Run(histo[0], histo[1]);
// write file
TFile *fout = new TFile(histogramFileName.Data(), "RECREATE", "Midas MC Histograms");
if (fout == 0) {
cout << endl << "**ERROR** Couldn't create ROOT file";
cout << endl << endl;
exit(0);
}
fout->cd();
header->FillFolder(gRunHeader);
gRunHeader->Add(&Slist);
Slist.SetName("RunSummary");
histosFolder->Write();
gRunHeader->Write();
fout->Close();
cout << "Histograms written to " << histogramFileName.Data() << endl;
cout << endl << "Simulation stopped on:" << endl;
TTimeStamp *timeStampEnd = new TTimeStamp();
timeStampEnd->Print("l");
cout << endl;
// delete fout;
// delete header;
// delete histo[0];
// delete histo[1];
// delete gRunHeader;
}

View File

@ -1,59 +0,0 @@
/***************************************************************************
testAnalysis.C
Author: Thomas Prokscha
Date: 26-Feb-2010
$Id$
***************************************************************************/
/***************************************************************************
* Copyright (C) 2010 by Thomas Prokscha, Paul Scherrer Institut *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
{
//gROOT->Reset();
Int_t rebin = 5;
Double_t t0, tbin;
t0 = 0.;
tbin = 1.;
gROOT->ProcessLine(".x defineFit.C"); //define fit function muonLife
histos = dynamic_cast <TFolder*>(gDirectory->Get("histos"));
hDecay00 = dynamic_cast <TH1F*>(histos->FindObjectAny("hDecay00"));
hDecay01 = dynamic_cast <TH1F*>(histos->FindObjectAny("hDecay01"));
hForward = hDecay00->Rebin(rebin, "hForward");
hBackward = hDecay01->Rebin(rebin, "hBackward");
//hForward->Draw();
hSum = (TH1*) hForward->Clone("hSum");
hSum->Reset();
hSum->Add(hForward, hBackward, 1., 1.);
//hSum->Draw();
hAsym = (TH1*) hForward->GetAsymmetry(hBackward, 1., 0.);
hAsym->SetName("Asymmetry");
hAsym->SetTitle("Asymmetry");
hAsym->GetXaxis()->SetTitle("Time (ns)");
hAsym->Draw();
asymTFExpo->SetLineColor(2); //fit function red
}

View File

@ -41,7 +41,10 @@
#include <TFile.h>
#include <TFolder.h>
#ifdef HAVE_GIT_REV_H
#include "git-revision.h"
#endif
#include "PMusr.h"
#include "TMusrRunHeader.h"
@ -61,9 +64,17 @@ int main(int argc, char *argv[])
if (!strcmp(argv[1], "--version")) {
#ifdef HAVE_CONFIG_H
#ifdef HAVE_GIT_REV_H
std::cout << std::endl << "write_musrRoot_runHeader version: " << PACKAGE_VERSION << ", git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << " (" << BUILD_TYPE << "), ROOT version: " << ROOT_VERSION_USED << std::endl << std::endl;
#else
std::cout << std::endl << "write_musrRoot_runHeader version: " << PACKAGE_VERSION << " (" << BUILD_TYPE << "), ROOT version: " << ROOT_VERSION_USED << std::endl << std::endl;
#endif
#else
#ifdef HAVE_GIT_REV_H
std::cout << std::endl << "write_musrRoot_runHeader git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << std::endl << std::endl;
#else
std::cout << std::endl << "write_musrRoot_runHeader version: unknown." << std::endl << std::endl;
#endif
#endif
return 0;
}