added the option to split a user function into a global and run-block related part (see MUSR-134)

This commit is contained in:
nemu 2010-11-10 13:13:00 +00:00
parent c4dfc3cbce
commit f4d6e349fe
41 changed files with 2401 additions and 161 deletions

View File

@ -4,6 +4,12 @@
# $Id$ # $Id$
#--------------------------------------------------------------------- #---------------------------------------------------------------------
musrfit 0.8.0 - changes since 0.7.0
NEW added the option to split a user function into a global and run-block related part (see MUSR-134). If the
global option is used, this can potentially increase the efficiency up to the number of run-blocks since
the time consuming calculations are done only once per changed parameter set. Examples where this approach
is profitable are: Abrikosov vortex lattice fits, Nonlocal Meissner screening.
musrfit 0.7.0 - changes since 0.6.0 musrfit 0.7.0 - changes since 0.6.0
=================================== ===================================
NEW added y-range option to usr_fit_ranges in the PLOT block (MUSR-144). NEW added y-range option to usr_fit_ranges in the PLOT block (MUSR-144).

View File

@ -1,5 +1,5 @@
AC_PREREQ(2.59) AC_PREREQ(2.59)
AC_INIT(musrfit, 0.7.0, andreas.suter@psi.ch) AC_INIT(musrfit, 0.8.0, andreas.suter@psi.ch)
AC_CONFIG_AUX_DIR(admin) AC_CONFIG_AUX_DIR(admin)
AC_CANONICAL_HOST AC_CANONICAL_HOST
#AC_MSG_RESULT([${host} ${host_cpu} ${host_vendor} ${host_os}]) #AC_MSG_RESULT([${host} ${host_cpu} ${host_vendor} ${host_os}])
@ -28,7 +28,7 @@ dnl -----------------------------------------------
#release versioning #release versioning
MUSR_MAJOR_VERSION=0 MUSR_MAJOR_VERSION=0
MUSR_MINOR_VERSION=7 MUSR_MINOR_VERSION=8
MUSR_MICRO_VERSION=0 MUSR_MICRO_VERSION=0
#release versioning #release versioning
@ -81,7 +81,7 @@ PLUGIN_LIBRARY_VERSION=1:0:0
LEM_LIBRARY_VERSION=1:5:0 LEM_LIBRARY_VERSION=1:5:0
PSIBIN_LIBRARY_VERSION=0:1:0 PSIBIN_LIBRARY_VERSION=0:1:0
MUD_LIBRARY_VERSION=0:0:0 MUD_LIBRARY_VERSION=0:0:0
MUSR_LIBRARY_VERSION=0:7:0 MUSR_LIBRARY_VERSION=0:8:0
# | | | # | | |
# +------+ | +---+ # +------+ | +---+
# | | | # | | |

View File

@ -30,6 +30,7 @@
***************************************************************************/ ***************************************************************************/
#include <iostream> #include <iostream>
#include <vector>
using namespace std; using namespace std;
#include <TObject.h> #include <TObject.h>
@ -48,6 +49,8 @@ using namespace std;
#define SQRT_TWO 1.41421356237 #define SQRT_TWO 1.41421356237
#define SQRT_PI 1.77245385091 #define SQRT_PI 1.77245385091
extern vector<void*> gGlobalUserFcn;
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
// Constructor // Constructor
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
@ -90,7 +93,7 @@ using namespace std;
* false (default) means this is the root object * false (default) means this is the root object
* true means this is part of an already existing object tree * true means this is part of an already existing object tree
*/ */
PTheory::PTheory(PMsrHandler *msrInfo, UInt_t runNo, const Bool_t hasParent) PTheory::PTheory(PMsrHandler *msrInfo, UInt_t runNo, const Bool_t hasParent) : fMsrInfo(msrInfo)
{ {
// init stuff // init stuff
fValid = true; fValid = true;
@ -112,6 +115,9 @@ PTheory::PTheory(PMsrHandler *msrInfo, UInt_t runNo, const Bool_t hasParent)
for (UInt_t i=0; i<THEORY_MAX_PARAM; i++) for (UInt_t i=0; i<THEORY_MAX_PARAM; i++)
fPrevParam[i] = 0.0; fPrevParam[i] = 0.0;
// keep the number of user functions found up to this point
fUserFcnIdx = GetUserFcnIdx(lineNo);
// get the input to be analyzed from the msr handler // get the input to be analyzed from the msr handler
PMsrLines *fullTheoryBlock = msrInfo->GetMsrTheory(); PMsrLines *fullTheoryBlock = msrInfo->GetMsrTheory();
if (lineNo > fullTheoryBlock->size()-1) { if (lineNo > fullTheoryBlock->size()-1) {
@ -139,8 +145,8 @@ PTheory::PTheory(PMsrHandler *msrInfo, UInt_t runNo, const Bool_t hasParent)
tokens = str.Tokenize(" \t"); tokens = str.Tokenize(" \t");
if (!tokens) { if (!tokens) {
cerr << endl << "**SEVERE ERROR**: PTheory(): Couldn't tokenize theory block line " << line->fLineNo << "."; cerr << endl << ">> PTheory::PTheory: **SEVERE ERROR** Couldn't tokenize theory block line " << line->fLineNo << ".";
cerr << endl << " line content: " << line->fLine.Data(); cerr << endl << ">> line content: " << line->fLine.Data();
cerr << endl; cerr << endl;
exit(0); exit(0);
} }
@ -152,8 +158,8 @@ PTheory::PTheory(PMsrHandler *msrInfo, UInt_t runNo, const Bool_t hasParent)
// function found is not defined // function found is not defined
if (idx == (UInt_t) THEORY_UNDEFINED) { if (idx == (UInt_t) THEORY_UNDEFINED) {
cerr << endl << "**ERROR**: PTheory(): Theory line '" << line->fLine.Data() << "'"; cerr << endl << ">> PTheory::PTheory: **ERROR** Theory line '" << line->fLine.Data() << "'";
cerr << endl << " in line no " << line->fLineNo << " is undefined!"; cerr << endl << ">> in line no " << line->fLineNo << " is undefined!";
cerr << endl; cerr << endl;
fValid = false; fValid = false;
return; return;
@ -162,9 +168,9 @@ PTheory::PTheory(PMsrHandler *msrInfo, UInt_t runNo, const Bool_t hasParent)
// line is a valid function, hence analyze parameters // line is a valid function, hence analyze parameters
if (((UInt_t)(tokens->GetEntries()-1) < fNoOfParam) && if (((UInt_t)(tokens->GetEntries()-1) < fNoOfParam) &&
((idx != THEORY_USER_FCN) && (idx != THEORY_POLYNOM))) { ((idx != THEORY_USER_FCN) && (idx != THEORY_POLYNOM))) {
cerr << endl << "**ERROR**: PTheory(): Theory line '" << line->fLine.Data() << "'"; cerr << endl << ">> PTheory::PTheory: **ERROR** Theory line '" << line->fLine.Data() << "'";
cerr << endl << " in line no " << line->fLineNo; cerr << endl << ">> in line no " << line->fLineNo;
cerr << endl << " expecting " << fgTheoDataBase[idx].fNoOfParam << ", but found " << tokens->GetEntries()-1; cerr << endl << ">> expecting " << fgTheoDataBase[idx].fNoOfParam << ", but found " << tokens->GetEntries()-1;
cerr << endl; cerr << endl;
fValid = false; fValid = false;
} }
@ -199,12 +205,12 @@ PTheory::PTheory(PMsrHandler *msrInfo, UInt_t runNo, const Bool_t hasParent)
if ((value <= maps.size()) && (value > 0)) { // everything fine if ((value <= maps.size()) && (value > 0)) { // everything fine
fParamNo.push_back(maps[value-1]-1); fParamNo.push_back(maps[value-1]-1);
} else { // map index out of range } else { // map index out of range
cerr << endl << "**ERROR**: PTheory: map index " << value << " out of range! See line no " << line->fLineNo; cerr << endl << ">> PTheory::PTheory: **ERROR** map index " << value << " out of range! See line no " << line->fLineNo;
cerr << endl; cerr << endl;
fValid = false; fValid = false;
} }
} else { // something wrong } else { // something wrong
cerr << endl << "**ERROR**: PTheory: map '" << str.Data() << "' not allowed. See line no " << line->fLineNo; cerr << endl << ">> PTheory::PTheory: **ERROR**: map '" << str.Data() << "' not allowed. See line no " << line->fLineNo;
cerr << endl; cerr << endl;
fValid = false; fValid = false;
} }
@ -226,7 +232,7 @@ PTheory::PTheory(PMsrHandler *msrInfo, UInt_t runNo, const Bool_t hasParent)
} }
// check if one of the valid entries was found // check if one of the valid entries was found
if (!ok) { if (!ok) {
cerr << endl << "**ERROR**: PTheory: '" << str.Data() << "' not allowed. See line no " << line->fLineNo; cerr << endl << ">> PTheory::PTheory: **ERROR** '" << str.Data() << "' not allowed. See line no " << line->fLineNo;
cerr << endl; cerr << endl;
fValid = false; fValid = false;
} }
@ -264,9 +270,9 @@ PTheory::PTheory(PMsrHandler *msrInfo, UInt_t runNo, const Bool_t hasParent)
cout << endl << ">> user function class name: " << fUserFcnClassName.Data() << endl; cout << endl << ">> user function class name: " << fUserFcnClassName.Data() << endl;
if (!TClass::GetDict(fUserFcnClassName.Data())) { if (!TClass::GetDict(fUserFcnClassName.Data())) {
if (gSystem->Load(fUserFcnSharedLibName.Data()) < 0) { if (gSystem->Load(fUserFcnSharedLibName.Data()) < 0) {
cerr << endl << "**ERROR**: PTheory: user function class '" << fUserFcnClassName.Data() << "' not found."; cerr << endl << ">> PTheory::PTheory: **ERROR** user function class '" << fUserFcnClassName.Data() << "' not found.";
cerr << endl << " Tried to load " << fUserFcnSharedLibName.Data() << " but failed."; cerr << endl << ">> Tried to load " << fUserFcnSharedLibName.Data() << " but failed.";
cerr << endl << " See line no " << line->fLineNo; cerr << endl << ">> See line no " << line->fLineNo;
cerr << endl; cerr << endl;
fValid = false; fValid = false;
// clean up // clean up
@ -277,15 +283,28 @@ PTheory::PTheory(PMsrHandler *msrInfo, UInt_t runNo, const Bool_t hasParent)
return; return;
} }
} }
// invoke user function object // invoke user function object
fUserFcn = 0; fUserFcn = 0;
fUserFcn = (PUserFcnBase*)TClass::GetClass(fUserFcnClassName.Data())->New(); fUserFcn = (PUserFcnBase*)TClass::GetClass(fUserFcnClassName.Data())->New();
if (fUserFcn == 0) { if (fUserFcn == 0) {
cerr << endl << "**ERROR**: PTheory: user function object could not be invoked. See line no " << line->fLineNo; cerr << endl << ">> PTheory::PTheory: **ERROR** user function object could not be invoked. See line no " << line->fLineNo;
cerr << endl; cerr << endl;
fValid = false; fValid = false;
} else { // user function valid, hence expand the fUserParam vector to the proper size } else { // user function valid, hence expand the fUserParam vector to the proper size
fUserParam.resize(fParamNo.size()); fUserParam.resize(fParamNo.size());
}
//cout << endl << "debug> fUserFcn=" << fUserFcn << ", fUserFcn->NeedGlobalPart()=" << fUserFcn->NeedGlobalPart() << ", gGlobalUserFcn=" << gGlobalUserFcn << endl;
// check if the global part of the user function is needed
if (fUserFcn->NeedGlobalPart()) {
fUserFcn->SetGlobalPart(gGlobalUserFcn, fUserFcnIdx); // invoke or retrieve global user function object
if (!fUserFcn->GlobalPartIsValid()) {
cerr << endl << ">> PTheory::PTheory: **ERROR** global user function object could not be invoked/retrived. See line no " << line->fLineNo;
cerr << endl;
fValid = false;
}
} }
} }
@ -317,6 +336,8 @@ PTheory::~PTheory()
delete fUserFcn; delete fUserFcn;
fUserFcn = 0; fUserFcn = 0;
} }
gGlobalUserFcn.clear();
} }
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
@ -451,7 +472,7 @@ Double_t PTheory::Func(register Double_t t, const PDoubleVector& paramValues, co
fAdd->Func(t, paramValues, funcValues); fAdd->Func(t, paramValues, funcValues);
break; break;
default: default:
cerr << endl << "**PANIC ERROR**: PTheory::Func: You never should have reached this line?!?! (" << fType << ")"; cerr << endl << ">> PTheory::Func: **PANIC ERROR** You never should have reached this line?!?! (" << fType << ")";
cerr << endl; cerr << endl;
exit(0); exit(0);
} }
@ -521,7 +542,7 @@ Double_t PTheory::Func(register Double_t t, const PDoubleVector& paramValues, co
return UserFcn(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues); return UserFcn(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
break; break;
default: default:
cerr << endl << "**PANIC ERROR**: PTheory::Func: You never should have reached this line?!?! (" << fType << ")"; cerr << endl << ">> PTheory::Func: **PANIC ERROR** You never should have reached this line?!?! (" << fType << ")";
cerr << endl; cerr << endl;
exit(0); exit(0);
} }
@ -593,7 +614,7 @@ Double_t PTheory::Func(register Double_t t, const PDoubleVector& paramValues, co
return UserFcn(t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues); return UserFcn(t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
break; break;
default: default:
cerr << endl << "**PANIC ERROR**: PTheory::Func: You never should have reached this line?!?! (" << fType << ")"; cerr << endl << ">> PTheory::Func: **PANIC ERROR** You never should have reached this line?!?! (" << fType << ")";
cerr << endl; cerr << endl;
exit(0); exit(0);
} }
@ -663,7 +684,7 @@ Double_t PTheory::Func(register Double_t t, const PDoubleVector& paramValues, co
return UserFcn(t, paramValues, funcValues); return UserFcn(t, paramValues, funcValues);
break; break;
default: default:
cerr << endl << "**PANIC ERROR**: PTheory::Func: You never should have reached this line?!?! (" << fType << ")"; cerr << endl << ">> PTheory::Func: **PANIC ERROR** You never should have reached this line?!?! (" << fType << ")";
cerr << endl; cerr << endl;
exit(0); exit(0);
} }
@ -731,6 +752,36 @@ Int_t PTheory::SearchDataBase(TString name)
return idx; return idx;
} }
//--------------------------------------------------------------------------
// GetUserFcnIdx (private)
//--------------------------------------------------------------------------
/**
* <p>Counts the number of user functions in the theory block up to lineNo.
*
* <b>return:</b> to number of user functions found up to lineNo
*
* \param lineNo current line number in the theory block
*/
Int_t PTheory::GetUserFcnIdx(UInt_t lineNo) const
{
Int_t userFcnIdx = -1;
// retrieve the theory block from the msr-file handler
PMsrLines *fullTheoryBlock = fMsrInfo->GetMsrTheory();
// make sure that lineNo is within proper bounds
if (lineNo > fullTheoryBlock->size())
return userFcnIdx;
// count the number of user function present up to the lineNo
for (UInt_t i=1; i<=lineNo; i++) {
if (fullTheoryBlock->at(i).fLine.Contains("userFcn", TString::kIgnoreCase))
userFcnIdx++;
}
return userFcnIdx;
}
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
// MakeCleanAndTidyTheoryBlock private // MakeCleanAndTidyTheoryBlock private
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
@ -2232,7 +2283,7 @@ void PTheory::CalculateDynKTLF(const Double_t *val, Int_t tag) const
CalculateLorentzLFIntegral(val); CalculateLorentzLFIntegral(val);
break; break;
default: default:
cerr << endl << "**FATAL ERROR** in PTheory::CalculateDynKTLF: You should never have reached this point." << endl; cerr << endl << ">> PTheory::CalculateDynKTLF: **FATAL ERROR** You should never have reached this point." << endl;
assert(false); assert(false);
break; break;
} }

