202 if(contour<zmin || contour>zmax) {
203 Error(
"GetContourList",
"Contour level (%g) outside the Z scope [%g,%g]",
221 Int_t t[3],i,it,i0,i1,i2;
230 for (i=0;i<
fNdt;i++) {
243 for(it=0; it<
fNdt; it++) {
250 x0 =
fX[p0]; x2 =
fX[p0];
251 y0 =
fY[p0]; y2 =
fY[p0];
252 z0 =
fZ[p0]; z2 =
fZ[p0];
261 if (i0==0 && i2==0) {
262 Error(
"GetContourList",
"wrong vertices ordering");
281 if(contour >= z0 && contour <=z2) {
282 r20 = (contour-z0)/(z2-z0);
283 xs0c = r20*(x2-x0)+x0;
284 ys0c = r20*(y2-y0)+y0;
285 if(contour >= z1 && contour <=z2) {
286 r21 = (contour-z1)/(z2-z1);
287 xs1c = r21*(x2-
x1)+x1;
288 ys1c = r21*(y2-y1)+y1;
290 r10 = (contour-z0)/(z1-z0);
291 xs1c = r10*(x1-x0)+x0;
292 ys1c = r10*(y1-y0)+y0;
295 if(xs0c != xs1c || ys0c != ys1c) {
312 x0 =
fX[p[0]]; x2 =
fX[p[0]];
313 y0 =
fY[p[0]]; y2 =
fY[p[0]];
314 z0 =
fZ[p[0]]; z2 =
fZ[p[0]];
319 if (
fZ[p[1]]<=z0) {z0=
fZ[p[1]]; x0=
fX[p[1]]; y0=
fY[p[1]]; i0=1;}
320 if (
fZ[p[1]]>z2) {z2=
fZ[p[1]]; x2=
fX[p[1]]; y2=
fY[p[1]]; i2=1;}
321 if (
fZ[p[2]]<=z0) {z0=
fZ[p[2]]; x0=
fX[p[2]]; y0=
fY[p[2]]; i0=2;}
322 if (
fZ[p[2]]>z2) {z2=
fZ[p[2]]; x2=
fX[p[2]]; y2=
fY[p[2]]; i2=2;}
323 if (i0==0 && i2==0) {
324 Error(
"GetContourList",
"wrong vertices ordering");
343 if(contour >= z0 && contour <=z2) {
344 r20 = (contour-z0)/(z2-z0);
345 xs0c = r20*(x2-x0)+x0;
346 ys0c = r20*(y2-y0)+y0;
347 if(contour >= z1 && contour <=z2) {
348 r21 = (contour-z1)/(z2-z1);
349 xs1c = r21*(x2-
x1)+x1;
350 ys1c = r21*(y2-y1)+y1;
352 r10 = (contour-z0)/(z1-z0);
353 xs1c = r10*(x1-x0)+x0;
354 ys1c = r10*(y1-y0)+y0;
357 if(xs0c != xs1c || ys0c != ys1c) {
379 for (is=0; is<nbSeg; is++) {
380 if (segUsed[is])
continue;
385 for (js=0; js<nbSeg; js++) {
386 if (is==js)
continue;
387 if (xs0[is]==xs0[js] && ys0[is]==ys0[js]) s0 =
kTRUE;
388 if (xs0[is]==xs1[js] && ys0[is]==ys1[js]) s0 =
kTRUE;
389 if (xs1[is]==xs0[js] && ys1[is]==ys0[js]) s1 =
kTRUE;
390 if (xs1[is]==xs1[js] && ys1[is]==ys1[js]) s1 =
kTRUE;
397 graph->
SetPoint(npg,xs0[is],ys0[is]); npg++;
398 graph->
SetPoint(npg,xs1[is],ys1[is]); npg++;
400 list->
Add(graph); npg = 0;
409 if (s0) {xc = xs0[is]; yc = ys0[is]; xnc = xs1[is]; ync = ys1[is];}
410 if (s1) {xc = xs1[is]; yc = ys1[is]; xnc = xs0[is]; ync = ys0[is];}
411 graph->
SetPoint(npg,xnc,ync); npg++;
416 if (js < nbSeg && segUsed[js]) {
419 }
else if (xc==xs0[js] && yc==ys0[js]) {
423 }
else if (xc==xs1[js] && yc==ys1[js]) {
435 if (js<nbSeg)
goto L01;
436 list->
Add(graph); npg = 0;
443 for (is=0; is<nbSeg; is++) {
444 if (segUsed[is])
continue;
455 if (js < nbSeg && segUsed[js]) {
458 }
else if (xc==xs0[js] && yc==ys0[js]) {
462 }
else if (xc==xs1[js] && yc==ys1[js]) {
474 if (js<nbSeg)
goto L02;
476 graph->
SetPoint(npg,xs0[is],ys0[is]); npg++;
477 list->
Add(graph); npg = 0;
569 for (
Int_t k=0; k<ndiv; k++) {
573 while ((obj = next())) {
596 Error(
"PaintErrors",
"No TView in current pad");
614 temp1[0] =
fX[it]-
fEX[it];
624 view->
WCtoNDC(temp1, &temp2[0]);
628 temp1[0] =
fX[it]+fEX[it];
631 view->
WCtoNDC(temp1, &temp2[0]);
634 gPad->PaintPolyLine(2,xm,ym);
638 temp1[1] =
fY[it]-
fEY[it];
647 view->
WCtoNDC(temp1, &temp2[0]);
651 temp1[1] =
fY[it]+fEY[it];
654 view->
WCtoNDC(temp1, &temp2[0]);
657 gPad->PaintPolyLine(2,xm,ym);
662 temp1[2] =
fZ[it]-
fEZ[it];
670 view->
WCtoNDC(temp1, &temp2[0]);
674 temp1[2] =
fZ[it]+fEZ[it];
678 view->
WCtoNDC(temp1, &temp2[0]);
681 gPad->PaintPolyLine(2,xm,ym);
698 Int_t i, fillColor, ncolors, theColor0, theColor2;
718 if (zmin==-1111 && zmax==-1111) {
726 Int_t i0=0, i1=0, i2=0;
727 if (
fZ[p[1]]<=z0) {z0=
fZ[p[1]]; x0=x[1]; y0=y[1]; i0=1;}
728 if (
fZ[p[1]]>z2) {z2=
fZ[p[1]]; x2=x[1]; y2=y[1]; i2=1;}
729 if (
fZ[p[2]]<=z0) {z0=
fZ[p[2]]; x0=x[2]; y0=y[2]; i0=2;}
730 if (
fZ[p[2]]>z2) {z2=
fZ[p[2]]; x2=x[2]; y2=y[2]; i2=2;}
736 if (z0>zmax) z0 = zmax;
737 if (z2>zmax) z2 = zmax;
738 if (z0<zmin) z0 = zmin;
739 if (z2<zmin) z2 = zmin;
740 if (z1>zmax) z1 = zmax;
741 if (z1<zmin) z1 = zmin;
760 theColor0 = (
Int_t)( ((z0-zmin)/(zmax-zmin))*(ncolors-1) );
761 theColor2 = (
Int_t)( ((z2-zmin)/(zmax-zmin))*(ncolors-1) );
778 if(theColor0 == theColor2) {
781 gPad->PaintFillArea(3,x,y);
785 for(ci=theColor0; ci<=theColor2; ci++) {
789 zi = (((ci+1)*(zmax-zmin))/(ncolors-1))+zmin;
792 rl = (zi-z0)/(z2-z0);
793 xp[1] = rl*(x2-x0)+x0;
794 yp[1] = rl*(y2-y0)+y0;
795 if (zi>=z1 || z0==z1) {
796 rs = (zi-z1)/(z2-z1);
797 xp[2] = rs*(x2-
x1)+x1;
798 yp[2] = rs*(y2-y1)+y1;
803 rs = (zi-z0)/(z1-z0);
804 xp[2] = rs*(x1-x0)+x0;
805 yp[2] = rs*(y1-y0)+y0;
808 }
else if (ci==theColor2) {
813 if (zi<z1 || z2==z1) {
823 zi = (((ci+1)*(zmax-zmin))/(ncolors-1))+zmin;
826 rl = (zi-z0)/(z2-z0);
827 xp[1] = rl*(x2-x0)+x0;
828 yp[1] = rl*(y2-y0)+y0;
829 if ( zi>=z1 && zip<=z1) {
841 rs = (zi-z0)/(z1-z0);
842 xp[2] = rs*(x1-x0)+x0;
843 yp[2] = rs*(y1-y0)+y0;
845 rs = (zi-z1)/(z2-z1);
846 xp[2] = rs*(x2-
x1)+x1;
847 yp[2] = rs*(y2-y1)+y1;
852 gPad->PaintFillArea(npf,xp,yp);
862 for(i=0; i<nblev; i++){
864 if(zl >= z0 && zl <=z2) {
868 xl[0]=r20*(x2-x0)+x0;
869 yl[0]=r20*(y2-y0)+y0;
870 if(zl >= z1 && zl <=z2) {
871 xl[1]=r21*(x2-
x1)+x1;
872 yl[1]=r21*(y2-y1)+y1;
874 xl[1]=r10*(x1-x0)+x0;
875 yl[1]=r10*(y1-y0)+y0;
877 gPad->PaintPolyLine(2,xl,yl);
895 Error(
"PaintPolyMarker",
"No TView in current pad");
925 if (hzmincol==-1111 && hzmaxcol==-1111) {
937 Double_t Zeps = (hzmax-hzmin)*0.0001;
945 if(hzmin -
fZ[it] > Zeps ||
fZ[it] - hzmax > Zeps)
continue;
956 view->
WCtoNDC(temp1, &temp2[0]);
966 for (it=0; it<npd; it++) {
967 theColor = (
Int_t)( ((zm[it]-hzmincol)/(hzmaxcol-hzmincol))*(ncolors-1) );
970 gPad->PaintPolyMarker(1,&xm[it],&ym[it]);
978 gPad->PaintPolyMarker(npd,xm,ym);
995 Error(
"PaintPolyLine",
"No TView in current pad");
1023 view->
WCtoNDC(temp1, &temp2[0]);
1024 xm[npd - 1] = temp2[0];
1025 ym[npd - 1] = temp2[1];
1031 gPad->PaintPolyLine(npd,xm,ym);
1045 for (
Int_t i=0; i<
n; i++) {
1049 gPad->PaintPolyMarker(1,&x[i],&y[i]);
1053 gPad->PaintPolyMarker(1,&x[i],&y[i]);
1083 Error(
"PaintTriangles",
"No TView in current pad");
1099 if (!tri1 && !tri2 && !wire) {
1102 Double_t binLow = 0, binHigh = 0, binWidth = 0;
1107 if (!r0 || !r1)
return;
1111 binLow, binHigh, nbins, binWidth,
" ");
1116 binWidth = (binHigh-binLow)/nbins;
1121 for (
Int_t i = 0; i < nblev; ++i) glev[i] = binLow+i*binWidth;
1145 for (it=0; it<
fNdt; it++) {
1151 if ((cp >= 0) && (sp >= 0.)) {
1153 }
else if ((cp <= 0) && (sp >= 0.)) {
1156 }
else if ((cp <= 0) && (sp <= 0.)) {
1173 for (it=0; it<
fNdt; it++) {
1177 for (
Int_t k=0; k<3; k++) {
1180 temp1[0] =
fX[t[k]-1];
1181 temp1[1] =
fY[t[k]-1];
1182 temp1[2] =
fZ[t[k]-1];
1190 view->
WCtoNDC(temp1, &temp2[0]);
1197 if (!tri1 && !tri2 && !wire) {
1198 gPad->PaintFillArea(3,x,y);
1201 if (!tri2)
gPad->PaintPolyLine(4,x,y);
1210 gPad->PaintPolyMarker(3,x,y);
1222 if (glev)
delete [] glev;
1237 Error(
"PaintTriangles",
"No TView in current pad");
1253 if (!tri1 && !tri2 && !wire) {
1256 Double_t binLow = 0, binHigh = 0, binWidth = 0;
1261 if (!r0 || !r1)
return;
1265 binLow, binHigh, nbins, binWidth,
" ");
1270 binWidth = (binHigh-binLow)/nbins;
1275 for (
Int_t i = 0; i < nblev; ++i) glev[i] = binLow+i*binWidth;
1296 std::function<Double_t(Double_t, Double_t)> fDist;
1298 if ((cp >= 0) && (sp >= 0.)) {
1300 }
else if ((cp <= 0) && (sp >= 0.)) {
1303 }
else if ((cp <= 0) && (sp <= 0.)) {
1310 typedef std::pair<Double_t, TGraphDelaunay2D::Triangles::const_iterator> DistEntry;
1311 std::vector<DistEntry>
dist;
1314 Double_t xd = (face.x[0] + face.x[1] + face.x[2]) / 3;
1315 Double_t yd = (face.y[0] + face.y[1] + face.y[2]) / 3;
1317 dist.emplace_back(fDist(xd, yd), it);
1320 std::sort(dist.begin(), dist.end(),
1321 [&](
const DistEntry &
a,
const DistEntry &
b){
return !reverse ? (a.first <
b.first) : (
b.first < a .first); });
1331 for (
const auto & it : dist) {
1332 p[0] = it.second->idx[0];
1333 p[1] = it.second->idx[1];
1334 p[2] = it.second->idx[2];
1335 for (
Int_t k=0; k<3; k++) {
1338 temp1[0] =
fX[p[k]];
1339 temp1[1] =
fY[p[k]];
1340 temp1[2] =
fZ[p[k]];
1348 view->
WCtoNDC(temp1, &temp2[0]);
1355 if (!tri1 && !tri2 && !wire) {
1356 gPad->PaintFillArea(3,x,y);
1359 if (!tri2)
gPad->PaintPolyLine(4,x,y);
1368 gPad->PaintPolyMarker(3,x,y);
1379 if (glev)
delete [] glev;
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
double dist(Rotation3D const &r1, Rotation3D const &r2)
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...
TGraph2D * GetGraph2D() const
Int_t * fPTried
Equal to fDelaunay->fNdt.
Int_t GetFirst() const
Return first bin on the axis i.e.
Int_t GetNumberContours() const
Histogram option structure.
virtual void WCtoNDC(const Float_t *pw, Float_t *pn)=0
virtual Double_t * GetRmax()=0
virtual Double_t GetBinLowEdge(Int_t bin) const
Return low edge of bin.
virtual void SetContour(Int_t nlevels, const Double_t *levels=0)
Set the number and values of contour levels.
R__EXTERN TStyle * gStyle
int Logy
log scale in Y. Also set by histogram option
Int_t * GetNTried() const
static void Optimize(Double_t A1, Double_t A2, Int_t nold, Double_t &BinLow, Double_t &BinHigh, Int_t &nbins, Double_t &BWID, Option_t *option="")
Static function to compute reasonable axis limits.
Double_t GetXNmin() const
void PaintPolyLine(Option_t *option)
Paints the 2D graph as PaintPolyLine.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Double_t fXNmax
Equal to fDelaunay->fXNmin.
void PaintPolyMarker0(Int_t n, Double_t *x, Double_t *y)
Paints a circle at each vertex. Each circle background is white.
Double_t GetZmin() const
Returns the Z minimum.
void PaintLevels(Int_t *v, Double_t *x, Double_t *y, Int_t nblev=0, Double_t *glev=0)
Paints one triangle.
R__EXTERN Hoption_t Hoption
Short_t Min(Short_t a, Short_t b)
void ToLower()
Change string to lower-case.
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
Int_t * GetPTried() const
user specified contour levels
void Paint(Option_t *option)
Paint a TGraphDelaunay according to the value of "option":
int Logx
log scale in X. Also set by histogram option
virtual Width_t GetLineWidth() const
Return the line width.
Double_t GetMinimum() const
Double_t GetYNmax() const
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
virtual Style_t GetMarkerStyle() const
Return the marker style.
TGraphDelaunay2D * fDelaunay2D
virtual Style_t GetLineStyle() const
Return the line style.
virtual Int_t GetContour(Double_t *levels=0)
Return contour values into array levels if pointer levels is non zero.
static const double x2[5]
void PaintTriangles_new(Option_t *option)
Paints the 2D graph as triangles (new implementation)
virtual void Paint(Option_t *chopt="")
Draw this graph with its current attributes.
Double_t * fXN
Pointer to fGraph2D->fZ.
Int_t fNdt
Equal to fGraph2D->fNpoints.
TGraph2D * GetGraph2D() const
virtual Double_t * GetEY() const
Double_t * fY
Pointer to fGraph2D->fX.
Double_t * fYN
Pointer to fDelaunay->fXN.
Double_t GetXNmax() const
Double_t Log10(Double_t x)
static double p2(double t, double a, double b, double c)
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
Double_t GetXNmin() const
void Sort(Index n, const Element *a, Index *index, Bool_t down=kTRUE)
virtual Size_t GetMarkerSize() const
Return the marker size.
Double_t * fZ
Pointer to fGraph2D->fY.
Int_t GetColorPalette(Int_t i) const
Return color number i in current palette.
virtual Double_t * GetEZ() const
virtual Int_t GetNdivisions() const
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Double_t fYmax
fGraph2D->fHistogram limits
Int_t GetLast() const
Return last bin on the axis i.e.
Class to manage histogram axis.
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Triangles::const_iterator end() const
void PaintTriangles(Option_t *option)
Paints the 2D graph as triangles.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Double_t GetMaximum() const
Double_t fXNmin
Pointer to fGraph2D->fZE.
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
virtual Double_t GetContourLevelPad(Int_t level) const
Return the value of contour number "level" in Pad coordinates.
static double p1(double t, double a, double b)
void FindTriangles()
Find triangles in fDelaunay and initialise the TGraph2DPainter values needed to paint triangles or fi...
Triangles::const_iterator begin() const
Int_t GetNumberOfColors() const
Return number of colors in the color palette.
static constexpr double ms
virtual void SetMarkerSize(Size_t msize=1)
Set the marker size.
virtual Double_t * GetRmin()=0
virtual Double_t GetLongitude()=0
TGraph2DPainter()
TGraph2DPainter default constructor.
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 Double_t * GetEX() const
Double_t GetZmax() const
Returns the Z maximum.
virtual Color_t GetLineColor() const
Return the line color.
void PaintErrors(Option_t *option)
Paints the 2D graph as error bars.
Int_t * fNTried
Pointer to fDelaunay->fPTried.
static const double x1[5]
Double_t fYNmin
Equal to fDelaunay->fXNmax.
Double_t fYNmax
Equal to fDelaunay->fYNmin.
Double_t * fEX
Pointer to fDelaunay->fYN.
void PaintContour(Option_t *option)
Paints the 2D graph as a contour plot.
TGraphDelaunay * fDelaunay
Pointer to fDelaunay->fMTried.
virtual Color_t GetFillColor() const
Return the fill area color.
TGraphDelaunay2D generates a Delaunay triangulation of a TGraph2D.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
TList * GetContourList(Double_t contour)
Returns the X and Y graphs building a contour.
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
Int_t * GetMTried() const
Mother of all ROOT objects.
virtual Int_t FindFixBin(Double_t x) const
Find bin number corresponding to abscissa x.
virtual Double_t GetBinWidth(Int_t bin) const
Return bin width.
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
Int_t * fMTried
Pointer to fDelaunay->fNTried.
Double_t * fEY
Pointer to fGraph2D->fXE.
virtual void Add(TObject *obj)
void PaintTriangles_old(Option_t *option)
Paints the 2D graph as triangles (old implementation)
Short_t Max(Short_t a, Short_t b)
A Graph is a graphics object made of two arrays X and Y with npoints each.
void PaintPolyMarker(Option_t *option)
Paints the 2D graph as PaintPolyMarker.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
R__EXTERN TH1 * gCurrentHist
Double_t * fEZ
Pointer to fGraph2D->fYE.
The TGraphDelaunay painting class.
virtual Color_t GetMarkerColor() const
Return the marker color.
Double_t GetYNmin() const
virtual Style_t GetFillStyle() const
Return the fill area style.
void FindAllTriangles()
Attempt to find all the Delaunay triangles of the point set.
Double_t GetXNmax() const
int Logz
log scale in Z. Also set by histogram option
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
TGraphDelaunay generates a Delaunay triangulation of a TGraph2D.
Double_t fXmin
Equal to fDelaunay->fYNmax.
virtual ~TGraph2DPainter()
TGraph2DPainter destructor.
Double_t GetYNmin() const
Double_t GetYNmax() const
static constexpr double g