fixed bug in tidyfing theory block. Added a parameter to InternalBessel
This commit is contained in:
parent
4f1ade3ca7
commit
f3e700b03f
@ -280,19 +280,19 @@ bool PFitter::SetParameters()
|
||||
} else { // add free parameter
|
||||
// check if boundaries are given
|
||||
if (fParams[i].fNoOfParams > 5) { // boundaries given
|
||||
cout << endl << ">> name=" << fParams[i].fName.Data() << ", lower=" << fParams[i].fLowerBoundaryPresent << ", upper=" << fParams[i].fUpperBoundaryPresent;
|
||||
//cout << endl << ">> name=" << fParams[i].fName.Data() << ", lower=" << fParams[i].fLowerBoundaryPresent << ", upper=" << fParams[i].fUpperBoundaryPresent;
|
||||
if (fParams[i].fLowerBoundaryPresent &&
|
||||
fParams[i].fUpperBoundaryPresent) { // upper and lower boundaries given
|
||||
cout << endl << ">> lower and upper";
|
||||
//cout << endl << ">> lower and upper";
|
||||
fMnUserParams.Add(fParams[i].fName.Data(), fParams[i].fValue, fParams[i].fStep,
|
||||
fParams[i].fLowerBoundary, fParams[i].fUpperBoundary);
|
||||
} else if (fParams[i].fLowerBoundaryPresent &&
|
||||
!fParams[i].fUpperBoundaryPresent) { // lower boundary limited
|
||||
cout << endl << ">> lower only";
|
||||
//cout << endl << ">> lower only";
|
||||
fMnUserParams.Add(fParams[i].fName.Data(), fParams[i].fValue, fParams[i].fStep);
|
||||
fMnUserParams.SetLowerLimit(fParams[i].fName.Data(), fParams[i].fLowerBoundary);
|
||||
} else { // upper boundary limited
|
||||
cout << endl << ">> upper only";
|
||||
//cout << endl << ">> upper only";
|
||||
fMnUserParams.Add(fParams[i].fName.Data(), fParams[i].fValue, fParams[i].fStep);
|
||||
fMnUserParams.SetUpperLimit(fParams[i].fName.Data(), fParams[i].fUpperBoundary);
|
||||
}
|
||||
@ -301,7 +301,7 @@ cout << endl << ">> upper only";
|
||||
}
|
||||
}
|
||||
}
|
||||
cout << endl;
|
||||
//cout << endl;
|
||||
|
||||
// check if there is an unused parameter, if so, fix it
|
||||
for (unsigned int i=0; i<fParams.size(); i++) {
|
||||
|
@ -684,6 +684,7 @@ void PTheory::MakeCleanAndTidyTheoryBlock(PMsrLines *fullTheoryBlock)
|
||||
line = &(*fullTheoryBlock)[i];
|
||||
// copy line content to str in order to remove comments
|
||||
str = line->fLine.Copy();
|
||||
cout << endl << ">> str = " << str.Data();
|
||||
// remove theory line comment if present, i.e. something starting with '('
|
||||
int index = str.Index("(");
|
||||
if (index > 0) // theory line comment present
|
||||
@ -696,16 +697,16 @@ void PTheory::MakeCleanAndTidyTheoryBlock(PMsrLines *fullTheoryBlock)
|
||||
str = ostr->GetString();
|
||||
// check if the line is just a '+' if so nothing to be done
|
||||
if (str.Contains("+"))
|
||||
return;
|
||||
continue;
|
||||
// check if the function is a polynom
|
||||
if (!str.CompareTo("p") || str.Contains("polynom")) {
|
||||
MakeCleanAndTidyPolynom(i, fullTheoryBlock);
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
// check if the function is a userFcn
|
||||
if (!str.CompareTo("u") || str.Contains("userFcn")) {
|
||||
MakeCleanAndTidyUserFcn(i, fullTheoryBlock);
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
// search the theory function
|
||||
for (unsigned int j=0; j<THEORY_MAX; j++) {
|
||||
@ -1324,11 +1325,11 @@ double PTheory::Bessel(register double t, const PDoubleVector& paramValues, cons
|
||||
*/
|
||||
double PTheory::InternalBessel(register double t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const
|
||||
{
|
||||
// expected parameters: phase frequency rateT rateL [tshift]
|
||||
// expected parameters: fraction phase frequency rateT rateL [tshift]
|
||||
|
||||
double val[5];
|
||||
double val[6];
|
||||
|
||||
assert(fParamNo.size() <= 5);
|
||||
assert(fParamNo.size() <= 6);
|
||||
|
||||
// check if FUNCTIONS are used
|
||||
for (unsigned int i=0; i<fParamNo.size(); i++) {
|
||||
@ -1340,15 +1341,14 @@ double PTheory::InternalBessel(register double t, const PDoubleVector& paramValu
|
||||
}
|
||||
|
||||
double tt;
|
||||
if (fParamNo.size() == 4) // no tshift
|
||||
if (fParamNo.size() == 5) // no tshift
|
||||
tt = t;
|
||||
else // tshift present
|
||||
tt = t-val[4];
|
||||
tt = t-val[5];
|
||||
|
||||
return 0.666666666666667*
|
||||
TMath::BesselJ0(DEG_TO_RAD*val[0]+TWO_PI*val[1]*tt)*
|
||||
TMath::Exp(-val[2]*tt) +
|
||||
0.333333333333333*TMath::Exp(-val[3]*tt);
|
||||
return val[0]* TMath::BesselJ0(DEG_TO_RAD*val[1]+TWO_PI*val[2]*tt)*
|
||||
TMath::Exp(-val[3]*tt) +
|
||||
(1.0-val[0])*TMath::Exp(-val[4]*tt);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
@ -87,7 +87,7 @@
|
||||
#define THEORY_PARAM_INTERNAL_FIELD 4 // phase, frequency, TF damping, damping (tshift)
|
||||
#define THEORY_PARAM_TF_COS 2 // phase, frequency (tshift)
|
||||
#define THEORY_PARAM_BESSEL 2 // phase, frequency (tshift)
|
||||
#define THEORY_PARAM_INTERNAL_BESSEL 5 // fraction, phase, frequency, TF damping, damping (tshift)
|
||||
#define THEORY_PARAM_INTERNAL_BESSEL 5 // fraction, phase, frequency, TF damping, LF damping (tshift)
|
||||
#define THEORY_PARAM_SKEWED_GAUSS 4 // phase, frequency, rate minus, rate plus (tshift)
|
||||
|
||||
// number of available user functions
|
||||
@ -163,7 +163,7 @@ static PTheoDataBase fgTheoDataBase[THEORY_MAX] = {
|
||||
"bessel", "b", "(phase frequency)", "(phase frequency tshift)"},
|
||||
|
||||
{THEORY_INTERNAL_BESSEL, THEORY_PARAM_INTERNAL_BESSEL, false,
|
||||
"internBsl", "ib", "(phase frequency Trate Lrate)", "(phase frequency Trate Lrate tshift)"},
|
||||
"internBsl", "ib", "(fraction phase frequency Trate Lrate)", "(fraction phase frequency Trate Lrate tshift)"},
|
||||
|
||||
{THEORY_SKEWED_GAUSS, THEORY_PARAM_SKEWED_GAUSS, false,
|
||||
"skewedGss", "skg", "(phase frequency rate_m rate_p)", "(phase frequency rate_m rate_p tshift)"},
|
||||
|
Loading…
x
Reference in New Issue
Block a user