68 TAttLine::operator=(sp);
69 TAttFill::operator=(sp);
70 TAttMarker::operator=(sp);
134 pmin =
gPad->PadtoX(
gPad->GetUxmin());
135 pmax =
gPad->PadtoX(
gPad->GetUxmax());
139 if (
xmax < pmin)
return;
140 if (
xmin > pmax)
return;
164 for (i=0;i<=
fNpx;i++) {
165 xbins[i] =
gPad->PadtoX(xlogmin+ i*dlogx);
176 for (i=1;i<=
fNpx;i++) {
194 char *o = (
char *) opt.
Data();
199 if(o[i]==
'p') graph=
kTRUE ;
else o[j++]=o[i];
357 fValBeg(valbeg), fValEnd(valend), fBegCond(0), fEndCond(0)
367 for (
Int_t i=0; i<
n; ++i) {
386 fValBeg(valbeg), fValEnd(valend),
387 fBegCond(0), fEndCond(0)
397 for (
Int_t i=0; i<
n; ++i) {
415 fValBeg(valbeg), fValEnd(valend),
416 fBegCond(0), fEndCond(0)
426 for (
Int_t i=0; i<
n; ++i) {
442 const TF1 *func,
Int_t n,
const char *opt,
445 fValBeg(valbeg), fValEnd(valend),
446 fBegCond(0), fEndCond(0)
459 for (
Int_t i=0; i<
n; ++i) {
475 const TGraph *
g,
const char *opt,
478 fValBeg(valbeg), fValEnd(valend),
479 fBegCond(0), fEndCond(0)
491 g->GetPoint(i,xx,yy);
508 fValBeg(valbeg), fValEnd(valend),
509 fBegCond(0), fEndCond(0)
520 fPoly[i].
X()=
h->GetXaxis()->GetBinCenter(i+1);
521 fPoly[i].
Y()=
h->GetBinContent(i+1);
534 :
TSpline(sp3), fValBeg(sp3.fValBeg), fValEnd(sp3.fValEnd), fBegCond(sp3.fBegCond), fEndCond(sp3.fEndCond)
571 const char *b1 = strstr(opt,
"b1");
572 const char *e1 = strstr(opt,
"e1");
573 const char *b2 = strstr(opt,
"b2");
574 const char *e2 = strstr(opt,
"e2");
576 Error(
"SetCond",
"Cannot specify first and second derivative at first point");
578 Error(
"SetCond",
"Cannot specify first and second derivative at last point");
618 printf(
"1 TEST OF TSpline3 WITH NONEQUIDISTANT KNOTS\n");
633 printf(
"\n-N = %3d M =%2d\n",
n,
m);
635 for (i = 0; i <
n; ++i)
636 spline->
GetCoeff(i,hx,
a[i],
a[i+200],
a[i+400],
a[i+600]);
638 for (i = 0; i < mm1; ++i) diff[i] = com[i] = 0;
639 for (k = 0; k <
n; ++k) {
640 for (i = 0; i < mm; ++i)
c[i] =
a[k+i*200];
641 printf(
" ---------------------------------------%3d --------------------------------------------\n",k+1);
642 printf(
"%12.8f\n",
x[k]);
644 printf(
"%16.8f\n",
c[0]);
646 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
648 for (i = 0; i < mm1; ++i)
649 if ((z=
TMath::Abs(
a[k+i*200])) > com[i]) com[i] = z;
651 for (i = 1; i < mm; ++i)
652 for (jj = i; jj < mm; ++jj) {
654 c[j-2] =
c[j-1]*z+
c[j-2];
656 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
658 for (i = 0; i < mm1; ++i)
659 if (!(k >=
n-2 && i != 0))
661 > diff[i]) diff[i] = z;
664 printf(
" MAXIMUM ABSOLUTE VALUES OF DIFFERENCES \n");
665 for (i = 0; i < mm1; ++i) printf(
"%18.9E",diff[i]);
667 printf(
" MAXIMUM ABSOLUTE VALUES OF COEFFICIENTS \n");
670 for (i = 0; i < mm1; ++i) printf(
"%16.8f",com[i]);
673 for (
n = 10;
n <= 100;
n += 10) {
677 for (i = 0; i < nm1; i += 2) {
687 printf(
"\n-N = %3d M =%2d\n",
n,
m);
689 for (i = 0; i <
n; ++i)
692 for (i = 0; i < mm1; ++i)
693 diff[i] = com[i] = 0;
694 for (k = 0; k <
n; ++k) {
695 for (i = 0; i < mm; ++i)
698 printf(
" ---------------------------------------%3d --------------------------------------------\n",k+1);
699 printf(
"%12.8f\n",
x[k]);
700 if (k ==
n-1) printf(
"%16.8f\n",
c[0]);
704 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
707 for (i = 0; i < mm1; ++i)
711 for (i = 1; i < mm; ++i)
712 for (jj = i; jj < mm; ++jj) {
714 c[j-2] =
c[j-1]*z+
c[j-2];
717 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
720 for (i = 0; i < mm1; ++i)
721 if (!(k >=
n-2 && i != 0))
723 > diff[i]) diff[i] = z;
725 printf(
" MAXIMUM ABSOLUTE VALUES OF DIFFERENCES \n");
726 for (i = 0; i < mm1; ++i) printf(
"%18.9E",diff[i]);
728 printf(
" MAXIMUM ABSOLUTE VALUES OF COEFFICIENTS \n");
731 for (i = 0; i < mm1; ++i) printf(
"%16.8E",com[i]);
746 else if(
x>=
fXmax) klow=khig;
755 else if (klow < khig) {
756 if (
x >
fPoly[klow+1].
X()) ++klow;
763 if(
x>
fPoly[khalf=(klow+khig)/2].
X())
771 "Binary search failed x(%d) = %f < x= %f < x(%d) = %f\n",
784 if (klow >=
fNp-1 &&
fNp > 1) klow =
fNp-2;
794 if (klow >=
fNp-1) klow =
fNp-2;
805 std::ofstream *
f =
new std::ofstream(
filename,std::ios::out);
814 snprintf(buffer,512,
"double %s",
filename);
815 char *dot = strstr(buffer,
".");
817 strlcat(buffer,
"(double x) {\n",512);
818 nch = strlen(buffer);
f->write(buffer,nch);
819 snprintf(buffer,512,
" const int fNp = %d, fKstep = %d;\n",
fNp,
fKstep);
820 nch = strlen(buffer);
f->write(buffer,nch);
821 snprintf(buffer,512,
" const double fDelta = %.17g, fXmin = %.17g, fXmax = %.17g;\n",
fDelta,
fXmin,
fXmax);
822 nch = strlen(buffer);
f->write(buffer,nch);
826 snprintf(buffer,512,
" const double fX[%d] = {",
fNp);
827 nch = strlen(buffer);
f->write(buffer,nch);
831 for (i=0;i<
fNp;i++) {
832 snprintf(numb,30,
" %.17g,",
fPoly[i].
X());
834 if (i ==
fNp-1) numb[nch-1]=0;
835 strlcat(buffer,numb,512);
836 if (i%5 == 4 || i ==
fNp-1) {
837 nch = strlen(buffer);
f->write(buffer,nch);
838 if (i !=
fNp-1) snprintf(buffer,512,
"\n ");
841 snprintf(buffer,512,
" };\n");
842 nch = strlen(buffer);
f->write(buffer,nch);
844 snprintf(buffer,512,
" const double fY[%d] = {",
fNp);
845 nch = strlen(buffer);
f->write(buffer,nch);
847 for (i=0;i<
fNp;i++) {
848 snprintf(numb,30,
" %.17g,",
fPoly[i].Y());
850 if (i ==
fNp-1) numb[nch-1]=0;
851 strlcat(buffer,numb,512);
852 if (i%5 == 4 || i ==
fNp-1) {
853 nch = strlen(buffer);
f->write(buffer,nch);
854 if (i !=
fNp-1) snprintf(buffer,512,
"\n ");
857 snprintf(buffer,512,
" };\n");
858 nch = strlen(buffer);
f->write(buffer,nch);
860 snprintf(buffer,512,
" const double fB[%d] = {",
fNp);
861 nch = strlen(buffer);
f->write(buffer,nch);
863 for (i=0;i<
fNp;i++) {
864 snprintf(numb,30,
" %.17g,",
fPoly[i].B());
866 if (i ==
fNp-1) numb[nch-1]=0;
867 strlcat(buffer,numb,512);
868 if (i%5 == 4 || i ==
fNp-1) {
869 nch = strlen(buffer);
f->write(buffer,nch);
870 if (i !=
fNp-1) snprintf(buffer,512,
"\n ");
873 snprintf(buffer,512,
" };\n");
874 nch = strlen(buffer);
f->write(buffer,nch);
876 snprintf(buffer,512,
" const double fC[%d] = {",
fNp);
877 nch = strlen(buffer);
f->write(buffer,nch);
879 for (i=0;i<
fNp;i++) {
880 snprintf(numb,30,
" %.17g,",
fPoly[i].C());
882 if (i ==
fNp-1) numb[nch-1]=0;
883 strlcat(buffer,numb,512);
884 if (i%5 == 4 || i ==
fNp-1) {
885 nch = strlen(buffer);
f->write(buffer,nch);
886 if (i !=
fNp-1) snprintf(buffer,512,
"\n ");
889 snprintf(buffer,512,
" };\n");
890 nch = strlen(buffer);
f->write(buffer,nch);
892 snprintf(buffer,512,
" const double fD[%d] = {",
fNp);
893 nch = strlen(buffer);
f->write(buffer,nch);
895 for (i=0;i<
fNp;i++) {
896 snprintf(numb,30,
" %.17g,",
fPoly[i].D());
898 if (i ==
fNp-1) numb[nch-1]=0;
899 strlcat(buffer,numb,512);
900 if (i%5 == 4 || i ==
fNp-1) {
901 nch = strlen(buffer);
f->write(buffer,nch);
902 if (i !=
fNp-1) snprintf(buffer,512,
"\n ");
905 snprintf(buffer,512,
" };\n");
906 nch = strlen(buffer);
f->write(buffer,nch);
909 snprintf(buffer,512,
" int klow=0;\n");
910 nch = strlen(buffer);
f->write(buffer,nch);
912 snprintf(buffer,512,
" // If out of boundaries, extrapolate. It may be badly wrong\n");
913 snprintf(buffer,512,
" if(x<=fXmin) klow=0;\n");
914 nch = strlen(buffer);
f->write(buffer,nch);
915 snprintf(buffer,512,
" else if(x>=fXmax) klow=fNp-1;\n");
916 nch = strlen(buffer);
f->write(buffer,nch);
917 snprintf(buffer,512,
" else {\n");
918 nch = strlen(buffer);
f->write(buffer,nch);
919 snprintf(buffer,512,
" if(fKstep) {\n");
920 nch = strlen(buffer);
f->write(buffer,nch);
922 snprintf(buffer,512,
" // Equidistant knots, use histogramming\n");
923 nch = strlen(buffer);
f->write(buffer,nch);
924 snprintf(buffer,512,
" klow = int((x-fXmin)/fDelta);\n");
925 nch = strlen(buffer);
f->write(buffer,nch);
926 snprintf(buffer,512,
" if (klow > fNp-1) klow = fNp-1;\n");
927 nch = strlen(buffer);
f->write(buffer,nch);
928 snprintf(buffer,512,
" } else {\n");
929 nch = strlen(buffer);
f->write(buffer,nch);
930 snprintf(buffer,512,
" int khig=fNp-1, khalf;\n");
931 nch = strlen(buffer);
f->write(buffer,nch);
933 snprintf(buffer,512,
" // Non equidistant knots, binary search\n");
934 nch = strlen(buffer);
f->write(buffer,nch);
935 snprintf(buffer,512,
" while(khig-klow>1)\n");
936 nch = strlen(buffer);
f->write(buffer,nch);
937 snprintf(buffer,512,
" if(x>fX[khalf=(klow+khig)/2]) klow=khalf;\n");
938 nch = strlen(buffer);
f->write(buffer,nch);
939 snprintf(buffer,512,
" else khig=khalf;\n");
940 nch = strlen(buffer);
f->write(buffer,nch);
941 snprintf(buffer,512,
" }\n");
942 nch = strlen(buffer);
f->write(buffer,nch);
943 snprintf(buffer,512,
" }\n");
944 nch = strlen(buffer);
f->write(buffer,nch);
945 snprintf(buffer,512,
" // Evaluate now\n");
946 nch = strlen(buffer);
f->write(buffer,nch);
947 snprintf(buffer,512,
" double dx=x-fX[klow];\n");
948 nch = strlen(buffer);
f->write(buffer,nch);
949 snprintf(buffer,512,
" return (fY[klow]+dx*(fB[klow]+dx*(fC[klow]+dx*fD[klow])));\n");
950 nch = strlen(buffer);
f->write(buffer,nch);
955 if (
f) {
f->close();
delete f;}
974 out <<
" spline3->SetNpx(" <<
fNpx <<
");\n";
977 out <<
" spline3->SetPoint(" << i <<
"," <<
fPoly[i].
X() <<
"," <<
fPoly[i].
Y() <<
");\n";
978 out <<
" spline3->SetPointCoeff(" << i <<
"," <<
fPoly[i].
B() <<
"," <<
fPoly[i].
C() <<
"," <<
fPoly[i].
D()
990 if (i < 0 || i >=
fNp)
return;
1000 if (i < 0 || i >=
fNp)
return;
1085 for (
m=1;
m<
l; ++
m) {
1154 for (i=1; i<
fNp; ++i) {
1158 fPoly[i-1].
C() = (divdf1 -
fPoly[i-1].
B() - divdf3)/dtau;
1159 fPoly[i-1].
D() = (divdf3/dtau)/dtau;
1213 const char *cb1, *ce1, *cb2, *ce2;
1222 for (
Int_t i=0; i<
n; ++i) {
1247 const char *cb1, *ce1, *cb2, *ce2;
1256 for (
Int_t i=0; i<
n; ++i) {
1280 const char *cb1, *ce1, *cb2, *ce2;
1289 for (
Int_t i=0; i<
n; i++) {
1314 const char *cb1, *ce1, *cb2, *ce2;
1323 for (
Int_t i=0; i<
n; ++i) {
1326 if (func)
fPoly[i+beg].
Y() = ((
TF1*)func)->Eval(
x);
1349 const char *cb1, *ce1, *cb2, *ce2;
1360 g->GetPoint(i,xx,yy);
1383 const char *cb1, *ce1, *cb2, *ce2;
1393 fPoly[i+beg].
X()=
h->GetXaxis()->GetBinCenter(i+1);
1394 fPoly[i+beg].
Y()=
h->GetBinContent(i+1);
1441 const char *&cb1,
const char *&ce1,
1442 const char *&cb2,
const char *&ce2)
1444 cb1=ce1=cb2=ce2=
nullptr;
1447 cb1 = strstr(opt,
"b1");
1448 ce1 = strstr(opt,
"e1");
1449 cb2 = strstr(opt,
"b2");
1450 ce2 = strstr(opt,
"e2");
1472 const char *cb1,
const char *ce1,
const char *cb2,
1538 if(
x>
fPoly[khalf=(klow+khig)/2].
X())
1547 "Binary search failed x(%d) = %f < x(%d) = %f\n",
1578 std::ofstream *
f =
new std::ofstream(
filename,std::ios::out);
1587 snprintf(buffer,512,
"double %s",
filename);
1588 char *dot = strstr(buffer,
".");
1590 strlcat(buffer,
"(double x) {\n",512);
1591 nch = strlen(buffer);
f->write(buffer,nch);
1592 snprintf(buffer,512,
" const int fNp = %d, fKstep = %d;\n",
fNp,
fKstep);
1593 nch = strlen(buffer);
f->write(buffer,nch);
1594 snprintf(buffer,512,
" const double fDelta = %.17g, fXmin = %.17g, fXmax = %.17g;\n",
fDelta,
fXmin,
fXmax);
1595 nch = strlen(buffer);
f->write(buffer,nch);
1599 snprintf(buffer,512,
" const double fX[%d] = {",
fNp);
1600 nch = strlen(buffer);
f->write(buffer,nch);
1604 for (i=0;i<
fNp;i++) {
1605 snprintf(numb,30,
" %.17g,",
fPoly[i].
X());
1607 if (i ==
fNp-1) numb[nch-1]=0;
1608 strlcat(buffer,numb,512);
1609 if (i%5 == 4 || i ==
fNp-1) {
1610 nch = strlen(buffer);
f->write(buffer,nch);
1611 if (i !=
fNp-1) snprintf(buffer,512,
"\n ");
1614 snprintf(buffer,512,
" };\n");
1615 nch = strlen(buffer);
f->write(buffer,nch);
1617 snprintf(buffer,512,
" const double fY[%d] = {",
fNp);
1618 nch = strlen(buffer);
f->write(buffer,nch);
1620 for (i=0;i<
fNp;i++) {
1621 snprintf(numb,30,
" %.17g,",
fPoly[i].Y());
1623 if (i ==
fNp-1) numb[nch-1]=0;
1624 strlcat(buffer,numb,512);
1625 if (i%5 == 4 || i ==
fNp-1) {
1626 nch = strlen(buffer);
f->write(buffer,nch);
1627 if (i !=
fNp-1) snprintf(buffer,512,
"\n ");
1630 snprintf(buffer,512,
" };\n");
1631 nch = strlen(buffer);
f->write(buffer,nch);
1633 snprintf(buffer,512,
" const double fB[%d] = {",
fNp);
1634 nch = strlen(buffer);
f->write(buffer,nch);
1636 for (i=0;i<
fNp;i++) {
1637 snprintf(numb,30,
" %.17g,",
fPoly[i].B());
1639 if (i ==
fNp-1) numb[nch-1]=0;
1640 strlcat(buffer,numb,512);
1641 if (i%5 == 4 || i ==
fNp-1) {
1642 nch = strlen(buffer);
f->write(buffer,nch);
1643 if (i !=
fNp-1) snprintf(buffer,512,
"\n ");
1646 snprintf(buffer,512,
" };\n");
1647 nch = strlen(buffer);
f->write(buffer,nch);
1649 snprintf(buffer,512,
" const double fC[%d] = {",
fNp);
1650 nch = strlen(buffer);
f->write(buffer,nch);
1652 for (i=0;i<
fNp;i++) {
1653 snprintf(numb,30,
" %.17g,",
fPoly[i].C());
1655 if (i ==
fNp-1) numb[nch-1]=0;
1656 strlcat(buffer,numb,512);
1657 if (i%5 == 4 || i ==
fNp-1) {
1658 nch = strlen(buffer);
f->write(buffer,nch);
1659 if (i !=
fNp-1) snprintf(buffer,512,
"\n ");
1662 snprintf(buffer,512,
" };\n");
1663 nch = strlen(buffer);
f->write(buffer,nch);
1665 snprintf(buffer,512,
" const double fD[%d] = {",
fNp);
1666 nch = strlen(buffer);
f->write(buffer,nch);
1668 for (i=0;i<
fNp;i++) {
1669 snprintf(numb,30,
" %.17g,",
fPoly[i].D());
1671 if (i ==
fNp-1) numb[nch-1]=0;
1672 strlcat(buffer,numb,512);
1673 if (i%5 == 4 || i ==
fNp-1) {
1674 nch = strlen(buffer);
f->write(buffer,nch);
1675 if (i !=
fNp-1) snprintf(buffer,512,
"\n ");
1678 snprintf(buffer,512,
" };\n");
1679 nch = strlen(buffer);
f->write(buffer,nch);
1681 snprintf(buffer,512,
" const double fE[%d] = {",
fNp);
1682 nch = strlen(buffer);
f->write(buffer,nch);
1684 for (i=0;i<
fNp;i++) {
1685 snprintf(numb,30,
" %.17g,",
fPoly[i].E());
1687 if (i ==
fNp-1) numb[nch-1]=0;
1688 strlcat(buffer,numb,512);
1689 if (i%5 == 4 || i ==
fNp-1) {
1690 nch = strlen(buffer);
f->write(buffer,nch);
1691 if (i !=
fNp-1) snprintf(buffer,512,
"\n ");
1694 snprintf(buffer,512,
" };\n");
1695 nch = strlen(buffer);
f->write(buffer,nch);
1697 snprintf(buffer,512,
" const double fF[%d] = {",
fNp);
1698 nch = strlen(buffer);
f->write(buffer,nch);
1700 for (i=0;i<
fNp;i++) {
1701 snprintf(numb,30,
" %.17g,",
fPoly[i].F());
1703 if (i ==
fNp-1) numb[nch-1]=0;
1704 strlcat(buffer,numb,512);
1705 if (i%5 == 4 || i ==
fNp-1) {
1706 nch = strlen(buffer);
f->write(buffer,nch);
1707 if (i !=
fNp-1) snprintf(buffer,512,
"\n ");
1710 snprintf(buffer,512,
" };\n");
1711 nch = strlen(buffer);
f->write(buffer,nch);
1714 snprintf(buffer,512,
" int klow=0;\n");
1715 nch = strlen(buffer);
f->write(buffer,nch);
1717 snprintf(buffer,512,
" // If out of boundaries, extrapolate. It may be badly wrong\n");
1718 snprintf(buffer,512,
" if(x<=fXmin) klow=0;\n");
1719 nch = strlen(buffer);
f->write(buffer,nch);
1720 snprintf(buffer,512,
" else if(x>=fXmax) klow=fNp-1;\n");
1721 nch = strlen(buffer);
f->write(buffer,nch);
1722 snprintf(buffer,512,
" else {\n");
1723 nch = strlen(buffer);
f->write(buffer,nch);
1724 snprintf(buffer,512,
" if(fKstep) {\n");
1725 nch = strlen(buffer);
f->write(buffer,nch);
1727 snprintf(buffer,512,
" // Equidistant knots, use histogramming\n");
1728 nch = strlen(buffer);
f->write(buffer,nch);
1729 snprintf(buffer,512,
" klow = int((x-fXmin)/fDelta);\n");
1730 nch = strlen(buffer);
f->write(buffer,nch);
1731 snprintf(buffer,512,
" if (klow > fNp-1) klow = fNp-1;\n");
1732 nch = strlen(buffer);
f->write(buffer,nch);
1733 snprintf(buffer,512,
" } else {\n");
1734 nch = strlen(buffer);
f->write(buffer,nch);
1735 snprintf(buffer,512,
" int khig=fNp-1, khalf;\n");
1736 nch = strlen(buffer);
f->write(buffer,nch);
1738 snprintf(buffer,512,
" // Non equidistant knots, binary search\n");
1739 nch = strlen(buffer);
f->write(buffer,nch);
1740 snprintf(buffer,512,
" while(khig-klow>1)\n");
1741 nch = strlen(buffer);
f->write(buffer,nch);
1742 snprintf(buffer,512,
" if(x>fX[khalf=(klow+khig)/2]) klow=khalf;\n");
1743 nch = strlen(buffer);
f->write(buffer,nch);
1744 snprintf(buffer,512,
" else khig=khalf;\n");
1745 nch = strlen(buffer);
f->write(buffer,nch);
1746 snprintf(buffer,512,
" }\n");
1747 nch = strlen(buffer);
f->write(buffer,nch);
1748 snprintf(buffer,512,
" }\n");
1749 nch = strlen(buffer);
f->write(buffer,nch);
1750 snprintf(buffer,512,
" // Evaluate now\n");
1751 nch = strlen(buffer);
f->write(buffer,nch);
1752 snprintf(buffer,512,
" double dx=x-fX[klow];\n");
1753 nch = strlen(buffer);
f->write(buffer,nch);
1754 snprintf(buffer,512,
" return (fY[klow]+dx*(fB[klow]+dx*(fC[klow]+dx*(fD[klow]+dx*(fE[klow]+dx*fF[klow])))));\n");
1755 nch = strlen(buffer);
f->write(buffer,nch);
1760 if (
f) {
f->close();
delete f;}
1774 TString::Format(
"\"%s\", %g, %g, (TF1 *)nullptr, %d, \"\", %g, %g, %g, %g",
1784 out <<
" spline5->SetNpx(" <<
fNpx <<
");\n";
1787 out <<
" spline5->SetPoint(" << i <<
"," <<
fPoly[i].
X() <<
"," <<
fPoly[i].
Y() <<
");\n";
1788 out <<
" spline5->SetPointCoeff(" << i <<
"," <<
fPoly[i].
B() <<
"," <<
fPoly[i].
C() <<
"," <<
fPoly[i].
D()
1789 <<
"," <<
fPoly[i].
E() <<
"," <<
fPoly[i].
F() <<
");\n";
1801 if (i < 0 || i >=
fNp)
return;
1812 if (i < 0 || i >=
fNp)
return;
1901 b1, p2, p3, q2, q3, r2, pq, pr, qr;
1916 if (
q)
fPoly[1].
D() =
q*6.*q2/(qr*qr);
1920 for (i = 1; i <
m; ++i) {
1933 fPoly[i+1].
D() = q3*6./(qr*qr);
1935 *(pr* 20.+q2*7.)+q2*
1936 ((p2+r2)*8.+pr*21.+q2+q2))/(pqqr*pqqr);
1937 fPoly[i-1].
D() += q3*6./(pq*pq);
1938 fPoly[i].
E() = q2*(
p*qr+pq*3.*(qr+
r+
r))/(pqqr*qr);
1939 fPoly[i-1].
E() += q2*(
r*pq+qr*3.*(pq+
p+
p))/(pqqr*pq);
1940 fPoly[i-1].
F() = q3/pqqr;
1945 if (
r)
fPoly[
m-1].
D() +=
r*6.*r2/(qr*qr);
1950 for (i = 1; i <
fNp; ++i) {
1959 for (i = 2; i <
fNp; ++i) {
1977 for (i = 2; i <
m; ++i) {
1990 for (i=
fNp-3; i > 0; --i)
2008 for (i = 1; i <
m; ++i) {
2029 p3-(
v+
fPoly[i].E())*q3)/pq;
2086 printf(
"1 TEST OF TSpline5 WITH NONEQUIDISTANT KNOTS\n");
2101 printf(
"\n-N = %3d M =%2d\n",
n,
m);
2103 for (i = 0; i <
n; ++i)
2105 a[i+600],
a[i+800],
a[i+1000]);
2107 for (i = 0; i < mm1; ++i) diff[i] = com[i] = 0;
2108 for (k = 0; k <
n; ++k) {
2109 for (i = 0; i < mm; ++i)
c[i] =
a[k+i*200];
2110 printf(
" ---------------------------------------%3d --------------------------------------------\n",k+1);
2111 printf(
"%12.8f\n",
x[k]);
2113 printf(
"%16.8f\n",
c[0]);
2115 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
2117 for (i = 0; i < mm1; ++i)
2118 if ((z=
TMath::Abs(
a[k+i*200])) > com[i]) com[i] = z;
2120 for (i = 1; i < mm; ++i)
2121 for (jj = i; jj < mm; ++jj) {
2123 c[j-2] =
c[j-1]*z+
c[j-2];
2125 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
2127 for (i = 0; i < mm1; ++i)
2128 if (!(k >=
n-2 && i != 0))
2130 > diff[i]) diff[i] = z;
2133 printf(
" MAXIMUM ABSOLUTE VALUES OF DIFFERENCES \n");
2134 for (i = 0; i < mm1; ++i) printf(
"%18.9E",diff[i]);
2136 printf(
" MAXIMUM ABSOLUTE VALUES OF COEFFICIENTS \n");
2139 for (i = 0; i < mm1; ++i) printf(
"%16.8f",com[i]);
2142 for (
n = 10;
n <= 100;
n += 10) {
2146 for (i = 0; i < nm1; i += 2) {
2156 printf(
"\n-N = %3d M =%2d\n",
n,
m);
2158 for (i = 0; i <
n; ++i)
2160 a[i+600],
a[i+800],
a[i+1000]);
2162 for (i = 0; i < mm1; ++i)
2163 diff[i] = com[i] = 0;
2164 for (k = 0; k <
n; ++k) {
2165 for (i = 0; i < mm; ++i)
2168 printf(
" ---------------------------------------%3d --------------------------------------------\n",k+1);
2169 printf(
"%12.8f\n",
x[k]);
2170 if (k ==
n-1) printf(
"%16.8f\n",
c[0]);
2172 if (k ==
n-1)
break;
2174 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
2177 for (i = 0; i < mm1; ++i)
2181 for (i = 1; i < mm; ++i)
2182 for (jj = i; jj < mm; ++jj) {
2184 c[j-2] =
c[j-1]*z+
c[j-2];
2187 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
2190 for (i = 0; i < mm1; ++i)
2191 if (!(k >=
n-2 && i != 0))
2193 > diff[i]) diff[i] = z;
2195 printf(
" MAXIMUM ABSOLUTE VALUES OF DIFFERENCES \n");
2196 for (i = 0; i < mm1; ++i) printf(
"%18.9E",diff[i]);
2198 printf(
" MAXIMUM ABSOLUTE VALUES OF COEFFICIENTS \n");
2201 for (i = 0; i < mm1; ++i) printf(
"%16.8E",com[i]);
2206 printf(
"1 TEST OF TSpline5 WITH NONEQUIDISTANT DOUBLE KNOTS\n");
2232 printf(
"-N = %3d M =%2d\n",
n,
m);
2234 for (i = 0; i < nn; ++i)
2236 a[i+600],
a[i+800],
a[i+1000]);
2238 for (i = 0; i < mm1; ++i)
2239 diff[i] = com[i] = 0;
2240 for (k = 0; k < nn; ++k) {
2241 for (i = 0; i < mm; ++i)
2243 printf(
" ---------------------------------------%3d --------------------------------------------\n",k+1);
2244 printf(
"%12.8f\n",
x[k]);
2246 printf(
"%16.8f\n",
c[0]);
2249 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
2251 for (i = 0; i < mm1; ++i)
2252 if ((z=
TMath::Abs(
a[k+i*200])) > com[i]) com[i] = z;
2254 for (i = 1; i < mm; ++i)
2255 for (jj = i; jj < mm; ++jj) {
2257 c[j-2] =
c[j-1]*z+
c[j-2];
2259 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
2261 for (i = 0; i < mm1; ++i)
2262 if (!(k >= nn-2 && i != 0))
2264 > diff[i]) diff[i] = z;
2266 printf(
" MAXIMUM ABSOLUTE VALUES OF DIFFERENCES \n");
2267 for (i = 1; i <= mm1; ++i) {
2268 printf(
"%18.9E",diff[i-1]);
2273 printf(
" MAXIMUM ABSOLUTE VALUES OF COEFFICIENTS \n");
2274 for (i = 0; i < mm1; ++i) printf(
"%16.8f",com[i]);
2277 for (
n = 10;
n <= 100;
n += 10) {
2282 for (i = 0; i <
n; ++i) {
2289 printf(
"-N = %3d M =%2d\n",
n,
m);
2291 for (i = 0; i < nn; ++i)
2293 a[i+600],
a[i+800],
a[i+1000]);
2295 for (i = 0; i < mm1; ++i)
2296 diff[i] = com[i] = 0;
2297 for (k = 0; k < nn; ++k) {
2298 for (i = 0; i < mm; ++i)
2301 printf(
" ---------------------------------------%3d --------------------------------------------\n",k+1);
2302 printf(
"%12.8f\n",
x[k]);
2303 if (k == nn-1) printf(
"%16.8f\n",
c[0]);
2305 if (k == nn-1)
break;
2307 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
2310 for (i = 0; i < mm1; ++i)
2311 if ((z=
TMath::Abs(
a[k+i*200])) > com[i]) com[i] = z;
2313 for (i = 1; i < mm; ++i) {
2314 for (jj = i; jj < mm; ++jj) {
2316 c[j-2] =
c[j-1]*z+
c[j-2];
2320 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
2323 for (i = 0; i < mm1; ++i)
2324 if (!(k >= nn-2 && i != 0))
2326 > diff[i]) diff[i] = z;
2328 printf(
" MAXIMUM ABSOLUTE VALUES OF DIFFERENCES \n");
2329 for (i = 0; i < mm1; ++i) printf(
"%18.9E",diff[i]);
2331 printf(
" MAXIMUM ABSOLUTE VALUES OF COEFFICIENTS \n");
2334 for (i = 0; i < mm1; ++i) printf(
"%18.9E",com[i]);
2340 printf(
"1 TEST OF TSpline5 WITH NONEQUIDISTANT KNOTS,\n");
2341 printf(
" ONE DOUBLE, ONE TRIPLE KNOT\n");
2362 printf(
"-N = %3d M =%2d\n",
n,
m);
2364 for (i = 0; i <
n; ++i)
2366 a[i+600],
a[i+800],
a[i+1000]);
2368 for (i = 0; i < mm1; ++i)
2369 diff[i] = com[i] = 0;
2370 for (k = 0; k <
n; ++k) {
2371 for (i = 0; i < mm; ++i)
2373 printf(
" ---------------------------------------%3d --------------------------------------------\n",k+1);
2374 printf(
"%12.8f\n",
x[k]);
2376 printf(
"%16.8f\n",
c[0]);
2379 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
2381 for (i = 0; i < mm1; ++i)
2382 if ((z=
TMath::Abs(
a[k+i*200])) > com[i]) com[i] = z;
2384 for (i = 1; i < mm; ++i)
2385 for (jj = i; jj < mm; ++jj) {
2387 c[j-2] =
c[j-1]*z+
c[j-2];
2389 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
2391 for (i = 0; i < mm1; ++i)
2392 if (!(k >=
n-2 && i != 0))
2394 > diff[i]) diff[i] = z;
2396 printf(
" MAXIMUM ABSOLUTE VALUES OF DIFFERENCES \n");
2397 for (i = 0; i < mm1; ++i) printf(
"%18.9E",diff[i]);
2399 printf(
" MAXIMUM ABSOLUTE VALUES OF COEFFICIENTS \n");
2402 for (i = 0; i < mm1; ++i) printf(
"%16.8f",com[i]);
2407 printf(
"1 TEST OF TSpline5 WITH NONEQUIDISTANT KNOTS,\n");
2408 printf(
" TWO DOUBLE, ONE TRIPLE KNOT\n");
2433 printf(
"-N = %3d M =%2d\n",
n,
m);
2435 for (i = 0; i <
n; ++i)
2437 a[i+600],
a[i+800],
a[i+1000]);
2439 for (i = 0; i < mm1; ++i)
2440 diff[i] = com[i] = 0;
2441 for (k = 0; k <
n; ++k) {
2442 for (i = 0; i < mm; ++i)
2444 printf(
" ---------------------------------------%3d --------------------------------------------\n",k+1);
2445 printf(
"%12.8f\n",
x[k]);
2447 printf(
"%16.8f\n",
c[0]);
2450 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
2452 for (i = 0; i < mm1; ++i)
2453 if ((z=
TMath::Abs(
a[k+i*200])) > com[i]) com[i] = z;
2455 for (i = 1; i < mm; ++i)
2456 for (jj = i; jj < mm; ++jj) {
2458 c[j-2] =
c[j-1]*z+
c[j-2];
2460 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
2462 for (i = 0; i < mm1; ++i)
2463 if (!(k >=
n-2 && i != 0))
2465 > diff[i]) diff[i] = z;
2467 printf(
" MAXIMUM ABSOLUTE VALUES OF DIFFERENCES \n");
2468 for (i = 0; i < mm1; ++i) printf(
"%18.9E",diff[i]);
2470 printf(
" MAXIMUM ABSOLUTE VALUES OF COEFFICIENTS \n");
2473 for (i = 0; i < mm1; ++i) printf(
"%16.8f",com[i]);
int Int_t
Signed integer 4 bytes (int)
short Version_t
Class version identifier (short)
const char Option_t
Option string (const char)
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
R__EXTERN TSystem * gSystem
Fill Area Attributes class.
virtual void Streamer(TBuffer &)
virtual Color_t GetFillColor() const
Return the fill area color.
virtual Style_t GetFillStyle() const
Return the fill area style.
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
virtual void SaveFillAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1001)
Save fill attributes as C++ statement(s) on output stream out.
virtual void Streamer(TBuffer &)
virtual Color_t GetLineColor() const
Return the line color.
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
virtual Width_t GetLineWidth() const
Return the line width.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual Style_t GetLineStyle() const
Return the line style.
virtual void SaveLineAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t widdef=1)
Save line attributes as C++ statement(s) on output stream out.
virtual void SaveMarkerAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t sizdef=1)
Save line attributes as C++ statement(s) on output stream out.
virtual Style_t GetMarkerStyle() const
Return the marker style.
virtual Color_t GetMarkerColor() const
Return the marker color.
virtual Size_t GetMarkerSize() const
Return the marker size.
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
virtual void SetMarkerSize(Size_t msize=1)
Set the marker size.
virtual void Streamer(TBuffer &)
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
virtual void SetLimits(Double_t xmin, Double_t xmax)
Buffer base class used for serializing objects.
virtual Version_t ReadVersion(UInt_t *start=nullptr, UInt_t *bcnt=nullptr, const TClass *cl=nullptr)=0
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=nullptr)=0
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
A TGraph is an object made of two arrays X and Y with npoints each.
void Paint(Option_t *chopt="") override
Draw this graph with its current attributes.
1-D histogram with a float per channel (see TH1 documentation)
TH1 is the base class of all histogram classes in ROOT.
virtual void SetDirectory(TDirectory *dir)
By default, when a histogram is created, it is added to the list of histogram objects in the current ...
virtual Double_t GetBinCenter(Int_t bin) const
Return bin center for 1D histogram.
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Compute distance from point px,py to a line.
@ kLogX
X-axis in log scale.
@ kNoStats
Don't draw stats box.
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content see convention for numbering bins in TH1::GetBin In case the bin number is greater th...
void Paint(Option_t *option="") override
Control routine to paint any kind of histograms.
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to one event.
The TNamed class is the base class for all named ROOT classes.
const char * GetName() const override
Returns name of object.
void Streamer(TBuffer &) override
Stream an object of class TObject.
const char * GetTitle() const override
Returns title of object.
TNamed & operator=(const TNamed &rhs)
TNamed assignment operator.
TObject & operator=(const TObject &rhs) noexcept
TObject assignment operator.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
static void SavePrimitiveDraw(std::ostream &out, const char *variable_name, Option_t *option=nullptr)
Save invocation of primitive Draw() method Skipped if option contains "nodraw" string.
static void SavePrimitiveConstructor(std::ostream &out, TClass *cl, const char *variable_name, const char *constructor_agrs="", Bool_t empty_line=kTRUE)
Save object constructor in the output stream "out".
Class to create third splines to interpolate knots Arbitrary conditions can be introduced for first a...
void SaveAs(const char *filename="", Option_t *option="") const override
Write this spline as a C++ function that can be executed without ROOT the name of the function is the...
Int_t fEndCond
0=no end cond, 1=first derivative, 2=second derivative
Int_t fBegCond
0=no beg cond, 1=first derivative, 2=second derivative
Int_t FindX(Double_t x) const
Find X.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save primitive as a C++ statement(s) on output stream out.
void GetCoeff(Int_t i, Double_t &x, Double_t &y, Double_t &b, Double_t &c, Double_t &d) const
static void Test()
Test method for TSpline5.
Double_t fValBeg
Initial value of first or second derivative.
void BuildCoeff() override
Build coefficients.
void Streamer(TBuffer &) override
Stream an object of class TSpline3.
Double_t Eval(Double_t x) const override
Eval this spline at x.
Double_t fValEnd
End value of first or second derivative.
void SetCond(const char *opt)
Check the boundary conditions.
Double_t Derivative(Double_t x) const
Derivative.
TSplinePoly3 * fPoly
[fNp] Array of polynomial terms
TSpline3 & operator=(const TSpline3 &)
Assignment operator.
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set point number i.
virtual void SetPointCoeff(Int_t i, Double_t b, Double_t c, Double_t d)
Set point coefficient number i.
Class to create quintic natural splines to interpolate knots Arbitrary conditions can be introduced f...
void GetCoeff(Int_t i, Double_t &x, Double_t &y, Double_t &b, Double_t &c, Double_t &d, Double_t &e, Double_t &f) const
static void Test()
Test method for TSpline5.
Double_t Eval(Double_t x) const override
Eval this spline at x.
void Streamer(TBuffer &) override
Stream an object of class TSpline5.
void BuildCoeff() override
Algorithm 600, collected algorithms from acm.
TSplinePoly5 * fPoly
[fNp] Array of polynomial terms
virtual void SetPointCoeff(Int_t i, Double_t b, Double_t c, Double_t d, Double_t e, Double_t f)
Set point coefficient number i.
void SaveAs(const char *filename="", Option_t *option="") const override
Write this spline as a C++ function that can be executed without ROOT the name of the function is the...
Double_t Derivative(Double_t x) const
Derivative.
void BoundaryConditions(const char *opt, Int_t &beg, Int_t &end, const char *&cb1, const char *&ce1, const char *&cb2, const char *&ce2)
Check the boundary conditions and the amount of extra double knots needed.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save primitive as a C++ statement(s) on output stream out.
void SetBoundaries(Double_t b1, Double_t e1, Double_t b2, Double_t e2, const char *cb1, const char *ce1, const char *cb2, const char *ce2)
Set the boundary conditions at double/triple knots.
Int_t FindX(Double_t x) const
Find X.
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set point number i.
TSpline5 & operator=(const TSpline5 &)
Assignment operator.
Double_t fC
Second order expansion coefficient : fC*2! is the second derivative at x.
Double_t Eval(Double_t x) const override
Double_t fD
Third order expansion coefficient : fD*3! is the third derivative at x.
Double_t Derivative(Double_t x) const
Double_t fB
First order expansion coefficient : fB*1! is the first derivative at x.
void CopyPoly(TSplinePoly3 const &other)
Utility called by the copy constructors and = operator.
TSplinePoly3 & operator=(TSplinePoly3 const &other)
Assignment operator.
void Streamer(TBuffer &) override
Stream an object of class TObject.
void CopyPoly(TSplinePoly5 const &other)
Utility called by the copy constructors and = operator.
TSplinePoly5 & operator=(TSplinePoly5 const &other)
Assignment operator.
Double_t fF
Fifth order expansion coefficient : fF*5! is the fifth derivative at x.
Double_t Derivative(Double_t x) const
void Streamer(TBuffer &) override
Stream an object of class TObject.
Double_t fB
First order expansion coefficient : fB*1! is the first derivative at x.
Double_t fC
Second order expansion coefficient : fC*2! is the second derivative at x.
Double_t fD
Third order expansion coefficient : fD*3! is the third derivative at x.
Double_t Eval(Double_t x) const override
Double_t fE
Fourth order expansion coefficient : fE*4! is the fourth derivative at x.
Base class for TSpline knot.
void CopyPoly(TSplinePoly const &other)
Utility called by the copy constructors and = operator.
TSplinePoly & operator=(TSplinePoly const &other)
Assignment operator.
Double_t fY
Constant term.
Base class for spline implementation containing the Draw/Paint methods.
void Streamer(TBuffer &) override
Stream an object of class TSpline.
virtual Double_t Eval(Double_t x) const =0
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to one event.
TGraph * fGraph
Graph for drawing the knots.
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Compute distance from point px,py to a spline.
Double_t fXmin
Minimum value of abscissa.
TClass * IsA() const override
TH1F * fHistogram
Temporary histogram.
void Draw(Option_t *option="") override
Draw this function with its current attributes.
Double_t fDelta
Distance between equidistant knots.
virtual void GetKnot(Int_t i, Double_t &x, Double_t &y) const =0
TSpline & operator=(const TSpline &)
Assignment operator.
void Paint(Option_t *option="") override
Paint this function with its current attributes.
Bool_t fKstep
True of equidistant knots.
Int_t fNp
Number of knots.
~TSpline() override
Destructor.
Double_t fXmax
Maximum value of abscissa.
Int_t fNpx
Number of points used for graphical representation.
void ToLower()
Change string to lower-case.
TString & ReplaceSpecialCppChars()
Find special characters which are typically used in printf() calls and replace them by appropriate es...
const char * Data() const
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Int_t FloorNint(Double_t x)
Returns the nearest integer of TMath::Floor(x).
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Double_t Log10(Double_t x)
Returns the common (base-10) logarithm of x.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.