73 TAttLine::operator=(sp);
74 TAttFill::operator=(sp);
75 TAttMarker::operator=(sp);
139 pmin =
gPad->PadtoX(
gPad->GetUxmin());
140 pmax =
gPad->PadtoX(
gPad->GetUxmax());
144 if (
xmax < pmin)
return;
145 if (
xmin > pmax)
return;
169 for (i=0;i<=
fNpx;i++) {
170 xbins[i] =
gPad->PadtoX(xlogmin+ i*dlogx);
181 for (i=1;i<=
fNpx;i++) {
199 char *o = (
char *) opt.
Data();
362 fValBeg(valbeg), fValEnd(valend), fBegCond(0), fEndCond(0)
372 for (
Int_t i=0; i<
n; ++i) {
391 fValBeg(valbeg), fValEnd(valend),
392 fBegCond(0), fEndCond(0)
402 for (
Int_t i=0; i<
n; ++i) {
420 fValBeg(valbeg), fValEnd(valend),
421 fBegCond(0), fEndCond(0)
431 for (
Int_t i=0; i<
n; ++i) {
447 const TF1 *func,
Int_t n,
const char *opt,
450 fValBeg(valbeg), fValEnd(valend),
451 fBegCond(0), fEndCond(0)
464 for (
Int_t i=0; i<
n; ++i) {
480 const TGraph *
g,
const char *opt,
483 fValBeg(valbeg), fValEnd(valend),
484 fBegCond(0), fEndCond(0)
496 g->GetPoint(i,xx,yy);
513 fValBeg(valbeg), fValEnd(valend),
514 fBegCond(0), fEndCond(0)
525 fPoly[i].
X()=
h->GetXaxis()->GetBinCenter(i+1);
526 fPoly[i].
Y()=
h->GetBinContent(i+1);
541 fValBeg(sp3.fValBeg),
542 fValEnd(sp3.fValEnd),
543 fBegCond(sp3.fBegCond),
544 fEndCond(sp3.fEndCond)
580 const char *b1 = strstr(opt,
"b1");
581 const char *e1 = strstr(opt,
"e1");
582 const char *b2 = strstr(opt,
"b2");
583 const char *e2 = strstr(opt,
"e2");
585 Error(
"SetCond",
"Cannot specify first and second derivative at first point");
587 Error(
"SetCond",
"Cannot specify first and second derivative at last point");
627 printf(
"1 TEST OF TSpline3 WITH NONEQUIDISTANT KNOTS\n");
642 printf(
"\n-N = %3d M =%2d\n",
n,
m);
644 for (i = 0; i <
n; ++i)
645 spline->
GetCoeff(i,hx,
a[i],
a[i+200],
a[i+400],
a[i+600]);
647 for (i = 0; i < mm1; ++i) diff[i] = com[i] = 0;
648 for (k = 0; k <
n; ++k) {
649 for (i = 0; i < mm; ++i)
c[i] =
a[k+i*200];
650 printf(
" ---------------------------------------%3d --------------------------------------------\n",k+1);
651 printf(
"%12.8f\n",
x[k]);
653 printf(
"%16.8f\n",
c[0]);
655 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
657 for (i = 0; i < mm1; ++i)
658 if ((z=
TMath::Abs(
a[k+i*200])) > com[i]) com[i] = z;
660 for (i = 1; i < mm; ++i)
661 for (jj = i; jj < mm; ++jj) {
663 c[j-2] =
c[j-1]*z+
c[j-2];
665 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
667 for (i = 0; i < mm1; ++i)
668 if (!(k >=
n-2 && i != 0))
670 > diff[i]) diff[i] = z;
673 printf(
" MAXIMUM ABSOLUTE VALUES OF DIFFERENCES \n");
674 for (i = 0; i < mm1; ++i) printf(
"%18.9E",diff[i]);
676 printf(
" MAXIMUM ABSOLUTE VALUES OF COEFFICIENTS \n");
679 for (i = 0; i < mm1; ++i) printf(
"%16.8f",com[i]);
682 for (
n = 10;
n <= 100;
n += 10) {
686 for (i = 0; i < nm1; i += 2) {
696 printf(
"\n-N = %3d M =%2d\n",
n,
m);
698 for (i = 0; i <
n; ++i)
701 for (i = 0; i < mm1; ++i)
702 diff[i] = com[i] = 0;
703 for (k = 0; k <
n; ++k) {
704 for (i = 0; i < mm; ++i)
707 printf(
" ---------------------------------------%3d --------------------------------------------\n",k+1);
708 printf(
"%12.8f\n",
x[k]);
709 if (k ==
n-1) printf(
"%16.8f\n",
c[0]);
713 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
716 for (i = 0; i < mm1; ++i)
720 for (i = 1; i < mm; ++i)
721 for (jj = i; jj < mm; ++jj) {
723 c[j-2] =
c[j-1]*z+
c[j-2];
726 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
729 for (i = 0; i < mm1; ++i)
730 if (!(k >=
n-2 && i != 0))
732 > diff[i]) diff[i] = z;
734 printf(
" MAXIMUM ABSOLUTE VALUES OF DIFFERENCES \n");
735 for (i = 0; i < mm1; ++i) printf(
"%18.9E",diff[i]);
737 printf(
" MAXIMUM ABSOLUTE VALUES OF COEFFICIENTS \n");
740 for (i = 0; i < mm1; ++i) printf(
"%16.8E",com[i]);
755 else if(
x>=
fXmax) klow=khig;
764 else if (klow < khig) {
765 if (
x >
fPoly[klow+1].
X()) ++klow;
772 if(
x>
fPoly[khalf=(klow+khig)/2].
X())
780 "Binary search failed x(%d) = %f < x= %f < x(%d) = %f\n",
793 if (klow >=
fNp-1 &&
fNp > 1) klow =
fNp-2;
803 if (klow >=
fNp-1) klow =
fNp-2;
814 std::ofstream *
f =
new std::ofstream(
filename,std::ios::out);
824 char *dot = strstr(buffer,
".");
826 strlcat(buffer,
"(double x) {\n",512);
827 nch = strlen(buffer);
f->write(buffer,nch);
829 nch = strlen(buffer);
f->write(buffer,nch);
831 nch = strlen(buffer);
f->write(buffer,nch);
835 snprintf(buffer,512,
" const double fX[%d] = {",
fNp);
836 nch = strlen(buffer);
f->write(buffer,nch);
840 for (i=0;i<
fNp;i++) {
843 if (i ==
fNp-1) numb[nch-1]=0;
844 strlcat(buffer,numb,512);
845 if (i%5 == 4 || i ==
fNp-1) {
846 nch = strlen(buffer);
f->write(buffer,nch);
851 nch = strlen(buffer);
f->write(buffer,nch);
853 snprintf(buffer,512,
" const double fY[%d] = {",
fNp);
854 nch = strlen(buffer);
f->write(buffer,nch);
856 for (i=0;i<
fNp;i++) {
859 if (i ==
fNp-1) numb[nch-1]=0;
860 strlcat(buffer,numb,512);
861 if (i%5 == 4 || i ==
fNp-1) {
862 nch = strlen(buffer);
f->write(buffer,nch);
867 nch = strlen(buffer);
f->write(buffer,nch);
869 snprintf(buffer,512,
" const double fB[%d] = {",
fNp);
870 nch = strlen(buffer);
f->write(buffer,nch);
872 for (i=0;i<
fNp;i++) {
875 if (i ==
fNp-1) numb[nch-1]=0;
876 strlcat(buffer,numb,512);
877 if (i%5 == 4 || i ==
fNp-1) {
878 nch = strlen(buffer);
f->write(buffer,nch);
883 nch = strlen(buffer);
f->write(buffer,nch);
885 snprintf(buffer,512,
" const double fC[%d] = {",
fNp);
886 nch = strlen(buffer);
f->write(buffer,nch);
888 for (i=0;i<
fNp;i++) {
891 if (i ==
fNp-1) numb[nch-1]=0;
892 strlcat(buffer,numb,512);
893 if (i%5 == 4 || i ==
fNp-1) {
894 nch = strlen(buffer);
f->write(buffer,nch);
899 nch = strlen(buffer);
f->write(buffer,nch);
901 snprintf(buffer,512,
" const double fD[%d] = {",
fNp);
902 nch = strlen(buffer);
f->write(buffer,nch);
904 for (i=0;i<
fNp;i++) {
907 if (i ==
fNp-1) numb[nch-1]=0;
908 strlcat(buffer,numb,512);
909 if (i%5 == 4 || i ==
fNp-1) {
910 nch = strlen(buffer);
f->write(buffer,nch);
915 nch = strlen(buffer);
f->write(buffer,nch);
918 snprintf(buffer,512,
" int klow=0;\n");
919 nch = strlen(buffer);
f->write(buffer,nch);
921 snprintf(buffer,512,
" // If out of boundaries, extrapolate. It may be badly wrong\n");
922 snprintf(buffer,512,
" if(x<=fXmin) klow=0;\n");
923 nch = strlen(buffer);
f->write(buffer,nch);
924 snprintf(buffer,512,
" else if(x>=fXmax) klow=fNp-1;\n");
925 nch = strlen(buffer);
f->write(buffer,nch);
927 nch = strlen(buffer);
f->write(buffer,nch);
928 snprintf(buffer,512,
" if(fKstep) {\n");
929 nch = strlen(buffer);
f->write(buffer,nch);
931 snprintf(buffer,512,
" // Equidistant knots, use histogramming\n");
932 nch = strlen(buffer);
f->write(buffer,nch);
933 snprintf(buffer,512,
" klow = int((x-fXmin)/fDelta);\n");
934 nch = strlen(buffer);
f->write(buffer,nch);
935 snprintf(buffer,512,
" if (klow < fNp-1) klow = fNp-1;\n");
936 nch = strlen(buffer);
f->write(buffer,nch);
938 nch = strlen(buffer);
f->write(buffer,nch);
939 snprintf(buffer,512,
" int khig=fNp-1, khalf;\n");
940 nch = strlen(buffer);
f->write(buffer,nch);
942 snprintf(buffer,512,
" // Non equidistant knots, binary search\n");
943 nch = strlen(buffer);
f->write(buffer,nch);
944 snprintf(buffer,512,
" while(khig-klow>1)\n");
945 nch = strlen(buffer);
f->write(buffer,nch);
946 snprintf(buffer,512,
" if(x>fX[khalf=(klow+khig)/2]) klow=khalf;\n");
947 nch = strlen(buffer);
f->write(buffer,nch);
948 snprintf(buffer,512,
" else khig=khalf;\n");
949 nch = strlen(buffer);
f->write(buffer,nch);
951 nch = strlen(buffer);
f->write(buffer,nch);
953 nch = strlen(buffer);
f->write(buffer,nch);
954 snprintf(buffer,512,
" // Evaluate now\n");
955 nch = strlen(buffer);
f->write(buffer,nch);
956 snprintf(buffer,512,
" double dx=x-fX[klow];\n");
957 nch = strlen(buffer);
f->write(buffer,nch);
958 snprintf(buffer,512,
" return (fY[klow]+dx*(fB[klow]+dx*(fC[klow]+dx*fD[klow])));\n");
959 nch = strlen(buffer);
f->write(buffer,nch);
964 if (
f) {
f->close();
delete f;}
979 out<<
"spline3 = new TSpline3("<<quote<<
GetTitle()<<quote<<
","
980 <<
fXmin<<
","<<
fXmax<<
",(TF1*)0,"<<
fNp<<
","<<quote<<quote<<
","
982 out<<
" spline3->SetName("<<quote<<
GetName()<<quote<<
");"<<std::endl;
987 if (
fNpx != 100) out<<
" spline3->SetNpx("<<
fNpx<<
");"<<std::endl;
990 out<<
" spline3->SetPoint("<<i<<
","<<
fPoly[i].
X()<<
","<<
fPoly[i].
Y()<<
");"<<std::endl;
991 out<<
" spline3->SetPointCoeff("<<i<<
","<<
fPoly[i].
B()<<
","<<
fPoly[i].
C()<<
","<<
fPoly[i].
D()<<
");"<<std::endl;
993 out<<
" spline3->Draw("<<quote<<
option<<quote<<
");"<<std::endl;
1001 if (i < 0 || i >=
fNp)
return;
1011 if (i < 0 || i >=
fNp)
return;
1096 for (
m=1;
m<
l; ++
m) {
1165 for (i=1; i<
fNp; ++i) {
1169 fPoly[i-1].
C() = (divdf1 -
fPoly[i-1].
B() - divdf3)/dtau;
1170 fPoly[i-1].
D() = (divdf3/dtau)/dtau;
1224 const char *cb1, *ce1, *cb2, *ce2;
1233 for (
Int_t i=0; i<
n; ++i) {
1258 const char *cb1, *ce1, *cb2, *ce2;
1267 for (
Int_t i=0; i<
n; ++i) {
1291 const char *cb1, *ce1, *cb2, *ce2;
1300 for (
Int_t i=0; i<
n; i++) {
1325 const char *cb1, *ce1, *cb2, *ce2;
1334 for (
Int_t i=0; i<
n; ++i) {
1337 if (func)
fPoly[i+beg].
Y() = ((
TF1*)func)->Eval(
x);
1360 const char *cb1, *ce1, *cb2, *ce2;
1371 g->GetPoint(i,xx,yy);
1394 const char *cb1, *ce1, *cb2, *ce2;
1404 fPoly[i+beg].
X()=
h->GetXaxis()->GetBinCenter(i+1);
1405 fPoly[i+beg].
Y()=
h->GetBinContent(i+1);
1454 const char *&cb1,
const char *&ce1,
1455 const char *&cb2,
const char *&ce2)
1457 cb1=ce1=cb2=ce2=
nullptr;
1460 cb1 = strstr(opt,
"b1");
1461 ce1 = strstr(opt,
"e1");
1462 cb2 = strstr(opt,
"b2");
1463 ce2 = strstr(opt,
"e2");
1485 const char *cb1,
const char *ce1,
const char *cb2,
1551 if(
x>
fPoly[khalf=(klow+khig)/2].
X())
1560 "Binary search failed x(%d) = %f < x(%d) = %f\n",
1591 std::ofstream *
f =
new std::ofstream(
filename,std::ios::out);
1601 char *dot = strstr(buffer,
".");
1603 strlcat(buffer,
"(double x) {\n",512);
1604 nch = strlen(buffer);
f->write(buffer,nch);
1606 nch = strlen(buffer);
f->write(buffer,nch);
1608 nch = strlen(buffer);
f->write(buffer,nch);
1612 snprintf(buffer,512,
" const double fX[%d] = {",
fNp);
1613 nch = strlen(buffer);
f->write(buffer,nch);
1617 for (i=0;i<
fNp;i++) {
1620 if (i ==
fNp-1) numb[nch-1]=0;
1621 strlcat(buffer,numb,512);
1622 if (i%5 == 4 || i ==
fNp-1) {
1623 nch = strlen(buffer);
f->write(buffer,nch);
1628 nch = strlen(buffer);
f->write(buffer,nch);
1630 snprintf(buffer,512,
" const double fY[%d] = {",
fNp);
1631 nch = strlen(buffer);
f->write(buffer,nch);
1633 for (i=0;i<
fNp;i++) {
1636 if (i ==
fNp-1) numb[nch-1]=0;
1637 strlcat(buffer,numb,512);
1638 if (i%5 == 4 || i ==
fNp-1) {
1639 nch = strlen(buffer);
f->write(buffer,nch);
1644 nch = strlen(buffer);
f->write(buffer,nch);
1646 snprintf(buffer,512,
" const double fB[%d] = {",
fNp);
1647 nch = strlen(buffer);
f->write(buffer,nch);
1649 for (i=0;i<
fNp;i++) {
1652 if (i ==
fNp-1) numb[nch-1]=0;
1653 strlcat(buffer,numb,512);
1654 if (i%5 == 4 || i ==
fNp-1) {
1655 nch = strlen(buffer);
f->write(buffer,nch);
1660 nch = strlen(buffer);
f->write(buffer,nch);
1662 snprintf(buffer,512,
" const double fC[%d] = {",
fNp);
1663 nch = strlen(buffer);
f->write(buffer,nch);
1665 for (i=0;i<
fNp;i++) {
1668 if (i ==
fNp-1) numb[nch-1]=0;
1669 strlcat(buffer,numb,512);
1670 if (i%5 == 4 || i ==
fNp-1) {
1671 nch = strlen(buffer);
f->write(buffer,nch);
1676 nch = strlen(buffer);
f->write(buffer,nch);
1678 snprintf(buffer,512,
" const double fD[%d] = {",
fNp);
1679 nch = strlen(buffer);
f->write(buffer,nch);
1681 for (i=0;i<
fNp;i++) {
1684 if (i ==
fNp-1) numb[nch-1]=0;
1685 strlcat(buffer,numb,512);
1686 if (i%5 == 4 || i ==
fNp-1) {
1687 nch = strlen(buffer);
f->write(buffer,nch);
1692 nch = strlen(buffer);
f->write(buffer,nch);
1694 snprintf(buffer,512,
" const double fE[%d] = {",
fNp);
1695 nch = strlen(buffer);
f->write(buffer,nch);
1697 for (i=0;i<
fNp;i++) {
1700 if (i ==
fNp-1) numb[nch-1]=0;
1701 strlcat(buffer,numb,512);
1702 if (i%5 == 4 || i ==
fNp-1) {
1703 nch = strlen(buffer);
f->write(buffer,nch);
1708 nch = strlen(buffer);
f->write(buffer,nch);
1710 snprintf(buffer,512,
" const double fF[%d] = {",
fNp);
1711 nch = strlen(buffer);
f->write(buffer,nch);
1713 for (i=0;i<
fNp;i++) {
1716 if (i ==
fNp-1) numb[nch-1]=0;
1717 strlcat(buffer,numb,512);
1718 if (i%5 == 4 || i ==
fNp-1) {
1719 nch = strlen(buffer);
f->write(buffer,nch);
1724 nch = strlen(buffer);
f->write(buffer,nch);
1727 snprintf(buffer,512,
" int klow=0;\n");
1728 nch = strlen(buffer);
f->write(buffer,nch);
1730 snprintf(buffer,512,
" // If out of boundaries, extrapolate. It may be badly wrong\n");
1731 snprintf(buffer,512,
" if(x<=fXmin) klow=0;\n");
1732 nch = strlen(buffer);
f->write(buffer,nch);
1733 snprintf(buffer,512,
" else if(x>=fXmax) klow=fNp-1;\n");
1734 nch = strlen(buffer);
f->write(buffer,nch);
1736 nch = strlen(buffer);
f->write(buffer,nch);
1737 snprintf(buffer,512,
" if(fKstep) {\n");
1738 nch = strlen(buffer);
f->write(buffer,nch);
1740 snprintf(buffer,512,
" // Equidistant knots, use histogramming\n");
1741 nch = strlen(buffer);
f->write(buffer,nch);
1742 snprintf(buffer,512,
" klow = int((x-fXmin)/fDelta);\n");
1743 nch = strlen(buffer);
f->write(buffer,nch);
1744 snprintf(buffer,512,
" if (klow < fNp-1) klow = fNp-1;\n");
1745 nch = strlen(buffer);
f->write(buffer,nch);
1746 snprintf(buffer,512,
" } else {\n");
1747 nch = strlen(buffer);
f->write(buffer,nch);
1748 snprintf(buffer,512,
" int khig=fNp-1, khalf;\n");
1749 nch = strlen(buffer);
f->write(buffer,nch);
1751 snprintf(buffer,512,
" // Non equidistant knots, binary search\n");
1752 nch = strlen(buffer);
f->write(buffer,nch);
1753 snprintf(buffer,512,
" while(khig-klow>1)\n");
1754 nch = strlen(buffer);
f->write(buffer,nch);
1755 snprintf(buffer,512,
" if(x>fX[khalf=(klow+khig)/2]) klow=khalf;\n");
1756 nch = strlen(buffer);
f->write(buffer,nch);
1757 snprintf(buffer,512,
" else khig=khalf;\n");
1758 nch = strlen(buffer);
f->write(buffer,nch);
1760 nch = strlen(buffer);
f->write(buffer,nch);
1762 nch = strlen(buffer);
f->write(buffer,nch);
1763 snprintf(buffer,512,
" // Evaluate now\n");
1764 nch = strlen(buffer);
f->write(buffer,nch);
1765 snprintf(buffer,512,
" double dx=x-fX[klow];\n");
1766 nch = strlen(buffer);
f->write(buffer,nch);
1767 snprintf(buffer,512,
" return (fY[klow]+dx*(fB[klow]+dx*(fC[klow]+dx*(fD[klow]+dx*(fE[klow]+dx*fF[klow])))));\n");
1768 nch = strlen(buffer);
f->write(buffer,nch);
1773 if (
f) {
f->close();
delete f;}
1782 out<<
" "<<std::endl;
1792 out<<
"spline5 = new TSpline5("<<quote<<
GetTitle()<<quote<<
","
1793 <<
fXmin<<
","<<
fXmax<<
",(TF1*)0,"<<
fNp<<
","<<quote<<quote<<
","
1794 <<b1<<
","<<e1<<
","<<b2<<
","<<e2<<
");"<<std::endl;
1795 out<<
" spline5->SetName("<<quote<<
GetName()<<quote<<
");"<<std::endl;
1800 if (
fNpx != 100) out<<
" spline5->SetNpx("<<
fNpx<<
");"<<std::endl;
1803 out<<
" spline5->SetPoint("<<i<<
","<<
fPoly[i].
X()<<
","<<
fPoly[i].
Y()<<
");"<<std::endl;
1804 out<<
" spline5->SetPointCoeff("<<i<<
","<<
fPoly[i].
B()<<
","<<
fPoly[i].
C()<<
","<<
fPoly[i].
D()<<
","<<
fPoly[i].
E()<<
","<<
fPoly[i].
F()<<
");"<<std::endl;
1806 out<<
" spline5->Draw("<<quote<<
option<<quote<<
");"<<std::endl;
1815 if (i < 0 || i >=
fNp)
return;
1826 if (i < 0 || i >=
fNp)
return;
1915 b1, p2, p3, q2, q3, r2, pq, pr, qr;
1930 if (
q)
fPoly[1].
D() =
q*6.*q2/(qr*qr);
1934 for (i = 1; i <
m; ++i) {
1947 fPoly[i+1].
D() = q3*6./(qr*qr);
1949 *(pr* 20.+q2*7.)+q2*
1950 ((p2+r2)*8.+pr*21.+q2+q2))/(pqqr*pqqr);
1951 fPoly[i-1].
D() += q3*6./(pq*pq);
1952 fPoly[i].
E() = q2*(
p*qr+pq*3.*(qr+
r+
r))/(pqqr*qr);
1953 fPoly[i-1].
E() += q2*(
r*pq+qr*3.*(pq+
p+
p))/(pqqr*pq);
1954 fPoly[i-1].
F() = q3/pqqr;
1959 if (
r)
fPoly[
m-1].
D() +=
r*6.*r2/(qr*qr);
1964 for (i = 1; i <
fNp; ++i) {
1973 for (i = 2; i <
fNp; ++i) {
1991 for (i = 2; i <
m; ++i) {
2004 for (i=
fNp-3; i > 0; --i)
2022 for (i = 1; i <
m; ++i) {
2043 p3-(
v+
fPoly[i].E())*q3)/pq;
2100 printf(
"1 TEST OF TSpline5 WITH NONEQUIDISTANT KNOTS\n");
2115 printf(
"\n-N = %3d M =%2d\n",
n,
m);
2117 for (i = 0; i <
n; ++i)
2119 a[i+600],
a[i+800],
a[i+1000]);
2121 for (i = 0; i < mm1; ++i) diff[i] = com[i] = 0;
2122 for (k = 0; k <
n; ++k) {
2123 for (i = 0; i < mm; ++i)
c[i] =
a[k+i*200];
2124 printf(
" ---------------------------------------%3d --------------------------------------------\n",k+1);
2125 printf(
"%12.8f\n",
x[k]);
2127 printf(
"%16.8f\n",
c[0]);
2129 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
2131 for (i = 0; i < mm1; ++i)
2132 if ((z=
TMath::Abs(
a[k+i*200])) > com[i]) com[i] = z;
2134 for (i = 1; i < mm; ++i)
2135 for (jj = i; jj < mm; ++jj) {
2137 c[j-2] =
c[j-1]*z+
c[j-2];
2139 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
2141 for (i = 0; i < mm1; ++i)
2142 if (!(k >=
n-2 && i != 0))
2144 > diff[i]) diff[i] = z;
2147 printf(
" MAXIMUM ABSOLUTE VALUES OF DIFFERENCES \n");
2148 for (i = 0; i < mm1; ++i) printf(
"%18.9E",diff[i]);
2150 printf(
" MAXIMUM ABSOLUTE VALUES OF COEFFICIENTS \n");
2153 for (i = 0; i < mm1; ++i) printf(
"%16.8f",com[i]);
2156 for (
n = 10;
n <= 100;
n += 10) {
2160 for (i = 0; i < nm1; i += 2) {
2170 printf(
"\n-N = %3d M =%2d\n",
n,
m);
2172 for (i = 0; i <
n; ++i)
2174 a[i+600],
a[i+800],
a[i+1000]);
2176 for (i = 0; i < mm1; ++i)
2177 diff[i] = com[i] = 0;
2178 for (k = 0; k <
n; ++k) {
2179 for (i = 0; i < mm; ++i)
2182 printf(
" ---------------------------------------%3d --------------------------------------------\n",k+1);
2183 printf(
"%12.8f\n",
x[k]);
2184 if (k ==
n-1) printf(
"%16.8f\n",
c[0]);
2186 if (k ==
n-1)
break;
2188 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
2191 for (i = 0; i < mm1; ++i)
2195 for (i = 1; i < mm; ++i)
2196 for (jj = i; jj < mm; ++jj) {
2198 c[j-2] =
c[j-1]*z+
c[j-2];
2201 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
2204 for (i = 0; i < mm1; ++i)
2205 if (!(k >=
n-2 && i != 0))
2207 > diff[i]) diff[i] = z;
2209 printf(
" MAXIMUM ABSOLUTE VALUES OF DIFFERENCES \n");
2210 for (i = 0; i < mm1; ++i) printf(
"%18.9E",diff[i]);
2212 printf(
" MAXIMUM ABSOLUTE VALUES OF COEFFICIENTS \n");
2215 for (i = 0; i < mm1; ++i) printf(
"%16.8E",com[i]);
2220 printf(
"1 TEST OF TSpline5 WITH NONEQUIDISTANT DOUBLE KNOTS\n");
2246 printf(
"-N = %3d M =%2d\n",
n,
m);
2248 for (i = 0; i < nn; ++i)
2250 a[i+600],
a[i+800],
a[i+1000]);
2252 for (i = 0; i < mm1; ++i)
2253 diff[i] = com[i] = 0;
2254 for (k = 0; k < nn; ++k) {
2255 for (i = 0; i < mm; ++i)
2257 printf(
" ---------------------------------------%3d --------------------------------------------\n",k+1);
2258 printf(
"%12.8f\n",
x[k]);
2260 printf(
"%16.8f\n",
c[0]);
2263 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
2265 for (i = 0; i < mm1; ++i)
2266 if ((z=
TMath::Abs(
a[k+i*200])) > com[i]) com[i] = z;
2268 for (i = 1; i < mm; ++i)
2269 for (jj = i; jj < mm; ++jj) {
2271 c[j-2] =
c[j-1]*z+
c[j-2];
2273 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
2275 for (i = 0; i < mm1; ++i)
2276 if (!(k >= nn-2 && i != 0))
2278 > diff[i]) diff[i] = z;
2280 printf(
" MAXIMUM ABSOLUTE VALUES OF DIFFERENCES \n");
2281 for (i = 1; i <= mm1; ++i) {
2282 printf(
"%18.9E",diff[i-1]);
2287 printf(
" MAXIMUM ABSOLUTE VALUES OF COEFFICIENTS \n");
2288 for (i = 0; i < mm1; ++i) printf(
"%16.8f",com[i]);
2291 for (
n = 10;
n <= 100;
n += 10) {
2296 for (i = 0; i <
n; ++i) {
2303 printf(
"-N = %3d M =%2d\n",
n,
m);
2305 for (i = 0; i < nn; ++i)
2307 a[i+600],
a[i+800],
a[i+1000]);
2309 for (i = 0; i < mm1; ++i)
2310 diff[i] = com[i] = 0;
2311 for (k = 0; k < nn; ++k) {
2312 for (i = 0; i < mm; ++i)
2315 printf(
" ---------------------------------------%3d --------------------------------------------\n",k+1);
2316 printf(
"%12.8f\n",
x[k]);
2317 if (k == nn-1) printf(
"%16.8f\n",
c[0]);
2319 if (k == nn-1)
break;
2321 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
2324 for (i = 0; i < mm1; ++i)
2325 if ((z=
TMath::Abs(
a[k+i*200])) > com[i]) com[i] = z;
2327 for (i = 1; i < mm; ++i) {
2328 for (jj = i; jj < mm; ++jj) {
2330 c[j-2] =
c[j-1]*z+
c[j-2];
2334 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
2337 for (i = 0; i < mm1; ++i)
2338 if (!(k >= nn-2 && i != 0))
2340 > diff[i]) diff[i] = z;
2342 printf(
" MAXIMUM ABSOLUTE VALUES OF DIFFERENCES \n");
2343 for (i = 0; i < mm1; ++i) printf(
"%18.9E",diff[i]);
2345 printf(
" MAXIMUM ABSOLUTE VALUES OF COEFFICIENTS \n");
2348 for (i = 0; i < mm1; ++i) printf(
"%18.9E",com[i]);
2354 printf(
"1 TEST OF TSpline5 WITH NONEQUIDISTANT KNOTS,\n");
2355 printf(
" ONE DOUBLE, ONE TRIPLE KNOT\n");
2376 printf(
"-N = %3d M =%2d\n",
n,
m);
2378 for (i = 0; i <
n; ++i)
2380 a[i+600],
a[i+800],
a[i+1000]);
2382 for (i = 0; i < mm1; ++i)
2383 diff[i] = com[i] = 0;
2384 for (k = 0; k <
n; ++k) {
2385 for (i = 0; i < mm; ++i)
2387 printf(
" ---------------------------------------%3d --------------------------------------------\n",k+1);
2388 printf(
"%12.8f\n",
x[k]);
2390 printf(
"%16.8f\n",
c[0]);
2393 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
2395 for (i = 0; i < mm1; ++i)
2396 if ((z=
TMath::Abs(
a[k+i*200])) > com[i]) com[i] = z;
2398 for (i = 1; i < mm; ++i)
2399 for (jj = i; jj < mm; ++jj) {
2401 c[j-2] =
c[j-1]*z+
c[j-2];
2403 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
2405 for (i = 0; i < mm1; ++i)
2406 if (!(k >=
n-2 && i != 0))
2408 > diff[i]) diff[i] = z;
2410 printf(
" MAXIMUM ABSOLUTE VALUES OF DIFFERENCES \n");
2411 for (i = 0; i < mm1; ++i) printf(
"%18.9E",diff[i]);
2413 printf(
" MAXIMUM ABSOLUTE VALUES OF COEFFICIENTS \n");
2416 for (i = 0; i < mm1; ++i) printf(
"%16.8f",com[i]);
2421 printf(
"1 TEST OF TSpline5 WITH NONEQUIDISTANT KNOTS,\n");
2422 printf(
" TWO DOUBLE, ONE TRIPLE KNOT\n");
2447 printf(
"-N = %3d M =%2d\n",
n,
m);
2449 for (i = 0; i <
n; ++i)
2451 a[i+600],
a[i+800],
a[i+1000]);
2453 for (i = 0; i < mm1; ++i)
2454 diff[i] = com[i] = 0;
2455 for (k = 0; k <
n; ++k) {
2456 for (i = 0; i < mm; ++i)
2458 printf(
" ---------------------------------------%3d --------------------------------------------\n",k+1);
2459 printf(
"%12.8f\n",
x[k]);
2461 printf(
"%16.8f\n",
c[0]);
2464 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
2466 for (i = 0; i < mm1; ++i)
2467 if ((z=
TMath::Abs(
a[k+i*200])) > com[i]) com[i] = z;
2469 for (i = 1; i < mm; ++i)
2470 for (jj = i; jj < mm; ++jj) {
2472 c[j-2] =
c[j-1]*z+
c[j-2];
2474 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
2476 for (i = 0; i < mm1; ++i)
2477 if (!(k >=
n-2 && i != 0))
2479 > diff[i]) diff[i] = z;
2481 printf(
" MAXIMUM ABSOLUTE VALUES OF DIFFERENCES \n");
2482 for (i = 0; i < mm1; ++i) printf(
"%18.9E",diff[i]);
2484 printf(
" MAXIMUM ABSOLUTE VALUES OF COEFFICIENTS \n");
2487 for (i = 0; i < mm1; ++i) printf(
"%16.8f",com[i]);
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 void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
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 Streamer(TBuffer &)
virtual void SetMarkerSize(Size_t msize=1)
Set the marker size.
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)
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.
Class to create third splines to interpolate knots Arbitrary conditions can be introduced for first a...
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 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...
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 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...
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.
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.
const char * Data() const
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.