67 TAttLine::operator=(sp);
68 TAttFill::operator=(sp);
69 TAttMarker::operator=(sp);
110 return fHistogram->DistancetoPrimitive(px, py);
133 pmin =
gPad->PadtoX(
gPad->GetUxmin());
134 pmax =
gPad->PadtoX(
gPad->GetUxmax());
138 if (
xmax < pmin)
return;
139 if (
xmin > pmax)
return;
163 for (i=0;i<=
fNpx;i++) {
164 xbins[i] =
gPad->PadtoX(xlogmin+ i*dlogx);
175 for (i=1;i<=
fNpx;i++) {
193 char *o = (
char *) opt.
Data();
198 if(o[i]==
'p') graph=
kTRUE ;
else o[j++]=o[i];
201 else if (opt ==
"same")
fHistogram->Paint(
"lfsame");
366 for (
Int_t i=0; i<
n; ++i) {
396 for (
Int_t i=0; i<
n; ++i) {
425 for (
Int_t i=0; i<
n; ++i) {
441 const TF1 *func,
Int_t n,
const char *opt,
458 for (
Int_t i=0; i<
n; ++i) {
474 const TGraph *
g,
const char *opt,
490 g->GetPoint(i,xx,yy);
519 fPoly[i].X()=
h->GetXaxis()->GetBinCenter(i+1);
520 fPoly[i].Y()=
h->GetBinContent(i+1);
570 const char *b1 = strstr(opt,
"b1");
571 const char *e1 = strstr(opt,
"e1");
572 const char *b2 = strstr(opt,
"b2");
573 const char *e2 = strstr(opt,
"e2");
575 Error(
"SetCond",
"Cannot specify first and second derivative at first point");
577 Error(
"SetCond",
"Cannot specify first and second derivative at last point");
617 printf(
"1 TEST OF TSpline3 WITH NONEQUIDISTANT KNOTS\n");
632 printf(
"\n-N = %3d M =%2d\n",
n,
m);
634 for (i = 0; i <
n; ++i)
635 spline->
GetCoeff(i,hx,
a[i],
a[i+200],
a[i+400],
a[i+600]);
637 for (i = 0; i < mm1; ++i) diff[i] = com[i] = 0;
638 for (k = 0; k <
n; ++k) {
639 for (i = 0; i < mm; ++i)
c[i] =
a[k+i*200];
640 printf(
" ---------------------------------------%3d --------------------------------------------\n",k+1);
641 printf(
"%12.8f\n",
x[k]);
643 printf(
"%16.8f\n",
c[0]);
645 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
647 for (i = 0; i < mm1; ++i)
648 if ((z=
TMath::Abs(
a[k+i*200])) > com[i]) com[i] = z;
650 for (i = 1; i < mm; ++i)
651 for (jj = i; jj < mm; ++jj) {
653 c[j-2] =
c[j-1]*z+
c[j-2];
655 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
657 for (i = 0; i < mm1; ++i)
658 if (!(k >=
n-2 && i != 0))
660 > diff[i]) diff[i] = z;
663 printf(
" MAXIMUM ABSOLUTE VALUES OF DIFFERENCES \n");
664 for (i = 0; i < mm1; ++i) printf(
"%18.9E",diff[i]);
666 printf(
" MAXIMUM ABSOLUTE VALUES OF COEFFICIENTS \n");
669 for (i = 0; i < mm1; ++i) printf(
"%16.8f",com[i]);
672 for (
n = 10;
n <= 100;
n += 10) {
676 for (i = 0; i < nm1; i += 2) {
686 printf(
"\n-N = %3d M =%2d\n",
n,
m);
688 for (i = 0; i <
n; ++i)
691 for (i = 0; i < mm1; ++i)
692 diff[i] = com[i] = 0;
693 for (k = 0; k <
n; ++k) {
694 for (i = 0; i < mm; ++i)
697 printf(
" ---------------------------------------%3d --------------------------------------------\n",k+1);
698 printf(
"%12.8f\n",
x[k]);
699 if (k ==
n-1) printf(
"%16.8f\n",
c[0]);
703 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
706 for (i = 0; i < mm1; ++i)
710 for (i = 1; i < mm; ++i)
711 for (jj = i; jj < mm; ++jj) {
713 c[j-2] =
c[j-1]*z+
c[j-2];
716 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
719 for (i = 0; i < mm1; ++i)
720 if (!(k >=
n-2 && i != 0))
722 > diff[i]) diff[i] = z;
724 printf(
" MAXIMUM ABSOLUTE VALUES OF DIFFERENCES \n");
725 for (i = 0; i < mm1; ++i) printf(
"%18.9E",diff[i]);
727 printf(
" MAXIMUM ABSOLUTE VALUES OF COEFFICIENTS \n");
730 for (i = 0; i < mm1; ++i) printf(
"%16.8E",com[i]);
745 else if(
x>=
fXmax) klow=khig;
754 else if (klow < khig) {
755 if (
x >
fPoly[klow+1].
X()) ++klow;
762 if(
x>
fPoly[khalf=(klow+khig)/2].
X())
770 "Binary search failed x(%d) = %f < x= %f < x(%d) = %f\n",
783 if (klow >=
fNp-1 &&
fNp > 1) klow =
fNp-2;
784 return fPoly[klow].Eval(
x);
793 if (klow >=
fNp-1) klow =
fNp-2;
794 return fPoly[klow].Derivative(
x);
804 std::ofstream *
f =
new std::ofstream(filename,std::ios::out);
806 Error(
"SaveAs",
"Cannot open file:%s\n",filename);
812 Int_t nch = strlen(filename);
813 snprintf(buffer,512,
"double %s",filename);
814 char *dot = strstr(buffer,
".");
816 strlcat(buffer,
"(double x) {\n",512);
817 nch = strlen(buffer);
f->write(buffer,nch);
819 nch = strlen(buffer);
f->write(buffer,nch);
821 nch = strlen(buffer);
f->write(buffer,nch);
825 snprintf(buffer,512,
" const double fX[%d] = {",
fNp);
826 nch = strlen(buffer);
f->write(buffer,nch);
830 for (i=0;i<
fNp;i++) {
833 if (i ==
fNp-1) numb[nch-1]=0;
834 strlcat(buffer,numb,512);
835 if (i%5 == 4 || i ==
fNp-1) {
836 nch = strlen(buffer);
f->write(buffer,nch);
841 nch = strlen(buffer);
f->write(buffer,nch);
843 snprintf(buffer,512,
" const double fY[%d] = {",
fNp);
844 nch = strlen(buffer);
f->write(buffer,nch);
846 for (i=0;i<
fNp;i++) {
849 if (i ==
fNp-1) numb[nch-1]=0;
850 strlcat(buffer,numb,512);
851 if (i%5 == 4 || i ==
fNp-1) {
852 nch = strlen(buffer);
f->write(buffer,nch);
857 nch = strlen(buffer);
f->write(buffer,nch);
859 snprintf(buffer,512,
" const double fB[%d] = {",
fNp);
860 nch = strlen(buffer);
f->write(buffer,nch);
862 for (i=0;i<
fNp;i++) {
865 if (i ==
fNp-1) numb[nch-1]=0;
866 strlcat(buffer,numb,512);
867 if (i%5 == 4 || i ==
fNp-1) {
868 nch = strlen(buffer);
f->write(buffer,nch);
873 nch = strlen(buffer);
f->write(buffer,nch);
875 snprintf(buffer,512,
" const double fC[%d] = {",
fNp);
876 nch = strlen(buffer);
f->write(buffer,nch);
878 for (i=0;i<
fNp;i++) {
881 if (i ==
fNp-1) numb[nch-1]=0;
882 strlcat(buffer,numb,512);
883 if (i%5 == 4 || i ==
fNp-1) {
884 nch = strlen(buffer);
f->write(buffer,nch);
889 nch = strlen(buffer);
f->write(buffer,nch);
891 snprintf(buffer,512,
" const double fD[%d] = {",
fNp);
892 nch = strlen(buffer);
f->write(buffer,nch);
894 for (i=0;i<
fNp;i++) {
897 if (i ==
fNp-1) numb[nch-1]=0;
898 strlcat(buffer,numb,512);
899 if (i%5 == 4 || i ==
fNp-1) {
900 nch = strlen(buffer);
f->write(buffer,nch);
905 nch = strlen(buffer);
f->write(buffer,nch);
908 snprintf(buffer,512,
" int klow=0;\n");
909 nch = strlen(buffer);
f->write(buffer,nch);
911 snprintf(buffer,512,
" // If out of boundaries, extrapolate. It may be badly wrong\n");
912 snprintf(buffer,512,
" if(x<=fXmin) klow=0;\n");
913 nch = strlen(buffer);
f->write(buffer,nch);
914 snprintf(buffer,512,
" else if(x>=fXmax) klow=fNp-1;\n");
915 nch = strlen(buffer);
f->write(buffer,nch);
917 nch = strlen(buffer);
f->write(buffer,nch);
918 snprintf(buffer,512,
" if(fKstep) {\n");
919 nch = strlen(buffer);
f->write(buffer,nch);
921 snprintf(buffer,512,
" // Equidistant knots, use histogramming\n");
922 nch = strlen(buffer);
f->write(buffer,nch);
923 snprintf(buffer,512,
" klow = int((x-fXmin)/fDelta);\n");
924 nch = strlen(buffer);
f->write(buffer,nch);
925 snprintf(buffer,512,
" if (klow > fNp-1) klow = fNp-1;\n");
926 nch = strlen(buffer);
f->write(buffer,nch);
928 nch = strlen(buffer);
f->write(buffer,nch);
929 snprintf(buffer,512,
" int khig=fNp-1, khalf;\n");
930 nch = strlen(buffer);
f->write(buffer,nch);
932 snprintf(buffer,512,
" // Non equidistant knots, binary search\n");
933 nch = strlen(buffer);
f->write(buffer,nch);
934 snprintf(buffer,512,
" while(khig-klow>1)\n");
935 nch = strlen(buffer);
f->write(buffer,nch);
936 snprintf(buffer,512,
" if(x>fX[khalf=(klow+khig)/2]) klow=khalf;\n");
937 nch = strlen(buffer);
f->write(buffer,nch);
938 snprintf(buffer,512,
" else khig=khalf;\n");
939 nch = strlen(buffer);
f->write(buffer,nch);
941 nch = strlen(buffer);
f->write(buffer,nch);
943 nch = strlen(buffer);
f->write(buffer,nch);
944 snprintf(buffer,512,
" // Evaluate now\n");
945 nch = strlen(buffer);
f->write(buffer,nch);
946 snprintf(buffer,512,
" double dx=x-fX[klow];\n");
947 nch = strlen(buffer);
f->write(buffer,nch);
948 snprintf(buffer,512,
" return (fY[klow]+dx*(fB[klow]+dx*(fC[klow]+dx*fD[klow])));\n");
949 nch = strlen(buffer);
f->write(buffer,nch);
954 if (
f) {
f->close();
delete f;}
973 out <<
" spline3->SetNpx(" <<
fNpx <<
");\n";
976 out <<
" spline3->SetPoint(" << i <<
"," <<
fPoly[i].X() <<
"," <<
fPoly[i].Y() <<
");\n";
977 out <<
" spline3->SetPointCoeff(" << i <<
"," <<
fPoly[i].B() <<
"," <<
fPoly[i].C() <<
"," <<
fPoly[i].D()
989 if (i < 0 || i >=
fNp)
return;
999 if (i < 0 || i >=
fNp)
return;
1084 for (
m=1;
m<
l; ++
m) {
1153 for (i=1; i<
fNp; ++i) {
1154 dtau =
fPoly[i].C();
1155 divdf1 = (
fPoly[i].Y() -
fPoly[i-1].Y())/dtau;
1156 divdf3 =
fPoly[i-1].B() +
fPoly[i].B() - 2.*divdf1;
1157 fPoly[i-1].C() = (divdf1 -
fPoly[i-1].B() - divdf3)/dtau;
1158 fPoly[i-1].D() = (divdf3/dtau)/dtau;
1179 fPoly[i].Streamer(R__b);
1212 const char *cb1, *ce1, *cb2, *ce2;
1221 for (
Int_t i=0; i<
n; ++i) {
1246 const char *cb1, *ce1, *cb2, *ce2;
1255 for (
Int_t i=0; i<
n; ++i) {
1279 const char *cb1, *ce1, *cb2, *ce2;
1288 for (
Int_t i=0; i<
n; i++) {
1290 fPoly[i+beg].Y() = ((
TF1*)func)->Eval(
x[i]);
1313 const char *cb1, *ce1, *cb2, *ce2;
1322 for (
Int_t i=0; i<
n; ++i) {
1325 if (func)
fPoly[i+beg].Y() = ((
TF1*)func)->Eval(
x);
1348 const char *cb1, *ce1, *cb2, *ce2;
1359 g->GetPoint(i,xx,yy);
1360 fPoly[i+beg].X()=xx;
1361 fPoly[i+beg].Y()=yy;
1382 const char *cb1, *ce1, *cb2, *ce2;
1392 fPoly[i+beg].X()=
h->GetXaxis()->GetBinCenter(i+1);
1393 fPoly[i+beg].Y()=
h->GetBinContent(i+1);
1440 const char *&cb1,
const char *&ce1,
1441 const char *&cb2,
const char *&ce2)
1443 cb1=ce1=cb2=ce2=
nullptr;
1446 cb1 = strstr(opt,
"b1");
1447 ce1 = strstr(opt,
"e1");
1448 cb2 = strstr(opt,
"b2");
1449 ce2 = strstr(opt,
"e2");
1471 const char *cb1,
const char *ce1,
const char *cb2,
1537 if(
x>
fPoly[khalf=(klow+khig)/2].
X())
1546 "Binary search failed x(%d) = %f < x(%d) = %f\n",
1558 return fPoly[klow].Eval(
x);
1567 return fPoly[klow].Derivative(
x);
1577 std::ofstream *
f =
new std::ofstream(filename,std::ios::out);
1579 Error(
"SaveAs",
"Cannot open file:%s\n",filename);
1585 Int_t nch = strlen(filename);
1586 snprintf(buffer,512,
"double %s",filename);
1587 char *dot = strstr(buffer,
".");
1589 strlcat(buffer,
"(double x) {\n",512);
1590 nch = strlen(buffer);
f->write(buffer,nch);
1592 nch = strlen(buffer);
f->write(buffer,nch);
1594 nch = strlen(buffer);
f->write(buffer,nch);
1598 snprintf(buffer,512,
" const double fX[%d] = {",
fNp);
1599 nch = strlen(buffer);
f->write(buffer,nch);
1603 for (i=0;i<
fNp;i++) {
1606 if (i ==
fNp-1) numb[nch-1]=0;
1607 strlcat(buffer,numb,512);
1608 if (i%5 == 4 || i ==
fNp-1) {
1609 nch = strlen(buffer);
f->write(buffer,nch);
1614 nch = strlen(buffer);
f->write(buffer,nch);
1616 snprintf(buffer,512,
" const double fY[%d] = {",
fNp);
1617 nch = strlen(buffer);
f->write(buffer,nch);
1619 for (i=0;i<
fNp;i++) {
1622 if (i ==
fNp-1) numb[nch-1]=0;
1623 strlcat(buffer,numb,512);
1624 if (i%5 == 4 || i ==
fNp-1) {
1625 nch = strlen(buffer);
f->write(buffer,nch);
1630 nch = strlen(buffer);
f->write(buffer,nch);
1632 snprintf(buffer,512,
" const double fB[%d] = {",
fNp);
1633 nch = strlen(buffer);
f->write(buffer,nch);
1635 for (i=0;i<
fNp;i++) {
1638 if (i ==
fNp-1) numb[nch-1]=0;
1639 strlcat(buffer,numb,512);
1640 if (i%5 == 4 || i ==
fNp-1) {
1641 nch = strlen(buffer);
f->write(buffer,nch);
1646 nch = strlen(buffer);
f->write(buffer,nch);
1648 snprintf(buffer,512,
" const double fC[%d] = {",
fNp);
1649 nch = strlen(buffer);
f->write(buffer,nch);
1651 for (i=0;i<
fNp;i++) {
1654 if (i ==
fNp-1) numb[nch-1]=0;
1655 strlcat(buffer,numb,512);
1656 if (i%5 == 4 || i ==
fNp-1) {
1657 nch = strlen(buffer);
f->write(buffer,nch);
1662 nch = strlen(buffer);
f->write(buffer,nch);
1664 snprintf(buffer,512,
" const double fD[%d] = {",
fNp);
1665 nch = strlen(buffer);
f->write(buffer,nch);
1667 for (i=0;i<
fNp;i++) {
1670 if (i ==
fNp-1) numb[nch-1]=0;
1671 strlcat(buffer,numb,512);
1672 if (i%5 == 4 || i ==
fNp-1) {
1673 nch = strlen(buffer);
f->write(buffer,nch);
1678 nch = strlen(buffer);
f->write(buffer,nch);
1680 snprintf(buffer,512,
" const double fE[%d] = {",
fNp);
1681 nch = strlen(buffer);
f->write(buffer,nch);
1683 for (i=0;i<
fNp;i++) {
1686 if (i ==
fNp-1) numb[nch-1]=0;
1687 strlcat(buffer,numb,512);
1688 if (i%5 == 4 || i ==
fNp-1) {
1689 nch = strlen(buffer);
f->write(buffer,nch);
1694 nch = strlen(buffer);
f->write(buffer,nch);
1696 snprintf(buffer,512,
" const double fF[%d] = {",
fNp);
1697 nch = strlen(buffer);
f->write(buffer,nch);
1699 for (i=0;i<
fNp;i++) {
1702 if (i ==
fNp-1) numb[nch-1]=0;
1703 strlcat(buffer,numb,512);
1704 if (i%5 == 4 || i ==
fNp-1) {
1705 nch = strlen(buffer);
f->write(buffer,nch);
1710 nch = strlen(buffer);
f->write(buffer,nch);
1713 snprintf(buffer,512,
" int klow=0;\n");
1714 nch = strlen(buffer);
f->write(buffer,nch);
1716 snprintf(buffer,512,
" // If out of boundaries, extrapolate. It may be badly wrong\n");
1717 snprintf(buffer,512,
" if(x<=fXmin) klow=0;\n");
1718 nch = strlen(buffer);
f->write(buffer,nch);
1719 snprintf(buffer,512,
" else if(x>=fXmax) klow=fNp-1;\n");
1720 nch = strlen(buffer);
f->write(buffer,nch);
1722 nch = strlen(buffer);
f->write(buffer,nch);
1723 snprintf(buffer,512,
" if(fKstep) {\n");
1724 nch = strlen(buffer);
f->write(buffer,nch);
1726 snprintf(buffer,512,
" // Equidistant knots, use histogramming\n");
1727 nch = strlen(buffer);
f->write(buffer,nch);
1728 snprintf(buffer,512,
" klow = int((x-fXmin)/fDelta);\n");
1729 nch = strlen(buffer);
f->write(buffer,nch);
1730 snprintf(buffer,512,
" if (klow > fNp-1) klow = fNp-1;\n");
1731 nch = strlen(buffer);
f->write(buffer,nch);
1732 snprintf(buffer,512,
" } else {\n");
1733 nch = strlen(buffer);
f->write(buffer,nch);
1734 snprintf(buffer,512,
" int khig=fNp-1, khalf;\n");
1735 nch = strlen(buffer);
f->write(buffer,nch);
1737 snprintf(buffer,512,
" // Non equidistant knots, binary search\n");
1738 nch = strlen(buffer);
f->write(buffer,nch);
1739 snprintf(buffer,512,
" while(khig-klow>1)\n");
1740 nch = strlen(buffer);
f->write(buffer,nch);
1741 snprintf(buffer,512,
" if(x>fX[khalf=(klow+khig)/2]) klow=khalf;\n");
1742 nch = strlen(buffer);
f->write(buffer,nch);
1743 snprintf(buffer,512,
" else khig=khalf;\n");
1744 nch = strlen(buffer);
f->write(buffer,nch);
1746 nch = strlen(buffer);
f->write(buffer,nch);
1748 nch = strlen(buffer);
f->write(buffer,nch);
1749 snprintf(buffer,512,
" // Evaluate now\n");
1750 nch = strlen(buffer);
f->write(buffer,nch);
1751 snprintf(buffer,512,
" double dx=x-fX[klow];\n");
1752 nch = strlen(buffer);
f->write(buffer,nch);
1753 snprintf(buffer,512,
" return (fY[klow]+dx*(fB[klow]+dx*(fC[klow]+dx*(fD[klow]+dx*(fE[klow]+dx*fF[klow])))));\n");
1754 nch = strlen(buffer);
f->write(buffer,nch);
1759 if (
f) {
f->close();
delete f;}
1773 TString::Format(
"\"%s\", %g, %g, (TF1 *)nullptr, %d, \"\", %g, %g, %g, %g",
1783 out <<
" spline5->SetNpx(" <<
fNpx <<
");\n";
1786 out <<
" spline5->SetPoint(" << i <<
"," <<
fPoly[i].X() <<
"," <<
fPoly[i].Y() <<
");\n";
1787 out <<
" spline5->SetPointCoeff(" << i <<
"," <<
fPoly[i].B() <<
"," <<
fPoly[i].C() <<
"," <<
fPoly[i].D()
1788 <<
"," <<
fPoly[i].E() <<
"," <<
fPoly[i].F() <<
");\n";
1800 if (i < 0 || i >=
fNp)
return;
1811 if (i < 0 || i >=
fNp)
return;
1900 b1, p2, p3, q2, q3, r2, pq, pr, qr;
1915 if (
q)
fPoly[1].D() =
q*6.*q2/(qr*qr);
1916 else fPoly[1].D() = 0;
1919 for (i = 1; i <
m; ++i) {
1932 fPoly[i+1].D() = q3*6./(qr*qr);
1933 fPoly[i].D() += (
q+
q)*(pr*15.*pr+(p+
r)*
q
1934 *(pr* 20.+q2*7.)+q2*
1935 ((p2+r2)*8.+pr*21.+q2+q2))/(pqqr*pqqr);
1936 fPoly[i-1].D() += q3*6./(pq*pq);
1937 fPoly[i].E() = q2*(p*qr+pq*3.*(qr+
r+
r))/(pqqr*qr);
1938 fPoly[i-1].E() += q2*(
r*pq+qr*3.*(pq+p+p))/(pqqr*pq);
1939 fPoly[i-1].F() = q3/pqqr;
1944 if (
r)
fPoly[
m-1].D() +=
r*6.*r2/(qr*qr);
1949 for (i = 1; i <
fNp; ++i) {
1958 for (i = 2; i <
fNp; ++i) {
1976 for (i = 2; i <
m; ++i) {
1989 for (i=
fNp-3; i > 0; --i)
2006 else fPoly[0].F() = 0;
2007 for (i = 1; i <
m; ++i) {
2017 if (qr) t = (
fPoly[i+1].C()-
fPoly[i].C())/qr;
2024 fPoly[i].E() = s*5.;
2028 p3-(
v+
fPoly[i].E())*q3)/pq;
2039 s =
fPoly[0].F()*p*p*p;
2085 printf(
"1 TEST OF TSpline5 WITH NONEQUIDISTANT KNOTS\n");
2100 printf(
"\n-N = %3d M =%2d\n",
n,
m);
2102 for (i = 0; i <
n; ++i)
2104 a[i+600],
a[i+800],
a[i+1000]);
2106 for (i = 0; i < mm1; ++i) diff[i] = com[i] = 0;
2107 for (k = 0; k <
n; ++k) {
2108 for (i = 0; i < mm; ++i)
c[i] =
a[k+i*200];
2109 printf(
" ---------------------------------------%3d --------------------------------------------\n",k+1);
2110 printf(
"%12.8f\n",
x[k]);
2112 printf(
"%16.8f\n",
c[0]);
2114 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
2116 for (i = 0; i < mm1; ++i)
2117 if ((z=
TMath::Abs(
a[k+i*200])) > com[i]) com[i] = z;
2119 for (i = 1; i < mm; ++i)
2120 for (jj = i; jj < mm; ++jj) {
2122 c[j-2] =
c[j-1]*z+
c[j-2];
2124 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
2126 for (i = 0; i < mm1; ++i)
2127 if (!(k >=
n-2 && i != 0))
2129 > diff[i]) diff[i] = z;
2132 printf(
" MAXIMUM ABSOLUTE VALUES OF DIFFERENCES \n");
2133 for (i = 0; i < mm1; ++i) printf(
"%18.9E",diff[i]);
2135 printf(
" MAXIMUM ABSOLUTE VALUES OF COEFFICIENTS \n");
2138 for (i = 0; i < mm1; ++i) printf(
"%16.8f",com[i]);
2141 for (
n = 10;
n <= 100;
n += 10) {
2145 for (i = 0; i < nm1; i += 2) {
2155 printf(
"\n-N = %3d M =%2d\n",
n,
m);
2157 for (i = 0; i <
n; ++i)
2159 a[i+600],
a[i+800],
a[i+1000]);
2161 for (i = 0; i < mm1; ++i)
2162 diff[i] = com[i] = 0;
2163 for (k = 0; k <
n; ++k) {
2164 for (i = 0; i < mm; ++i)
2167 printf(
" ---------------------------------------%3d --------------------------------------------\n",k+1);
2168 printf(
"%12.8f\n",
x[k]);
2169 if (k ==
n-1) printf(
"%16.8f\n",
c[0]);
2171 if (k ==
n-1)
break;
2173 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
2176 for (i = 0; i < mm1; ++i)
2180 for (i = 1; i < mm; ++i)
2181 for (jj = i; jj < mm; ++jj) {
2183 c[j-2] =
c[j-1]*z+
c[j-2];
2186 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
2189 for (i = 0; i < mm1; ++i)
2190 if (!(k >=
n-2 && i != 0))
2192 > diff[i]) diff[i] = z;
2194 printf(
" MAXIMUM ABSOLUTE VALUES OF DIFFERENCES \n");
2195 for (i = 0; i < mm1; ++i) printf(
"%18.9E",diff[i]);
2197 printf(
" MAXIMUM ABSOLUTE VALUES OF COEFFICIENTS \n");
2200 for (i = 0; i < mm1; ++i) printf(
"%16.8E",com[i]);
2205 printf(
"1 TEST OF TSpline5 WITH NONEQUIDISTANT DOUBLE KNOTS\n");
2231 printf(
"-N = %3d M =%2d\n",
n,
m);
2233 for (i = 0; i < nn; ++i)
2235 a[i+600],
a[i+800],
a[i+1000]);
2237 for (i = 0; i < mm1; ++i)
2238 diff[i] = com[i] = 0;
2239 for (k = 0; k < nn; ++k) {
2240 for (i = 0; i < mm; ++i)
2242 printf(
" ---------------------------------------%3d --------------------------------------------\n",k+1);
2243 printf(
"%12.8f\n",
x[k]);
2245 printf(
"%16.8f\n",
c[0]);
2248 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
2250 for (i = 0; i < mm1; ++i)
2251 if ((z=
TMath::Abs(
a[k+i*200])) > com[i]) com[i] = z;
2253 for (i = 1; i < mm; ++i)
2254 for (jj = i; jj < mm; ++jj) {
2256 c[j-2] =
c[j-1]*z+
c[j-2];
2258 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
2260 for (i = 0; i < mm1; ++i)
2261 if (!(k >= nn-2 && i != 0))
2263 > diff[i]) diff[i] = z;
2265 printf(
" MAXIMUM ABSOLUTE VALUES OF DIFFERENCES \n");
2266 for (i = 1; i <= mm1; ++i) {
2267 printf(
"%18.9E",diff[i-1]);
2272 printf(
" MAXIMUM ABSOLUTE VALUES OF COEFFICIENTS \n");
2273 for (i = 0; i < mm1; ++i) printf(
"%16.8f",com[i]);
2276 for (
n = 10;
n <= 100;
n += 10) {
2281 for (i = 0; i <
n; ++i) {
2288 printf(
"-N = %3d M =%2d\n",
n,
m);
2290 for (i = 0; i < nn; ++i)
2292 a[i+600],
a[i+800],
a[i+1000]);
2294 for (i = 0; i < mm1; ++i)
2295 diff[i] = com[i] = 0;
2296 for (k = 0; k < nn; ++k) {
2297 for (i = 0; i < mm; ++i)
2300 printf(
" ---------------------------------------%3d --------------------------------------------\n",k+1);
2301 printf(
"%12.8f\n",
x[k]);
2302 if (k == nn-1) printf(
"%16.8f\n",
c[0]);
2304 if (k == nn-1)
break;
2306 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
2309 for (i = 0; i < mm1; ++i)
2310 if ((z=
TMath::Abs(
a[k+i*200])) > com[i]) com[i] = z;
2312 for (i = 1; i < mm; ++i) {
2313 for (jj = i; jj < mm; ++jj) {
2315 c[j-2] =
c[j-1]*z+
c[j-2];
2319 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
2322 for (i = 0; i < mm1; ++i)
2323 if (!(k >= nn-2 && i != 0))
2325 > diff[i]) diff[i] = z;
2327 printf(
" MAXIMUM ABSOLUTE VALUES OF DIFFERENCES \n");
2328 for (i = 0; i < mm1; ++i) printf(
"%18.9E",diff[i]);
2330 printf(
" MAXIMUM ABSOLUTE VALUES OF COEFFICIENTS \n");
2333 for (i = 0; i < mm1; ++i) printf(
"%18.9E",com[i]);
2339 printf(
"1 TEST OF TSpline5 WITH NONEQUIDISTANT KNOTS,\n");
2340 printf(
" ONE DOUBLE, ONE TRIPLE KNOT\n");
2361 printf(
"-N = %3d M =%2d\n",
n,
m);
2363 for (i = 0; i <
n; ++i)
2365 a[i+600],
a[i+800],
a[i+1000]);
2367 for (i = 0; i < mm1; ++i)
2368 diff[i] = com[i] = 0;
2369 for (k = 0; k <
n; ++k) {
2370 for (i = 0; i < mm; ++i)
2372 printf(
" ---------------------------------------%3d --------------------------------------------\n",k+1);
2373 printf(
"%12.8f\n",
x[k]);
2375 printf(
"%16.8f\n",
c[0]);
2378 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
2380 for (i = 0; i < mm1; ++i)
2381 if ((z=
TMath::Abs(
a[k+i*200])) > com[i]) com[i] = z;
2383 for (i = 1; i < mm; ++i)
2384 for (jj = i; jj < mm; ++jj) {
2386 c[j-2] =
c[j-1]*z+
c[j-2];
2388 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
2390 for (i = 0; i < mm1; ++i)
2391 if (!(k >=
n-2 && i != 0))
2393 > diff[i]) diff[i] = z;
2395 printf(
" MAXIMUM ABSOLUTE VALUES OF DIFFERENCES \n");
2396 for (i = 0; i < mm1; ++i) printf(
"%18.9E",diff[i]);
2398 printf(
" MAXIMUM ABSOLUTE VALUES OF COEFFICIENTS \n");
2401 for (i = 0; i < mm1; ++i) printf(
"%16.8f",com[i]);
2406 printf(
"1 TEST OF TSpline5 WITH NONEQUIDISTANT KNOTS,\n");
2407 printf(
" TWO DOUBLE, ONE TRIPLE KNOT\n");
2432 printf(
"-N = %3d M =%2d\n",
n,
m);
2434 for (i = 0; i <
n; ++i)
2436 a[i+600],
a[i+800],
a[i+1000]);
2438 for (i = 0; i < mm1; ++i)
2439 diff[i] = com[i] = 0;
2440 for (k = 0; k <
n; ++k) {
2441 for (i = 0; i < mm; ++i)
2443 printf(
" ---------------------------------------%3d --------------------------------------------\n",k+1);
2444 printf(
"%12.8f\n",
x[k]);
2446 printf(
"%16.8f\n",
c[0]);
2449 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
2451 for (i = 0; i < mm1; ++i)
2452 if ((z=
TMath::Abs(
a[k+i*200])) > com[i]) com[i] = z;
2454 for (i = 1; i < mm; ++i)
2455 for (jj = i; jj < mm; ++jj) {
2457 c[j-2] =
c[j-1]*z+
c[j-2];
2459 for (i = 0; i < mm; ++i) printf(
"%16.8f",
c[i]);
2461 for (i = 0; i < mm1; ++i)
2462 if (!(k >=
n-2 && i != 0))
2464 > diff[i]) diff[i] = z;
2466 printf(
" MAXIMUM ABSOLUTE VALUES OF DIFFERENCES \n");
2467 for (i = 0; i < mm1; ++i) printf(
"%18.9E",diff[i]);
2469 printf(
" MAXIMUM ABSOLUTE VALUES OF COEFFICIENTS \n");
2472 for (i = 0; i < mm1; ++i) printf(
"%16.8f",com[i]);
2493 fPoly[i].Streamer(R__b);
int Int_t
Signed integer 4 bytes (int).
short Version_t
Class version identifier (short).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
double Double_t
Double 8 bytes.
const char Option_t
Option string (const char).
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 SaveFillAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1001)
virtual void Streamer(TBuffer &)
virtual Color_t GetLineColor() const
Return the line color.
virtual Width_t GetLineWidth() const
Return the line width.
virtual void SaveLineAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t widdef=1)
virtual Style_t GetLineStyle() const
Return the line style.
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 Streamer(TBuffer &)
virtual void SaveMarkerAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t sizdef=1)
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
1-D histogram with a float per channel (see TH1 documentation)
TH1 is the base class of all histogram classes in ROOT.
@ kLogX
X-axis in log scale.
@ kNoStats
Don't draw stats box.
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.
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
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".
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.
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 fD
Third order expansion coefficient : fD*3! is the third derivative at x.
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 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 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 fE
Fourth order expansion coefficient : fE*4! is the fourth derivative at x.
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.
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.
TSpline(const TSpline &)
Copy constructor.
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
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.