Commit some code snippets lying around here already for a few years
This commit is contained in:
parent
8884600bec
commit
cb995d984d
@ -811,6 +811,7 @@ AC_CONFIG_FILES([Makefile \
|
|||||||
src/external/libFitPofB/Makefile \
|
src/external/libFitPofB/Makefile \
|
||||||
src/external/libFitPofB/classes/Makefile \
|
src/external/libFitPofB/classes/Makefile \
|
||||||
src/external/libLFRelaxation/Makefile \
|
src/external/libLFRelaxation/Makefile \
|
||||||
|
src/external/libZFRelaxation/Makefile \
|
||||||
src/external/libGapIntegrals/Makefile \
|
src/external/libGapIntegrals/Makefile \
|
||||||
src/external/libCalcMeanFieldsLEM/Makefile \
|
src/external/libCalcMeanFieldsLEM/Makefile \
|
||||||
src/external/Nonlocal/Makefile \
|
src/external/Nonlocal/Makefile \
|
||||||
|
1
src/external/Makefile.am
vendored
1
src/external/Makefile.am
vendored
@ -13,6 +13,7 @@ if BUILD_BMWLIBS
|
|||||||
BMWDIRS = BMWtools \
|
BMWDIRS = BMWtools \
|
||||||
libFitPofB \
|
libFitPofB \
|
||||||
libLFRelaxation \
|
libLFRelaxation \
|
||||||
|
libZFRelaxation \
|
||||||
libGapIntegrals \
|
libGapIntegrals \
|
||||||
libCalcMeanFieldsLEM
|
libCalcMeanFieldsLEM
|
||||||
endif
|
endif
|
||||||
|
57
src/external/libZFRelaxation/Makefile.am
vendored
Normal file
57
src/external/libZFRelaxation/Makefile.am
vendored
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
## Process this file with automake to create Makefile.in
|
||||||
|
## $Id$
|
||||||
|
|
||||||
|
h_sources = \
|
||||||
|
ZFRelaxation.h
|
||||||
|
|
||||||
|
h_linkdef = \
|
||||||
|
ZFRelaxationLinkDef.h
|
||||||
|
|
||||||
|
dict_h_sources = \
|
||||||
|
ZFRelaxationDict.h
|
||||||
|
|
||||||
|
cpp_sources = \
|
||||||
|
ZFRelaxation.cpp
|
||||||
|
|
||||||
|
dict_cpp_sources = \
|
||||||
|
ZFRelaxationDict.cpp
|
||||||
|
|
||||||
|
include_HEADERS = $(h_sources)
|
||||||
|
noinst_HEADERS = $(h_linkdef) $(dict_h_sources)
|
||||||
|
|
||||||
|
INCLUDES = -I$(top_srcdir)/src/include $(PMUSR_CFLAGS) $(ROOT_CFLAGS)
|
||||||
|
AM_CXXFLAGS = $(LOCAL_LIB_CXXFLAGS)
|
||||||
|
|
||||||
|
BUILT_SOURCES = $(dict_cpp_sources) $(dict_h_sources)
|
||||||
|
AM_LDFLAGS = $(LOCAL_LIB_LDFLAGS) -L@ROOTLIBDIR@
|
||||||
|
CLEANFILES = *Dict.cpp *Dict.h *~ core
|
||||||
|
|
||||||
|
%Dict.cpp %Dict.h: %.h %LinkDef.h
|
||||||
|
@ROOTCINT@ -v -f $*Dict.cpp -c -p $(INCLUDES) $^
|
||||||
|
|
||||||
|
lib_LTLIBRARIES = libZFRelaxation.la
|
||||||
|
|
||||||
|
libZFRelaxation_la_SOURCES = $(h_sources) $(cpp_sources) $(dict_h_sources) $(dict_cpp_sources)
|
||||||
|
libZFRelaxation_la_LIBADD = $(USERFCN_LIBS) $(ROOT_LIBS)
|
||||||
|
libZFRelaxation_la_LDFLAGS = -version-info $(PLUGIN_LIBRARY_VERSION) -release $(PLUGIN_RELEASE) $(AM_LDFLAGS)
|
||||||
|
|
||||||
|
## For the moment do not build pkgconfig files for musrfit plug-ins...
|
||||||
|
## pkgconfigdir = $(libdir)/pkgconfig
|
||||||
|
## pkgconfig_DATA = ZFRelaxation.pc
|
||||||
|
|
||||||
|
## However, create some symbolic links to the shared library
|
||||||
|
## in order to unify the function call on different operating systems
|
||||||
|
|
||||||
|
if IS_DARWIN
|
||||||
|
install-exec-hook:
|
||||||
|
$(LN_S) $(libdir)/libZFRelaxation.dylib $(libdir)/libZFRelaxation.so
|
||||||
|
uninstall-hook:
|
||||||
|
rm -f $(libdir)/libZFRelaxation.so
|
||||||
|
endif
|
||||||
|
|
||||||
|
if IS_CYGWIN
|
||||||
|
install-exec-hook:
|
||||||
|
$(LN_S) $(bindir)/cygZFRelaxation-$(PLUGIN_MAJOR_VERSION)-$(PLUGIN_MINOR_VERSION)-$(PLUGIN_MAJOR_VERSION).dll $(libdir)/libZFRelaxation.so
|
||||||
|
uninstall-hook:
|
||||||
|
rm -f $(libdir)/libZFRelaxation.so
|
||||||
|
endif
|
73
src/external/libZFRelaxation/ZFRelaxation.cpp
vendored
Normal file
73
src/external/libZFRelaxation/ZFRelaxation.cpp
vendored
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
|
||||||
|
ZFRelaxation.cpp
|
||||||
|
|
||||||
|
Author: Bastian M. Wojek
|
||||||
|
|
||||||
|
$Id$
|
||||||
|
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2009 by Bastian M. Wojek *
|
||||||
|
* *
|
||||||
|
* *
|
||||||
|
* 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. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#define TWO_PI 6.28318530717958623
|
||||||
|
#define DEG_TO_RAD 0.0174532925199432955
|
||||||
|
|
||||||
|
#include "ZFRelaxation.h"
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
#include <cmath>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
ClassImp(ZFMagGss)
|
||||||
|
ClassImp(ZFMagExp)
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
// ZFMagGss::operator()
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* <p>Method returning the function value at a given time for a given set of parameters.
|
||||||
|
*
|
||||||
|
* \param t time \htmlonly (μs) \endhtmlonly \latexonly ($\mu\mathrm{s}$) \endlatexonly
|
||||||
|
* \param par parameters [\htmlonly α (1), ν (MHz), σ<sub>T</sub>; (μs<sup>-1</sup>), σ<sub>L</sub>; (μs<sup>-1</sup>)\endhtmlonly \latexonly $\alpha~(1)$, $\nu~(\mathrm{MHz})$, $\sigma_{\mathrm{T}}~(\mu\mathrm{s}^{-1})$, $\sigma_{\mathrm{L}}~(\mu\mathrm{s}^{-1})$ \endlatexonly]
|
||||||
|
*/
|
||||||
|
double ZFMagGss::operator()(double t, const vector<double> &par) const {
|
||||||
|
assert(par.size()==4);
|
||||||
|
double w(TWO_PI * par[1]), sst(par[2]*par[2]*t);
|
||||||
|
return par[0] * (cos(w*t) - sst/w*sin(w*t)) * exp(-0.5*sst*t) + (1.0-par[0]) * exp(-0.5*par[3]*par[3]*t*t);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
// ZFMagExp::operator()
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* <p>Method returning the function value at a given time for a given set of parameters.
|
||||||
|
*
|
||||||
|
* \param t time \htmlonly (μs) \endhtmlonly \latexonly ($\mu\mathrm{s}$) \endlatexonly
|
||||||
|
* \param par parameters [\htmlonly α (1), ν (MHz), <i>a</i><sub>T</sub>; (μs<sup>-1</sup>), <i>a</i><sub>L</sub>; (μs<sup>-1</sup>)\endhtmlonly \latexonly $\alpha~(1)$, $\nu~(\mathrm{MHz})$, $a_{\mathrm{T}}~(\mu\mathrm{s}^{-1})$, $a_{\mathrm{L}}~(\mu\mathrm{s}^{-1})$ \endlatexonly]
|
||||||
|
*/
|
||||||
|
double ZFMagExp::operator()(double t, const vector<double> &par) const {
|
||||||
|
assert(par.size()==4);
|
||||||
|
double w(TWO_PI * par[1]);
|
||||||
|
return par[0] * (cos(w*t) - par[2]/w*sin(w*t)) * exp(-par[2]*t) + (1.0-par[0]) * exp(-par[3]*t);
|
||||||
|
}
|
89
src/external/libZFRelaxation/ZFRelaxation.h
vendored
Normal file
89
src/external/libZFRelaxation/ZFRelaxation.h
vendored
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
|
||||||
|
ZFRelaxation.h
|
||||||
|
|
||||||
|
Author: Bastian M. Wojek
|
||||||
|
|
||||||
|
$Id$
|
||||||
|
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2009 by Bastian M. Wojek *
|
||||||
|
* *
|
||||||
|
* *
|
||||||
|
* 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 _ZFRelaxation_H_
|
||||||
|
#define _ZFRelaxation_H_
|
||||||
|
|
||||||
|
#include "PUserFcnBase.h"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* <p>User function for the muon spin depolarization resulting from static Gaussian broadened randomly oriented internal fields
|
||||||
|
* See also: E.I. Kornilov and V.Yu. Pomjakushin
|
||||||
|
* \htmlonly Phys. Lett. A <b>153</b>, 364–367 (1991), doi:<a href="http://dx.doi.org/10.1016/0375-9601(91)90959-C">10.1016/0375-9601(91)90959-C</a>
|
||||||
|
* \endhtmlonly
|
||||||
|
* \latexonly Phys. Lett. A \textbf{153}, 364--367 (1991), \texttt{http://dx.doi.org/10.1016/0375-9601(91)90959-C}
|
||||||
|
* \endlatexonly
|
||||||
|
*/
|
||||||
|
class ZFMagGss : public PUserFcnBase {
|
||||||
|
|
||||||
|
public:
|
||||||
|
// default constructor
|
||||||
|
ZFMagGss(){} ///< default constructor
|
||||||
|
~ZFMagGss(){} ///< default destructor
|
||||||
|
|
||||||
|
Bool_t NeedGlobalPart() const { return false; }
|
||||||
|
void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
|
||||||
|
Bool_t GlobalPartIsValid() const { return true; }
|
||||||
|
|
||||||
|
double operator()(double, const vector<double>&) const;
|
||||||
|
|
||||||
|
ClassDef(ZFMagGss,1)
|
||||||
|
};
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* <p>User function for the muon spin depolarization resulting from static Lorentzian broadened randomly oriented internal fields
|
||||||
|
* See also: M. I. Larkin, Y. Fudamoto, I. M. Gat, A. Kinkhabwala, K. M. Kojima, G. M. Luke, J. Merrin, B. Nachumi, Y. J. Uemura, M. Azuma, T. Saito, and M. Takano
|
||||||
|
* \htmlonly Physica B <b>289–290</b>, 153–156 (2000), doi:<a href="http://dx.doi.org/10.1016/S0921-4526(00)00337-9">10.1016/S0921-4526(00)00337-9</a>
|
||||||
|
* \endhtmlonly
|
||||||
|
* \latexonly Physica B \textbf{289--290}, 153--156 (2000), \texttt{http://dx.doi.org/10.1016/S0921-4526(00)00337-9}
|
||||||
|
* \endlatexonly
|
||||||
|
*/
|
||||||
|
class ZFMagExp : public PUserFcnBase {
|
||||||
|
|
||||||
|
public:
|
||||||
|
// default constructor
|
||||||
|
ZFMagExp(){} ///< default constructor
|
||||||
|
~ZFMagExp(){} ///< default destructor
|
||||||
|
|
||||||
|
Bool_t NeedGlobalPart() const { return false; }
|
||||||
|
void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
|
||||||
|
Bool_t GlobalPartIsValid() const { return true; }
|
||||||
|
|
||||||
|
double operator()(double, const vector<double>&) const;
|
||||||
|
|
||||||
|
ClassDef(ZFMagExp,1)
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //_ZFRelaxation_H_
|
43
src/external/libZFRelaxation/ZFRelaxationLinkDef.h
vendored
Normal file
43
src/external/libZFRelaxation/ZFRelaxationLinkDef.h
vendored
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
|
||||||
|
ZFRelaxationLinkDef.h
|
||||||
|
|
||||||
|
Author: Bastian M. Wojek
|
||||||
|
|
||||||
|
$Id$
|
||||||
|
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2009 by Bastian M. Wojek *
|
||||||
|
* *
|
||||||
|
* *
|
||||||
|
* 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. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
// root dictionary stuff --------------------------------------------------
|
||||||
|
#ifdef __CINT__
|
||||||
|
|
||||||
|
#pragma link off all globals;
|
||||||
|
#pragma link off all classes;
|
||||||
|
#pragma link off all functions;
|
||||||
|
|
||||||
|
#pragma link C++ class ZFMagGss+;
|
||||||
|
#pragma link C++ class ZFMagExp+;
|
||||||
|
|
||||||
|
#endif //__CINT__
|
||||||
|
// root dictionary stuff --------------------------------------------------
|
||||||
|
|
Binary file not shown.
@ -0,0 +1,57 @@
|
|||||||
|
Test libZFRelaxation random fields Lorentzian broadened, asymmetry plot, PSI-BIN data file
|
||||||
|
###############################################################
|
||||||
|
FITPARAMETER
|
||||||
|
# No Name Value Step Pos_Error Boundaries
|
||||||
|
1 precFrac 0.666667 0 none 0 1
|
||||||
|
2 field 171.20 0.55 none 0 none
|
||||||
|
3 lambdaT 1.303 0.061 none 0 none
|
||||||
|
4 lambdaL 0.099 0.012 none 0 none
|
||||||
|
|
||||||
|
5 asymmetry 0.1429 0.0039 none 0 0.3
|
||||||
|
6 alpha 0.8209 0.0027 none
|
||||||
|
|
||||||
|
###############################################################
|
||||||
|
THEORY
|
||||||
|
asymmetry 5
|
||||||
|
userFcn libZFRelaxation ZFMagExp 1 fun1 3 4
|
||||||
|
|
||||||
|
###############################################################
|
||||||
|
FUNCTIONS
|
||||||
|
fun1 = par2 * gamma_mu
|
||||||
|
|
||||||
|
###############################################################
|
||||||
|
RUN data/deltat_pta_gps_4255 PIM3 PSI PSI-BIN (name beamline institute data-file-format)
|
||||||
|
fittype 2 (asymmetry fit)
|
||||||
|
alpha 6
|
||||||
|
map 0 0 0 0 0 0 0 0 0 0
|
||||||
|
forward 2
|
||||||
|
backward 1
|
||||||
|
t0 125 128
|
||||||
|
data 128 8097 131 8112
|
||||||
|
background 45 113 40 117
|
||||||
|
fit 0 8
|
||||||
|
packing 30
|
||||||
|
|
||||||
|
###############################################################
|
||||||
|
COMMANDS
|
||||||
|
MINIMIZE
|
||||||
|
HESSE
|
||||||
|
SAVE
|
||||||
|
|
||||||
|
###############################################################
|
||||||
|
FOURIER
|
||||||
|
units Gauss # units either 'Gauss', 'MHz', or 'Mc/s'
|
||||||
|
fourier_power 8
|
||||||
|
apodization NONE # NONE, WEAK, MEDIUM, STRONG
|
||||||
|
plot POWER # REAL, IMAG, REAL_AND_IMAG, POWER, PHASE
|
||||||
|
phase 0
|
||||||
|
range 0 500
|
||||||
|
|
||||||
|
###############################################################
|
||||||
|
PLOT 2 (asymmetry plot)
|
||||||
|
runs 1
|
||||||
|
range 0 4 -0.25 0.25
|
||||||
|
|
||||||
|
###############################################################
|
||||||
|
STATISTIC --- 2011-05-09 14:56:44
|
||||||
|
chisq = 470.01394974044985, NDF = 208, chisq/NDF = 2.2596824506752395
|
Loading…
x
Reference in New Issue
Block a user