202 if(contour<zmin || contour>zmax) {
203 Error(
"GetContourList",
"Contour level (%g) outside the Z scope [%g,%g]",
220 Int_t t[3],i,it,i0,i1,i2;
229 for (i=0;i<
fNdt;i++) {
242 for(it=0; it<
fNdt; it++) {
250 y0 =
fY[p0]; y2 =
fY[p0];
251 z0 =
fZ[p0]; z2 =
fZ[p0];
256 if (
fZ[p1]<=z0) {z0=
fZ[p1]; x0=
fX[p1]; y0=
fY[p1]; i0=1;}
257 if (
fZ[p1]>z2) {z2=
fZ[p1];
x2=
fX[p1]; y2=
fY[p1]; i2=1;}
258 if (
fZ[p2]<=z0) {z0=
fZ[p2]; x0=
fX[p2]; y0=
fY[p2]; i0=2;}
259 if (
fZ[p2]>z2) {z2=
fZ[p2];
x2=
fX[p2]; y2=
fY[p2]; i2=2;}
260 if (i0==0 && i2==0) {
261 Error(
"GetContourList",
"wrong vertices ordering");
280 if(contour >= z0 && contour <=z2) {
281 r20 = (contour-z0)/(z2-z0);
282 xs0c = r20*(
x2-x0)+x0;
283 ys0c = r20*(y2-y0)+y0;
284 if(contour >= z1 && contour <=z2) {
285 r21 = (contour-z1)/(z2-z1);
287 ys1c = r21*(y2-y1)+y1;
289 r10 = (contour-z0)/(z1-z0);
290 xs1c = r10*(
x1-x0)+x0;
291 ys1c = r10*(y1-y0)+y0;
294 if(xs0c != xs1c || ys0c != ys1c) {
311 x0 =
fX[p[0]];
x2 =
fX[p[0]];
312 y0 =
fY[p[0]]; y2 =
fY[p[0]];
313 z0 =
fZ[p[0]]; z2 =
fZ[p[0]];
318 if (
fZ[p[1]]<=z0) {z0=
fZ[p[1]]; x0=
fX[p[1]]; y0=
fY[p[1]]; i0=1;}
319 if (
fZ[p[1]]>z2) {z2=
fZ[p[1]];
x2=
fX[p[1]]; y2=
fY[p[1]]; i2=1;}
320 if (
fZ[p[2]]<=z0) {z0=
fZ[p[2]]; x0=
fX[p[2]]; y0=
fY[p[2]]; i0=2;}
321 if (
fZ[p[2]]>z2) {z2=
fZ[p[2]];
x2=
fX[p[2]]; y2=
fY[p[2]]; i2=2;}
322 if (i0==0 && i2==0) {
323 Error(
"GetContourList",
"wrong vertices ordering");
342 if(contour >= z0 && contour <=z2) {
343 r20 = (contour-z0)/(z2-z0);
344 xs0c = r20*(
x2-x0)+x0;
345 ys0c = r20*(y2-y0)+y0;
346 if(contour >= z1 && contour <=z2) {
347 r21 = (contour-z1)/(z2-z1);
349 ys1c = r21*(y2-y1)+y1;
351 r10 = (contour-z0)/(z1-z0);
352 xs1c = r10*(
x1-x0)+x0;
353 ys1c = r10*(y1-y0)+y0;
356 if(xs0c != xs1c || ys0c != ys1c) {
380 for (is=0; is<nbSeg; is++) {
381 if (segUsed[is])
continue;
386 for (js=0; js<nbSeg; js++) {
387 if (is==js)
continue;
388 if (xs0[is]==xs0[js] && ys0[is]==ys0[js])
s0 =
kTRUE;
389 if (xs0[is]==xs1[js] && ys0[is]==ys1[js])
s0 =
kTRUE;
390 if (xs1[is]==xs0[js] && ys1[is]==ys0[js])
s1 =
kTRUE;
391 if (xs1[is]==xs1[js] && ys1[is]==ys1[js])
s1 =
kTRUE;
398 graph->SetPoint(npg,xs0[is],ys0[is]); npg++;
399 graph->SetPoint(npg,xs1[is],ys1[is]); npg++;
410 if (
s0) {xc = xs0[is]; yc = ys0[is]; xnc = xs1[is]; ync = ys1[is];}
411 if (
s1) {xc = xs1[is]; yc = ys1[is]; xnc = xs0[is]; ync = ys0[is];}
412 graph->SetPoint(npg,xnc,ync); npg++;
417 if (js < nbSeg && segUsed[js]) {
420 }
else if (xc==xs0[js] && yc==ys0[js]) {
424 }
else if (xc==xs1[js] && yc==ys1[js]) {
431 graph->SetPoint(npg,xc,yc); npg++;
436 if (js<nbSeg)
goto L01;
444 for (is=0; is<nbSeg; is++) {
445 if (segUsed[is])
continue;
453 graph->SetPoint(npg,xc,yc); npg++;
456 if (js < nbSeg && segUsed[js]) {
459 }
else if (xc==xs0[js] && yc==ys0[js]) {
463 }
else if (xc==xs1[js] && yc==ys1[js]) {
470 graph->SetPoint(npg,xc,yc); npg++;
475 if (js<nbSeg)
goto L02;
477 graph->SetPoint(npg,xs0[is],ys0[is]); npg++;
570 for (
Int_t k=0; k<ndiv; k++) {
574 while ((obj = next())) {
584 if (
l) {
l->Delete();
delete l; }
598 Error(
"PaintErrors",
"No TView in current pad");
616 temp1[0] =
fX[it]-
fEX[it];
626 view->
WCtoNDC(temp1, &temp2[0]);
630 temp1[0] =
fX[it]+
fEX[it];
633 view->
WCtoNDC(temp1, &temp2[0]);
636 gPad->PaintPolyLine(2,xm,ym);
640 temp1[1] =
fY[it]-
fEY[it];
649 view->
WCtoNDC(temp1, &temp2[0]);
653 temp1[1] =
fY[it]+
fEY[it];
656 view->
WCtoNDC(temp1, &temp2[0]);
659 gPad->PaintPolyLine(2,xm,ym);
664 temp1[2] =
fZ[it]-
fEZ[it];
672 view->
WCtoNDC(temp1, &temp2[0]);
676 temp1[2] =
fZ[it]+
fEZ[it];
680 view->
WCtoNDC(temp1, &temp2[0]);
683 gPad->PaintPolyLine(2,xm,ym);
700 Int_t i, fillColor, ncolors, theColor0, theColor2;
720 if (zmin==-1111 && zmax==-1111) {
728 Int_t i0=0, i1=0, i2=0;
729 if (
fZ[p[1]]<=z0) {z0=
fZ[p[1]]; x0=
x[1]; y0=
y[1]; i0=1;}
730 if (
fZ[p[1]]>z2) {z2=
fZ[p[1]];
x2=
x[1]; y2=
y[1]; i2=1;}
731 if (
fZ[p[2]]<=z0) {z0=
fZ[p[2]]; x0=
x[2]; y0=
y[2]; i0=2;}
732 if (
fZ[p[2]]>z2) {z2=
fZ[p[2]];
x2=
x[2]; y2=
y[2]; i2=2;}
738 if (z0>zmax) z0 = zmax;
739 if (z2>zmax) z2 = zmax;
740 if (z0<zmin) z0 = zmin;
741 if (z2<zmin) z2 = zmin;
742 if (z1>zmax) z1 = zmax;
743 if (z1<zmin) z1 = zmin;
762 theColor0 = (
Int_t)( ((z0-zmin)/(zmax-zmin))*(ncolors-1) );
763 theColor2 = (
Int_t)( ((z2-zmin)/(zmax-zmin))*(ncolors-1) );
780 if(theColor0 == theColor2) {
783 gPad->PaintFillArea(3,
x,
y);
787 for(ci=theColor0; ci<=theColor2; ci++) {
791 zi = (((ci+1)*(zmax-zmin))/(ncolors-1))+zmin;
794 rl = (zi-z0)/(z2-z0);
795 xp[1] = rl*(
x2-x0)+x0;
796 yp[1] = rl*(y2-y0)+y0;
797 if (zi>=z1 || z0==z1) {
798 rs = (zi-z1)/(z2-z1);
800 yp[2] = rs*(y2-y1)+y1;
805 rs = (zi-z0)/(z1-z0);
806 xp[2] = rs*(
x1-x0)+x0;
807 yp[2] = rs*(y1-y0)+y0;
810 }
else if (ci==theColor2) {
815 if (zi<z1 || z2==z1) {
825 zi = (((ci+1)*(zmax-zmin))/(ncolors-1))+zmin;
828 rl = (zi-z0)/(z2-z0);
829 xp[1] = rl*(
x2-x0)+x0;
830 yp[1] = rl*(y2-y0)+y0;
831 if ( zi>=z1 && zip<=z1) {
843 rs = (zi-z0)/(z1-z0);
844 xp[2] = rs*(
x1-x0)+x0;
845 yp[2] = rs*(y1-y0)+y0;
847 rs = (zi-z1)/(z2-z1);
849 yp[2] = rs*(y2-y1)+y1;
854 gPad->PaintFillArea(npf,xp,yp);
864 for(i=0; i<nblev; i++){
866 if(zl >= z0 && zl <=z2) {
870 xl[0]=r20*(
x2-x0)+x0;
871 yl[0]=r20*(y2-y0)+y0;
872 if(zl >= z1 && zl <=z2) {
874 yl[1]=r21*(y2-y1)+y1;
876 xl[1]=r10*(
x1-x0)+x0;
877 yl[1]=r10*(y1-y0)+y0;
879 gPad->PaintPolyLine(2,xl,yl);
897 Error(
"PaintPolyMarker",
"No TView in current pad");
927 if (hzmincol==-1111 && hzmaxcol==-1111) {
939 Double_t Zeps = (hzmax-hzmin)*0.0001;
947 if(hzmin -
fZ[it] > Zeps ||
fZ[it] - hzmax > Zeps)
continue;
958 view->
WCtoNDC(temp1, &temp2[0]);
968 for (it=0; it<npd; it++) {
969 theColor = (
Int_t)( ((zm[it]-hzmincol)/(hzmaxcol-hzmincol))*(ncolors-1) );
972 gPad->PaintPolyMarker(1,&xm[it],&ym[it]);
980 gPad->PaintPolyMarker(npd,xm,ym);
997 Error(
"PaintPolyLine",
"No TView in current pad");
1025 view->
WCtoNDC(temp1, &temp2[0]);
1026 xm[npd - 1] = temp2[0];
1027 ym[npd - 1] = temp2[1];
1033 gPad->PaintPolyLine(npd,xm,ym);
1047 for (
Int_t i=0; i<
n; i++) {
1051 gPad->PaintPolyMarker(1,&
x[i],&
y[i]);
1055 gPad->PaintPolyMarker(1,&
x[i],&
y[i]);
1085 Error(
"PaintTriangles",
"No TView in current pad");
1101 if (!tri1 && !tri2 && !wire) {
1104 Double_t binLow = 0, binHigh = 0, binWidth = 0;
1109 if (!r0 || !r1)
return;
1113 binLow, binHigh, nbins, binWidth,
" ");
1118 binWidth = (binHigh-binLow)/nbins;
1123 for (
Int_t i = 0; i < nblev; ++i) glev[i] = binLow+i*binWidth;
1147 for (it=0; it<
fNdt; it++) {
1153 if ((cp >= 0) && (sp >= 0.)) {
1155 }
else if ((cp <= 0) && (sp >= 0.)) {
1158 }
else if ((cp <= 0) && (sp <= 0.)) {
1175 for (it=0; it<
fNdt; it++) {
1179 for (
Int_t k=0; k<3; k++) {
1182 temp1[0] =
fX[t[k]-1];
1183 temp1[1] =
fY[t[k]-1];
1184 temp1[2] =
fZ[t[k]-1];
1192 view->
WCtoNDC(temp1, &temp2[0]);
1199 if (!tri1 && !tri2 && !wire) {
1200 gPad->PaintFillArea(3,
x,
y);
1203 if (!tri2)
gPad->PaintPolyLine(4,
x,
y);
1212 gPad->PaintPolyMarker(3,
x,
y);
1224 if (glev)
delete [] glev;
1239 Error(
"PaintTriangles",
"No TView in current pad");
1255 if (!tri1 && !tri2 && !wire) {
1258 Double_t binLow = 0, binHigh = 0, binWidth = 0;
1263 if (!r0 || !r1)
return;
1267 binLow, binHigh, nbins, binWidth,
" ");
1272 binWidth = (binHigh-binLow)/nbins;
1277 for (
Int_t i = 0; i < nblev; ++i) glev[i] = binLow+i*binWidth;
1300 if ((cp >= 0) && (sp >= 0.)) {
1302 }
else if ((cp <= 0) && (sp >= 0.)) {
1305 }
else if ((cp <= 0) && (sp <= 0.)) {
1312 typedef std::pair<Double_t, TGraphDelaunay2D::Triangles::const_iterator> DistEntry;
1313 std::vector<DistEntry>
dist;
1316 Double_t xd = (face.x[0] + face.x[1] + face.x[2]) / 3;
1317 Double_t yd = (face.y[0] + face.y[1] + face.y[2]) / 3;
1319 dist.emplace_back(fDist(xd, yd), it);
1322 std::sort(
dist.begin(),
dist.end(),
1323 [&](
const DistEntry &
a,
const DistEntry &
b){ return !reverse ? (a.first < b.first) : (b.first < a .first); });
1333 for (
const auto & it :
dist) {
1334 p[0] = it.second->idx[0];
1335 p[1] = it.second->idx[1];
1336 p[2] = it.second->idx[2];
1337 for (
Int_t k=0; k<3; k++) {
1340 temp1[0] =
fX[p[k]];
1341 temp1[1] =
fY[p[k]];
1342 temp1[2] =
fZ[p[k]];
1350 view->
WCtoNDC(temp1, &temp2[0]);
1357 if (!tri1 && !tri2 && !wire) {
1358 gPad->PaintFillArea(3,
x,
y);
1361 if (!tri2)
gPad->PaintPolyLine(4,
x,
y);
1370 gPad->PaintPolyMarker(3,
x,
y);
1381 if (glev)
delete [] glev;
static const double x2[5]
static const double x1[5]
R__EXTERN TH1 * gCurrentHist
R__EXTERN Hoption_t Hoption
R__EXTERN TStyle * gStyle
virtual Int_t GetNdivisions() const
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 SetLineWidth(Width_t lwidth)
Set 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.
Class to manage histogram axis.
virtual Double_t GetBinLowEdge(Int_t bin) const
Return low edge of bin.
virtual Int_t FindFixBin(Double_t x) const
Find bin number corresponding to abscissa x.
Int_t GetLast() const
Return last bin on the axis i.e.
virtual Double_t GetBinWidth(Int_t bin) const
Return bin width.
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
Int_t GetFirst() const
Return first bin on the axis i.e.
The TGraphDelaunay painting class.
void PaintContour(Option_t *option)
Paints the 2D graph as a contour plot.
void Paint(Option_t *option)
Paint a TGraphDelaunay according to the value of "option":
Int_t * fNTried
Pointer to fDelaunay->fPTried.
Double_t * fYN
Pointer to fDelaunay->fXN.
TGraphDelaunay * fDelaunay
Pointer to fDelaunay->fMTried.
Double_t * fZ
Pointer to fGraph2D->fY.
TGraphDelaunay2D * fDelaunay2D
Pointer to the TGraphDelaunay2D to be painted.
virtual ~TGraph2DPainter()
TGraph2DPainter destructor.
TGraph2D * fGraph2D
Pointer to the TGraphDelaunay2D to be painted.
void PaintErrors(Option_t *option)
Paints the 2D graph as error bars.
Double_t * fXN
Pointer to fGraph2D->fZ.
Int_t * fMTried
Pointer to fDelaunay->fNTried.
void FindTriangles()
Pointer to the TGraph2D in fDelaunay.
Int_t * fPTried
Equal to fDelaunay->fNdt.
Double_t fXNmin
Pointer to fGraph2D->fZE.
void PaintLevels(Int_t *v, Double_t *x, Double_t *y, Int_t nblev=0, Double_t *glev=0)
Paints one triangle.
Int_t fNdt
Equal to fGraph2D->fNpoints.
Double_t * fEZ
Pointer to fGraph2D->fYE.
TList * GetContourList(Double_t contour)
Returns the X and Y graphs building a contour.
Double_t fYmax
fGraph2D->fHistogram limits
void PaintPolyMarker0(Int_t n, Double_t *x, Double_t *y)
Paints a circle at each vertex. Each circle background is white.
void PaintTriangles(Option_t *option)
Paints the 2D graph as triangles.
void PaintPolyMarker(Option_t *option)
Paints the 2D graph as PaintPolyMarker.
Double_t * fY
Pointer to fGraph2D->fX.
Double_t fYNmin
Equal to fDelaunay->fXNmax.
Double_t * fEY
Pointer to fGraph2D->fXE.
void PaintPolyLine(Option_t *option)
Paints the 2D graph as PaintPolyLine.
TGraph2DPainter()
TGraph2DPainter default constructor.
void PaintTriangles_old(Option_t *option)
Paints the 2D graph as triangles (old implementation)
Double_t fYNmax
Equal to fDelaunay->fYNmin.
Double_t fXmin
Equal to fDelaunay->fYNmax.
Double_t * fEX
Pointer to fDelaunay->fYN.
Double_t fXNmax
Equal to fDelaunay->fXNmin.
void PaintTriangles_new(Option_t *option)
Paints the 2D graph as triangles (new implementation)
Double_t GetMaximum() const
virtual Double_t GetZminE() const
Double_t GetMinimum() const
virtual Double_t GetZmaxE() const
virtual Double_t * GetEZ() const
Double_t GetZmax() const
Returns the Z maximum.
virtual Double_t * GetEY() const
virtual Double_t * GetEX() const
TGraphDelaunay2D generates a Delaunay triangulation of a TGraph2D.
Triangles::const_iterator begin() const
Double_t GetXNmax() const
TGraph2D * GetGraph2D() const
Triangles::const_iterator end() const
Double_t GetXNmin() const
Double_t GetYNmax() const
Double_t GetYNmin() const
TGraphDelaunay generates a Delaunay triangulation of a TGraph2D.
Double_t GetYNmax() const
Int_t * GetMTried() const
Double_t GetXNmin() const
TGraph2D * GetGraph2D() const
Double_t GetXNmax() const
void FindAllTriangles()
Attempt to find all the Delaunay triangles of the point set.
Int_t * GetPTried() const
Int_t * GetNTried() const
Double_t GetYNmin() const
A TGraph is an object made of two arrays X and Y with npoints each.
virtual Double_t GetContourLevelPad(Int_t level) const
Return the value of contour number "level" in Pad coordinates.
@ kUserContour
user specified contour levels
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 SetContour(Int_t nlevels, const Double_t *levels=0)
Set the number and values of contour levels.
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 Int_t GetContour(Double_t *levels=0)
Return contour values into array levels if pointer levels is non zero.
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.
virtual void Add(TObject *obj)
Mother of all ROOT objects.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
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.
void ToLower()
Change string to lower-case.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Int_t GetColorPalette(Int_t i) const
Return color number i in current palette.
Int_t GetNumberOfColors() const
Return number of colors in the color palette.
Int_t GetNumberContours() const
virtual Double_t * GetRmax()=0
virtual Double_t * GetRmin()=0
virtual Double_t GetLongitude()=0
virtual void WCtoNDC(const Float_t *pw, Float_t *pn)=0
double dist(Rotation3D const &r1, Rotation3D const &r2)
void function(const Char_t *name_, T fun, const Char_t *docstring=0)
static constexpr double ms
Short_t Max(Short_t a, Short_t b)
Short_t Min(Short_t a, Short_t b)
void Sort(Index n, const Element *a, Index *index, Bool_t down=kTRUE)
Double_t Log10(Double_t x)
Histogram option structure.
int Logx
log scale in X. Also set by histogram option
int Logz
log scale in Z. Also set by histogram option
int Logy
log scale in Y. Also set by histogram option