667 if (
gPad->GetLogx()) {
668 for (i=0;i<npoints;i++) {
673 if (!opt &&
gPad->GetLogy()) {
674 for (i=0;i<npoints;i++) {
695 if (distance <= 5)
return distance;
699 const Int_t big = 9999;
700 const Int_t kMaxDiff = 10;
707 if (px <= puxmin)
return big;
708 if (py >= puymin)
return big;
709 if (px >= puxmax)
return big;
710 if (py <= puymax)
return big;
720 theX = theGraphPolar->
GetXpol();
721 theY = theGraphPolar->
GetYpol();
723 theX = theGraph->
GetX();
724 theY = theGraph->
GetY();
728 for (i=0;i<theNpoints;i++) {
729 pxp =
gPad->XtoAbsPixel(
gPad->XtoPad(theX[i]));
730 pyp =
gPad->YtoAbsPixel(
gPad->YtoPad(theY[i]));
740 if (distance < kMaxDiff)
return distance;
742 for (i=0;i<theNpoints-1;i++) {
744 d =
l.DistancetoLine(px, py,
gPad->XtoPad(theX[i]),
gPad->YtoPad(theY[i]),
gPad->XtoPad(theX[i+1]),
gPad->YtoPad(theY[i+1]));
745 if (
d < distance) distance =
d;
760 TIter next(functions);
764 else dist =
f->DistancetoPrimitive(px,py);
765 if (
dist < kMaxDiff) {
766 gPad->SetSelected(
f);
782 Error(
"DrawPanel",
"need to draw graph first");
787 gROOT->ProcessLine(
Form(
"((TCanvas*)0x%lx)->Selected((TVirtualPad*)0x%lx,(TObject*)0x%lx,1)",
810 const Int_t kMaxDiff = 10;
811 static Bool_t middle, badcase;
812 static Int_t ipoint, pxp, pyp;
813 static Int_t px1,px2,py1,py2;
814 static Int_t pxold, pyold, px1old, py1old, px2old, py2old;
815 static Int_t dpx, dpy;
823 if (!
gPad->IsEditable())
return;
833 theGraph->TAttLine::Modify();
834 px1 =
gPad->XtoAbsPixel(
gPad->GetX1());
835 py1 =
gPad->YtoAbsPixel(
gPad->GetY1());
836 px2 =
gPad->XtoAbsPixel(
gPad->GetX2());
837 py2 =
gPad->YtoAbsPixel(
gPad->GetY2());
842 x =
new Int_t[theNpoints+1];
843 y =
new Int_t[theNpoints+1];
844 for (i=0;i<theNpoints;i++) {
845 pxp =
gPad->XtoAbsPixel(
gPad->XtoPad(theX[i]));
846 pyp =
gPad->YtoAbsPixel(
gPad->YtoPad(theY[i]));
847 if (pxp < -kMaxPixel || pxp >=
kMaxPixel ||
853 gVirtualX->DrawLine(pxp-4, pyp-4, pxp+4, pyp-4);
854 gVirtualX->DrawLine(pxp+4, pyp-4, pxp+4, pyp+4);
855 gVirtualX->DrawLine(pxp+4, pyp+4, pxp-4, pyp+4);
856 gVirtualX->DrawLine(pxp-4, pyp+4, pxp-4, pyp-4);
861 if (
d < kMaxDiff) ipoint =i;
867 if (ipoint < 0)
return;
871 px2old =
gPad->XtoAbsPixel(theX[1]);
872 py2old =
gPad->YtoAbsPixel(theY[1]);
873 }
else if (ipoint == theNpoints-1) {
874 px1old =
gPad->XtoAbsPixel(
gPad->XtoPad(theX[theNpoints-2]));
875 py1old =
gPad->YtoAbsPixel(
gPad->YtoPad(theY[theNpoints-2]));
879 px1old =
gPad->XtoAbsPixel(
gPad->XtoPad(theX[ipoint-1]));
880 py1old =
gPad->YtoAbsPixel(
gPad->YtoPad(theY[ipoint-1]));
881 px2old =
gPad->XtoAbsPixel(
gPad->XtoPad(theX[ipoint+1]));
882 py2old =
gPad->YtoAbsPixel(
gPad->YtoPad(theY[ipoint+1]));
884 pxold =
gPad->XtoAbsPixel(
gPad->XtoPad(theX[ipoint]));
885 pyold =
gPad->YtoAbsPixel(
gPad->YtoPad(theY[ipoint]));
893 for (i=0;i<theNpoints;i++) {
894 pxp =
gPad->XtoAbsPixel(
gPad->XtoPad(theX[i]));
895 pyp =
gPad->YtoAbsPixel(
gPad->YtoPad(theY[i]));
897 if (
d < kMaxDiff) middle =
kFALSE;
909 for(i=0;i<theNpoints-1;i++) {
910 gVirtualX->DrawLine(
x[i]+dpx,
y[i]+dpy,
x[i+1]+dpx,
y[i+1]+dpy);
913 if (pxp < -kMaxPixel || pxp >=
kMaxPixel ||
914 pyp < -kMaxPixel || pyp >=
kMaxPixel)
continue;
915 gVirtualX->DrawLine(pxp-4, pyp-4, pxp+4, pyp-4);
916 gVirtualX->DrawLine(pxp+4, pyp-4, pxp+4, pyp+4);
917 gVirtualX->DrawLine(pxp+4, pyp+4, pxp-4, pyp+4);
918 gVirtualX->DrawLine(pxp-4, pyp+4, pxp-4, pyp-4);
920 pxp =
x[theNpoints-1]+dpx;
921 pyp =
y[theNpoints-1]+dpy;
922 gVirtualX->DrawLine(pxp-4, pyp-4, pxp+4, pyp-4);
923 gVirtualX->DrawLine(pxp+4, pyp-4, pxp+4, pyp+4);
924 gVirtualX->DrawLine(pxp+4, pyp+4, pxp-4, pyp+4);
925 gVirtualX->DrawLine(pxp-4, pyp+4, pxp-4, pyp-4);
930 for(i=0;i<theNpoints-1;i++) {
931 gVirtualX->DrawLine(
x[i]+dpx,
y[i]+dpy,
x[i+1]+dpx,
y[i+1]+dpy);
934 if (pxp < -kMaxPixel || pxp >=
kMaxPixel ||
935 pyp < -kMaxPixel || pyp >=
kMaxPixel)
continue;
936 gVirtualX->DrawLine(pxp-4, pyp-4, pxp+4, pyp-4);
937 gVirtualX->DrawLine(pxp+4, pyp-4, pxp+4, pyp+4);
938 gVirtualX->DrawLine(pxp+4, pyp+4, pxp-4, pyp+4);
939 gVirtualX->DrawLine(pxp-4, pyp+4, pxp-4, pyp-4);
941 pxp =
x[theNpoints-1]+dpx;
942 pyp =
y[theNpoints-1]+dpy;
943 gVirtualX->DrawLine(pxp-4, pyp-4, pxp+4, pyp-4);
944 gVirtualX->DrawLine(pxp+4, pyp-4, pxp+4, pyp+4);
945 gVirtualX->DrawLine(pxp+4, pyp+4, pxp-4, pyp+4);
946 gVirtualX->DrawLine(pxp-4, pyp+4, pxp-4, pyp-4);
948 if (px1old)
gVirtualX->DrawLine(px1old, py1old, pxold, pyold);
949 if (px2old)
gVirtualX->DrawLine(pxold, pyold, px2old, py2old);
950 gVirtualX->DrawLine(pxold-4, pyold-4, pxold+4, pyold-4);
951 gVirtualX->DrawLine(pxold+4, pyold-4, pxold+4, pyold+4);
952 gVirtualX->DrawLine(pxold+4, pyold+4, pxold-4, pyold+4);
953 gVirtualX->DrawLine(pxold-4, pyold+4, pxold-4, pyold-4);
960 if (px1old)
gVirtualX->DrawLine(px1old, py1old, pxold, pyold);
961 if (px2old)
gVirtualX->DrawLine(pxold, pyold, px2old, py2old);
962 gVirtualX->DrawLine(pxold-4, pyold-4, pxold+4, pyold-4);
963 gVirtualX->DrawLine(pxold+4, pyold-4, pxold+4, pyold+4);
964 gVirtualX->DrawLine(pxold+4, pyold+4, pxold-4, pyold+4);
965 gVirtualX->DrawLine(pxold-4, pyold+4, pxold-4, pyold-4);
974 dxr = dx/(1 -
gPad->GetLeftMargin() -
gPad->GetRightMargin());
975 dyr = dy/(1 -
gPad->GetBottomMargin() -
gPad->GetTopMargin());
991 for(i=0;i<theNpoints;i++) {
992 if (badcase)
continue;
993 if (
x) theX[i] =
gPad->PadtoX(
gPad->AbsPixeltoX(
x[i]+dpx));
994 if (
y) theY[i] =
gPad->PadtoY(
gPad->AbsPixeltoY(
y[i]+dpy));
1003 theX[ipoint] =
gPad->PadtoX(
gPad->AbsPixeltoX(pxold));
1004 theY[ipoint] =
gPad->PadtoY(
gPad->AbsPixeltoY(pyold));
1008 theX[theNpoints-1] = theX[0];
1009 theY[theNpoints-1] = theY[0];
1011 if (ipoint == theNpoints-1) {
1012 theX[0] = theX[theNpoints-1];
1013 theY[0] = theY[theNpoints-1];
1025 if (
gROOT->IsEscaped()) {
1039 dxr = dx/(1 -
gPad->GetLeftMargin() -
gPad->GetRightMargin());
1040 dyr = dy/(1 -
gPad->GetBottomMargin() -
gPad->GetTopMargin());
1046 ymin - dyr*
gPad->GetBottomMargin(),
1052 for(i=0;i<theNpoints;i++) {
1053 if (badcase)
continue;
1054 if (
x) theX[i] =
gPad->PadtoX(
gPad->AbsPixeltoX(
x[i]+dpx));
1055 if (
y) theY[i] =
gPad->PadtoY(
gPad->AbsPixeltoY(
y[i]+dpy));
1058 theX[ipoint] =
gPad->PadtoX(
gPad->AbsPixeltoX(pxold));
1059 theY[ipoint] =
gPad->PadtoY(
gPad->AbsPixeltoY(pyold));
1063 theX[theNpoints-1] = theX[0];
1064 theY[theNpoints-1] = theY[0];
1066 if (ipoint == theNpoints-1) {
1067 theX[0] = theX[theNpoints-1];
1068 theY[0] = theY[theNpoints-1];
1122 const Int_t kHighlightRange = 50;
1123 static Int_t distanceOld = kHighlightRange;
1126 if ((distance < kHighlightRange) && (distance < distanceOld)) {
1164 if (
gPad->GetLogx()) {
1168 if (
gPad->GetLogy()) {
1172 if ((hx < uxmin) || (hx > uxmax))
return;
1173 if ((hy < uymin) || (hy > uymax))
return;
1197 strlcpy(chopt,option,80);
1200 char *l1 = strstr(chopt,
"pfc");
1201 char *l2 = strstr(chopt,
"plc");
1202 char *l3 = strstr(chopt,
"pmc");
1203 if (l1 || l2 || l3) {
1212 char *l4 = strstr(chopt,
"rx");
1213 char *l5 = strstr(chopt,
"ry");
1247 TIter next(functions);
1268 gPad->PushSelectableObject(theGraph);
1270 Int_t optionLine , optionAxis , optionCurve , optionStar , optionMark;
1271 Int_t optionBar , optionR , optionOne , optionE;
1272 Int_t optionFill , optionZ , optionCurveFill, optionIAxis;
1273 Int_t i, npt, nloop;
1276 Double_t barxmin, barxmax, barymin, barymax;
1283 Error(
"PaintGraph",
"illegal number of points (%d)", npoints);
1290 if (opt.
Contains(
"L")) optionLine = 1;
else optionLine = 0;
1291 if (opt.
Contains(
"A")) optionAxis = 1;
else optionAxis = 0;
1292 if (opt.
Contains(
"C")) optionCurve = 1;
else optionCurve = 0;
1293 if (opt.
Contains(
"*")) optionStar = 1;
else optionStar = 0;
1294 if (opt.
Contains(
"P")) optionMark = 1;
else optionMark = 0;
1295 if (opt.
Contains(
"B")) optionBar = 1;
else optionBar = 0;
1296 if (opt.
Contains(
"R")) optionR = 1;
else optionR = 0;
1297 if (opt.
Contains(
"1")) optionOne = 1;
else optionOne = 0;
1298 if (opt.
Contains(
"F")) optionFill = 1;
else optionFill = 0;
1299 if (opt.
Contains(
"I")) optionIAxis = 1;
else optionIAxis = 0;
1305 if (optionLine+optionFill+optionCurve+optionStar+optionMark+optionBar+optionE == 0) {
1306 if (!chopt[0]) optionLine=1;
1312 optionCurveFill = 0;
1313 if (optionCurve && optionFill) {
1314 optionCurveFill = 1;
1319 Double_t rwxmin,rwxmax, rwymin, rwymax, maximum, minimum, dx, dy;
1322 rwxmin =
gPad->GetUxmin();
1323 rwxmax =
gPad->GetUxmax();
1324 rwymin =
gPad->GetUymin();
1325 rwymax =
gPad->GetUymax();
1328 if (minimum == -1111) {
1332 if (maximum == -1111) {
1336 uxmin =
gPad->PadtoX(rwxmin);
1337 uxmax =
gPad->PadtoX(rwxmax);
1340 theGraph->
ComputeRange(rwxmin, rwymin, rwxmax, rwymax);
1342 if (rwxmin == rwxmax) rwxmax += 1.;
1343 if (rwymin == rwymax) rwymax += 1.;
1344 dx = 0.1*(rwxmax-rwxmin);
1345 dy = 0.1*(rwymax-rwymin);
1346 uxmin = rwxmin - dx;
1347 uxmax = rwxmax + dx;
1348 minimum = rwymin - dy;
1349 maximum = rwymax + dy;
1353 if (uxmin < 0 && rwxmin >= 0) uxmin = 0.9*rwxmin;
1354 if (uxmax > 0 && rwxmax <= 0) {
1355 if (
gPad->GetLogx()) uxmax = 1.1*rwxmax;
1358 if (minimum < 0 && rwymin >= 0) minimum = 0.9*rwymin;
1359 if (maximum > 0 && rwymax <= 0) {
1363 if (minimum <= 0 && gPad->GetLogy()) minimum = 0.001*maximum;
1364 if (uxmin <= 0 && gPad->GetLogx()) {
1365 if (uxmax > 1000) uxmin = 1;
1366 else uxmin = 0.001*uxmax;
1373 char chopth[8] =
" ";
1374 if (strstr(chopt,
"x+")) strncat(chopth,
"x+",3);
1375 if (strstr(chopt,
"y+")) strncat(chopth,
"y+",3);
1376 if (optionIAxis) strncat(chopth,
"A",2);
1383 if (theNpoints > npt) npt = theNpoints;
1395 if (
gPad->GetLogy()) {
1408 rwxmin =
gPad->GetUxmin();
1409 rwxmax =
gPad->GetUxmax();
1410 rwymin =
gPad->GetUymin();
1411 rwymax =
gPad->GetUymax();
1412 uxmin =
gPad->PadtoX(rwxmin);
1413 uxmax =
gPad->PadtoX(rwxmax);
1418 maximum =
gPad->PadtoY(rwymax);
1419 minimum =
gPad->PadtoY(rwymin);
1423 theGraph->TAttLine::Modify();
1424 theGraph->TAttFill::Modify();
1425 theGraph->TAttMarker::Modify();
1433 if (optionLine || optionFill) {
1439 if (optionFill && (xn !=
x1 || yn != y1)) nloop++;
1441 for (i=1;i<=nloop;i++) {
1484 if (optionCurveFill) {
1486 if (xn !=
x1 || yn != y1) nloop++;
1490 for (i=1;i<=nloop;i++) {
1515 for (i=1;i<=nloop;i++) {
1519 if (
y[i-1] < minimum ||
y[i-1] > maximum)
continue;
1520 if (
x[i-1] < uxmin ||
x[i-1] > uxmax)
continue;
1546 for (i=1;i<=npoints;i++) {
1561 for (i=1;i<=npoints;i++) {
1578 for (i=1;i<npoints;i++) {
1579 if (
x[i] < barxmin) barxmin =
x[i];
1580 if (
x[i] > barxmax) barxmax =
x[i];
1582 bdelta = (barxmax-barxmin)/
Double_t(npoints);
1586 for (i=1;i<npoints;i++) {
1587 if (
y[i] < barymin) barymin =
y[i];
1588 if (
y[i] > barymax) barymax =
y[i];
1590 bdelta = (barymax-barymin)/
Double_t(npoints);
1594 for (i=1;i<=npoints;i++) {
1595 xlow =
x[i-1] - dbar;
1596 xhigh =
x[i-1] + dbar;
1598 if (xlow < uxmin && xhigh < uxmin)
continue;
1599 if (xhigh > uxmax && xlow > uxmax)
continue;
1600 if (xlow < uxmin) xlow = uxmin;
1601 if (xhigh > uxmax) xhigh = uxmax;
1603 else ylow =
gPad->GetUymin();
1617 for (i=1;i<=npoints;i++) {
1619 ylow =
y[i-1] - dbar;
1620 yhigh =
y[i-1] + dbar;
1673 const char *where =
"PaintGrapHist";
1675 Int_t optionLine , optionAxis , optionCurve, optionStar, optionMark;
1676 Int_t optionBar , optionRot , optionOne , optionOff ;
1677 Int_t optionFill , optionZ;
1678 Int_t optionHist , optionBins , optionMarker;
1680 Int_t drawtype=0, drawborder, drawbordersav;
1686 Double_t xi, xi1, xj, xj1, yi1, yi, yj, yj1, xwmin, ywmin;
1690 char choptaxis[10] =
" ";
1693 Error(where,
"illegal number of points (%d)", npoints);
1698 if (opt.
Contains(
"H")) optionHist = 1;
else optionHist = 0;
1699 if (opt.
Contains(
"F")) optionFill = 1;
else optionFill = 0;
1700 if (opt.
Contains(
"C")) optionCurve= 1;
else optionCurve= 0;
1701 if (opt.
Contains(
"*")) optionStar = 1;
else optionStar = 0;
1702 if (opt.
Contains(
"R")) optionRot = 1;
else optionRot = 0;
1703 if (opt.
Contains(
"1")) optionOne = 1;
else optionOne = 0;
1704 if (opt.
Contains(
"B")) optionBar = 1;
else optionBar = 0;
1705 if (opt.
Contains(
"N")) optionBins = 1;
else optionBins = 0;
1706 if (opt.
Contains(
"L")) optionLine = 1;
else optionLine = 0;
1707 if (opt.
Contains(
"P")) optionMark = 1;
else optionMark = 0;
1708 if (opt.
Contains(
"A")) optionAxis = 1;
else optionAxis = 0;
1709 if (opt.
Contains(
"][")) optionOff = 1;
else optionOff = 0;
1710 if (opt.
Contains(
"P0")) optionMark = 10;
1712 Int_t optionFill2 = 0;
1714 optionFill = 0; optionFill2 = 1;
1729 nbins = last -
first + 1;
1741 Double_t rounding = (uxmax-uxmin)*1.e-5;
1744 Int_t nx1, nx2, ndivx, ndivy, ndiv;
1757 if (ndivx < 0) strlcat(choptaxis,
"N",10);
1758 if (
gPad->GetGridx()) {
1760 strlcat(choptaxis,
"W",10);
1762 if (
gPad->GetLogx()) {
1766 strlcat(choptaxis,
"G",10);
1776 axis->
PaintAxis(rwxmin,rwymin,rwxmax,rwymin,rwmin,rwmax,ndiv,choptaxis);
1786 strlcat(choptaxis,
"N",10);
1789 if (
gPad->GetGridy()) {
1791 strlcat(choptaxis,
"W",10);
1793 if (
gPad->GetLogy()) {
1797 strlcat(choptaxis,
"G",10);
1806 axis->
PaintAxis(rwxmin,rwymin,rwxmin,rwymax,rwmin,rwmax,ndiv,choptaxis);
1812 theGraph->TAttLine::Modify();
1813 theGraph->TAttFill::Modify();
1814 theGraph->TAttMarker::Modify();
1818 if (!optionRot) {wmin =
x[0]; wmax =
x[1];}
1819 else {wmin =
y[0]; wmax =
y[1];}
1821 if (!optionBins) delta = (wmax - wmin)/
Double_t(nbins);
1823 Int_t fwidth =
gPad->GetFrameLineWidth();
1826 if (optionOff) fwidth = 1;
1842 if (optionFill && !optionCurve) {
1850 for (j=
first; j<=last;j++) {
1857 xj1 =
x[j]; xj =
x[j-1];
1859 if (j != last)
Error(where,
"X must be in increasing order");
1860 else Error(where,
"X must have N+1 values with option N");
1868 if ((
gxwork[npt-1] >= uxmin-rounding &&
gxwork[npt-1] <= uxmax+rounding) ||
1869 (
gxwork[npt] >= uxmin-rounding &&
gxwork[npt] <= uxmax+rounding)) npt += 2;
1882 if (!fillarea)
gyworkl[0] = ylast;
1893 for (j=
first; j<=last;j++) {
1898 yj1 =
y[j]; yj =
y[j-1];
1900 if (j != last)
Error(where,
"Y must be in increasing order");
1901 else Error(where,
"Y must have N+1 values with option N");
1907 if ((
gxwork[npt-1] >= uxmin-rounding &&
gxwork[npt-1] <= uxmax+rounding) ||
1908 (
gxwork[npt] >= uxmin-rounding &&
gxwork[npt] <= uxmax+rounding)) npt += 2;
1915 if (!fillarea)
gyworkl[0] = ylast;
1922 theGraph->TAttLine::Modify();
1923 theGraph->TAttFill::Modify();
1928 if ((optionHist) || !chopt[0]) {
1934 for (i=
first; i<=last;i++) {
1939 xi1 =
x[i]; xi =
x[i-1];
1941 if (i != last)
Error(where,
"X must be in increasing order");
1942 else Error(where,
"X must have N+1 values with option N");
1950 if ((
gxwork[npt-1] >= uxmin-rounding &&
gxwork[npt-1] <= uxmax+rounding) ||
1951 (
gxwork[npt] >= uxmin-rounding &&
gxwork[npt] <= uxmax+rounding)) npt += 2;
1963 Int_t nbpoints = npt-2;
1969 for (ip=point1; ip<=nbpoints; ip++) {
1976 Int_t point2 = nbpoints;
1977 for (ip=point2; ip>=point1; ip--) {
1983 nbpoints = point2-point1+1;
1987 if (
gxwork[0] >
gPad->GetUxmin()) { nbpoints++; point1 = 0; }
1988 if (
gxwork[nbpoints] <
gPad->GetUxmax()) nbpoints++;
2000 for (i=
first; i<=last;i++) {
2005 yi1 =
y[i]; yi =
y[i-1];
2007 if (i != last)
Error(where,
"Y must be in increasing order");
2008 else Error(where,
"Y must have N+1 values with option N");
2014 if ((
gxwork[npt-1] >= uxmin-rounding &&
gxwork[npt-1] <= uxmax+rounding) ||
2015 (
gxwork[npt] >= uxmin-rounding &&
gxwork[npt] <= uxmax+rounding)) npt += 2;
2034 if (!optionOne) drawtype = 2;
2039 for (i=
first; i<=last;i++) {
2044 xi1 =
x[i]; xi =
x[i-1];
2046 if (i != last)
Error(where,
"X must be in increasing order");
2047 else Error(where,
"X must have N+1 values with option N");
2050 gxwork[npt-1] =
x[i-1] + 0.5*(
x[i]-
x[i-1]);
2081 drawtype = drawtype+10;
2083 for (i=
first; i<=last;i++) {
2088 yi1 =
y[i]; yi =
y[i-1];
2090 if (i != last)
Error(where,
"Y must be in increasing order");
2091 else Error(where,
"Y must have N+1 values with option N");
2094 gywork[npt-1] =
y[i-1] + 0.5*(
y[i]-
y[i-1]);
2127 wminstep = wmin + 0.5*delta;
2129 gPad->GetRangeAxis(ax1,ay1,ax2,ay2);
2133 for (i=
first; i<=last;i++) {
2138 xi1 =
x[i]; xi =
x[i-1];
2140 if (i != last)
Error(where,
"X must be in increasing order");
2141 else Error(where,
"X must have N+1 values with option N");
2144 gxwork[npt-1] =
x[i-1] + 0.5*(
x[i]-
x[i-1]);
2146 if (
gxwork[npt-1] < uxmin ||
gxwork[npt-1] > uxmax) { npt--;
continue;}
2149 if ((
gywork[npt-1] < rwymin) || ((
gywork[npt-1] > rwymax) && !optionFill2)) {
2186 for (i=
first; i<=last;i++) {
2189 gywork[npt-1] = wminstep+(i-
first)*delta+0.5*delta;
2191 yi1 =
y[i]; yi =
y[i-1];
2193 if (i != last)
Error(where,
"Y must be in increasing order");
2194 else Error(where,
"Y must have N+1 values with option N");
2197 gywork[npt-1] =
y[i-1] + 0.5*(
y[i]-
y[i-1]);
2200 if ((
gxwork[npt-1] < uxmin) || (
gxwork[npt-1] > uxmax)) {
2222 if (optionLine != 0 && npt > 1) {
2233 offset = delta*baroffset; dbar = delta*barwidth;
2236 offset = (
x[1]-
x[0])*baroffset;
2237 dbar = (
x[1]-
x[0])*barwidth;
2239 offset = (
y[1]-
y[0])*baroffset;
2240 dbar = (
y[1]-
y[0])*barwidth;
2243 drawbordersav = drawborder;
2247 xhigh = wmin+offset+dbar;
2250 else ylow =
gPad->GetUymin();
2252 for (i=
first; i<=last;i++) {
2259 if (xlow < rwxmax && xhigh > rwxmin)
2263 xhigh = xhigh+delta;
2266 xi1 =
x[i]; xi =
x[i-1];
2268 Error(where,
"X must be in increasing order");
2271 offset = (
x[i+1]-
x[i])*baroffset;
2272 dbar = (
x[i+1]-
x[i])*barwidth;
2273 xlow =
x[i] + offset;
2274 xhigh =
x[i] + offset + dbar;
2279 ylow = wmin + offset;
2280 yhigh = wmin + offset + dbar;
2282 else xlow =
gPad->GetUxmin();
2283 for (i=
first; i<=last;i++) {
2291 gPad->PaintBox(xlow,ylow,xhigh,yhigh);
2293 ylow = ylow + delta;
2294 yhigh = yhigh + delta;
2297 yi1 =
y[i]; yi =
y[i-1];
2299 Error(where,
"Y must be in increasing order");
2302 offset = (
y[i+1]-
y[i])*baroffset;
2303 dbar = (
y[i+1]-
y[i])*barwidth;
2304 ylow =
y[i] + offset;
2305 yhigh =
y[i] + offset + dbar;
2316 if ((optionStar) || (optionMark)) optionMarker=1;
2322 for (i=
first; i<=last;i++) {
2323 if (!optionBins) xm = wmin+(i-
first)*delta+0.5*delta;
2324 else xm =
x[i-1] + 0.5*(
x[i]-
x[i-1]);
2326 if (optionMark != 10) {
2327 if (ym<rwymax && ym > rwymin) {
2333 if (ym<rwymax && ym >= rwymin) {
2350 wminstep = wmin + 0.5*delta;
2351 for (i=
first; i<=last;i++) {
2352 if (!optionBins) ym = wminstep+(i-
first)*delta+0.5*delta;
2353 else ym =
y[i-1] + 0.5*(
y[i]-
y[i-1]);
2355 if (optionMark != 10) {
2356 if (xm<rwxmax && xm > rwxmin) {
2362 if (xm<rwxmax && xm >= rwxmin) {
2402 const Int_t kBASEMARKER=8;
2403 Double_t s2x, s2y, symbolsize, sbase;
2404 Double_t x,
y, xl1, xl2, xr1, xr2, yup1, yup2, ylow1, ylow2, tx, ty;
2405 static Float_t cxx[15] = {1,1,0.6,0.6,1,1,0.6,0.5,1,0.6,0.6,1,0.6,1,1};
2406 static Float_t cyy[15] = {1,1,1,1,1,1,1,1,1,0.5,0.6,1,1,1,1};
2415 if (strchr(option,
'X') || strchr(option,
'x')) {
PaintGraphSimple(theGraph, option);
return;}
2418 if (strstr(option,
"||") || strstr(option,
"[]")) {
2420 if (strstr(option,
"[]")) braticks =
kTRUE;
2423 if (strchr(option,
'z')) endLines =
kFALSE;
2424 if (strchr(option,
'Z')) endLines =
kFALSE;
2425 const char *arrowOpt = 0;
2426 if (strchr(option,
'>')) arrowOpt =
">";
2427 if (strstr(option,
"|>")) arrowOpt =
"|>";
2430 if (strchr(option,
'a')) axis =
kTRUE;
2431 if (strchr(option,
'A')) axis =
kTRUE;
2439 if (strchr(option,
'0')) option0 =
kTRUE;
2440 if (strchr(option,
'2')) option2 =
kTRUE;
2441 if (strchr(option,
'3')) option3 =
kTRUE;
2442 if (strchr(option,
'4')) {option3 =
kTRUE; option4 =
kTRUE;}
2443 if (strchr(option,
'5')) {option2 =
kTRUE; option5 =
kTRUE;}
2446 xline =
new Double_t[2*theNpoints];
2447 yline =
new Double_t[2*theNpoints];
2448 if (!xline || !yline) {
2449 Error(
"Paint",
"too many points, out of memory");
2456 theGraph->TAttLine::Modify();
2471 sbase = symbolsize*kBASEMARKER;
2484 tx =
gPad->PixeltoX(dxend) -
gPad->PixeltoX(0);
2485 ty =-
gPad->PixeltoY(dxend) +
gPad->PixeltoY(0);
2486 Float_t asize = 0.6*symbolsize*kBASEMARKER/
gPad->GetWh();
2489 for (
Int_t i=0;i<theNpoints;i++) {
2490 x =
gPad->XtoPad(theX[i]);
2491 y =
gPad->YtoPad(theY[i]);
2494 if (x < gPad->GetUxmin())
x =
gPad->GetUxmin();
2495 if (
x >
gPad->GetUxmax())
x =
gPad->GetUxmax();
2496 if (y < gPad->GetUymin())
y =
gPad->GetUymin();
2497 if (
y >
gPad->GetUymax())
y =
gPad->GetUymax();
2499 if (x < gPad->GetUxmin())
continue;
2500 if (
x >
gPad->GetUxmax())
continue;
2501 if (y < gPad->GetUymin())
continue;
2502 if (
y >
gPad->GetUymax())
continue;
2506 xl2 =
gPad->XtoPad(theX[i] - theEXlow[i]);
2510 x1b =
gPad->XtoPad(theX[i] - theEXlow[i]);
2511 y1b =
gPad->YtoPad(theY[i] - theEYlow[i]);
2512 x2b =
gPad->XtoPad(theX[i] + theEXhigh[i]);
2513 y2b =
gPad->YtoPad(theY[i] + theEYhigh[i]);
2514 if (x1b < gPad->GetUxmin()) x1b =
gPad->GetUxmin();
2515 if (x1b >
gPad->GetUxmax()) x1b =
gPad->GetUxmax();
2516 if (y1b < gPad->GetUymin()) y1b =
gPad->GetUymin();
2517 if (y1b >
gPad->GetUymax()) y1b =
gPad->GetUymax();
2518 if (x2b < gPad->GetUxmin()) x2b =
gPad->GetUxmin();
2519 if (x2b >
gPad->GetUxmax()) x2b =
gPad->GetUxmax();
2520 if (y2b < gPad->GetUymin()) y2b =
gPad->GetUymin();
2521 if (y2b >
gPad->GetUymax()) y2b =
gPad->GetUymax();
2522 if (option5)
box.PaintBox(x1b, y1b, x2b, y2b,
"l");
2523 else box.PaintBox(x1b, y1b, x2b, y2b);
2531 yline[if1-1] =
gPad->YtoPad(theY[i] + theEYhigh[i]);
2532 yline[if2-1] =
gPad->YtoPad(theY[i] - theEYlow[i]);
2540 arrow.PaintArrow(xl1,
y,xl2,
y,asize,arrowOpt);
2542 if (!brackets)
gPad->PaintLine(xl1,
y,xl2,
y);
2545 xb[0] = xl2+tx; yb[0] =
y-ty;
2546 xb[1] = xl2; yb[1] =
y-ty;
2547 xb[2] = xl2; yb[2] =
y+ty;
2548 xb[3] = xl2+tx; yb[3] =
y+ty;
2549 gPad->PaintPolyLine(4, xb, yb);
2551 gPad->PaintLine(xl2,
y-ty,xl2,
y+ty);
2557 xr2 =
gPad->XtoPad(theX[i] + theEXhigh[i]);
2560 arrow.PaintArrow(xr1,
y,xr2,
y,asize,arrowOpt);
2562 if (!brackets)
gPad->PaintLine(xr1,
y,xr2,
y);
2565 xb[0] = xr2-tx; yb[0] =
y-ty;
2566 xb[1] = xr2; yb[1] =
y-ty;
2567 xb[2] = xr2; yb[2] =
y+ty;
2568 xb[3] = xr2-tx; yb[3] =
y+ty;
2569 gPad->PaintPolyLine(4, xb, yb);
2571 gPad->PaintLine(xr2,
y-ty,xr2,
y+ty);
2577 yup2 =
gPad->YtoPad(theY[i] + theEYhigh[i]);
2578 if (yup2 >
gPad->GetUymax()) yup2 =
gPad->GetUymax();
2581 arrow.PaintArrow(
x,yup1,
x,yup2,asize,arrowOpt);
2583 if (!brackets)
gPad->PaintLine(
x,yup1,
x,yup2);
2586 xb[0] =
x-tx; yb[0] = yup2-ty;
2587 xb[1] =
x-tx; yb[1] = yup2;
2588 xb[2] =
x+tx; yb[2] = yup2;
2589 xb[3] =
x+tx; yb[3] = yup2-ty;
2590 gPad->PaintPolyLine(4, xb, yb);
2592 gPad->PaintLine(
x-tx,yup2,
x+tx,yup2);
2598 ylow2 =
gPad->YtoPad(theY[i] - theEYlow[i]);
2599 if (ylow2 < gPad->GetUymin()) ylow2 =
gPad->GetUymin();
2600 if (ylow2 < ylow1) {
2602 arrow.PaintArrow(
x,ylow1,
x,ylow2,asize,arrowOpt);
2604 if (!brackets)
gPad->PaintLine(
x,ylow1,
x,ylow2);
2607 xb[0] =
x-tx; yb[0] = ylow2+ty;
2608 xb[1] =
x-tx; yb[1] = ylow2;
2609 xb[2] =
x+tx; yb[2] = ylow2;
2610 xb[3] =
x+tx; yb[3] = ylow2+ty;
2611 gPad->PaintPolyLine(4, xb, yb);
2613 gPad->PaintLine(
x-tx,ylow2,
x+tx,ylow2);
2627 if (option4)
PaintGraph(theGraph, 2*theNpoints, xline, yline,
"FC");
2628 else PaintGraph(theGraph, 2*theNpoints, xline, yline,
"F");
2629 gPad->SetLogx(logx);
2630 gPad->SetLogy(logy);
2648 Int_t NYErrors = tg->GetNYErrors();
2649 if (NYErrors <= 0) {
2657 std::vector<TString> options(NYErrors + 1);
2666 while ((firstSemicolon = tsOpt.
First(
';')) !=
kNPOS && filled <= NYErrors) {
2667 options[filled] = tsOpt(0, firstSemicolon);
2668 tsOpt = tsOpt(firstSemicolon + 1, tsOpt.
Length());
2672 if (filled <= NYErrors) {
2673 options[filled] = tsOpt.
Copy();
2677 for (
Int_t i = filled; i <= NYErrors; i++)
2681 std::vector<Double_t *> yline(NYErrors);
2686 const Int_t kBASEMARKER = 8;
2687 Double_t s2x, s2y, symbolsize, sbase;
2688 Double_t x,
y, xl1, xl2, xr1, xr2, yup1, yup2, ylow1, ylow2, tx, ty;
2689 static Float_t cxx[15] = {1., 1., 0.6, 0.6, 1., 1., 0.6, 0.5, 1., 0.6, 0.6, 1., 0.6, 1., 1.};
2690 static Float_t cyy[15] = {1., 1., 1., 1., 1., 1., 1., 1., 1., 0.5, 0.6, 1., 1., 1., 1.};
2691 Int_t theNpoints = tg->GetN();
2695 Double_t *theExH = tg->GetEXhigh();
2696 std::vector<Double_t *> theEyL(NYErrors);
2697 std::vector<Double_t *> theEyH(NYErrors);
2700 for (
Int_t j = 0; j < NYErrors; j++) {
2701 theEyL[j] = tg->GetEYlow(j);
2702 theEyH[j] = tg->GetEYhigh(j);
2703 theEyExists &= (theEyL[j] && theEyH[j]);
2706 if (!theX || !theY || !theExL || !theExH || !theEyExists)
2709 std::vector<Bool_t> DrawErrors(NYErrors);
2714 std::vector<Bool_t> Braticks(NYErrors);
2715 std::vector<Bool_t> Brackets(NYErrors);
2716 std::vector<Bool_t> EndLines(NYErrors);
2717 std::vector<Char_t *> ArrowOpt(NYErrors);
2718 std::vector<Bool_t> Option5(NYErrors);
2719 std::vector<Bool_t> Option4(NYErrors);
2720 std::vector<Bool_t> Option3(NYErrors);
2722 std::vector<Bool_t> Option2(NYErrors);
2723 std::vector<Bool_t> Option0(NYErrors);
2725 std::vector<Double_t> Scale(NYErrors);
2727 const TRegexp ScaleRegExp(
"s=*[0-9]\\.*[0-9]");
2729 for (
Int_t j = 0; j < NYErrors; j++) {
2730 if (options[j + 1].Contains(
"s=")) {
2731 sscanf(strstr(options[j + 1].Data(),
"s="),
"s=%lf", &Scale[j]);
2732 options[j + 1].ReplaceAll(options[j + 1](ScaleRegExp),
"");
2736 DrawErrors[j] = !options[j + 1].Contains(
"x");
2737 AnyErrors |= DrawErrors[j];
2738 Braticks[j] = options[j + 1].Contains(
"[]");
2739 Brackets[j] = options[j + 1].Contains(
"||") || Braticks[j];
2740 EndLines[j] = !options[j + 1].Contains(
"z");
2742 if (options[j + 1].Contains(
"|>"))
2743 ArrowOpt[j] = (
Char_t *)
"|>";
2744 else if (options[j + 1].Contains(
">"))
2745 ArrowOpt[j] = (
Char_t *)
">";
2747 ArrowOpt[j] =
nullptr;
2749 Option5[j] = options[j + 1].Contains(
"5");
2750 Option4[j] = options[j + 1].Contains(
"4");
2751 Option3[j] = options[j + 1].Contains(
"3") || Option4[j];
2752 AnyOption3 |= Option3[j];
2753 Option2[j] = options[j + 1].Contains(
"2") || Option5[j];
2754 Option0[j] = options[j + 1].Contains(
"0");
2755 AnyOption0 |= Option0[j];
2757 NoErrorsX &= (Option3[j] || Option2[j]);
2758 Option0X |= !(Option3[j] || Option2[j]) && Option0[j];
2759 DrawMarker |= !(Brackets[j] || Option3[j] || Option2[j]);
2762 Bool_t Draw0PointsX = !options[0].Contains(
"x0") && (
gPad->GetLogx() == 0);
2763 Bool_t Draw0PointsY = !options[0].Contains(
"y0") && (
gPad->GetLogy() == 0);
2764 options[0].ReplaceAll(
"x0",
"");
2765 options[0].ReplaceAll(
"y0",
"");
2767 Bool_t DrawErrorsX = !options[0].Contains(
"x");
2768 Bool_t BraticksX = options[0].Contains(
"[]");
2769 Bool_t BracketsX = options[0].Contains(
"||") || BraticksX;
2770 Bool_t EndLinesX = !options[0].Contains(
"z");
2772 Char_t *ArrowOptX =
nullptr;
2773 if (options[0].Contains(
"|>"))
2774 ArrowOptX = (
Char_t *)
"|>";
2775 else if (options[0].Contains(
">"))
2776 ArrowOptX = (
Char_t *)
">";
2779 if (options[0].Contains(
"s=")) {
2780 sscanf(strstr(options[0].Data(),
"s="),
"s=%lf", &ScaleX);
2781 options[0].ReplaceAll(options[0](ScaleRegExp),
"");
2784 if (!AnyErrors && !DrawErrorsX) {
2789 Bool_t DrawAxis = options[0].Contains(
"a");
2790 Bool_t IndividualStyles = options[0].Contains(
"s");
2795 Int_t NPointsInside = AnyOption0 ? theNpoints : 0;
2797 for (
Int_t i = 0; i < theNpoints && !AnyOption0; i++) {
2798 x =
gPad->XtoPad(theX[i]);
2799 y =
gPad->YtoPad(theY[i]);
2801 if ((
x >=
gPad->GetUxmin()) && (x <= gPad->GetUxmax()) && (
y >=
gPad->GetUymin()) && (y <= gPad->GetUymax()) &&
2802 (Draw0PointsX || theX[i] != 0.) && (Draw0PointsY || theY[i] != 0.))
2807 xline =
new Double_t[2 * NPointsInside];
2810 Error(
"Paint",
"too many points, out of memory");
2815 if2 = 2 * NPointsInside;
2818 for (
Int_t j = 0; j < NYErrors; j++) {
2819 if (Option3[j] && DrawErrors[j]) {
2820 yline[j] =
new Double_t[2 * NPointsInside];
2823 Error(
"Paint",
"too many points, out of memory");
2825 for (
Int_t k = 0; k < j; k++)
2833 tg->TAttLine::Modify();
2836 arrow.SetLineWidth(tg->GetLineWidth());
2837 arrow.SetLineColor(tg->GetLineColor());
2838 arrow.SetFillColor(tg->GetFillColor());
2842 box.SetLineWidth(tg->GetLineWidth());
2843 box.SetLineColor(tg->GetLineColor());
2844 box.SetFillColor(tg->GetFillColor());
2845 box.SetFillStyle(tg->GetFillStyle());
2847 symbolsize = tg->GetMarkerSize();
2848 sbase = symbolsize * kBASEMARKER;
2854 cx = cxx[
mark - 20];
2855 cy = cyy[
mark - 20];
2859 s2x =
gPad->PixeltoX(
Int_t(0.5 * sbase)) -
gPad->PixeltoX(0);
2860 s2y = -
gPad->PixeltoY(
Int_t(0.5 * sbase)) +
gPad->PixeltoY(0);
2862 tx =
gPad->PixeltoX(dxend) -
gPad->PixeltoX(0);
2863 ty = -
gPad->PixeltoY(dxend) +
gPad->PixeltoY(0);
2864 Float_t asize = 0.6 * symbolsize * kBASEMARKER /
gPad->GetWh();
2868 for (
Int_t i = 0; i < theNpoints; i++) {
2869 x =
gPad->XtoPad(theX[i]);
2870 y =
gPad->YtoPad(theY[i]);
2873 (
x <
gPad->GetUxmin()) || (
x >
gPad->GetUxmax()) || (y < gPad->GetUymin()) || (
y >
gPad->GetUymax());
2875 if ((isOutside && !AnyOption0) || (!Draw0PointsX && theX[i] == 0.) || (!Draw0PointsY && theY[i] == 0.))
2880 if (x < gPad->GetUxmin())
2881 x =
gPad->GetUxmin();
2882 if (
x >
gPad->GetUxmax())
2883 x =
gPad->GetUxmax();
2884 if (y < gPad->GetUymin())
2885 y =
gPad->GetUymin();
2886 if (
y >
gPad->GetUymax())
2887 y =
gPad->GetUymax();
2897 for (
Int_t j = 0; j < NYErrors; j++) {
2902 if (Option2[j] && (!isOutside || Option0[j])) {
2903 if (IndividualStyles) {
2904 box.SetLineWidth(tg->GetLineWidth(j));
2905 box.SetLineColor(tg->GetLineColor(j));
2906 box.SetFillColor(tg->GetFillColor(j));
2907 box.SetFillStyle(tg->GetFillStyle(j));
2910 x1b =
gPad->XtoPad(theX[i] - Scale[j] * theExL[i]);
2911 y1b =
gPad->YtoPad(theY[i] - theEyL[j][i]);
2912 x2b =
gPad->XtoPad(theX[i] + Scale[j] * theExH[i]);
2913 y2b =
gPad->YtoPad(theY[i] + theEyH[j][i]);
2914 if (x1b < gPad->GetUxmin())
2915 x1b =
gPad->GetUxmin();
2916 if (x1b >
gPad->GetUxmax())
2917 x1b =
gPad->GetUxmax();
2918 if (y1b < gPad->GetUymin())
2919 y1b =
gPad->GetUymin();
2920 if (y1b >
gPad->GetUymax())
2921 y1b =
gPad->GetUymax();
2922 if (x2b < gPad->GetUxmin())
2923 x2b =
gPad->GetUxmin();
2924 if (x2b >
gPad->GetUxmax())
2925 x2b =
gPad->GetUxmax();
2926 if (y2b < gPad->GetUymin())
2927 y2b =
gPad->GetUymin();
2928 if (y2b >
gPad->GetUymax())
2929 y2b =
gPad->GetUymax();
2931 box.PaintBox(x1b, y1b, x2b, y2b,
"l");
2933 box.PaintBox(x1b, y1b, x2b, y2b);
2938 if (!isOutside || Option0[j]) {
2939 yline[j][if1 - 2] =
gPad->YtoPad(theY[i] + theEyH[j][i]);
2940 yline[j][if2] =
gPad->YtoPad(theY[i] - theEyL[j][i]);
2942 yline[j][if1 - 2] =
gPad->GetUymin();
2943 yline[j][if2] =
gPad->GetUymin();
2947 if (IndividualStyles) {
2948 tg->GetAttLine(j)->Modify();
2950 arrow.SetLineWidth(tg->GetLineWidth(j));
2951 arrow.SetLineColor(tg->GetLineColor(j));
2952 arrow.SetFillColor(tg->GetFillColor(j));
2955 ylow1 =
y - s2y * cy;
2956 ylow2 =
gPad->YtoPad(theY[i] - theEyL[j][i]);
2957 if (ylow2 < gPad->GetUymin())
2958 ylow2 =
gPad->GetUymin();
2959 if (ylow2 < ylow1 && DrawErrors[j] && !Option2[j] && !Option3[j] && (!isOutside || Option0[j])) {
2961 arrow.PaintArrow(
x, ylow1,
x, ylow2, asize, ArrowOpt[j]);
2964 gPad->PaintLine(
x, ylow1,
x, ylow2);
2975 gPad->PaintPolyLine(4, xb, yb);
2977 gPad->PaintLine(
x - tx, ylow2,
x + tx, ylow2);
2982 yup1 =
y + s2y * cy;
2983 yup2 =
gPad->YtoPad(theY[i] + theEyH[j][i]);
2984 if (yup2 >
gPad->GetUymax())
2985 yup2 =
gPad->GetUymax();
2986 if (yup2 > yup1 && DrawErrors[j] && !Option2[j] && !Option3[j] && (!isOutside || Option0[j])) {
2988 arrow.PaintArrow(
x, yup1,
x, yup2, asize, ArrowOpt[j]);
2991 gPad->PaintLine(
x, yup1,
x, yup2);
3002 gPad->PaintPolyLine(4, xb, yb);
3004 gPad->PaintLine(
x - tx, yup2,
x + tx, yup2);
3011 if (IndividualStyles) {
3012 tg->TAttLine::Modify();
3014 arrow.SetLineWidth(tg->GetLineWidth());
3015 arrow.SetLineColor(tg->GetLineColor());
3016 arrow.SetFillColor(tg->GetFillColor());
3020 xl2 =
gPad->XtoPad(theX[i] - ScaleX * theExL[i]);
3021 if (xl1 > xl2 && !NoErrorsX && (!isOutside || Option0X)) {
3023 arrow.PaintArrow(xl1,
y, xl2,
y, asize, ArrowOptX);
3026 gPad->PaintLine(xl1,
y, xl2,
y);
3037 gPad->PaintPolyLine(4, xb, yb);
3039 gPad->PaintLine(xl2,
y - ty, xl2,
y + ty);
3045 xr2 =
gPad->XtoPad(theX[i] + ScaleX * theExH[i]);
3046 if (xr1 < xr2 && !NoErrorsX && (!isOutside || Option0X)) {
3048 arrow.PaintArrow(xr1,
y, xr2,
y, asize, ArrowOptX);
3051 gPad->PaintLine(xr1,
y, xr2,
y);
3062 gPad->PaintPolyLine(4, xb, yb);
3064 gPad->PaintLine(xr2,
y - ty, xr2,
y + ty);
3075 auto tgDummy =
new TGraph();
3076 tg->TAttFill::Copy(*tgDummy);
3077 tg->TAttLine::Copy(*tgDummy);
3078 tg->TAttMarker::Copy(*tgDummy);
3080 for (
Int_t j = 0; j < NYErrors; j++) {
3081 if (Option3[j] && DrawErrors[j]) {
3082 if (IndividualStyles) {
3083 tg->GetAttFill(j)->Copy(*tgDummy);
3084 tg->GetAttLine(j)->Copy(*tgDummy);
3092 PaintGraph(tgDummy, 2 * NPointsInside, xline, yline[j],
"FC");
3094 PaintGraph(tgDummy, 2 * NPointsInside, xline, yline[j],
"F");
3095 gPad->SetLogx(logx);
3096 gPad->SetLogy(logy);
3119 const Int_t kBASEMARKER=8;
3120 Double_t s2x, s2y, symbolsize, sbase;
3121 Double_t x,
y, xl1, xl2, xr1, xr2, yup1, yup2, ylow1, ylow2, tx, ty;
3123 static Float_t cxx[15] = {1,1,0.6,0.6,1,1,0.6,0.5,1,0.6,0.6,1,0.6,1,1};
3124 static Float_t cyy[15] = {1,1,1,1,1,1,1,1,1,0.5,0.6,1,1,1,1};
3137 if (strchr(option,
'X') || strchr(option,
'x')) {
PaintGraphSimple(theGraph, option);
return;}
3140 if (strstr(option,
"||") || strstr(option,
"[]")) {
3142 if (strstr(option,
"[]")) braticks =
kTRUE;
3145 if (strchr(option,
'z')) endLines =
kFALSE;
3146 if (strchr(option,
'Z')) endLines =
kFALSE;
3147 const char *arrowOpt = 0;
3148 if (strchr(option,
'>')) arrowOpt =
">";
3149 if (strstr(option,
"|>")) arrowOpt =
"|>";
3152 if (strchr(option,
'a')) axis =
kTRUE;
3153 if (strchr(option,
'A')) axis =
kTRUE;
3161 if (strchr(option,
'0')) option0 =
kTRUE;
3162 if (strchr(option,
'2')) option2 =
kTRUE;
3163 if (strchr(option,
'3')) option3 =
kTRUE;
3164 if (strchr(option,
'4')) {option3 =
kTRUE; option4 =
kTRUE;}
3165 if (strchr(option,
'5')) {option2 =
kTRUE; option5 =
kTRUE;}
3168 xline =
new Double_t[2*theNpoints];
3169 yline =
new Double_t[2*theNpoints];
3170 if (!xline || !yline) {
3171 Error(
"Paint",
"too many points, out of memory");
3178 theGraph->TAttLine::Modify();
3193 sbase = symbolsize*kBASEMARKER;
3206 tx =
gPad->PixeltoX(dxend) -
gPad->PixeltoX(0);
3207 ty =-
gPad->PixeltoY(dxend) +
gPad->PixeltoY(0);
3208 Float_t asize = 0.6*symbolsize*kBASEMARKER/
gPad->GetWh();
3211 for (
Int_t i=0;i<theNpoints;i++) {
3212 x =
gPad->XtoPad(theX[i]);
3213 y =
gPad->YtoPad(theY[i]);
3214 bxl =
gPad->YtoPad(theY[i]+theEXlowd[i]);
3215 bxh =
gPad->YtoPad(theY[i]+theEXhighd[i]);
3216 byl =
gPad->XtoPad(theX[i]+theEYlowd[i]);
3217 byh =
gPad->XtoPad(theX[i]+theEYhighd[i]);
3220 if (x < gPad->GetUxmin())
x =
gPad->GetUxmin();
3221 if (
x >
gPad->GetUxmax())
x =
gPad->GetUxmax();
3222 if (y < gPad->GetUymin())
y =
gPad->GetUymin();
3223 if (
y >
gPad->GetUymax())
y =
gPad->GetUymax();
3225 if (x < gPad->GetUxmin())
continue;
3226 if (
x >
gPad->GetUxmax())
continue;
3227 if (y < gPad->GetUymin())
continue;
3228 if (
y >
gPad->GetUymax())
continue;
3234 x1b =
gPad->XtoPad(theX[i] - theEXlow[i]);
3235 y1b =
gPad->YtoPad(theY[i] - theEYlow[i]);
3236 x2b =
gPad->XtoPad(theX[i] + theEXhigh[i]);
3237 y2b =
gPad->YtoPad(theY[i] + theEYhigh[i]);
3238 if (x1b < gPad->GetUxmin()) x1b =
gPad->GetUxmin();
3239 if (x1b >
gPad->GetUxmax()) x1b =
gPad->GetUxmax();
3240 if (y1b < gPad->GetUymin()) y1b =
gPad->GetUymin();
3241 if (y1b >
gPad->GetUymax()) y1b =
gPad->GetUymax();
3242 if (x2b < gPad->GetUxmin()) x2b =
gPad->GetUxmin();
3243 if (x2b >
gPad->GetUxmax()) x2b =
gPad->GetUxmax();
3244 if (y2b < gPad->GetUymin()) y2b =
gPad->GetUymin();
3245 if (y2b >
gPad->GetUymax()) y2b =
gPad->GetUymax();
3246 if (option5)
box.PaintBox(x1b, y1b, x2b, y2b,
"l");
3247 else box.PaintBox(x1b, y1b, x2b, y2b);
3255 yline[if1-1] =
gPad->YtoPad(theY[i] + theEYhigh[i]);
3256 yline[if2-1] =
gPad->YtoPad(theY[i] - theEYlow[i]);
3263 xl2 =
gPad->XtoPad(theX[i] - theEXlow[i]);
3266 arrow.PaintArrow(xl1,
y,xl2,bxl,asize,arrowOpt);
3268 if (!brackets)
gPad->PaintLine(xl1,
y,xl2,bxl);
3271 xb[0] = xl2+tx; yb[0] = bxl-ty;
3272 xb[1] = xl2; yb[1] = bxl-ty;
3273 xb[2] = xl2; yb[2] = bxl+ty;
3274 xb[3] = xl2+tx; yb[3] = bxl+ty;
3275 gPad->PaintPolyLine(4, xb, yb);
3277 gPad->PaintLine(xl2,bxl-ty,xl2,bxl+ty);
3283 xr2 =
gPad->XtoPad(theX[i] + theEXhigh[i]);
3286 arrow.PaintArrow(xr1,
y,xr2,bxh,asize,arrowOpt);
3288 if (!brackets)
gPad->PaintLine(xr1,
y,xr2,bxh);
3291 xb[0] = xr2-tx; yb[0] = bxh-ty;
3292 xb[1] = xr2; yb[1] = bxh-ty;
3293 xb[2] = xr2; yb[2] = bxh+ty;
3294 xb[3] = xr2-tx; yb[3] = bxh+ty;
3295 gPad->PaintPolyLine(4, xb, yb);
3297 gPad->PaintLine(xr2,bxh-ty,xr2,bxh+ty);
3303 yup2 =
gPad->YtoPad(theY[i] + theEYhigh[i]);
3304 if (yup2 >
gPad->GetUymax()) yup2 =
gPad->GetUymax();
3307 arrow.PaintArrow(
x,yup1,byh,yup2,asize,arrowOpt);
3309 if (!brackets)
gPad->PaintLine(
x,yup1,byh,yup2);
3312 xb[0] = byh-tx; yb[0] = yup2-ty;
3313 xb[1] = byh-tx; yb[1] = yup2;
3314 xb[2] = byh+tx; yb[2] = yup2;
3315 xb[3] = byh+tx; yb[3] = yup2-ty;
3316 gPad->PaintPolyLine(4, xb, yb);
3318 gPad->PaintLine(byh-tx,yup2,byh+tx,yup2);
3324 ylow2 =
gPad->YtoPad(theY[i] - theEYlow[i]);
3325 if (ylow2 < gPad->GetUymin()) ylow2 =
gPad->GetUymin();
3326 if (ylow2 < ylow1) {
3328 arrow.PaintArrow(
x,ylow1,byl,ylow2,asize,arrowOpt);
3330 if (!brackets)
gPad->PaintLine(
x,ylow1,byl,ylow2);
3333 xb[0] = byl-tx; yb[0] = ylow2+ty;
3334 xb[1] = byl-tx; yb[1] = ylow2;
3335 xb[2] = byl+tx; yb[2] = ylow2;
3336 xb[3] = byl+tx; yb[3] = ylow2+ty;
3337 gPad->PaintPolyLine(4, xb, yb);
3339 gPad->PaintLine(byl-tx,ylow2,byl+tx,ylow2);
3353 if (option4)
PaintGraph(theGraph, 2*theNpoints, xline, yline,
"FC");
3354 else PaintGraph(theGraph, 2*theNpoints, xline, yline,
"F");
3355 gPad->SetLogx(logx);
3356 gPad->SetLogy(logy);
3375 const Int_t kBASEMARKER=8;
3376 Double_t s2x, s2y, symbolsize, sbase;
3377 Double_t x,
y,
ex,
ey, xl1, xl2, xr1, xr2, yup1, yup2, ylow1, ylow2, tx, ty;
3378 static Float_t cxx[15] = {1,1,0.6,0.6,1,1,0.6,0.5,1,0.6,0.6,1,0.6,1,1};
3379 static Float_t cyy[15] = {1,1,1,1,1,1,1,1,1,0.5,0.6,1,1,1,1};
3386 if (strchr(option,
'X') || strchr(option,
'x')) {
PaintGraphSimple(theGraph, option);
return;}
3389 if (strstr(option,
"||") || strstr(option,
"[]")) {
3391 if (strstr(option,
"[]")) braticks =
kTRUE;
3394 if (strchr(option,
'z')) endLines =
kFALSE;
3395 if (strchr(option,
'Z')) endLines =
kFALSE;
3396 const char *arrowOpt = 0;
3397 if (strchr(option,
'>')) arrowOpt =
">";
3398 if (strstr(option,
"|>")) arrowOpt =
"|>";
3401 if (strchr(option,
'a')) axis =
kTRUE;
3402 if (strchr(option,
'A')) axis =
kTRUE;
3410 if (strchr(option,
'0')) option0 =
kTRUE;
3411 if (strchr(option,
'2')) option2 =
kTRUE;
3412 if (strchr(option,
'3')) option3 =
kTRUE;
3413 if (strchr(option,
'4')) {option3 =
kTRUE; option4 =
kTRUE;}
3414 if (strchr(option,
'5')) {option2 =
kTRUE; option5 =
kTRUE;}
3417 xline =
new Double_t[2*theNpoints];
3418 yline =
new Double_t[2*theNpoints];
3419 if (!xline || !yline) {
3420 Error(
"Paint",
"too many points, out of memory");
3427 theGraph->TAttLine::Modify();
3442 sbase = symbolsize*kBASEMARKER;
3455 tx =
gPad->PixeltoX(dxend) -
gPad->PixeltoX(0);
3456 ty =-
gPad->PixeltoY(dxend) +
gPad->PixeltoY(0);
3457 Float_t asize = 0.6*symbolsize*kBASEMARKER/
gPad->GetWh();
3460 for (
Int_t i=0;i<theNpoints;i++) {
3461 x =
gPad->XtoPad(theX[i]);
3462 y =
gPad->YtoPad(theY[i]);
3465 if (x < gPad->GetUxmin())
x =
gPad->GetUxmin();
3466 if (
x >
gPad->GetUxmax())
x =
gPad->GetUxmax();
3467 if (y < gPad->GetUymin())
y =
gPad->GetUymin();
3468 if (
y >
gPad->GetUymax())
y =
gPad->GetUymax();
3470 if (x < gPad->GetUxmin())
continue;
3471 if (
x >
gPad->GetUxmax())
continue;
3472 if (y < gPad->GetUymin())
continue;
3473 if (
y >
gPad->GetUymax())
continue;
3481 x1b =
gPad->XtoPad(theX[i] -
ex);
3482 y1b =
gPad->YtoPad(theY[i] -
ey);
3483 x2b =
gPad->XtoPad(theX[i] +
ex);
3484 y2b =
gPad->YtoPad(theY[i] +
ey);
3485 if (x1b < gPad->GetUxmin()) x1b =
gPad->GetUxmin();
3486 if (x1b >
gPad->GetUxmax()) x1b =
gPad->GetUxmax();
3487 if (y1b < gPad->GetUymin()) y1b =
gPad->GetUymin();
3488 if (y1b >
gPad->GetUymax()) y1b =
gPad->GetUymax();
3489 if (x2b < gPad->GetUxmin()) x2b =
gPad->GetUxmin();
3490 if (x2b >
gPad->GetUxmax()) x2b =
gPad->GetUxmax();
3491 if (y2b < gPad->GetUymin()) y2b =
gPad->GetUymin();
3492 if (y2b >
gPad->GetUymax()) y2b =
gPad->GetUymax();
3493 if (option5)
box.PaintBox(x1b, y1b, x2b, y2b,
"l");
3494 else box.PaintBox(x1b, y1b, x2b, y2b);
3502 yline[if1-1] =
gPad->YtoPad(theY[i] +
ey);
3503 yline[if2-1] =
gPad->YtoPad(theY[i] -
ey);
3510 xl2 =
gPad->XtoPad(theX[i] -
ex);
3513 arrow.PaintArrow(xl1,
y,xl2,
y,asize,arrowOpt);
3515 if (!brackets)
gPad->PaintLine(xl1,
y,xl2,
y);
3518 xb[0] = xl2+tx; yb[0] =
y-ty;
3519 xb[1] = xl2; yb[1] =
y-ty;
3520 xb[2] = xl2; yb[2] =
y+ty;
3521 xb[3] = xl2+tx; yb[3] =
y+ty;
3522 gPad->PaintPolyLine(4, xb, yb);
3524 gPad->PaintLine(xl2,
y-ty,xl2,
y+ty);
3530 xr2 =
gPad->XtoPad(theX[i] +
ex);
3533 arrow.PaintArrow(xr1,
y,xr2,
y,asize,arrowOpt);
3535 if (!brackets)
gPad->PaintLine(xr1,
y,xr2,
y);
3538 xb[0] = xr2-tx; yb[0] =
y-ty;
3539 xb[1] = xr2; yb[1] =
y-ty;
3540 xb[2] = xr2; yb[2] =
y+ty;
3541 xb[3] = xr2-tx; yb[3] =
y+ty;
3542 gPad->PaintPolyLine(4, xb, yb);
3544 gPad->PaintLine(xr2,
y-ty,xr2,
y+ty);
3550 yup2 =
gPad->YtoPad(theY[i] +
ey);
3551 if (yup2 >
gPad->GetUymax()) yup2 =
gPad->GetUymax();
3554 arrow.PaintArrow(
x,yup1,
x,yup2,asize,arrowOpt);
3556 if (!brackets)
gPad->PaintLine(
x,yup1,
x,yup2);
3559 xb[0] =
x-tx; yb[0] = yup2-ty;
3560 xb[1] =
x-tx; yb[1] = yup2;
3561 xb[2] =
x+tx; yb[2] = yup2;
3562 xb[3] =
x+tx; yb[3] = yup2-ty;
3563 gPad->PaintPolyLine(4, xb, yb);
3565 gPad->PaintLine(
x-tx,yup2,
x+tx,yup2);
3571 ylow2 =
gPad->YtoPad(theY[i] -
ey);
3572 if (ylow2 < gPad->GetUymin()) ylow2 =
gPad->GetUymin();
3573 if (ylow2 < ylow1) {
3575 arrow.PaintArrow(
x,ylow1,
x,ylow2,asize,arrowOpt);
3577 if (!brackets)
gPad->PaintLine(
x,ylow1,
x,ylow2);
3580 xb[0] =
x-tx; yb[0] = ylow2+ty;
3581 xb[1] =
x-tx; yb[1] = ylow2;
3582 xb[2] =
x+tx; yb[2] = ylow2;
3583 xb[3] =
x+tx; yb[3] = ylow2+ty;
3584 gPad->PaintPolyLine(4, xb, yb);
3586 gPad->PaintLine(
x-tx,ylow2,
x+tx,ylow2);
3600 if (option4)
PaintGraph(theGraph, 2*theNpoints, xline, yline,
"FC");
3601 else PaintGraph(theGraph, 2*theNpoints, xline, yline,
"F");
3602 gPad->SetLogx(logx);
3603 gPad->SetLogy(logy);
3617 Double_t rwrmin, rwrmax, rwtmin, rwtmax;
3621 Int_t theNpoints = theGraphPolar->
GetN();
3627 if (theNpoints<1)
return;
3642 if (thePolargram)
if (!
gPad->FindObject(thePolargram->
GetName())) thePolargram=0;
3643 if (!thePolargram) {
3656 if (!thePolargram) {
3658 rwrmin = theY[0]; rwrmax = theY[theNpoints-1];
3659 rwtmin = theX[0]; rwtmax = theX[theNpoints-1];
3661 for (ipt = 0; ipt < theNpoints; ipt++) {
3664 if (theX[ipt] -theEX[ipt] < rwtmin) rwtmin = theX[ipt]-theEX[ipt];
3665 if (theX[ipt] +theEX[ipt] > rwtmax) rwtmax = theX[ipt]+theEX[ipt];
3667 if (theX[ipt] < rwtmin) rwtmin=theX[ipt];
3668 if (theX[ipt] > rwtmax) rwtmax=theX[ipt];
3671 if (theY[ipt] -theEY[ipt] < rwrmin) rwrmin = theY[ipt]-theEY[ipt];
3672 if (theY[ipt] +theEY[ipt] > rwrmax) rwrmax = theY[ipt]+theEY[ipt];
3674 if (theY[ipt] < rwrmin) rwrmin=theY[ipt];
3675 if (theY[ipt] > rwrmax) rwrmax=theY[ipt];
3679 if (rwrmin == rwrmax) rwrmax += 1.;
3680 if (rwtmin == rwtmax) rwtmax += 1.;
3687 rwtmax += dt/theNpoints;
3689 rwrmin = thePolargram->
GetRMin();
3690 rwrmax = thePolargram->
GetRMax();
3691 rwtmin = thePolargram->
GetTMin();
3692 rwtmax = thePolargram->
GetTMax();
3697 thePolargram =
new TGraphPolargram(
"Polargram",rwrmin,rwrmax,rwtmin,rwtmax);
3701 if (nolabel) thePolargram->
Draw(
"N");
3702 else thePolargram->
Draw(
"");
3711 Double_t radiusNDC = rwrmax-rwrmin;
3721 for (i=0; i<theNpoints; i++) {
3722 Double_t eymin, eymax, exmin,exmax;
3723 exmin = (theY[i]-theEY[i]-rwrmin)/radiusNDC*
3725 eymin = (theY[i]-theEY[i]-rwrmin)/radiusNDC*
3727 exmax = (theY[i]+theEY[i]-rwrmin)/radiusNDC*
3729 eymax = (theY[i]+theEY[i]-rwrmin)/radiusNDC*
3731 theGraphPolar->TAttLine::Modify();
3732 if (exmin != exmax || eymin != eymax)
gPad->PaintLine(exmin,eymin,exmax,eymax);
3736 for (i=0; i<theNpoints; i++) {
3740 theGraphPolar->TAttLine::Modify();
3741 if (phimin != phimax) thePolargram->
PaintCircle(0,0,
rad,phimin,phimax,0);
3747 if (!(
gPad->GetLogx()) && !(
gPad->GetLogy())) {
3748 Double_t a,
b,
c=1,
x1,
x2, y1, y2, discr, norm1, norm2, xts, yts;
3756 for (i=0; i<theNpoints; i++) {
3759 xt = (theY[i]-rwrmin)/radiusNDC*
TMath::Cos(
c*(theX[i]-rwtmin)/thetaNDC);
3760 yt = (theY[i]-rwrmin)/radiusNDC*
TMath::Sin(
c*(theX[i]-rwtmin)/thetaNDC);
3761 norm =
sqrt(xt*xt+yt*yt);
3766 if (!previouspointin) {
3771 a = (yt-yts)/(xt-xts);
3773 discr = 4*(
a*
a-
b*
b+1);
3778 norm1 =
sqrt((
x1-xt)*(
x1-xt)+(y1-yt)*(y1-yt));
3779 norm2 =
sqrt((
x2-xt)*(
x2-xt)+(y2-yt)*(y2-yt));
3780 previouspointin =
kFALSE;
3782 if (norm1 < norm2) {
3792 PaintGraph(theGraphPolar, j+1, theXpol, theYpol, opt);
3797 if (j>=1 && !previouspointin) {
3798 a = (yt-theYpol[j])/(xt-theXpol[j]);
3799 b = theYpol[j]-
a*theXpol[j];
3800 previouspointin =
kTRUE;
3801 discr = 4*(
a*
a-
b*
b+1);
3806 norm1 =
sqrt((
x1-xt)*(
x1-xt)+(y1-yt)*(y1-yt));
3807 norm2 =
sqrt((
x2-xt)*(
x2-xt)+(y2-yt)*(y2-yt));
3809 if (norm1 < norm2) {
3816 PaintGraph(theGraphPolar, j+1, theXpol, theYpol, opt);
3823 PaintGraph(theGraphPolar, j+1, theXpol, theYpol, opt);
3826 for (i=0; i<theNpoints; i++) {
3830 PaintGraph(theGraphPolar, theNpoints, theXpol, theYpol,opt);
3839 TIter next(
gPad->GetListOfPrimitives());
3840 while ((obj = next())) {
3844 if (strcmp(title->
GetName(),
"title")) {title = 0;
continue;}
3848 if (title)
delete title;
3854 if (ht <= 0) ht = 0.05;
3875 if (talh < 1) talh = 1;
else if (talh > 3) talh = 3;
3877 if (talv < 1) talv = 1;
else if (talv > 3) talv = 3;
3883 if (talh == 2) xpos = xpos-wt/2.;
3884 if (talh == 3) xpos = xpos-wt;
3885 if (talv == 2) ypos = ypos+ht/2.;
3886 if (talv == 1) ypos = ypos+ht;
3919 TF1 *theF = theGraphQQ->
GetF();
3922 Error(
"TGraphQQ::Paint",
"2nd dataset or theoretical function not specified");
3937 Double_t yxmin, xymin, yxmax, xymax;
3943 TLine line1, line2, line3;
3946 yxmin = (theYq2-theYq1)*(
xmin-theXq1)/(theXq2-theXq1) + theYq1;
3948 xymin = (theXq2-theXq1)*(
ymin-theYq1)/(theYq2-theYq1) + theXq1;
3954 line2.
PaintLine(xqmin, yqmin, xqmax, yqmax);
3956 yxmax = (theYq2-theYq1)*(
xmax-theXq1)/(theXq2-theXq1) + theYq1;
3958 xymax = (theXq2-theXq1)*(
ymax-theYq1)/(theYq2-theYq1) + theXq1;
3998 theHist->
Paint(
"0");
4011 XA1 =
gPad->GetUxmin();
4012 XA2 =
gPad->GetUxmax();
4013 YA1 =
gPad->GetUymin();
4014 YA2 =
gPad->GetUymax();
4019 std::vector<Double_t> newX(
N);
4020 std::vector<Double_t> newY(
N);
4032 if (
gPad->GetGridx()) {
4033 GL = (YA2 - YA1) / (
gPad->GetY2() -
gPad->GetY1());
4036 auto *theNewAxis =
new TGaxis(
gPad->GetUxmax(),
4047 theNewAxis->SetTickLength(TLX);
4049 theNewAxis->Paint();
4052 for (
Int_t i=0; i<
N; i++) newX[i] = dX-X[i];
4054 for (
Int_t i=0; i<
N; i++) newX[i] = X[i];
4065 if (
gPad->GetGridy()) {
4066 GL = (XA2 - XA1) / (
gPad->GetX2() -
gPad->GetX1());
4069 auto *theNewAxis =
new TGaxis(
gPad->GetUxmin(),
4080 theNewAxis->SetTickLength(-TLY);
4081 theNewAxis->SetLabelOffset(LOY-TLY);
4082 theNewAxis->Paint();
4085 for (
Int_t i=0; i<
N; i++) newY[i] = dY-Y[i];
4087 for (
Int_t i=0; i<
N; i++) newY[i] = Y[i];
4092 for (
Int_t i=0; i<
N; i++) theNewGraph->
SetPoint(i, newX[i], newY[i]);
4115 if (strstr(option,
"H") || strstr(option,
"h")) {
4126 if (!functions)
return;
4162 Double_t x1,
x2, y1, y2,
x3, y3, xm, ym,
a, a1, a2, a3;
4165 Int_t ix1,iy1,ix2,iy2;
4169 gPad->GetPadPar(x1p,y1p,x2p,y2p);
4170 ix1 = (
Int_t)(iw*x1p);
4171 iy1 = (
Int_t)(ih*y1p);
4172 ix2 = (
Int_t)(iw*x2p);
4173 iy2 = (
Int_t)(ih*y2p);
4185 gPad->GetRange(rx1,ry1,rx2,ry2);
4186 Double_t rx = (x2ndc-x1ndc)/(rx2-rx1);
4187 Double_t ry = (y2ndc-y1ndc)/(ry2-ry1);
4191 xf[0] = rx*(
x[0]-rx1)+x1ndc;
4192 yf[0] = ry*(
y[0]-ry1)+y1ndc;
4194 for (i=1; i<
n; i++) {
4195 if (
x[i]==
x[i-1] &&
y[i]==
y[i-1])
continue;
4197 xf[nf] = rx*(
x[i]-rx1)+x1ndc;
4198 if (xf[i]==xf[i-1]) xf[i] += 0.000001;
4199 yf[nf] = ry*(
y[i]-ry1)+y1ndc;
4218 if (xf[nf]==xf[nf-1]) {
4223 if (xf[nf]>=xf[nf-1]) {
4232 for (i=1; i<nf; i++) {
4244 if (xi1<xi0) a1 = a1+3.14159;
4250 if (xi0<xi2) a2 = a2+3.14159;
4265 if ((xm-xi0)*(
x3-xi0)<0 && (ym-yi0)*(y3-yi0)<0) {
4269 if ((xm==
x1) && (ym==y1)) {
4278 if (xf[nf]==xf[0] && yf[nf]==yf[0]) {
4279 xm = (xt[nf]+xt[0])*0.5;
4280 ym = (yt[nf]+yt[0])*0.5;
4288 if ((xm-xf[0])*(
x3-xf[0])<0 && (ym-yf[0])*(y3-yf[0])<0) {
4302 for (i=nf2; i>0; i--) {
4303 for (j=i-1; j>0; j--) {
4304 if (xt[i-1]==xt[i] || xt[j-1]==xt[j])
continue;
4305 c1 = (yt[i-1]-yt[i])/(xt[i-1]-xt[i]);
4306 b1 = yt[i]-
c1*xt[i];
4307 c2 = (yt[j-1]-yt[j])/(xt[j-1]-xt[j]);
4308 b2 = yt[j]-
c2*xt[j];
4310 xc = (b2-b1)/(
c1-
c2);
4316 nf++; xf[nf] = xt[i]; yf[nf] = yt[i];
4317 nf++; xf[nf] = xc ; yf[nf] = yc;
4335 nf++; xf[nf] = xt[0]; yf[nf] = yt[0];
4338 for (i=0; i<nf+1; i++) {
4339 xf[i] = (1/rx)*(xf[i]-x1ndc)+rx1;
4340 yf[i] = (1/ry)*(yf[i]-y1ndc)+ry1;
4344 gPad->PaintFillArea(nf+1,xf,yf);
4345 theGraph->TAttLine::Modify();
4363 TIter next(functions);
4365 while ((obj = next())) {
4375 if (!dofit) fit = 0;
4377 if (dofit == 1) dofit = 111;
4379 Int_t print_fval = dofit%10;
4380 Int_t print_ferrors = (dofit/10)%10;
4381 Int_t print_fchi2 = (dofit/100)%10;
4382 Int_t print_fprob = (dofit/1000)%10;
4383 Int_t nlinesf = print_fval + print_fchi2 + print_fprob;
4384 if (fit) nlinesf += fit->
GetNpar();
4422 if (print_fchi2) stats->
AddText(t);
4428 if (print_fval || print_ferrors) {
4430 if (print_ferrors) {
4443 if (!done) functions->
Add(stats);
4473 Int_t i, k, kp,
km, npointsMax, banksize, n2, npt;
4474 Int_t maxiterations, finished;
4475 Int_t jtype, ktype, closed;
4476 Double_t sxmin, sxmax, symin, symax;
4479 Double_t ratio_signs, xratio, yratio;
4485 Double_t co, so, ct, st, ctu, stu, xnt;
4486 Double_t dx1, dy1, dx2, dy2, dk1, dk2;
4493 c = t = co = so = ct = st = ctu = stu = dx1 = dy1 = dx2 = dy2 = 0;
4494 xt = yt = xa = xb = ya = yb = u1 = u2 = u3 = tj = sb = 0;
4496 npointsMax = npoints*10;
4503 Error(
"Smooth",
"not enough space in memory");
4510 jtype = (drawtype%1000)-10;
4511 if (jtype > 0) { ktype = jtype; loptx =
kTRUE; }
4512 else ktype = drawtype%1000;
4541 for (i=1;i<npoints;i++) {
4543 if ((
x[i]-
x[i-1])*(
x[i-1]-
x[i-2]) < 0) six++;
4544 if ((
y[i]-
y[i-1])*(
y[i-1]-
y[i-2]) < 0) siy++;
4546 if (
x[i] < sxmin) sxmin =
x[i];
4547 if (
x[i] > sxmax) sxmax =
x[i];
4548 if (
y[i] < symin) symin =
y[i];
4549 if (
y[i] > symax) symax =
y[i];
4554 if (dx1n < 0.01*(sxmax-sxmin) && dy1n < 0.01*(symax-symin)) closed = 1;
4555 if (sxmin == sxmax) {
4558 if (six > 1) ratio_signs = siy/six;
4559 else ratio_signs = 20;
4560 xratio = ratio_signs/(sxmax-sxmin);
4562 if (symin == symax) yratio = 1;
4563 else yratio = 1/(symax-symin);
4567 for (i=0;i<npoints;i++) {
4568 x[i] = (
x[i]-sxmin)*xratio;
4569 y[i] = (
y[i]-symin)*yratio;
4588 if (
x[0] !=
x[npoints-1] ||
y[0] !=
y[npoints-1])
goto L40;
4589 if (
x[npoints-2] ==
x[npoints-1] &&
y[npoints-2] ==
y[npoints-1])
goto L40;
4590 if (
x[0] ==
x[1] &&
y[0] ==
y[1])
goto L40;
4613 if (npt > 1)
goto L310;
4617 if (
x[k-1] ==
x[k-2] &&
y[k-1] ==
y[k-2])
goto L50;
4622 if (npt > 1)
goto L310;
4625 if (k < npoints)
goto L90;
4626 if (!flgic) { kp = 2;
goto L130;}
4629 if (flgis)
goto L150;
4639 if (
x[k-1] ==
x[k] &&
y[k-1] ==
y[k])
goto L80;
4647 if (!flgis)
goto L50;
4662 dx1 =
x[k-1] -
x[
km-1];
4663 dy1 =
y[k-1] -
y[
km-1];
4664 dk1 = dx1*dx1 + dy1*dy1;
4665 dx2 =
x[kp-1] -
x[k-1];
4666 dy2 =
y[kp-1] -
y[k-1];
4667 dk2 = dx2*dx2 + dy2*dy2;
4668 ctu = dx1*dk2 + dx2*dk1;
4669 stu = dy1*dk2 + dy2*dk1;
4670 xnt = ctu*ctu + stu*stu;
4684 if (flgis)
goto L160;
4688 w3 = 2*(dx1*dy2-dx2*dy1);
4700 w3 = 2*(dx1*dy2-dx2*dy1);
4709 if (k <= 1)
goto L120;
4739 xa = (
a*t-2*dx)/tcube;
4740 xb = (3*dx-(co+
a)*t)/tsquare;
4741 ya = (
b*t-2*dy)/tcube;
4742 yb = (3*dy-(so+
b)*t)/tsquare;
4773 p2 = (u1*tj-u3)*3*tj+u2;
4803 z =
s*sth*(
s-
s*sth)*(w1*sth+w1+w2);
4804 z = z*z/((
a*
a+
b*
b)*(delta*delta));
4805 z = (z+2.642937)*z/((.3715652*z+3.063444)*z+.2441889)-cc;
4809 if (iw > 0)
goto L250;
4810 if (z > err)
goto L240;
4815 if (iw+2 == 0)
goto L190;
4816 if (iw+2 > 0)
goto L290;
4834 theGraph->
Zero(kp,0,sb,err,
s,z,maxiterations);
4835 if (kp == 2)
goto L210;
4837 Error(
"Smooth",
"Attempt to plot outside plot limits");
4840 if (iw > 0)
goto L200;
4866 qlx[npt] = sxmin + xt/xratio;
4867 qly[npt] = symin + yt/yratio;
4874 if (npt < banksize)
goto L320;
4875 if (drawtype >= 1000 || ktype > 1) {
4876 Int_t newsize = banksize + n2;
4878 for (i=0;i<banksize;i++) qtemp[i] = qlx[i];
4881 for (i=0;i<banksize;i++) qlx[i] = qtemp[i];
4882 for (i=0;i<banksize;i++) qtemp[i] = qly[i];
4885 for (i=0;i<banksize;i++) qly[i] = qtemp[i];
4894 if (drawtype >= 1000) {
4895 gPad->PaintFillArea(npt,qlx,qly,
"B");
4899 qlx[npt] = qlx[npt-1];
4900 qlx[npt+1] = qlx[0];
4906 qly[npt] = qly[npt-1];
4907 qly[npt+1] = qly[0];
4909 gPad->PaintFillArea(npt+2,qlx,qly);
4912 gPad->PaintPolyLine(npt,qlx,qly);
4915 qlx[0] = sxmin + xt/xratio;
4916 qly[0] = symin + yt/yratio;
4918 if (finished > 0)
goto L390;
4919 if (finished < 0) { finished = 0;
goto L110;}
4920 if (
s > 0)
goto L180;
4926 for (i=0;i<npoints;i++) {
4927 x[i] = sxmin +
x[i]/xratio;
4928 y[i] = symin +
y[i]/yratio;
static const double x2[5]
static const double x1[5]
static const double x3[11]
static TMarker * gHighlightMarker
static Int_t gHighlightPoint
static TGraph * gHighlightGraph
char * Form(const char *fmt,...)
R__EXTERN TStyle * gStyle
Draw all kinds of Arrows.
virtual Color_t GetLabelColor() const
virtual Color_t GetAxisColor() const
virtual Float_t GetLabelOffset() const
virtual void SetAxisColor(Color_t color=1, Float_t alpha=1.)
Set color of the line axis and tick marks.
virtual Style_t GetLabelFont() const
virtual void SetLabelOffset(Float_t offset=0.005)
Set distance between the axis and the labels.
virtual Float_t GetLabelSize() const
virtual Float_t GetTickLength() const
virtual void SetTickLength(Float_t length=0.03)
Set tick mark length.
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 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 SetLineColor(Color_t lcolor)
Set the line color.
virtual Style_t GetLineStyle() const
Return the line style.
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 SetMarkerSize(Size_t msize=1)
Set the marker size.
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
virtual void SetTextFont(Font_t tfont=62)
Set the text font.
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
virtual void SetLimits(Double_t xmin, Double_t xmax)
virtual Int_t GetNDF() const
Return the number of degrees of freedom in the fit the fNDF parameter has been previously computed du...
virtual Double_t GetParError(Int_t ipar) const
Return value of parameter number ipar.
Double_t GetChisquare() const
virtual Int_t GetNpar() const
virtual const char * GetParName(Int_t ipar) const
virtual Double_t GetParameter(Int_t ipar) const
virtual void PaintAxis(Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax, Double_t &wmin, Double_t &wmax, Int_t &ndiv, Option_t *chopt="", Double_t gridlength=0, Bool_t drawGridOnly=kFALSE)
Control function to draw an axis.
void SetLabelOffset(Float_t labeloffset)
void SetTickSize(Float_t ticksize)
void SetLabelSize(Float_t labelsize)
TGraph with asymmetric error bars and multiple y error dimensions.
void PaintGraphPolar(TGraph *theGraph, Option_t *option)
[Paint this TGraphPolar with its current attributes.]($GP04)
virtual char * GetObjectInfoHelper(TGraph *theGraph, Int_t px, Int_t py) const
virtual ~TGraphPainter()
Destructor.
void PaintGraphErrors(TGraph *theGraph, Option_t *option)
[Paint this TGraphErrors with its current attributes.]($GP03)
void PaintGraphAsymmErrors(TGraph *theGraph, Option_t *option)
Paint this TGraphAsymmErrors with its current attributes.
void PaintGraphMultiErrors(TGraph *theGraph, Option_t *option)
[Paint this TGraphMultiErrors with its current attributes.]($GP03)
virtual void PaintHighlightPoint(TGraph *theGraph, Option_t *option)
Paint highlight point as TMarker object (open circle)
void PaintGraphReverse(TGraph *theGraph, Option_t *option)
Paint theGraph reverting values along X and/or Y axis. a new graph is created.
virtual void PaintGrapHist(TGraph *theGraph, Int_t npoints, const Double_t *x, const Double_t *y, Option_t *chopt)
This is a service method used by THistPainter to paint 1D histograms.
virtual void SetHighlight(TGraph *theGraph)
Set highlight (enable/disable) mode for theGraph.
void PaintStats(TGraph *theGraph, TF1 *fit)
Paint the statistics box with the fit info.
void PaintHelper(TGraph *theGraph, Option_t *option)
Paint a any kind of TGraph.
static Int_t fgMaxPointsPerLine
virtual void PaintGraph(TGraph *theGraph, Int_t npoints, const Double_t *x, const Double_t *y, Option_t *chopt)
[Control function to draw a graph.]($GP01)
void PaintPolyLineHatches(TGraph *theGraph, Int_t n, const Double_t *x, const Double_t *y)
Paint a polyline with hatches on one side showing an exclusion zone.
virtual void DrawPanelHelper(TGraph *theGraph)
Display a panel with all histogram drawing options.
virtual void HighlightPoint(TGraph *theGraph, Int_t hpoint, Int_t distance)
Check on highlight point.
virtual Int_t DistancetoPrimitiveHelper(TGraph *theGraph, Int_t px, Int_t py)
Compute distance from point px,py to a graph.
void ComputeLogs(Int_t npoints, Int_t opt)
Compute the logarithm of global variables gxwork and gywork according to the value of Options and put...
virtual void ExecuteEventHelper(TGraph *theGraph, Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
void Smooth(TGraph *theGraph, Int_t npoints, Double_t *x, Double_t *y, Int_t drawtype)
Smooth a curve given by N points.
virtual Int_t GetHighlightPoint(TGraph *theGraph) const
Return the highlighted point for theGraph.
void PaintGraphSimple(TGraph *theGraph, Option_t *option)
Paint a simple graph, without errors bars.
void PaintGraphQQ(TGraph *theGraph, Option_t *option)
Paint this graphQQ. No options for the time being.
static void SetMaxPointsPerLine(Int_t maxp=50)
Static function to set fgMaxPointsPerLine for graph painting.
void PaintGraphBentErrors(TGraph *theGraph, Option_t *option)
[Paint this TGraphBentErrors with its current attributes.]($GP03)
TGraphPainter()
Default constructor.
Double_t * GetYpol()
Return points in polar coordinates.
TGraphPolargram * GetPolargram()
void SetPolargram(TGraphPolargram *p)
void SetOptionAxis(Bool_t opt)
Double_t * GetXpol()
Return points in polar coordinates.
void PaintCircle(Double_t x, Double_t y, Double_t r, Double_t phimin, Double_t phimax, Double_t theta)
This is simplified from TEllipse::PaintEllipse.
void Draw(Option_t *options="")
Draw Polargram.
This class allows to draw quantile-quantile plots.
A Graph is a graphics object made of two arrays X and Y with npoints each.
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
virtual Double_t * GetEXhighd() const
virtual Bool_t IsEditable() const
@ kClipFrame
clip to the frame boundary
Double_t GetMinimum() const
virtual Double_t * GetEYlow() const
virtual Double_t * GetEX() const
Double_t GetMaximum() const
virtual Double_t * GetEXlowd() const
virtual void ComputeRange(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax) const
Compute the x/y range of the points in this graph.
virtual Double_t * GetEYlowd() const
void Zero(Int_t &k, Double_t AZ, Double_t BZ, Double_t E2, Double_t &X, Double_t &Y, Int_t maxiterations)
Find zero of a continuous function.
TList * GetListOfFunctions() const
virtual Bool_t IsHighlight() const
virtual Double_t * GetEYhighd() const
TAxis * GetXaxis() const
Get x axis of the graph.
virtual Double_t * GetEXhigh() const
virtual Double_t * GetEYhigh() const
TAxis * GetYaxis() const
Get y axis of the graph.
TH1F * GetHistogram() const
Returns a pointer to the histogram used to draw the axis Takes into account the two following cases.
virtual Double_t * GetEY() const
virtual void SetHistogram(TH1F *h)
virtual Double_t * GetEXlow() const
virtual Int_t GetPoint(Int_t i, Double_t &x, Double_t &y) const
Get x and y values for point number i.
1-D histogram with a float per channel (see TH1 documentation)}
virtual void SetDirectory(TDirectory *dir)
By default when an histogram is created, it is added to the list of histogram objects in the current ...
virtual Double_t GetMinimumStored() const
@ kNoTitle
don't draw the histogram title
@ kNoStats
don't draw stats box
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
virtual Double_t GetMaximum(Double_t maxval=FLT_MAX) const
Return maximum value smaller than maxval of bins in the range, unless the value has been overridden b...
virtual void SetMaximum(Double_t maximum=-1111)
virtual Int_t GetNdivisions(Option_t *axis="X") const
Return the number of divisions for "axis".
virtual void SetMinimum(Double_t minimum=-1111)
virtual Double_t GetMaximumStored() const
virtual void Paint(Option_t *option="")
Control routine to paint any kind of histograms.
virtual Double_t GetMinimum(Double_t minval=-FLT_MAX) const
Return minimum value larger than minval of bins in the range, unless the value has been overridden by...
virtual void Sumw2(Bool_t flag=kTRUE)
Create structure to store sum of squares of weights.
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to a line.
To draw Mathematical Formula.
virtual void PaintLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Draw this line with new coordinates.
TObject * Next()
Return next object in the list. Returns 0 when no more objects in list.
virtual void Add(TObject *obj)
virtual TObjLink * FirstLink() const
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
virtual void SetX(Double_t x)
virtual void Paint(Option_t *option="")
Paint this marker with its current attributes.
virtual void SetY(Double_t y)
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
virtual const char * GetTitle() const
Returns title of object.
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
virtual const char * GetName() const
Returns name of object.
TObject * GetObject() const
Option_t * GetOption() const
Mother of all ROOT objects.
virtual const char * GetName() const
Returns name of object.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual Option_t * GetDrawOption() const
Get option used by the graphics system to draw this object.
virtual void Delete(Option_t *option="")
Delete this object.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual const char * GetTitle() const
Returns title of object.
virtual void Paint(Option_t *option="")
This method must be overridden if a class wants to paint itself.
@ kCannotPick
if object in a pad cannot be picked
@ kCanDelete
if object in a list can be deleted
@ kMustCleanup
if object destructor must call RecursiveRemove()
The histogram statistics painter class.
virtual void SetStatFormat(const char *format="6.4g")
Change (i.e. set) the format for printing statistics.
void SetOptStat(Int_t stat=1)
Set the stat option.
virtual void SetParent(TObject *obj)
virtual const char * GetFitFormat() const
virtual void SetFitFormat(const char *format="5.4g")
Change (i.e. set) the format for printing fit parameters in statistics box.
Int_t GetOptFit() const
Return the fit option.
virtual void Paint(Option_t *option="")
Paint the pave stat.
void SetOptFit(Int_t fit=1)
Set the fit option.
A Pave (see TPave) with text, lines or/and boxes inside.
virtual TText * AddText(Double_t x1, Double_t y1, const char *label)
Add a new Text line to this pavetext at given coordinates.
virtual void Draw(Option_t *option="")
Draw this pavetext with its current attributes.
virtual void Paint(Option_t *option="")
Paint this pavetext with its current attributes.
virtual TText * GetLine(Int_t number) const
Get Pointer to line number in this pavetext.
virtual void Clear(Option_t *option="")
Clear all lines in this pavetext.
virtual void SetName(const char *name="")
Option_t * GetName() const
Returns name of object.
virtual void SetBorderSize(Int_t bordersize=4)
Double_t GetX1NDC() const
virtual void SetX2NDC(Double_t x2)
Regular expression class.
TString Copy() const
Copy a string.
void ToLower()
Change string to lower-case.
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
Ssiz_t First(char c) const
Find first occurrence of a character c.
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
void ToUpper()
Change string to upper case.
Int_t CountChar(Int_t c) const
Return number of times character c occurs in the string.
TString & Append(const char *cs)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Color_t GetLabelColor(Option_t *axis="X") const
Return the label color number in the axis.
Color_t GetStatTextColor() const
Float_t GetTitleX() const
Int_t GetOptTitle() const
Int_t GetNdivisions(Option_t *axis="X") const
Return number of divisions.
Float_t GetStatFontSize() const
Float_t GetBarOffset() const
Float_t GetLabelSize(Option_t *axis="X") const
Return label size.
Float_t GetTickLength(Option_t *axis="X") const
Return tick length.
Style_t GetLabelFont(Option_t *axis="X") const
Return label font.
Float_t GetTitleY() const
Style_t GetTitleFont(Option_t *axis="X") const
Return title font.
Color_t GetTitleFillColor() const
Style_t GetTitleStyle() const
Float_t GetLabelOffset(Option_t *axis="X") const
Return label offset.
Color_t GetStatColor() const
Float_t GetBarWidth() const
void SetDrawBorder(Int_t drawborder=1)
Width_t GetTitleBorderSize() const
Float_t GetEndErrorSize() const
Int_t GetDrawBorder() const
Width_t GetStatBorderSize() const
Color_t GetTitleTextColor() const
Float_t GetTitleH() const
Style_t GetStatStyle() const
const char * GetFitFormat() const
const char * GetStatFormat() const
Style_t GetStatFont() const
Float_t GetTitleFontSize() const
Color_t GetAxisColor(Option_t *axis="X") const
Return the axis color number in the axis.
Float_t GetTitleW() const
Base class for several text objects.
Abstract base class used by ROOT graphics editor.
static TVirtualPadEditor * GetPadEditor(Bool_t load=kTRUE)
Returns the pad editor dialog. Static method.
TVirtualPad is an abstract base class for the Pad and Canvas classes.
virtual TVirtualPad * cd(Int_t subpadnumber=0)=0
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
double dist(Rotation3D const &r1, Rotation3D const &r2)
static constexpr double rad
static constexpr double s
static constexpr double km
Short_t Max(Short_t a, Short_t b)
Double_t Prob(Double_t chi2, Int_t ndf)
Computation of the probability for a certain Chi-squared (chi2) and number of degrees of freedom (ndf...
Bool_t IsInside(T xp, T yp, Int_t np, T *x, T *y)
Function which returns kTRUE if point xp,yp lies inside the polygon defined by the np points in array...
constexpr Double_t PiOver2()
Double_t Sqrt(Double_t x)
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Short_t Min(Short_t a, Short_t b)
Double_t Log10(Double_t x)