- Extended the usage of xml-startup files in some plugin libraries and renamed the file itself.

- Added some documentation to libLFRelaxation which in the present stage is mainly used for testing purposes.
This commit is contained in:
Bastian M. Wojek 2011-03-16 16:43:13 +00:00
parent 233ca10dff
commit 032ce4a1e4
18 changed files with 964 additions and 436 deletions

View File

@ -31,6 +31,7 @@ FIXED 2 little annoying problems: (i) now it is possible to zoom down to the sin
(ii) when switching between data- and difference-view, the x-range doesn't change anymore. (ii) when switching between data- and difference-view, the x-range doesn't change anymore.
FIXED musrt0 crash for histogram number out of range (MUSR-157) FIXED musrt0 crash for histogram number out of range (MUSR-157)
FIXED fixes the inadequate attempt to use log max likelihood fit for asymmetry/non-muSR fit (MUSR-148) FIXED fixes the inadequate attempt to use log max likelihood fit for asymmetry/non-muSR fit (MUSR-148)
CHANGED the file name of the XML startup file for some of the libraries included in the BMWlibs to "BMW_startup.xml"
CHANGED added an additional layer for process killing to musrgui/musredit which hopefully should help to reduce the number of CHANGED added an additional layer for process killing to musrgui/musredit which hopefully should help to reduce the number of
musrfit/musrview corpses with high CPU load. musrfit/musrview corpses with high CPU load.
CHANGED the formating of the parameters such that they show the precision corresponding to the error. At the CHANGED the formating of the parameters such that they show the precision corresponding to the error. At the

View File

@ -506,6 +506,11 @@ if test "${BUILD_BMW_LIBS}" = "1"; then
# Check for fftw3f library. If it is not available the BMWlibs will not be built! # Check for fftw3f library. If it is not available the BMWlibs will not be built!
AC_SEARCH_LIBS([fftwf_malloc], [fftw3f], [FFTW3_LIBS="$FFTW3_LIBS -lfftw3f"], [BUILD_BMW_LIBS=0 AC_SEARCH_LIBS([fftwf_malloc], [fftw3f], [FFTW3_LIBS="$FFTW3_LIBS -lfftw3f"], [BUILD_BMW_LIBS=0
AC_MSG_WARN([The float version of FFTW3 is not available. The BMWlibs will not be built!])], []) AC_MSG_WARN([The float version of FFTW3 is not available. The BMWlibs will not be built!])], [])
if test "${BUILD_BMW_LIBS}" = "1"; then
AC_SEARCH_LIBS([fftwf_init_threads], [fftw3f_threads], [FFTW3_LIBS="$FFTW3_LIBS -lfftw3f_threads -lpthread"
AC_DEFINE([HAVE_LIBFFTW3F_THREADS], [1], [Define to 1 if fftw3f_threads are available])], [], [-lpthread])
fi
CFLAGS="$SAVED_CFLAGS" CFLAGS="$SAVED_CFLAGS"
LIBS="$SAVED_LIBS" LIBS="$SAVED_LIBS"

View File

