689 if (
gPad->GetLogx()) {
690 for (
Int_t i = 0; i < npoints; i++) {
694 for (
Int_t i = 0; i < npoints; i++)
697 if (!opt &&
gPad->GetLogy()) {
698 for (
Int_t i = 0; i < npoints; i++) {
702 for (
Int_t i = 0; i < npoints; i++)
721 if (distance <= 5)
return distance;
725 const Int_t big = 9999;
726 const Int_t kMaxDiff = 10;
733 if (px <= puxmin)
return big;
734 if (py >= puymin)
return big;
735 if (px >= puxmax)
return big;
736 if (py <= puymax)
return big;
746 theX = theGraphPolar->
GetXpol();
747 theY = theGraphPolar->
GetYpol();
749 theX = theGraph->
GetX();
750 theY = theGraph->
GetY();
754 for (i=0;i<theNpoints;i++) {
755 pxp =
gPad->XtoAbsPixel(
gPad->XtoPad(theX[i]));
756 pyp =
gPad->YtoAbsPixel(
gPad->YtoPad(theY[i]));
766 if (distance < kMaxDiff)
return distance;
768 for (i=0;i<theNpoints-1;i++) {
771 if (
d < distance) distance =
d;
786 TIter next(functions);
790 else dist =
f->DistancetoPrimitive(px,py);
791 if (
dist < kMaxDiff) {
792 gPad->SetSelected(
f);
808 Error(
"DrawPanel",
"need to draw graph first");
813 gROOT->ProcessLine(
Form(
"((TCanvas*)0x%zx)->Selected((TVirtualPad*)0x%zx,(TObject*)0x%zx,1)",
814 (
size_t)
gPad->GetCanvas(), (
size_t)
gPad, (
size_t)theGraph));
836 const Int_t kMaxDiff = 10;
837 static Bool_t middle, badcase;
838 static Int_t ipoint, pxp, pyp;
839 static Int_t px1,px2,py1,py2;
840 static Int_t pxold, pyold, px1old, py1old, px2old, py2old;
841 static Int_t dpx, dpy;
842 static std::vector<Int_t>
x,
y;
849 if (!
gPad->IsEditable())
return;
859 theGraph->TAttLine::Modify();
860 px1 =
gPad->XtoAbsPixel(
gPad->GetX1());
861 py1 =
gPad->YtoAbsPixel(
gPad->GetY1());
862 px2 =
gPad->XtoAbsPixel(
gPad->GetX2());
863 py2 =
gPad->YtoAbsPixel(
gPad->GetY2());
867 if (!
x.empty() || !
y.empty())
break;
868 x.resize(theNpoints+1);
869 y.resize(theNpoints+1);
870 for (i=0;i<theNpoints;i++) {
871 pxp =
gPad->XtoAbsPixel(
gPad->XtoPad(theX[i]));
872 pyp =
gPad->YtoAbsPixel(
gPad->YtoPad(theY[i]));
873 if (pxp < -kMaxPixel || pxp >=
kMaxPixel ||
879 gVirtualX->DrawLine(pxp-4, pyp-4, pxp+4, pyp-4);
880 gVirtualX->DrawLine(pxp+4, pyp-4, pxp+4, pyp+4);
881 gVirtualX->DrawLine(pxp+4, pyp+4, pxp-4, pyp+4);
882 gVirtualX->DrawLine(pxp-4, pyp+4, pxp-4, pyp-4);
887 if (
d < kMaxDiff) ipoint =i;
893 if (ipoint < 0)
return;
897 px2old =
gPad->XtoAbsPixel(theX[1]);
898 py2old =
gPad->YtoAbsPixel(theY[1]);
899 }
else if (ipoint == theNpoints-1) {
900 px1old =
gPad->XtoAbsPixel(
gPad->XtoPad(theX[theNpoints-2]));
901 py1old =
gPad->YtoAbsPixel(
gPad->YtoPad(theY[theNpoints-2]));
905 px1old =
gPad->XtoAbsPixel(
gPad->XtoPad(theX[ipoint-1]));
906 py1old =
gPad->YtoAbsPixel(
gPad->YtoPad(theY[ipoint-1]));
907 px2old =
gPad->XtoAbsPixel(
gPad->XtoPad(theX[ipoint+1]));
908 py2old =
gPad->YtoAbsPixel(
gPad->YtoPad(theY[ipoint+1]));
910 pxold =
gPad->XtoAbsPixel(
gPad->XtoPad(theX[ipoint]));
911 pyold =
gPad->YtoAbsPixel(
gPad->YtoPad(theY[ipoint]));
919 for (i=0;i<theNpoints;i++) {
920 pxp =
gPad->XtoAbsPixel(
gPad->XtoPad(theX[i]));
921 pyp =
gPad->YtoAbsPixel(
gPad->YtoPad(theY[i]));
923 if (
d < kMaxDiff) middle =
kFALSE;
935 for(i=0;i<theNpoints-1;i++) {
936 gVirtualX->DrawLine(
x[i]+dpx,
y[i]+dpy,
x[i+1]+dpx,
y[i+1]+dpy);
939 if (pxp < -kMaxPixel || pxp >=
kMaxPixel ||
940 pyp < -kMaxPixel || pyp >=
kMaxPixel)
continue;
941 gVirtualX->DrawLine(pxp-4, pyp-4, pxp+4, pyp-4);
942 gVirtualX->DrawLine(pxp+4, pyp-4, pxp+4, pyp+4);
943 gVirtualX->DrawLine(pxp+4, pyp+4, pxp-4, pyp+4);
944 gVirtualX->DrawLine(pxp-4, pyp+4, pxp-4, pyp-4);
946 pxp =
x[theNpoints-1]+dpx;
947 pyp =
y[theNpoints-1]+dpy;
948 gVirtualX->DrawLine(pxp-4, pyp-4, pxp+4, pyp-4);
949 gVirtualX->DrawLine(pxp+4, pyp-4, pxp+4, pyp+4);
950 gVirtualX->DrawLine(pxp+4, pyp+4, pxp-4, pyp+4);
951 gVirtualX->DrawLine(pxp-4, pyp+4, pxp-4, pyp-4);
956 for(i=0;i<theNpoints-1;i++) {
957 gVirtualX->DrawLine(
x[i]+dpx,
y[i]+dpy,
x[i+1]+dpx,
y[i+1]+dpy);
960 if (pxp < -kMaxPixel || pxp >=
kMaxPixel ||
961 pyp < -kMaxPixel || pyp >=
kMaxPixel)
continue;
962 gVirtualX->DrawLine(pxp-4, pyp-4, pxp+4, pyp-4);
963 gVirtualX->DrawLine(pxp+4, pyp-4, pxp+4, pyp+4);
964 gVirtualX->DrawLine(pxp+4, pyp+4, pxp-4, pyp+4);
965 gVirtualX->DrawLine(pxp-4, pyp+4, pxp-4, pyp-4);
967 pxp =
x[theNpoints-1]+dpx;
968 pyp =
y[theNpoints-1]+dpy;
969 gVirtualX->DrawLine(pxp-4, pyp-4, pxp+4, pyp-4);
970 gVirtualX->DrawLine(pxp+4, pyp-4, pxp+4, pyp+4);
971 gVirtualX->DrawLine(pxp+4, pyp+4, pxp-4, pyp+4);
972 gVirtualX->DrawLine(pxp-4, pyp+4, pxp-4, pyp-4);
974 if (px1old)
gVirtualX->DrawLine(px1old, py1old, pxold, pyold);
975 if (px2old)
gVirtualX->DrawLine(pxold, pyold, px2old, py2old);
976 gVirtualX->DrawLine(pxold-4, pyold-4, pxold+4, pyold-4);
977 gVirtualX->DrawLine(pxold+4, pyold-4, pxold+4, pyold+4);
978 gVirtualX->DrawLine(pxold+4, pyold+4, pxold-4, pyold+4);
979 gVirtualX->DrawLine(pxold-4, pyold+4, pxold-4, pyold-4);
986 if (px1old)
gVirtualX->DrawLine(px1old, py1old, pxold, pyold);
987 if (px2old)
gVirtualX->DrawLine(pxold, pyold, px2old, py2old);
988 gVirtualX->DrawLine(pxold-4, pyold-4, pxold+4, pyold-4);
989 gVirtualX->DrawLine(pxold+4, pyold-4, pxold+4, pyold+4);
990 gVirtualX->DrawLine(pxold+4, pyold+4, pxold-4, pyold+4);
991 gVirtualX->DrawLine(pxold-4, pyold+4, pxold-4, pyold-4);
1000 dxr = dx/(1 -
gPad->GetLeftMargin() -
gPad->GetRightMargin());
1001 dyr = dy/(1 -
gPad->GetBottomMargin() -
gPad->GetTopMargin());
1007 ymin - dyr*
gPad->GetBottomMargin(),
1017 for(i=0;i<theNpoints;i++) {
1018 if (badcase)
continue;
1019 if (!
x.empty()) theX[i] =
gPad->PadtoX(
gPad->AbsPixeltoX(
x[i]+dpx));
1020 if (!
y.empty()) theY[i] =
gPad->PadtoY(
gPad->AbsPixeltoY(
y[i]+dpy));
1029 theX[ipoint] =
gPad->PadtoX(
gPad->AbsPixeltoX(pxold));
1030 theY[ipoint] =
gPad->PadtoY(
gPad->AbsPixeltoY(pyold));
1034 theX[theNpoints-1] = theX[0];
1035 theY[theNpoints-1] = theY[0];
1037 if (ipoint == theNpoints-1) {
1038 theX[0] = theX[theNpoints-1];
1039 theY[0] = theY[theNpoints-1];
1051 if (
gROOT->IsEscaped()) {
1065 dxr = dx/(1 -
gPad->GetLeftMargin() -
gPad->GetRightMargin());
1066 dyr = dy/(1 -
gPad->GetBottomMargin() -
gPad->GetTopMargin());
1072 ymin - dyr*
gPad->GetBottomMargin(),
1078 for(i=0;i<theNpoints;i++) {
1079 if (badcase)
continue;
1080 if (!
x.empty()) theX[i] =
gPad->PadtoX(
gPad->AbsPixeltoX(
x[i]+dpx));
1081 if (!
y.empty()) theY[i] =
gPad->PadtoY(
gPad->AbsPixeltoY(
y[i]+dpy));
1084 theX[ipoint] =
gPad->PadtoX(
gPad->AbsPixeltoX(pxold));
1085 theY[ipoint] =
gPad->PadtoY(
gPad->AbsPixeltoY(pyold));
1089 theX[theNpoints-1] = theX[0];
1090 theY[theNpoints-1] = theY[0];
1092 if (ipoint == theNpoints-1) {
1093 theX[0] = theX[theNpoints-1];
1094 theY[0] = theY[theNpoints-1];
1148 const Int_t kHighlightRange = 50;
1149 static Int_t distanceOld = kHighlightRange;
1152 if ((distance < kHighlightRange) && (distance < distanceOld)) {
1190 if (
gPad->GetLogx()) {
1194 if (
gPad->GetLogy()) {
1198 if ((hx < uxmin) || (hx > uxmax))
return;
1199 if ((hy < uymin) || (hy > uymax))
return;
1223 strlcpy(chopt,
option,80);
1226 char *l1 = strstr(chopt,
"pfc");
1227 char *l2 = strstr(chopt,
"plc");
1228 char *l3 = strstr(chopt,
"pmc");
1229 if (l1 || l2 || l3) {
1238 char *l4 = strstr(chopt,
"rx");
1239 char *l5 = strstr(chopt,
"ry");
1273 TIter next(functions);
1294 gPad->PushSelectableObject(theGraph);
1296 Int_t optionLine , optionAxis , optionCurve , optionStar , optionMark;
1297 Int_t optionBar , optionR , optionOne , optionE;
1298 Int_t optionFill , optionZ , optionCurveFill, optionIAxis;
1299 Int_t i, npt, nloop;
1302 Double_t barxmin, barxmax, barymin, barymax;
1309 Error(
"PaintGraph",
"illegal number of points (%d)", npoints);
1316 if (opt.
Contains(
"L")) optionLine = 1;
else optionLine = 0;
1317 if (opt.
Contains(
"A")) optionAxis = 1;
else optionAxis = 0;
1318 if (opt.
Contains(
"C")) optionCurve = 1;
else optionCurve = 0;
1319 if (opt.
Contains(
"*")) optionStar = 1;
else optionStar = 0;
1320 if (opt.
Contains(
"P")) optionMark = 1;
else optionMark = 0;
1321 if (opt.
Contains(
"B")) optionBar = 1;
else optionBar = 0;
1322 if (opt.
Contains(
"R")) optionR = 1;
else optionR = 0;
1323 if (opt.
Contains(
"1")) optionOne = 1;
else optionOne = 0;
1324 if (opt.
Contains(
"F")) optionFill = 1;
else optionFill = 0;
1325 if (opt.
Contains(
"I")) optionIAxis = 1;
else optionIAxis = 0;
1331 if (optionLine+optionFill+optionCurve+optionStar+optionMark+optionBar+optionE == 0) {
1332 if (!chopt[0]) optionLine=1;
1338 optionCurveFill = 0;
1339 if (optionCurve && optionFill) {
1340 optionCurveFill = 1;
1345 Double_t rwxmin,rwxmax, rwymin, rwymax, maximum, minimum, dx, dy;
1348 rwxmin =
gPad->GetUxmin();
1349 rwxmax =
gPad->GetUxmax();
1350 rwymin =
gPad->GetUymin();
1351 rwymax =
gPad->GetUymax();
1354 if (minimum == -1111) {
1358 if (maximum == -1111) {
1362 uxmin =
gPad->PadtoX(rwxmin);
1363 uxmax =
gPad->PadtoX(rwxmax);
1366 theGraph->
ComputeRange(rwxmin, rwymin, rwxmax, rwymax);
1368 if (rwxmin == rwxmax) rwxmax += 1.;
1369 if (rwymin == rwymax) rwymax += 1.;
1370 dx = 0.1*(rwxmax-rwxmin);
1371 dy = 0.1*(rwymax-rwymin);
1372 uxmin = rwxmin - dx;
1373 uxmax = rwxmax + dx;
1374 minimum = rwymin - dy;
1375 maximum = rwymax + dy;
1379 if (uxmin < 0 && rwxmin >= 0) uxmin = 0.9*rwxmin;
1380 if (uxmax > 0 && rwxmax <= 0) {
1381 if (
gPad->GetLogx()) uxmax = 1.1*rwxmax;
1384 if (minimum < 0 && rwymin >= 0) minimum = 0.9*rwymin;
1385 if (maximum > 0 && rwymax <= 0) {
1389 if (minimum <= 0 && gPad->GetLogy()) minimum = 0.001*maximum;
1390 if (uxmin <= 0 && gPad->GetLogx()) {
1391 if (uxmax > 1000) uxmin = 1;
1392 else uxmin = 0.001*uxmax;
1399 char chopth[8] =
" ";
1400 if (strstr(chopt,
"x+")) strncat(chopth,
"x+",3);
1401 if (strstr(chopt,
"y+")) strncat(chopth,
"y+",3);
1402 if (optionIAxis) strncat(chopth,
"A",2);
1409 if (theNpoints > npt) npt = theNpoints;
1421 if (
gPad->GetLogy()) {
1434 rwxmin =
gPad->GetUxmin();
1435 rwxmax =
gPad->GetUxmax();
1436 rwymin =
gPad->GetUymin();
1437 rwymax =
gPad->GetUymax();
1438 uxmin =
gPad->PadtoX(rwxmin);
1439 uxmax =
gPad->PadtoX(rwxmax);
1444 maximum =
gPad->PadtoY(rwymax);
1445 minimum =
gPad->PadtoY(rwymin);
1449 theGraph->TAttLine::Modify();
1450 theGraph->TAttFill::Modify();
1451 theGraph->TAttMarker::Modify();
1454 gxwork.resize(2*npoints+10);
1455 gywork.resize(2*npoints+10);
1459 if (optionLine || optionFill) {
1465 if (optionFill && (xn !=
x1 || yn !=
y1)) nloop++;
1467 for (i=1;i<=nloop;i++) {
1510 if (optionCurveFill) {
1512 if (xn !=
x1 || yn !=
y1) nloop++;
1516 for (i=1;i<=nloop;i++) {
1541 for (i=1;i<=nloop;i++) {
1545 if (
y[i-1] < minimum ||
y[i-1] > maximum)
continue;
1546 if (
x[i-1] < uxmin ||
x[i-1] > uxmax)
continue;
1572 for (i=1;i<=npoints;i++) {
1587 for (i=1;i<=npoints;i++) {
1602 if(FillSave ==
gPad->GetFrameFillColor()) {
1604 if (
gPad->GetFrameFillColor()==1) {
1606 theGraph->TAttFill::Modify();
1609 theGraph->TAttFill::Modify();
1615 for (i=1;i<npoints;i++) {
1616 if (
x[i] < barxmin) barxmin =
x[i];
1617 if (
x[i] > barxmax) barxmax =
x[i];
1619 bdelta = (barxmax-barxmin)/
Double_t(npoints);
1623 for (i=1;i<npoints;i++) {
1624 if (
y[i] < barymin) barymin =
y[i];
1625 if (
y[i] > barymax) barymax =
y[i];
1627 bdelta = (barymax-barymin)/
Double_t(npoints);
1631 for (i=1;i<=npoints;i++) {
1632 xlow =
x[i-1] - dbar;
1633 xhigh =
x[i-1] + dbar;
1635 if (xlow < uxmin && xhigh < uxmin)
continue;
1636 if (xhigh > uxmax && xlow > uxmax)
continue;
1637 if (xlow < uxmin) xlow = uxmin;
1638 if (xhigh > uxmax) xhigh = uxmax;
1640 else ylow =
gPad->GetUymin();
1654 for (i=1;i<=npoints;i++) {
1656 ylow =
y[i-1] - dbar;
1657 yhigh =
y[i-1] + dbar;
1668 theGraph->TAttFill::Modify();
1712 const char *where =
"PaintGrapHist";
1714 Int_t optionLine , optionAxis , optionCurve, optionStar, optionMark;
1715 Int_t optionBar , optionRot , optionOne , optionOff ;
1716 Int_t optionFill , optionZ;
1717 Int_t optionHist , optionBins , optionMarker;
1719 Int_t drawtype=0, drawborder, drawbordersav;
1725 Double_t xi, xi1, xj, xj1, yi1, yi, yj, yj1, xwmin, ywmin;
1729 char choptaxis[10] =
" ";
1732 Error(where,
"illegal number of points (%d)", npoints);
1737 if (opt.
Contains(
"H")) optionHist = 1;
else optionHist = 0;
1738 if (opt.
Contains(
"F")) optionFill = 1;
else optionFill = 0;
1739 if (opt.
Contains(
"C")) optionCurve= 1;
else optionCurve= 0;
1740 if (opt.
Contains(
"*")) optionStar = 1;
else optionStar = 0;
1741 if (opt.
Contains(
"R")) optionRot = 1;
else optionRot = 0;
1742 if (opt.
Contains(
"1")) optionOne = 1;
else optionOne = 0;
1743 if (opt.
Contains(
"B")) optionBar = 1;
else optionBar = 0;
1744 if (opt.
Contains(
"N")) optionBins = 1;
else optionBins = 0;
1745 if (opt.
Contains(
"L")) optionLine = 1;
else optionLine = 0;
1746 if (opt.
Contains(
"P")) optionMark = 1;
else optionMark = 0;
1747 if (opt.
Contains(
"A")) optionAxis = 1;
else optionAxis = 0;
1748 if (opt.
Contains(
"][")) optionOff = 1;
else optionOff = 0;
1749 if (opt.
Contains(
"P0")) optionMark = 10;
1751 Int_t optionFill2 = 0;
1753 optionFill = 0; optionFill2 = 1;
1768 nbins = last -
first + 1;
1780 Double_t rounding = (uxmax-uxmin)*1.e-5;
1783 Int_t nx1, nx2, ndivx, ndivy, ndiv;
1796 if (ndivx < 0) strlcat(choptaxis,
"N",10);
1797 if (
gPad->GetGridx()) {
1799 strlcat(choptaxis,
"W",10);
1801 if (
gPad->GetLogx()) {
1805 strlcat(choptaxis,
"G",10);
1815 axis.
PaintAxis(rwxmin,rwymin,rwxmax,rwymin,rwmin,rwmax,ndiv,choptaxis);
1825 strlcat(choptaxis,
"N",10);
1828 if (
gPad->GetGridy()) {
1830 strlcat(choptaxis,
"W",10);
1832 if (
gPad->GetLogy()) {
1836 strlcat(choptaxis,
"G",10);
1845 axis.
PaintAxis(rwxmin,rwymin,rwxmin,rwymax,rwmin,rwmax,ndiv,choptaxis);
1850 theGraph->TAttLine::Modify();
1851 theGraph->TAttFill::Modify();
1852 theGraph->TAttMarker::Modify();
1861 Int_t fwidth =
gPad->GetFrameLineWidth();
1864 if (optionOff) fwidth = 1;
1875 gxwork.resize(2*npoints+10);
1876 gywork.resize(2*npoints+10);
1880 if (optionFill && !optionCurve) {
1888 for (j=
first; j<=last;j++) {
1895 xj1 =
x[j]; xj =
x[j-1];
1897 if (j != last)
Error(where,
"X must be in increasing order");
1898 else Error(where,
"X must have N+1 values with option N");
1906 if ((
gxwork[npt-1] >= uxmin-rounding &&
gxwork[npt-1] <= uxmax+rounding) ||
1907 (
gxwork[npt] >= uxmin-rounding &&
gxwork[npt] <= uxmax+rounding)) npt += 2;
1920 if (!fillarea)
gyworkl[0] = ylast;
1931 for (j=
first; j<=last;j++) {
1936 yj1 =
y[j]; yj =
y[j-1];
1938 if (j != last)
Error(where,
"Y must be in increasing order");
1939 else Error(where,
"Y must have N+1 values with option N");
1945 if ((
gxwork[npt-1] >= uxmin-rounding &&
gxwork[npt-1] <= uxmax+rounding) ||
1946 (
gxwork[npt] >= uxmin-rounding &&
gxwork[npt] <= uxmax+rounding)) npt += 2;
1953 if (!fillarea)
gyworkl[0] = ylast;
1960 theGraph->TAttLine::Modify();
1961 theGraph->TAttFill::Modify();
1966 if ((optionHist) || !chopt[0]) {
1973 for (i=
first; i<=last;i++) {
1978 xi1 =
x[i]; xi =
x[i-1];
1980 if (i != last)
Error(where,
"X must be in increasing order");
1981 else Error(where,
"X must have N+1 values with option N");
1989 if ((
gxwork[npt-1] >= uxmin-rounding &&
gxwork[npt-1] <= uxmax+rounding) ||
1990 (
gxwork[npt] >= uxmin-rounding &&
gxwork[npt] <= uxmax+rounding)) npt += 2;
2002 Int_t nbpoints = npt-2;
2008 for (ip=point1; ip<=nbpoints; ip++) {
2015 Int_t point2 = nbpoints;
2016 for (ip=point2; ip>=point1; ip--) {
2022 nbpoints = point2-point1+1;
2026 if (
gxwork[0] >
gPad->GetUxmin()) { nbpoints++; point1 = 0; }
2027 if (
gxwork[nbpoints] <
gPad->GetUxmax()) nbpoints++;
2030 gPad->PaintPolyLine(nbpoints,
gxworkl.data() + point1,
gyworkl.data() + point1, noClip);
2039 for (i=
first; i<=last;i++) {
2044 yi1 =
y[i]; yi =
y[i-1];
2046 if (i != last)
Error(where,
"Y must be in increasing order");
2047 else Error(where,
"Y must have N+1 values with option N");
2053 if ((
gxwork[npt-1] >= uxmin-rounding &&
gxwork[npt-1] <= uxmax+rounding) ||
2054 (
gxwork[npt] >= uxmin-rounding &&
gxwork[npt] <= uxmax+rounding)) npt += 2;
2073 if (!optionOne) drawtype = 2;
2078 for (i=
first; i<=last;i++) {
2083 xi1 =
x[i]; xi =
x[i-1];
2085 if (i != last)
Error(where,
"X must be in increasing order");
2086 else Error(where,
"X must have N+1 values with option N");
2089 gxwork[npt-1] =
x[i-1] + 0.5*(
x[i]-
x[i-1]);
2120 drawtype = drawtype+10;
2122 for (i=
first; i<=last;i++) {
2127 yi1 =
y[i]; yi =
y[i-1];
2129 if (i != last)
Error(where,
"Y must be in increasing order");
2130 else Error(where,
"Y must have N+1 values with option N");
2133 gywork[npt-1] =
y[i-1] + 0.5*(
y[i]-
y[i-1]);
2166 wminstep =
wmin + 0.5*delta;
2168 gPad->GetRangeAxis(ax1,ay1,ax2,ay2);
2172 for (i=
first; i<=last;i++) {
2177 xi1 =
x[i]; xi =
x[i-1];
2179 if (i != last)
Error(where,
"X must be in increasing order");
2180 else Error(where,
"X must have N+1 values with option N");
2183 gxwork[npt-1] =
x[i-1] + 0.5*(
x[i]-
x[i-1]);
2185 if (
gxwork[npt-1] < uxmin ||
gxwork[npt-1] > uxmax) { npt--;
continue;}
2188 if ((
gywork[npt-1] < rwymin) || ((
gywork[npt-1] > rwymax) && !optionFill2)) {
2225 for (i=
first; i<=last;i++) {
2228 gywork[npt-1] = wminstep+(i-
first)*delta+0.5*delta;
2230 yi1 =
y[i]; yi =
y[i-1];
2232 if (i != last)
Error(where,
"Y must be in increasing order");
2233 else Error(where,
"Y must have N+1 values with option N");
2236 gywork[npt-1] =
y[i-1] + 0.5*(
y[i]-
y[i-1]);
2239 if ((
gxwork[npt-1] < uxmin) || (
gxwork[npt-1] > uxmax)) {
2261 if (optionLine != 0 && npt > 1) {
2272 offset = delta*baroffset; dbar = delta*barwidth;
2276 dbar = (
x[1]-
x[0])*barwidth;
2279 dbar = (
y[1]-
y[0])*barwidth;
2282 drawbordersav = drawborder;
2289 else ylow =
gPad->GetUymin();
2291 for (i=
first; i<=last;i++) {
2298 if (xlow < rwxmax && xhigh > rwxmin)
2302 xhigh = xhigh+delta;
2305 xi1 =
x[i]; xi =
x[i-1];
2307 Error(where,
"X must be in increasing order");
2311 dbar = (
x[i+1]-
x[i])*barwidth;
2321 else xlow =
gPad->GetUxmin();
2322 for (i=
first; i<=last;i++) {
2330 gPad->PaintBox(xlow,ylow,xhigh,yhigh);
2332 ylow = ylow + delta;
2333 yhigh = yhigh + delta;
2336 yi1 =
y[i]; yi =
y[i-1];
2338 Error(where,
"Y must be in increasing order");
2342 dbar = (
y[i+1]-
y[i])*barwidth;
2355 if ((optionStar) || (optionMark)) optionMarker=1;
2361 for (i=
first; i<=last;i++) {
2362 if (!optionBins) xm =
wmin+(i-
first)*delta+0.5*delta;
2363 else xm =
x[i-1] + 0.5*(
x[i]-
x[i-1]);
2365 if (optionMark != 10) {
2366 if (ym<rwymax && ym > rwymin) {
2372 if (ym<rwymax && ym >= rwymin) {
2389 wminstep =
wmin + 0.5*delta;
2390 for (i=
first; i<=last;i++) {
2391 if (!optionBins) ym = wminstep+(i-
first)*delta+0.5*delta;
2392 else ym =
y[i-1] + 0.5*(
y[i]-
y[i-1]);
2394 if (optionMark != 10) {
2395 if (xm<rwxmax && xm > rwxmin) {
2401 if (xm<rwxmax && xm >= rwxmin) {
2436 std::vector<Double_t> xline, yline;
2441 const Int_t kBASEMARKER=8;
2442 Double_t s2x, s2y, symbolsize, sbase;
2443 Double_t x,
y, xl1, xl2, xr1, xr2, yup1, yup2, ylow1, ylow2, tx, ty;
2444 static Float_t cxx[30] = {1.0,1.0,0.5,0.5,1.0,1.0,0.5,0.6,1.0,0.5,0.5,1.0,0.5,0.6,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,0.5,0.5,0.5,1.0};
2445 static Float_t cyy[30] = {1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.5,0.5,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,0.5,0.5,0.5,1.0};
2464 const char *arrowOpt =
nullptr;
2465 if (strchr(
option,
'>')) arrowOpt =
">";
2466 if (strstr(
option,
"|>")) arrowOpt =
"|>";
2485 xline.resize(2*theNpoints);
2486 yline.resize(2*theNpoints);
2487 if (xline.empty() || yline.empty()) {
2488 Error(
"PaintGraphAsymmErrors",
"too many points, out of memory");
2495 theGraph->TAttLine::Modify();
2510 sbase = symbolsize*kBASEMARKER;
2523 tx =
gPad->PixeltoX(dxend) -
gPad->PixeltoX(0);
2524 ty =-
gPad->PixeltoY(dxend) +
gPad->PixeltoY(0);
2525 Float_t asize = 0.6*symbolsize*kBASEMARKER/
gPad->GetWh();
2528 for (
Int_t i=0;i<theNpoints;i++) {
2529 x =
gPad->XtoPad(theX[i]);
2530 y =
gPad->YtoPad(theY[i]);
2533 if (x < gPad->GetUxmin())
x =
gPad->GetUxmin();
2534 if (
x >
gPad->GetUxmax())
x =
gPad->GetUxmax();
2535 if (y < gPad->GetUymin())
y =
gPad->GetUymin();
2536 if (
y >
gPad->GetUymax())
y =
gPad->GetUymax();
2538 if (x < gPad->GetUxmin())
continue;
2539 if (
x >
gPad->GetUxmax())
continue;
2540 if (y < gPad->GetUymin())
continue;
2541 if (
y >
gPad->GetUymax())
continue;
2545 xl2 =
gPad->XtoPad(theX[i] - theEXlow[i]);
2549 x1b =
gPad->XtoPad(theX[i] - theEXlow[i]);
2550 y1b =
gPad->YtoPad(theY[i] - theEYlow[i]);
2551 x2b =
gPad->XtoPad(theX[i] + theEXhigh[i]);
2552 y2b =
gPad->YtoPad(theY[i] + theEYhigh[i]);
2553 if (x1b < gPad->GetUxmin()) x1b =
gPad->GetUxmin();
2554 if (x1b >
gPad->GetUxmax()) x1b =
gPad->GetUxmax();
2555 if (y1b < gPad->GetUymin()) y1b =
gPad->GetUymin();
2556 if (y1b >
gPad->GetUymax()) y1b =
gPad->GetUymax();
2557 if (x2b < gPad->GetUxmin()) x2b =
gPad->GetUxmin();
2558 if (x2b >
gPad->GetUxmax()) x2b =
gPad->GetUxmax();
2559 if (y2b < gPad->GetUymin()) y2b =
gPad->GetUymin();
2560 if (y2b >
gPad->GetUymax()) y2b =
gPad->GetUymax();
2561 if (option5)
box.PaintBox(x1b, y1b, x2b, y2b,
"l");
2562 else box.PaintBox(x1b, y1b, x2b, y2b);
2570 yline[if1-1] =
gPad->YtoPad(theY[i] + theEYhigh[i]);
2571 yline[if2-1] =
gPad->YtoPad(theY[i] - theEYlow[i]);
2579 arrow.PaintArrow(xl1,
y,xl2,
y,asize,arrowOpt);
2581 if (!brackets)
gPad->PaintLine(xl1,
y,xl2,
y);
2584 xb[0] = xl2+tx; yb[0] =
y-ty;
2585 xb[1] = xl2; yb[1] =
y-ty;
2586 xb[2] = xl2; yb[2] =
y+ty;
2587 xb[3] = xl2+tx; yb[3] =
y+ty;
2588 gPad->PaintPolyLine(4, xb, yb);
2590 gPad->PaintLine(xl2,
y-ty,xl2,
y+ty);
2596 xr2 =
gPad->XtoPad(theX[i] + theEXhigh[i]);
2599 arrow.PaintArrow(xr1,
y,xr2,
y,asize,arrowOpt);
2601 if (!brackets)
gPad->PaintLine(xr1,
y,xr2,
y);
2604 xb[0] = xr2-tx; yb[0] =
y-ty;
2605 xb[1] = xr2; yb[1] =
y-ty;
2606 xb[2] = xr2; yb[2] =
y+ty;
2607 xb[3] = xr2-tx; yb[3] =
y+ty;
2608 gPad->PaintPolyLine(4, xb, yb);
2610 gPad->PaintLine(xr2,
y-ty,xr2,
y+ty);
2616 yup2 =
gPad->YtoPad(theY[i] + theEYhigh[i]);
2617 if (yup2 >
gPad->GetUymax()) yup2 =
gPad->GetUymax();
2620 arrow.PaintArrow(
x,yup1,
x,yup2,asize,arrowOpt);
2622 if (!brackets)
gPad->PaintLine(
x,yup1,
x,yup2);
2625 xb[0] =
x-tx; yb[0] = yup2-ty;
2626 xb[1] =
x-tx; yb[1] = yup2;
2627 xb[2] =
x+tx; yb[2] = yup2;
2628 xb[3] =
x+tx; yb[3] = yup2-ty;
2629 gPad->PaintPolyLine(4, xb, yb);
2631 gPad->PaintLine(
x-tx,yup2,
x+tx,yup2);
2637 ylow2 =
gPad->YtoPad(theY[i] - theEYlow[i]);
2638 if (ylow2 < gPad->GetUymin()) ylow2 =
gPad->GetUymin();
2639 if (ylow2 < ylow1) {
2641 arrow.PaintArrow(
x,ylow1,
x,ylow2,asize,arrowOpt);
2643 if (!brackets)
gPad->PaintLine(
x,ylow1,
x,ylow2);
2646 xb[0] =
x-tx; yb[0] = ylow2+ty;
2647 xb[1] =
x-tx; yb[1] = ylow2;
2648 xb[2] =
x+tx; yb[2] = ylow2;
2649 xb[3] =
x+tx; yb[3] = ylow2+ty;
2650 gPad->PaintPolyLine(4, xb, yb);
2652 gPad->PaintLine(
x-tx,ylow2,
x+tx,ylow2);
2666 if (option4)
PaintGraph(theGraph, 2*theNpoints, xline.data(), yline.data(),
"FC");
2667 else PaintGraph(theGraph, 2*theNpoints, xline.data(), yline.data(),
"F");
2668 gPad->SetLogx(logx);
2669 gPad->SetLogy(logy);
2685 Int_t NYErrors = tg->GetNYErrors();
2686 if (NYErrors <= 0) {
2694 std::vector<TString> options(NYErrors + 1);
2703 while ((firstSemicolon = tsOpt.
First(
';')) !=
kNPOS && filled <= NYErrors) {
2704 options[filled] = tsOpt(0, firstSemicolon);
2705 tsOpt = tsOpt(firstSemicolon + 1, tsOpt.
Length());
2709 if (filled <= NYErrors) {
2710 options[filled] = tsOpt.
Copy();
2714 for (
Int_t i = filled; i <= NYErrors; i++)
2717 std::vector<Double_t> xline;
2718 std::vector<std::vector<Double_t>> yline(NYErrors);
2723 const Int_t kBASEMARKER = 8;
2724 Double_t s2x, s2y, symbolsize, sbase;
2725 Double_t x,
y, xl1, xl2, xr1, xr2, yup1, yup2, ylow1, ylow2, tx, ty;
2726 static Float_t cxx[30] = {1.0,1.0,0.5,0.5,1.0,1.0,0.5,0.6,1.0,0.5,0.5,1.0,0.5,0.6,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,0.5,0.5,0.5,1.0};
2727 static Float_t cyy[30] = {1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.5,0.5,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,0.5,0.5,0.5,1.0};
2728 Int_t theNpoints = tg->GetN();
2732 Double_t *theExH = tg->GetEXhigh();
2733 std::vector<Double_t *> theEyL(NYErrors);
2734 std::vector<Double_t *> theEyH(NYErrors);
2737 for (
Int_t j = 0; j < NYErrors; j++) {
2738 theEyL[j] = tg->GetEYlow(j);
2739 theEyH[j] = tg->GetEYhigh(j);
2740 theEyExists &= (theEyL[j] && theEyH[j]);
2743 if (!theX || !theY || !theExL || !theExH || !theEyExists)
2746 std::vector<Bool_t> DrawErrors(NYErrors);
2751 std::vector<Bool_t> Braticks(NYErrors);
2752 std::vector<Bool_t> Brackets(NYErrors);
2753 std::vector<Bool_t> EndLines(NYErrors);
2754 std::vector<Char_t *> ArrowOpt(NYErrors);
2755 std::vector<Bool_t> Option5(NYErrors);
2756 std::vector<Bool_t> Option4(NYErrors);
2757 std::vector<Bool_t> Option3(NYErrors);
2759 std::vector<Bool_t> Option2(NYErrors);
2760 std::vector<Bool_t> Option0(NYErrors);
2762 std::vector<Double_t> Scale(NYErrors);
2764 const TRegexp ScaleRegExp(
"s=*[0-9]\\.*[0-9]");
2766 for (
Int_t j = 0; j < NYErrors; j++) {
2767 if (options[j + 1].Contains(
"s=")) {
2768 sscanf(strstr(options[j + 1].Data(),
"s="),
"s=%lf", &Scale[j]);
2769 options[j + 1].ReplaceAll(options[j + 1](ScaleRegExp),
"");
2773 DrawErrors[j] = !options[j + 1].Contains(
"x");
2774 AnyErrors |= DrawErrors[j];
2775 Braticks[j] = options[j + 1].Contains(
"[]");
2776 Brackets[j] = options[j + 1].Contains(
"||") || Braticks[j];
2777 EndLines[j] = !options[j + 1].Contains(
"z");
2779 if (options[j + 1].Contains(
"|>"))
2780 ArrowOpt[j] = (
Char_t *)
"|>";
2781 else if (options[j + 1].Contains(
">"))
2782 ArrowOpt[j] = (
Char_t *)
">";
2784 ArrowOpt[j] =
nullptr;
2786 Option5[j] = options[j + 1].Contains(
"5");
2787 Option4[j] = options[j + 1].Contains(
"4");
2788 Option3[j] = options[j + 1].Contains(
"3") || Option4[j];
2789 AnyOption3 |= Option3[j];
2790 Option2[j] = options[j + 1].Contains(
"2") || Option5[j];
2791 Option0[j] = options[j + 1].Contains(
"0");
2792 AnyOption0 |= Option0[j];
2794 NoErrorsX &= (Option3[j] || Option2[j]);
2795 Option0X |= !(Option3[j] || Option2[j]) && Option0[j];
2796 DrawMarker |= !(Brackets[j] || Option3[j] || Option2[j]);
2799 Bool_t Draw0PointsX = !options[0].Contains(
"x0") && (
gPad->GetLogx() == 0);
2800 Bool_t Draw0PointsY = !options[0].Contains(
"y0") && (
gPad->GetLogy() == 0);
2801 options[0].ReplaceAll(
"x0",
"");
2802 options[0].ReplaceAll(
"y0",
"");
2804 Bool_t DrawErrorsX = !options[0].Contains(
"x");
2805 Bool_t BraticksX = options[0].Contains(
"[]");
2806 Bool_t BracketsX = options[0].Contains(
"||") || BraticksX;
2807 Bool_t EndLinesX = !options[0].Contains(
"z");
2809 Char_t *ArrowOptX =
nullptr;
2810 if (options[0].Contains(
"|>"))
2811 ArrowOptX = (
Char_t *)
"|>";
2812 else if (options[0].Contains(
">"))
2813 ArrowOptX = (
Char_t *)
">";
2816 if (options[0].Contains(
"s=")) {
2817 sscanf(strstr(options[0].Data(),
"s="),
"s=%lf", &ScaleX);
2818 options[0].ReplaceAll(options[0](ScaleRegExp),
"");
2821 if (!AnyErrors && !DrawErrorsX) {
2826 Bool_t DrawAxis = options[0].Contains(
"a");
2827 Bool_t IndividualStyles = options[0].Contains(
"s");
2832 Int_t NPointsInside = AnyOption0 ? theNpoints : 0;
2834 for (
Int_t i = 0; i < theNpoints && !AnyOption0; i++) {
2835 x =
gPad->XtoPad(theX[i]);
2836 y =
gPad->YtoPad(theY[i]);
2838 if ((
x >=
gPad->GetUxmin()) && (x <= gPad->GetUxmax()) && (
y >=
gPad->GetUymin()) && (y <= gPad->GetUymax()) &&
2839 (Draw0PointsX || theX[i] != 0.) && (Draw0PointsY || theY[i] != 0.))
2844 xline.resize(2 * NPointsInside);
2846 if (xline.empty()) {
2847 Error(
"PaintGraphMultiErrors",
"too many points, out of memory");
2852 if2 = 2 * NPointsInside;
2855 for (
Int_t j = 0; j < NYErrors; j++) {
2856 if (Option3[j] && DrawErrors[j]) {
2857 yline[j].resize(2 * NPointsInside);
2859 if (yline[j].empty()) {
2860 Error(
"PaintGraphMultiErrors",
"too many points, out of memory");
2866 tg->TAttLine::Modify();
2869 arrow.SetLineWidth(tg->GetLineWidth());
2870 arrow.SetLineColor(tg->GetLineColor());
2871 arrow.SetFillColor(tg->GetFillColor());
2875 box.SetLineWidth(tg->GetLineWidth());
2876 box.SetLineColor(tg->GetLineColor());
2877 box.SetFillColor(tg->GetFillColor());
2878 box.SetFillStyle(tg->GetFillStyle());
2880 symbolsize = tg->GetMarkerSize();
2881 sbase = symbolsize * kBASEMARKER;
2887 cx = cxx[
mark - 20];
2888 cy = cyy[
mark - 20];
2892 s2x =
gPad->PixeltoX(
Int_t(0.5 * sbase)) -
gPad->PixeltoX(0);
2893 s2y = -
gPad->PixeltoY(
Int_t(0.5 * sbase)) +
gPad->PixeltoY(0);
2895 tx =
gPad->PixeltoX(dxend) -
gPad->PixeltoX(0);
2896 ty = -
gPad->PixeltoY(dxend) +
gPad->PixeltoY(0);
2897 Float_t asize = 0.6 * symbolsize * kBASEMARKER /
gPad->GetWh();
2901 for (
Int_t i = 0; i < theNpoints; i++) {
2902 x =
gPad->XtoPad(theX[i]);
2903 y =
gPad->YtoPad(theY[i]);
2906 (
x <
gPad->GetUxmin()) || (
x >
gPad->GetUxmax()) || (y < gPad->GetUymin()) || (
y >
gPad->GetUymax());
2908 if ((isOutside && !AnyOption0) || (!Draw0PointsX && theX[i] == 0.) || (!Draw0PointsY && theY[i] == 0.))
2913 if (x < gPad->GetUxmin())
2914 x =
gPad->GetUxmin();
2915 if (
x >
gPad->GetUxmax())
2916 x =
gPad->GetUxmax();
2917 if (y < gPad->GetUymin())
2918 y =
gPad->GetUymin();
2919 if (
y >
gPad->GetUymax())
2920 y =
gPad->GetUymax();
2930 for (
Int_t j = 0; j < NYErrors; j++) {
2935 if (Option2[j] && (!isOutside || Option0[j])) {
2936 if (IndividualStyles) {
2937 box.SetLineWidth(tg->GetLineWidth(j));
2938 box.SetLineColor(tg->GetLineColor(j));
2939 box.SetFillColor(tg->GetFillColor(j));
2940 box.SetFillStyle(tg->GetFillStyle(j));
2943 x1b =
gPad->XtoPad(theX[i] - Scale[j] * theExL[i]);
2944 y1b =
gPad->YtoPad(theY[i] - theEyL[j][i]);
2945 x2b =
gPad->XtoPad(theX[i] + Scale[j] * theExH[i]);
2946 y2b =
gPad->YtoPad(theY[i] + theEyH[j][i]);
2947 if (x1b < gPad->GetUxmin())
2948 x1b =
gPad->GetUxmin();
2949 if (x1b >
gPad->GetUxmax())
2950 x1b =
gPad->GetUxmax();
2951 if (y1b < gPad->GetUymin())
2952 y1b =
gPad->GetUymin();
2953 if (y1b >
gPad->GetUymax())
2954 y1b =
gPad->GetUymax();
2955 if (x2b < gPad->GetUxmin())
2956 x2b =
gPad->GetUxmin();
2957 if (x2b >
gPad->GetUxmax())
2958 x2b =
gPad->GetUxmax();
2959 if (y2b < gPad->GetUymin())
2960 y2b =
gPad->GetUymin();
2961 if (y2b >
gPad->GetUymax())
2962 y2b =
gPad->GetUymax();
2964 box.PaintBox(x1b, y1b, x2b, y2b,
"l");
2966 box.PaintBox(x1b, y1b, x2b, y2b);
2971 if (!isOutside || Option0[j]) {
2972 yline[j][if1 - 2] =
gPad->YtoPad(theY[i] + theEyH[j][i]);
2973 yline[j][if2] =
gPad->YtoPad(theY[i] - theEyL[j][i]);
2975 yline[j][if1 - 2] =
gPad->GetUymin();
2976 yline[j][if2] =
gPad->GetUymin();
2980 if (IndividualStyles) {
2981 tg->GetAttLine(j)->Modify();
2983 arrow.SetLineWidth(tg->GetLineWidth(j));
2984 arrow.SetLineColor(tg->GetLineColor(j));
2985 arrow.SetFillColor(tg->GetFillColor(j));
2988 ylow1 =
y - s2y * cy;
2989 ylow2 =
gPad->YtoPad(theY[i] - theEyL[j][i]);
2990 if (ylow2 < gPad->GetUymin())
2991 ylow2 =
gPad->GetUymin();
2992 if (ylow2 < ylow1 && DrawErrors[j] && !Option2[j] && !Option3[j] && (!isOutside || Option0[j])) {
2994 arrow.PaintArrow(
x, ylow1,
x, ylow2, asize, ArrowOpt[j]);
2997 gPad->PaintLine(
x, ylow1,
x, ylow2);
3008 gPad->PaintPolyLine(4, xb, yb);
3010 gPad->PaintLine(
x - tx, ylow2,
x + tx, ylow2);
3015 yup1 =
y + s2y * cy;
3016 yup2 =
gPad->YtoPad(theY[i] + theEyH[j][i]);
3017 if (yup2 >
gPad->GetUymax())
3018 yup2 =
gPad->GetUymax();
3019 if (yup2 > yup1 && DrawErrors[j] && !Option2[j] && !Option3[j] && (!isOutside || Option0[j])) {
3021 arrow.PaintArrow(
x, yup1,
x, yup2, asize, ArrowOpt[j]);
3024 gPad->PaintLine(
x, yup1,
x, yup2);
3035 gPad->PaintPolyLine(4, xb, yb);
3037 gPad->PaintLine(
x - tx, yup2,
x + tx, yup2);
3044 if (IndividualStyles) {
3045 tg->TAttLine::Modify();
3047 arrow.SetLineWidth(tg->GetLineWidth());
3048 arrow.SetLineColor(tg->GetLineColor());
3049 arrow.SetFillColor(tg->GetFillColor());
3053 xl2 =
gPad->XtoPad(theX[i] - ScaleX * theExL[i]);
3054 if (xl1 > xl2 && !NoErrorsX && (!isOutside || Option0X)) {
3056 arrow.PaintArrow(xl1,
y, xl2,
y, asize, ArrowOptX);
3059 gPad->PaintLine(xl1,
y, xl2,
y);
3070 gPad->PaintPolyLine(4, xb, yb);
3072 gPad->PaintLine(xl2,
y - ty, xl2,
y + ty);
3078 xr2 =
gPad->XtoPad(theX[i] + ScaleX * theExH[i]);
3079 if (xr1 < xr2 && !NoErrorsX && (!isOutside || Option0X)) {
3081 arrow.PaintArrow(xr1,
y, xr2,
y, asize, ArrowOptX);
3084 gPad->PaintLine(xr1,
y, xr2,
y);
3095 gPad->PaintPolyLine(4, xb, yb);
3097 gPad->PaintLine(xr2,
y - ty, xr2,
y + ty);
3109 tg->TAttFill::Copy(tgDummy);
3110 tg->TAttLine::Copy(tgDummy);
3111 tg->TAttMarker::Copy(tgDummy);
3113 for (
Int_t j = 0; j < NYErrors; j++)
3114 if (Option3[j] && DrawErrors[j]) {
3115 if (IndividualStyles) {
3116 tg->GetAttFill(j)->
Copy(tgDummy);
3117 tg->GetAttLine(j)->Copy(tgDummy);
3125 PaintGraph(&tgDummy, 2 * NPointsInside, xline.data(), yline[j].data(),
"FC");
3127 PaintGraph(&tgDummy, 2 * NPointsInside, xline.data(), yline[j].data(),
"F");
3128 gPad->SetLogx(logx);
3129 gPad->SetLogy(logy);
3140 std::vector<Double_t> xline, yline;
3145 const Int_t kBASEMARKER=8;
3146 Double_t s2x, s2y, symbolsize, sbase;
3147 Double_t x,
y, xl1, xl2, xr1, xr2, yup1, yup2, ylow1, ylow2, tx, ty;
3149 static Float_t cxx[30] = {1.0,1.0,0.5,0.5,1.0,1.0,0.5,0.6,1.0,0.5,0.5,1.0,0.5,0.6,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,0.5,0.5,0.5,1.0};
3150 static Float_t cyy[30] = {1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.5,0.5,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,0.5,0.5,0.5,1.0};
3173 const char *arrowOpt =
nullptr;
3174 if (strchr(
option,
'>')) arrowOpt =
">";
3175 if (strstr(
option,
"|>")) arrowOpt =
"|>";
3194 xline.resize(2*theNpoints);
3195 yline.resize(2*theNpoints);
3196 if (xline.empty() || yline.empty()) {
3197 Error(
"PaintGraphBentErrors",
"too many points, out of memory");
3204 theGraph->TAttLine::Modify();
3219 sbase = symbolsize*kBASEMARKER;
3232 tx =
gPad->PixeltoX(dxend) -
gPad->PixeltoX(0);
3233 ty =-
gPad->PixeltoY(dxend) +
gPad->PixeltoY(0);
3234 Float_t asize = 0.6*symbolsize*kBASEMARKER/
gPad->GetWh();
3237 for (
Int_t i=0;i<theNpoints;i++) {
3238 x =
gPad->XtoPad(theX[i]);
3239 y =
gPad->YtoPad(theY[i]);
3240 bxl =
gPad->YtoPad(theY[i]+theEXlowd[i]);
3241 bxh =
gPad->YtoPad(theY[i]+theEXhighd[i]);
3242 byl =
gPad->XtoPad(theX[i]+theEYlowd[i]);
3243 byh =
gPad->XtoPad(theX[i]+theEYhighd[i]);
3246 if (x < gPad->GetUxmin())
x =
gPad->GetUxmin();
3247 if (
x >
gPad->GetUxmax())
x =
gPad->GetUxmax();
3248 if (y < gPad->GetUymin())
y =
gPad->GetUymin();
3249 if (
y >
gPad->GetUymax())
y =
gPad->GetUymax();
3251 if (x < gPad->GetUxmin())
continue;
3252 if (
x >
gPad->GetUxmax())
continue;
3253 if (y < gPad->GetUymin())
continue;
3254 if (
y >
gPad->GetUymax())
continue;
3260 x1b =
gPad->XtoPad(theX[i] - theEXlow[i]);
3261 y1b =
gPad->YtoPad(theY[i] - theEYlow[i]);
3262 x2b =
gPad->XtoPad(theX[i] + theEXhigh[i]);
3263 y2b =
gPad->YtoPad(theY[i] + theEYhigh[i]);
3264 if (x1b < gPad->GetUxmin()) x1b =
gPad->GetUxmin();
3265 if (x1b >
gPad->GetUxmax()) x1b =
gPad->GetUxmax();
3266 if (y1b < gPad->GetUymin()) y1b =
gPad->GetUymin();
3267 if (y1b >
gPad->GetUymax()) y1b =
gPad->GetUymax();
3268 if (x2b < gPad->GetUxmin()) x2b =
gPad->GetUxmin();
3269 if (x2b >
gPad->GetUxmax()) x2b =
gPad->GetUxmax();
3270 if (y2b < gPad->GetUymin()) y2b =
gPad->GetUymin();
3271 if (y2b >
gPad->GetUymax()) y2b =
gPad->GetUymax();
3272 if (option5)
box.PaintBox(x1b, y1b, x2b, y2b,
"l");
3273 else box.PaintBox(x1b, y1b, x2b, y2b);
3281 yline[if1-1] =
gPad->YtoPad(theY[i] + theEYhigh[i]);
3282 yline[if2-1] =
gPad->YtoPad(theY[i] - theEYlow[i]);
3289 xl2 =
gPad->XtoPad(theX[i] - theEXlow[i]);
3292 arrow.PaintArrow(xl1,
y,xl2,bxl,asize,arrowOpt);
3294 if (!brackets)
gPad->PaintLine(xl1,
y,xl2,bxl);
3297 xb[0] = xl2+tx; yb[0] = bxl-ty;
3298 xb[1] = xl2; yb[1] = bxl-ty;
3299 xb[2] = xl2; yb[2] = bxl+ty;
3300 xb[3] = xl2+tx; yb[3] = bxl+ty;
3301 gPad->PaintPolyLine(4, xb, yb);
3303 gPad->PaintLine(xl2,bxl-ty,xl2,bxl+ty);
3309 xr2 =
gPad->XtoPad(theX[i] + theEXhigh[i]);
3312 arrow.PaintArrow(xr1,
y,xr2,bxh,asize,arrowOpt);
3314 if (!brackets)
gPad->PaintLine(xr1,
y,xr2,bxh);
3317 xb[0] = xr2-tx; yb[0] = bxh-ty;
3318 xb[1] = xr2; yb[1] = bxh-ty;
3319 xb[2] = xr2; yb[2] = bxh+ty;
3320 xb[3] = xr2-tx; yb[3] = bxh+ty;
3321 gPad->PaintPolyLine(4, xb, yb);
3323 gPad->PaintLine(xr2,bxh-ty,xr2,bxh+ty);
3329 yup2 =
gPad->YtoPad(theY[i] + theEYhigh[i]);
3330 if (yup2 >
gPad->GetUymax()) yup2 =
gPad->GetUymax();
3333 arrow.PaintArrow(
x,yup1,byh,yup2,asize,arrowOpt);
3335 if (!brackets)
gPad->PaintLine(
x,yup1,byh,yup2);
3338 xb[0] = byh-tx; yb[0] = yup2-ty;
3339 xb[1] = byh-tx; yb[1] = yup2;
3340 xb[2] = byh+tx; yb[2] = yup2;
3341 xb[3] = byh+tx; yb[3] = yup2-ty;
3342 gPad->PaintPolyLine(4, xb, yb);
3344 gPad->PaintLine(byh-tx,yup2,byh+tx,yup2);
3350 ylow2 =
gPad->YtoPad(theY[i] - theEYlow[i]);
3351 if (ylow2 < gPad->GetUymin()) ylow2 =
gPad->GetUymin();
3352 if (ylow2 < ylow1) {
3354 arrow.PaintArrow(
x,ylow1,byl,ylow2,asize,arrowOpt);
3356 if (!brackets)
gPad->PaintLine(
x,ylow1,byl,ylow2);
3359 xb[0] = byl-tx; yb[0] = ylow2+ty;
3360 xb[1] = byl-tx; yb[1] = ylow2;
3361 xb[2] = byl+tx; yb[2] = ylow2;
3362 xb[3] = byl+tx; yb[3] = ylow2+ty;
3363 gPad->PaintPolyLine(4, xb, yb);
3365 gPad->PaintLine(byl-tx,ylow2,byl+tx,ylow2);
3379 if (option4)
PaintGraph(theGraph, 2*theNpoints, xline.data(), yline.data(),
"FC");
3380 else PaintGraph(theGraph, 2*theNpoints, xline.data(), yline.data(),
"F");
3381 gPad->SetLogx(logx);
3382 gPad->SetLogy(logy);
3393 std::vector<Double_t> xline, yline;
3398 const Int_t kBASEMARKER=8;
3399 Double_t s2x, s2y, symbolsize, sbase;
3400 Double_t x,
y,
ex,
ey, xl1, xl2, xr1, xr2, yup1, yup2, ylow1, ylow2, tx, ty;
3401 static Float_t cxx[30] = {1.0,1.0,0.5,0.5,1.0,1.0,0.5,0.6,1.0,0.5,0.5,1.0,0.5,0.6,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,0.5,0.5,0.5,1.0};
3402 static Float_t cyy[30] = {1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.5,0.5,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.0,0.0,1.0,1.0,1.0,1.0,0.5,0.5,0.5,1.0};
3419 const char *arrowOpt =
nullptr;
3420 if (strchr(
option,
'>')) arrowOpt =
">";
3421 if (strstr(
option,
"|>")) arrowOpt =
"|>";
3440 xline.resize(2*theNpoints);
3441 yline.resize(2*theNpoints);
3442 if (xline.empty() || yline.empty()) {
3443 Error(
"Paint",
"too many points, out of memory");
3450 theGraph->TAttLine::Modify();
3465 sbase = symbolsize*kBASEMARKER;
3478 tx =
gPad->PixeltoX(dxend) -
gPad->PixeltoX(0);
3479 ty =-
gPad->PixeltoY(dxend) +
gPad->PixeltoY(0);
3480 Float_t asize = 0.6*symbolsize*kBASEMARKER/
gPad->GetWh();
3483 for (
Int_t i=0;i<theNpoints;i++) {
3484 x =
gPad->XtoPad(theX[i]);
3485 y =
gPad->YtoPad(theY[i]);
3488 if (x < gPad->GetUxmin())
x =
gPad->GetUxmin();
3489 if (
x >
gPad->GetUxmax())
x =
gPad->GetUxmax();
3490 if (y < gPad->GetUymin())
y =
gPad->GetUymin();
3491 if (
y >
gPad->GetUymax())
y =
gPad->GetUymax();
3493 if (x < gPad->GetUxmin())
continue;
3494 if (
x >
gPad->GetUxmax())
continue;
3495 if (y < gPad->GetUymin())
continue;
3496 if (
y >
gPad->GetUymax())
continue;
3504 x1b =
gPad->XtoPad(theX[i] -
ex);
3505 y1b =
gPad->YtoPad(theY[i] -
ey);
3506 x2b =
gPad->XtoPad(theX[i] +
ex);
3507 y2b =
gPad->YtoPad(theY[i] +
ey);
3508 if (x1b < gPad->GetUxmin()) x1b =
gPad->GetUxmin();
3509 if (x1b >
gPad->GetUxmax()) x1b =
gPad->GetUxmax();
3510 if (y1b < gPad->GetUymin()) y1b =
gPad->GetUymin();
3511 if (y1b >
gPad->GetUymax()) y1b =
gPad->GetUymax();
3512 if (x2b < gPad->GetUxmin()) x2b =
gPad->GetUxmin();
3513 if (x2b >
gPad->GetUxmax()) x2b =
gPad->GetUxmax();
3514 if (y2b < gPad->GetUymin()) y2b =
gPad->GetUymin();
3515 if (y2b >
gPad->GetUymax()) y2b =
gPad->GetUymax();
3516 if (option5)
box.PaintBox(x1b, y1b, x2b, y2b,
"l");
3517 else box.PaintBox(x1b, y1b, x2b, y2b);
3525 yline[if1-1] =
gPad->YtoPad(theY[i] +
ey);
3526 yline[if2-1] =
gPad->YtoPad(theY[i] -
ey);
3533 xl2 =
gPad->XtoPad(theX[i] -
ex);
3536 arrow.PaintArrow(xl1,
y,xl2,
y,asize,arrowOpt);
3538 if (!brackets)
gPad->PaintLine(xl1,
y,xl2,
y);
3541 xb[0] = xl2+tx; yb[0] =
y-ty;
3542 xb[1] = xl2; yb[1] =
y-ty;
3543 xb[2] = xl2; yb[2] =
y+ty;
3544 xb[3] = xl2+tx; yb[3] =
y+ty;
3545 gPad->PaintPolyLine(4, xb, yb);
3547 gPad->PaintLine(xl2,
y-ty,xl2,
y+ty);
3553 xr2 =
gPad->XtoPad(theX[i] +
ex);
3556 arrow.PaintArrow(xr1,
y,xr2,
y,asize,arrowOpt);
3558 if (!brackets)
gPad->PaintLine(xr1,
y,xr2,
y);
3561 xb[0] = xr2-tx; yb[0] =
y-ty;
3562 xb[1] = xr2; yb[1] =
y-ty;
3563 xb[2] = xr2; yb[2] =
y+ty;
3564 xb[3] = xr2-tx; yb[3] =
y+ty;
3565 gPad->PaintPolyLine(4, xb, yb);
3567 gPad->PaintLine(xr2,
y-ty,xr2,
y+ty);
3573 yup2 =
gPad->YtoPad(theY[i] +
ey);
3574 if (yup2 >
gPad->GetUymax()) yup2 =
gPad->GetUymax();
3577 arrow.PaintArrow(
x,yup1,
x,yup2,asize,arrowOpt);
3579 if (!brackets)
gPad->PaintLine(
x,yup1,
x,yup2);
3582 xb[0] =
x-tx; yb[0] = yup2-ty;
3583 xb[1] =
x-tx; yb[1] = yup2;
3584 xb[2] =
x+tx; yb[2] = yup2;
3585 xb[3] =
x+tx; yb[3] = yup2-ty;
3586 gPad->PaintPolyLine(4, xb, yb);
3588 gPad->PaintLine(
x-tx,yup2,
x+tx,yup2);
3594 ylow2 =
gPad->YtoPad(theY[i] -
ey);
3595 if (ylow2 < gPad->GetUymin()) ylow2 =
gPad->GetUymin();
3596 if (ylow2 < ylow1) {
3598 arrow.PaintArrow(
x,ylow1,
x,ylow2,asize,arrowOpt);
3600 if (!brackets)
gPad->PaintLine(
x,ylow1,
x,ylow2);
3603 xb[0] =
x-tx; yb[0] = ylow2+ty;
3604 xb[1] =
x-tx; yb[1] = ylow2;
3605 xb[2] =
x+tx; yb[2] = ylow2;
3606 xb[3] =
x+tx; yb[3] = ylow2+ty;
3607 gPad->PaintPolyLine(4, xb, yb);
3609 gPad->PaintLine(
x-tx,ylow2,
x+tx,ylow2);
3623 if (option4)
PaintGraph(theGraph, 2*theNpoints, xline.data(), yline.data(),
"FC");
3624 else PaintGraph(theGraph, 2*theNpoints, xline.data(), yline.data(),
"F");
3625 gPad->SetLogx(logx);
3626 gPad->SetLogy(logy);
3638 Double_t rwrmin, rwrmax, rwtmin, rwtmax;
3642 Int_t theNpoints = theGraphPolar->
GetN();
3648 if (theNpoints<1)
return;
3663 if (thePolargram)
if (!
gPad->FindObject(thePolargram->
GetName())) thePolargram=0;
3664 if (!thePolargram) {
3677 if (!thePolargram) {
3679 rwrmin = theY[0]; rwrmax = theY[theNpoints-1];
3680 rwtmin = theX[0]; rwtmax = theX[theNpoints-1];
3682 for (ipt = 0; ipt < theNpoints; ipt++) {
3685 if (theX[ipt] -theEX[ipt] < rwtmin) rwtmin = theX[ipt]-theEX[ipt];
3686 if (theX[ipt] +theEX[ipt] > rwtmax) rwtmax = theX[ipt]+theEX[ipt];
3688 if (theX[ipt] < rwtmin) rwtmin=theX[ipt];
3689 if (theX[ipt] > rwtmax) rwtmax=theX[ipt];
3692 if (theY[ipt] -theEY[ipt] < rwrmin) rwrmin = theY[ipt]-theEY[ipt];
3693 if (theY[ipt] +theEY[ipt] > rwrmax) rwrmax = theY[ipt]+theEY[ipt];
3695 if (theY[ipt] < rwrmin) rwrmin=theY[ipt];
3696 if (theY[ipt] > rwrmax) rwrmax=theY[ipt];
3700 if (rwrmin == rwrmax) rwrmax += 1.;
3701 if (rwtmin == rwtmax) rwtmax += 1.;
3708 rwtmax += dt/theNpoints;
3710 rwrmin = thePolargram->
GetRMin();
3711 rwrmax = thePolargram->
GetRMax();
3712 rwtmin = thePolargram->
GetTMin();
3713 rwtmax = thePolargram->
GetTMax();
3718 thePolargram =
new TGraphPolargram(
"Polargram",rwrmin,rwrmax,rwtmin,rwtmax);
3722 if (nolabel) thePolargram->
Draw(
"N");
3723 else thePolargram->
Draw(
"");
3732 Double_t radiusNDC = rwrmax-rwrmin;
3742 for (i=0; i<theNpoints; i++) {
3743 Double_t eymin, eymax, exmin,exmax;
3744 exmin = (theY[i]-theEY[i]-rwrmin)/radiusNDC*
3746 eymin = (theY[i]-theEY[i]-rwrmin)/radiusNDC*
3748 exmax = (theY[i]+theEY[i]-rwrmin)/radiusNDC*
3750 eymax = (theY[i]+theEY[i]-rwrmin)/radiusNDC*
3752 theGraphPolar->TAttLine::Modify();
3753 if (exmin != exmax || eymin != eymax)
gPad->PaintLine(exmin,eymin,exmax,eymax);
3757 for (i=0; i<theNpoints; i++) {
3761 theGraphPolar->TAttLine::Modify();
3762 if (phimin != phimax) thePolargram->
PaintCircle(0,0,
rad,phimin,phimax,0);
3768 if (!(
gPad->GetLogx()) && !(
gPad->GetLogy())) {
3769 Double_t a,
b,
c=1,
x1,
x2,
y1,
y2, discr, norm1, norm2, xts, yts;
3777 for (i=0; i<theNpoints; i++) {
3780 xt = (theY[i]-rwrmin)/radiusNDC*
TMath::Cos(
c*(theX[i]-rwtmin)/thetaNDC);
3781 yt = (theY[i]-rwrmin)/radiusNDC*
TMath::Sin(
c*(theX[i]-rwtmin)/thetaNDC);
3782 norm =
sqrt(xt*xt+yt*yt);
3787 if (!previouspointin) {
3792 a = (yt-yts)/(xt-xts);
3794 discr = 4*(
a*
a-
b*
b+1);
3801 previouspointin =
kFALSE;
3803 if (norm1 < norm2) {
3813 PaintGraph(theGraphPolar, j+1, theXpol, theYpol, opt);
3818 if (j>=1 && !previouspointin) {
3819 a = (yt-theYpol[j])/(xt-theXpol[j]);
3820 b = theYpol[j]-
a*theXpol[j];
3821 previouspointin =
kTRUE;
3822 discr = 4*(
a*
a-
b*
b+1);
3830 if (norm1 < norm2) {
3837 PaintGraph(theGraphPolar, j+1, theXpol, theYpol, opt);
3844 PaintGraph(theGraphPolar, j+1, theXpol, theYpol, opt);
3847 for (i=0; i<theNpoints; i++) {
3851 PaintGraph(theGraphPolar, theNpoints, theXpol, theYpol,opt);
3859 TIter next(
gPad->GetListOfPrimitives());
3860 while (
auto obj = next()) {
3864 if (strcmp(title->
GetName(),
"title")) {title =
nullptr;
continue;}
3868 if (title)
delete title;
3874 if (ht <= 0) ht = 0.05;
3895 if (talh < 1) talh = 1;
else if (talh > 3) talh = 3;
3897 if (talv < 1) talv = 1;
else if (talv > 3) talv = 3;
3939 TF1 *theF = theGraphQQ->
GetF();
3942 Error(
"TGraphQQ::Paint",
"2nd dataset or theoretical function not specified");
3957 Double_t yxmin, xymin, yxmax, xymax;
3963 TLine line1, line2, line3;
3966 yxmin = (theYq2-theYq1)*(
xmin-theXq1)/(theXq2-theXq1) + theYq1;
3968 xymin = (theXq2-theXq1)*(
ymin-theYq1)/(theYq2-theYq1) + theXq1;
3974 line2.
PaintLine(xqmin, yqmin, xqmax, yqmax);
3976 yxmax = (theYq2-theYq1)*(
xmax-theXq1)/(theXq2-theXq1) + theYq1;
3978 xymax = (theXq2-theXq1)*(
ymax-theYq1)/(theYq2-theYq1) + theXq1;
4021 if (lxp) opth.
Append(
"x+");
4022 if (lyp) opth.
Append(
"y+");
4036 XA1 =
gPad->GetUxmin();
4037 XA2 =
gPad->GetUxmax();
4038 YA1 =
gPad->GetUymin();
4039 YA2 =
gPad->GetUymax();
4044 std::vector<Double_t> newX(
N);
4045 std::vector<Double_t> newY(
N);
4057 if (
gPad->GetGridx()) {
4058 GL = (YA2 - YA1) / (
gPad->GetY2() -
gPad->GetY1());
4064 auto *theNewAxis =
new TGaxis(
gPad->GetUxmax(),
4075 theNewAxis->SetTickLength(TLX);
4077 theNewAxis->Paint();
4080 for (
Int_t i=0; i<
N; i++) newX[i] = dX-X[i];
4082 for (
Int_t i=0; i<
N; i++) newX[i] = X[i];
4093 if (
gPad->GetGridy()) {
4094 GL = (XA2 - XA1) / (
gPad->GetX2() -
gPad->GetX1());
4111 theNewAxis->SetTickLength(-TLY);
4112 theNewAxis->SetLabelOffset(LOY-TLY);
4113 theNewAxis->Paint();
4116 for (
Int_t i=0; i<
N; i++) newY[i] = dY-Y[i];
4118 for (
Int_t i=0; i<
N; i++) newY[i] = Y[i];
4123 for (
Int_t i=0; i<
N; i++) theNewGraph->
SetPoint(i, newX[i], newY[i]);
4156 if (!functions)
return;
4165 obj->Paint(lnk->GetOption());
4185 std::vector<Double_t> xf(2*
n);
4186 std::vector<Double_t> yf(2*
n);
4187 std::vector<Double_t> xt(
n);
4188 std::vector<Double_t> yt(
n);
4189 Double_t x1,
x2,
y1,
y2,
x3, y3, xm, ym,
a, a1, a2, a3;
4192 Int_t ix1,iy1,ix2,iy2;
4196 gPad->GetPadPar(x1p,y1p,x2p,y2p);
4197 ix1 = (
Int_t)(iw*x1p);
4198 iy1 = (
Int_t)(ih*y1p);
4199 ix2 = (
Int_t)(iw*x2p);
4200 iy2 = (
Int_t)(ih*y2p);
4212 gPad->GetRange(rx1,ry1,rx2,ry2);
4213 Double_t rx = (x2ndc-x1ndc)/(rx2-rx1);
4214 Double_t ry = (y2ndc-y1ndc)/(ry2-ry1);
4218 xf[0] = rx*(
x[0]-rx1)+x1ndc;
4219 yf[0] = ry*(
y[0]-ry1)+y1ndc;
4221 for (i=1; i<
n; i++) {
4222 if (
x[i]==
x[i-1] &&
y[i]==
y[i-1])
continue;
4224 xf[nf] = rx*(
x[i]-rx1)+x1ndc;
4225 if (xf[i]==xf[i-1]) xf[i] += 0.000001;
4226 yf[nf] = ry*(
y[i]-ry1)+y1ndc;
4245 if (xf[nf]==xf[nf-1]) {
4250 if (xf[nf]>=xf[nf-1]) {
4259 for (i=1; i<nf; i++) {
4271 if (xi1<xi0) a1 = a1+3.14159;
4277 if (xi0<xi2) a2 = a2+3.14159;
4292 if ((xm-xi0)*(
x3-xi0)<0 && (ym-yi0)*(y3-yi0)<0) {
4296 if ((xm==
x1) && (ym==
y1)) {
4305 if (xf[nf]==xf[0] && yf[nf]==yf[0]) {
4306 xm = (xt[nf]+xt[0])*0.5;
4307 ym = (yt[nf]+yt[0])*0.5;
4315 if ((xm-xf[0])*(
x3-xf[0])<0 && (ym-yf[0])*(y3-yf[0])<0) {
4329 for (i=nf2; i>0; i--) {
4330 for (j=i-1; j>0; j--) {
4331 if (xt[i-1]==xt[i] || xt[j-1]==xt[j])
continue;
4332 c1 = (yt[i-1]-yt[i])/(xt[i-1]-xt[i]);
4333 b1 = yt[i]-
c1*xt[i];
4334 c2 = (yt[j-1]-yt[j])/(xt[j-1]-xt[j]);
4335 b2 = yt[j]-
c2*xt[j];
4337 xc = (b2-b1)/(
c1-
c2);
4343 nf++; xf[nf] = xt[i]; yf[nf] = yt[i];
4344 nf++; xf[nf] = xc ; yf[nf] = yc;
4362 nf++; xf[nf] = xt[0]; yf[nf] = yt[0];
4365 for (i=0; i<nf+1; i++) {
4366 xf[i] = (1/rx)*(xf[i]-x1ndc)+rx1;
4367 yf[i] = (1/ry)*(yf[i]-y1ndc)+ry1;
4371 gPad->PaintFillArea(nf+1,xf.data(),yf.data());
4372 theGraph->TAttLine::Modify();
4385 TIter next(functions);
4386 while (
auto obj = next()) {
4396 if (!dofit)
fit = 0;
4398 if (dofit == 1) dofit = 111;
4400 Int_t print_fval = dofit%10;
4401 Int_t print_ferrors = (dofit/10)%10;
4402 Int_t print_fchi2 = (dofit/100)%10;
4403 Int_t print_fprob = (dofit/1000)%10;
4404 Int_t nlinesf = print_fval + print_fchi2 + print_fprob;
4406 if (print_fval < 2) nlinesf +=
fit->GetNumberFreeParameters();
4407 else nlinesf +=
fit->GetNpar();
4446 if (print_fchi2) stats->
AddText(t);
4452 if (print_fval || print_ferrors) {
4454 for (
Int_t ipar=0;ipar<
fit->GetNpar();ipar++) {
4455 fit->GetParLimits(ipar,parmin,parmax);
4456 if (print_fval < 2 && parmin*parmax != 0 && parmin >= parmax)
continue;
4457 if (print_ferrors) {
4470 if (!done) functions->
Add(stats);
4500 Int_t i, k, kp,
km, npointsMax, banksize, n2, npt;
4501 Int_t maxiterations, finished;
4502 Int_t jtype, ktype, closed;
4503 Double_t sxmin, sxmax, symin, symax;
4506 Double_t ratio_signs, xratio, yratio;
4512 Double_t co, so, ct, st, ctu, stu, xnt;
4513 Double_t dx1, dy1, dx2, dy2, dk1, dk2;
4520 c = t = co = so = ct = st = ctu = stu = dx1 = dy1 = dx2 = dy2 = 0;
4521 xt = yt = xa = xb = ya = yb = u1 = u2 = u3 = tj = sb = 0;
4523 npointsMax = npoints*10;
4527 std::vector<Double_t> qlx(npointsMax);
4528 std::vector<Double_t> qly(npointsMax);
4529 if (qlx.empty() || qly.empty()) {
4530 Error(
"Smooth",
"not enough space in memory");
4537 jtype = (drawtype%1000)-10;
4538 if (jtype > 0) { ktype = jtype; loptx =
kTRUE; }
4539 else ktype = drawtype%1000;
4568 for (i=1;i<npoints;i++) {
4570 if ((
x[i]-
x[i-1])*(
x[i-1]-
x[i-2]) < 0) six++;
4571 if ((
y[i]-
y[i-1])*(
y[i-1]-
y[i-2]) < 0) siy++;
4573 if (
x[i] < sxmin) sxmin =
x[i];
4574 if (
x[i] > sxmax) sxmax =
x[i];
4575 if (
y[i] < symin) symin =
y[i];
4576 if (
y[i] > symax) symax =
y[i];
4581 if (dx1n < 0.01*(sxmax-sxmin) && dy1n < 0.01*(symax-symin)) closed = 1;
4582 if (sxmin == sxmax) {
4585 if (six > 1) ratio_signs = siy/six;
4586 else ratio_signs = 20;
4587 xratio = ratio_signs/(sxmax-sxmin);
4589 if (symin == symax) yratio = 1;
4590 else yratio = 1/(symax-symin);
4594 for (i=0;i<npoints;i++) {
4595 x[i] = (
x[i]-sxmin)*xratio;
4596 y[i] = (
y[i]-symin)*yratio;
4615 if (
x[0] !=
x[npoints-1] ||
y[0] !=
y[npoints-1])
goto L40;
4616 if (
x[npoints-2] ==
x[npoints-1] &&
y[npoints-2] ==
y[npoints-1])
goto L40;
4617 if (
x[0] ==
x[1] &&
y[0] ==
y[1])
goto L40;
4640 if (npt > 1)
goto L310;
4644 if (
x[k-1] ==
x[k-2] &&
y[k-1] ==
y[k-2])
goto L50;
4649 if (npt > 1)
goto L310;
4652 if (k < npoints)
goto L90;
4653 if (!flgic) { kp = 2;
goto L130;}
4656 if (flgis)
goto L150;
4666 if (
x[k-1] ==
x[k] &&
y[k-1] ==
y[k])
goto L80;
4674 if (!flgis)
goto L50;
4689 dx1 =
x[k-1] -
x[
km-1];
4690 dy1 =
y[k-1] -
y[
km-1];
4691 dk1 = dx1*dx1 + dy1*dy1;
4692 dx2 =
x[kp-1] -
x[k-1];
4693 dy2 =
y[kp-1] -
y[k-1];
4694 dk2 = dx2*dx2 + dy2*dy2;
4695 ctu = dx1*dk2 + dx2*dk1;
4696 stu = dy1*dk2 + dy2*dk1;
4697 xnt = ctu*ctu + stu*stu;
4711 if (flgis)
goto L160;
4715 w3 = 2*(dx1*dy2-dx2*dy1);
4727 w3 = 2*(dx1*dy2-dx2*dy1);
4736 if (k <= 1)
goto L120;
4766 xa = (
a*t-2*dx)/tcube;
4767 xb = (3*dx-(co+
a)*t)/tsquare;
4768 ya = (
b*t-2*dy)/tcube;
4769 yb = (3*dy-(so+
b)*t)/tsquare;
4800 p2 = (u1*tj-u3)*3*tj+u2;
4830 z =
s*sth*(
s-
s*sth)*(w1*sth+w1+w2);
4831 z = z*z/((
a*
a+
b*
b)*(delta*delta));
4832 z = (z+2.642937)*z/((.3715652*z+3.063444)*z+.2441889)-cc;
4836 if (iw > 0)
goto L250;
4837 if (z > err)
goto L240;
4842 if (iw+2 == 0)
goto L190;
4843 if (iw+2 > 0)
goto L290;
4861 theGraph->
Zero(kp,0,sb,err,
s,z,maxiterations);
4862 if (kp == 2)
goto L210;
4864 Error(
"Smooth",
"Attempt to plot outside plot limits");
4867 if (iw > 0)
goto L200;
4893 qlx[npt] = sxmin + xt/xratio;
4894 qly[npt] = symin + yt/yratio;
4901 if (npt < banksize)
goto L320;
4902 if (drawtype >= 1000 || ktype > 1) {
4903 Int_t newsize = banksize + n2;
4904 std::vector<Double_t> qtemp(banksize);
4905 for (i=0;i<banksize;i++) qtemp[i] = qlx[i];
4906 qlx.resize(newsize);
4907 for (i=0;i<banksize;i++) qlx[i] = qtemp[i];
4908 for (i=0;i<banksize;i++) qtemp[i] = qly[i];
4909 qly.resize(newsize);
4910 for (i=0;i<banksize;i++) qly[i] = qtemp[i];
4918 if (drawtype >= 1000) {
4919 gPad->PaintFillArea(npt,qlx.data(),qly.data(),
"B");
4923 qlx[npt] = qlx[npt-1];
4924 qlx[npt+1] = qlx[0];
4930 qly[npt] = qly[npt-1];
4931 qly[npt+1] = qly[0];
4933 gPad->PaintFillArea(npt+2,qlx.data(),qly.data());
4936 gPad->PaintPolyLine(npt,qlx.data(),qly.data());
4939 qlx[0] = sxmin + xt/xratio;
4940 qly[0] = symin + yt/yratio;
4942 if (finished > 0)
goto L390;
4943 if (finished < 0) { finished = 0;
goto L110;}
4944 if (
s > 0)
goto L180;
4950 for (i=0;i<npoints;i++) {
4951 x[i] = sxmin +
x[i]/xratio;
4952 y[i] = symin +
y[i]/yratio;