View File

@ -29,6 +29,9 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#include <vector>
using namespace std;
#include "PUserFcnBase.h" #include "PUserFcnBase.h"
ClassImp(PUserFcnBase) ClassImp(PUserFcnBase)
@ -52,3 +55,6 @@ PUserFcnBase::PUserFcnBase()
PUserFcnBase::~PUserFcnBase() PUserFcnBase::~PUserFcnBase()
{ {
} }
// place a void pointer vector for global user function objects which might be needed
vector<void *> gGlobalUserFcn;

View File

@ -43,7 +43,7 @@ using namespace std;
#define GAMMA_MU 0.0851615503527 #define GAMMA_MU 0.0851615503527
#define DEGREE2RAD 0.0174532925199 #define DEGREE2RAD 0.0174532925199
ClassImp(PNL_PippardFitter) ClassImp(PNL_PippardFitterGlobal)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
// Constructor // Constructor
@ -51,8 +51,12 @@ ClassImp(PNL_PippardFitter)
/** /**
* *
*/ */
PNL_PippardFitter::PNL_PippardFitter() PNL_PippardFitterGlobal::PNL_PippardFitterGlobal()
{ {
fValid = true;
fStartupHandler = 0;
fRgeHandler = 0;
// read XML startup file // read XML startup file
char startup_path_name[128]; char startup_path_name[128];
TSAXParser *saxParser = new TSAXParser(); TSAXParser *saxParser = new TSAXParser();
@ -62,18 +66,9 @@ PNL_PippardFitter::PNL_PippardFitter()
Int_t status = saxParser->ParseFile(startup_path_name); Int_t status = saxParser->ParseFile(startup_path_name);
// check for parse errors // check for parse errors
if (status) { // error if (status) { // error
cout << endl << "**WARNING** reading/parsing nonlocal_startup.xml."; cout << endl << ">> PNL_PippardFitterGlobal::PNL_PippardFitterGlobal: **WARNING** reading/parsing nonlocal_startup.xml.";
cout << endl; cout << endl;
// clean up fValid = false;
if (saxParser) {
delete saxParser;
saxParser = 0;
}
if (fStartupHandler) {
delete fStartupHandler;
fStartupHandler = 0;
}
assert(false);
} }
// clean up // clean up
@ -84,21 +79,21 @@ PNL_PippardFitter::PNL_PippardFitter()
// check if everything went fine with the startup handler // check if everything went fine with the startup handler
if (!fStartupHandler->IsValid()) { if (!fStartupHandler->IsValid()) {
cout << endl << "PNL_PippardFitter::PNL_PippardFitter **PANIC ERROR**"; cout << endl << ">> PNL_PippardFitterGlobal::PNL_PippardFitterGlobal **PANIC ERROR**";
cout << endl << " startup handler too unhappy. Will terminate unfriendly, sorry."; cout << endl << ">> startup handler too unhappy. Will terminate unfriendly, sorry.";
cout << endl; cout << endl;
assert(false); fValid = false;
} }
fFourierPoints = fStartupHandler->GetFourierPoints(); fFourierPoints = fStartupHandler->GetFourierPoints();
// load all the TRIM.SP rge-files // load all the TRIM.SP rge-files
fRgeHandler = new PNL_RgeHandler(fStartupHandler->GetTrimSpDataPathList()); fRgeHandler = new PNL_RgeHandler(fStartupHandler->GetTrimSpDataPathList(), fStartupHandler->GetTrimSpDataVectorList());
if (!fRgeHandler->IsValid()) { if (!fRgeHandler->IsValid()) {
cout << endl << "PNL_PippardFitter::PNL_PippardFitter **PANIC ERROR**"; cout << endl << ">> PNL_PippardFitterGlobal::PNL_PippardFitterGlobal **PANIC ERROR**";
cout << endl << " rge data handler too unhappy. Will terminate unfriendly, sorry."; cout << endl << ">> rge data handler too unhappy. Will terminate unfriendly, sorry.";
cout << endl; cout << endl;
assert(false); fValid = false;
} }
fPlanPresent = false; fPlanPresent = false;
@ -115,7 +110,7 @@ PNL_PippardFitter::PNL_PippardFitter()
/** /**
* *
*/ */
PNL_PippardFitter::~PNL_PippardFitter() PNL_PippardFitterGlobal::~PNL_PippardFitterGlobal()
{ {
fPreviousParam.clear(); fPreviousParam.clear();
@ -136,107 +131,45 @@ PNL_PippardFitter::~PNL_PippardFitter()
delete fRgeHandler; delete fRgeHandler;
fRgeHandler = 0; fRgeHandler = 0;
} }
/*
if (fStartupHandler) { if (fStartupHandler) {
delete fStartupHandler; delete fStartupHandler;
fStartupHandler = 0; fStartupHandler = 0;
} }
*/
} }
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
// operator() // CalculateField (public)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* *
*/ */
Double_t PNL_PippardFitter::operator()(Double_t t, const std::vector<Double_t> &param) const void PNL_PippardFitterGlobal::CalculateField(const std::vector<Double_t> &param) const
{ {
// param: [0] energy, [1] temp, [2] thickness, [3] meanFreePath, [4] xi0, [5] lambdaL, [6] Bext, [7] phase, [8] dead-layer // param: [0] energy, [1] temp, [2] thickness, [3] meanFreePath, [4] xi0, [5] lambdaL, [6] Bext, [7] phase, [8] dead-layer
assert(param.size() == 9);
// for negative time return polarization == 1 // check that param are new and hence a calculation is needed
if (t <= 0.0) Bool_t newParams = false;
return 1.0;
// calculate field if parameter have changed
if (NewParameters(param)) { // new parameters, hence B(z), P(t), ..., needs to be calculated
// keep parameters
for (UInt_t i=0; i<param.size(); i++)
fPreviousParam[i] = param[i];
fEnergyIndex = fRgeHandler->GetRgeEnergyIndex(param[0]);
CalculateField(param);
}
// calcualte polarization
Bool_t done = false;
Double_t pol = 0.0, dPol = 0.0;
Double_t z=0.0;
Int_t terminate = 0;
Double_t dz = 1.0;
do {
if (z < param[8]) { // z < dead-layer
dPol = fRgeHandler->GetRgeValue(fEnergyIndex, z) * cos(GAMMA_MU * param[6] * t + param[7] * DEGREE2RAD);;
} else {
dPol = fRgeHandler->GetRgeValue(fEnergyIndex, z) * cos(GAMMA_MU * param[6] * GetMagneticField(z-param[8]) * t + param[7] * DEGREE2RAD);
}
z += dz;
pol += dPol;
// change in polarization is very small hence start termination counting
if (fabs(dPol) < 1.0e-7) {
terminate++;
} else {
terminate = 0;
}
if (terminate > 10) // polarization died out hence one can stop
done = true;
} while (!done);
// cout << endl << "t = " << t << ", pol = " << pol*dz;
return pol*dz;
}
//--------------------------------------------------------------------------
// NewParameters
//--------------------------------------------------------------------------
/**
*
*/
Bool_t PNL_PippardFitter::NewParameters(const std::vector<Double_t> &param) const
{
if (fPreviousParam.size() == 0) { if (fPreviousParam.size() == 0) {
for (UInt_t i=0; i<param.size(); i++) for (UInt_t i=0; i<param.size(); i++)
fPreviousParam.push_back(param[i]); fPreviousParam.push_back(param[i]);
return true; newParams = true;
} } else {
assert(param.size() == fPreviousParam.size());
assert(param.size() == fPreviousParam.size()); for (UInt_t i=0; i<param.size(); i++) {
if (param[i] != fPreviousParam[i]) {
Bool_t result = false; newParams = true;
break;
for (UInt_t i=0; i<param.size(); i++) { }
if (param[i] != fPreviousParam[i]) {
result = true;
break;
} }
} }
return result; if (!newParams)
} return;
//-------------------------------------------------------------------------- // keep parameters
// CalculateField for (UInt_t i=0; i<param.size(); i++)
//-------------------------------------------------------------------------- fPreviousParam[i] = param[i];
/**
*
*/
void PNL_PippardFitter::CalculateField(const std::vector<Double_t> &param) const
{
// param: [0] energy, [1] temp, [2] thickness, [3] meanFreePath, [4] xi0, [5] lambdaL, [6] Bext, [7] phase, [8] dead-layer
//cout << endl << "in CalculateField ..." << endl; //cout << endl << "in CalculateField ..." << endl;
//cout << endl << "fFourierPoints = " << fFourierPoints; //cout << endl << "fFourierPoints = " << fFourierPoints;
@ -324,7 +257,7 @@ void PNL_PippardFitter::CalculateField(const std::vector<Double_t> &param) const
/** /**
* *
*/ */
Double_t PNL_PippardFitter::GetMagneticField(const Double_t z) const Double_t PNL_PippardFitterGlobal::GetMagneticField(const Double_t z) const
{ {
Double_t result = -1.0; Double_t result = -1.0;
@ -350,7 +283,7 @@ Double_t PNL_PippardFitter::GetMagneticField(const Double_t z) const
/** /**
* *
*/ */
Double_t PNL_PippardFitter::DeltaBCS(const Double_t t) const Double_t PNL_PippardFitterGlobal::DeltaBCS(const Double_t t) const
{ {
Double_t result = 0.0; Double_t result = 0.0;
@ -392,7 +325,7 @@ Double_t PNL_PippardFitter::DeltaBCS(const Double_t t) const
/** /**
* *
*/ */
Double_t PNL_PippardFitter::LambdaL_T(const Double_t lambdaL, const Double_t t) const Double_t PNL_PippardFitterGlobal::LambdaL_T(const Double_t lambdaL, const Double_t t) const
{ {
return lambdaL/sqrt(1.0-pow(t,4.0)); return lambdaL/sqrt(1.0-pow(t,4.0));
} }
@ -404,7 +337,7 @@ Double_t PNL_PippardFitter::LambdaL_T(const Double_t lambdaL, const Double_t t)
* <p> Approximated xi_P(T). The main approximation is that (lamdaL(T)/lambdaL(0))^2 = 1/(1-t^2). This way * <p> Approximated xi_P(T). The main approximation is that (lamdaL(T)/lambdaL(0))^2 = 1/(1-t^2). This way
* xi_P(T) is close the the BCS xi_BCS(T). * xi_P(T) is close the the BCS xi_BCS(T).
*/ */
Double_t PNL_PippardFitter::XiP_T(const Double_t xi0, const Double_t meanFreePath, Double_t t) const Double_t PNL_PippardFitterGlobal::XiP_T(const Double_t xi0, const Double_t meanFreePath, Double_t t) const
{ {
if (t>0.96) if (t>0.96)
t=0.96; t=0.96;
@ -413,3 +346,134 @@ Double_t PNL_PippardFitter::XiP_T(const Double_t xi0, const Double_t meanFreePat
return xi0*meanFreePath/(meanFreePath*J0T+xi0); return xi0*meanFreePath/(meanFreePath*J0T+xi0);
} }
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ClassImp(PNL_PippardFitter)
//--------------------------------------------------------------------------
// Constructor
//--------------------------------------------------------------------------
/**
*
*/
PNL_PippardFitter::PNL_PippardFitter()
{
fValid = false;
fInvokedGlobal = false;
fPippardFitterGlobal = 0;
}
//--------------------------------------------------------------------------
// Destructor
//--------------------------------------------------------------------------
/**
*
*/
PNL_PippardFitter::~PNL_PippardFitter()
{
if ((fPippardFitterGlobal != 0) && fInvokedGlobal) {
delete fPippardFitterGlobal;
fPippardFitterGlobal = 0;
// cout << endl << "debug> in PNL_PippardFitter::~PNL_PippardFitter(), fPippardFitterGlobal deleted." << endl;
}
}
//--------------------------------------------------------------------------
// SetGlobalPart (public)
//--------------------------------------------------------------------------
/**
* <p>
*
* <b>return:</b>
*
* \param globalPart
* \param idx
*/
void PNL_PippardFitter::SetGlobalPart(vector<void*> &globalPart, UInt_t idx)
{
fIdxGlobal = static_cast<Int_t>(idx);
if ((Int_t)globalPart.size() <= fIdxGlobal) {
fPippardFitterGlobal = new PNL_PippardFitterGlobal();
if (fPippardFitterGlobal == 0) {
fValid = false;
cerr << endl << ">> PNL_PippardFitter::SetGlobalPart(): **ERROR** Couldn't invoke global user function object, sorry ..." << endl;
} else if (!fPippardFitterGlobal->IsValid()) {
fValid = false;
cerr << endl << ">> PNL_PippardFitter::SetGlobalPart(): **ERROR** initialization of global user function object failed, sorry ..." << endl;
} else {
fValid = true;
fInvokedGlobal = true;
globalPart.resize(fIdxGlobal+1);
globalPart[fIdxGlobal] = dynamic_cast<PNL_PippardFitterGlobal*>(fPippardFitterGlobal);
// cout << endl << ">> debug> PNL_PippardFitter::SetGlobalPart(): invoked global user function object, fPippardFitterGlobal = " << fPippardFitterGlobal << ", fInvokedGlobal=" << fInvokedGlobal;
}
} else {
fValid = true;
fPippardFitterGlobal = (PNL_PippardFitterGlobal*)globalPart[fIdxGlobal];
}
}
//--------------------------------------------------------------------------
// GlobalPartIsValid (public)
//--------------------------------------------------------------------------
/**
* <p>
*
* <b>return:</b>
*/
Bool_t PNL_PippardFitter::GlobalPartIsValid() const
{
// cout << endl << "debug> PNL_PippardFitter::GlobalPartIsValid(): fValid=" << fValid << ", fGlobalUserFcn->IsValid()=" << fPippardFitterGlobal->IsValid() << endl;
return (fValid && fPippardFitterGlobal->IsValid());
}
//--------------------------------------------------------------------------
// operator()
//--------------------------------------------------------------------------
/**
*
*/
Double_t PNL_PippardFitter::operator()(Double_t t, const std::vector<Double_t> &param) const
{
// param: [0] energy, [1] temp, [2] thickness, [3] meanFreePath, [4] xi0, [5] lambdaL, [6] Bext, [7] phase, [8] dead-layer
assert(param.size() == 9);
// for negative time return polarization == 1
if (t <= 0.0)
return 1.0;
// calculate field if parameter have changed
fPippardFitterGlobal->CalculateField(param);
Int_t energyIndex = fPippardFitterGlobal->GetEnergyIndex(param[0]);
// calcualte polarization
Bool_t done = false;
Double_t pol = 0.0, dPol = 0.0;
Double_t z=0.0;
Int_t terminate = 0;
Double_t dz = 1.0;
do {
if (z < param[8]) { // z < dead-layer
dPol = fPippardFitterGlobal->GetMuoneStoppingDensity(energyIndex, z) * cos(GAMMA_MU * param[6] * t + param[7] * DEGREE2RAD);
} else {
dPol = fPippardFitterGlobal->GetMuoneStoppingDensity(energyIndex, z) * cos(GAMMA_MU * param[6] * fPippardFitterGlobal->GetMagneticField(z-param[8]) * t + param[7] * DEGREE2RAD);
}
z += dz;
pol += dPol;
// change in polarization is very small hence start termination counting
if (fabs(dPol) < 1.0e-9) {
terminate++;
} else {
terminate = 0;
}
if (terminate > 10) // polarization died out hence one can stop
done = true;
} while (!done);
return pol*dz;
}

View File

@ -38,15 +38,21 @@
#include "PNL_StartupHandler.h" #include "PNL_StartupHandler.h"
#include "PNL_RgeHandler.h" #include "PNL_RgeHandler.h"
class PNL_PippardFitter : public PUserFcnBase class PNL_PippardFitterGlobal
{ {
public: public:
PNL_PippardFitter(); PNL_PippardFitterGlobal();
virtual ~PNL_PippardFitter(); virtual ~PNL_PippardFitterGlobal();
virtual Double_t operator()(Double_t t, const std::vector<Double_t> &param) const; Bool_t IsValid() { return fValid; }
virtual void CalculateField(const std::vector<Double_t> &param) const;
virtual Int_t GetEnergyIndex(const Double_t energy) { return fRgeHandler->GetRgeEnergyIndex(energy); }
virtual Double_t GetMuoneStoppingDensity(const Int_t energyIndex, const Double_t z) const { return fRgeHandler->GetRgeValue(energyIndex, z); }
virtual Double_t GetMagneticField(const Double_t z) const;
private: private:
Bool_t fValid;
PNL_StartupHandler *fStartupHandler; PNL_StartupHandler *fStartupHandler;
PNL_RgeHandler *fRgeHandler; PNL_RgeHandler *fRgeHandler;
@ -64,14 +70,33 @@ class PNL_PippardFitter : public PUserFcnBase
mutable Int_t fEnergyIndex; // keeps the proper index to select n(z) mutable Int_t fEnergyIndex; // keeps the proper index to select n(z)
virtual Bool_t NewParameters(const std::vector<Double_t> &param) const;
virtual void CalculateField(const std::vector<Double_t> &param) const;
virtual Double_t GetMagneticField(const Double_t z) const;
virtual Double_t DeltaBCS(const Double_t t) const; virtual Double_t DeltaBCS(const Double_t t) const;
virtual Double_t LambdaL_T(const Double_t lambdaL, const Double_t t) const; virtual Double_t LambdaL_T(const Double_t lambdaL, const Double_t t) const;
virtual Double_t XiP_T(const Double_t xi0, const Double_t meanFreePath, Double_t t) const; virtual Double_t XiP_T(const Double_t xi0, const Double_t meanFreePath, Double_t t) const;
ClassDef(PNL_PippardFitterGlobal, 1)
};
class PNL_PippardFitter : public PUserFcnBase
{
public:
PNL_PippardFitter();
virtual ~PNL_PippardFitter();
virtual Bool_t NeedGlobalPart() const { return true; }
virtual void SetGlobalPart(vector<void*> &globalPart, UInt_t idx);
virtual Bool_t GlobalPartIsValid() const;
virtual Double_t operator()(Double_t t, const std::vector<Double_t> &param) const;
private:
Bool_t fValid;
Bool_t fInvokedGlobal;
Int_t fIdxGlobal;
PNL_PippardFitterGlobal *fPippardFitterGlobal;
ClassDef(PNL_PippardFitter, 1) ClassDef(PNL_PippardFitter, 1)
}; };

View File

@ -35,6 +35,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 PNL_PippardFitterGlobal+;
#pragma link C++ class PNL_PippardFitter+; #pragma link C++ class PNL_PippardFitter+;
#endif #endif

View File

@ -43,11 +43,11 @@ using namespace std;
/** /**
* *
*/ */
PNL_RgeHandler::PNL_RgeHandler(const PStringVector &rgeDataPathList) PNL_RgeHandler::PNL_RgeHandler(const PStringVector &rgeDataPathList, const PDoubleVector &rgeDataEnergyList)
{ {
fIsValid = false; fIsValid = false;
fIsValid = LoadRgeData(rgeDataPathList); fIsValid = LoadRgeData(rgeDataPathList, rgeDataEnergyList);
} }
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
@ -146,7 +146,7 @@ Double_t PNL_RgeHandler::GetRgeValue(const Double_t energy, const Double_t dist)
/** /**
* *
*/ */
Bool_t PNL_RgeHandler::LoadRgeData(const PStringVector &rgeDataPathList) Bool_t PNL_RgeHandler::LoadRgeData(const PStringVector &rgeDataPathList, const PDoubleVector &rgeDataEnergyList)
{ {
ifstream fin; ifstream fin;
PNL_RgeData data; PNL_RgeData data;
@ -166,17 +166,8 @@ Bool_t PNL_RgeHandler::LoadRgeData(const PStringVector &rgeDataPathList)
return false; return false;
} }
// extract energy from rgeDataPathList name // keep energy (in keV)
dataName = rgeDataPathList[i]; data.energy = rgeDataEnergyList[i]/1000.0;
// remove rge extension
dataName.Remove(dataName.Length()-4, 4);
// get energy part
dataName.Replace(0, dataName.Length()-3, "");
if (!dataName.IsDigit()) {
fin.close();
return false;
}
data.energy = dataName.Atof()/10.0;
// read msr-file // read msr-file
idx = 0; idx = 0;

View File

@ -37,7 +37,7 @@
class PNL_RgeHandler class PNL_RgeHandler
{ {
public: public:
PNL_RgeHandler(const PStringVector &rgeDataPathList); PNL_RgeHandler(const PStringVector &rgeDataPathList, const PDoubleVector &rgeDataEnergyList);
virtual ~PNL_RgeHandler(); virtual ~PNL_RgeHandler();
virtual Bool_t IsValid() { return fIsValid; } virtual Bool_t IsValid() { return fIsValid; }
@ -49,7 +49,7 @@ class PNL_RgeHandler
Bool_t fIsValid; Bool_t fIsValid;
PNL_RgeDataList fRgeDataList; PNL_RgeDataList fRgeDataList;
virtual Bool_t LoadRgeData(const PStringVector &rgeDataPathList); virtual Bool_t LoadRgeData(const PStringVector &rgeDataPathList, const PDoubleVector &rgeDataEnergyList);
}; };
#endif // _PNL_RGEHANDLER_H_ #endif // _PNL_RGEHANDLER_H_

View File

@ -64,6 +64,7 @@ PNL_StartupHandler::PNL_StartupHandler()
fStartupFileFound = true; fStartupFileFound = true;
fStartupFilePath = TString(startup_path_name); fStartupFilePath = TString(startup_path_name);
} else { // startup file is not found in the current directory } else { // startup file is not found in the current directory
cout << endl << "PNL_StartupHandler(): **WARNING** Couldn't find nonlocal_startup.xml in the current directory, will try default one." << endl;
strncpy(startup_path_name, "/home/nemu/analysis/musrfit/src/external/Nonlocal/nonlocal_startup.xml", sizeof(startup_path_name)); strncpy(startup_path_name, "/home/nemu/analysis/musrfit/src/external/Nonlocal/nonlocal_startup.xml", sizeof(startup_path_name));
if (StartupFileExists(startup_path_name)) { if (StartupFileExists(startup_path_name)) {
fStartupFileFound = true; fStartupFileFound = true;
@ -81,6 +82,7 @@ PNL_StartupHandler::PNL_StartupHandler()
PNL_StartupHandler::~PNL_StartupHandler() PNL_StartupHandler::~PNL_StartupHandler()
{ {
fTrimSpDataPathList.clear(); fTrimSpDataPathList.clear();
fTrimSpDataEnergyList.clear();
} }
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
@ -154,8 +156,6 @@ void PNL_StartupHandler::OnEndElement(const char *str)
void PNL_StartupHandler::OnCharacters(const char *str) void PNL_StartupHandler::OnCharacters(const char *str)
{ {
TString tstr; TString tstr;
Double_t dval;
char sstr[128];
switch (fKey) { switch (fKey) {
case eFourierPoints: case eFourierPoints:
@ -174,18 +174,16 @@ void PNL_StartupHandler::OnCharacters(const char *str)
case eEnergy: case eEnergy:
tstr = str; tstr = str;
if (tstr.IsFloat()) { if (tstr.IsFloat()) {
dval = tstr.Atof(); fTrimSpDataEnergyList.push_back(tstr.Atof());
tstr = fTrimSpDataPath;
tstr += str;
tstr += ".rge";
fTrimSpDataPathList.push_back(tstr);
} else { } else {
cout << endl << "PNL_StartupHandler::OnCharacters: **ERROR** when finding energy:"; cout << endl << "PNL_StartupHandler::OnCharacters: **ERROR** when finding energy:";
cout << endl << "\"" << str << "\" is not a double."; cout << endl << "\"" << str << "\" is not a floating point number, will ignore it and use the default value.";
cout << endl; cout << endl;
fIsValid = false;
} }
tstr = fTrimSpDataPath;
sprintf(sstr, "%03d", (int)(round(dval*10.0)));
tstr += sstr;
tstr += ".rge";
fTrimSpDataPathList.push_back(tstr);
break; break;
default: default:
break; break;

View File

@ -59,6 +59,7 @@ class PNL_StartupHandler : public TObject
virtual TString GetStartupFilePath() { return fStartupFilePath; } virtual TString GetStartupFilePath() { return fStartupFilePath; }
virtual const Int_t GetFourierPoints() const { return fFourierPoints; } virtual const Int_t GetFourierPoints() const { return fFourierPoints; }
virtual const PStringVector GetTrimSpDataPathList() const { return fTrimSpDataPathList; } virtual const PStringVector GetTrimSpDataPathList() const { return fTrimSpDataPathList; }
virtual const PDoubleVector GetTrimSpDataVectorList() const { return fTrimSpDataEnergyList; }
virtual bool StartupFileFound() { return fStartupFileFound; } virtual bool StartupFileFound() { return fStartupFileFound; }
@ -74,6 +75,7 @@ class PNL_StartupHandler : public TObject
Int_t fFourierPoints; Int_t fFourierPoints;
TString fTrimSpDataPath; TString fTrimSpDataPath;
PStringVector fTrimSpDataPathList; PStringVector fTrimSpDataPathList;
PDoubleVector fTrimSpDataEnergyList;
bool StartupFileExists(char *fln); bool StartupFileExists(char *fln);

View File

@ -46,6 +46,10 @@ public:
TLondon1DHS(); TLondon1DHS();
~TLondon1DHS(); ~TLondon1DHS();
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
@ -75,6 +79,10 @@ public:
TLondon1D1L(); TLondon1D1L();
~TLondon1D1L(); ~TLondon1D1L();
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
@ -106,6 +114,10 @@ public:
TLondon1D2L(); TLondon1D2L();
~TLondon1D2L(); ~TLondon1D2L();
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
@ -136,6 +148,10 @@ public:
TProximity1D1LHS(); TProximity1D1LHS();
~TProximity1D1LHS(); ~TProximity1D1LHS();
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
@ -166,6 +182,10 @@ public:
TLondon1D3L(); TLondon1D3L();
~TLondon1D3L(); ~TLondon1D3L();
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
@ -196,6 +216,10 @@ public:
TLondon1D3LS(); TLondon1D3LS();
~TLondon1D3LS(); ~TLondon1D3LS();
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:

View File

@ -46,6 +46,10 @@ public:
TSkewedGss(); TSkewedGss();
~TSkewedGss(); ~TSkewedGss();
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:

View File

@ -46,6 +46,10 @@ public:
TBulkTriVortexLondon(); TBulkTriVortexLondon();
~TBulkTriVortexLondon(); ~TBulkTriVortexLondon();
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
@ -75,6 +79,10 @@ public:
TBulkSqVortexLondon(); TBulkSqVortexLondon();
~TBulkSqVortexLondon(); ~TBulkSqVortexLondon();
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
@ -104,6 +112,10 @@ public:
TBulkTriVortexML(); TBulkTriVortexML();
~TBulkTriVortexML(); ~TBulkTriVortexML();
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
@ -133,6 +145,10 @@ public:
TBulkTriVortexAGL(); TBulkTriVortexAGL();
~TBulkTriVortexAGL(); ~TBulkTriVortexAGL();
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
@ -162,6 +178,10 @@ public:
TBulkTriVortexNGL(); TBulkTriVortexNGL();
~TBulkTriVortexNGL(); ~TBulkTriVortexNGL();
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:

View File

@ -44,6 +44,10 @@ public:
TBNMR(){} TBNMR(){}
~TBNMR(){} ~TBNMR(){}
Bool_t NeedGlobalPart() const { return false; }
void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
Bool_t GlobalPartIsValid() const { return true; }
// function operator // function operator
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
@ -58,6 +62,10 @@ public:
ExpRlx(){} ExpRlx(){}
~ExpRlx(){} ~ExpRlx(){}
Bool_t NeedGlobalPart() const { return false; }
void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
Bool_t GlobalPartIsValid() const { return true; }
// function operator // function operator
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
@ -72,6 +80,10 @@ public:
SExpRlx(){} SExpRlx(){}
~SExpRlx(){} ~SExpRlx(){}
Bool_t NeedGlobalPart() const { return false; }
void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
Bool_t GlobalPartIsValid() const { return true; }
// function operator // function operator
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;

View File

@ -41,6 +41,10 @@ public:
TMeanFieldsForScHalfSpace(); TMeanFieldsForScHalfSpace();
~TMeanFieldsForScHalfSpace() {delete fImpProfile; fImpProfile = 0;} ~TMeanFieldsForScHalfSpace() {delete fImpProfile; fImpProfile = 0;}
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
double CalcMeanB (double, const TLondon1D_HS&) const; double CalcMeanB (double, const TLondon1D_HS&) const;
@ -57,6 +61,10 @@ public:
TMeanFieldsForScSingleLayer(); TMeanFieldsForScSingleLayer();
~TMeanFieldsForScSingleLayer() {delete fImpProfile; fImpProfile = 0;} ~TMeanFieldsForScSingleLayer() {delete fImpProfile; fImpProfile = 0;}
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
double CalcMeanB (double, const vector<double>&, const vector<double>&, const TLondon1D_1L&) const; double CalcMeanB (double, const vector<double>&, const vector<double>&, const TLondon1D_1L&) const;
@ -73,6 +81,10 @@ public:
TMeanFieldsForScBilayer(); TMeanFieldsForScBilayer();
~TMeanFieldsForScBilayer() {delete fImpProfile; fImpProfile = 0;} ~TMeanFieldsForScBilayer() {delete fImpProfile; fImpProfile = 0;}
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
double CalcMeanB (double, const vector<double>&, const vector<double>&, const TLondon1D_2L&) const; double CalcMeanB (double, const vector<double>&, const vector<double>&, const TLondon1D_2L&) const;
@ -89,6 +101,10 @@ public:
TMeanFieldsForScTrilayer(); TMeanFieldsForScTrilayer();
~TMeanFieldsForScTrilayer() {delete fImpProfile; fImpProfile = 0;} ~TMeanFieldsForScTrilayer() {delete fImpProfile; fImpProfile = 0;}
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
double CalcMeanB (double, const vector<double>&, const vector<double>&, const TLondon1D_3L&) const; double CalcMeanB (double, const vector<double>&, const vector<double>&, const TLondon1D_3L&) const;
@ -105,6 +121,10 @@ public:
TMeanFieldsForScTrilayerWithInsulator(); TMeanFieldsForScTrilayerWithInsulator();
~TMeanFieldsForScTrilayerWithInsulator() {delete fImpProfile; fImpProfile = 0;} ~TMeanFieldsForScTrilayerWithInsulator() {delete fImpProfile; fImpProfile = 0;}
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
double CalcMeanB (double, const vector<double>&, const vector<double>&, const TLondon1D_3LwInsulator&) const; double CalcMeanB (double, const vector<double>&, const vector<double>&, const TLondon1D_3LwInsulator&) const;

View File

@ -46,6 +46,10 @@ public:
TGapSWave(); TGapSWave();
~TGapSWave(); ~TGapSWave();
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
@ -66,6 +70,10 @@ public:
TGapDWave(); TGapDWave();
~TGapDWave(); ~TGapDWave();
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
@ -86,6 +94,10 @@ public:
TGapCosSqDWave(); TGapCosSqDWave();
~TGapCosSqDWave(); ~TGapCosSqDWave();
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
@ -106,6 +118,10 @@ public:
TGapSinSqDWave(); TGapSinSqDWave();
~TGapSinSqDWave(); ~TGapSinSqDWave();
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
@ -127,6 +143,10 @@ public:
TGapAnSWave(); TGapAnSWave();
~TGapAnSWave(); ~TGapAnSWave();
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
@ -147,6 +167,10 @@ public:
TGapNonMonDWave1(); TGapNonMonDWave1();
~TGapNonMonDWave1(); ~TGapNonMonDWave1();
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
@ -167,6 +191,10 @@ public:
TGapNonMonDWave2(); TGapNonMonDWave2();
~TGapNonMonDWave2(); ~TGapNonMonDWave2();
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
@ -188,6 +216,10 @@ public:
TGapPowerLaw() {} TGapPowerLaw() {}
~TGapPowerLaw() {} ~TGapPowerLaw() {}
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
@ -201,6 +233,10 @@ public:
TGapDirtySWave() {} TGapDirtySWave() {}
~TGapDirtySWave() {} ~TGapDirtySWave() {}
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
@ -215,6 +251,10 @@ public:
TLambdaSWave(); TLambdaSWave();
~TLambdaSWave(); ~TLambdaSWave();
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
@ -229,6 +269,10 @@ public:
TLambdaDWave(); TLambdaDWave();
~TLambdaDWave(); ~TLambdaDWave();
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
@ -243,6 +287,10 @@ public:
TLambdaAnSWave(); TLambdaAnSWave();
~TLambdaAnSWave(); ~TLambdaAnSWave();
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
@ -257,6 +305,10 @@ public:
TLambdaNonMonDWave1(); TLambdaNonMonDWave1();
~TLambdaNonMonDWave1(); ~TLambdaNonMonDWave1();
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
@ -271,6 +323,10 @@ public:
TLambdaNonMonDWave2(); TLambdaNonMonDWave2();
~TLambdaNonMonDWave2(); ~TLambdaNonMonDWave2();
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
@ -286,6 +342,10 @@ public:
TLambdaPowerLaw() {} TLambdaPowerLaw() {}
~TLambdaPowerLaw() {} ~TLambdaPowerLaw() {}
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
@ -299,6 +359,10 @@ public:
TLambdaInvSWave(); TLambdaInvSWave();
~TLambdaInvSWave(); ~TLambdaInvSWave();
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
@ -313,6 +377,10 @@ public:
TLambdaInvDWave(); TLambdaInvDWave();
~TLambdaInvDWave(); ~TLambdaInvDWave();
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
@ -327,6 +395,10 @@ public:
TLambdaInvAnSWave(); TLambdaInvAnSWave();
~TLambdaInvAnSWave(); ~TLambdaInvAnSWave();
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
@ -341,6 +413,10 @@ public:
TLambdaInvNonMonDWave1(); TLambdaInvNonMonDWave1();
~TLambdaInvNonMonDWave1(); ~TLambdaInvNonMonDWave1();
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
@ -355,6 +431,10 @@ public:
TLambdaInvNonMonDWave2(); TLambdaInvNonMonDWave2();
~TLambdaInvNonMonDWave2(); ~TLambdaInvNonMonDWave2();
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
@ -370,6 +450,10 @@ public:
TLambdaInvPowerLaw() {} TLambdaInvPowerLaw() {}
~TLambdaInvPowerLaw() {} ~TLambdaInvPowerLaw() {}
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
@ -383,6 +467,10 @@ public:
TFilmMagnetizationDWave(); TFilmMagnetizationDWave();
~TFilmMagnetizationDWave(); ~TFilmMagnetizationDWave();
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
virtual Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:

View File

@ -56,6 +56,10 @@ public:
TLFStatGssKT(); TLFStatGssKT();
~TLFStatGssKT(); ~TLFStatGssKT();
Bool_t NeedGlobalPart() const { return false; }
void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
@ -70,6 +74,10 @@ public:
TLFStatLorKT(); TLFStatLorKT();
~TLFStatLorKT(); ~TLFStatLorKT();
Bool_t NeedGlobalPart() const { return false; }
void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
@ -84,6 +92,10 @@ public:
TLFDynGssKT(); TLFDynGssKT();
~TLFDynGssKT(); ~TLFDynGssKT();
Bool_t NeedGlobalPart() const { return false; }
void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
@ -110,6 +122,10 @@ public:
TLFDynLorKT(); TLFDynLorKT();
~TLFDynLorKT(); ~TLFDynLorKT();
Bool_t NeedGlobalPart() const { return false; }
void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
@ -138,6 +154,10 @@ public:
TLFSGInterpolation(); TLFSGInterpolation();
~TLFSGInterpolation(); ~TLFSGInterpolation();
Bool_t NeedGlobalPart() const { return false; }
void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
Bool_t GlobalPartIsValid() const { return true; }
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:

View File

@ -201,6 +201,7 @@ class PTheory
private: private:
virtual void CleanUp(PTheory *theo); virtual void CleanUp(PTheory *theo);
virtual Int_t SearchDataBase(TString name); virtual Int_t SearchDataBase(TString name);
virtual Int_t GetUserFcnIdx(UInt_t lineNo) const;
virtual void MakeCleanAndTidyTheoryBlock(PMsrLines* fullTheoryBlock); virtual void MakeCleanAndTidyTheoryBlock(PMsrLines* fullTheoryBlock);
virtual void MakeCleanAndTidyPolynom(UInt_t i, PMsrLines* fullTheoryBlock); virtual void MakeCleanAndTidyPolynom(UInt_t i, PMsrLines* fullTheoryBlock);
virtual void MakeCleanAndTidyUserFcn(UInt_t i, PMsrLines* fullTheoryBlock); virtual void MakeCleanAndTidyUserFcn(UInt_t i, PMsrLines* fullTheoryBlock);
@ -240,6 +241,7 @@ class PTheory
UInt_t fNoOfParam; ///< number of parameters for the given function UInt_t fNoOfParam; ///< number of parameters for the given function
PTheory *fAdd, *fMul; ///< pointers to the add-sub-function or the multiply-sub-function PTheory *fAdd, *fMul; ///< pointers to the add-sub-function or the multiply-sub-function
Int_t fUserFcnIdx; ///< index of the user function within the theory tree
TString fUserFcnClassName; ///< name of the user function class for within root TString fUserFcnClassName; ///< name of the user function class for within root
TString fUserFcnSharedLibName; ///< name of the shared lib to which the user function belongs TString fUserFcnSharedLibName; ///< name of the shared lib to which the user function belongs
PUserFcnBase *fUserFcn; ///< pointer to the user function object PUserFcnBase *fUserFcn; ///< pointer to the user function object

View File

@ -33,9 +33,11 @@
#define _PUSERFCNBASE_H_ #define _PUSERFCNBASE_H_
#include <vector> #include <vector>
using namespace std;
#include "TObject.h" #include "TObject.h"
//--------------------------------------------------------------------------------------------
/** /**
* <p>Interface class for the user function. * <p>Interface class for the user function.
*/ */
@ -45,6 +47,10 @@ class PUserFcnBase : public TObject
PUserFcnBase(); PUserFcnBase();
virtual ~PUserFcnBase(); virtual ~PUserFcnBase();
virtual Bool_t NeedGlobalPart() const = 0; ///< if a user function needs a global part this function should return true, otherwise false
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) = 0; ///< if a user function is using a global part, this function is used to invoke and retrieve the proper global object
virtual Bool_t GlobalPartIsValid() const = 0; ///< if a user function is using a global part, this function returns if the global object part is valid
virtual Double_t operator()(Double_t t, const std::vector<Double_t> &param) const = 0; virtual Double_t operator()(Double_t t, const std::vector<Double_t> &param) const = 0;
ClassDef(PUserFcnBase, 1) ClassDef(PUserFcnBase, 1)

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<nonlocal xmlns="http://nemu.web.psi.ch/musrfit/nonlocal">
<comment>
$Id: nonlocal_startup.xml 4047 2009-07-02 13:36:18Z nemu $
</comment>
<nonlocal_par>
<fourier_points>262144</fourier_points>
</nonlocal_par>
<trim_sp_part>
<data_path>profiles/Sn_E</data_path>
<energy_list>
<energy>1000</energy>
<energy>2000</energy>
<energy>4000</energy>
<energy>6000</energy>
<energy>8000</energy>
<energy>10000</energy>
<energy>12000</energy>
<energy>14100</energy>
<energy>18000</energy>
<energy>22000</energy>
<energy>25000</energy>
<energy>27300</energy>
</energy_list>
</trim_sp_part>
</nonlocal>

View File

@ -0,0 +1,63 @@
DEPTH PARTICLES
4. 1094
12. 2457
20. 3130
28. 3821
36. 4153
44. 4406
52. 4581
60. 4679
68. 4829
76. 4832
84. 4636
92. 4435
100. 4199
108. 4001
116. 3697
124. 3299
132. 3075
140. 2601
148. 2388
156. 2053
164. 1802
172. 1471
180. 1142
188. 936
196. 747
204. 590
212. 463
220. 305
228. 233
236. 169
244. 148
252. 85
260. 63
268. 33
276. 21
284. 12
292. 5
300. 4
308. 5
316. 3
324. 1
332. 0
340. 0
348. 1
356. 0
364. 0
372. 0
380. 0
388. 0
396. 0
404. 0
412. 0
420. 0
428. 0
436. 0
444. 0
452. 0
460. 0
468. 0
476. 0
484. 0
492. 0

View File

@ -0,0 +1,93 @@
DEPTH PARTICLES
6. 57
18. 167
30. 222
42. 265
54. 274
66. 318
78. 345
90. 379
102. 414
114. 443
126. 476
138. 528
150. 552
162. 654
174. 623
186. 669
198. 690
210. 764
222. 793
234. 869
246. 904
258. 905
270. 1004
282. 1098
294. 1160
306. 1120
318. 1282
330. 1332
342. 1428
354. 1463
366. 1616
378. 1635
390. 1719
402. 1732
414. 1834
426. 2012
438. 1995
450. 2175
462. 2214
474. 2326
486. 2315
498. 2557
510. 2548
522. 2589
534. 2651
546. 2584
558. 2765
570. 2755
582. 2730
594. 2655
606. 2727
618. 2625
630. 2560
642. 2574
654. 2431
666. 2228
678. 2083
690. 2034
702. 1793
714. 1546
726. 1385
738. 1188
750. 986
762. 833
774. 639
786. 491
798. 330
810. 232
822. 159
834. 93
846. 43
858. 27
870. 12
882. 6
894. 2
906. 1
918. 2
930. 0
942. 0
954. 0
966. 0
978. 0
990. 0
1002. 0
1014. 0
1026. 0
1038. 0
1050. 0
1062. 0
1074. 0
1086. 0
1098. 0

View File

@ -0,0 +1,101 @@
DEPTH PARTICLES
6. 52
18. 97
30. 133
42. 181
54. 215
66. 233
78. 226
90. 286
102. 301
114. 305
126. 331
138. 364
150. 414
162. 383
174. 475
186. 475
198. 493
210. 477
222. 534
234. 498
246. 660
258. 588
270. 631
282. 699
294. 800
306. 767
318. 812
330. 839
342. 889
354. 977
366. 1061
378. 1140
390. 1119
402. 1161
414. 1242
426. 1248
438. 1356
450. 1513
462. 1514
474. 1589
486. 1630
498. 1683
510. 1830
522. 1872
534. 1990
546. 1964
558. 2015
570. 2069
582. 2317
594. 2243
606. 2253
618. 2361
630. 2432
642. 2459
654. 2599
666. 2451
678. 2501
690. 2520
702. 2534
714. 2492
726. 2467
738. 2348
750. 2257
762. 2211
774. 2192
786. 1971
798. 1825
810. 1694
822. 1509
834. 1333
846. 1173
858. 948
870. 795
882. 683
894. 502
906. 382
918. 273
930. 148
942. 109
954. 92
966. 39
978. 22
990. 15
1002. 1
1014. 2
1026. 1
1038. 0
1050. 0
1062. 0
1074. 0
1086. 0
1098. 0
1110. 0
1122. 0
1134. 0
1146. 0
1158. 0
1170. 0
1182. 0
1194. 0

View File

@ -0,0 +1,101 @@
DEPTH PARTICLES
6. 40
18. 80
30. 105
42. 113
54. 136
66. 138
78. 166
90. 202
102. 181
114. 215
126. 255
138. 257
150. 271
162. 254
174. 296
186. 324
198. 343
210. 337
222. 348
234. 397
246. 426
258. 407
270. 456
282. 457
294. 499
306. 509
318. 587
330. 632
342. 637
354. 688
366. 689
378. 679
390. 795
402. 755
414. 833
426. 891
438. 888
450. 897
462. 968
474. 1074
486. 1127
498. 1148
510. 1162
522. 1296
534. 1343
546. 1396
558. 1441
570. 1563
582. 1524
594. 1591
606. 1697
618. 1684
630. 1795
642. 1841
654. 1893
666. 1934
678. 1945
690. 2051
702. 2154
714. 2230
726. 2123
738. 2273
750. 2294
762. 2410
774. 2435
786. 2286
798. 2380
810. 2337
822. 2286
834. 2222
846. 2254
858. 2259
870. 2137
882. 2049
894. 1976
906. 1747
918. 1577
930. 1506
942. 1350
954. 1194
966. 1042
978. 904
990. 689
1002. 561
1014. 447
1026. 363
1038. 254
1050. 170
1062. 128
1074. 70
1086. 51
1098. 23
1110. 11
1122. 8
1134. 6
1146. 1
1158. 4
1170. 0
1182. 0
1194. 0

View File

@ -0,0 +1,101 @@
DEPTH PARTICLES
8. 25
24. 83
40. 89
56. 105
72. 152
88. 143
104. 160
120. 173
136. 198
152. 196
168. 200
184. 213
200. 251
216. 255
232. 276
248. 301
264. 305
280. 328
296. 360
312. 374
328. 406
344. 422
360. 480
376. 413
392. 504
408. 550
424. 538
440. 614
456. 626
472. 699
488. 685
504. 772
520. 818
536. 774
552. 877
568. 914
584. 984
600. 1034
616. 1093
632. 1236
648. 1273
664. 1336
680. 1405
696. 1489
712. 1494
728. 1602
744. 1642
760. 1779
776. 1900
792. 1977
808. 2080
824. 2014
840. 2215
856. 2311
872. 2381
888. 2431
904. 2550
920. 2636
936. 2698
952. 2786
968. 2794
984. 2817
1000. 2853
1016. 2858
1032. 2850
1048. 2742
1064. 2656
1080. 2496
1096. 2384
1112. 2286
1128. 2091
1144. 1935
1160. 1762
1176. 1471
1192. 1256
1208. 1045
1224. 819
1240. 649
1256. 459
1272. 308
1288. 207
1304. 122
1320. 71
1336. 40
1352. 11
1368. 3
1384. 5
1400. 1
1416. 1
1432. 0
1448. 0
1464. 0
1480. 0
1496. 0
1512. 0
1528. 0
1544. 0
1560. 0
1576. 0
1592. 0

View File

@ -0,0 +1,73 @@
DEPTH PARTICLES
4. 324
12. 859
20. 1200
28. 1491
36. 1650
44. 1963
52. 2150
60. 2361
68. 2708
76. 2611
84. 2857
92. 3074
100. 3249
108. 3281
116. 3338
124. 3453
132. 3555
140. 3550
148. 3586
156. 3608
164. 3611
172. 3440
180. 3226
188. 3115
196. 2998
204. 2780
212. 2571
220. 2276
228. 1999
236. 1770
244. 1530
252. 1309
260. 1127
268. 902
276. 723
284. 575
292. 448
300. 311
308. 273
316. 174
324. 124
332. 85
340. 59
348. 41
356. 23
364. 16
372. 9
380. 5
388. 5
396. 2
404. 0
412. 0
420. 0
428. 0
436. 0
444. 0
452. 0
460. 0
468. 0
476. 0
484. 0
492. 0
500. 0
508. 0
516. 0
524. 0
532. 0
540. 0
548. 0
556. 0
564. 0
572. 0

View File

@ -0,0 +1,97 @@
DEPTH PARTICLES
10. 33
30. 57
50. 88
70. 99
90. 93
110. 122
130. 130
150. 145
170. 160
190. 208
210. 224
230. 212
250. 214
270. 232
290. 234
310. 268
330. 271
350. 311
370. 345
390. 346
410. 355
430. 417
450. 405
470. 449
490. 428
510. 508
530. 550
550. 560
570. 581
590. 649
610. 646
630. 707
650. 751
670. 810
690. 836
710. 964
730. 1051
750. 1063
770. 1135
790. 1193
810. 1294
830. 1334
850. 1464
870. 1487
890. 1624
910. 1686
930. 1733
950. 1895
970. 1891
990. 2150
1010. 2192
1030. 2369
1050. 2459
1070. 2599
1090. 2713
1110. 2733
1130. 2907
1150. 2929
1170. 2986
1190. 3080
1210. 3084
1230. 3088
1250. 3159
1270. 3197
1290. 3052
1310. 2920
1330. 2749
1350. 2600
1370. 2389
1390. 2232
1410. 1976
1430. 1651
1450. 1285
1470. 1046
1490. 827
1510. 607
1530. 341
1550. 213
1570. 120
1590. 47
1610. 22
1630. 6
1650. 1
1670. 1
1690. 0
1710. 0
1730. 0
1750. 0
1770. 0
1790. 0
1810. 0
1830. 0
1850. 0
1870. 0
1890. 0
1910. 0

View File

@ -0,0 +1,101 @@
DEPTH PARTICLES
10. 23
30. 45
50. 70
70. 64
90. 74
110. 93
130. 103
150. 113
170. 102
190. 122
210. 127
230. 135
250. 145
270. 159
290. 155
310. 188
330. 190
350. 203
370. 187
390. 231
410. 251
430. 259
450. 286
470. 280
490. 321
510. 328
530. 343
550. 336
570. 366
590. 407
610. 435
630. 417
650. 468
670. 498
690. 525
710. 546
730. 601
750. 629
770. 629
790. 749
810. 742
830. 866
850. 810
870. 895
890. 998
910. 1028
930. 1044
950. 1090
970. 1212
990. 1270
1010. 1374
1030. 1369
1050. 1544
1070. 1555
1090. 1671
1110. 1709
1130. 1730
1150. 1880
1170. 2004
1190. 2111
1210. 2147
1230. 2294
1250. 2437
1270. 2431
1290. 2612
1310. 2564
1330. 2749
1350. 2725
1370. 2847
1390. 2970
1410. 2896
1430. 2977
1450. 2943
1470. 2890
1490. 2795
1510. 2720
1530. 2552
1550. 2427
1570. 2148
1590. 2062
1610. 1775
1630. 1536
1650. 1302
1670. 994
1690. 792
1710. 558
1730. 401
1750. 269
1770. 182
1790. 78
1810. 30
1830. 18
1850. 3
1870. 1
1890. 1
1910. 0
1930. 0
1950. 0
1970. 0
1990. 0

View File

@ -0,0 +1,80 @@
DEPTH PARTICLES
15. 44
45. 75
75. 88
105. 112
135. 128
165. 142
195. 147
225. 173
255. 176
285. 187
315. 198
345. 243
375. 224
405. 241
435. 312
465. 342
495. 328
525. 375
555. 381
585. 433
615. 411
645. 493
675. 542
705. 592
735. 615
765. 705
795. 713
825. 818
855. 867
885. 940
915. 1045
945. 1163
975. 1282
1005. 1325
1035. 1439
1065. 1537
1095. 1729
1125. 1870
1155. 2026
1185. 2086
1215. 2254
1245. 2420
1275. 2727
1305. 2742
1335. 2994
1365. 3144
1395. 3381
1425. 3666
1455. 3717
1485. 3911
1515. 4053
1545. 4093
1575. 4045
1605. 4095
1635. 4120
1665. 3817
1695. 3589
1725. 3286
1755. 2787
1785. 2240
1815. 1803
1845. 1254
1875. 878
1905. 473
1935. 231
1965. 97
1995. 30
2025. 4
2055. 0
2085. 1
2115. 0
2145. 0
2175. 0
2205. 0
2235. 0
2265. 0
2295. 0
2325. 0
2355. 0

View File

@ -0,0 +1,91 @@
DEPTH PARTICLES
4. 103
12. 348
20. 466
28. 581
36. 688
44. 760
52. 826
60. 891
68. 1036
76. 1031
84. 1096
92. 1181
100. 1268
108. 1317
116. 1343
124. 1546
132. 1633
140. 1662
148. 1781
156. 1903
164. 1906
172. 2032
180. 2162
188. 2259
196. 2318
204. 2289
212. 2437
220. 2412
228. 2514
236. 2634
244. 2622
252. 2636
260. 2749
268. 2704
276. 2724
284. 2705
292. 2654
300. 2480
308. 2455
316. 2355
324. 2322
332. 2299
340. 2118
348. 1917
356. 1792
364. 1596
372. 1377
380. 1284
388. 1118
396. 931
404. 827
412. 696
420. 597
428. 418
436. 348
444. 254
452. 209
460. 154
468. 110
476. 72
484. 54
492. 27
500. 20
508. 14
516. 8
524. 3
532. 3
540. 1
548. 1
556. 0
564. 0
572. 0
580. 0
588. 0
596. 0
604. 0
612. 0
620. 0
628. 0
636. 0
644. 0
652. 0
660. 0
668. 0
676. 0
684. 0
692. 0
700. 0
708. 0
716. 0

View File

@ -0,0 +1,101 @@
DEPTH PARTICLES
4. 62
12. 158
20. 246
28. 302
36. 338
44. 405
52. 482
60. 467
68. 508
76. 582
84. 576
92. 620
100. 679
108. 688
116. 777
124. 830
132. 836
140. 911
148. 914
156. 1003
164. 957
172. 1083
180. 1151
188. 1203
196. 1226
204. 1337
212. 1381
220. 1365
228. 1516
236. 1519
244. 1640
252. 1648
260. 1644
268. 1718
276. 1836
284. 1865
292. 1933
300. 1917
308. 1998
316. 2027
324. 2095
332. 2134
340. 2208
348. 2268
356. 2278
364. 2222
372. 2295
380. 2291
388. 2216
396. 2276
404. 2218
412. 2173
420. 2101
428. 2009
436. 1944
444. 1877
452. 1813
460. 1789
468. 1609
476. 1506
484. 1423
492. 1225
500. 1181
508. 1034
516. 900
524. 797
532. 629
540. 538
548. 457
556. 351
564. 270
572. 229
580. 178
588. 133
596. 81
604. 67
612. 39
620. 23
628. 18
636. 14
644. 4
652. 5
660. 3
668. 0
676. 0
684. 0
692. 0
700. 0
708. 0
716. 0
724. 0
732. 0
740. 0
748. 0
756. 0
764. 0
772. 0
780. 0
788. 0
796. 0

View File

@ -0,0 +1,99 @@
DEPTH PARTICLES
5. 74
15. 177
25. 219
35. 270
45. 311
55. 351
65. 370
75. 376
85. 448
95. 513
105. 517
115. 542
125. 622
135. 645
145. 647
155. 732
165. 772
175. 789
185. 890
195. 959
205. 946
215. 1043
225. 1033
235. 1133
245. 1185
255. 1278
265. 1369
275. 1444
285. 1392
295. 1505
305. 1531
315. 1610
325. 1712
335. 1751
345. 1853
355. 1944
365. 1885
375. 2097
385. 2147
395. 2213
405. 2251
415. 2276
425. 2347
435. 2458
445. 2404
455. 2500
465. 2468
475. 2546
485. 2547
495. 2451
505. 2513
515. 2444
525. 2361
535. 2337
545. 2193
555. 2145
565. 1989
575. 1862
585. 1845
595. 1594
605. 1368
615. 1289
625. 1097
635. 885
645. 782
655. 618
665. 540
675. 397
685. 295
695. 196
705. 140
715. 111
725. 59
735. 22
745. 21
755. 9
765. 5
775. 1
785. 1
795. 2
805. 1
815. 0
825. 0
835. 0
845. 0
855. 0
865. 0
875. 0
885. 0
895. 0
905. 0
915. 0
925. 0
935. 0
945. 0
955. 0
965. 0
975. 0

View File

@ -0,0 +1,104 @@
Sn-210042 B=~48(G)/1.50(A), T=3.31(K), Tr=18.02(kV), Sa=-4.70(kV), En=21.97(keV), RAL-RAR=0.09(kV), RAT-RAB=0.15(kV)
###############################################################
FITPARAMETER
# Nr. Name Value Step Pos_Error Boundaries
1 one 1 0 none
2 zero 0 0 none
3 Asy 0.207938 0.00663241 none 0 0.33
4 energy 22 0 none
5 redTemp 0.8683 0 none
6 thickness 5000 0 none
7 ell 12000 0 none
8 xi 94 0 none
9 lambdaL 45.9973 1.19932 none
10 Bext 47.11 0 none
11 deadLayer 20.7296 0.054242 none 0 none
12 RateSmear 0.327307 0.0222695 none
13 N0_L 297.975 1.29352 none
14 Bkg_L 24.582 0.122645 none
15 Phase_L 31.2249 2.7339 none
16 Alpha_LR 1.08146 0.00759253 none
17 Bkg_R 27.5568 0.123419 none
18 RelPhase_R 152.704 1.58788 none
###############################################################
THEORY
asymmetry 3
userFcn libPNL_PippardFitter.so PNL_PippardFitter 4 5 6 7 8 9 10 fun2 11
simpleGss 12 (rate)
###############################################################
FUNCTIONS
fun1 = par13 * map1
fun2 = par15 + map2
###############################################################
RUN data/lem10_his_0825 MUE4 PSI ROOT-NPP (name beamline institute data-file-format)
fittype 0 (single histogram fit)
norm 13
backgr.fit 14
lifetimecorrection
map 1 2 0 0 0 0 0 0 0 0
forward 1
data 3289 65000
t0 3289
fit 0.2 9.2
packing 250
RUN data/lem10_his_0825 MUE4 PSI ROOT-NPP (name beamline institute data-file-format)
fittype 0 (single histogram fit)
norm fun1
backgr.fit 17
lifetimecorrection
map 16 18 0 0 0 0 0 0 0 0
forward 3
data 3289 65000
t0 3289
fit 0.2 9.2
packing 250
###############################################################
COMMANDS
MINIMIZE
HESSE
SAVE
###############################################################
PLOT 0 (single histo plot)
runs 1 2
range 0.00 9.00 -0.30 0.30
view_packing 500
###############################################################
FOURIER
units Gauss # units either 'Gauss', 'MHz', or 'Mc/s'
fourier_power 10
apodization STRONG # NONE, WEAK, MEDIUM, STRONG
plot POWER # REAL, IMAG, REAL_AND_IMAG, POWER, PHASE
phase 8.50
#range_for_phase_correction 50.0 70.0
range 0.00 200.00
###############################################################
STATISTIC --- 2010-11-07 16:46:59
chisq = 417.37802066449291, NDF = 358, chisq/NDF = 1.1658603929175779

View File

@ -0,0 +1,85 @@
YBCO(110)/PrBCO/STO on Ag, T=4.96 K, E=19.12 keV, B=~98(G)/3.04(A), Tr/Sa=15.02/-5.00 kV, RA-LR 0.05 kV, RA-TB 0.14 kV
###############################################################
FITPARAMETER
# No Name Value Step Pos_Error Boundaries
1 phase 25.1328 -0.979855 0.987925 -180 180
2 field 84.2201 -0.243991 0.264511 0 none
3 asym 0.11616 -0.00735602 0.00786111 0 0.3
4 rate 0.297241 -0.028157 0.0289587 0 2
5 fieldBKG 94.9012 -0.142071 0.143479 0 none
6 asymBKG 0.139904 -0.00933264 0.00905566 0 0.3
7 rateBKG 0.0623834 -0.0189223 0.0188684 0 100
8 Norm_L 272.022 -0.565339 0.566487 0 1000
9 BG_L 25.7891 -0.120907 0.120769 0 100
10 Norm_R 320.245 -0.608216 0.60492 0 1000
11 BG_R 30.7947 -0.130858 0.131547 0 100
12 relasy_R 0.982832 -0.0159124 0.0162089 0 1.2
13 relphase_R 159.584 -0.898672 0.898169 150 210
14 one 1 0 none
15 zero 0 0 none
###############################################################
THEORY
asymmetry fun1
userFcn libPRelax.so PGauss 4 (rate)
TFieldCos fun3 fun4 (phase frequency)
+
asymmetry fun2
userFcn libPRelax.so PExp 7 (rate)
TFieldCos fun3 fun5 (phase frequency)
###############################################################
FUNCTIONS
fun1 = par3 * map1
fun2 = par6 * map1
fun3 = par1 + map2
fun4 = par2 * gamma_mu
fun5 = par5 * gamma_mu
###############################################################
RUN data/lem10_his_1951 MUE4 PSI ROOT-NPP (name beamline institute data-file-format)
fittype 0 (single histogram fit)
norm 8
backgr.fit 9
lifetimecorrection
map 14 15 0 0 0 0 0 0 0 0
forward 1
background 65000 66500
data 3289 63000
fit 0.15 8
packing 200
RUN data/lem10_his_1951 MUE4 PSI ROOT-NPP (name beamline institute data-file-format)
fittype 0 (single histogram fit)
norm 10
backgr.fit 11
lifetimecorrection
map 12 13 0 0 0 0 0 0 0 0
forward 3
background 65000 66500
data 3289 63000
fit 0.15 8
packing 200
###############################################################
COMMANDS
MINIMIZE
MINOS
SAVE
###############################################################
FOURIER
units Gauss # units either 'Gauss', 'MHz', or 'Mc/s'
fourier_power 10
apodization STRONG # NONE, WEAK, MEDIUM, STRONG
plot POWER # REAL, IMAG, REAL_AND_IMAG, POWER, PHASE
range 0 250
###############################################################
PLOT 0 (single histo plot)
runs 1 2
range 0.00 8.00 -0.30 0.30
###############################################################
STATISTIC --- 2010-11-09 20:13:52
chisq = 401.71526823978365, NDF = 389, chisq/NDF = 1.0326870648837627

View File

@ -0,0 +1,99 @@
#---------------------------------------------------
# Makefile
#
# Author: Andreas Suter
# e-mail: andreas.suter@psi.ch
#
# $Id: Makefile.libPNL_PippardFitter 4314 2009-12-22 17:03:48Z l_wojek $
#
#---------------------------------------------------
#---------------------------------------------------
# get compilation and library flags from root-config
ROOTCFLAGS = $(shell $(ROOTSYS)/bin/root-config --cflags)
ROOTLIBS = $(shell $(ROOTSYS)/bin/root-config --libs)
ROOTGLIBS = $(shell $(ROOTSYS)/bin/root-config --glibs)
#---------------------------------------------------
# depending on the architecture, choose the compiler,
# linker, and the flags to use
#
OSTYPE = $(shell uname)
ifeq ($(OSTYPE),Linux)
OS = LINUX
endif
ifeq ($(OSTYPE),Linux-gnu)
OS = LINUX
endif
ifeq ($(OSTYPE),Darwin)
OS = DARWIN
endif
# -- Linux
ifeq ($(OS),LINUX)
CXX = g++
CXXFLAGS = -Wall -Wno-trigraphs -fPIC
INCLUDES = -I../include
LD = g++
LDFLAGS = -g
SOFLAGS = -O -shared
endif
# -- Darwin
ifeq ($(OS),DARWIN)
CXX = g++
CXXFLAGS = -Wall -Wno-trigraphs -fPIC
INCLUDES = -I../include
LD = g++
LDFLAGS = -g
SOFLAGS = -dynamic
endif
# the output from the root-config script:
CXXFLAGS += $(ROOTCFLAGS)
LDFLAGS +=
# the ROOT libraries (G = graphic)
LIBS = $(ROOTLIBS) -lXMLParser
GLIBS = $(ROOTGLIBS) -lXMLParser
# some definitions: headers (used to generate *Dict* stuff), sources, objects,...
OBJS =
OBJS += PRelax.o PRelaxDict.o
SHLIB = libPRelax.so
# make the shared lib:
#
all: $(SHLIB)
$(SHLIB): $(OBJS)
@echo "---> Building shared library $(SHLIB) ..."
/bin/rm -f $(SHLIB)
$(LD) $(OBJS) $(SOFLAGS) -o $(SHLIB) $(LIBS)
@echo "done"
# clean up: remove all object file (and core files)
# semicolon needed to tell make there is no source
# for this target!
#
clean:; @rm -f $(OBJS) *Dict* core*
@echo "---> removing $(OBJS)"
#
$(OBJS): %.o: %.cpp
$(CXX) $(INCLUDES) $(CXXFLAGS) -c $<
PRelaxDict.cpp: PRelax.h PRelaxLinkDef.h
@echo "Generating dictionary $@..."
rootcint -f $@ -c -p $^
install: all
@echo "Installing shared lib: libPRelax.so ( you must be root ;-) )"
ifeq ($(OS),LINUX)
cp -pv $(SHLIB) $(ROOTSYS)/lib
cp -pv PRelax.h $(ROOTSYS)/include
endif

View File

@ -0,0 +1,338 @@
/***************************************************************************
PRelax.cpp
Author: Andreas Suter
e-mail: andreas.suter@psi.ch
$Id$
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007 by Andreas Suter *
* andreas.suter@psi.c *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <iostream>
using namespace std;
#include <cassert>
#include <cstdlib>
#include <cmath>
#include "PRelax.h"
ClassImp(PExp)
//------------------------------------------------------------------------------------
/**
* <p> Constructor.
*/
PExp::PExp()
{
fValid = false;
fInvokedGlobal = false;
fIdxGlobal = -1;
fGlobalUserFcn = 0;
}
//------------------------------------------------------------------------------------
/**
* <p> Destructor.
*/
PExp::~PExp()
{
if ((fGlobalUserFcn != 0) && fInvokedGlobal) {
delete fGlobalUserFcn;
fGlobalUserFcn = 0;
}
}
//------------------------------------------------------------------------------------
/**
* <p> Used to invoke/retrieve the proper global user function
*
* \param globalPart reference to the global user function object vector
* \param idx global user function index within the theory tree
*/
void PExp::SetGlobalPart(vector<void *> &globalPart, UInt_t idx)
{
fIdxGlobal = static_cast<Int_t>(idx);
if ((Int_t)globalPart.size() <= fIdxGlobal) { // global user function not present, invoke it
fGlobalUserFcn = new PExpGlobal();
if (fGlobalUserFcn == 0) { // global user function object couldn't be invoked -> error
fValid = false;
cerr << endl << ">> PExp::SetGlobalPart(): **ERROR** Couldn't invoke global user function object, sorry ..." << endl;
} else { // global user function object could be invoked -> resize to global user function vector and keep the pointer to the corresponding object
globalPart.resize(fIdxGlobal+1);
globalPart[fIdxGlobal] = dynamic_cast<PExpGlobal*>(fGlobalUserFcn);
fValid = true;
fInvokedGlobal = true;
}
} else { // global user function already present hence just retrieve a pointer to it
fValid = true;
fGlobalUserFcn = (PExpGlobal*)globalPart[fIdxGlobal];
}
}
//------------------------------------------------------------------------------------
/**
* <p> Used to check if the user function is OK.
*
* <b>return:</b> true if both, the user function and the global user function object are valid
*/
Bool_t PExp::GlobalPartIsValid() const
{
return (fValid && fGlobalUserFcn->IsValid());
}
//------------------------------------------------------------------------------------
/**
* <p> user function example: global exponential
*
* \f[ = exp(-t \lambda) \f]
*
* <b>meaning of paramValues:</b> \f$\lambda\f$ depol. rate
*
* <b>return:</b> function value
*
* \param t time in \f$(\mu\mathrm{s})\f$, or x-axis value for non-muSR fit
* \param param parameter vector
*/
Double_t PExp::operator()(Double_t t, const std::vector<Double_t> &param) const
{
// expected parameters: lambda
assert(param.size() == 1);
assert(fGlobalUserFcn);
// call the global user function object
fGlobalUserFcn->Calc(param);
return exp(-t*param[0]);
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ClassImp(PExpGlobal)
//------------------------------------------------------------------------------------
/**
* <p> Constructor
*/
PExpGlobal::PExpGlobal()
{
fValid = true;
fRandom = 0.0;
}
//------------------------------------------------------------------------------------
/**
* <p> Destructor
*/
PExpGlobal::~PExpGlobal()
{
fPrevParam.clear();
}
//------------------------------------------------------------------------------------
/**
* <p> Check if the parameter vector has changed to the previous one, and if so,
* do some global user function calculation (here calculate only a stupid random
* number).
*
* \param param fit parameter vector
*/
void PExpGlobal::Calc(const std::vector<Double_t> &param)
{
// check if previous parameters where ever fed
if (fPrevParam.size() == 0) {
fPrevParam = param;
fRandom = rand() / (RAND_MAX+1.0);
cout << endl << "debug> PExpGlobal::Calc(): fRandom = " << fRandom << " (first time)";
}
// check if param has changed, i.e. something needs to be done
Bool_t newParam = false;
for (UInt_t i=0; i<param.size(); i++) {
if (param[i] != fPrevParam[i]) {
newParam = true;
break;
}
}
if (newParam) {
// do the global calculations (here only a stupid random number)
fRandom = rand() / (RAND_MAX+1.0);
// feed the previous parameter vector
for (UInt_t i=0; i<param.size(); i++)
fPrevParam[i] = param[i];
}
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ClassImp(PGauss)
//------------------------------------------------------------------------------------
/**
* <p> Constructor.
*/
PGauss::PGauss()
{
fValid = false;
fInvokedGlobal = false;
fIdxGlobal = -1;
fGlobalUserFcn = 0;
}
//------------------------------------------------------------------------------------
/**
* <p> Destructor.
*/
PGauss::~PGauss()
{
if ((fGlobalUserFcn != 0) && fInvokedGlobal) {
delete fGlobalUserFcn;
fGlobalUserFcn = 0;
}
}
//------------------------------------------------------------------------------------
/**
* <p> Used to invoke/retrieve the proper global user function
*
* \param globalPart reference to the global user function object vector
* \param idx global user function index within the theory tree
*/
void PGauss::SetGlobalPart(vector<void *> &globalPart, UInt_t idx)
{
fIdxGlobal = static_cast<Int_t>(idx);
if ((Int_t)globalPart.size() <= fIdxGlobal) {
fGlobalUserFcn = new PGaussGlobal();
if (fGlobalUserFcn == 0) {
fValid = false;
cerr << endl << ">> PGauss::SetGlobalPart(): **ERROR** Couldn't invoke global user function object, sorry ..." << endl;
} else {
globalPart.resize(fIdxGlobal+1);
globalPart[fIdxGlobal] = dynamic_cast<PGaussGlobal*>(fGlobalUserFcn);
fValid = true;
fInvokedGlobal = true;
}
} else {
fValid = true;
fGlobalUserFcn = (PGaussGlobal*)globalPart[fIdxGlobal];
}
}
//------------------------------------------------------------------------------------
/**
* <p> Used to check if the user function is OK.
*
* <b>return:</b> true if both, the user function and the global user function object are valid
*/
Bool_t PGauss::GlobalPartIsValid() const
{
return (fValid && fGlobalUserFcn->IsValid());
}
//------------------------------------------------------------------------------------
/**
* <p> user function example: global Gaussian
*
* \f[ = exp(-1/2 (t sigma)^2) \f]
*
* <b>meaning of paramValues:</b> \f$\sigma\f$ depol. rate
*
* <b>return:</b> function value
*
* \param t time in \f$(\mu\mathrm{s})\f$, or x-axis value for non-muSR fit
* \param param parameter vector
*/
Double_t PGauss::operator()(Double_t t, const std::vector<Double_t> &param) const
{
// expected parameters: sigma
assert(param.size() == 1);
assert(fGlobalUserFcn);
fGlobalUserFcn->Calc(param);
return exp(-0.5*pow(t*param[0],2.0));
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ClassImp(PGaussGlobal)
//------------------------------------------------------------------------------------
/**
* <p> Constructor
*/
PGaussGlobal::PGaussGlobal()
{
fValid = true;
fRandom = 0.0;
}
//------------------------------------------------------------------------------------
/**
* <p> Destructor
*/
PGaussGlobal::~PGaussGlobal()
{
fPrevParam.clear();
}
//------------------------------------------------------------------------------------
/**
* <p> Check if the parameter vector has changed to the previous one, and if so,
* do some global user function calculation (here calculate only a stupid random
* number).
*
* \param param fit parameter vector
*/
void PGaussGlobal::Calc(const std::vector<Double_t> &param)
{
// check if previous parameters where ever fed
if (fPrevParam.size() == 0) {
fPrevParam = param;
fRandom = rand() / (RAND_MAX+1.0);
cout << endl << "debug> PGaussGlobal::Calc(): fRandom = " << fRandom << " (first time)";
}
// check if param has changed, i.e. something needs to be done
Bool_t newParam = false;
for (UInt_t i=0; i<param.size(); i++) {
if (param[i] != fPrevParam[i]) {
newParam = true;
break;
}
}
if (newParam) {
// do the global calculations (here only a stupid random number)
fRandom = rand() / (RAND_MAX+1.0);
// feed the previous parameter vector
for (UInt_t i=0; i<param.size(); i++)
fPrevParam[i] = param[i];
}
}

View File

@ -0,0 +1,135 @@
/***************************************************************************
PRelax.h
Author: Andreas Suter
e-mail: andreas.suter@psi.ch
$Id$
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007 by Andreas Suter *
* andreas.suter@psi.c *
* *
* 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 _PRELAX_H_
#define _PRELAX_H_
#include <vector>
#include <iostream>
#include "PUserFcnBase.h"
class PExpGlobal;
class PGaussGlobal;
//-----------------------------------------------------------------------------------
/**
* <p>User function example class. Global exponential function.
*/
class PExp : public PUserFcnBase
{
public:
PExp();
virtual ~PExp();
virtual Bool_t NeedGlobalPart() const { return true; }
virtual void SetGlobalPart(vector<void*> &globalPart, UInt_t idx);
virtual Bool_t GlobalPartIsValid() const;
Double_t operator()(Double_t t, const std::vector<Double_t> &param) const;
private:
Bool_t fValid;
Bool_t fInvokedGlobal;
Int_t fIdxGlobal;
PExpGlobal *fGlobalUserFcn;
ClassDef(PExp, 1)
};
//-----------------------------------------------------------------------------------
/**
* <p>User function example class (global part). Global exponential function.
*/
class PExpGlobal
{
public:
PExpGlobal();
virtual ~PExpGlobal();
Bool_t IsValid() { return fValid; }
void Calc(const std::vector<Double_t> &param);
private:
Bool_t fValid;
std::vector<Double_t> fPrevParam;
Double_t fRandom;
ClassDef(PExpGlobal, 1)
};
//-----------------------------------------------------------------------------------
/**
* <p>User function example class. Global Gaussian function.
*/
class PGauss : public PUserFcnBase
{
public:
PGauss();
virtual ~PGauss();
virtual Bool_t NeedGlobalPart() const { return true; }
virtual void SetGlobalPart(vector<void*> &globalPart, UInt_t idx);
virtual Bool_t GlobalPartIsValid() const;
Double_t operator()(Double_t t, const std::vector<Double_t> &param) const;
private:
Bool_t fValid;
Bool_t fInvokedGlobal;
Int_t fIdxGlobal;
PGaussGlobal *fGlobalUserFcn;
ClassDef(PGauss, 1)
};
//-----------------------------------------------------------------------------------
/**
* <p>User function example class (global part). Global Gaussian function.
*/
class PGaussGlobal
{
public:
PGaussGlobal();
virtual ~PGaussGlobal();
Bool_t IsValid() { return fValid; }
void Calc(const std::vector<Double_t> &param);
private:
Bool_t fValid;
std::vector<Double_t> fPrevParam;
Double_t fRandom;
ClassDef(PGaussGlobal, 1)
};
#endif // _PRELAX_H_

View File

@ -0,0 +1,12 @@
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class PExp+;
#pragma link C++ class PExpGlobal+;
#pragma link C++ class PGauss+;
#pragma link C++ class PGaussGlobal+;
#endif

Binary file not shown.