668 if (
gPad->GetLogx()) {
669 for (i=0;i<npoints;i++) {
674 if (!opt &&
gPad->GetLogy()) {
675 for (i=0;i<npoints;i++) {
696 if (distance <= 5)
return distance;
700 const Int_t big = 9999;
701 const Int_t kMaxDiff = 10;
708 if (px <= puxmin)
return big;
709 if (py >= puymin)
return big;
710 if (px >= puxmax)
return big;
711 if (py <= puymax)
return big;
721 theX = theGraphPolar->
GetXpol();
722 theY = theGraphPolar->
GetYpol();
724 theX = theGraph->
GetX();
725 theY = theGraph->
GetY();
729 for (i=0;i<theNpoints;i++) {
730 pxp =
gPad->XtoAbsPixel(
gPad->XtoPad(theX[i]));
731 pyp =
gPad->YtoAbsPixel(
gPad->YtoPad(theY[i]));
741 if (distance < kMaxDiff)
return distance;
743 for (i=0;i<theNpoints-1;i++) {
745 d =
l.DistancetoLine(px, py,
gPad->XtoPad(theX[i]),
gPad->YtoPad(theY[i]),
gPad->XtoPad(theX[i+1]),
gPad->YtoPad(theY[i+1]));
746 if (
d < distance) distance =
d;
761 TIter next(functions);
765 else dist =
f->DistancetoPrimitive(px,py);
766 if (
dist < kMaxDiff) {
767 gPad->SetSelected(
f);
783 Error(
"DrawPanel",
"need to draw graph first");
788 gROOT->ProcessLine(
Form(
"((TCanvas*)0x%lx)->Selected((TVirtualPad*)0x%lx,(TObject*)0x%lx,1)",
811 const Int_t kMaxDiff = 10;
812 static Bool_t middle, badcase;
813 static Int_t ipoint, pxp, pyp;
814 static Int_t px1,px2,py1,py2;
815 static Int_t pxold, pyold, px1old, py1old, px2old, py2old;
816 static Int_t dpx, dpy;
824 if (!
gPad->IsEditable())
return;
834 theGraph->TAttLine::Modify();
835 px1 =
gPad->XtoAbsPixel(
gPad->GetX1());
836 py1 =
gPad->YtoAbsPixel(
gPad->GetY1());
837 px2 =
gPad->XtoAbsPixel(
gPad->GetX2());
838 py2 =
gPad->YtoAbsPixel(
gPad->GetY2());
843 x =
new Int_t[theNpoints+1];
844 y =
new Int_t[theNpoints+1];
845 for (i=0;i<theNpoints;i++) {
846 pxp =
gPad->XtoAbsPixel(
gPad->XtoPad(theX[i]));
847 pyp =
gPad->YtoAbsPixel(
gPad->YtoPad(theY[i]));
848 if (pxp < -kMaxPixel || pxp >=
kMaxPixel ||
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);
857 gVirtualX->DrawLine(pxp-4, pyp+4, pxp-4, pyp-4);
862 if (
d < kMaxDiff) ipoint =i;
868 if (ipoint < 0)
return;
872 px2old =
gPad->XtoAbsPixel(theX[1]);
873 py2old =
gPad->YtoAbsPixel(theY[1]);
874 }
else if (ipoint == theNpoints-1) {
875 px1old =
gPad->XtoAbsPixel(
gPad->XtoPad(theX[theNpoints-2]));
876 py1old =
gPad->YtoAbsPixel(
gPad->YtoPad(theY[theNpoints-2]));
880 px1old =
gPad->XtoAbsPixel(
gPad->XtoPad(theX[ipoint-1]));
881 py1old =
gPad->YtoAbsPixel(
gPad->YtoPad(theY[ipoint-1]));
882 px2old =
gPad->XtoAbsPixel(
gPad->XtoPad(theX[ipoint+1]));
883 py2old =
gPad->YtoAbsPixel(
gPad->YtoPad(theY[ipoint+1]));
885 pxold =
gPad->XtoAbsPixel(
gPad->XtoPad(theX[ipoint]));
886 pyold =
gPad->YtoAbsPixel(
gPad->YtoPad(theY[ipoint]));
894 for (i=0;i<theNpoints;i++) {
895 pxp =
gPad->XtoAbsPixel(
gPad->XtoPad(theX[i]));
896 pyp =
gPad->YtoAbsPixel(
gPad->YtoPad(theY[i]));
898 if (
d < kMaxDiff) middle =
kFALSE;
910 for(i=0;i<theNpoints-1;i++) {
911 gVirtualX->DrawLine(
x[i]+dpx,
y[i]+dpy,
x[i+1]+dpx,
y[i+1]+dpy);
914 if (pxp < -kMaxPixel || pxp >=
kMaxPixel ||
915 pyp < -kMaxPixel || pyp >=
kMaxPixel)
continue;
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);
919 gVirtualX->DrawLine(pxp-4, pyp+4, pxp-4, pyp-4);
921 pxp =
x[theNpoints-1]+dpx;
922 pyp =
y[theNpoints-1]+dpy;
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);
926 gVirtualX->DrawLine(pxp-4, pyp+4, pxp-4, pyp-4);
931 for(i=0;i<theNpoints-1;i++) {
932 gVirtualX->DrawLine(
x[i]+dpx,
y[i]+dpy,
x[i+1]+dpx,
y[i+1]+dpy);
935 if (pxp < -kMaxPixel || pxp >=
kMaxPixel ||
936 pyp < -kMaxPixel || pyp >=
kMaxPixel)
continue;
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);
940 gVirtualX->DrawLine(pxp-4, pyp+4, pxp-4, pyp-4);
942 pxp =
x[theNpoints-1]+dpx;
943 pyp =
y[theNpoints-1]+dpy;
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);
947 gVirtualX->DrawLine(pxp-4, pyp+4, pxp-4, pyp-4);
949 if (px1old)
gVirtualX->DrawLine(px1old, py1old, pxold, pyold);
950 if (px2old)
gVirtualX->DrawLine(pxold, pyold, px2old, py2old);
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);
954 gVirtualX->DrawLine(pxold-4, pyold+4, pxold-4, pyold-4);
961 if (px1old)
gVirtualX->DrawLine(px1old, py1old, pxold, pyold);
962 if (px2old)
gVirtualX->DrawLine(pxold, pyold, px2old, py2old);
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);
966 gVirtualX->DrawLine(pxold-4, pyold+4, pxold-4, pyold-4);
975 dxr = dx/(1 -
gPad->GetLeftMargin() -
gPad->GetRightMargin());
976 dyr = dy/(1 -
gPad->GetBottomMargin() -
gPad->GetTopMargin());
992 for(i=0;i<theNpoints;i++) {
993 if (badcase)
continue;
994 if (
x) theX[i] =
gPad->PadtoX(
gPad->AbsPixeltoX(
x[i]+dpx));
995 if (
y) theY[i] =
gPad->PadtoY(
gPad->AbsPixeltoY(
y[i]+dpy));
1004 theX[ipoint] =
gPad->PadtoX(
gPad->AbsPixeltoX(pxold));
1005 theY[ipoint] =
gPad->PadtoY(
gPad->AbsPixeltoY(pyold));
1009 theX[theNpoints-1] = theX[0];
1010 theY[theNpoints-1] = theY[0];
1012 if (ipoint == theNpoints-1) {
1013 theX[0] = theX[theNpoints-1];
1014 theY[0] = theY[theNpoints-1];
1026 if (
gROOT->IsEscaped()) {
1040 dxr = dx/(1 -
gPad->GetLeftMargin() -
gPad->GetRightMargin());
1041 dyr = dy/(1 -
gPad->GetBottomMargin() -
gPad->GetTopMargin());
1047 ymin - dyr*
gPad->GetBottomMargin(),
1053 for(i=0;i<theNpoints;i++) {
1054 if (badcase)
continue;
1055 if (
x) theX[i] =
gPad->PadtoX(
gPad->AbsPixeltoX(
x[i]+dpx));
1056 if (
y) theY[i] =
gPad->PadtoY(
gPad->AbsPixeltoY(
y[i]+dpy));
1059 theX[ipoint] =
gPad->PadtoX(
gPad->AbsPixeltoX(pxold));
1060 theY[ipoint] =
gPad->PadtoY(
gPad->AbsPixeltoY(pyold));
1064 theX[theNpoints-1] = theX[0];
1065 theY[theNpoints-1] = theY[0];
1067 if (ipoint == theNpoints-1) {
1068 theX[0] = theX[theNpoints-1];
1069 theY[0] = theY[theNpoints-1];
1123 const Int_t kHighlightRange = 50;
1124 static Int_t distanceOld = kHighlightRange;
1127 if ((distance < kHighlightRange) && (distance < distanceOld)) {
1165 if (
gPad->GetLogx()) {
1169 if (
gPad->GetLogy()) {
1173 if ((hx < uxmin) || (hx > uxmax))
return;
1174 if ((hy < uymin) || (hy > uymax))
return;
1198 strlcpy(chopt,option,80);
1201 char *l1 = strstr(chopt,
"pfc");
1202 char *l2 = strstr(chopt,
"plc");
1203 char *l3 = strstr(chopt,
"pmc");
1204 if (l1 || l2 || l3) {
1213 char *l4 = strstr(chopt,
"rx");
1214 char *l5 = strstr(chopt,
"ry");
1248 TIter next(functions);
1269 gPad->PushSelectableObject(theGraph);
1271 Int_t optionLine , optionAxis , optionCurve , optionStar , optionMark;
1272 Int_t optionBar , optionR , optionOne , optionE;
1273 Int_t optionFill , optionZ , optionCurveFill, optionIAxis;
1274 Int_t i, npt, nloop;
1277 Double_t barxmin, barxmax, barymin, barymax;
1284 Error(
"PaintGraph",
"illegal number of points (%d)", npoints);
1291 if (opt.
Contains(
"L")) optionLine = 1;
else optionLine = 0;
1292 if (opt.
Contains(
"A")) optionAxis = 1;
else optionAxis = 0;
1293 if (opt.
Contains(
"C")) optionCurve = 1;
else optionCurve = 0;
1294 if (opt.
Contains(
"*")) optionStar = 1;
else optionStar = 0;
1295 if (opt.
Contains(
"P")) optionMark = 1;
else optionMark = 0;
1296 if (opt.
Contains(
"B")) optionBar = 1;
else optionBar = 0;
1297 if (opt.
Contains(
"R")) optionR = 1;
else optionR = 0;
1298 if (opt.
Contains(
"1")) optionOne = 1;
else optionOne = 0;
1299 if (opt.
Contains(
"F")) optionFill = 1;
else optionFill = 0;
1300 if (opt.
Contains(
"I")) optionIAxis = 1;
else optionIAxis = 0;
1306 if (optionLine+optionFill+optionCurve+optionStar+optionMark+optionBar+optionE == 0) {
1307 if (!chopt[0]) optionLine=1;
1313 optionCurveFill = 0;
1314 if (optionCurve && optionFill) {
1315 optionCurveFill = 1;
1320 Double_t rwxmin,rwxmax, rwymin, rwymax, maximum, minimum, dx, dy;
1323 rwxmin =
gPad->GetUxmin();
1324 rwxmax =
gPad->GetUxmax();
1325 rwymin =
gPad->GetUymin();
1326 rwymax =
gPad->GetUymax();
1329 if (minimum == -1111) {
1333 if (maximum == -1111) {
1337 uxmin =
gPad->PadtoX(rwxmin);
1338 uxmax =
gPad->PadtoX(rwxmax);
1341 theGraph->
ComputeRange(rwxmin, rwymin, rwxmax, rwymax);
1343 if (rwxmin == rwxmax) rwxmax += 1.;
1344 if (rwymin == rwymax) rwymax += 1.;
1345 dx = 0.1*(rwxmax-rwxmin);
1346 dy = 0.1*(rwymax-rwymin);
1347 uxmin = rwxmin - dx;
1348 uxmax = rwxmax + dx;
1349 minimum = rwymin - dy;
1350 maximum = rwymax + dy;
1354 if (uxmin < 0 && rwxmin >= 0) uxmin = 0.9*rwxmin;
1355 if (uxmax > 0 && rwxmax <= 0) {
1356 if (
gPad->GetLogx()) uxmax = 1.1*rwxmax;
1359 if (minimum < 0 && rwymin >= 0) minimum = 0.9*rwymin;
1360 if (maximum > 0 && rwymax <= 0) {
1364 if (minimum <= 0 && gPad->GetLogy()) minimum = 0.001*maximum;
1365 if (uxmin <= 0 && gPad->GetLogx()) {
1366 if (uxmax > 1000) uxmin = 1;
1367 else uxmin = 0.001*uxmax;
1374 char chopth[8] =
" ";
1375 if (strstr(chopt,
"x+")) strncat(chopth,
"x+",3);
1376 if (strstr(chopt,
"y+")) strncat(chopth,
"y+",3);
1377 if (optionIAxis) strncat(chopth,
"A",2);
1384 if (theNpoints > npt) npt = theNpoints;
1396 if (
gPad->GetLogy()) {
1409 rwxmin =
gPad->GetUxmin();
1410 rwxmax =
gPad->GetUxmax();
1411 rwymin =
gPad->GetUymin();
1412 rwymax =
gPad->GetUymax();
1413 uxmin =
gPad->PadtoX(rwxmin);
1414 uxmax =
gPad->PadtoX(rwxmax);
1419 maximum =
gPad->PadtoY(rwymax);
1420 minimum =
gPad->PadtoY(rwymin);
1424 theGraph->TAttLine::Modify();
1425 theGraph->TAttFill::Modify();
1426 theGraph->TAttMarker::Modify();
1434 if (optionLine || optionFill) {
1440 if (optionFill && (xn !=
x1 || yn != y1)) nloop++;
1442 for (i=1;i<=nloop;i++) {
1485 if (optionCurveFill) {
1487 if (xn !=
x1 || yn != y1) nloop++;
1491 for (i=1;i<=nloop;i++) {
1516 for (i=1;i<=nloop;i++) {
1520 if (
y[i-1] < minimum ||
y[i-1] > maximum)
continue;
1521 if (
x[i-1] < uxmin ||
x[i-1] > uxmax)
continue;
1547 for (i=1;i<=npoints;i++) {
1562 for (i=1;i<=npoints;i++) {
1579 for (i=1;i<npoints;i++) {
1580 if (
x[i] < barxmin) barxmin =
x[i];
1581 if (
x[i] > barxmax) barxmax =
x[i];
1583 bdelta = (barxmax-barxmin)/
Double_t(npoints);
1587 for (i=1;i<npoints;i++) {
1588 if (
y[i] < barymin) barymin =
y[i];
1589 if (
y[i] > barymax) barymax =
y[i];
1591 bdelta = (barymax-barymin)/
Double_t(npoints);
1595 for (i=1;i<=npoints;i++) {
1596 xlow =
x[i-1] - dbar;
1597 xhigh =
x[i-1] + dbar;
1599 if (xlow < uxmin && xhigh < uxmin)
continue;
1600 if (xhigh > uxmax && xlow > uxmax)
continue;
1601 if (xlow < uxmin) xlow = uxmin;
1602 if (xhigh > uxmax) xhigh = uxmax;
1604 else ylow =
gPad->GetUymin();
1618 for (i=1;i<=npoints;i++) {
1620 ylow =
y[i-1] - dbar;
1621 yhigh =
y[i-1] + dbar;
1674 const char *where =
"PaintGrapHist";
1676 Int_t optionLine , optionAxis , optionCurve, optionStar, optionMark;
1677 Int_t optionBar , optionRot , optionOne , optionOff ;
1678 Int_t optionFill , optionZ;
1679 Int_t optionHist , optionBins , optionMarker;
1681 Int_t drawtype=0, drawborder, drawbordersav;
1687 Double_t xi, xi1, xj, xj1, yi1, yi, yj, yj1, xwmin, ywmin;
1691 char choptaxis[10] =
" ";
1694 Error(where,
"illegal number of points (%d)", npoints);
1699 if (opt.
Contains(
"H")) optionHist = 1;
else optionHist = 0;
1700 if (opt.
Contains(
"F")) optionFill = 1;
else optionFill = 0;
1701 if (opt.
Contains(
"C")) optionCurve= 1;
else optionCurve= 0;
1702 if (opt.
Contains(
"*")) optionStar = 1;
else optionStar = 0;
1703 if (opt.
Contains(
"R")) optionRot = 1;
else optionRot = 0;
1704 if (opt.
Contains(
"1")) optionOne = 1;
else optionOne = 0;
1705 if (opt.
Contains(
"B")) optionBar = 1;
else optionBar = 0;
1706 if (opt.
Contains(
"N")) optionBins = 1;
else optionBins = 0;
1707 if (opt.
Contains(
"L")) optionLine = 1;
else optionLine = 0;
1708 if (opt.
Contains(
"P")) optionMark = 1;
else optionMark = 0;
1709 if (opt.
Contains(
"A")) optionAxis = 1;
else optionAxis = 0;
1710 if (opt.
Contains(
"][")) optionOff = 1;
else optionOff = 0;
1711 if (opt.
Contains(
"P0")) optionMark = 10;
1713 Int_t optionFill2 = 0;
1715 optionFill = 0; optionFill2 = 1;
1730 nbins = last -
first + 1;
1742 Double_t rounding = (uxmax-uxmin)*1.e-5;
1745 Int_t nx1, nx2, ndivx, ndivy, ndiv;
1758 if (ndivx < 0) strlcat(choptaxis,
"N",10);
1759 if (
gPad->GetGridx()) {
1761 strlcat(choptaxis,
"W",10);
1763 if (
gPad->GetLogx()) {
1767 strlcat(choptaxis,
"G",10);
1777 axis->
PaintAxis(rwxmin,rwymin,rwxmax,rwymin,rwmin,rwmax,ndiv,choptaxis);
1787 strlcat(choptaxis,
"N",10);
1790 if (
gPad->GetGridy()) {
1792 strlcat(choptaxis,
"W",10);
1794 if (
gPad->GetLogy()) {
1798 strlcat(choptaxis,
"G",10);
1807 axis->
PaintAxis(rwxmin,rwymin,rwxmin,rwymax,rwmin,rwmax,ndiv,choptaxis);
1813 theGraph->TAttLine::Modify();
1814 theGraph->TAttFill::Modify();
1815 theGraph->TAttMarker::Modify();
1819 if (!optionRot) {wmin =
x[0]; wmax =
x[1];}
1820 else {wmin =
y[0]; wmax =
y[1];}
1822 if (!optionBins) delta = (wmax - wmin)/
Double_t(nbins);
1824 Int_t fwidth =
gPad->GetFrameLineWidth();
1827 if (optionOff) fwidth = 1;
1843 if (optionFill && !optionCurve) {
1851 for (j=
first; j<=last;j++) {
1858 xj1 =
x[j]; xj =
x[j-1];
1860 if (j != last)
Error(where,
"X must be in increasing order");
1861 else Error(where,
"X must have N+1 values with option N");
1869 if ((
gxwork[npt-1] >= uxmin-rounding &&
gxwork[npt-1] <= uxmax+rounding) ||
1870 (
gxwork[npt] >= uxmin-rounding &&
gxwork[npt] <= uxmax+rounding)) npt += 2;
1883 if (!fillarea)
gyworkl[0] = ylast;
1894 for (j=
first; j<=last;j++) {
1899 yj1 =
y[j]; yj =
y[j-1];
1901 if (j != last)
Error(where,
"Y must be in increasing order");
1902 else Error(where,
"Y must have N+1 values with option N");
1908 if ((
gxwork[npt-1] >= uxmin-rounding &&
gxwork[npt-1] <= uxmax+rounding) ||
1909 (
gxwork[npt] >= uxmin-rounding &&
gxwork[npt] <= uxmax+rounding)) npt += 2;
1916 if (!fillarea)
gyworkl[0] = ylast;
1923 theGraph->TAttLine::Modify();
1924 theGraph->TAttFill::Modify();
1929 if ((optionHist) || !chopt[0]) {
1935 for (i=
first; i<=last;i++) {
1940 xi1 =
x[i]; xi =
x[i-1];
1942 if (i != last)
Error(where,
"X must be in increasing order");
1943 else Error(where,
"X must have N+1 values with option N");
1951 if ((
gxwork[npt-1] >= uxmin-rounding &&
gxwork[npt-1] <= uxmax+rounding) ||
1952 (
gxwork[npt] >= uxmin-rounding &&
gxwork[npt] <= uxmax+rounding)) npt += 2;
1964 Int_t nbpoints = npt-2;
1970 for (ip=point1; ip<=nbpoints; ip++) {
1977 Int_t point2 = nbpoints;
1978 for (ip=point2; ip>=point1; ip--) {
1984 nbpoints = point2-point1+1;
1988 if (
gxwork[0] >
gPad->GetUxmin()) { nbpoints++; point1 = 0; }
1989 if (
gxwork[nbpoints] <
gPad->GetUxmax()) nbpoints++;
2001 for (i=
first; i<=last;i++) {
2006 yi1 =
y[i]; yi =
y[i-1];
2008 if (i != last)
Error(where,
"Y must be in increasing order");
2009 else Error(where,
"Y must have N+1 values with option N");
2015 if ((
gxwork[npt-1] >= uxmin-rounding &&
gxwork[npt-1] <= uxmax+rounding) ||
2016 (
gxwork[npt] >= uxmin-rounding &&
gxwork[npt] <= uxmax+rounding)) npt += 2;
2035 if (!optionOne) drawtype = 2;
2040 for (i=
first; i<=last;i++) {
2045 xi1 =
x[i]; xi =
x[i-1];
2047 if (i != last)
Error(where,
"X must be in increasing order");
2048 else Error(where,
"X must have N+1 values with option N");
2051 gxwork[npt-1] =
x[i-1] + 0.5*(
x[i]-
x[i-1]);
2082 drawtype = drawtype+10;
2084 for (i=
first; i<=last;i++) {
2089 yi1 =
y[i]; yi =
y[i-1];
2091 if (i != last)
Error(where,
"Y must be in increasing order");
2092 else Error(where,
"Y must have N+1 values with option N");
2095 gywork[npt-1] =
y[i-1] + 0.5*(
y[i]-
y[i-1]);
2128 wminstep = wmin + 0.5*delta;
2130 gPad->GetRangeAxis(ax1,ay1,ax2,ay2);
2134 for (i=
first; i<=last;i++) {
2139 xi1 =
x[i]; xi =
x[i-1];
2141 if (i != last)
Error(where,
"X must be in increasing order");
2142 else Error(where,
"X must have N+1 values with option N");
2145 gxwork[npt-1] =
x[i-1] + 0.5*(
x[i]-
x[i-1]);
2147 if (
gxwork[npt-1] < uxmin ||
gxwork[npt-1] > uxmax) { npt--;
continue;}
2150 if ((
gywork[npt-1] < rwymin) || ((
gywork[npt-1] > rwymax) && !optionFill2)) {
2187 for (i=
first; i<=last;i++) {
2190 gywork[npt-1] = wminstep+(i-
first)*delta+0.5*delta;
2192 yi1 =
y[i]; yi =
y[i-1];
2194 if (i != last)
Error(where,
"Y must be in increasing order");
2195 else Error(where,
"Y must have N+1 values with option N");
2198 gywork[npt-1] =
y[i-1] + 0.5*(
y[i]-
y[i-1]);
2201 if ((
gxwork[npt-1] < uxmin) || (
gxwork[npt-1] > uxmax)) {
2223 if (optionLine != 0 && npt > 1) {
2234 offset = delta*baroffset; dbar = delta*barwidth;
2237 offset = (
x[1]-
x[0])*baroffset;
2238 dbar = (
x[1]-
x[0])*barwidth;
2240 offset = (
y[1]-
y[0])*baroffset;
2241 dbar = (
y[1]-
y[0])*barwidth;
2244 drawbordersav = drawborder;
2248 xhigh = wmin+offset+dbar;
2251 else ylow =
gPad->GetUymin();
2253 for (i=
first; i<=last;i++) {
2260 if (xlow < rwxmax && xhigh > rwxmin)
2264 xhigh = xhigh+delta;
2267 xi1 =
x[i]; xi =
x[i-1];
2269 Error(where,
"X must be in increasing order");
2272 offset = (
x[i+1]-
x[i])*baroffset;
2273 dbar = (
x[i+1]-
x[i])*barwidth;
2274 xlow =
x[i] + offset;
2275 xhigh =
x[i] + offset + dbar;
2280 ylow = wmin + offset;
2281 yhigh = wmin + offset + dbar;
2283 else xlow =
gPad->GetUxmin();
2284 for (i=
first; i<=last;i++) {
2292 gPad->PaintBox(xlow,ylow,xhigh,yhigh);
2294 ylow = ylow + delta;
2295 yhigh = yhigh + delta;
2298 yi1 =
y[i]; yi =
y[i-1];
2300 Error(where,
"Y must be in increasing order");
2303 offset = (
y[i+1]-
y[i])*baroffset;
2304 dbar = (
y[i+1]-
y[i])*barwidth;
2305 ylow =
y[i] + offset;
2306 yhigh =
y[i] + offset + dbar;
2317 if ((optionStar) || (optionMark)) optionMarker=1;
2323 for (i=
first; i<=last;i++) {
2324 if (!optionBins) xm = wmin+(i-
first)*delta+0.5*delta;
2325 else xm =
x[i-1] + 0.5*(
x[i]-
x[i-1]);
2327 if (optionMark != 10) {
2328 if (ym<rwymax && ym > rwymin) {
2334 if (ym<rwymax && ym >= rwymin) {
2351 wminstep = wmin + 0.5*delta;
2352 for (i=
first; i<=last;i++) {
2353 if (!optionBins) ym = wminstep+(i-
first)*delta+0.5*delta;
2354 else ym =
y[i-1] + 0.5*(
y[i]-
y[i-1]);
2356 if (optionMark != 10) {
2357 if (xm<rwxmax && xm > rwxmin) {
2363 if (xm<rwxmax && xm >= rwxmin) {
2404 const Int_t kBASEMARKER=8;
2405 Double_t s2x, s2y, symbolsize, sbase;
2406 Double_t x,
y, xl1, xl2, xr1, xr2, yup1, yup2, ylow1, ylow2, tx, ty;
2407 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};
2408 static Float_t cyy[15] = {1,1,1,1,1,1,1,1,1,0.5,0.6,1,1,1,1};
2417 if (strchr(option,
'X') || strchr(option,
'x')) {
PaintGraphSimple(theGraph, option);
return;}
2420 if (strstr(option,
"||") || strstr(option,
"[]")) {
2422 if (strstr(option,
"[]")) braticks =
kTRUE;
2425 if (strchr(option,
'z')) endLines =
kFALSE;
2426 if (strchr(option,
'Z')) endLines =
kFALSE;
2427 const char *arrowOpt = 0;
2428 if (strchr(option,
'>')) arrowOpt =
">";
2429 if (strstr(option,
"|>")) arrowOpt =
"|>";
2432 if (strchr(option,
'a')) axis =
kTRUE;
2433 if (strchr(option,
'A')) axis =
kTRUE;
2441 if (strchr(option,
'0')) option0 =
kTRUE;
2442 if (strchr(option,
'2')) option2 =
kTRUE;
2443 if (strchr(option,
'3')) option3 =
kTRUE;
2444 if (strchr(option,
'4')) {option3 =
kTRUE; option4 =
kTRUE;}
2445 if (strchr(option,
'5')) {option2 =
kTRUE; option5 =
kTRUE;}
2448 xline =
new Double_t[2*theNpoints];
2449 yline =
new Double_t[2*theNpoints];
2450 if (!xline || !yline) {
2451 Error(
"Paint",
"too many points, out of memory");
2458 theGraph->TAttLine::Modify();
2473 sbase = symbolsize*kBASEMARKER;
2486 tx =
gPad->PixeltoX(dxend) -
gPad->PixeltoX(0);
2487 ty =-
gPad->PixeltoY(dxend) +
gPad->PixeltoY(0);
2488 Float_t asize = 0.6*symbolsize*kBASEMARKER/
gPad->GetWh();
2491 for (
Int_t i=0;i<theNpoints;i++) {
2492 x =
gPad->XtoPad(theX[i]);
2493 y =
gPad->YtoPad(theY[i]);
2496 if (x < gPad->GetUxmin())
x =
gPad->GetUxmin();
2497 if (
x >
gPad->GetUxmax())
x =
gPad->GetUxmax();
2498 if (y < gPad->GetUymin())
y =
gPad->GetUymin();
2499 if (
y >
gPad->GetUymax())
y =
gPad->GetUymax();
2501 if (x < gPad->GetUxmin())
continue;
2502 if (
x >
gPad->GetUxmax())
continue;
2503 if (y < gPad->GetUymin())
continue;
2504 if (
y >
gPad->GetUymax())
continue;
2508 xl2 =
gPad->XtoPad(theX[i] - theEXlow[i]);
2512 x1b =
gPad->XtoPad(theX[i] - theEXlow[i]);
2513 y1b =
gPad->YtoPad(theY[i] - theEYlow[i]);
2514 x2b =
gPad->XtoPad(theX[i] + theEXhigh[i]);
2515 y2b =
gPad->YtoPad(theY[i] + theEYhigh[i]);
2516 if (x1b < gPad->GetUxmin()) x1b =
gPad->GetUxmin();
2517 if (x1b >
gPad->GetUxmax()) x1b =
gPad->GetUxmax();
2518 if (y1b < gPad->GetUymin()) y1b =
gPad->GetUymin();
2519 if (y1b >
gPad->GetUymax()) y1b =
gPad->GetUymax();
2520 if (x2b < gPad->GetUxmin()) x2b =
gPad->GetUxmin();
2521 if (x2b >
gPad->GetUxmax()) x2b =
gPad->GetUxmax();
2522 if (y2b < gPad->GetUymin()) y2b =
gPad->GetUymin();
2523 if (y2b >
gPad->GetUymax()) y2b =
gPad->GetUymax();
2524 if (option5)
box.PaintBox(x1b, y1b, x2b, y2b,
"l");
2525 else box.PaintBox(x1b, y1b, x2b, y2b);
2533 yline[if1-1] =
gPad->YtoPad(theY[i] + theEYhigh[i]);
2534 yline[if2-1] =
gPad->YtoPad(theY[i] - theEYlow[i]);
2542 arrow.PaintArrow(xl1,
y,xl2,
y,asize,arrowOpt);
2544 if (!brackets)
gPad->PaintLine(xl1,
y,xl2,
y);
2547 xb[0] = xl2+tx; yb[0] =
y-ty;
2548 xb[1] = xl2; yb[1] =
y-ty;
2549 xb[2] = xl2; yb[2] =
y+ty;
2550 xb[3] = xl2+tx; yb[3] =
y+ty;
2551 gPad->PaintPolyLine(4, xb, yb);
2553 gPad->PaintLine(xl2,
y-ty,xl2,
y+ty);
2559 xr2 =
gPad->XtoPad(theX[i] + theEXhigh[i]);
2562 arrow.PaintArrow(xr1,
y,xr2,
y,asize,arrowOpt);
2564 if (!brackets)
gPad->PaintLine(xr1,
y,xr2,
y);
2567 xb[0] = xr2-tx; yb[0] =
y-ty;
2568 xb[1] = xr2; yb[1] =
y-ty;
2569 xb[2] = xr2; yb[2] =
y+ty;
2570 xb[3] = xr2-tx; yb[3] =
y+ty;
2571 gPad->PaintPolyLine(4, xb, yb);
2573 gPad->PaintLine(xr2,
y-ty,xr2,
y+ty);
2579 yup2 =
gPad->YtoPad(theY[i] + theEYhigh[i]);
2580 if (yup2 >
gPad->GetUymax()) yup2 =
gPad->GetUymax();
2583 arrow.PaintArrow(
x,yup1,
x,yup2,asize,arrowOpt);
2585 if (!brackets)
gPad->PaintLine(
x,yup1,
x,yup2);
2588 xb[0] =
x-tx; yb[0] = yup2-ty;
2589 xb[1] =
x-tx; yb[1] = yup2;
2590 xb[2] =
x+tx; yb[2] = yup2;
2591 xb[3] =
x+tx; yb[3] = yup2-ty;
2592 gPad->PaintPolyLine(4, xb, yb);
2594 gPad->PaintLine(
x-tx,yup2,
x+tx,yup2);
2600 ylow2 =
gPad->YtoPad(theY[i] - theEYlow[i]);
2601 if (ylow2 < gPad->GetUymin()) ylow2 =
gPad->GetUymin();
2602 if (ylow2 < ylow1) {
2604 arrow.PaintArrow(
x,ylow1,
x,ylow2,asize,arrowOpt);
2606 if (!brackets)
gPad->PaintLine(
x,ylow1,
x,ylow2);
2609 xb[0] =
x-tx; yb[0] = ylow2+ty;
2610 xb[1] =
x-tx; yb[1] = ylow2;
2611 xb[2] =
x+tx; yb[2] = ylow2;
2612 xb[3] =
x+tx; yb[3] = ylow2+ty;
2613 gPad->PaintPolyLine(4, xb, yb);
2615 gPad->PaintLine(
x-tx,ylow2,
x+tx,ylow2);
2629 if (option4)
PaintGraph(theGraph, 2*theNpoints, xline, yline,
"FC");
2630 else PaintGraph(theGraph, 2*theNpoints, xline, yline,
"F");
2631 gPad->SetLogx(logx);
2632 gPad->SetLogy(logy);
2650 Int_t NYErrors = tg->GetNYErrors();
2651 if (NYErrors <= 0) {
2659 std::vector<TString> options(NYErrors + 1);
2668 while ((firstSemicolon = tsOpt.
First(
';')) !=
kNPOS && filled <= NYErrors) {
2669 options[filled] = tsOpt(0, firstSemicolon);
2670 tsOpt = tsOpt(firstSemicolon + 1, tsOpt.
Length());
2674 if (filled <= NYErrors) {
2675 options[filled] = tsOpt.
Copy();
2679 for (
Int_t i = filled; i <= NYErrors; i++)
2683 std::vector<Double_t *> yline(NYErrors);
2688 const Int_t kBASEMARKER = 8;
2689 Double_t s2x, s2y, symbolsize, sbase;
2690 Double_t x,
y, xl1, xl2, xr1, xr2, yup1, yup2, ylow1, ylow2, tx, ty;
2691 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.};
2692 static Float_t cyy[15] = {1., 1., 1., 1., 1., 1., 1., 1., 1., 0.5, 0.6, 1., 1., 1., 1.};
2693 Int_t theNpoints = tg->GetN();
2697 Double_t *theExH = tg->GetEXhigh();
2698 std::vector<Double_t *> theEyL(NYErrors);
2699 std::vector<Double_t *> theEyH(NYErrors);
2702 for (
Int_t j = 0; j < NYErrors; j++) {
2703 theEyL[j] = tg->GetEYlow(j);
2704 theEyH[j] = tg->GetEYhigh(j);
2705 theEyExists &= (theEyL[j] && theEyH[j]);
2708 if (!theX || !theY || !theExL || !theExH || !theEyExists)
2711 std::vector<Bool_t> DrawErrors(NYErrors);
2716 std::vector<Bool_t> Braticks(NYErrors);
2717 std::vector<Bool_t> Brackets(NYErrors);
2718 std::vector<Bool_t> EndLines(NYErrors);
2719 std::vector<Char_t *> ArrowOpt(NYErrors);
2720 std::vector<Bool_t> Option5(NYErrors);
2721 std::vector<Bool_t> Option4(NYErrors);
2722 std::vector<Bool_t> Option3(NYErrors);
2724 std::vector<Bool_t> Option2(NYErrors);
2725 std::vector<Bool_t> Option0(NYErrors);
2727 std::vector<Double_t> Scale(NYErrors);
2729 const TRegexp ScaleRegExp(
"s=*[0-9]\\.*[0-9]");
2731 for (
Int_t j = 0; j < NYErrors; j++) {
2732 if (options[j + 1].Contains(
"s=")) {
2733 sscanf(strstr(options[j + 1].Data(),
"s="),
"s=%lf", &Scale[j]);
2734 options[j + 1].ReplaceAll(options[j + 1](ScaleRegExp),
"");
2738 DrawErrors[j] = !options[j + 1].Contains(
"x");
2739 AnyErrors |= DrawErrors[j];
2740 Braticks[j] = options[j + 1].Contains(
"[]");
2741 Brackets[j] = options[j + 1].Contains(
"||") || Braticks[j];
2742 EndLines[j] = !options[j + 1].Contains(
"z");
2744 if (options[j + 1].Contains(
"|>"))
2745 ArrowOpt[j] = (
Char_t *)
"|>";
2746 else if (options[j + 1].Contains(
">"))
2747 ArrowOpt[j] = (
Char_t *)
">";
2749 ArrowOpt[j] =
nullptr;
2751 Option5[j] = options[j + 1].Contains(
"5");
2752 Option4[j] = options[j + 1].Contains(
"4");
2753 Option3[j] = options[j + 1].Contains(
"3") || Option4[j];
2754 AnyOption3 |= Option3[j];
2755 Option2[j] = options[j + 1].Contains(
"2") || Option5[j];
2756 Option0[j] = options[j + 1].Contains(
"0");
2757 AnyOption0 |= Option0[j];
2759 NoErrorsX &= (Option3[j] || Option2[j]);
2760 Option0X |= !(Option3[j] || Option2[j]) && Option0[j];
2761 DrawMarker |= !(Brackets[j] || Option3[j] || Option2[j]);
2764 Bool_t Draw0PointsX = !options[0].Contains(
"x0") && (
gPad->GetLogx() == 0);
2765 Bool_t Draw0PointsY = !options[0].Contains(
"y0") && (
gPad->GetLogy() == 0);
2766 options[0].ReplaceAll(
"x0",
"");
2767 options[0].ReplaceAll(
"y0",
"");
2769 Bool_t DrawErrorsX = !options[0].Contains(
"x");
2770 Bool_t BraticksX = options[0].Contains(
"[]");
2771 Bool_t BracketsX = options[0].Contains(
"||") || BraticksX;
2772 Bool_t EndLinesX = !options[0].Contains(
"z");
2774 Char_t *ArrowOptX =
nullptr;
2775 if (options[0].Contains(
"|>"))
2776 ArrowOptX = (
Char_t *)
"|>";
2777 else if (options[0].Contains(
">"))
2778 ArrowOptX = (
Char_t *)
">";
2781 if (options[0].Contains(
"s=")) {
2782 sscanf(strstr(options[0].Data(),
"s="),
"s=%lf", &ScaleX);
2783 options[0].ReplaceAll(options[0](ScaleRegExp),
"");
2786 if (!AnyErrors && !DrawErrorsX) {
2791 Bool_t DrawAxis = options[0].Contains(
"a");
2792 Bool_t IndividualStyles = options[0].Contains(
"s");
2797 Int_t NPointsInside = AnyOption0 ? theNpoints : 0;
2799 for (
Int_t i = 0; i < theNpoints && !AnyOption0; i++) {
2800 x =
gPad->XtoPad(theX[i]);
2801 y =
gPad->YtoPad(theY[i]);
2803 if ((
x >=
gPad->GetUxmin()) && (x <= gPad->GetUxmax()) && (
y >=
gPad->GetUymin()) && (y <= gPad->GetUymax()) &&
2804 (Draw0PointsX || theX[i] != 0.) && (Draw0PointsY || theY[i] != 0.))
2809 xline =
new Double_t[2 * NPointsInside];
2812 Error(
"Paint",
"too many points, out of memory");
2817 if2 = 2 * NPointsInside;
2820 for (
Int_t j = 0; j < NYErrors; j++) {
2821 if (Option3[j] && DrawErrors[j]) {
2822 yline[j] =
new Double_t[2 * NPointsInside];
2825 Error(
"Paint",
"too many points, out of memory");
2827 for (
Int_t k = 0; k < j; k++)
2835 tg->TAttLine::Modify();
2838 arrow.SetLineWidth(tg->GetLineWidth());
2839 arrow.SetLineColor(tg->GetLineColor());
2840 arrow.SetFillColor(tg->GetFillColor());
2844 box.SetLineWidth(tg->GetLineWidth());
2845 box.SetLineColor(tg->GetLineColor());
2846 box.SetFillColor(tg->GetFillColor());
2847 box.SetFillStyle(tg->GetFillStyle());
2849 symbolsize = tg->GetMarkerSize();
2850 sbase = symbolsize * kBASEMARKER;
2856 cx = cxx[
mark - 20];
2857 cy = cyy[
mark - 20];
2861 s2x =
gPad->PixeltoX(
Int_t(0.5 * sbase)) -
gPad->PixeltoX(0);
2862 s2y = -
gPad->PixeltoY(
Int_t(0.5 * sbase)) +
gPad->PixeltoY(0);
2864 tx =
gPad->PixeltoX(dxend) -
gPad->PixeltoX(0);
2865 ty = -
gPad->PixeltoY(dxend) +
gPad->PixeltoY(0);
2866 Float_t asize = 0.6 * symbolsize * kBASEMARKER /
gPad->GetWh();
2870 for (
Int_t i = 0; i < theNpoints; i++) {
2871 x =
gPad->XtoPad(theX[i]);
2872 y =
gPad->YtoPad(theY[i]);
2875 (
x <
gPad->GetUxmin()) || (
x >
gPad->GetUxmax()) || (y < gPad->GetUymin()) || (
y >
gPad->GetUymax());
2877 if ((isOutside && !AnyOption0) || (!Draw0PointsX && theX[i] == 0.) || (!Draw0PointsY && theY[i] == 0.))
2882 if (x < gPad->GetUxmin())
2883 x =
gPad->GetUxmin();
2884 if (
x >
gPad->GetUxmax())
2885 x =
gPad->GetUxmax();
2886 if (y < gPad->GetUymin())
2887 y =
gPad->GetUymin();
2888 if (
y >
gPad->GetUymax())
2889 y =
gPad->GetUymax();
2899 for (
Int_t j = 0; j < NYErrors; j++) {
2904 if (Option2[j] && (!isOutside || Option0[j])) {
2905 if (IndividualStyles) {
2906 box.SetLineWidth(tg->GetLineWidth(j));
2907 box.SetLineColor(tg->GetLineColor(j));
2908 box.SetFillColor(tg->GetFillColor(j));
2909 box.SetFillStyle(tg->GetFillStyle(j));
2912 x1b =
gPad->XtoPad(theX[i] - Scale[j] * theExL[i]);
2913 y1b =
gPad->YtoPad(theY[i] - theEyL[j][i]);
2914 x2b =
gPad->XtoPad(theX[i] + Scale[j] * theExH[i]);
2915 y2b =
gPad->YtoPad(theY[i] + theEyH[j][i]);
2916 if (x1b < gPad->GetUxmin())
2917 x1b =
gPad->GetUxmin();
2918 if (x1b >
gPad->GetUxmax())
2919 x1b =
gPad->GetUxmax();
2920 if (y1b < gPad->GetUymin())
2921 y1b =
gPad->GetUymin();
2922 if (y1b >
gPad->GetUymax())
2923 y1b =
gPad->GetUymax();
2924 if (x2b < gPad->GetUxmin())
2925 x2b =
gPad->GetUxmin();
2926 if (x2b >
gPad->GetUxmax())
2927 x2b =
gPad->GetUxmax();
2928 if (y2b < gPad->GetUymin())
2929 y2b =
gPad->GetUymin();
2930 if (y2b >
gPad->GetUymax())
2931 y2b =
gPad->GetUymax();
2933 box.PaintBox(x1b, y1b, x2b, y2b,
"l");
2935 box.PaintBox(x1b, y1b, x2b, y2b);
2940 if (!isOutside || Option0[j]) {
2941 yline[j][if1 - 2] =
gPad->YtoPad(theY[i] + theEyH[j][i]);
2942 yline[j][if2] =
gPad->YtoPad(theY[i] - theEyL[j][i]);
2944 yline[j][if1 - 2] =
gPad->GetUymin();
2945 yline[j][if2] =
gPad->GetUymin();
2949 if (IndividualStyles) {
2950 tg->GetAttLine(j)->Modify();
2952 arrow.SetLineWidth(tg->GetLineWidth(j));
2953 arrow.SetLineColor(tg->GetLineColor(j));
2954 arrow.SetFillColor(tg->GetFillColor(j));
2957 ylow1 =
y - s2y * cy;
2958 ylow2 =
gPad->YtoPad(theY[i] - theEyL[j][i]);
2959 if (ylow2 < gPad->GetUymin())
2960 ylow2 =
gPad->GetUymin();
2961 if (ylow2 < ylow1 && DrawErrors[j] && !Option2[j] && !Option3[j] && (!isOutside || Option0[j])) {
2963 arrow.PaintArrow(
x, ylow1,
x, ylow2, asize, ArrowOpt[j]);
2966 gPad->PaintLine(
x, ylow1,
x, ylow2);
2977 gPad->PaintPolyLine(4, xb, yb);
2979 gPad->PaintLine(
x - tx, ylow2,
x + tx, ylow2);
2984 yup1 =
y + s2y * cy;
2985 yup2 =
gPad->YtoPad(theY[i] + theEyH[j][i]);
2986 if (yup2 >
gPad->GetUymax())
2987 yup2 =
gPad->GetUymax();
2988 if (yup2 > yup1 && DrawErrors[j] && !Option2[j] && !Option3[j] && (!isOutside || Option0[j])) {
2990 arrow.PaintArrow(
x, yup1,
x, yup2, asize, ArrowOpt[j]);
2993 gPad->PaintLine(
x, yup1,
x, yup2);
3004 gPad->PaintPolyLine(4, xb, yb);
3006 gPad->PaintLine(
x - tx, yup2,
x + tx, yup2);
3013 if (IndividualStyles) {
3014 tg->TAttLine::Modify();
3016 arrow.SetLineWidth(tg->GetLineWidth());
3017 arrow.SetLineColor(tg->GetLineColor());
3018 arrow.SetFillColor(tg->GetFillColor());
3022 xl2 =
gPad->XtoPad(theX[i] - ScaleX * theExL[i]);
3023 if (xl1 > xl2 && !NoErrorsX && (!isOutside || Option0X)) {
3025 arrow.PaintArrow(xl1,
y, xl2,
y, asize, ArrowOptX);
3028 gPad->PaintLine(xl1,
y, xl2,
y);
3039 gPad->PaintPolyLine(4, xb, yb);
3041 gPad->PaintLine(xl2,
y - ty, xl2,
y + ty);
3047 xr2 =
gPad->XtoPad(theX[i] + ScaleX * theExH[i]);
3048 if (xr1 < xr2 && !NoErrorsX && (!isOutside || Option0X)) {
3050 arrow.PaintArrow(xr1,
y, xr2,
y, asize, ArrowOptX);
3053 gPad->PaintLine(xr1,
y, xr2,
y);
3064 gPad->PaintPolyLine(4, xb, yb);
3066 gPad->PaintLine(xr2,
y - ty, xr2,
y + ty);
3077 auto tgDummy =
new TGraph();
3078 tg->TAttFill::Copy(*tgDummy);
3079 tg->TAttLine::Copy(*tgDummy);
3080 tg->TAttMarker::Copy(*tgDummy);
3082 for (
Int_t j = 0; j < NYErrors; j++) {
3083 if (Option3[j] && DrawErrors[j]) {
3084 if (IndividualStyles) {
3085 tg->GetAttFill(j)->Copy(*tgDummy);
3086 tg->GetAttLine(j)->Copy(*tgDummy);
3094 PaintGraph(tgDummy, 2 * NPointsInside, xline, yline[j],
"FC");
3096 PaintGraph(tgDummy, 2 * NPointsInside, xline, yline[j],
"F");
3097 gPad->SetLogx(logx);
3098 gPad->SetLogy(logy);
3121 const Int_t kBASEMARKER=8;
3122 Double_t s2x, s2y, symbolsize, sbase;
3123 Double_t x,
y, xl1, xl2, xr1, xr2, yup1, yup2, ylow1, ylow2, tx, ty;
3125 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};
3126 static Float_t cyy[15] = {1,1,1,1,1,1,1,1,1,0.5,0.6,1,1,1,1};
3139 if (strchr(option,
'X') || strchr(option,
'x')) {
PaintGraphSimple(theGraph, option);
return;}
3142 if (strstr(option,
"||") || strstr(option,
"[]")) {
3144 if (strstr(option,
"[]")) braticks =
kTRUE;
3147 if (strchr(option,
'z')) endLines =
kFALSE;
3148 if (strchr(option,
'Z')) endLines =
kFALSE;
3149 const char *arrowOpt = 0;
3150 if (strchr(option,
'>')) arrowOpt =
">";
3151 if (strstr(option,
"|>")) arrowOpt =
"|>";
3154 if (strchr(option,
'a')) axis =
kTRUE;
3155 if (strchr(option,
'A')) axis =
kTRUE;
3163 if (strchr(option,
'0')) option0 =
kTRUE;
3164 if (strchr(option,
'2')) option2 =
kTRUE;
3165 if (strchr(option,
'3')) option3 =
kTRUE;
3166 if (strchr(option,
'4')) {option3 =
kTRUE; option4 =
kTRUE;}
3167 if (strchr(option,
'5')) {option2 =
kTRUE; option5 =
kTRUE;}
3170 xline =
new Double_t[2*theNpoints];
3171 yline =
new Double_t[2*theNpoints];
3172 if (!xline || !yline) {
3173 Error(
"Paint",
"too many points, out of memory");
3180 theGraph->TAttLine::Modify();
3195 sbase = symbolsize*kBASEMARKER;
3208 tx =
gPad->PixeltoX(dxend) -
gPad->PixeltoX(0);
3209 ty =-
gPad->PixeltoY(dxend) +
gPad->PixeltoY(0);
3210 Float_t asize = 0.6*symbolsize*kBASEMARKER/
gPad->GetWh();
3213 for (
Int_t i=0;i<theNpoints;i++) {
3214 x =
gPad->XtoPad(theX[i]);
3215 y =
gPad->YtoPad(theY[i]);
3216 bxl =
gPad->YtoPad(theY[i]+theEXlowd[i]);
3217 bxh =
gPad->YtoPad(theY[i]+theEXhighd[i]);
3218 byl =
gPad->XtoPad(theX[i]+theEYlowd[i]);
3219 byh =
gPad->XtoPad(theX[i]+theEYhighd[i]);
3222 if (x < gPad->GetUxmin())
x =
gPad->GetUxmin();
3223 if (
x >
gPad->GetUxmax())
x =
gPad->GetUxmax();
3224 if (y < gPad->GetUymin())
y =
gPad->GetUymin();
3225 if (
y >
gPad->GetUymax())
y =
gPad->GetUymax();
3227 if (x < gPad->GetUxmin())
continue;
3228 if (
x >
gPad->GetUxmax())
continue;
3229 if (y < gPad->GetUymin())
continue;
3230 if (
y >
gPad->GetUymax())
continue;
3236 x1b =
gPad->XtoPad(theX[i] - theEXlow[i]);
3237 y1b =
gPad->YtoPad(theY[i] - theEYlow[i]);
3238 x2b =
gPad->XtoPad(theX[i] + theEXhigh[i]);
3239 y2b =
gPad->YtoPad(theY[i] + theEYhigh[i]);
3240 if (x1b < gPad->GetUxmin()) x1b =
gPad->GetUxmin();
3241 if (x1b >
gPad->GetUxmax()) x1b =
gPad->GetUxmax();
3242 if (y1b < gPad->GetUymin()) y1b =
gPad->GetUymin();
3243 if (y1b >
gPad->GetUymax()) y1b =
gPad->GetUymax();
3244 if (x2b < gPad->GetUxmin()) x2b =
gPad->GetUxmin();
3245 if (x2b >
gPad->GetUxmax()) x2b =
gPad->GetUxmax();
3246 if (y2b < gPad->GetUymin()) y2b =
gPad->GetUymin();
3247 if (y2b >
gPad->GetUymax()) y2b =
gPad->GetUymax();
3248 if (option5)
box.PaintBox(x1b, y1b, x2b, y2b,
"l");
3249 else box.PaintBox(x1b, y1b, x2b, y2b);
3257 yline[if1-1] =
gPad->YtoPad(theY[i] + theEYhigh[i]);
3258 yline[if2-1] =
gPad->YtoPad(theY[i] - theEYlow[i]);
3265 xl2 =
gPad->XtoPad(theX[i] - theEXlow[i]);
3268 arrow.PaintArrow(xl1,
y,xl2,bxl,asize,arrowOpt);
3270 if (!brackets)
gPad->PaintLine(xl1,
y,xl2,bxl);
3273 xb[0] = xl2+tx; yb[0] = bxl-ty;
3274 xb[1] = xl2; yb[1] = bxl-ty;
3275 xb[2] = xl2; yb[2] = bxl+ty;
3276 xb[3] = xl2+tx; yb[3] = bxl+ty;
3277 gPad->PaintPolyLine(4, xb, yb);
3279 gPad->PaintLine(xl2,bxl-ty,xl2,bxl+ty);
3285 xr2 =
gPad->XtoPad(theX[i] + theEXhigh[i]);
3288 arrow.PaintArrow(xr1,
y,xr2,bxh,asize,arrowOpt);
3290 if (!brackets)
gPad->PaintLine(xr1,
y,xr2,bxh);
3293 xb[0] = xr2-tx; yb[0] = bxh-ty;
3294 xb[1] = xr2; yb[1] = bxh-ty;
3295 xb[2] = xr2; yb[2] = bxh+ty;
3296 xb[3] = xr2-tx; yb[3] = bxh+ty;
3297 gPad->PaintPolyLine(4, xb, yb);
3299 gPad->PaintLine(xr2,bxh-ty,xr2,bxh+ty);
3305 yup2 =
gPad->YtoPad(theY[i] + theEYhigh[i]);
3306 if (yup2 >
gPad->GetUymax()) yup2 =
gPad->GetUymax();
3309 arrow.PaintArrow(
x,yup1,byh,yup2,asize,arrowOpt);
3311 if (!brackets)
gPad->PaintLine(
x,yup1,byh,yup2);
3314 xb[0] = byh-tx; yb[0] = yup2-ty;
3315 xb[1] = byh-tx; yb[1] = yup2;
3316 xb[2] = byh+tx; yb[2] = yup2;
3317 xb[3] = byh+tx; yb[3] = yup2-ty;
3318 gPad->PaintPolyLine(4, xb, yb);
3320 gPad->PaintLine(byh-tx,yup2,byh+tx,yup2);
3326 ylow2 =
gPad->YtoPad(theY[i] - theEYlow[i]);
3327 if (ylow2 < gPad->GetUymin()) ylow2 =
gPad->GetUymin();
3328 if (ylow2 < ylow1) {
3330 arrow.PaintArrow(
x,ylow1,byl,ylow2,asize,arrowOpt);
3332 if (!brackets)
gPad->PaintLine(
x,ylow1,byl,ylow2);
3335 xb[0] = byl-tx; yb[0] = ylow2+ty;
3336 xb[1] = byl-tx; yb[1] = ylow2;
3337 xb[2] = byl+tx; yb[2] = ylow2;
3338 xb[3] = byl+tx; yb[3] = ylow2+ty;
3339 gPad->PaintPolyLine(4, xb, yb);
3341 gPad->PaintLine(byl-tx,ylow2,byl+tx,ylow2);
3355 if (option4)
PaintGraph(theGraph, 2*theNpoints, xline, yline,
"FC");
3356 else PaintGraph(theGraph, 2*theNpoints, xline, yline,
"F");
3357 gPad->SetLogx(logx);
3358 gPad->SetLogy(logy);
3377 const Int_t kBASEMARKER=8;
3378 Double_t s2x, s2y, symbolsize, sbase;
3379 Double_t x,
y,
ex,
ey, xl1, xl2, xr1, xr2, yup1, yup2, ylow1, ylow2, tx, ty;
3380 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};
3381 static Float_t cyy[15] = {1,1,1,1,1,1,1,1,1,0.5,0.6,1,1,1,1};
3388 if (strchr(option,
'X') || strchr(option,
'x')) {
PaintGraphSimple(theGraph, option);
return;}
3391 if (strstr(option,
"||") || strstr(option,
"[]")) {
3393 if (strstr(option,
"[]")) braticks =
kTRUE;
3396 if (strchr(option,
'z')) endLines =
kFALSE;
3397 if (strchr(option,
'Z')) endLines =
kFALSE;
3398 const char *arrowOpt = 0;
3399 if (strchr(option,
'>')) arrowOpt =
">";
3400 if (strstr(option,
"|>")) arrowOpt =
"|>";
3403 if (strchr(option,
'a')) axis =
kTRUE;
3404 if (strchr(option,
'A')) axis =
kTRUE;
3412 if (strchr(option,
'0')) option0 =
kTRUE;
3413 if (strchr(option,
'2')) option2 =
kTRUE;
3414 if (strchr(option,
'3')) option3 =
kTRUE;
3415 if (strchr(option,
'4')) {option3 =
kTRUE; option4 =
kTRUE;}
3416 if (strchr(option,
'5')) {option2 =
kTRUE; option5 =
kTRUE;}
3419 xline =
new Double_t[2*theNpoints];
3420 yline =
new Double_t[2*theNpoints];
3421 if (!xline || !yline) {
3422 Error(
"Paint",
"too many points, out of memory");
3429 theGraph->TAttLine::Modify();
3444 sbase = symbolsize*kBASEMARKER;
3457 tx =
gPad->PixeltoX(dxend) -
gPad->PixeltoX(0);
3458 ty =-
gPad->PixeltoY(dxend) +
gPad->PixeltoY(0);
3459 Float_t asize = 0.6*symbolsize*kBASEMARKER/
gPad->GetWh();
3462 for (
Int_t i=0;i<theNpoints;i++) {
3463 x =
gPad->XtoPad(theX[i]);
3464 y =
gPad->YtoPad(theY[i]);
3467 if (x < gPad->GetUxmin())
x =
gPad->GetUxmin();
3468 if (
x >
gPad->GetUxmax())
x =
gPad->GetUxmax();
3469 if (y < gPad->GetUymin())
y =
gPad->GetUymin();
3470 if (
y >
gPad->GetUymax())
y =
gPad->GetUymax();
3472 if (x < gPad->GetUxmin())
continue;
3473 if (
x >
gPad->GetUxmax())
continue;
3474 if (y < gPad->GetUymin())
continue;
3475 if (
y >
gPad->GetUymax())
continue;
3483 x1b =
gPad->XtoPad(theX[i] -
ex);
3484 y1b =
gPad->YtoPad(theY[i] -
ey);
3485 x2b =
gPad->XtoPad(theX[i] +
ex);
3486 y2b =
gPad->YtoPad(theY[i] +
ey);
3487 if (x1b < gPad->GetUxmin()) x1b =
gPad->GetUxmin();
3488 if (x1b >
gPad->GetUxmax()) x1b =
gPad->GetUxmax();
3489 if (y1b < gPad->GetUymin()) y1b =
gPad->GetUymin();
3490 if (y1b >
gPad->GetUymax()) y1b =
gPad->GetUymax();
3491 if (x2b < gPad->GetUxmin()) x2b =
gPad->GetUxmin();
3492 if (x2b >
gPad->GetUxmax()) x2b =
gPad->GetUxmax();
3493 if (y2b < gPad->GetUymin()) y2b =
gPad->GetUymin();
3494 if (y2b >
gPad->GetUymax()) y2b =
gPad->GetUymax();
3495 if (option5)
box.PaintBox(x1b, y1b, x2b, y2b,
"l");
3496 else box.PaintBox(x1b, y1b, x2b, y2b);
3504 yline[if1-1] =
gPad->YtoPad(theY[i] +
ey);
3505 yline[if2-1] =
gPad->YtoPad(theY[i] -
ey);
3512 xl2 =
gPad->XtoPad(theX[i] -
ex);
3515 arrow.PaintArrow(xl1,
y,xl2,
y,asize,arrowOpt);
3517 if (!brackets)
gPad->PaintLine(xl1,
y,xl2,
y);
3520 xb[0] = xl2+tx; yb[0] =
y-ty;
3521 xb[1] = xl2; yb[1] =
y-ty;
3522 xb[2] = xl2; yb[2] =
y+ty;
3523 xb[3] = xl2+tx; yb[3] =
y+ty;
3524 gPad->PaintPolyLine(4, xb, yb);
3526 gPad->PaintLine(xl2,
y-ty,xl2,
y+ty);
3532 xr2 =
gPad->XtoPad(theX[i] +
ex);
3535 arrow.PaintArrow(xr1,
y,xr2,
y,asize,arrowOpt);
3537 if (!brackets)
gPad->PaintLine(xr1,
y,xr2,
y);
3540 xb[0] = xr2-tx; yb[0] =
y-ty;
3541 xb[1] = xr2; yb[1] =
y-ty;
3542 xb[2] = xr2; yb[2] =
y+ty;
3543 xb[3] = xr2-tx; yb[3] =
y+ty;
3544 gPad->PaintPolyLine(4, xb, yb);
3546 gPad->PaintLine(xr2,
y-ty,xr2,
y+ty);
3552 yup2 =
gPad->YtoPad(theY[i] +
ey);
3553 if (yup2 >
gPad->GetUymax()) yup2 =
gPad->GetUymax();
3556 arrow.PaintArrow(
x,yup1,
x,yup2,asize,arrowOpt);
3558 if (!brackets)
gPad->PaintLine(
x,yup1,
x,yup2);
3561 xb[0] =
x-tx; yb[0] = yup2-ty;
3562 xb[1] =
x-tx; yb[1] = yup2;
3563 xb[2] =
x+tx; yb[2] = yup2;
3564 xb[3] =
x+tx; yb[3] = yup2-ty;
3565 gPad->PaintPolyLine(4, xb, yb);
3567 gPad->PaintLine(
x-tx,yup2,
x+tx,yup2);
3573 ylow2 =
gPad->YtoPad(theY[i] -
ey);
3574 if (ylow2 < gPad->GetUymin()) ylow2 =
gPad->GetUymin();
3575 if (ylow2 < ylow1) {
3577 arrow.PaintArrow(
x,ylow1,
x,ylow2,asize,arrowOpt);
3579 if (!brackets)
gPad->PaintLine(
x,ylow1,
x,ylow2);
3582 xb[0] =
x-tx; yb[0] = ylow2+ty;
3583 xb[1] =
x-tx; yb[1] = ylow2;
3584 xb[2] =
x+tx; yb[2] = ylow2;
3585 xb[3] =
x+tx; yb[3] = ylow2+ty;
3586 gPad->PaintPolyLine(4, xb, yb);
3588 gPad->PaintLine(
x-tx,ylow2,
x+tx,ylow2);
3602 if (option4)
PaintGraph(theGraph, 2*theNpoints, xline, yline,
"FC");
3603 else PaintGraph(theGraph, 2*theNpoints, xline, yline,
"F");
3604 gPad->SetLogx(logx);
3605 gPad->SetLogy(logy);
3619 Double_t rwrmin, rwrmax, rwtmin, rwtmax;
3623 Int_t theNpoints = theGraphPolar->
GetN();
3629 if (theNpoints<1)
return;
3644 if (thePolargram)
if (!
gPad->FindObject(thePolargram->
GetName())) thePolargram=0;
3645 if (!thePolargram) {
3658 if (!thePolargram) {
3660 rwrmin = theY[0]; rwrmax = theY[theNpoints-1];
3661 rwtmin = theX[0]; rwtmax = theX[theNpoints-1];
3663 for (ipt = 0; ipt < theNpoints; ipt++) {
3666 if (theX[ipt] -theEX[ipt] < rwtmin) rwtmin = theX[ipt]-theEX[ipt];
3667 if (theX[ipt] +theEX[ipt] > rwtmax) rwtmax = theX[ipt]+theEX[ipt];
3669 if (theX[ipt] < rwtmin) rwtmin=theX[ipt];
3670 if (theX[ipt] > rwtmax) rwtmax=theX[ipt];
3673 if (theY[ipt] -theEY[ipt] < rwrmin) rwrmin = theY[ipt]-theEY[ipt];
3674 if (theY[ipt] +theEY[ipt] > rwrmax) rwrmax = theY[ipt]+theEY[ipt];
3676 if (theY[ipt] < rwrmin) rwrmin=theY[ipt];
3677 if (theY[ipt] > rwrmax) rwrmax=theY[ipt];
3681 if (rwrmin == rwrmax) rwrmax += 1.;
3682 if (rwtmin == rwtmax) rwtmax += 1.;
3689 rwtmax += dt/theNpoints;
3691 rwrmin = thePolargram->
GetRMin();
3692 rwrmax = thePolargram->
GetRMax();
3693 rwtmin = thePolargram->
GetTMin();
3694 rwtmax = thePolargram->
GetTMax();
3699 thePolargram =
new TGraphPolargram(
"Polargram",rwrmin,rwrmax,rwtmin,rwtmax);
3703 if (nolabel) thePolargram->
Draw(
"N");
3704 else thePolargram->
Draw(
"");
3713 Double_t radiusNDC = rwrmax-rwrmin;
3723 for (i=0; i<theNpoints; i++) {
3724 Double_t eymin, eymax, exmin,exmax;
3725 exmin = (theY[i]-theEY[i]-rwrmin)/radiusNDC*
3727 eymin = (theY[i]-theEY[i]-rwrmin)/radiusNDC*
3729 exmax = (theY[i]+theEY[i]-rwrmin)/radiusNDC*
3731 eymax = (theY[i]+theEY[i]-rwrmin)/radiusNDC*
3733 theGraphPolar->TAttLine::Modify();
3734 if (exmin != exmax || eymin != eymax)
gPad->PaintLine(exmin,eymin,exmax,eymax);
3738 for (i=0; i<theNpoints; i++) {
3742 theGraphPolar->TAttLine::Modify();
3743 if (phimin != phimax) thePolargram->
PaintCircle(0,0,
rad,phimin,phimax,0);
3749 if (!(
gPad->GetLogx()) && !(
gPad->GetLogy())) {
3750 Double_t a,
b,
c=1,
x1,
x2, y1, y2, discr, norm1, norm2, xts, yts;
3758 for (i=0; i<theNpoints; i++) {
3761 xt = (theY[i]-rwrmin)/radiusNDC*
TMath::Cos(
c*(theX[i]-rwtmin)/thetaNDC);
3762 yt = (theY[i]-rwrmin)/radiusNDC*
TMath::Sin(
c*(theX[i]-rwtmin)/thetaNDC);
3763 norm =
sqrt(xt*xt+yt*yt);
3768 if (!previouspointin) {
3773 a = (yt-yts)/(xt-xts);
3775 discr = 4*(
a*
a-
b*
b+1);
3780 norm1 =
sqrt((
x1-xt)*(
x1-xt)+(y1-yt)*(y1-yt));
3781 norm2 =
sqrt((
x2-xt)*(
x2-xt)+(y2-yt)*(y2-yt));
3782 previouspointin =
kFALSE;
3784 if (norm1 < norm2) {
3794 PaintGraph(theGraphPolar, j+1, theXpol, theYpol, opt);
3799 if (j>=1 && !previouspointin) {
3800 a = (yt-theYpol[j])/(xt-theXpol[j]);
3801 b = theYpol[j]-
a*theXpol[j];
3802 previouspointin =
kTRUE;
3803 discr = 4*(
a*
a-
b*
b+1);
3808 norm1 =
sqrt((
x1-xt)*(
x1-xt)+(y1-yt)*(y1-yt));
3809 norm2 =
sqrt((
x2-xt)*(
x2-xt)+(y2-yt)*(y2-yt));
3811 if (norm1 < norm2) {
3818 PaintGraph(theGraphPolar, j+1, theXpol, theYpol, opt);
3825 PaintGraph(theGraphPolar, j+1, theXpol, theYpol, opt);
3828 for (i=0; i<theNpoints; i++) {
3832 PaintGraph(theGraphPolar, theNpoints, theXpol, theYpol,opt);
3841 TIter next(
gPad->GetListOfPrimitives());
3842 while ((obj = next())) {
3846 if (strcmp(title->
GetName(),
"title")) {title = 0;
continue;}
3850 if (title)
delete title;
3856 if (ht <= 0) ht = 0.05;
3877 if (talh < 1) talh = 1;
else if (talh > 3) talh = 3;
3879 if (talv < 1) talv = 1;
else if (talv > 3) talv = 3;
3885 if (talh == 2) xpos = xpos-wt/2.;
3886 if (talh == 3) xpos = xpos-wt;
3887 if (talv == 2) ypos = ypos+ht/2.;
3888 if (talv == 1) ypos = ypos+ht;
3921 TF1 *theF = theGraphQQ->
GetF();
3924 Error(
"TGraphQQ::Paint",
"2nd dataset or theoretical function not specified");
3939 Double_t yxmin, xymin, yxmax, xymax;
3945 TLine line1, line2, line3;
3948 yxmin = (theYq2-theYq1)*(
xmin-theXq1)/(theXq2-theXq1) + theYq1;
3950 xymin = (theXq2-theXq1)*(
ymin-theYq1)/(theYq2-theYq1) + theXq1;
3956 line2.
PaintLine(xqmin, yqmin, xqmax, yqmax);
3958 yxmax = (theYq2-theYq1)*(
xmax-theXq1)/(theXq2-theXq1) + theYq1;
3960 xymax = (theXq2-theXq1)*(
ymax-theYq1)/(theYq2-theYq1) + theXq1;
4000 theHist->
Paint(
"0");
4013 XA1 =
gPad->GetUxmin();
4014 XA2 =
gPad->GetUxmax();
4015 YA1 =
gPad->GetUymin();
4016 YA2 =
gPad->GetUymax();
4021 std::vector<Double_t> newX(
N);
4022 std::vector<Double_t> newY(
N);
4034 if (
gPad->GetGridx()) {
4035 GL = (YA2 - YA1) / (
gPad->GetY2() -
gPad->GetY1());
4038 auto *theNewAxis =
new TGaxis(
gPad->GetUxmax(),
4049 theNewAxis->SetTickLength(TLX);
4051 theNewAxis->Paint();
4054 for (
Int_t i=0; i<
N; i++) newX[i] = dX-X[i];
4056 for (
Int_t i=0; i<
N; i++) newX[i] = X[i];
4067 if (
gPad->GetGridy()) {
4068 GL = (XA2 - XA1) / (
gPad->GetX2() -
gPad->GetX1());
4071 auto *theNewAxis =
new TGaxis(
gPad->GetUxmin(),
4082 theNewAxis->SetTickLength(-TLY);
4083 theNewAxis->SetLabelOffset(LOY-TLY);
4084 theNewAxis->Paint();
4087 for (
Int_t i=0; i<
N; i++) newY[i] = dY-Y[i];
4089 for (
Int_t i=0; i<
N; i++) newY[i] = Y[i];
4094 for (
Int_t i=0; i<
N; i++) theNewGraph->
SetPoint(i, newX[i], newY[i]);
4117 if (strstr(option,
"H") || strstr(option,
"h")) {
4128 if (!functions)
return;
4164 Double_t x1,
x2, y1, y2,
x3, y3, xm, ym,
a, a1, a2, a3;
4167 Int_t ix1,iy1,ix2,iy2;
4171 gPad->GetPadPar(x1p,y1p,x2p,y2p);
4172 ix1 = (
Int_t)(iw*x1p);
4173 iy1 = (
Int_t)(ih*y1p);
4174 ix2 = (
Int_t)(iw*x2p);
4175 iy2 = (
Int_t)(ih*y2p);
4187 gPad->GetRange(rx1,ry1,rx2,ry2);
4188 Double_t rx = (x2ndc-x1ndc)/(rx2-rx1);
4189 Double_t ry = (y2ndc-y1ndc)/(ry2-ry1);
4193 xf[0] = rx*(
x[0]-rx1)+x1ndc;
4194 yf[0] = ry*(
y[0]-ry1)+y1ndc;
4196 for (i=1; i<
n; i++) {
4197 if (
x[i]==
x[i-1] &&
y[i]==
y[i-1])
continue;
4199 xf[nf] = rx*(
x[i]-rx1)+x1ndc;
4200 if (xf[i]==xf[i-1]) xf[i] += 0.000001;
4201 yf[nf] = ry*(
y[i]-ry1)+y1ndc;
4220 if (xf[nf]==xf[nf-1]) {
4225 if (xf[nf]>=xf[nf-1]) {
4234 for (i=1; i<nf; i++) {
4246 if (xi1<xi0) a1 = a1+3.14159;
4252 if (xi0<xi2) a2 = a2+3.14159;
4267 if ((xm-xi0)*(
x3-xi0)<0 && (ym-yi0)*(y3-yi0)<0) {
4271 if ((xm==
x1) && (ym==y1)) {
4280 if (xf[nf]==xf[0] && yf[nf]==yf[0]) {
4281 xm = (xt[nf]+xt[0])*0.5;
4282 ym = (yt[nf]+yt[0])*0.5;
4290 if ((xm-xf[0])*(
x3-xf[0])<0 && (ym-yf[0])*(y3-yf[0])<0) {
4304 for (i=nf2; i>0; i--) {
4305 for (j=i-1; j>0; j--) {
4306 if (xt[i-1]==xt[i] || xt[j-1]==xt[j])
continue;
4307 c1 = (yt[i-1]-yt[i])/(xt[i-1]-xt[i]);
4308 b1 = yt[i]-
c1*xt[i];
4309 c2 = (yt[j-1]-yt[j])/(xt[j-1]-xt[j]);
4310 b2 = yt[j]-
c2*xt[j];
4312 xc = (b2-b1)/(
c1-
c2);
4318 nf++; xf[nf] = xt[i]; yf[nf] = yt[i];
4319 nf++; xf[nf] = xc ; yf[nf] = yc;
4337 nf++; xf[nf] = xt[0]; yf[nf] = yt[0];
4340 for (i=0; i<nf+1; i++) {
4341 xf[i] = (1/rx)*(xf[i]-x1ndc)+rx1;
4342 yf[i] = (1/ry)*(yf[i]-y1ndc)+ry1;
4346 gPad->PaintFillArea(nf+1,xf,yf);
4347 theGraph->TAttLine::Modify();
4365 TIter next(functions);
4367 while ((obj = next())) {
4377 if (!dofit) fit = 0;
4379 if (dofit == 1) dofit = 111;
4381 Int_t print_fval = dofit%10;
4382 Int_t print_ferrors = (dofit/10)%10;
4383 Int_t print_fchi2 = (dofit/100)%10;
4384 Int_t print_fprob = (dofit/1000)%10;
4385 Int_t nlinesf = print_fval + print_fchi2 + print_fprob;
4386 if (fit) nlinesf += fit->
GetNpar();
4424 if (print_fchi2) stats->
AddText(t);
4430 if (print_fval || print_ferrors) {
4432 if (print_ferrors) {
4445 if (!done) functions->
Add(stats);
4475 Int_t i, k, kp,
km, npointsMax, banksize, n2, npt;
4476 Int_t maxiterations, finished;
4477 Int_t jtype, ktype, closed;
4478 Double_t sxmin, sxmax, symin, symax;
4481 Double_t ratio_signs, xratio, yratio;
4487 Double_t co, so, ct, st, ctu, stu, xnt;
4488 Double_t dx1, dy1, dx2, dy2, dk1, dk2;
4495 c = t = co = so = ct = st = ctu = stu = dx1 = dy1 = dx2 = dy2 = 0;
4496 xt = yt = xa = xb = ya = yb = u1 = u2 = u3 = tj = sb = 0;
4498 npointsMax = npoints*10;
4505 Error(
"Smooth",
"not enough space in memory");
4512 jtype = (drawtype%1000)-10;
4513 if (jtype > 0) { ktype = jtype; loptx =
kTRUE; }
4514 else ktype = drawtype%1000;
4543 for (i=1;i<npoints;i++) {
4545 if ((
x[i]-
x[i-1])*(
x[i-1]-
x[i-2]) < 0) six++;
4546 if ((
y[i]-
y[i-1])*(
y[i-1]-
y[i-2]) < 0) siy++;
4548 if (
x[i] < sxmin) sxmin =
x[i];
4549 if (
x[i] > sxmax) sxmax =
x[i];
4550 if (
y[i] < symin) symin =
y[i];
4551 if (
y[i] > symax) symax =
y[i];
4556 if (dx1n < 0.01*(sxmax-sxmin) && dy1n < 0.01*(symax-symin)) closed = 1;
4557 if (sxmin == sxmax) {
4560 if (six > 1) ratio_signs = siy/six;
4561 else ratio_signs = 20;
4562 xratio = ratio_signs/(sxmax-sxmin);
4564 if (symin == symax) yratio = 1;
4565 else yratio = 1/(symax-symin);
4569 for (i=0;i<npoints;i++) {
4570 x[i] = (
x[i]-sxmin)*xratio;
4571 y[i] = (
y[i]-symin)*yratio;
4590 if (
x[0] !=
x[npoints-1] ||
y[0] !=
y[npoints-1])
goto L40;
4591 if (
x[npoints-2] ==
x[npoints-1] &&
y[npoints-2] ==
y[npoints-1])
goto L40;
4592 if (
x[0] ==
x[1] &&
y[0] ==
y[1])
goto L40;
4615 if (npt > 1)
goto L310;
4619 if (
x[k-1] ==
x[k-2] &&
y[k-1] ==
y[k-2])
goto L50;
4624 if (npt > 1)
goto L310;
4627 if (k < npoints)
goto L90;
4628 if (!flgic) { kp = 2;
goto L130;}
4631 if (flgis)
goto L150;
4641 if (
x[k-1] ==
x[k] &&
y[k-1] ==
y[k])
goto L80;
4649 if (!flgis)
goto L50;
4664 dx1 =
x[k-1] -
x[
km-1];
4665 dy1 =
y[k-1] -
y[
km-1];
4666 dk1 = dx1*dx1 + dy1*dy1;
4667 dx2 =
x[kp-1] -
x[k-1];
4668 dy2 =
y[kp-1] -
y[k-1];
4669 dk2 = dx2*dx2 + dy2*dy2;
4670 ctu = dx1*dk2 + dx2*dk1;
4671 stu = dy1*dk2 + dy2*dk1;
4672 xnt = ctu*ctu + stu*stu;
4686 if (flgis)
goto L160;
4690 w3 = 2*(dx1*dy2-dx2*dy1);
4702 w3 = 2*(dx1*dy2-dx2*dy1);
4711 if (k <= 1)
goto L120;
4741 xa = (
a*t-2*dx)/tcube;
4742 xb = (3*dx-(co+
a)*t)/tsquare;
4743 ya = (
b*t-2*dy)/tcube;
4744 yb = (3*dy-(so+
b)*t)/tsquare;
4775 p2 = (u1*tj-u3)*3*tj+u2;
4805 z =
s*sth*(
s-
s*sth)*(w1*sth+w1+w2);
4806 z = z*z/((
a*
a+
b*
b)*(delta*delta));
4807 z = (z+2.642937)*z/((.3715652*z+3.063444)*z+.2441889)-cc;
4811 if (iw > 0)
goto L250;
4812 if (z > err)
goto L240;
4817 if (iw+2 == 0)
goto L190;
4818 if (iw+2 > 0)
goto L290;
4836 theGraph->
Zero(kp,0,sb,err,
s,z,maxiterations);
4837 if (kp == 2)
goto L210;
4839 Error(
"Smooth",
"Attempt to plot outside plot limits");
4842 if (iw > 0)
goto L200;
4868 qlx[npt] = sxmin + xt/xratio;
4869 qly[npt] = symin + yt/yratio;
4876 if (npt < banksize)
goto L320;
4877 if (drawtype >= 1000 || ktype > 1) {
4878 Int_t newsize = banksize + n2;
4880 for (i=0;i<banksize;i++) qtemp[i] = qlx[i];
4883 for (i=0;i<banksize;i++) qlx[i] = qtemp[i];
4884 for (i=0;i<banksize;i++) qtemp[i] = qly[i];
4887 for (i=0;i<banksize;i++) qly[i] = qtemp[i];
4896 if (drawtype >= 1000) {
4897 gPad->PaintFillArea(npt,qlx,qly,
"B");
4901 qlx[npt] = qlx[npt-1];
4902 qlx[npt+1] = qlx[0];
4908 qly[npt] = qly[npt-1];
4909 qly[npt+1] = qly[0];
4911 gPad->PaintFillArea(npt+2,qlx,qly);
4914 gPad->PaintPolyLine(npt,qlx,qly);
4917 qlx[0] = sxmin + xt/xratio;
4918 qly[0] = symin + yt/yratio;
4920 if (finished > 0)
goto L390;
4921 if (finished < 0) { finished = 0;
goto L110;}
4922 if (
s > 0)
goto L180;
4928 for (i=0;i<npoints;i++) {
4929 x[i] = sxmin +
x[i]/xratio;
4930 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 TGraph is an 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)