@ -1,14 +1,14 @@
/*************************************************************************** /***************************************************************************
TFitPofBStartupHandler.cpp BMWStartupHandler.cpp
Author: Bastian M. Wojek Author: Bastian M. Wojek
e-mail: bastian.wojek@psi.ch e-mail: bastian.wojek@psi.ch
2008/06/03 $Id$
based upon: based upon:
$Id: PStartupHandler.cpp 3340 2008-04-30 12:27:01Z nemu $ $Id$
by Andreas Suter by Andreas Suter
***************************************************************************/ ***************************************************************************/
@ -39,18 +39,18 @@ using namespace std;
#include <cassert> #include <cassert>
#include "TFitPofBStartupHandler.h" #include "BMWStartupHandler.h"
ClassImpQ(TFitPofBStartupHandler) ClassImpQ(BMWStartupHandler)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
// Constructor // Constructor
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Constructor. Check if the BMW_startup.xml file is found in the local directory
*/ */
TFitPofBStartupHandler::TFitPofBStartupHandler() : BMWStartupHandler::BMWStartupHandler() :
fDebug(false), fLEM(false), fVortex(false), fDataPath(""), fDeltat(0.), fDeltaB(0.), fWisdomFile(""), fNSteps(0), fGridSteps(0) fDebug(false), fLEM(false), fVortex(false), fLF(false), fDataPath(""), fDeltat(0.), fDeltaB(0.), fWisdomFile(""), fWisdomFileFloat(""), fNSteps(0), fGridSteps(0), fDeltatLF(0.), fNStepsLF(0)
{ {
} }
@ -58,9 +58,9 @@ TFitPofBStartupHandler::TFitPofBStartupHandler() :
// Destructor // Destructor
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Destructor
*/ */
TFitPofBStartupHandler::~TFitPofBStartupHandler() BMWStartupHandler::~BMWStartupHandler()
{ {
// clean up // clean up
fEnergyList.clear(); fEnergyList.clear();
@ -72,9 +72,9 @@ TFitPofBStartupHandler::~TFitPofBStartupHandler()
// OnStartDocument // OnStartDocument
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Called on start of the XML file reading. Initializes all necessary variables.
*/ */
void TFitPofBStartupHandler::OnStartDocument() void BMWStartupHandler::OnStartDocument()
{ {
fKey = eEmpty; fKey = eEmpty;
} }
@ -83,9 +83,9 @@ void TFitPofBStartupHandler::OnStartDocument()
// OnEndDocument // OnEndDocument
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Called on end of XML file reading.
*/ */
void TFitPofBStartupHandler::OnEndDocument() void BMWStartupHandler::OnEndDocument()
{ {
// check if anything was set, and if not set some default stuff // check if anything was set, and if not set some default stuff
CheckLists(); CheckLists();
@ -95,12 +95,13 @@ void TFitPofBStartupHandler::OnEndDocument()
// OnStartElement // OnStartElement
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Called when a XML start element is found. Filters out the needed elements
* and sets a proper key.
* *
* \param str * \param str XML element name
* \param attributes * \param attributes not used
*/ */
void TFitPofBStartupHandler::OnStartElement(const char *str, const TList *attributes) void BMWStartupHandler::OnStartElement(const char *str, const TList *attributes)
{ {
if (!strcmp(str, "debug")) { if (!strcmp(str, "debug")) {
fKey = eDebug; fKey = eDebug;
@ -108,6 +109,8 @@ void TFitPofBStartupHandler::OnStartElement(const char *str, const TList *attrib
fKey = eLEM; fKey = eLEM;
} else if (!strcmp(str, "VortexLattice")) { } else if (!strcmp(str, "VortexLattice")) {
fKey = eVortex; fKey = eVortex;
} else if (!strcmp(str, "LFRelaxation")) {
fKey = eLF;
} else if (!strcmp(str, "data_path")) { } else if (!strcmp(str, "data_path")) {
fKey = eDataPath; fKey = eDataPath;
} else if (!strcmp(str, "energy_label")) { } else if (!strcmp(str, "energy_label")) {
@ -120,10 +123,16 @@ void TFitPofBStartupHandler::OnStartElement(const char *str, const TList *attrib
fKey = eDeltaB; fKey = eDeltaB;
} else if (!strcmp(str, "wisdom")) { } else if (!strcmp(str, "wisdom")) {
fKey = eWisdomFile; fKey = eWisdomFile;
} else if (!strcmp(str, "wisdom_float")) {
fKey = eWisdomFileFloat;
} else if (!strcmp(str, "N_theory")) { } else if (!strcmp(str, "N_theory")) {
fKey = eNSteps; fKey = eNSteps;
} else if (!strcmp(str, "N_VortexGrid")) { } else if (!strcmp(str, "N_VortexGrid")) {
fKey = eGridSteps; fKey = eGridSteps;
} else if (!strcmp(str, "delta_t_LF")) {
fKey = eDeltatLF;
} else if (!strcmp(str, "N_LF")) {
fKey = eNStepsLF;
} }
} }
@ -131,11 +140,11 @@ void TFitPofBStartupHandler::OnStartElement(const char *str, const TList *attrib
// OnEndElement // OnEndElement
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Called when a XML end element is found. Resets the handler key.
* *
* \param str * \param str not used
*/ */
void TFitPofBStartupHandler::OnEndElement(const char *str) void BMWStartupHandler::OnEndElement(const char *str)
{ {
fKey = eEmpty; fKey = eEmpty;
} }
@ -144,11 +153,12 @@ void TFitPofBStartupHandler::OnEndElement(const char *str)
// OnCharacters // OnCharacters
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Content of a given XML element. Filters out the data and feeds them to
* the internal variables.
* *
* \param str * \param str XML element string
*/ */
void TFitPofBStartupHandler::OnCharacters(const char *str) void BMWStartupHandler::OnCharacters(const char *str)
{ {
switch (fKey) { switch (fKey) {
case eDebug: case eDebug:
@ -163,6 +173,9 @@ void TFitPofBStartupHandler::OnCharacters(const char *str)
case eVortex: case eVortex:
fVortex = true; fVortex = true;
break; break;
case eLF:
fLF = true;
break;
case eDataPath: case eDataPath:
// set the data path to the given path // set the data path to the given path
fDataPath = str; fDataPath = str;
@ -187,6 +200,10 @@ void TFitPofBStartupHandler::OnCharacters(const char *str)
// set the wisdom file to the given name // set the wisdom file to the given name
fWisdomFile = str; fWisdomFile = str;
break; break;
case eWisdomFileFloat:
// set the float-wisdom file to the given name
fWisdomFileFloat = str;
break;
case eNSteps: case eNSteps:
// convert str to int and assign it to the NSteps-member // convert str to int and assign it to the NSteps-member
fNSteps = atoi(str); fNSteps = atoi(str);
@ -195,6 +212,14 @@ void TFitPofBStartupHandler::OnCharacters(const char *str)
// convert str to int and assign it to the GridSteps-member // convert str to int and assign it to the GridSteps-member
fGridSteps = atoi(str); fGridSteps = atoi(str);
break; break;
case eDeltatLF:
// convert str to double and assign it to the deltatLF-member
fDeltatLF = atof(str);
break;
case eNStepsLF:
// convert str to int and assign it to the NStepsLF-member
fNStepsLF = atoi(str);
break;
default: default:
break; break;
} }
@ -204,11 +229,11 @@ void TFitPofBStartupHandler::OnCharacters(const char *str)
// OnComment // OnComment
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Called when a XML comment is found. Not used.
* *
* \param str * \param str not used.
*/ */
void TFitPofBStartupHandler::OnComment(const char *str) void BMWStartupHandler::OnComment(const char *str)
{ {
// nothing to be done for now // nothing to be done for now
} }
@ -217,53 +242,54 @@ void TFitPofBStartupHandler::OnComment(const char *str)
// OnWarning // OnWarning
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Called when the XML parser emits a warning.
* *
* \param str * \param str warning string
*/ */
void TFitPofBStartupHandler::OnWarning(const char *str) void BMWStartupHandler::OnWarning(const char *str)
{ {
cout << endl << "TFitPofBStartupHandler::OnWarning: TFitPofBStartupHandler **WARNING** " << str; cerr << endl << "BMWStartupHandler::OnWarning: BMWStartupHandler **WARNING** " << str;
cout << endl; cerr << endl;
} }
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
// OnError // OnError
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Called when the XML parser emits an error.
* *
* \param str * \param str error string
*/ */
void TFitPofBStartupHandler::OnError(const char *str) void BMWStartupHandler::OnError(const char *str)
{ {
cout << endl << "TFitPofBStartupHandler::OnError: TFitPofBStartupHandler **ERROR** " << str; cerr << endl << "BMWStartupHandler::OnError: BMWStartupHandler **ERROR** " << str;
cout << endl; cerr << endl;
} }
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
// OnFatalError // OnFatalError
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Called when the XML parser emits a fatal error.
* *
* \param str * \param str fatal error string
*/ */
void TFitPofBStartupHandler::OnFatalError(const char *str) void BMWStartupHandler::OnFatalError(const char *str)
{ {
cout << endl << "TFitPofBStartupHandler::OnFatalError: TFitPofBStartupHandler **FATAL ERROR** " << str; cerr << endl << "BMWStartupHandler::OnFatalError: BMWStartupHandler **FATAL ERROR** " << str;
cout << endl; cerr << endl;
} }
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
// OnCdataBlock // OnCdataBlock
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Not used.
* *
* \param str * \param str not used
* \param len not used
*/ */
void TFitPofBStartupHandler::OnCdataBlock(const char *str, int len) void BMWStartupHandler::OnCdataBlock(const char *str, int len)
{ {
// nothing to be done for now // nothing to be done for now
} }
@ -272,55 +298,89 @@ void TFitPofBStartupHandler::OnCdataBlock(const char *str, int len)
// CheckList // CheckList
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Check if the default lists are present and if not, feed them with some default settings
* *
*/ */
void TFitPofBStartupHandler::CheckLists() void BMWStartupHandler::CheckLists()
{ {
// check if anything was set, and if not set some default stuff // check if anything was set, and if not set some default stuff
// check if delta_t is given, if not set default if(fLF) {
if(fDebug) // check if delta_t_LF is given, if not set default
cout << endl << "TFitPofBStartupHandler::CheckLists: check specified time resolution ... " << endl;
if(!fDeltat) {
cout << "TFitPofBStartupHandler::CheckLists: You did not specify the time resolution. Setting the default (10 ns)." << endl;
fDeltat = 0.01;
} else {
if(fDebug) if(fDebug)
cout << fDeltat << " us" << endl; cout << endl << "BMWStartupHandler::CheckLists: check specified LF time resolution for the Laplace transform ... " << endl;
} if(!fDeltatLF) {
cout << "BMWStartupHandler::CheckLists: You did not specify the LF time resolution. Setting the default (0.04 ns)." << endl;
fDeltatLF = 0.00004;
} else {
if(fDebug)
cout << fDeltatLF << " us" << endl;
}
// check if delta_B is given, if not set default // check if N_LF is given, if not set default
if(fDebug)
cout << endl << "TFitPofBStartupHandler::CheckLists: check specified field resolution ..." << endl;
if(!fDeltaB) {
cout << "TFitPofBStartupHandler::CheckLists: You did not specify the field resolution. Setting the default (0.1 G)." << endl;
fDeltaB = 0.1;
} else {
if(fDebug) if(fDebug)
cout << fDeltaB << " G" << endl; cout << endl << "BMWStartupHandler::CheckLists: check length of the Laplace transform ..." << endl;
if (!fNStepsLF) {
cout << "BMWStartupHandler::CheckLists: You did not specify the length of the Laplace transform. Setting the default (524288)." << endl;
fNStepsLF = 524288;
} else {
if(fDebug)
cout << fNStepsLF << endl;
}
} else {
// check if delta_t is given, if not set default
if(fDebug)
cout << endl << "BMWStartupHandler::CheckLists: check specified time resolution ... " << endl;
if(!fDeltat) {
cout << "BMWStartupHandler::CheckLists: You did not specify the time resolution. Setting the default (10 ns)." << endl;
fDeltat = 0.01;
} else {
if(fDebug)
cout << fDeltat << " us" << endl;
}
// check if delta_B is given, if not set default
if(fDebug)
cout << endl << "BMWStartupHandler::CheckLists: check specified field resolution ..." << endl;
if(!fDeltaB) {
cout << "BMWStartupHandler::CheckLists: You did not specify the field resolution. Setting the default (0.1 G)." << endl;
fDeltaB = 0.1;
} else {
if(fDebug)
cout << fDeltaB << " G" << endl;
}
} }
// check if any wisdom-file is specified // check if any wisdom-file is specified
if(fDebug) if(fDebug)
cout << endl << "TFitPofBStartupHandler::CheckLists: check wisdom-file ..." << endl; cout << endl << "BMWStartupHandler::CheckLists: check wisdom file ..." << endl;
if (!fWisdomFile.size()) { if (!fWisdomFile.size()) {
cout << "TFitPofBStartupHandler::CheckLists: You did not specify a wisdom file. No FFTW plans will be loaded or saved." << endl; cout << "BMWStartupHandler::CheckLists: You did not specify a wisdom file. No FFTW plans will be loaded or saved." << endl;
fWisdomFile = ""; fWisdomFile = "";
} else { } else {
if(fDebug) if(fDebug)
cout << fWisdomFile << endl; cout << fWisdomFile << endl;
} }
// check if any float-wisdom-file is specified
if(fDebug)
cout << endl << "BMWStartupHandler::CheckLists: check float-wisdom file ..." << endl;
if (!fWisdomFile.size()) {
cout << "BMWStartupHandler::CheckLists: You did not specify a float-wisdom file. No FFTW plans will be loaded or saved." << endl;
fWisdomFileFloat = "";
} else {
if(fDebug)
cout << fWisdomFileFloat << endl;
}
if (fLEM) { if (fLEM) {
// check if any data path is given // check if any data path is given
if(fDebug) if(fDebug)
cout << endl << "TFitPofBStartupHandler::CheckLists: check data path ..." << endl; cout << endl << "BMWStartupHandler::CheckLists: check data path ..." << endl;
if (!fDataPath.size()) { if (fDataPath.empty()) {
cerr << "TFitPofBStartupHandler::CheckLists: This is not going to work, you have to set a valid data path where to find the rge-files in the xml-file!" << endl; cerr << "BMWStartupHandler::CheckLists: This is not going to work, you have to set a valid data path where to find the rge-files in the xml-file!" << endl;
assert(fDataPath.size()); assert(!fDataPath.empty());
} else { } else {
if(fDebug) if(fDebug)
cout << fDataPath << endl; cout << fDataPath << endl;
@ -328,23 +388,23 @@ void TFitPofBStartupHandler::CheckLists()
// check if any energies are given // check if any energies are given
if(fDebug) if(fDebug)
cout << endl << "TFitPofBStartupHandler::CheckLists: check energy list ..." << endl; cout << endl << "BMWStartupHandler::CheckLists: check energy list ..." << endl;
if (fEnergyList.size() != fEnergyLabelList.size()) { if (fEnergyList.size() != fEnergyLabelList.size()) {
cerr << "TFitPofBStartupHandler::CheckLists: The number of energies and energy labels are different! Please fix it!" << endl \ cerr << "BMWStartupHandler::CheckLists: The number of energies and energy labels are different! Please fix it!" << endl \
<< "TFitPofBStartupHandler::CheckLists: The program will be terminated now!" << endl; << "BMWStartupHandler::CheckLists: The program will be terminated now!" << endl;
assert(fEnergyList.size() == fEnergyLabelList.size()); assert(fEnergyList.size() == fEnergyLabelList.size());
} }
if (fEnergyList.empty()) { if (fEnergyList.empty()) {
cerr << "TFitPofBStartupHandler::CheckLists: Energy list empty!" << endl \ cerr << "BMWStartupHandler::CheckLists: Energy list empty!" << endl \
<< "TFitPofBStartupHandler::CheckLists: Trying to use the standard energies: 0.0 to 35.0 keV in 0.1 keV steps" << endl; << "BMWStartupHandler::CheckLists: Trying to use the standard energies: 0.0 to 35.0 keV in 0.1 keV steps" << endl;
for (double x(0.0); x<= 35.0; x+=0.1) { for (double x(0.0); x<= 35.0; x+=0.1) {
fEnergyList.push_back(x); fEnergyList.push_back(x);
} }
} }
if (fEnergyLabelList.empty()) { if (fEnergyLabelList.empty()) {
cerr << "TFitPofBStartupHandler::CheckLists: Energy label list empty!" << endl \ cerr << "BMWStartupHandler::CheckLists: Energy label list empty!" << endl \
<< "TFitPofBStartupHandler::CheckLists: Trying to use the specified energies as labels in the format %02.1f..." << endl \ << "BMWStartupHandler::CheckLists: Trying to use the specified energies as labels in the format %02.1f..." << endl \
<< "TFitPofBStartupHandler::CheckLists: Most probably this will go wrong and should therefore be fixed in the xml-file!" << endl; << "BMWStartupHandler::CheckLists: Most probably this will go wrong and should therefore be fixed in the xml-file!" << endl;
char eChar[5]; char eChar[5];
for(unsigned int i(0); i<fEnergyList.size(); i++) { for(unsigned int i(0); i<fEnergyList.size(); i++) {
sprintf(eChar, "%02.1f", fEnergyList[i]); sprintf(eChar, "%02.1f", fEnergyList[i]);
@ -366,9 +426,9 @@ void TFitPofBStartupHandler::CheckLists()
// check if any number of steps for the theory function is specified // check if any number of steps for the theory function is specified
if(fDebug) if(fDebug)
cout << endl << "TFitPofBStartupHandler::CheckLists: check number of steps for theory ..." << endl; cout << endl << "BMWStartupHandler::CheckLists: check number of steps for theory ..." << endl;
if (!fNSteps) { if (!fNSteps) {
cout << "TFitPofBStartupHandler::CheckLists: You did not specify the number of steps for the theory. Setting the default (3000)." << endl; cout << "BMWStartupHandler::CheckLists: You did not specify the number of steps for the theory. Setting the default (3000)." << endl;
fNSteps = 3000; fNSteps = 3000;
} else { } else {
if(fDebug) if(fDebug)
@ -379,9 +439,9 @@ void TFitPofBStartupHandler::CheckLists()
if (fVortex) { if (fVortex) {
// check if any number of steps for the theory function is specified // check if any number of steps for the theory function is specified
if(fDebug) if(fDebug)
cout << endl << "TFitPofBStartupHandler::CheckLists: check number of steps for Vortex grid ..." << endl; cout << endl << "BMWStartupHandler::CheckLists: check number of steps for Vortex grid ..." << endl;
if (!fGridSteps) { if (!fGridSteps) {
cout << "TFitPofBStartupHandler::CheckLists: You did not specify the number of steps for the grid. Setting the default (256)." << endl; cout << "BMWStartupHandler::CheckLists: You did not specify the number of steps for the grid. Setting the default (256)." << endl;
fGridSteps = 256; fGridSteps = 256;
} else { } else {
if(fDebug) if(fDebug)
@ -390,5 +450,7 @@ void TFitPofBStartupHandler::CheckLists()
} }
} }
// end --------------------------------------------------------------------- // -------------------------------------------------------------------------
// end
// -------------------------------------------------------------------------

View File

@ -0,0 +1,113 @@
/***************************************************************************
BMWStartupHandler.h
Author: Bastian M. Wojek
e-mail: bastian.wojek@psi.ch
$Id$
based upon:
$Id$
by Andreas Suter
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2008 by Andreas Suter, 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 _BMWSTARTUPHANDLER_H_
#define _BMWSTARTUPHANDLER_H_
#include <TList.h>
#include <TQObject.h>
#include <string>
#include <vector>
#include <map>
/**
* <p>Handles the XML musrfit startup file (BMW_startup.xml) where default settings for some plugin libraries are stored:
* - TRIM.SP data file path and energies
* - time and field resolutions for Fourier transforms
* - paths to FFTW3 wisdom files (double and float)
* - number of steps for one-dimensional theory functions (where needed)
* - number of steps for two-dimensional grids when calculating spatial field distributions in vortex lattices
* - time resolutions and lengths of Laplace transforms used in the calculation of LF-relaxation functions
* - flag for debugging the information contained in the startup file
*/
class BMWStartupHandler : public TQObject {
public:
BMWStartupHandler();
virtual ~BMWStartupHandler();
virtual void OnStartDocument(); // SLOT
virtual void OnEndDocument(); // SLOT
virtual void OnStartElement(const char*, const TList*); // SLOT
virtual void OnEndElement(const char*); // SLOT
virtual void OnCharacters(const char*); // SLOT
virtual void OnComment(const char*); // SLOT
virtual void OnWarning(const char*); // SLOT
virtual void OnError(const char*); // SLOT
virtual void OnFatalError(const char*); // SLOT
virtual void OnCdataBlock(const char*, int); // SLOT
virtual void CheckLists();
virtual const string GetDataPath() const { return fDataPath; } ///< returns the path to TRIM.SP files
virtual map<double, string> GetEnergies() const { return fEnergies; } ///< returns energies and file labels of available TRIM.SP files
virtual const double GetDeltat() const { return fDeltat; } ///< returns the time resolution of P(t) when using Fourier transforms
virtual const double GetDeltaB() const { return fDeltaB; } ///< returns the field resolution of p(B) when using Fourier transforms
virtual const string GetWisdomFile() const { return fWisdomFile; } ///< returns the path to the FFTW3 double-wisdom file
virtual const string GetWisdomFileFloat() const { return fWisdomFileFloat; } ///< returns the path to the FFTW3 float-wisdom file
virtual const unsigned int GetNSteps() const { return fNSteps; } ///< returns the number of steps in one-dimensional theory functions
virtual const unsigned int GetGridSteps() const { return fGridSteps; } ///< returns the number of steps in each direction when calculating two-dimensional spatial field distributions
virtual const double GetDeltatLF() const { return fDeltatLF; } ///< returns the time resolution of P(t) when using Laplace transforms for the calculation of LF-relaxation functions
virtual const unsigned int GetNStepsLF() const { return fNStepsLF; } ///< returns the length of the Laplace transforms for the calculation of LF-relaxation functions
virtual const bool GetDebug() const { return fDebug; } ///< true = debug the xml-entries
private:
enum EKeyWords {eEmpty, eComment, eDebug, eLEM, eVortex, eLF, eDataPath, eEnergyLabel, \
eEnergy, eEnergyList, eDeltat, eDeltaB, eWisdomFile, eWisdomFileFloat, \
eNSteps, eGridSteps, eDeltatLF, eNStepsLF};
EKeyWords fKey; ///< xml filter key
bool fDebug; ///< debug flag
bool fLEM; ///< low-energy muSR flag
bool fVortex; ///< vortex-lattice flag
bool fLF; ///< longitudinal-field flag
string fDataPath; ///< path to TRIM.SP files
vector<string> fEnergyLabelList; ///< file labels of the TRIM.SP files
vector<double> fEnergyList; ///< muon implantation energies of the TRIM.SP files
map<double, string> fEnergies; ///< muon implantation energies and file labels of the TRIM.SP files
double fDeltat; ///< time resolution of P(t) when using Fourier transforms
double fDeltaB; ///< field resolution of p(B) when using Fourier transforms
string fWisdomFile; ///< FFTW3 double-wisdom file
string fWisdomFileFloat; ///< FFTW3 float-wisdom file
unsigned int fNSteps; ///< number of steps in one-dimensional theory functions
unsigned int fGridSteps; ///< number of steps in each direction when calculating two-dimensional spatial field distributions
double fDeltatLF; ///< time resolution of P(t) when using Laplace transforms for the calculation of LF-relaxation functions
unsigned int fNStepsLF; ///< length of the Laplace transforms for the calculation of LF-relaxation functions
ClassDef(BMWStartupHandler, 1)
};
#endif // _BMWSTARTUPHANDLER_H_

View File

@ -1,11 +1,11 @@
/*************************************************************************** /***************************************************************************
TFitPofBStartupHandlerLinkDef.h BMWStartupHandlerLinkDef.h
Author: Bastian M. Wojek Author: Bastian M. Wojek
e-mail: bastian.wojek@psi.ch e-mail: bastian.wojek@psi.ch
2008/05/29 $Id$
***************************************************************************/ ***************************************************************************/
@ -36,7 +36,7 @@
#pragma link off all classes; #pragma link off all classes;
#pragma link off all functions; #pragma link off all functions;
#pragma link C++ class TFitPofBStartupHandler+; #pragma link C++ class BMWStartupHandler+;
#endif //__CINT__ #endif //__CINT__
// root dictionary stuff -------------------------------------------------- // root dictionary stuff --------------------------------------------------

View File

@ -1,9 +1,11 @@
## Process this file with automake to create Makefile.in ## Process this file with automake to create Makefile.in
startup_path = ../../BMWStartupHandler
h_sources = \ h_sources = \
$(startup_path)/BMWStartupHandler.h \
../include/TBofZCalc.h \ ../include/TBofZCalc.h \
../include/TBulkTriVortexFieldCalc.h \ ../include/TBulkTriVortexFieldCalc.h \
../include/TFitPofBStartupHandler.h \
../include/TLondon1D.h \ ../include/TLondon1D.h \
../include/TPofBCalc.h \ ../include/TPofBCalc.h \
../include/TPofTCalc.h \ ../include/TPofTCalc.h \
@ -12,21 +14,21 @@ h_sources = \
../include/TVortex.h ../include/TVortex.h
h_linkdef = \ h_linkdef = \
../include/TFitPofBStartupHandlerLinkDef.h \ $(startup_path)/BMWStartupHandlerLinkDef.h \
../include/TLondon1DLinkDef.h \ ../include/TLondon1DLinkDef.h \
../include/TVortexLinkDef.h \ ../include/TVortexLinkDef.h \
../include/TSkewedGssLinkDef.h ../include/TSkewedGssLinkDef.h
dict_h_sources = \ dict_h_sources = \
TFitPofBStartupHandlerDict.h \ $(startup_path)/BMWStartupHandlerDict.h \
TLondon1DDict.h \ TLondon1DDict.h \
TSkewedGssDict.h \ TSkewedGssDict.h \
TVortexDict.h TVortexDict.h
cpp_sources = \ cpp_sources = \
$(startup_path)/BMWStartupHandler.cpp \
TBulkTriVortexFieldCalc.cpp \ TBulkTriVortexFieldCalc.cpp \
TBofZCalc.cpp \ TBofZCalc.cpp \
TFitPofBStartupHandler.cpp \
TLondon1D.cpp \ TLondon1D.cpp \
TPofBCalc.cpp \ TPofBCalc.cpp \
TPofTCalc.cpp \ TPofTCalc.cpp \
@ -35,7 +37,7 @@ cpp_sources = \
TVortex.cpp TVortex.cpp
dict_cpp_sources = \ dict_cpp_sources = \
TFitPofBStartupHandlerDict.cpp \ $(startup_path)/BMWStartupHandlerDict.cpp \
TLondon1DDict.cpp \ TLondon1DDict.cpp \
TSkewedGssDict.cpp \ TSkewedGssDict.cpp \
TVortexDict.cpp TVortexDict.cpp
@ -43,12 +45,16 @@ dict_cpp_sources = \
include_HEADERS = $(h_sources) include_HEADERS = $(h_sources)
noinst_HEADERS = $(h_linkdef) $(dict_h_sources) noinst_HEADERS = $(h_linkdef) $(dict_h_sources)
INCLUDES = -I$(top_srcdir)/src/include -I../include $(LEM_CFLAGS) $(PMUSR_CFLAGS) $(FFTW3_CFLAGS) $(ROOT_CFLAGS) INCLUDES = -I$(top_srcdir)/src/include -I../include -I$(startup_path) $(LEM_CFLAGS) $(PMUSR_CFLAGS) $(FFTW3_CFLAGS) $(ROOT_CFLAGS)
AM_CXXFLAGS = $(LOCAL_LIB_CXXFLAGS) AM_CXXFLAGS = $(LOCAL_LIB_CXXFLAGS)
BUILT_SOURCES = $(dict_cpp_sources) $(dict_h_sources) BUILT_SOURCES = $(dict_cpp_sources) $(dict_h_sources)
AM_LDFLAGS = $(LOCAL_LIB_LDFLAGS) -L@ROOTLIBDIR@ AM_LDFLAGS = $(LOCAL_LIB_LDFLAGS) -L@ROOTLIBDIR@
CLEANFILES = *Dict.cpp *Dict.h *~ core CLEANFILES = $(startup_path)/*Dict.cpp $(startup_path)/*Dict.h $(startup_path)/*~ \
*Dict.cpp *Dict.h *~ core
$(startup_path)/BMWStartupHandlerDict.cpp $(startup_path)/BMWStartupHandlerDict.h: $(startup_path)/BMWStartupHandler.h $(startup_path)/BMWStartupHandlerLinkDef.h
@ROOTCINT@ -v -f $(startup_path)/BMWStartupHandlerDict.cpp -c -p $(INCLUDES) $^
%Dict.cpp %Dict.h: ../include/%.h ../include/%LinkDef.h %Dict.cpp %Dict.h: ../include/%.h ../include/%LinkDef.h
@ROOTCINT@ -v -f $*Dict.cpp -c -p $(INCLUDES) $^ @ROOTCINT@ -v -f $*Dict.cpp -c -p $(INCLUDES) $^

View File

@ -5,7 +5,7 @@
Author: Bastian M. Wojek Author: Bastian M. Wojek
e-mail: bastian.wojek@psi.ch e-mail: bastian.wojek@psi.ch
2008/11/07 $Id$
***************************************************************************/ ***************************************************************************/
@ -36,7 +36,7 @@
using namespace std; using namespace std;
#include <TSAXParser.h> #include <TSAXParser.h>
#include "TFitPofBStartupHandler.h" #include "BMWStartupHandler.h"
ClassImp(TLondon1DHS) ClassImp(TLondon1DHS)
ClassImp(TLondon1D1L) ClassImp(TLondon1D1L)
@ -149,15 +149,15 @@ TLondon1D3LS::~TLondon1D3LS() {
TLondon1DHS::TLondon1DHS() : fCalcNeeded(true), fFirstCall(true) { TLondon1DHS::TLondon1DHS() : fCalcNeeded(true), fFirstCall(true) {
// read startup file // read startup file
string startup_path_name("TFitPofB_startup.xml"); string startup_path_name("BMW_startup.xml");
TSAXParser *saxParser = new TSAXParser(); TSAXParser *saxParser = new TSAXParser();
TFitPofBStartupHandler *startupHandler = new TFitPofBStartupHandler(); BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("TFitPofBStartupHandler", startupHandler); saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
int status (saxParser->ParseFile(startup_path_name.c_str())); int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors // check for parse errors
if (status) { // error if (status) { // error
cerr << endl << "**ERROR** reading/parsing TFitPofB_startup.xml failed." \ cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ << endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl; << endl;
assert(false); assert(false);
@ -297,15 +297,15 @@ double TLondon1DHS::operator()(double t, const vector<double> &par) const {
TLondon1D1L::TLondon1D1L() : fCalcNeeded(true), fFirstCall(true) { TLondon1D1L::TLondon1D1L() : fCalcNeeded(true), fFirstCall(true) {
// read startup file // read startup file
string startup_path_name("TFitPofB_startup.xml"); string startup_path_name("BMW_startup.xml");
TSAXParser *saxParser = new TSAXParser(); TSAXParser *saxParser = new TSAXParser();
TFitPofBStartupHandler *startupHandler = new TFitPofBStartupHandler(); BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("TFitPofBStartupHandler", startupHandler); saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
int status (saxParser->ParseFile(startup_path_name.c_str())); int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors // check for parse errors
if (status) { // error if (status) { // error
cerr << endl << "**ERROR** reading/parsing TFitPofB_startup.xml failed." \ cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ << endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl; << endl;
assert(false); assert(false);
@ -480,15 +480,15 @@ double TLondon1D1L::operator()(double t, const vector<double> &par) const {
TLondon1D2L::TLondon1D2L() : fCalcNeeded(true), fFirstCall(true) { TLondon1D2L::TLondon1D2L() : fCalcNeeded(true), fFirstCall(true) {
// read startup file // read startup file
string startup_path_name("TFitPofB_startup.xml"); string startup_path_name("BMW_startup.xml");
TSAXParser *saxParser = new TSAXParser(); TSAXParser *saxParser = new TSAXParser();
TFitPofBStartupHandler *startupHandler = new TFitPofBStartupHandler(); BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("TFitPofBStartupHandler", startupHandler); saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
int status (saxParser->ParseFile(startup_path_name.c_str())); int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors // check for parse errors
if (status) { // error if (status) { // error
cerr << endl << "**ERROR** reading/parsing TFitPofB_startup.xml failed." \ cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ << endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl; << endl;
assert(false); assert(false);
@ -650,15 +650,15 @@ double TLondon1D2L::operator()(double t, const vector<double> &par) const {
TProximity1D1LHS::TProximity1D1LHS() : fCalcNeeded(true), fFirstCall(true) { TProximity1D1LHS::TProximity1D1LHS() : fCalcNeeded(true), fFirstCall(true) {
// read startup file // read startup file
string startup_path_name("TFitPofB_startup.xml"); string startup_path_name("BMW_startup.xml");
TSAXParser *saxParser = new TSAXParser(); TSAXParser *saxParser = new TSAXParser();
TFitPofBStartupHandler *startupHandler = new TFitPofBStartupHandler(); BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("TFitPofBStartupHandler", startupHandler); saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
int status (saxParser->ParseFile(startup_path_name.c_str())); int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors // check for parse errors
if (status) { // error if (status) { // error
cerr << endl << "**ERROR** reading/parsing TFitPofB_startup.xml failed." \ cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ << endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl; << endl;
assert(false); assert(false);
@ -797,15 +797,15 @@ double TProximity1D1LHS::operator()(double t, const vector<double> &par) const {
TLondon1D3L::TLondon1D3L() : fCalcNeeded(true), fFirstCall(true) { TLondon1D3L::TLondon1D3L() : fCalcNeeded(true), fFirstCall(true) {
// read startup file // read startup file
string startup_path_name("TFitPofB_startup.xml"); string startup_path_name("BMW_startup.xml");
TSAXParser *saxParser = new TSAXParser(); TSAXParser *saxParser = new TSAXParser();
TFitPofBStartupHandler *startupHandler = new TFitPofBStartupHandler(); BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("TFitPofBStartupHandler", startupHandler); saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
int status (saxParser->ParseFile(startup_path_name.c_str())); int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors // check for parse errors
if (status) { // error if (status) { // error
cerr << endl << "**ERROR** reading/parsing TFitPofB_startup.xml failed." \ cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ << endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl; << endl;
assert(false); assert(false);
@ -966,15 +966,15 @@ double TLondon1D3L::operator()(double t, const vector<double> &par) const {
TLondon1D3LS::TLondon1D3LS() : fCalcNeeded(true), fFirstCall(true) { TLondon1D3LS::TLondon1D3LS() : fCalcNeeded(true), fFirstCall(true) {
// read startup file // read startup file
string startup_path_name("TFitPofB_startup.xml"); string startup_path_name("BMW_startup.xml");
TSAXParser *saxParser = new TSAXParser(); TSAXParser *saxParser = new TSAXParser();
TFitPofBStartupHandler *startupHandler = new TFitPofBStartupHandler(); BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("TFitPofBStartupHandler", startupHandler); saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
int status (saxParser->ParseFile(startup_path_name.c_str())); int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors // check for parse errors
if (status) { // error if (status) { // error
cerr << endl << "**ERROR** reading/parsing TFitPofB_startup.xml failed." \ cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ << endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl; << endl;
assert(false); assert(false);
@ -1135,15 +1135,15 @@ double TLondon1D3LS::operator()(double t, const vector<double> &par) const {
// //
// TLondon1D4L::TLondon1D4L() : fCalcNeeded(true), fFirstCall(true), fLastFourChanged(true) { // TLondon1D4L::TLondon1D4L() : fCalcNeeded(true), fFirstCall(true), fLastFourChanged(true) {
// // read startup file // // read startup file
// string startup_path_name("TFitPofB_startup.xml"); // string startup_path_name("BMW_startup.xml");
// //
// TSAXParser *saxParser = new TSAXParser(); // TSAXParser *saxParser = new TSAXParser();
// TFitPofBStartupHandler *startupHandler = new TFitPofBStartupHandler(); // BMWStartupHandler *startupHandler = new BMWStartupHandler();
// saxParser->ConnectToHandler("TFitPofBStartupHandler", startupHandler); // saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
// int status (saxParser->ParseFile(startup_path_name.c_str())); // int status (saxParser->ParseFile(startup_path_name.c_str()));
// // check for parse errors // // check for parse errors
// if (status) { // error // if (status) { // error
// cout << endl << "**WARNING** reading/parsing TFitPofB_startup.xml failed." << endl; // cout << endl << "**WARNING** reading/parsing " << startup_path_name << " failed." << endl;
// } // }
// //
// fNSteps = startupHandler->GetNSteps(); // fNSteps = startupHandler->GetNSteps();

View File

@ -5,7 +5,7 @@
Author: Bastian M. Wojek Author: Bastian M. Wojek
e-mail: bastian.wojek@psi.ch e-mail: bastian.wojek@psi.ch
2009/01/24 $Id$
***************************************************************************/ ***************************************************************************/
@ -35,7 +35,7 @@
using namespace std; using namespace std;
#include <TSAXParser.h> #include <TSAXParser.h>
#include "TFitPofBStartupHandler.h" #include "BMWStartupHandler.h"
ClassImp(TSkewedGss) ClassImp(TSkewedGss)
@ -60,15 +60,18 @@ TSkewedGss::~TSkewedGss() {
TSkewedGss::TSkewedGss() : fCalcNeeded(true), fFirstCall(true) { TSkewedGss::TSkewedGss() : fCalcNeeded(true), fFirstCall(true) {
// read startup file // read startup file
string startup_path_name("TFitPofB_startup.xml"); string startup_path_name("BMW_startup.xml");
TSAXParser *saxParser = new TSAXParser(); TSAXParser *saxParser = new TSAXParser();
TFitPofBStartupHandler *startupHandler = new TFitPofBStartupHandler(); BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("TFitPofBStartupHandler", startupHandler); saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
int status (saxParser->ParseFile(startup_path_name.c_str())); int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors // check for parse errors
if (status) { // error if (status) { // error
cout << endl << "**WARNING** reading/parsing TFitPofB_startup.xml failed." << endl; cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl;
assert(false);
} }
fWisdom = startupHandler->GetWisdomFile(); fWisdom = startupHandler->GetWisdomFile();
@ -83,13 +86,9 @@ TSkewedGss::TSkewedGss() : fCalcNeeded(true), fFirstCall(true) {
fParForPofB.push_back(0.0); // s- fParForPofB.push_back(0.0); // s-
fParForPofB.push_back(0.0); // s+ fParForPofB.push_back(0.0); // s+
TPofBCalc *x = new TPofBCalc(fParForPofB); fPofB = new TPofBCalc(fParForPofB);
fPofB = x;
x = 0;
TPofTCalc *y = new TPofTCalc(fPofB, fWisdom, fParForPofT); fPofT = new TPofTCalc(fPofB, fWisdom, fParForPofT);
fPofT = y;
y = 0;
// clean up // clean up
if (saxParser) { if (saxParser) {

View File

@ -5,7 +5,7 @@
Author: Bastian M. Wojek Author: Bastian M. Wojek
e-mail: bastian.wojek@psi.ch e-mail: bastian.wojek@psi.ch
2009/10/17 $Id$
***************************************************************************/ ***************************************************************************/
@ -36,7 +36,7 @@
using namespace std; using namespace std;
#include <TSAXParser.h> #include <TSAXParser.h>
#include "TFitPofBStartupHandler.h" #include "BMWStartupHandler.h"
ClassImp(TBulkTriVortexLondon) ClassImp(TBulkTriVortexLondon)
ClassImp(TBulkSqVortexLondon) ClassImp(TBulkSqVortexLondon)
@ -143,15 +143,15 @@ TBulkTriVortexNGL::~TBulkTriVortexNGL() {
TBulkTriVortexLondon::TBulkTriVortexLondon() : fCalcNeeded(true), fFirstCall(true) { TBulkTriVortexLondon::TBulkTriVortexLondon() : fCalcNeeded(true), fFirstCall(true) {
// read startup file // read startup file
string startup_path_name("TFitPofB_startup.xml"); string startup_path_name("BMW_startup.xml");
TSAXParser *saxParser = new TSAXParser(); TSAXParser *saxParser = new TSAXParser();
TFitPofBStartupHandler *startupHandler = new TFitPofBStartupHandler(); BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("TFitPofBStartupHandler", startupHandler); saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
int status (saxParser->ParseFile(startup_path_name.c_str())); int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors // check for parse errors
if (status) { // error if (status) { // error
cerr << endl << "**ERROR** reading/parsing TFitPofB_startup.xml failed." \ cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ << endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl; << endl;
assert(false); assert(false);
@ -200,15 +200,15 @@ TBulkTriVortexLondon::TBulkTriVortexLondon() : fCalcNeeded(true), fFirstCall(tru
TBulkSqVortexLondon::TBulkSqVortexLondon() : fCalcNeeded(true), fFirstCall(true) { TBulkSqVortexLondon::TBulkSqVortexLondon() : fCalcNeeded(true), fFirstCall(true) {
// read startup file // read startup file
string startup_path_name("TFitPofB_startup.xml"); string startup_path_name("BMW_startup.xml");
TSAXParser *saxParser = new TSAXParser(); TSAXParser *saxParser = new TSAXParser();
TFitPofBStartupHandler *startupHandler = new TFitPofBStartupHandler(); BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("TFitPofBStartupHandler", startupHandler); saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
int status (saxParser->ParseFile(startup_path_name.c_str())); int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors // check for parse errors
if (status) { // error if (status) { // error
cerr << endl << "**ERROR** reading/parsing TFitPofB_startup.xml failed." \ cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ << endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl; << endl;
assert(false); assert(false);
@ -427,15 +427,15 @@ double TBulkSqVortexLondon::operator()(double t, const vector<double> &par) cons
TBulkTriVortexML::TBulkTriVortexML() : fCalcNeeded(true), fFirstCall(true) { TBulkTriVortexML::TBulkTriVortexML() : fCalcNeeded(true), fFirstCall(true) {
// read startup file // read startup file
string startup_path_name("TFitPofB_startup.xml"); string startup_path_name("BMW_startup.xml");
TSAXParser *saxParser = new TSAXParser(); TSAXParser *saxParser = new TSAXParser();
TFitPofBStartupHandler *startupHandler = new TFitPofBStartupHandler(); BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("TFitPofBStartupHandler", startupHandler); saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
int status (saxParser->ParseFile(startup_path_name.c_str())); int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors // check for parse errors
if (status) { // error if (status) { // error
cerr << endl << "**ERROR** reading/parsing TFitPofB_startup.xml failed." \ cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ << endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl; << endl;
assert(false); assert(false);
@ -563,15 +563,15 @@ double TBulkTriVortexML::operator()(double t, const vector<double> &par) const {
TBulkTriVortexAGL::TBulkTriVortexAGL() : fCalcNeeded(true), fFirstCall(true) { TBulkTriVortexAGL::TBulkTriVortexAGL() : fCalcNeeded(true), fFirstCall(true) {
// read startup file // read startup file
string startup_path_name("TFitPofB_startup.xml"); string startup_path_name("BMW_startup.xml");
TSAXParser *saxParser = new TSAXParser(); TSAXParser *saxParser = new TSAXParser();
TFitPofBStartupHandler *startupHandler = new TFitPofBStartupHandler(); BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("TFitPofBStartupHandler", startupHandler); saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
int status (saxParser->ParseFile(startup_path_name.c_str())); int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors // check for parse errors
if (status) { // error if (status) { // error
cerr << endl << "**ERROR** reading/parsing TFitPofB_startup.xml failed." \ cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ << endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl; << endl;
assert(false); assert(false);
@ -699,15 +699,15 @@ double TBulkTriVortexAGL::operator()(double t, const vector<double> &par) const
TBulkTriVortexNGL::TBulkTriVortexNGL() : fCalcNeeded(true), fFirstCall(true) { TBulkTriVortexNGL::TBulkTriVortexNGL() : fCalcNeeded(true), fFirstCall(true) {
// read startup file // read startup file
string startup_path_name("TFitPofB_startup.xml"); string startup_path_name("BMW_startup.xml");
TSAXParser *saxParser = new TSAXParser(); TSAXParser *saxParser = new TSAXParser();
TFitPofBStartupHandler *startupHandler = new TFitPofBStartupHandler(); BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("TFitPofBStartupHandler", startupHandler); saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
int status (saxParser->ParseFile(startup_path_name.c_str())); int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors // check for parse errors
if (status) { // error if (status) { // error
cerr << endl << "**ERROR** reading/parsing TFitPofB_startup.xml failed." \ cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ << endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl; << endl;
assert(false); assert(false);
@ -851,15 +851,15 @@ TBulkAnisotropicTriVortexLondonGlobal::~TBulkAnisotropicTriVortexLondonGlobal()
TBulkAnisotropicTriVortexLondonGlobal::TBulkAnisotropicTriVortexLondonGlobal() : fCalcNeeded(true), fFirstCall(true) { TBulkAnisotropicTriVortexLondonGlobal::TBulkAnisotropicTriVortexLondonGlobal() : fCalcNeeded(true), fFirstCall(true) {
// read startup file // read startup file
string startup_path_name("TFitPofB_startup.xml"); string startup_path_name("BMW_startup.xml");
TSAXParser *saxParser = new TSAXParser(); TSAXParser *saxParser = new TSAXParser();
TFitPofBStartupHandler *startupHandler = new TFitPofBStartupHandler(); BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("TFitPofBStartupHandler", startupHandler); saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
int status (saxParser->ParseFile(startup_path_name.c_str())); int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors // check for parse errors
if (status) { // error if (status) { // error
cerr << endl << "**ERROR** reading/parsing TFitPofB_startup.xml failed." \ cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ << endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl; << endl;
assert(false); assert(false);
@ -1090,15 +1090,15 @@ TBulkAnisotropicTriVortexMLGlobal::~TBulkAnisotropicTriVortexMLGlobal() {
TBulkAnisotropicTriVortexMLGlobal::TBulkAnisotropicTriVortexMLGlobal() : fCalcNeeded(true), fFirstCall(true) { TBulkAnisotropicTriVortexMLGlobal::TBulkAnisotropicTriVortexMLGlobal() : fCalcNeeded(true), fFirstCall(true) {
// read startup file // read startup file
string startup_path_name("TFitPofB_startup.xml"); string startup_path_name("BMW_startup.xml");
TSAXParser *saxParser = new TSAXParser(); TSAXParser *saxParser = new TSAXParser();
TFitPofBStartupHandler *startupHandler = new TFitPofBStartupHandler(); BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("TFitPofBStartupHandler", startupHandler); saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
int status (saxParser->ParseFile(startup_path_name.c_str())); int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors // check for parse errors
if (status) { // error if (status) { // error
cerr << endl << "**ERROR** reading/parsing TFitPofB_startup.xml failed." \ cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ << endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl; << endl;
assert(false); assert(false);
@ -1329,15 +1329,15 @@ TBulkAnisotropicTriVortexAGLGlobal::~TBulkAnisotropicTriVortexAGLGlobal() {
TBulkAnisotropicTriVortexAGLGlobal::TBulkAnisotropicTriVortexAGLGlobal() : fCalcNeeded(true), fFirstCall(true) { TBulkAnisotropicTriVortexAGLGlobal::TBulkAnisotropicTriVortexAGLGlobal() : fCalcNeeded(true), fFirstCall(true) {
// read startup file // read startup file
string startup_path_name("TFitPofB_startup.xml"); string startup_path_name("BMW_startup.xml");
TSAXParser *saxParser = new TSAXParser(); TSAXParser *saxParser = new TSAXParser();
TFitPofBStartupHandler *startupHandler = new TFitPofBStartupHandler(); BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("TFitPofBStartupHandler", startupHandler); saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
int status (saxParser->ParseFile(startup_path_name.c_str())); int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors // check for parse errors
if (status) { // error if (status) { // error
cerr << endl << "**ERROR** reading/parsing TFitPofB_startup.xml failed." \ cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ << endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl; << endl;
assert(false); assert(false);

View File

@ -1,95 +0,0 @@
/***************************************************************************
TFitPofBStartupHandler.h
Author: Bastian M. Wojek
e-mail: bastian.wojek@psi.ch
2008/06/03
based upon:
$Id: PStartupHandler.h 3396 2008-05-29 14:41:33Z nemu $
by Andreas Suter
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2008 by Andreas Suter, 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 _TFITPOFBSTARTUPHANDLER_H_
#define _TFITPOFBSTARTUPHANDLER_H_
#include <TList.h>
#include <TQObject.h>
#include <string>
#include <vector>
#include <map>
class TFitPofBStartupHandler : public TQObject {
public:
TFitPofBStartupHandler();
virtual ~TFitPofBStartupHandler();
virtual void OnStartDocument(); // SLOT
virtual void OnEndDocument(); // SLOT
virtual void OnStartElement(const char*, const TList*); // SLOT
virtual void OnEndElement(const char*); // SLOT
virtual void OnCharacters(const char*); // SLOT
virtual void OnComment(const char*); // SLOT
virtual void OnWarning(const char*); // SLOT
virtual void OnError(const char*); // SLOT
virtual void OnFatalError(const char*); // SLOT
virtual void OnCdataBlock(const char*, int); // SLOT
virtual void CheckLists();
virtual const string GetDataPath() const { return fDataPath; }
virtual map<double, string> GetEnergies() const { return fEnergies; }
virtual const double GetDeltat() const { return fDeltat; }
virtual const double GetDeltaB() const { return fDeltaB; }
virtual const string GetWisdomFile() const { return fWisdomFile; }
virtual const unsigned int GetNSteps() const { return fNSteps; }
virtual const unsigned int GetGridSteps() const { return fGridSteps; }
virtual const bool GetDebug() const { return fDebug; }
private:
enum EKeyWords {eEmpty, eComment, eDebug, eLEM, eVortex, eDataPath, eEnergyLabel, \
eEnergy, eEnergyList, eDeltat, eDeltaB, eWisdomFile, eNSteps, eGridSteps};
EKeyWords fKey;
bool fDebug;
bool fLEM;
bool fVortex;
string fDataPath;
vector<string> fEnergyLabelList;
vector<double> fEnergyList;
map<double, string> fEnergies;
double fDeltat;
double fDeltaB;
string fWisdomFile;
unsigned int fNSteps;
unsigned int fGridSteps;
ClassDef(TFitPofBStartupHandler, 1)
};
#endif // _TFITPOFBSTARTUPHANDLER_H_

View File

@ -18,7 +18,7 @@ dict_cpp_sources = \
include_HEADERS = $(h_sources) include_HEADERS = $(h_sources)
noinst_HEADERS = $(h_linkdef) $(dict_h_sources) noinst_HEADERS = $(h_linkdef) $(dict_h_sources)
INCLUDES = -I$(top_srcdir)/src/include $(TFITPOFB_CFLAGS) $(PMUSR_CFLAGS) $(ROOT_CFLAGS) $(FFTW3_CFLAGS) INCLUDES = -I$(top_srcdir)/src/include -I../BMWStartupHandler $(TFITPOFB_CFLAGS) $(PMUSR_CFLAGS) $(ROOT_CFLAGS) $(FFTW3_CFLAGS)
AM_CXXFLAGS = $(LOCAL_LIB_CXXFLAGS) AM_CXXFLAGS = $(LOCAL_LIB_CXXFLAGS)
BUILT_SOURCES = $(dict_cpp_sources) $(dict_h_sources) BUILT_SOURCES = $(dict_cpp_sources) $(dict_h_sources)

View File

@ -37,7 +37,7 @@
using namespace std; using namespace std;
#include <TSAXParser.h> #include <TSAXParser.h>
#include "TFitPofBStartupHandler.h" #include "BMWStartupHandler.h"
#include "TCalcMeanFieldsLEM.h" #include "TCalcMeanFieldsLEM.h"
@ -54,8 +54,8 @@ TMeanFieldsForScHalfSpace::TMeanFieldsForScHalfSpace() {
string startup_path_name("TFitPofB_startup.xml"); string startup_path_name("TFitPofB_startup.xml");
TSAXParser *saxParser = new TSAXParser(); TSAXParser *saxParser = new TSAXParser();
TFitPofBStartupHandler *startupHandler = new TFitPofBStartupHandler(); BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("TFitPofBStartupHandler", startupHandler); saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
int status (saxParser->ParseFile(startup_path_name.c_str())); int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors // check for parse errors
if (status) { // error if (status) { // error
@ -145,8 +145,8 @@ TMeanFieldsForScSingleLayer::TMeanFieldsForScSingleLayer() {
string startup_path_name("TFitPofB_startup.xml"); string startup_path_name("TFitPofB_startup.xml");
TSAXParser *saxParser = new TSAXParser(); TSAXParser *saxParser = new TSAXParser();
TFitPofBStartupHandler *startupHandler = new TFitPofBStartupHandler(); BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("TFitPofBStartupHandler", startupHandler); saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
int status (saxParser->ParseFile(startup_path_name.c_str())); int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors // check for parse errors
if (status) { // error if (status) { // error
@ -244,8 +244,8 @@ TMeanFieldsForScBilayer::TMeanFieldsForScBilayer() {
string startup_path_name("TFitPofB_startup.xml"); string startup_path_name("TFitPofB_startup.xml");
TSAXParser *saxParser = new TSAXParser(); TSAXParser *saxParser = new TSAXParser();
TFitPofBStartupHandler *startupHandler = new TFitPofBStartupHandler(); BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("TFitPofBStartupHandler", startupHandler); saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
int status (saxParser->ParseFile(startup_path_name.c_str())); int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors // check for parse errors
if (status) { // error if (status) { // error
@ -347,8 +347,8 @@ TMeanFieldsForScTrilayer::TMeanFieldsForScTrilayer() {
string startup_path_name("TFitPofB_startup.xml"); string startup_path_name("TFitPofB_startup.xml");
TSAXParser *saxParser = new TSAXParser(); TSAXParser *saxParser = new TSAXParser();
TFitPofBStartupHandler *startupHandler = new TFitPofBStartupHandler(); BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("TFitPofBStartupHandler", startupHandler); saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
int status (saxParser->ParseFile(startup_path_name.c_str())); int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors // check for parse errors
if (status) { // error if (status) { // error
@ -452,8 +452,8 @@ TMeanFieldsForScTrilayerWithInsulator::TMeanFieldsForScTrilayerWithInsulator() {
string startup_path_name("TFitPofB_startup.xml"); string startup_path_name("TFitPofB_startup.xml");
TSAXParser *saxParser = new TSAXParser(); TSAXParser *saxParser = new TSAXParser();
TFitPofBStartupHandler *startupHandler = new TFitPofBStartupHandler(); BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("TFitPofBStartupHandler", startupHandler); saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
int status (saxParser->ParseFile(startup_path_name.c_str())); int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors // check for parse errors
if (status) { // error if (status) { // error

View File

@ -1,31 +1,40 @@
## Process this file with automake to create Makefile.in ## Process this file with automake to create Makefile.in
startup_path = ../BMWStartupHandler
integrator_path = ../BMWIntegrator
h_sources = \ h_sources = \
TLFRelaxation.h \ TLFRelaxation.h \
../BMWIntegrator/BMWIntegrator.h $(startup_path)/BMWStartupHandler.h \
$(integrator_path)/BMWIntegrator.h
h_linkdef = \ h_linkdef = \
TLFRelaxationLinkDef.h TLFRelaxationLinkDef.h \
$(startup_path)/BMWStartupHandlerLinkDef.h
dict_h_sources = \ dict_h_sources = \
TLFRelaxationDict.h TLFRelaxationDict.h \
$(startup_path)/BMWStartupHandlerDict.h
cpp_sources = \ cpp_sources = \
TLFRelaxation.cpp \ TLFRelaxation.cpp \
../BMWIntegrator/BMWIntegrator.cpp $(startup_path)/BMWStartupHandler.cpp \
$(integrator_path)/BMWIntegrator.cpp
dict_cpp_sources = \ dict_cpp_sources = \
TLFRelaxationDict.cpp TLFRelaxationDict.cpp \
$(startup_path)/BMWStartupHandlerDict.cpp
include_HEADERS = $(h_sources) include_HEADERS = $(h_sources)
noinst_HEADERS = $(h_linkdef) $(dict_h_sources) noinst_HEADERS = $(h_linkdef) $(dict_h_sources)
INCLUDES = -I$(top_srcdir)/src/include $(PMUSR_CFLAGS) $(FFTW3_CFLAGS) $(GSL_CFLAGS) $(ROOT_CFLAGS) $(CUBA_CFLAGS) INCLUDES = -I$(top_srcdir)/src/include -I$(startup_path) $(PMUSR_CFLAGS) $(FFTW3_CFLAGS) $(GSL_CFLAGS) $(ROOT_CFLAGS) $(CUBA_CFLAGS)
AM_CXXFLAGS = $(LOCAL_LIB_CXXFLAGS) AM_CXXFLAGS = $(LOCAL_LIB_CXXFLAGS)
BUILT_SOURCES = $(dict_cpp_sources) $(dict_h_sources) BUILT_SOURCES = $(dict_cpp_sources) $(dict_h_sources)
AM_LDFLAGS = $(LOCAL_LIB_LDFLAGS) -L@ROOTLIBDIR@ AM_LDFLAGS = $(LOCAL_LIB_LDFLAGS) -L@ROOTLIBDIR@
CLEANFILES = *Dict.cpp *Dict.h *~ core CLEANFILES = $(startup_path)/*Dict.cpp $(startup_path)/*Dict.h $(startup_path)/*~ \
$(integrator_path)/*~ *Dict.cpp *Dict.h *~ core
%Dict.cpp %Dict.h: %.h %LinkDef.h %Dict.cpp %Dict.h: %.h %LinkDef.h
@ROOTCINT@ -v -f $*Dict.cpp -c -p $(INCLUDES) $^ @ROOTCINT@ -v -f $*Dict.cpp -c -p $(INCLUDES) $^

View File

@ -5,7 +5,7 @@
Author: Bastian M. Wojek Author: Bastian M. Wojek
e-mail: bastian.wojek@psi.ch e-mail: bastian.wojek@psi.ch
2008/12/04 $Id$
***************************************************************************/ ***************************************************************************/
@ -29,12 +29,22 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <cassert> #include <cassert>
#include <sys/time.h> #include <sys/time.h>
#include <iostream> #include <iostream>
#include <cmath> #include <cmath>
#ifdef HAVE_GOMP
#include <omp.h>
#endif
#include <TSAXParser.h>
#include "../BMWIntegrator/BMWIntegrator.h" #include "../BMWIntegrator/BMWIntegrator.h"
#include "BMWStartupHandler.h"
#include "TLFRelaxation.h" #include "TLFRelaxation.h"
using namespace std; using namespace std;
@ -44,23 +54,46 @@ using namespace std;
#define Nsteps 100 #define Nsteps 100
ClassImp(TLFStatGssKT) ClassImp(TLFStatGssKT)
ClassImp(TLFStatLorKT) ClassImp(TLFStatExpKT)
ClassImp(TLFDynGssKT) ClassImp(TLFDynGssKT)
ClassImp(TLFDynLorKT) ClassImp(TLFDynExpKT)
ClassImp(TLFDynSG)
ClassImp(TLFSGInterpolation) ClassImp(TLFSGInterpolation)
// LF Static Gaussian KT //--------------------------------------------------------------------------
// Constructor
TLFStatGssKT::TLFStatGssKT() { //--------------------------------------------------------------------------
/**
* <p>Constructor: Initialize variables and allocate memory for the integrator.
*/
TLFStatGssKT::TLFStatGssKT() : fCalcNeeded(true), fLastTime(0.) {
fIntSinGss = new TIntSinGss(); fIntSinGss = new TIntSinGss();
fPar.resize(2, 0.);
} }
//--------------------------------------------------------------------------
// Destructor
//--------------------------------------------------------------------------
/**
* <p>Destructor: Free memory of the integrator, clean up some vectors.
*/
TLFStatGssKT::~TLFStatGssKT() { TLFStatGssKT::~TLFStatGssKT() {
delete fIntSinGss; delete fIntSinGss;
fIntSinGss = 0; fIntSinGss = 0;
fIntValues.clear();
fPar.clear();
} }
//--------------------------------------------------------------------------
// operator()
//--------------------------------------------------------------------------
/**
* <p>Method returning the function value at a given time for a given set of parameters.
*
* \param t time \htmlonly (&#956;s) \endhtmlonly \latexonly ($\mu\mathrm{s}$) \endlatexonly
* \param par parameters [\htmlonly &#957;<sub>L</sub>=<i>B</i>&#947;<sub>&#956;</sub>/2&#960; (MHz), &#963; (&#956;s<sup>-1</sup>)\endhtmlonly \latexonly $\nu_{\mathrm{L}}=B\gamma_{\mu}/2\pi~(\mathrm{MHz})$, $\sigma~(\mu\mathrm{s}^{-1})$ \endlatexonly]
*/
double TLFStatGssKT::operator()(double t, const vector<double> &par) const { double TLFStatGssKT::operator()(double t, const vector<double> &par) const {
assert(par.size() == 2); // two parameters nu=gbar*B,sigma assert(par.size() == 2); // two parameters nu=gbar*B,sigma
@ -69,32 +102,77 @@ double TLFStatGssKT::operator()(double t, const vector<double> &par) const {
return 1.0; return 1.0;
double sigsq(par[1]*par[1]); double sigsq(par[1]*par[1]);
double sigsqtt(sigsq*t*t);
if(TMath::Abs(par[0])<0.00135538817){ if(TMath::Abs(par[0])<0.00135538817){
return (0.33333333333333333333+0.66666666666666666667*(1.0-sigsq*t*t)*TMath::Exp(-0.5*sigsq*t*t)); return (0.33333333333333333333+0.66666666666666666667*(1.0-sigsqtt)*TMath::Exp(-0.5*sigsqtt));
} }
fIntSinGss->SetParameters(par); for (unsigned int i(0); i<2; ++i) {
if( fPar[i]-par[i] ) {
fPar[i] = par[i];
fCalcNeeded = true;
}
}
if (fCalcNeeded) {
fIntValues.clear();
fIntValues[0.] = 0.;
fLastTime = 0.;
} else {
if (t > fIntValues.rbegin()->first) {
fCalcNeeded = true;
fLastTime = fIntValues.rbegin()->first;
}
}
double omegaL(TMath::TwoPi()*par[0]); double omegaL(TMath::TwoPi()*par[0]);
double coeff1(2.0*sigsq/(omegaL*omegaL)); double coeff1(2.0*sigsq/(omegaL*omegaL));
double coeff2(2.0*sigsq*sigsq/(omegaL*omegaL*omegaL)); double coeff2(coeff1*sigsq/omegaL);
return (1.0-(coeff1*(1.0-TMath::Exp(-0.5*sigsq*t*t)*TMath::Cos(omegaL*t)))+(coeff2*fIntSinGss->IntegrateFunc(0.,t))); if (fCalcNeeded) {
fIntSinGss->SetParameters(par);
fIntValues[t] = fIntValues[fLastTime] + fIntSinGss->IntegrateFunc(fLastTime,t);
fCalcNeeded = false;
}
return (1.0-(coeff1*(1.0-TMath::Exp(-0.5*sigsqtt)*TMath::Cos(omegaL*t)))+(coeff2*fIntValues[t]));
} }
// LF Static Lorentzian KT //--------------------------------------------------------------------------
// Constructor
TLFStatLorKT::TLFStatLorKT() { //--------------------------------------------------------------------------
/**
* <p>Constructor: Initialize variables and allocate memory for the integrator.
*/
TLFStatExpKT::TLFStatExpKT() : fCalcNeeded(true), fLastTime(0.) {
fIntBesselJ0Exp = new TIntBesselJ0Exp(); fIntBesselJ0Exp = new TIntBesselJ0Exp();
fPar.resize(2, 0.);
} }
TLFStatLorKT::~TLFStatLorKT() { //--------------------------------------------------------------------------
delete fIntBesselJ0Exp; // Destructor
fIntBesselJ0Exp = 0; //--------------------------------------------------------------------------
/**
* <p>Destructor: Free memory of the integrator, clean up some vectors.
*/
TLFStatExpKT::~TLFStatExpKT() {
delete fIntBesselJ0Exp;
fIntBesselJ0Exp = 0;
fIntValues.clear();
fPar.clear();
} }
double TLFStatLorKT::operator()(double t, const vector<double> &par) const { //--------------------------------------------------------------------------
// operator()
//--------------------------------------------------------------------------
/**
* <p>Method returning the function value at a given time for a given set of parameters.
*
* \param t time \htmlonly (&#956;s) \endhtmlonly \latexonly ($\mu\mathrm{s}$) \endlatexonly
* \param par parameters [\htmlonly &#957;<sub>L</sub>=<i>B</i>&#947;<sub>&#956;</sub>/2&#960; (MHz), <i>a</i> (&#956;s<sup>-1</sup>)\endhtmlonly \latexonly $\nu_{\mathrm{L}}=B\gamma_{\mu}/2\pi~(\mathrm{MHz})$, $a~(\mu\mathrm{s}^{-1})$ \endlatexonly]
*/
double TLFStatExpKT::operator()(double t, const vector<double> &par) const {
assert(par.size() == 2); // two parameters nu=gbar*B,rate assert(par.size() == 2); // two parameters nu=gbar*B,rate
@ -105,7 +183,23 @@ double TLFStatLorKT::operator()(double t, const vector<double> &par) const {
return (0.33333333333333333333+0.66666666666666666667*(1.0-par[1]*t)*TMath::Exp(-par[1]*t)); return (0.33333333333333333333+0.66666666666666666667*(1.0-par[1]*t)*TMath::Exp(-par[1]*t));
} }
fIntBesselJ0Exp->SetParameters(par); for (unsigned int i(0); i<2; ++i) {
if( fPar[i]-par[i] ) {
fPar[i] = par[i];
fCalcNeeded = true;
}
}
if (fCalcNeeded) {
fIntValues.clear();
fIntValues[0.] = 0.;
fLastTime = 0.;
} else {
if (t > fIntValues.rbegin()->first) {
fCalcNeeded = true;
fLastTime = fIntValues.rbegin()->first;
}
}
double omegaL(TMath::TwoPi()*par[0]); double omegaL(TMath::TwoPi()*par[0]);
double coeff1(par[1]/omegaL); double coeff1(par[1]/omegaL);
@ -114,7 +208,7 @@ double TLFStatLorKT::operator()(double t, const vector<double> &par) const {
double w0t(omegaL*t); double w0t(omegaL*t);
double j1, j0; double j1, j0;
if (fabs(w0t) < 0.001) { // check zero time limits of the spherical bessel functions j0(x) and j1(x) if (fabs(w0t) < 1.e-5) { // check zero time limits of the spherical bessel functions j0(x) and j1(x)
j0 = 1.0; j0 = 1.0;
j1 = 0.0; j1 = 0.0;
} else { } else {
@ -122,50 +216,113 @@ double TLFStatLorKT::operator()(double t, const vector<double> &par) const {
j1 = (TMath::Sin(w0t)-w0t*TMath::Cos(w0t))/(w0t*w0t); j1 = (TMath::Sin(w0t)-w0t*TMath::Cos(w0t))/(w0t*w0t);
} }
return (1.0-(coeff1*TMath::Exp(-par[1]*t)*j1)-(coeff2*(j0*TMath::Exp(-par[1]*t)-1.0))-coeff3*fIntBesselJ0Exp->IntegrateFunc(0.,t)); if (fCalcNeeded) {
fIntBesselJ0Exp->SetParameters(par);
fIntValues[t] = fIntValues[fLastTime] + fIntBesselJ0Exp->IntegrateFunc(fLastTime,t);
fCalcNeeded = false;
}
return (1.0-(coeff1*TMath::Exp(-par[1]*t)*j1)-(coeff2*(j0*TMath::Exp(-par[1]*t)-1.0))-coeff3*fIntValues[t]);
} }
// LF Dynamic Gaussian KT //--------------------------------------------------------------------------
// Constructor
//--------------------------------------------------------------------------
/**
* <p>Constructor
* - read XML startup file
* - initialize variables
* - read FFTW3 wisdom if desired
* - allocate memory for the Laplace transform
* - create FFTW3 plans for the Laplace transform
*/
TLFDynGssKT::TLFDynGssKT() : fCalcNeeded(true), fFirstCall(true), fCounter(0) {
#ifdef HAVE_LIBFFTW3F_THREADS
int init_threads(fftwf_init_threads());
if (!init_threads)
cout << "TLFDynGssKT::TLFDynGssKT: Couldn't initialize multiple FFTW-threads ..." << endl;
else {
#ifdef HAVE_GOMP
fftwf_plan_with_nthreads(omp_get_num_procs());
#else
fftwf_plan_with_nthreads(2);
#endif /* HAVE_GOMP */
}
#endif /* HAVE_LIBFFTW3F_THREADS */
// read startup file
string startup_path_name("BMW_startup.xml");
TSAXParser *saxParser = new TSAXParser();
BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl;
assert(false);
}
fNSteps = startupHandler->GetNStepsLF();
fDt = startupHandler->GetDeltat();
fWisdom = startupHandler->GetWisdomFileFloat();
TLFDynGssKT::TLFDynGssKT() : fCalcNeeded(true), fFirstCall(true), fWisdom("WordsOfWisdom.dat"), fNSteps(524288), fDt(0.00004), fCounter(0) {
// Calculate d_omega and C for given NFFT and dt // Calculate d_omega and C for given NFFT and dt
fDw = PI/fNSteps/fDt; fDw = PI/(fNSteps*fDt);
fC = 2.0*TMath::Log(double(fNSteps))/(double(fNSteps-1)*fDt); fC = 2.0*TMath::Log(double(fNSteps))/(double(fNSteps-1)*fDt);
// Load FFTW Wisdom fUseWisdom = true;
int wisdomLoaded(0); int wisdomLoaded(0);
FILE *wordsOfWisdomR; FILE *wordsOfWisdomR;
wordsOfWisdomR = fopen(fWisdom.c_str(), "r"); wordsOfWisdomR = fopen(fWisdom.c_str(), "r");
if (wordsOfWisdomR == NULL) { if (wordsOfWisdomR == NULL) {
cout << "TLFDynGssKT::TLFDynGssKT: Couldn't open wisdom file ..." << endl; fUseWisdom = false;
} else { } else {
wisdomLoaded = fftwf_import_wisdom_from_file(wordsOfWisdomR); wisdomLoaded = fftwf_import_wisdom_from_file(wordsOfWisdomR);
fclose(wordsOfWisdomR); fclose(wordsOfWisdomR);
} }
if (!wisdomLoaded) { if (!wisdomLoaded) {
cout << "TLFDynGssKT::TLFDynGssKT: No wisdom is imported..." << endl; fUseWisdom = false;
} }
// END of WisdomLoading
// allocating memory for the FFtransform pairs and create the FFT plans // allocating memory for the FFtransform pairs and create the FFT plans
fFFTtime = (float *)malloc(sizeof(float) * fNSteps); fFFTtime = (float *)malloc(sizeof(float) * fNSteps);
fFFTfreq = (fftwf_complex *)fftwf_malloc(sizeof(fftwf_complex) * (fNSteps/2+1)); fFFTfreq = (fftwf_complex *)fftwf_malloc(sizeof(fftwf_complex) * (fNSteps/2+1));
fFFTplanFORW = fftwf_plan_dft_r2c_1d(fNSteps, fFFTtime, fFFTfreq, FFTW_ESTIMATE);
fFFTplanBACK = fftwf_plan_dft_c2r_1d(fNSteps, fFFTfreq, fFFTtime, FFTW_ESTIMATE); if (fUseWisdom) {
fFFTplanFORW = fftwf_plan_dft_r2c_1d(fNSteps, fFFTtime, fFFTfreq, FFTW_EXHAUSTIVE);
fFFTplanBACK = fftwf_plan_dft_c2r_1d(fNSteps, fFFTfreq, fFFTtime, FFTW_EXHAUSTIVE);
} else {
fFFTplanFORW = fftwf_plan_dft_r2c_1d(fNSteps, fFFTtime, fFFTfreq, FFTW_ESTIMATE);
fFFTplanBACK = fftwf_plan_dft_c2r_1d(fNSteps, fFFTfreq, fFFTtime, FFTW_ESTIMATE);
}
} }
//--------------------------------------------------------------------------
// Destructor
//--------------------------------------------------------------------------
/**
* <p>Destructor
* - write FFTW3 wisdom if desired
* - free memory used for the Laplace transform
*/
TLFDynGssKT::~TLFDynGssKT() { TLFDynGssKT::~TLFDynGssKT() {
// export FFTW Wisdom so it has not to be checked for the FFT-plan next time // export FFTW Wisdom so it has not to be checked for the FFT-plan next time
FILE *wordsOfWisdomW; if (fUseWisdom) {
wordsOfWisdomW = fopen(fWisdom.c_str(), "w"); FILE *wordsOfWisdomW;
if (wordsOfWisdomW == NULL) { wordsOfWisdomW = fopen(fWisdom.c_str(), "w");
cout << "TLFDynGssKT::~TLFDynGssKT: Could not open file ... No wisdom is exported..." << endl; if (wordsOfWisdomW == NULL) {
} else { cout << "TLFDynGssKT::~TLFDynGssKT(): Could not open file ... No wisdom is exported..." << endl;
fftwf_export_wisdom_to_file(wordsOfWisdomW); } else {
fclose(wordsOfWisdomW); fftwf_export_wisdom_to_file(wordsOfWisdomW);
fclose(wordsOfWisdomW);
}
} }
// END of Wisdom Export // END of Wisdom Export
@ -177,9 +334,18 @@ TLFDynGssKT::~TLFDynGssKT() {
cout << "TLFDynGssKT::~TLFDynGssKT(): " << fCounter << " full FFT cycles needed..." << endl; cout << "TLFDynGssKT::~TLFDynGssKT(): " << fCounter << " full FFT cycles needed..." << endl;
} }
//--------------------------------------------------------------------------
// operator()
//--------------------------------------------------------------------------
/**
* <p>Method returning the function value at a given time for a given set of parameters.
*
* \param t time \htmlonly (&#956;s) \endhtmlonly \latexonly ($\mu\mathrm{s}$) \endlatexonly
* \param par parameters [\htmlonly &#957;<sub>L</sub>=<i>B</i>&#947;<sub>&#956;</sub>/2&#960; (MHz), &#963; (&#956;s<sup>-1</sup>), &#957; (MHz)\endhtmlonly \latexonly $\nu_{\mathrm{L}}=B\gamma_{\mu}/2\pi~(\mathrm{MHz})$, $\sigma~(\mu\mathrm{s}^{-1})$, $\nu~(\mathrm{MHz})$ \endlatexonly]
*/
double TLFDynGssKT::operator()(double t, const vector<double> &par) const { double TLFDynGssKT::operator()(double t, const vector<double> &par) const {
assert(par.size() == 3 || par.size() == 4); // three parameters nuL=gbar*B,sigma,fluct.rate nu (fourth parameter: t[us] for SG-function) assert(par.size() == 3); // three parameters nuL=gbar*B,sigma,fluct.rate nu (fourth parameter: t[us] for SG-function)
if(t<0.0) if(t<0.0)
return 1.0; return 1.0;
@ -192,7 +358,7 @@ double TLFDynGssKT::operator()(double t, const vector<double> &par) const {
fFirstCall=false; fFirstCall=false;
} }
for (unsigned int i(0); i<3; i++) { for (unsigned int i(0); i<3; ++i) {
if( fPar[i]-par[i] ) { if( fPar[i]-par[i] ) {
fPar[i] = par[i]; fPar[i] = par[i];
fCalcNeeded=true; fCalcNeeded=true;
@ -228,12 +394,16 @@ double TLFDynGssKT::operator()(double t, const vector<double> &par) const {
struct timeval tv_start, tv_stop; struct timeval tv_start, tv_stop;
gettimeofday(&tv_start, 0); gettimeofday(&tv_start, 0);
*/ */
double tt(0.),sigsqtsq(0.); double tt(0.), sigsqtsq(0.);
int i;
if(fabs(par[0])<0.00135538817) { if(fabs(par[0])<0.00135538817) {
double mcplusnu(-(fC+par[2])); double mcplusnu(-(fC+par[2]));
for(unsigned int i(0); i<fNSteps; i++) { #ifdef HAVE_GOMP
tt=double(i)*fDt; #pragma omp parallel for default(shared) private(i,tt) schedule(dynamic)
#endif
for(i = 0; i < static_cast<int>(fNSteps); ++i) {
tt=static_cast<double>(i)*fDt;
sigsqtsq=sigsq*tt*tt; sigsqtsq=sigsq*tt*tt;
fFFTtime[i]=(0.33333333333333333333+0.66666666666666666667*(1.0-sigsqtsq)*exp(-0.5*sigsqtsq))*exp(mcplusnu*tt)*fDt; fFFTtime[i]=(0.33333333333333333333+0.66666666666666666667*(1.0-sigsqtsq)*exp(-0.5*sigsqtsq))*exp(mcplusnu*tt)*fDt;
} }
@ -244,15 +414,18 @@ double TLFDynGssKT::operator()(double t, const vector<double> &par) const {
fFFTtime[0] = fDt; fFFTtime[0] = fDt;
for(unsigned int i(1); i<fNSteps; i++) { #ifdef HAVE_GOMP
tt=(double(i)-0.5)*fDt; #pragma omp parallel for default(shared) private(i,tt) schedule(dynamic)
#endif
for(i = 1; i < static_cast<int>(fNSteps); ++i) {
tt=(static_cast<double>(i)-0.5)*fDt;
fFFTtime[i]=(sin(omegaL*tt) * exp(-0.5*sigsq*tt*tt))*fDt; fFFTtime[i]=(sin(omegaL*tt) * exp(-0.5*sigsq*tt*tt))*fDt;
} }
double totoIntegrale(0.); double totoIntegrale(0.);
for(unsigned int i(1); i<fNSteps; i++) { for(i = 1; i < static_cast<int>(fNSteps); ++i) {
tt=double(i)*fDt; tt=static_cast<double>(i)*fDt;
totoIntegrale+=fFFTtime[i]; totoIntegrale+=fFFTtime[i];
fFFTtime[i]=(1.0-(coeff1*(1.0-exp(-0.5*sigsq*tt*tt)*cos(omegaL*tt)))+(coeff2*totoIntegrale))*exp(mcplusnu*tt)*fDt; fFFTtime[i]=(1.0-(coeff1*(1.0-exp(-0.5*sigsq*tt*tt)*cos(omegaL*tt)))+(coeff2*totoIntegrale))*exp(mcplusnu*tt)*fDt;
} }
@ -269,7 +442,10 @@ double TLFDynGssKT::operator()(double t, const vector<double> &par) const {
double denom(1.0), imagsq(0.0), oneMINrealnu(1.0); double denom(1.0), imagsq(0.0), oneMINrealnu(1.0);
for (unsigned int i(0); i<fNSteps/2+1; i++) { #ifdef HAVE_GOMP
#pragma omp parallel for default(shared) private(i, imagsq, oneMINrealnu, denom) schedule(dynamic)
#endif
for (i = 0; i < static_cast<int>(fNSteps)/2+1; ++i) {
imagsq=fFFTfreq[i][1]*fFFTfreq[i][1]; imagsq=fFFTfreq[i][1]*fFFTfreq[i][1];
oneMINrealnu=1.0-(par[2]*fFFTfreq[i][0]); oneMINrealnu=1.0-(par[2]*fFFTfreq[i][0]);
denom=oneMINrealnu*oneMINrealnu + (nusq*imagsq); denom=oneMINrealnu*oneMINrealnu + (nusq*imagsq);
@ -285,7 +461,7 @@ double TLFDynGssKT::operator()(double t, const vector<double> &par) const {
// fFFTtime[i]=(fDw*TMath::Exp(fC*i*fDt)/TMath::Pi()*fFFTtime[i]); // fFFTtime[i]=(fDw*TMath::Exp(fC*i*fDt)/TMath::Pi()*fFFTtime[i]);
// } // }
fCalcNeeded=false; fCalcNeeded=false;
fCounter++; ++fCounter;
/* /*
gettimeofday(&tv_stop, 0); gettimeofday(&tv_stop, 0);
t2 = (tv_stop.tv_sec - tv_start.tv_sec)*1000.0 + (tv_stop.tv_usec - tv_start.tv_usec)/1000.0; t2 = (tv_stop.tv_sec - tv_start.tv_sec)*1000.0 + (tv_stop.tv_usec - tv_start.tv_usec)/1000.0;
@ -293,17 +469,27 @@ double TLFDynGssKT::operator()(double t, const vector<double> &par) const {
*/ */
} }
// return fFFTtime[int(t/fDt)]; // return fFFTtime[int(t/fDt)];
return fDw*exp(fC*t)/PI*fFFTtime[int(t/fDt)]; return fDw*exp(fC*t)/PI*fFFTtime[static_cast<int>(t/fDt)];
} }
// LF Dynamic Spin Glass Relaxation //--------------------------------------------------------------------------
// Constructor
//--------------------------------------------------------------------------
/**
* <p>Constructor: create dynamic-Gaussian-depolarization objects for a subset of static widths and initialize the parameter vector.
*/
TLFDynSG::TLFDynSG() { TLFDynSG::TLFDynSG() {
for(unsigned int i(0); i<Nsteps; ++i) for(unsigned int i(0); i<Nsteps; ++i)
fLFDynGssIntegral.push_back(new TLFDynGssKT()); fLFDynGssIntegral.push_back(new TLFDynGssKT());
fPar.resize(3, 0.0); fPar.resize(3, 0.0);
} }
//--------------------------------------------------------------------------
// Destructor
//--------------------------------------------------------------------------
/**
* <p>Destructor: free the memory of the dynamic-Gaussian-depolarization objects and cleanup the parameter vector.
*/
TLFDynSG::~TLFDynSG() { TLFDynSG::~TLFDynSG() {
for(unsigned int i(0); i<Nsteps; ++i) for(unsigned int i(0); i<Nsteps; ++i)
delete fLFDynGssIntegral[i]; delete fLFDynGssIntegral[i];
@ -311,6 +497,15 @@ TLFDynSG::~TLFDynSG() {
fPar.clear(); fPar.clear();
} }
//--------------------------------------------------------------------------
// operator()
//--------------------------------------------------------------------------
/**
* <p>Method returning the function value at a given time for a given set of parameters.
*
* \param t time \htmlonly (&#956;s) \endhtmlonly \latexonly ($\mu\mathrm{s}$) \endlatexonly
* \param par parameters [\htmlonly &#957;<sub>L</sub>=<i>B</i>&#947;<sub>&#956;</sub>/2&#960; (MHz), <i>a</i> (&#956;s<sup>-1</sup>), &#957; (MHz)\endhtmlonly \latexonly $\nu_{\mathrm{L}}=B\gamma_{\mu}/2\pi~(\mathrm{MHz})$, $a~(\mu\mathrm{s}^{-1})$, $\nu~(\mathrm{MHz})$ \endlatexonly]
*/
double TLFDynSG::operator()(double t, const vector<double> &par) const { double TLFDynSG::operator()(double t, const vector<double> &par) const {
assert(par.size() == 3); // three parameters nuL=gbar*B, a ,fluct.rate nu assert(par.size() == 3); // three parameters nuL=gbar*B, a ,fluct.rate nu
@ -321,19 +516,21 @@ double TLFDynSG::operator()(double t, const vector<double> &par) const {
if(t>20.0) if(t>20.0)
return 0.0; return 0.0;
const double upperCutOff(50.0); // times a
// Parameters for the integration // Parameters for the integration
for (unsigned int i(0); i<3; ++i) for (unsigned int i(0); i<3; ++i)
fPar[i] = par[i]; fPar[i] = par[i];
double sigma_step((40.0-0.1)*par[1]/static_cast<double>(Nsteps)); double sigma_step(upperCutOff*par[1]/static_cast<double>(Nsteps));
// at the moment, integrate between 0.1a and 40a (a "real upper limit" would be 10000a) // at the moment, integrate between 0 and 50a (a "real upper limit" would be 10000a)
double integral(0.0); double integral(0.0);
double a_sigmaSq(0.0); double a_sigmaSq(0.0);
double rho(0.0); double rho(0.0);
double rhoNormalizer(0.0); // is [1/]sqrt(2./PI) when the integration is done between 0 and infinity double rhoNormalizer(0.0); // is [1/]sqrt(2./PI) when the integration is done between 0 and infinity
for (unsigned int i(0); i<Nsteps; ++i) { for (unsigned int i(0); i<Nsteps; ++i) {
fPar[1] = 0.1*par[1] + (static_cast<double>(i) + 0.5)*sigma_step; fPar[1] = (static_cast<double>(i) + 0.5)*sigma_step;
a_sigmaSq = (par[1]/(fPar[1]*fPar[1])); a_sigmaSq = (par[1]/(fPar[1]*fPar[1]));
rho = a_sigmaSq*exp(-0.5*par[1]*a_sigmaSq); rho = a_sigmaSq*exp(-0.5*par[1]*a_sigmaSq);
rhoNormalizer += rho; rhoNormalizer += rho;
@ -347,47 +544,104 @@ double TLFDynSG::operator()(double t, const vector<double> &par) const {
} }
// LF Dynamic Lorentz KT //--------------------------------------------------------------------------
// Constructor
//--------------------------------------------------------------------------
/**
* <p>Constructor
* - read XML startup file
* - initialize variables
* - read FFTW3 wisdom if desired
* - allocate memory for the Laplace transform
* - create FFTW3 plans for the Laplace transform
*/
TLFDynExpKT::TLFDynExpKT() : fCalcNeeded(true), fFirstCall(true), fCounter(0), fL1(0.0), fL2(0.0) {
#ifdef HAVE_LIBFFTW3F_THREADS
int init_threads(fftwf_init_threads());
if (!init_threads)
cout << "TLFDynExpKT::TLFDynExpKT: Couldn't initialize multiple FFTW-threads ..." << endl;
else {
#ifdef HAVE_GOMP
fftwf_plan_with_nthreads(omp_get_num_procs());
#else
fftwf_plan_with_nthreads(2);
#endif /* HAVE_GOMP */
}
#endif /* HAVE_LIBFFTW3F_THREADS */
// read startup file
string startup_path_name("BMW_startup.xml");
TSAXParser *saxParser = new TSAXParser();
BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl;
assert(false);
}
fNSteps = startupHandler->GetNStepsLF();
fDt = startupHandler->GetDeltat();
fWisdom = startupHandler->GetWisdomFileFloat();
TLFDynLorKT::TLFDynLorKT() : fCalcNeeded(true), fFirstCall(true), fWisdom("WordsOfWisdom.dat"), fNSteps(524288), fDt(0.000040), fCounter(0), fL1(0.0), fL2(0.0) {
// Calculate d_omega and C for given NFFT and dt // Calculate d_omega and C for given NFFT and dt
fDw = TMath::Pi()/fNSteps/fDt; fDw = PI/(fNSteps*fDt);
fC = 2.0*TMath::Log(double(fNSteps))/(double(fNSteps-1)*fDt); fC = 2.0*TMath::Log(double(fNSteps))/(double(fNSteps-1)*fDt);
// Load FFTW Wisdom fUseWisdom = true;
int wisdomLoaded(0); int wisdomLoaded(0);
FILE *wordsOfWisdomR; FILE *wordsOfWisdomR;
wordsOfWisdomR = fopen(fWisdom.c_str(), "r"); wordsOfWisdomR = fopen(fWisdom.c_str(), "r");
if (wordsOfWisdomR == NULL) { if (wordsOfWisdomR == NULL) {
cout << "TLFDynLorKT::TLFDynLorKT: Couldn't open wisdom file ..." << endl; fUseWisdom = false;
} else { } else {
wisdomLoaded = fftwf_import_wisdom_from_file(wordsOfWisdomR); wisdomLoaded = fftwf_import_wisdom_from_file(wordsOfWisdomR);
fclose(wordsOfWisdomR); fclose(wordsOfWisdomR);
} }
if (!wisdomLoaded) { if (!wisdomLoaded) {
cout << "TLFDynLorKT::TLFDynLorKT: No wisdom is imported..." << endl; fUseWisdom = false;
} }
// END of WisdomLoading
// allocating memory for the FFtransform pairs and create the FFT plans // allocating memory for the FFtransform pairs and create the FFT plans
fFFTtime = (float *)malloc(sizeof(float) * fNSteps); fFFTtime = (float *)malloc(sizeof(float) * fNSteps);
fFFTfreq = (fftwf_complex *)fftwf_malloc(sizeof(fftwf_complex) * (fNSteps/2+1)); fFFTfreq = (fftwf_complex *)fftwf_malloc(sizeof(fftwf_complex) * (fNSteps/2+1));
fFFTplanFORW = fftwf_plan_dft_r2c_1d(fNSteps, fFFTtime, fFFTfreq, FFTW_ESTIMATE);
fFFTplanBACK = fftwf_plan_dft_c2r_1d(fNSteps, fFFTfreq, fFFTtime, FFTW_ESTIMATE); if (fUseWisdom) {
fFFTplanFORW = fftwf_plan_dft_r2c_1d(fNSteps, fFFTtime, fFFTfreq, FFTW_EXHAUSTIVE);
fFFTplanBACK = fftwf_plan_dft_c2r_1d(fNSteps, fFFTfreq, fFFTtime, FFTW_EXHAUSTIVE);
} else {
fFFTplanFORW = fftwf_plan_dft_r2c_1d(fNSteps, fFFTtime, fFFTfreq, FFTW_ESTIMATE);
fFFTplanBACK = fftwf_plan_dft_c2r_1d(fNSteps, fFFTfreq, fFFTtime, FFTW_ESTIMATE);
}
} }
TLFDynLorKT::~TLFDynLorKT() { //--------------------------------------------------------------------------
// Destructor
//--------------------------------------------------------------------------
/**
* <p>Destructor
* - write FFTW3 wisdom if desired
* - free memory used for the Laplace transform
*/
TLFDynExpKT::~TLFDynExpKT() {
// export FFTW Wisdom so it has not to be checked for the FFT-plan next time // export FFTW Wisdom so it has not to be checked for the FFT-plan next time
FILE *wordsOfWisdomW; if (fUseWisdom) {
wordsOfWisdomW = fopen(fWisdom.c_str(), "w"); FILE *wordsOfWisdomW;
if (wordsOfWisdomW == NULL) { wordsOfWisdomW = fopen(fWisdom.c_str(), "w");
cout << "TLFDynLorKT::~TLFDynLorKT: Could not open file ... No wisdom is exported..." << endl; if (wordsOfWisdomW == NULL) {
} else { cout << "TLFDynExpKT::~TLFDynExpKT(): Could not open file ... No wisdom is exported..." << endl;
fftwf_export_wisdom_to_file(wordsOfWisdomW); } else {
fclose(wordsOfWisdomW); fftwf_export_wisdom_to_file(wordsOfWisdomW);
fclose(wordsOfWisdomW);
}
} }
// END of Wisdom Export // END of Wisdom Export
@ -396,10 +650,19 @@ TLFDynLorKT::~TLFDynLorKT() {
fftwf_destroy_plan(fFFTplanBACK); fftwf_destroy_plan(fFFTplanBACK);
free(fFFTtime); free(fFFTtime);
fftwf_free(fFFTfreq); fftwf_free(fFFTfreq);
cout << "TLFDynLorKT::~TLFDynLorKT(): " << fCounter << " full FFT cyles needed..." << endl; cout << "TLFDynExpKT::~TLFDynExpKT(): " << fCounter << " full FFT cyles needed..." << endl;
} }
double TLFDynLorKT::operator()(double t, const vector<double> &par) const { //--------------------------------------------------------------------------
// operator()
//--------------------------------------------------------------------------
/**
* <p>Method returning the function value at a given time for a given set of parameters.
*
* \param t time \htmlonly (&#956;s) \endhtmlonly \latexonly ($\mu\mathrm{s}$) \endlatexonly
* \param par parameters [\htmlonly &#957;<sub>L</sub>=<i>B</i>&#947;<sub>&#956;</sub>/2&#960; (MHz), <i>a</i> (&#956;s<sup>-1</sup>), &#957; (MHz)\endhtmlonly \latexonly $\nu_{\mathrm{L}}=B\gamma_{\mu}/2\pi~(\mathrm{MHz})$, $a~(\mu\mathrm{s}^{-1})$, $\nu~(\mathrm{MHz})$ \endlatexonly]
*/
double TLFDynExpKT::operator()(double t, const vector<double> &par) const {
assert(par.size() == 3); // three parameters nuL=gbar*B,sigma,fluct.rate nu assert(par.size() == 3); // three parameters nuL=gbar*B,sigma,fluct.rate nu
@ -445,7 +708,7 @@ double TLFDynLorKT::operator()(double t, const vector<double> &par) const {
double nuN[4]; double nuN[4];
w0N[0] = omegaL; w0N[0] = omegaL;
nuN[0] = nu; nuN[0] = nu;
for (unsigned int i=1; i<4; i++) { for (unsigned int i=1; i<4; ++i) {
w0N[i] = omegaL * w0N[i-1]; w0N[i] = omegaL * w0N[i-1];
nuN[i] = nu * nuN[i-1]; nuN[i] = nu * nuN[i-1];
} }
@ -458,7 +721,7 @@ double TLFDynLorKT::operator()(double t, const vector<double> &par) const {
double w0t(omegaL*t); double w0t(omegaL*t);
double j1, j0; double j1, j0;
if (fabs(w0t) < 0.001) { // check zero time limits of the spherical bessel functions j0(x) and j1(x) if (fabs(w0t) < 1.e-5) { // check zero time limits of the spherical bessel functions j0(x) and j1(x)
j0 = 1.0; j0 = 1.0;
j1 = 0.0; j1 = 0.0;
} else { } else {
@ -476,10 +739,14 @@ double TLFDynLorKT::operator()(double t, const vector<double> &par) const {
if(fCalcNeeded){ if(fCalcNeeded){
double tt(0.); double tt(0.);
int i;
if(TMath::Abs(par[0])<0.00135538817){ if(TMath::Abs(par[0])<0.00135538817){
for(unsigned int i(0); i<fNSteps; i++) { #ifdef HAVE_GOMP
tt=double(i)*fDt; #pragma omp parallel for default(shared) private(i, tt) schedule(dynamic)
#endif
for(i = 0; i < static_cast<int>(fNSteps); ++i) {
tt=static_cast<double>(i)*fDt;
fFFTtime[i]=(0.33333333333333333333+0.66666666666666666667*(1.0-par[1]*tt)*TMath::Exp(-par[1]*tt))*TMath::Exp(-(fC+par[2])*tt)*fDt; fFFTtime[i]=(0.33333333333333333333+0.66666666666666666667*(1.0-par[1]*tt)*TMath::Exp(-par[1]*tt))*TMath::Exp(-(fC+par[2])*tt)*fDt;
} }
} else { } else {
@ -490,7 +757,10 @@ double TLFDynLorKT::operator()(double t, const vector<double> &par) const {
fFFTtime[0] = 1.0*fDt; fFFTtime[0] = 1.0*fDt;
for(unsigned int i(1); i<fNSteps; i++) { #ifdef HAVE_GOMP
#pragma omp parallel for default(shared) private(i, tt) schedule(dynamic)
#endif
for(i = 1; i < static_cast<int>(fNSteps); ++i) {
tt=(double(i)-0.5)*fDt; tt=(double(i)-0.5)*fDt;
fFFTtime[i]=TMath::Sin(omegaL*tt)/(omegaL*tt)*TMath::Exp(-par[1]*tt)*fDt; fFFTtime[i]=TMath::Sin(omegaL*tt)/(omegaL*tt)*TMath::Exp(-par[1]*tt)*fDt;
} }
@ -498,7 +768,7 @@ double TLFDynLorKT::operator()(double t, const vector<double> &par) const {
double totoIntegrale(0.); double totoIntegrale(0.);
double w0t(1.0); double w0t(1.0);
for(unsigned int i(1); i<fNSteps; i++) { for(i = 1; i < static_cast<int>(fNSteps); ++i) {
tt=double(i)*fDt; tt=double(i)*fDt;
totoIntegrale+=fFFTtime[i]; totoIntegrale+=fFFTtime[i];
w0t = omegaL*tt; w0t = omegaL*tt;
@ -515,7 +785,10 @@ double TLFDynLorKT::operator()(double t, const vector<double> &par) const {
double nusq(par[2]*par[2]); // nu^2 double nusq(par[2]*par[2]); // nu^2
double denom(1.0), imagsq(0.0), oneMINrealnu(1.0); double denom(1.0), imagsq(0.0), oneMINrealnu(1.0);
for (unsigned int i(0); i<fNSteps/2+1; i++) { #ifdef HAVE_GOMP
#pragma omp parallel for default(shared) private(i, imagsq, oneMINrealnu, denom) schedule(dynamic)
#endif
for (i = 0; i < static_cast<int>(fNSteps)/2+1; ++i) {
imagsq=fFFTfreq[i][1]*fFFTfreq[i][1]; imagsq=fFFTfreq[i][1]*fFFTfreq[i][1];
oneMINrealnu=1.0-(par[2]*fFFTfreq[i][0]); oneMINrealnu=1.0-(par[2]*fFFTfreq[i][0]);
denom=oneMINrealnu*oneMINrealnu + (nusq*imagsq); denom=oneMINrealnu*oneMINrealnu + (nusq*imagsq);
@ -531,47 +804,88 @@ double TLFDynLorKT::operator()(double t, const vector<double> &par) const {
// fFFTtime[i]=(fDw*TMath::Exp(fC*i*fDt)/TMath::Pi()*fFFTtime[i]); // fFFTtime[i]=(fDw*TMath::Exp(fC*i*fDt)/TMath::Pi()*fFFTtime[i]);
// } // }
fCalcNeeded=false; fCalcNeeded=false;
fCounter++; ++fCounter;
} }
// return fFFTtime[int(t/fDt)]; // return fFFTtime[int(t/fDt)];
return fDw*TMath::Exp(fC*t)/TMath::Pi()*fFFTtime[int(t/fDt)]; return fDw*TMath::Exp(fC*t)/TMath::Pi()*fFFTtime[static_cast<int>(t/fDt)];
} }
//--------------------------------------------------------------------------
// De Renzi Spin Glass Interpolation // Constructor
//--------------------------------------------------------------------------
TLFSGInterpolation::TLFSGInterpolation() { /**
TIntSGInterpolation *integral = new TIntSGInterpolation(); * <p>Constructor: Initialize variables and allocate memory for the integrator.
fIntegral = integral; */
integral = 0; TLFSGInterpolation::TLFSGInterpolation() : fCalcNeeded(true), fLastTime(0.) {
fIntegral = new TIntSGInterpolation();
fPar.resize(4, 0.);
} }
//--------------------------------------------------------------------------
// Destructor
//--------------------------------------------------------------------------
/**
* <p>Destructor: Free memory of the integrator, clean up some vectors.
*/
TLFSGInterpolation::~TLFSGInterpolation() { TLFSGInterpolation::~TLFSGInterpolation() {
delete fIntegral; delete fIntegral;
fIntegral = 0; fIntegral = 0;
fPar.clear();
fIntValues.clear();
} }
//--------------------------------------------------------------------------
// operator()
//--------------------------------------------------------------------------
/**
* <p>Method returning the function value at a given time for a given set of parameters.
*
* \param t time \htmlonly (&#956;s) \endhtmlonly \latexonly ($\mu\mathrm{s}$) \endlatexonly
* \param par parameters [\htmlonly &#957;<sub>L</sub>=<i>B</i>&#947;<sub>&#956;</sub>/2&#960; (MHz), <i>a</i> (&#956;s<sup>-1</sup>), &#955; (&#956;s<sup>-1</sup>), &#946; (1) \endhtmlonly \latexonly $\nu_{\mathrm{L}}=B\gamma_{\mu}/2\pi~(\mathrm{MHz})$, $a~(\mu\mathrm{s}^{-1})$, $\lambda~(\mu\mathrm{s}^{-1})$, $\beta~(1)$ \endlatexonly]
*/
double TLFSGInterpolation::operator()(double t, const vector<double> &par) const { double TLFSGInterpolation::operator()(double t, const vector<double> &par) const {
assert(par.size() == 4); // two parameters nu=gbar*B [MHz], a [1/us], lambda [1/us], beta [1] assert(par.size() == 4); // four parameters nu=gbar*B [MHz], a [1/us], lambda [1/us], beta [1]
if((t <= 0.0) || (par[3] <= 0.0)) if((t <= 0.0) || (par[3] <= 0.0))
return 1.0; return 1.0;
double expo(0.5*par[1]*par[1]*t*t/par[3]+par[2]*t); double expo(0.5*par[1]*par[1]*t*t/par[3]+par[2]*t);
if(TMath::Abs(par[0])<0.00135538817){ if (TMath::Abs(par[0]) < 0.00135538817) {
return (0.33333333333333333333*TMath::Exp(-TMath::Power(par[2]*t,par[3])) + \ return (0.33333333333333333333*TMath::Exp(-TMath::Power(par[2]*t,par[3])) + \
0.66666666666666666667*(1.0-par[1]*par[1]*t*t/TMath::Power(expo,(1.0-par[3])))*TMath::Exp(-TMath::Power(expo,par[3]))); 0.66666666666666666667*(1.0-par[1]*par[1]*t*t/TMath::Power(expo,(1.0-par[3])))*TMath::Exp(-TMath::Power(expo,par[3])));
} }
vector<double> intpar(par); for (unsigned int i(0); i<4; ++i) {
intpar.push_back(t); if( fPar[i]-par[i] ) {
fIntegral->SetParameters(intpar); fPar[i] = par[i];
fCalcNeeded = true;
}
}
if (fCalcNeeded) {
fIntValues.clear();
fIntValues[0.] = 0.;
fLastTime = 0.;
} else {
if (t > fIntValues.rbegin()->first) {
fCalcNeeded = true;
fLastTime = fIntValues.rbegin()->first;
}
}
double omegaL(TMath::TwoPi()*par[0]); double omegaL(TMath::TwoPi()*par[0]);
if (fCalcNeeded) {
vector<double> intpar(par);
intpar.push_back(t);
fIntegral->SetParameters(intpar);
fIntValues[t] = fIntValues[fLastTime] + fIntegral->IntegrateFunc(fLastTime,t);
intpar.clear();
}
return (TMath::Exp(-TMath::Power(par[2]*t,par[3])) + 2.0*par[1]*par[1]/(omegaL*omegaL) * \ return (TMath::Exp(-TMath::Power(par[2]*t,par[3])) + 2.0*par[1]*par[1]/(omegaL*omegaL) * \
((TMath::Cos(omegaL*t)-TMath::Sin(omegaL*t)/(omegaL*t))*TMath::Exp(-TMath::Power(expo,par[3]))/TMath::Power(expo,(1.0-par[3])) + \ ((TMath::Cos(omegaL*t)-TMath::Sin(omegaL*t)/(omegaL*t))*TMath::Exp(-TMath::Power(expo,par[3]))/TMath::Power(expo,(1.0-par[3])) + \
fIntegral->IntegrateFunc(0.,t))); fIntValues[t]));
} }

View File

@ -5,7 +5,7 @@
Author: Bastian M. Wojek Author: Bastian M. Wojek
e-mail: bastian.wojek@psi.ch e-mail: bastian.wojek@psi.ch
2008/12/04 $Id$
***************************************************************************/ ***************************************************************************/
@ -35,6 +35,7 @@
#include<vector> #include<vector>
#include<cstdio> #include<cstdio>
#include<cmath> #include<cmath>
#include<map>
using namespace std; using namespace std;
@ -50,6 +51,15 @@ using namespace std;
#include "fftw3.h" #include "fftw3.h"
#include "../BMWIntegrator/BMWIntegrator.h" #include "../BMWIntegrator/BMWIntegrator.h"
//-----------------------------------------------------------------------------------------------------------------
/**
* <p>User function for a static Gaussian depolarization in a longitudinal field using direct integration through GSL
* See also: R. S. Hayano, Y. J. Uemura, J. Imazato, N. Nishida, T. Yamazaki, and R. Kubo,
* \htmlonly Phys. Rev. B <b>20</b>, 850&#150;859 (1979), doi:<a href="http://dx.doi.org/10.1103/PhysRevB.20.850">10.1103/PhysRevB.20.850</a>
* \endhtmlonly
* \latexonly Phys. Rev. B \textbf{20}, 850--859 (1979), \texttt{http://dx.doi.org/10.1103/PhysRevB.20.850}
* \endlatexonly
*/
class TLFStatGssKT : public PUserFcnBase { class TLFStatGssKT : public PUserFcnBase {
public: public:
@ -63,16 +73,29 @@ public:
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
TIntSinGss *fIntSinGss; TIntSinGss *fIntSinGss; ///< integrator
mutable map<double, double> fIntValues; ///< previously calculated integral values
mutable vector<double> fPar; ///< parameters of the function [\htmlonly &#957;<sub>L</sub>=<i>B</i>&#947;<sub>&#956;</sub>/2&#960; (MHz), &#963; (&#956;s<sup>-1</sup>)\endhtmlonly \latexonly $\nu_{\mathrm{L}}=B\gamma_{\mu}/2\pi~(\mathrm{MHz})$, $\sigma~(\mu\mathrm{s}^{-1})$ \endlatexonly]
mutable bool fCalcNeeded; ///< flag specifying if an integration has to be done
mutable double fLastTime; ///< time of the last calculated function value
ClassDef(TLFStatGssKT,1) ClassDef(TLFStatGssKT,2)
}; };
class TLFStatLorKT : public PUserFcnBase { //-----------------------------------------------------------------------------------------------------------------
/**
* <p>User function for a static exponential depolarization in a longitudinal field using direct integration through GSL
* See also: Y. J. Uemura, T. Yamazaki, D. R. Harshman, M. Senba, and E. J. Ansaldo,
* \htmlonly Phys. Rev. B <b>31</b>, 546&#150;563 (1985), doi:<a href="http://dx.doi.org/10.1103/PhysRevB.31.546">10.1103/PhysRevB.31.546</a>
* \endhtmlonly
* \latexonly Phys. Rev. B \textbf{31}, 546--563 (1985), \texttt{http://dx.doi.org/10.1103/PhysRevB.31.546}
* \endlatexonly
*/
class TLFStatExpKT : public PUserFcnBase {
public: public:
TLFStatLorKT(); TLFStatExpKT();
~TLFStatLorKT(); ~TLFStatExpKT();
Bool_t NeedGlobalPart() const { return false; } Bool_t NeedGlobalPart() const { return false; }
void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { } void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
@ -81,11 +104,31 @@ public:
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
TIntBesselJ0Exp *fIntBesselJ0Exp; TIntBesselJ0Exp *fIntBesselJ0Exp; ///< integrator
mutable map<double, double> fIntValues; ///< previously calculated integral values
mutable vector<double> fPar; ///< parameters of the function [\htmlonly &#957;<sub>L</sub>=<i>B</i>&#947;<sub>&#956;</sub>/2&#960; (MHz), <i>a</i> (&#956;s<sup>-1</sup>)\endhtmlonly \latexonly $\nu_{\mathrm{L}}=B\gamma_{\mu}/2\pi~(\mathrm{MHz})$, $a~(\mu\mathrm{s}^{-1})$ \endlatexonly]
mutable bool fCalcNeeded; ///< flag specifying if an integration has to be done
mutable double fLastTime; ///< time of the last calculated function value
ClassDef(TLFStatLorKT,1) ClassDef(TLFStatExpKT,2)
}; };
//-----------------------------------------------------------------------------------------------------------------
/**
* <p>User function for a dynamic Gaussian depolarization in a longitudinal field calculated using Laplace transforms
* See also: R. S. Hayano, Y. J. Uemura, J. Imazato, N. Nishida, T. Yamazaki, and R. Kubo,
* \htmlonly Phys. Rev. B <b>20</b>, 850&#150;859 (1979), doi:<a href="http://dx.doi.org/10.1103/PhysRevB.20.850">10.1103/PhysRevB.20.850</a>
* \endhtmlonly
* \latexonly Phys. Rev. B \textbf{20}, 850--859 (1979), \texttt{http://dx.doi.org/10.1103/PhysRevB.20.850}
* \endlatexonly
*
* For details regarding the numerical Laplace transform, see e.g.
* P. Moreno and A. Ramirez,
* \htmlonly IEEE Trans. Power Delivery <b>23</b>, 2599&#150;2609 (2008), doi:<a href="http://dx.doi.org/10.1109/TPWRD.2008.923404">10.1109/TPWRD.2008.923404</a>
* \endhtmlonly
* \latexonly IEEE Trans. Power Delivery \textbf{23}, 2599--2609 (2008), \texttt{http://dx.doi.org/10.1109/TPWRD.2008.923404}
* \endlatexonly
*/
class TLFDynGssKT : public PUserFcnBase { class TLFDynGssKT : public PUserFcnBase {
public: public:
@ -99,28 +142,51 @@ public:
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
mutable vector<double> fPar; mutable vector<double> fPar; ///< parameters of the function [\htmlonly &#957;<sub>L</sub>=<i>B</i>&#947;<sub>&#956;</sub>/2&#960; (MHz), &#963; (&#956;s<sup>-1</sup>), &#957; (MHz)\endhtmlonly \latexonly $\nu_{\mathrm{L}}=B\gamma_{\mu}/2\pi~(\mathrm{MHz})$, $\sigma~(\mu\mathrm{s}^{-1})$, $\nu~(\mathrm{MHz})$ \endlatexonly]
mutable bool fCalcNeeded; mutable bool fCalcNeeded; ///< flag indicating if the expensive Laplace transform has to be done (e.g. after parameters have changed)
mutable bool fFirstCall; mutable bool fFirstCall; ///< flag indicating if the function is evaluated for the first time
string fWisdom; bool fUseWisdom; ///< flag showing if a FFTW3-wisdom file is used
unsigned int fNSteps; string fWisdom; ///< path to the wisdom file
double fDt; unsigned int fNSteps; ///< length of the Laplace transform
double fDw; double fDt; ///< time resolution
double fC; double fDw; ///< frequency resolution
fftwf_plan fFFTplanFORW; double fC; ///< coefficient depending on the length of the Laplace transform and time resolution
fftwf_plan fFFTplanBACK; fftwf_plan fFFTplanFORW; ///< FFTW3 plan: time domain \htmlonly &#8594; \endhtmlonly \latexonly $\rightarrow$ \endlatexonly frequency domain
float *fFFTtime; fftwf_plan fFFTplanBACK; ///< FFTW3 plan: time domain \htmlonly &#8592; \endhtmlonly \latexonly $\leftarrow$ \endlatexonly frequency domain
fftwf_complex *fFFTfreq; float *fFFTtime; ///< time-domain array
mutable unsigned int fCounter; fftwf_complex *fFFTfreq; ///< frequency-domain array
mutable unsigned int fCounter; ///< counter determining how many Laplace transforms are done (mainly for debugging purposes)
ClassDef(TLFDynGssKT,1) ClassDef(TLFDynGssKT,2)
}; };
class TLFDynLorKT : public PUserFcnBase { //-----------------------------------------------------------------------------------------------------------------
/**
* <p>User function for a dynamic exponential depolarization in a longitudinal field calculated using Laplace transforms
* See also: Y. J. Uemura, T. Yamazaki, D. R. Harshman, M. Senba, and E. J. Ansaldo,
* \htmlonly Phys. Rev. B <b>31</b>, 546&#150;563 (1985), doi:<a href="http://dx.doi.org/10.1103/PhysRevB.31.546">10.1103/PhysRevB.31.546</a>
* \endhtmlonly
* \latexonly Phys. Rev. B \textbf{31}, 546--563 (1985), \texttt{http://dx.doi.org/10.1103/PhysRevB.31.546}
* \endlatexonly
*
* and: R. S. Hayano, Y. J. Uemura, J. Imazato, N. Nishida, T. Yamazaki, and R. Kubo,
* \htmlonly Phys. Rev. B <b>20</b>, 850&#150;859 (1979), doi:<a href="http://dx.doi.org/10.1103/PhysRevB.20.850">10.1103/PhysRevB.20.850</a>
* \endhtmlonly
* \latexonly Phys. Rev. B \textbf{20}, 850--859 (1979), \texttt{http://dx.doi.org/10.1103/PhysRevB.20.850}
* \endlatexonly
*
* For details regarding the numerical Laplace transform, see e.g.
* P. Moreno and A. Ramirez,
* \htmlonly IEEE Trans. Power Delivery <b>23</b>, 2599&#150;2609 (2008), doi:<a href="http://dx.doi.org/10.1109/TPWRD.2008.923404">10.1109/TPWRD.2008.923404</a>
* \endhtmlonly
* \latexonly IEEE Trans. Power Delivery \textbf{23}, 2599--2609 (2008), \texttt{http://dx.doi.org/10.1109/TPWRD.2008.923404}
* \endlatexonly
*/
class TLFDynExpKT : public PUserFcnBase {
public: public:
TLFDynLorKT(); TLFDynExpKT();
~TLFDynLorKT(); ~TLFDynExpKT();
Bool_t NeedGlobalPart() const { return false; } Bool_t NeedGlobalPart() const { return false; }
void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { } void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
@ -129,25 +195,48 @@ public:
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
mutable vector<double> fPar; mutable vector<double> fPar; ///< parameters of the function [\htmlonly &#957;<sub>L</sub>=<i>B</i>&#947;<sub>&#956;</sub>/2&#960; (MHz), <i>a</i> (&#956;s<sup>-1</sup>), &#957; (MHz)\endhtmlonly \latexonly $\nu_{\mathrm{L}}=B\gamma_{\mu}/2\pi~(\mathrm{MHz})$, $a~(\mu\mathrm{s}^{-1})$, $\nu~(\mathrm{MHz})$ \endlatexonly]
mutable bool fCalcNeeded; mutable bool fCalcNeeded; ///< flag indicating if the expensive Laplace transform has to be done (e.g. after parameters have changed)
mutable bool fFirstCall; mutable bool fFirstCall; ///< flag indicating if the function is evaluated for the first time
string fWisdom; bool fUseWisdom; ///< flag showing if a FFTW3-wisdom file is used
unsigned int fNSteps; string fWisdom; ///< path to the wisdom file
double fDt; unsigned int fNSteps; ///< length of the Laplace transform
double fDw; double fDt; ///< time resolution
double fC; double fDw; ///< frequency resolution
fftwf_plan fFFTplanFORW; double fC; ///< coefficient depending on the length of the Laplace transform and time resolution
fftwf_plan fFFTplanBACK; fftwf_plan fFFTplanFORW; ///< FFTW3 plan: time domain \htmlonly &#8594; \endhtmlonly \latexonly $\rightarrow$ \endlatexonly frequency domain
float *fFFTtime; fftwf_plan fFFTplanBACK; ///< FFTW3 plan: time domain \htmlonly &#8592; \endhtmlonly \latexonly $\leftarrow$ \endlatexonly frequency domain
fftwf_complex *fFFTfreq; float *fFFTtime; ///< time-domain array
mutable unsigned int fCounter; fftwf_complex *fFFTfreq; ///< frequency-domain array
mutable double fL1; mutable unsigned int fCounter; ///< counter determining how many Laplace transforms are done (mainly for debugging purposes)
mutable double fL2; mutable double fL1; ///< coefficient used for the high-field and high-hopping-rate approximation
mutable double fL2; ///< coefficient used for the high-field and high-hopping-rate approximation
ClassDef(TLFDynLorKT,1) ClassDef(TLFDynExpKT,2)
}; };
//-----------------------------------------------------------------------------------------------------------------
/**
* <p>User function for a dynamic depolarization in a spin glass in a longitudinal field calculated using Laplace transforms
* See also: Y. J. Uemura, T. Yamazaki, D. R. Harshman, M. Senba, and E. J. Ansaldo,
* \htmlonly Phys. Rev. B <b>31</b>, 546&#150;563 (1985), doi:<a href="http://dx.doi.org/10.1103/PhysRevB.31.546">10.1103/PhysRevB.31.546</a>
* \endhtmlonly
* \latexonly Phys. Rev. B \textbf{31}, 546--563 (1985), \texttt{http://dx.doi.org/10.1103/PhysRevB.31.546}
* \endlatexonly
*
* and: R. S. Hayano, Y. J. Uemura, J. Imazato, N. Nishida, T. Yamazaki, and R. Kubo,
* \htmlonly Phys. Rev. B <b>20</b>, 850&#150;859 (1979), doi:<a href="http://dx.doi.org/10.1103/PhysRevB.20.850">10.1103/PhysRevB.20.850</a>
* \endhtmlonly
* \latexonly Phys. Rev. B \textbf{20}, 850--859 (1979), \texttt{http://dx.doi.org/10.1103/PhysRevB.20.850}
* \endlatexonly
*
* For details regarding the numerical Laplace transform, see e.g.
* P. Moreno and A. Ramirez,
* \htmlonly IEEE Trans. Power Delivery <b>23</b>, 2599&#150;2609 (2008), doi:<a href="http://dx.doi.org/10.1109/TPWRD.2008.923404">10.1109/TPWRD.2008.923404</a>
* \endhtmlonly
* \latexonly IEEE Trans. Power Delivery \textbf{23}, 2599--2609 (2008), \texttt{http://dx.doi.org/10.1109/TPWRD.2008.923404}
* \endlatexonly
*/
class TLFDynSG : public PUserFcnBase { class TLFDynSG : public PUserFcnBase {
public: public:
@ -161,12 +250,21 @@ public:
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
mutable vector<double> fPar; mutable vector<double> fPar; ///< parameters of the dynamic Gaussian depolarization function [\htmlonly &#957;<sub>L</sub>=<i>B</i>&#947;<sub>&#956;</sub>/2&#960; (MHz), &#963; (&#956;s<sup>-1</sup>), &#957; (MHz)\endhtmlonly \latexonly $\nu_{\mathrm{L}}=B\gamma_{\mu}/2\pi~(\mathrm{MHz})$, $\sigma~(\mu\mathrm{s}^{-1})$, $\nu~(\mathrm{MHz})$ \endlatexonly]
vector<TLFDynGssKT*> fLFDynGssIntegral; vector<TLFDynGssKT*> fLFDynGssIntegral; ///< vector of dynamic Gaussian depolarization functions for a subset of static widths
ClassDef(TLFDynSG,1) ClassDef(TLFDynSG,1)
}; };
//-----------------------------------------------------------------------------------------------------------------
/**
* <p>User function for a dynamic depolarization in a spin glass in a longitudinal field
* See also: R. De Renzi and S. Fanesi
* \htmlonly Physica B <b>289&#150;290</b>, 209&#150;212 (2000), doi:<a href="http://dx.doi.org/10.1016/S0921-4526(00)00368-9">10.1016/S0921-4526(00)00368-9</a>
* \endhtmlonly
* \latexonly Physica B \textbf{289--290}, 209--212 (2000), \texttt{http://dx.doi.org/10.1016/S0921-4526(00)00368-9}
* \endlatexonly
*/
class TLFSGInterpolation : public PUserFcnBase { class TLFSGInterpolation : public PUserFcnBase {
public: public:
@ -180,10 +278,14 @@ public:
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
TIntSGInterpolation *fIntegral; TIntSGInterpolation *fIntegral; ///< integrator
mutable map<double, double> fIntValues; ///< previously calculated integral values
mutable vector<double> fPar; ///< parameters of the function [\htmlonly &#957;<sub>L</sub>=<i>B</i>&#947;<sub>&#956;</sub>/2&#960; (MHz), <i>a</i> (&#956;s<sup>-1</sup>), &#955; (&#956;s<sup>-1</sup>), &#946; (1) \endhtmlonly \latexonly $\nu_{\mathrm{L}}=B\gamma_{\mu}/2\pi~(\mathrm{MHz})$, $a~(\mu\mathrm{s}^{-1})$, $\lambda~(\mu\mathrm{s}^{-1})$, $\beta~(1)$ \endlatexonly]
mutable bool fCalcNeeded; ///< flag specifying if an integration has to be done
mutable double fLastTime; ///< time of the last calculated function value
ClassDef(TLFSGInterpolation,1) ClassDef(TLFSGInterpolation,2)
}; };
#endif //_LFRelaxation_H_ #endif //_TLFRelaxation_H_

View File

@ -5,7 +5,7 @@
Author: Bastian M. Wojek Author: Bastian M. Wojek
e-mail: bastian.wojek@psi.ch e-mail: bastian.wojek@psi.ch
2008/12/04 $Id$
***************************************************************************/ ***************************************************************************/
@ -37,9 +37,9 @@
#pragma link off all functions; #pragma link off all functions;
#pragma link C++ class TLFStatGssKT+; #pragma link C++ class TLFStatGssKT+;
#pragma link C++ class TLFStatLorKT+; #pragma link C++ class TLFStatExpKT+;
#pragma link C++ class TLFDynGssKT+; #pragma link C++ class TLFDynGssKT+;
#pragma link C++ class TLFDynLorKT+; #pragma link C++ class TLFDynExpKT+;
#pragma link C++ class TLFDynSG+; #pragma link C++ class TLFDynSG+;
#pragma link C++ class TLFSGInterpolation+; #pragma link C++ class TLFSGInterpolation+;

View File

@ -1,19 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<TFitPofB> <BMW>
<comment> <comment>
TFitPofB_startup.xml BMW_startup.xml
Here some external parameters used in conjunction with the TFitPofB-library are set. Here some external parameters used in conjunction with the BMWlibs are set.
There are different sections: There are different sections:
* Common parameters which are used for any kind of function * Common parameters which are used for any kind of function
* Parameters for low energy uSR data analysis with given B(z) * Parameters for low energy uSR data analysis with given B(z)
* Parameters for bulk uSR data analysis (currently only four model to calculate field distributions for a triangular vortex lattice) * Parameters for bulk uSR data analysis (currently only four model to calculate field distributions for a triangular vortex lattice)
* Parameters for dynamical LF relaxation functions within the BMWlibs (mainly useful for testing purposes)
Common parameters: Common parameters:
- debug : set it to 1 in order to obtain some information what is read from the xml-file - debug : set it to 1 in order to obtain some information what is read from the xml-file
- wisdom : sets the path to an FFTW-wisdom file - if there is no valid wisdom at the given path, wisdom handling will be disabled - wisdom : sets the path to an FFTW-wisdom file - if there is no valid wisdom at the given path, wisdom handling will be disabled
- wisdom_float : sets the path to a float-FFTW-wisdom file - if there is no valid wisdom at the given path, wisdom handling will be disabled
(at the moment only used for LF-relaxation functions)
- delta_t : time resolution of P(t) in microseconds - delta_t : time resolution of P(t) in microseconds
- delta_B : field resolution of P(B) in Gauss - delta_B : field resolution of P(B) in Gauss
LF-relaxation parameters:
- delta_t_LF : time resolution of P(t) in microseconds for the Laplace transforms involved in the dynamical LF-relaxation calculations
- N_LF : length of the Laplace transforms involved in the dynamical LF-relaxation calculations
LEM parameters (if the LEM tag is present it is expected that the data_path tag contains a valid path): LEM parameters (if the LEM tag is present it is expected that the data_path tag contains a valid path):
- data_path, energy_list : Defines path/prefix, energy-labels and energies (keV) of TrimSP-rge-files - data_path, energy_list : Defines path/prefix, energy-labels and energies (keV) of TrimSP-rge-files
The expected file-names are then: data_path + energy_label + .rge The expected file-names are then: data_path + energy_label + .rge
@ -24,11 +31,16 @@
</comment> </comment>
<debug>0</debug> <debug>0</debug>
<wisdom>none</wisdom> <wisdom>none</wisdom>
<wisdom_float>none</wisdom_float>
<delta_t>0.01</delta_t> <delta_t>0.01</delta_t>
<delta_B>0.5</delta_B> <delta_B>0.5</delta_B>
<VortexLattice> <VortexLattice>
<N_VortexGrid>512</N_VortexGrid> <N_VortexGrid>512</N_VortexGrid>
</VortexLattice> </VortexLattice>
<LFRelaxation>
<delta_t_LF>0.00004</delta_t_LF>
<N_LF>524288</N_LF>
</LFRelaxation>
<LEM> <LEM>
<data_path>profiles/TestProfile-</data_path> <data_path>profiles/TestProfile-</data_path>
<N_theory>5000</N_theory> <N_theory>5000</N_theory>
@ -55,4 +67,4 @@
<energy>24.0</energy> <energy>24.0</energy>
</energy_list> </energy_list>
</LEM> </LEM>
</TFitPofB> </BMW>

View File

@ -17,7 +17,7 @@ asymmetry fun1
dynExpKTLF fun3 4 5 (frequency damping hopping-rate) dynExpKTLF fun3 4 5 (frequency damping hopping-rate)
+ +
asymmetry fun2 asymmetry fun2
userFcn libLFRelaxation TLFDynLorKT fun3 4 5 userFcn libLFRelaxation TLFDynExpKT fun3 4 5
############################################################### ###############################################################
FUNCTIONS FUNCTIONS