36 #include <TObjString.h> 37 #include <TObjArray.h> 41 #include <Math/SpecFuncMathMore.h> 46 #define SQRT_TWO 1.41421356237 47 #define SQRT_PI 1.77245385091 104 static UInt_t lineNo = 1;
105 static UInt_t depth = 0;
107 if (hasParent ==
false) {
120 if (lineNo > fullTheoryBlock->size()-1) {
127 TString str = line->
fLine.Copy();
130 Int_t index = str.Index(
"(");
135 index = str.Index(
"#");
143 tokens = str.Tokenize(
" \t");
145 std::cerr << std::endl <<
">> PTheory::PTheory: **SEVERE ERROR** Couldn't tokenize theory block line " << line->
fLineNo <<
".";
146 std::cerr << std::endl <<
">> line content: " << line->
fLine.Data();
147 std::cerr << std::endl;
150 ostr =
dynamic_cast<TObjString*
>(tokens->At(0));
151 str = ostr->GetString();
158 std::cerr << std::endl <<
">> PTheory::PTheory: **ERROR** Theory line '" << line->
fLine.Data() <<
"'";
159 std::cerr << std::endl <<
">> in line no " << line->
fLineNo <<
" is undefined!";
160 std::cerr << std::endl;
166 if ((static_cast<UInt_t>(tokens->GetEntries()-1) <
fNoOfParam) &&
168 std::cerr << std::endl <<
">> PTheory::PTheory: **ERROR** Theory line '" << line->
fLine.Data() <<
"'";
169 std::cerr << std::endl <<
">> in line no " << line->
fLineNo;
170 std::cerr << std::endl <<
">> expecting " <<
fgTheoDataBase[idx].
fNoOfParam <<
", but found " << tokens->GetEntries()-1;
171 std::cerr << std::endl;
180 for (Int_t i=1; i<tokens->GetEntries(); i++) {
181 ostr =
dynamic_cast<TObjString*
>(tokens->At(i));
182 str = ostr->GetString();
196 if (str.Contains(
"map")) {
197 status = sscanf(str.Data(),
"map%u", &value);
202 if ((value <= maps.size()) && (value > 0)) {
203 fParamNo.push_back(maps[value-1]-1);
205 std::cerr << std::endl <<
">> PTheory::PTheory: **ERROR** map index " << value <<
" out of range! See line no " << line->
fLineNo;
206 std::cerr << std::endl;
210 std::cerr << std::endl <<
">> PTheory::PTheory: **ERROR**: map '" << str.Data() <<
"' not allowed. See line no " << line->
fLineNo;
211 std::cerr << std::endl;
214 }
else if (str.Contains(
"fun")) {
215 status = sscanf(str.Data(),
"fun%u", &value);
225 status = sscanf(str.Data(),
"%u", &value);
232 std::cerr << std::endl <<
">> PTheory::PTheory: **ERROR** '" << str.Data() <<
"' not allowed. See line no " << line->
fLineNo;
233 std::cerr << std::endl;
241 if (
fValid && (lineNo < fullTheoryBlock->size()-1)) {
242 line = &(*fullTheoryBlock)[lineNo+1];
243 if (!line->
fLine.Contains(
"+")) {
252 if (
fValid && (lineNo < fullTheoryBlock->size()-1)) {
253 line = &(*fullTheoryBlock)[lineNo+1];
254 if ((depth == 0) && line->
fLine.Contains(
"+")) {
261 if (
fValid && !hasParent) {
267 std::cout << std::endl <<
">> user function class name: " <<
fUserFcnClassName.Data() << std::endl;
270 std::cerr << std::endl <<
">> PTheory::PTheory: **ERROR** user function class '" <<
fUserFcnClassName.Data() <<
"' not found.";
272 std::cerr << std::endl <<
">> See line no " << line->
fLineNo;
273 std::cerr << std::endl;
282 std::cerr << std::endl <<
">> PTheory::PTheory: **ERROR** user function class '" <<
fUserFcnClassName.Data() <<
"' not found.";
283 std::cerr << std::endl <<
">> " <<
fUserFcnSharedLibName.Data() <<
" loaded successfully, but no dictionary present.";
284 std::cerr << std::endl <<
">> See line no " << line->
fLineNo;
285 std::cerr << std::endl;
300 std::cerr << std::endl <<
">> PTheory::PTheory: **ERROR** user function object could not be invoked. See line no " << line->
fLineNo;
301 std::cerr << std::endl;
312 std::cerr << std::endl <<
">> PTheory::PTheory: **ERROR** global user function object could not be invoked/retrived. See line no " << line->
fLineNo;
313 std::cerr << std::endl;
396 return Constant(paramValues, funcValues) *
fMul->
Func(t, paramValues, funcValues) +
397 fAdd->
Func(t, paramValues, funcValues);
399 return Asymmetry(paramValues, funcValues) *
fMul->
Func(t, paramValues, funcValues) +
400 fAdd->
Func(t, paramValues, funcValues);
402 return SimpleExp(t, paramValues, funcValues) *
fMul->
Func(t, paramValues, funcValues) +
403 fAdd->
Func(t, paramValues, funcValues);
405 return GeneralExp(t, paramValues, funcValues) *
fMul->
Func(t, paramValues, funcValues) +
406 fAdd->
Func(t, paramValues, funcValues);
409 fAdd->
Func(t, paramValues, funcValues);
412 fAdd->
Func(t, paramValues, funcValues);
415 fAdd->
Func(t, paramValues, funcValues);
418 fAdd->
Func(t, paramValues, funcValues);
421 fAdd->
Func(t, paramValues, funcValues);
424 fAdd->
Func(t, paramValues, funcValues);
427 fAdd->
Func(t, paramValues, funcValues);
429 return CombiLGKT(t, paramValues, funcValues) *
fMul->
Func(t, paramValues, funcValues) +
430 fAdd->
Func(t, paramValues, funcValues);
432 return StrKT(t, paramValues, funcValues) *
fMul->
Func(t, paramValues, funcValues) +
433 fAdd->
Func(t, paramValues, funcValues);
435 return SpinGlass(t, paramValues, funcValues) *
fMul->
Func(t, paramValues, funcValues) +
436 fAdd->
Func(t, paramValues, funcValues);
439 fAdd->
Func(t, paramValues, funcValues);
441 return Abragam(t, paramValues, funcValues) *
fMul->
Func(t, paramValues, funcValues) +
442 fAdd->
Func(t, paramValues, funcValues);
444 return TFCos(t, paramValues, funcValues) *
fMul->
Func(t, paramValues, funcValues) +
445 fAdd->
Func(t, paramValues, funcValues);
448 fAdd->
Func(t, paramValues, funcValues);
451 fAdd->
Func(t, paramValues, funcValues);
454 fAdd->
Func(t, paramValues, funcValues);
456 return Bessel(t, paramValues, funcValues) *
fMul->
Func(t, paramValues, funcValues) +
457 fAdd->
Func(t, paramValues, funcValues);
460 fAdd->
Func(t, paramValues, funcValues);
463 fAdd->
Func(t, paramValues, funcValues);
465 return StaticNKZF (t, paramValues, funcValues) *
fMul->
Func(t, paramValues, funcValues) +
466 fAdd->
Func(t, paramValues, funcValues);
468 return StaticNKTF (t, paramValues, funcValues) *
fMul->
Func(t, paramValues, funcValues) +
469 fAdd->
Func(t, paramValues, funcValues);
472 fAdd->
Func(t, paramValues, funcValues);
475 fAdd->
Func(t, paramValues, funcValues);
477 return Polynom(t, paramValues, funcValues) *
fMul->
Func(t, paramValues, funcValues) +
478 fAdd->
Func(t, paramValues, funcValues);
481 fAdd->
Func(t, paramValues, funcValues);
483 return UserFcn(t, paramValues, funcValues) *
fMul->
Func(t, paramValues, funcValues) +
484 fAdd->
Func(t, paramValues, funcValues);
486 std::cerr << std::endl <<
">> PTheory::Func: **PANIC ERROR** You never should have reached this line?!?! (" <<
fType <<
")";
487 std::cerr << std::endl;
493 return Constant(paramValues, funcValues) *
fMul->
Func(t, paramValues, funcValues);
495 return Asymmetry(paramValues, funcValues) *
fMul->
Func(t, paramValues, funcValues);
497 return SimpleExp(t, paramValues, funcValues) *
fMul->
Func(t, paramValues, funcValues);
499 return GeneralExp(t, paramValues, funcValues) *
fMul->
Func(t, paramValues, funcValues);
515 return CombiLGKT(t, paramValues, funcValues) *
fMul->
Func(t, paramValues, funcValues);
517 return StrKT(t, paramValues, funcValues) *
fMul->
Func(t, paramValues, funcValues);
519 return SpinGlass(t, paramValues, funcValues) *
fMul->
Func(t, paramValues, funcValues);
523 return Abragam(t, paramValues, funcValues) *
fMul->
Func(t, paramValues, funcValues);
525 return TFCos(t, paramValues, funcValues) *
fMul->
Func(t, paramValues, funcValues);
533 return Bessel(t, paramValues, funcValues) *
fMul->
Func(t, paramValues, funcValues);
539 return StaticNKZF (t, paramValues, funcValues) *
fMul->
Func(t, paramValues, funcValues);
541 return StaticNKTF (t, paramValues, funcValues) *
fMul->
Func(t, paramValues, funcValues);
549 return Polynom(t, paramValues, funcValues) *
fMul->
Func(t, paramValues, funcValues);
551 return UserFcn(t, paramValues, funcValues) *
fMul->
Func(t, paramValues, funcValues);
553 std::cerr << std::endl <<
">> PTheory::Func: **PANIC ERROR** You never should have reached this line?!?! (" <<
fType <<
")";
554 std::cerr << std::endl;
562 return Constant(paramValues, funcValues) +
fAdd->
Func(t, paramValues, funcValues);
564 return Asymmetry(paramValues, funcValues) +
fAdd->
Func(t, paramValues, funcValues);
566 return SimpleExp(t, paramValues, funcValues) +
fAdd->
Func(t, paramValues, funcValues);
568 return GeneralExp(t, paramValues, funcValues) +
fAdd->
Func(t, paramValues, funcValues);
584 return CombiLGKT(t, paramValues, funcValues) +
fAdd->
Func(t, paramValues, funcValues);
586 return StrKT(t, paramValues, funcValues) +
fAdd->
Func(t, paramValues, funcValues);
588 return SpinGlass(t, paramValues, funcValues) +
fAdd->
Func(t, paramValues, funcValues);
592 return Abragam(t, paramValues, funcValues) +
fAdd->
Func(t, paramValues, funcValues);
594 return TFCos(t, paramValues, funcValues) +
fAdd->
Func(t, paramValues, funcValues);
602 return Bessel(t, paramValues, funcValues) +
fAdd->
Func(t, paramValues, funcValues);
608 return StaticNKZF (t, paramValues, funcValues) +
fAdd->
Func(t, paramValues, funcValues);
610 return StaticNKTF (t, paramValues, funcValues) +
fAdd->
Func(t, paramValues, funcValues);
618 return Polynom(t, paramValues, funcValues) +
fAdd->
Func(t, paramValues, funcValues);
620 return UserFcn(t, paramValues, funcValues) +
fAdd->
Func(t, paramValues, funcValues);
622 std::cerr << std::endl <<
">> PTheory::Func: **PANIC ERROR** You never should have reached this line?!?! (" <<
fType <<
")";
623 std::cerr << std::endl;
629 return Constant(paramValues, funcValues);
631 return Asymmetry(paramValues, funcValues);
633 return SimpleExp(t, paramValues, funcValues);
635 return GeneralExp(t, paramValues, funcValues);
651 return CombiLGKT(t, paramValues, funcValues);
653 return StrKT(t, paramValues, funcValues);
655 return SpinGlass(t, paramValues, funcValues);
659 return Abragam(t, paramValues, funcValues);
661 return TFCos(t, paramValues, funcValues);
669 return Bessel(t, paramValues, funcValues);
675 return StaticNKZF(t, paramValues, funcValues);
677 return StaticNKTF(t, paramValues, funcValues);
685 return Polynom(t, paramValues, funcValues);
687 return UserFcn(t, paramValues, funcValues);
689 std::cerr << std::endl <<
">> PTheory::Func: **PANIC ERROR** You never should have reached this line?!?! (" <<
fType <<
")";
690 std::cerr << std::endl;
720 theo->
fMul =
nullptr;
725 theo->
fAdd =
nullptr;
745 !name.CompareTo(
fgTheoDataBase[i].fAbbrev, TString::kIgnoreCase)) {
767 Int_t userFcnIdx = -1;
773 if (lineNo > fullTheoryBlock->size())
777 for (UInt_t i=1; i<=lineNo; i++) {
778 if (fullTheoryBlock->at(i).fLine.Contains(
"userFcn", TString::kIgnoreCase))
799 TObjArray *tokens =
nullptr;
800 TObjString *ostr =
nullptr;
803 for (UInt_t i=1; i<fullTheoryBlock->size(); i++) {
805 line = &(*fullTheoryBlock)[i];
807 str = line->
fLine.Copy();
809 Int_t index = str.Index(
"(");
813 tokens = str.Tokenize(
" \t");
815 ostr =
dynamic_cast<TObjString*
>(tokens->At(0));
816 str = ostr->GetString();
818 if (str.Contains(
"+"))
821 if (!str.CompareTo(
"p") || str.Contains(
"polynom")) {
826 if (!str.CompareTo(
"u") || str.Contains(
"userFcn")) {
833 !str.CompareTo(
fgTheoDataBase[j].fAbbrev, TString::kIgnoreCase)) {
844 snprintf(substr,
sizeof(substr),
"%-10s",
fgTheoDataBase[idx].fName.Data());
845 tidy = TString(substr);
846 for (Int_t j=1; j<tokens->GetEntries(); j++) {
847 ostr =
dynamic_cast<TObjString*
>(tokens->At(j));
848 str = ostr->GetString();
849 snprintf(substr,
sizeof(substr),
"%6s", str.Data());
850 tidy += TString(substr);
853 if (tidy.Length() < 35) {
854 for (Int_t k=0; k<35-tidy.Length(); k++)
855 tidy += TString(
" ");
857 tidy += TString(
" ");
865 (*fullTheoryBlock)[i].fLine = tidy;
889 TObjArray *tokens =
nullptr;
894 tidy = TString(
"polynom ");
896 line = &(*fullTheoryBlock)[i];
898 str = line->
fLine.Copy();
900 tokens = str.Tokenize(
" \t");
903 Int_t max = tokens->GetEntries();
904 for (Int_t j=1; j<max; j++) {
905 ostr =
dynamic_cast<TObjString*
>(tokens->At(j));
906 str = ostr->GetString();
907 if (str.Contains(
"(")) {
913 for (Int_t j=1; j<max; j++) {
914 ostr =
dynamic_cast<TObjString*
>(tokens->At(j));
915 str = ostr->GetString();
916 snprintf(substr,
sizeof(substr),
"%6s", str.Data());
917 tidy += TString(substr);
921 tidy +=
" (tshift p0 p1 ... pn)";
924 (*fullTheoryBlock)[i].fLine = tidy;
946 TObjArray *tokens =
nullptr;
950 tidy = TString(
"userFcn ");
952 line = &(*fullTheoryBlock)[i];
954 str = line->
fLine.Copy();
956 tokens = str.Tokenize(
" \t");
958 for (Int_t j=1; j<tokens->GetEntries(); j++) {
959 ostr =
dynamic_cast<TObjString*
>(tokens->At(j));
960 str = ostr->GetString();
961 tidy += TString(
" ") + str;
965 (*fullTheoryBlock)[i].fLine = tidy;
994 constant = paramValues[
fParamNo[0]];
1053 for (UInt_t i=0; i<
fParamNo.size(); i++) {
1067 return TMath::Exp(-tt*val[0]);
1094 for (UInt_t i=0; i<
fParamNo.size(); i++) {
1109 if ((tt*val[0] < 0) && (trunc(val[1])-val[1] != 0.0)) {
1112 result = TMath::Exp(-TMath::Power(tt*val[0], val[1]));
1141 for (UInt_t i=0; i<
fParamNo.size(); i++) {
1155 return TMath::Exp(-0.5*TMath::Power(tt*val[0], 2.0));
1181 for (UInt_t i=0; i<
fParamNo.size(); i++) {
1191 sigma_t_2 = t*t*val[0]*val[0];
1193 sigma_t_2 = (t-val[1])*(t-val[1])*val[0]*val[0];
1195 return 0.333333333333333 * (1.0 + 2.0*(1.0 - sigma_t_2)*TMath::Exp(-0.5*sigma_t_2));
1225 for (UInt_t i=0; i<
fParamNo.size(); i++) {
1234 if ((val[0] == 0.0) && (val[1] == 0.0))
1239 Bool_t newParam =
false;
1240 for (UInt_t i=0; i<2; i++) {
1249 for (UInt_t i=0; i<2; i++)
1264 Double_t sigma_t_2 = 0.0;
1265 if (val[0] < 0.02) {
1266 sigma_t_2 = tt*tt*val[1]*val[1];
1267 result = 0.333333333333333 * (1.0 + 2.0*(1.0 - sigma_t_2)*TMath::Exp(-0.5*sigma_t_2));
1268 }
else if (val[1]/val[0] > 79.5775) {
1269 sigma_t_2 = tt*tt*val[1]*val[1];
1270 result = 0.333333333333333 * (1.0 + 2.0*(1.0 - sigma_t_2)*TMath::Exp(-0.5*sigma_t_2));
1272 Double_t delta = val[1];
1273 Double_t w0 = 2.0*TMath::Pi()*val[0];
1275 result = 1.0 - 2.0*TMath::Power(delta/w0,2.0)*(1.0 -
1276 TMath::Exp(-0.5*TMath::Power(delta*tt, 2.0))*TMath::Cos(w0*tt)) +
1308 Double_t result = 0.0;
1309 Bool_t useKeren =
false;
1314 for (UInt_t i=0; i<
fParamNo.size(); i++) {
1323 if ((val[0] == 0.0) && (val[1] == 0.0) && (val[2] == 0.0))
1333 if (fabs(val[1]) < 1.0e-6) {
1338 if (val[2]/val[1] > 5.0)
1344 Bool_t newParam =
false;
1345 for (UInt_t i=0; i<3; i++) {
1353 for (UInt_t i=0; i<3; i++)
1370 Double_t wL =
TWO_PI * val[0];
1371 Double_t wL2 = wL*wL;
1372 Double_t nu2 = val[2]*val[2];
1373 Double_t Gamma_t = 2.0*val[1]*val[1]/((wL2+nu2)*(wL2+nu2))*
1375 + (wL2-nu2)*(1.0 - TMath::Exp(-val[2]*t)*TMath::Cos(wL*t))
1376 - 2.0*val[2]*wL*TMath::Exp(-val[2]*t)*TMath::Sin(wL*t));
1377 result = TMath::Exp(-Gamma_t);
1410 for (UInt_t i=0; i<
fParamNo.size(); i++) {
1422 a_t = (t-val[1])*val[0];
1424 return 0.333333333333333 * (1.0 + 2.0*(1.0 - a_t)*TMath::Exp(-a_t));
1454 for (UInt_t i=0; i<
fParamNo.size(); i++) {
1463 if ((val[0] == 0.0) && (val[1] == 0.0))
1468 Bool_t newParam =
false;
1469 for (UInt_t i=0; i<2; i++) {
1477 for (UInt_t i=0; i<2; i++)
1491 if (val[0] < 0.02) {
1492 Double_t at = tt*val[1];
1493 result = 0.333333333333333 * (1.0 + 2.0*(1.0 - at)*TMath::Exp(-at));
1494 }
else if (val[1]/val[0] > 159.1549) {
1495 Double_t at = tt*val[1];
1496 result = 0.333333333333333 * (1.0 + 2.0*(1.0 - at)*TMath::Exp(-at));
1498 Double_t a = val[1];
1500 Double_t w0 = 2.0*TMath::Pi()*val[0];
1501 Double_t a_w0 = a/w0;
1502 Double_t w0t = w0*tt;
1505 if (fabs(w0t) < 0.001) {
1510 j1 = (sin(w0t)-w0t*cos(w0t))/(w0t*w0t);
1513 result = 1.0 - a_w0*j1*exp(-at) - a_w0*a_w0*(j0*exp(-at) - 1.0) -
GetLFIntegralValue(tt);
1546 Double_t result = 0.0;
1551 for (UInt_t i=0; i<
fParamNo.size(); i++) {
1560 if ((val[0] == 0.0) && (val[1] == 0.0) && (val[2] == 0.0))
1580 Double_t w0 = 2.0*TMath::Pi()*val[0];
1581 Double_t a = val[1];
1582 Double_t nu = val[2];
1583 if ((nu > 5.0 * a) || (w0 >= 30.0 * a)) {
1585 const Double_t c[7] = {1.15331, 1.64826, -0.71763, 3.0, 0.386683, -5.01876, 2.41854};
1586 const Double_t d[4] = {2.44056, 2.92063, 1.69581, 0.667277};
1591 for (UInt_t i=1; i<4; i++) {
1592 w0N[i] = w0 * w0N[i-1];
1593 nuN[i] = nu * nuN[i-1];
1595 Double_t denom = w0N[3]+d[0]*w0N[2]*nuN[0]+d[1]*w0N[1]*nuN[1]+d[2]*w0N[0]*nuN[2]+d[3]*nuN[3];
1596 Double_t b1 = (c[0]*w0N[2]+c[1]*w0N[1]*nuN[0]+c[2]*w0N[0]*nuN[1])/denom;
1597 Double_t b2 = (c[3]*w0N[2]+c[4]*w0N[1]*nuN[0]+c[5]*w0N[0]*nuN[1]+c[6]*nuN[2])/denom;
1599 Double_t w0t = w0*tt;
1601 if (fabs(w0t) < 0.001) {
1606 j1 = (sin(w0t)-w0t*cos(w0t))/(w0t*w0t);
1609 Double_t Gamma_t = -4.0/3.0*a*(b1*(1.0-j0*TMath::Exp(-nu*tt))+b2*j1*TMath::Exp(-nu*tt)+(1.0-b2*w0/3.0-b1*nu)*tt);
1611 return TMath::Exp(Gamma_t);
1616 Bool_t newParam =
false;
1617 for (UInt_t i=0; i<3; i++) {
1625 for (UInt_t i=0; i<3; i++)
1660 for (UInt_t i=0; i<
fParamNo.size(); i++) {
1674 Double_t lambdaL_t = tt*val[0];
1675 Double_t lambdaG_t_2 = tt*tt*val[1]*val[1];
1677 return 0.333333333333333 *
1678 (1.0 + 2.0*(1.0-lambdaL_t-lambdaG_t_2)*TMath::Exp(-(lambdaL_t+0.5*lambdaG_t_2)));
1706 for (UInt_t i=0; i<
fParamNo.size(); i++) {
1717 return 0.333333333333333;
1725 Double_t sigma_t = TMath::Power(tt*val[0],val[1]);
1727 return 0.333333333333333 *
1728 (1.0 + 2.0*(1.0-sigma_t)*TMath::Exp(-sigma_t/val[1]));
1750 if (paramValues[
fParamNo[0]] == 0.0)
1758 for (UInt_t i=0; i<
fParamNo.size(); i++) {
1772 Double_t lambda_2 = val[0]*val[0];
1773 Double_t lambda_t_2_q = tt*tt*lambda_2*val[2];
1774 Double_t rate_2 = 4.0*lambda_2*(1.0-val[2])*tt/val[1];
1776 Double_t rateL = TMath::Sqrt(fabs(rate_2));
1777 Double_t rateT = TMath::Sqrt(fabs(rate_2)+lambda_t_2_q);
1779 return 0.333333333333333*(TMath::Exp(-rateL) + 2.0*(1.0-lambda_t_2_q/rateT)*TMath::Exp(-rateT));
1806 for (UInt_t i=0; i<
fParamNo.size(); i++) {
1820 Double_t nu_t = tt*val[0];
1821 Double_t lambda_t = tt*val[1];
1823 return 0.166666666666667*(1.0-0.5*nu_t)*TMath::Exp(-0.5*nu_t) +
1824 0.333333333333333*(1.0-0.25*nu_t)*TMath::Exp(-0.25*(nu_t+2.44949*lambda_t));
1851 for (UInt_t i=0; i<
fParamNo.size(); i++) {
1865 Double_t gamma_t = tt*val[1];
1867 return TMath::Exp(-TMath::Power(val[0]/val[1],2.0)*
1868 (TMath::Exp(-gamma_t)-1.0+gamma_t));
1895 for (UInt_t i=0; i<
fParamNo.size(); i++) {
1936 for (UInt_t i=0; i<
fParamNo.size(); i++) {
1950 return val[0]*TMath::Cos(
DEG_TO_RAD*val[1]+
TWO_PI*val[2]*tt)*TMath::Exp(-val[3]*tt) +
1951 (1-val[0])*TMath::Exp(-val[4]*tt);
1978 for (UInt_t i=0; i<
fParamNo.size(); i++) {
1992 Double_t result = 0.0;
1993 Double_t w_t =
TWO_PI*val[1]*tt;
1994 Double_t rateLF = TMath::Power(val[3]*tt, val[4]);
1995 Double_t rate2 = val[2]*val[2]*tt*tt;
1997 if (val[1] < 0.01) {
1998 result = (1.0-val[0])*TMath::Exp(-rateLF) + val[0]*(1.0-rate2)*TMath::Exp(-0.5*rate2);
2000 result = (1.0-val[0])*TMath::Exp(-rateLF) + val[0]*(TMath::Cos(w_t)-val[2]*val[2]*tt/(
TWO_PI*val[1])*TMath::Sin(w_t))*TMath::Exp(-0.5*rate2);
2030 for (UInt_t i=0; i<
fParamNo.size(); i++) {
2044 Double_t result = 0.0;
2045 Double_t w_t =
TWO_PI*val[1]*tt;
2046 Double_t rateLF = TMath::Power(val[3]*tt, val[4]);
2047 Double_t a_t = val[2]*tt;
2049 if (val[1] < 0.01) {
2050 result = (1.0-val[0])*TMath::Exp(-rateLF) + val[0]*(1.0-a_t)*TMath::Exp(-a_t);
2052 result = (1.0-val[0])*TMath::Exp(-rateLF) + val[0]*(TMath::Cos(w_t)-val[3]/(
TWO_PI*val[1])*TMath::Sin(w_t))*TMath::Exp(-a_t);
2082 for (UInt_t i=0; i<
fParamNo.size(); i++) {
2123 for (UInt_t i=0; i<
fParamNo.size(); i++) {
2138 TMath::Exp(-val[3]*tt) +
2139 (1.0-val[0])*TMath::Exp(-val[4]*tt);
2178 for (UInt_t i = 0; i <
fParamNo.size(); i++) {
2195 Double_t sigma_p = std::abs(val[3]);
2196 Double_t sigma_m = std::abs(val[2]);
2197 Double_t arg_p = sigma_p * tt;
2198 Double_t arg_m = sigma_m * tt;
2201 Double_t g_p = TMath::Exp(-0.5 * arg_p * arg_p);
2202 Double_t g_m = TMath::Exp(-0.5 * arg_m * arg_m);
2203 Double_t w_p = sigma_p / (sigma_p + sigma_m);
2204 Double_t w_m = 1.0 - w_p;
2206 Double_t freq =
TWO_PI * val[1];
2209 Double_t skg_cos = TMath::Cos(phase + freq * tt) * (w_m * g_m + w_p * g_p);
2212 constexpr Double_t z_max = 26.7776;
2219 TMath::Sin(phase + freq * tt) *
2220 ((z_m > z_max) or (z_p > z_max)
2222 : (w_m * g_m * 2.0 * z_m /
SQRT_PI) *
2223 ROOT::Math::conf_hyperg(0.5, 1.5, z_m * z_m) -
2224 (w_p * g_p * 2.0 * z_p /
SQRT_PI) *
2225 ROOT::Math::conf_hyperg(0.5, 1.5, z_p * z_p));
2229 return skg_cos + (std::isfinite(skg_sin) ? skg_sin : 0.0);
2257 Double_t result = 1.0;
2265 for (UInt_t i=0; i<
fParamNo.size(); i++) {
2279 Double_t D2_t2 = val[0]*val[0]*tt*tt;
2280 Double_t denom = 1.0+val[1]*val[1]*D2_t2;
2282 result = 0.333333333333333 + 0.666666666666666667 * TMath::Power(1.0/denom, 1.5) * (1.0 - (D2_t2/denom)) * exp(-0.5*D2_t2/denom);
2312 Double_t result = 1.0;
2320 for (UInt_t i=0; i<
fParamNo.size(); i++) {
2334 Double_t D2_t2 = val[2]*val[2]*tt*tt;
2335 Double_t denom = 1.0+val[3]*val[3]*D2_t2;
2337 result = sqrt(1.0/denom)*exp(-0.5*D2_t2/denom)*TMath::Cos(
DEG_TO_RAD*val[0]+
TWO_PI*val[1]*tt);
2368 Double_t result = 1.0;
2376 for (UInt_t i=0; i<
fParamNo.size(); i++) {
2391 if (val[2] < 1.0e-6) {
2394 theta = (exp(-val[2]*tt) - 1.0 + val[2]*tt)/(val[2]*val[2]);
2396 Double_t denom = 1.0 + 4.0*val[0]*val[0]*val[1]*val[1]*theta;
2398 result = sqrt(1.0/denom)*exp(-2.0*val[0]*val[0]*theta/denom);
2429 Double_t result = 1.0;
2437 for (UInt_t i=0; i<
fParamNo.size(); i++) {
2452 if (val[4] < 1.0e-6) {
2455 theta = (exp(-val[4]*tt) - 1.0 + val[4]*tt)/(val[4]*val[4]);
2457 Double_t denom = 1.0 + 2.0*val[2]*val[2]*val[3]*val[3]*theta;
2459 result = sqrt(1.0/denom)*exp(-val[2]*val[2]*theta/denom)*TMath::Cos(
DEG_TO_RAD*val[0]+
TWO_PI*val[1]*tt);
2482 Double_t result = 0.0;
2483 Double_t tshift = 0.0;
2485 Double_t expo = 0.0;
2488 for (UInt_t i=0; i<
fParamNo.size(); i++) {
2498 result += val*pow(t-tshift, expo);
2546 if (val[0] == 0.0) {
2548 }
else if (val[1]/val[0] > 79.5775) {
2555 Double_t w0 = TMath::TwoPi()*val[0];
2556 Double_t Delta = val[1];
2557 Double_t preFactor = 2.0*TMath::Power(Delta, 4.0) / TMath::Power(w0, 3.0);
2560 const Int_t samplingPerPeriod = 20;
2561 const Int_t samplingOnExp = 3000;
2562 if ((Delta <= w0) && (1.0/val[0] < 20.0)) {
2563 if (1.0/val[0]/samplingPerPeriod < 0.001) {
2564 dt = 1.0/val[0]/samplingPerPeriod;
2566 }
else if ((Delta > w0) && (Delta <= 10.0)) {
2567 if (Delta/w0 > 10.0) {
2570 }
else if ((Delta > w0) && (Delta > 10.0)) {
2571 if (1.0/Delta/samplingOnExp < 0.001) {
2572 dt = 1.0/Delta/samplingOnExp;
2587 Double_t step = 0.0, lastft = 1.0, diff = 0.0;
2590 step = 0.5*dt*preFactor*(exp(-0.5*pow(Delta * (t-dt), 2.0))*sin(w0*(t-dt))+
2591 exp(-0.5*pow(Delta * t, 2.0))*sin(w0*t));
2593 diff = fabs(fabs(lastft)-fabs(ft));
2596 }
while ((t <= 20.0) && (diff > 1.0e-10));
2617 if (val[0] < 0.02) {
2619 }
else if (val[1]/val[0] > 159.1549) {
2625 Double_t w0 = TMath::TwoPi()*val[0];
2626 Double_t a = val[1];
2627 Double_t preFactor = a*(1+pow(a/w0,2.0));
2630 const Int_t samplingPerPeriod = 20;
2631 const Int_t samplingOnExp = 3000;
2632 if ((a <= w0) && (1.0/val[0] < 20.0)) {
2633 if (1.0/val[0]/samplingPerPeriod < 0.001) {
2634 dt = 1.0/val[0]/samplingPerPeriod;
2636 }
else if ((a > w0) && (a <= 10.0)) {
2640 }
else if ((a > w0) && (a > 10.0)) {
2641 if (1.0/a/samplingOnExp < 0.001) {
2642 dt = 1.0/a/samplingOnExp;
2659 ft += 0.5*dt*preFactor*(1.0+sin(w0*t)/(w0*t)*exp(-a*t));
2662 Double_t step = 0.0, lastft = 1.0, diff = 0.0;
2665 step = 0.5*dt*preFactor*(sin(w0*(t-dt))/(w0*(t-dt))*exp(-a*(t-dt))+sin(w0*t)/(w0*t)*exp(-a*t));
2667 diff = fabs(fabs(lastft)-fabs(ft));
2670 }
while ((t <= 20.0) && (diff > 1.0e-10));
2712 const Double_t Tmax = 20.0;
2713 UInt_t N =
static_cast<UInt_t
>(16.0*Tmax*val[0]);
2716 if (fabs(val[1]) > 0.1) {
2717 Double_t tmin = 20.0;
2720 tmin = fabs(sqrt(3.0)/val[1]);
2723 tmin = fabs(2.0/val[1]);
2728 UInt_t Nrate =
static_cast<UInt_t
>(25.0 * Tmax / tmin);
2753 std::cerr << std::endl <<
">> PTheory::CalculateDynKTLF: **FATAL ERROR** You should never have reached this point." << std::endl;
2761 Double_t dt = Tmax/N;
2763 for (UInt_t i=0; i<N; i++) {
2766 if (val[0] < 0.02) {
2767 Double_t sigma_t_2 = t*t*val[1]*val[1];
2768 p0exp[i] = 0.333333333333333 * (1.0 + 2.0*(1.0 - sigma_t_2)*TMath::Exp(-0.5*sigma_t_2));
2769 }
else if (val[1]/val[0] > 79.5775) {
2770 Double_t sigma_t_2 = t*t*val[1]*val[1];
2771 p0exp[i] = 0.333333333333333 * (1.0 + 2.0*(1.0 - sigma_t_2)*TMath::Exp(-0.5*sigma_t_2));
2773 Double_t delta = val[1];
2774 Double_t w0 =
TWO_PI*val[0];
2776 p0exp[i] = 1.0 - 2.0*TMath::Power(delta/w0,2.0)*(1.0 -
2777 TMath::Exp(-0.5*TMath::Power(delta*t, 2.0))*TMath::Cos(w0*t)) +
2782 if (val[0] < 0.02) {
2783 Double_t at = t*val[1];
2784 p0exp[i] = 0.333333333333333 * (1.0 + 2.0*(1.0 - at)*TMath::Exp(-at));
2785 }
else if (val[1]/val[0] > 159.1549) {
2786 Double_t at = t*val[1];
2787 p0exp[i] = 0.333333333333333 * (1.0 + 2.0*(1.0 - at)*TMath::Exp(-at));
2789 Double_t a = val[1];
2791 Double_t w0 =
TWO_PI*val[0];
2792 Double_t a_w0 = a/w0;
2793 Double_t w0t = w0*t;
2796 if (fabs(w0t) < 0.001) {
2801 j1 = (sin(w0t)-w0t*cos(w0t))/(w0t*w0t);
2804 p0exp[i] = 1.0 - a_w0*j1*exp(-at) - a_w0*a_w0*(j0*exp(-at) - 1.0) -
GetLFIntegralValue(t);
2810 p0exp[i] *= TMath::Exp(-val[2]*t);
2819 Double_t preFactor = dt*val[2];
2820 for (UInt_t i=1; i<N; i++) {
2823 for (UInt_t j=1; j<i; j++) {
2826 a = 1.0-0.5*preFactor*p0exp[0];
2848 UInt_t idx =
static_cast<UInt_t
>(t/
fDynLFdt);
2882 for (UInt_t i=0; i<
fParamNo.size(); i++) {
2896 return val[0]*exp(-tt/val[1])*(1.0+val[2]*exp(-val[3]*tt)*cos(
TWO_PI*val[5]*tt+
DEG_TO_RAD*val[4]));
virtual Double_t StaticGaussKTLF(Double_t t, const PDoubleVector ¶mValues, const PDoubleVector &funcValues) const
PUserFcnBase * fUserFcn
pointer to the user function object
PTheory(PMsrHandler *msrInfo, UInt_t runNo, const Bool_t hasParent=false)
virtual Double_t DynamicNKZF(Double_t t, const PDoubleVector ¶mValues, const PDoubleVector &funcValues) const
#define THEORY_GENERAL_EXP
virtual Double_t StaticGaussKT(Double_t t, const PDoubleVector ¶mValues, const PDoubleVector &funcValues) const
virtual Double_t StrKT(Double_t t, const PDoubleVector ¶mValues, const PDoubleVector &funcValues) const
virtual void MakeCleanAndTidyTheoryBlock(PMsrLines *fullTheoryBlock)
#define THEORY_INTERNAL_FIELD_KORNILOV
virtual Double_t Polynom(Double_t t, const PDoubleVector ¶mValues, const PDoubleVector &funcValues) const
virtual Bool_t GlobalPartIsValid() const
if a user function is using a global part, this function returns if the global object part is valid (...
virtual Int_t SearchDataBase(TString name)
virtual Double_t SkewedGauss(Double_t t, const PDoubleVector ¶mValues, const PDoubleVector &funcValues) const
virtual void MakeCleanAndTidyPolynom(UInt_t i, PMsrLines *fullTheoryBlock)
virtual Double_t Bessel(Double_t t, const PDoubleVector ¶mValues, const PDoubleVector &funcValues) const
virtual Double_t DynamicLorentzKTLF(Double_t t, const PDoubleVector ¶mValues, const PDoubleVector &funcValues) const
#define THEORY_STATIC_GAUSS_KT
TString fComment
comment added in the msr-file theory block to help the used
PTheory * fMul
pointers to the add-sub-function or the multiply-sub-function
virtual Double_t MuMinusExpTF(Double_t t, const PDoubleVector ¶mValues, const PDoubleVector &funcValues) const
#define THEORY_STATIC_LORENTZ_KT
TString fUserFcnClassName
name of the user function class for within root
#define THEORY_DYNAMIC_GAUSS_KT_LF
#define THEORY_SIMPLE_GAUSS
PDoubleVector fUserParam
vector holding the resolved user function parameters, i.e. map and function resolved.
virtual Double_t InternalField(Double_t t, const PDoubleVector ¶mValues, const PDoubleVector &funcValues) const
UInt_t fNoOfParam
number of parameters for the given function
std::vector< Int_t > PIntVector
virtual UInt_t GetFuncIndex(Int_t funNo)
virtual Double_t Func(Double_t t, const PDoubleVector ¶mValues, const PDoubleVector &funcValues) const
virtual Double_t StaticNKTF(Double_t t, const PDoubleVector ¶mValues, const PDoubleVector &funcValues) const
virtual Double_t UserFcn(Double_t t, const PDoubleVector ¶mValues, const PDoubleVector &funcValues) const
std::vector< Double_t > PDoubleVector
virtual Int_t GetUserFcnIdx(UInt_t lineNo) const
#define THEORY_STATIC_TF_NK
virtual Double_t TFCos(Double_t t, const PDoubleVector ¶mValues, const PDoubleVector &funcValues) const
virtual PMsrRunList * GetMsrRunList()
#define MSR_PARAM_FUN_OFFSET
TString fName
name of the function as written into the msr-file
virtual void CalculateGaussLFIntegral(const Double_t *val) const
virtual void CalculateLorentzLFIntegral(const Double_t *val) const
Int_t fUserFcnIdx
index of the user function within the theory tree
virtual Bool_t NeedGlobalPart() const
if a user function needs a global part this function should return true, otherwise false (default: fa...
#define THEORY_STATIC_ZF_NK
TString fUserFcnSharedLibName
name of the shared lib to which the user function belongs
virtual Double_t GetDynKTLFValue(const Double_t t) const
#define THEORY_DYNAMIC_ZF_NK
virtual Double_t SimpleGauss(Double_t t, const PDoubleVector ¶mValues, const PDoubleVector &funcValues) const
PDoubleVector fDynLFFuncValue
needed for LF. Keeps the dynamic LF KT function values
virtual Double_t DynamicGaussKTLF(Double_t t, const PDoubleVector ¶mValues, const PDoubleVector &funcValues) const
#define THEORY_MU_MINUS_EXP
Int_t fLineNo
original line number of the msr-file
#define THEORY_RANDOM_ANISOTROPIC_HYPERFINE
virtual Double_t StaticLorentzKTLF(Double_t t, const PDoubleVector ¶mValues, const PDoubleVector &funcValues) const
#define THEORY_COMBI_LGKT
std::vector< PMsrLineStructure > PMsrLines
virtual Double_t GetLFIntegralValue(const Double_t t) const
TString fLine
msr-file line
virtual Double_t StaticNKZF(Double_t t, const PDoubleVector ¶mValues, const PDoubleVector &funcValues) const
std::vector< void * > gGlobalUserFcn
virtual void MakeCleanAndTidyUserFcn(UInt_t i, PMsrLines *fullTheoryBlock)
PMsrHandler * fMsrInfo
pointer to the msr-file handler
virtual Double_t InternalFieldLL(Double_t t, const PDoubleVector ¶mValues, const PDoubleVector &funcValues) const
virtual void SetGlobalPart(std::vector< void *> &globalPart, UInt_t idx)
if a user function is using a global part, this function is used to invoke and retrieve the proper gl...
#define THEORY_STATIC_LORENTZ_KT_LF
virtual Double_t GeneralExp(Double_t t, const PDoubleVector ¶mValues, const PDoubleVector &funcValues) const
virtual Double_t SimpleExp(Double_t t, const PDoubleVector ¶mValues, const PDoubleVector &funcValues) const
virtual void CalculateDynKTLF(const Double_t *val, Int_t tag) const
Double_t fSamplingTime
needed for LF. Keeps the sampling time of the non-analytic integral
virtual Double_t DynamicNKTF(Double_t t, const PDoubleVector ¶mValues, const PDoubleVector &funcValues) const
virtual Double_t Asymmetry(const PDoubleVector ¶mValues, const PDoubleVector &funcValues) const
virtual PMsrLines * GetMsrTheory()
#define THEORY_DYNAMIC_LORENTZ_KT_LF
virtual Double_t Abragam(Double_t t, const PDoubleVector ¶mValues, const PDoubleVector &funcValues) const
virtual Double_t InternalBessel(Double_t t, const PDoubleVector ¶mValues, const PDoubleVector &funcValues) const
Bool_t fValid
flag to tell if the theory is valid
virtual Double_t RandomAnisotropicHyperfine(Double_t t, const PDoubleVector ¶mValues, const PDoubleVector &funcValues) const
virtual Double_t CombiLGKT(Double_t t, const PDoubleVector ¶mValues, const PDoubleVector &funcValues) const
virtual Double_t InternalFieldGK(Double_t t, const PDoubleVector ¶mValues, const PDoubleVector &funcValues) const
static PTheoDataBase fgTheoDataBase[THEORY_MAX]
#define THEORY_STATIC_GAUSS_KT_LF
#define THEORY_INTERNAL_FIELD
UInt_t fNoOfParam
number of parameters for this function
PDoubleVector fLFIntegral
needed for LF. Keeps the non-analytic integral values
#define THEORY_SPIN_GLASS
#define THEORY_SKEWED_GAUSS
#define THEORY_INTERNAL_FIELD_LARKIN
#define THEORY_INTERNAL_BESSEL
std::vector< UInt_t > fParamNo
holds the parameter numbers for the theory (including maps and functions, see constructor desciption)...
Double_t fPrevParam[THEORY_MAX_PARAM]
needed for LF. Keeps the previous fitting parameters
virtual Double_t SpinGlass(Double_t t, const PDoubleVector ¶mValues, const PDoubleVector &funcValues) const
virtual Double_t Constant(const PDoubleVector ¶mValues, const PDoubleVector &funcValues) const
#define THEORY_DYNAMIC_TF_NK
#define THEORY_SIMPLE_EXP
virtual void CleanUp(PTheory *theo)
Double_t fDynLFdt
needed for LF. Keeps the time step for the dynamic LF calculation, used in the integral equation appr...
virtual Double_t StaticLorentzKT(Double_t t, const PDoubleVector ¶mValues, const PDoubleVector &funcValues) const
TString fCommentTimeShift
comment added in the msr-file theory block if there is a time shift