226 if(contour<zmin || contour>zmax) {
227 Error(
"GetContourList",
"Contour level (%g) outside the Z scope [%g,%g]",
244 Int_t t[3],i,it,i0,i1,i2;
249 std::vector<Double_t> xs0(
fNdt);
250 std::vector<Double_t> ys0(
fNdt);
251 std::vector<Double_t> xs1(
fNdt);
252 std::vector<Double_t> ys1(
fNdt);
253 for (i=0;i<
fNdt;i++) {
266 for(it=0; it<
fNdt; it++) {
275 z0 =
fZ[p0]; z2 =
fZ[p0];
280 if (
fZ[p1]<=z0) {z0=
fZ[p1]; x0=
fX[p1]; y0=
fY[p1]; i0=1;}
282 if (
fZ[p2]<=z0) {z0=
fZ[p2]; x0=
fX[p2]; y0=
fY[p2]; i0=2;}
284 if (i0==0 && i2==0) {
285 Error(
"GetContourList",
"wrong vertices ordering");
302 xs0c = r20*(
x2-x0)+x0;
303 ys0c = r20*(
y2-y0)+y0;
310 xs1c = r10*(
x1-x0)+x0;
311 ys1c = r10*(
y1-y0)+y0;
314 if(xs0c != xs1c || ys0c != ys1c) {
333 z0 =
fZ[
p[0]]; z2 =
fZ[
p[0]];
338 if (
fZ[
p[1]]<=z0) {z0=
fZ[
p[1]]; x0=
fX[
p[1]]; y0=
fY[
p[1]]; i0=1;}
340 if (
fZ[
p[2]]<=z0) {z0=
fZ[
p[2]]; x0=
fX[
p[2]]; y0=
fY[
p[2]]; i0=2;}
342 if (i0==0 && i2==0) {
343 Error(
"GetContourList",
"wrong vertices ordering");
360 xs0c = r20*(
x2-x0)+x0;
361 ys0c = r20*(
y2-y0)+y0;
368 xs1c = r10*(
x1-x0)+x0;
369 ys1c = r10*(
y1-y0)+y0;
372 if(xs0c != xs1c || ys0c != ys1c) {
385 std::vector<Bool_t> segUsed(
fNdt);
396 for (is=0; is<nbSeg; is++) {
397 if (segUsed[is])
continue;
402 for (js=0; js<nbSeg; js++) {
403 if (is==js)
continue;
404 if (xs0[is]==xs0[js] && ys0[is]==ys0[js])
s0 =
kTRUE;
405 if (xs0[is]==xs1[js] && ys0[is]==ys1[js])
s0 =
kTRUE;
406 if (xs1[is]==xs0[js] && ys1[is]==ys0[js])
s1 =
kTRUE;
407 if (xs1[is]==xs1[js] && ys1[is]==ys1[js])
s1 =
kTRUE;
414 graph->SetPoint(npg,xs0[is],ys0[is]); npg++;
415 graph->SetPoint(npg,xs1[is],ys1[is]); npg++;
426 if (
s0) {xc = xs0[is]; yc = ys0[is]; xnc = xs1[is]; ync = ys1[is];}
427 if (
s1) {xc = xs1[is]; yc = ys1[is]; xnc = xs0[is]; ync = ys0[is];}
428 graph->SetPoint(npg,xnc,ync); npg++;
433 if (js < nbSeg && segUsed[js]) {
436 }
else if (xc==xs0[js] && yc==ys0[js]) {
440 }
else if (xc==xs1[js] && yc==ys1[js]) {
447 graph->SetPoint(npg,xc,yc); npg++;
452 if (js<nbSeg)
goto L01;
460 for (is=0; is<nbSeg; is++) {
461 if (segUsed[is])
continue;
469 graph->SetPoint(npg,xc,yc); npg++;
472 if (js < nbSeg && segUsed[js]) {
475 }
else if (xc==xs0[js] && yc==ys0[js]) {
479 }
else if (xc==xs1[js] && yc==ys1[js]) {
486 graph->SetPoint(npg,xc,yc); npg++;
491 if (js<nbSeg)
goto L02;
493 graph->SetPoint(npg,xs0[is],ys0[is]); npg++;
575 for (
Int_t k=0; k<ndiv; k++) {
579 while (
auto obj = next()) {
603 Error(
"PaintErrors",
"No TView in current pad");
623 temp1[0] =
fX[it]-err;
633 view->
WCtoNDC(temp1, &temp2[0]);
638 temp1[0] =
fX[it]+err;
641 view->
WCtoNDC(temp1, &temp2[0]);
644 gPad->PaintPolyLine(2,xm,ym);
649 temp1[1] =
fY[it]-err;
658 view->
WCtoNDC(temp1, &temp2[0]);
663 temp1[1] =
fY[it]+err;
666 view->
WCtoNDC(temp1, &temp2[0]);
669 gPad->PaintPolyLine(2,xm,ym);
675 temp1[2] =
fZ[it]-err;
683 view->
WCtoNDC(temp1, &temp2[0]);
688 temp1[2] =
fZ[it]+err;
692 view->
WCtoNDC(temp1, &temp2[0]);
695 gPad->PaintPolyLine(2,xm,ym);
709 Int_t i, fillColor, ncolors, theColor0, theColor2;
729 if (zmin==-1111 && zmax==-1111) {
737 Int_t i0=0, i1=0, i2=0;
738 if (
fZ[
p[1]]<=z0) {z0=
fZ[
p[1]]; x0=
x[1]; y0=
y[1]; i0=1;}
740 if (
fZ[
p[2]]<=z0) {z0=
fZ[
p[2]]; x0=
x[2]; y0=
y[2]; i0=2;}
747 if (z0>zmax) z0 = zmax;
748 if (z2>zmax) z2 = zmax;
749 if (z0<zmin) z0 = zmin;
750 if (z2<zmin) z2 = zmin;
751 if (z1>zmax) z1 = zmax;
752 if (z1<zmin) z1 = zmin;
771 theColor0 = (
Int_t)( ((z0-zmin)/(zmax-zmin))*(ncolors-1) );
772 theColor2 = (
Int_t)( ((z2-zmin)/(zmax-zmin))*(ncolors-1) );
789 if(theColor0 == theColor2) {
792 gPad->PaintFillArea(3,
x,
y);
796 for(ci=theColor0; ci<=theColor2; ci++) {
800 zi = (((ci+1)*(zmax-zmin))/(ncolors-1))+zmin;
803 rl = (zi-z0)/(z2-z0);
804 xp[1] = rl*(
x2-x0)+x0;
805 yp[1] = rl*(
y2-y0)+y0;
806 if (zi>=z1 || z0==z1) {
807 rs = (zi-z1)/(z2-z1);
814 rs = (zi-z0)/(z1-z0);
815 xp[2] = rs*(
x1-x0)+x0;
816 yp[2] = rs*(
y1-y0)+y0;
819 }
else if (ci==theColor2) {
824 if (zi<z1 || z2==z1) {
834 zi = (((ci+1)*(zmax-zmin))/(ncolors-1))+zmin;
837 rl = (zi-z0)/(z2-z0);
838 xp[1] = rl*(
x2-x0)+x0;
839 yp[1] = rl*(
y2-y0)+y0;
840 if ( zi>=z1 && zip<=z1) {
852 rs = (zi-z0)/(z1-z0);
853 xp[2] = rs*(
x1-x0)+x0;
854 yp[2] = rs*(
y1-y0)+y0;
856 rs = (zi-z1)/(z2-z1);
863 gPad->PaintFillArea(npf,xp,yp);
873 for(i=0; i<nblev; i++){
875 if(zl >= z0 && zl <=z2) {
879 xl[0]=r20*(
x2-x0)+x0;
880 yl[0]=r20*(
y2-y0)+y0;
881 if(zl >= z1 && zl <=z2) {
885 xl[1]=r10*(
x1-x0)+x0;
886 yl[1]=r10*(
y1-y0)+y0;
888 gPad->PaintPolyLine(2,xl,yl);
906 Error(
"PaintPolyMarker",
"No TView in current pad");
936 if (hzmincol==-1111 && hzmaxcol==-1111) {
948 Double_t Zeps = (hzmax-hzmin)*0.0001;
956 if(hzmin -
fZ[it] > Zeps ||
fZ[it] - hzmax > Zeps)
continue;
967 view->
WCtoNDC(temp1, &temp2[0]);
977 for (it=0; it<npd; it++) {
978 theColor = (
Int_t)( ((zm[it]-hzmincol)/(hzmaxcol-hzmincol))*(ncolors-1) );
981 gPad->PaintPolyMarker(1,xm.data()+it,ym.data()+it);
989 gPad->PaintPolyMarker(npd,xm.data(),ym.data());
1003 Error(
"PaintPolyLine",
"No TView in current pad");
1011 std::vector<Double_t> xm(
fNpoints);
1012 std::vector<Double_t> ym(
fNpoints);
1031 view->
WCtoNDC(temp1, &temp2[0]);
1032 xm[npd - 1] = temp2[0];
1033 ym[npd - 1] = temp2[1];
1039 gPad->PaintPolyLine(npd,xm.data(),ym.data());
1051 for (
Int_t i=0; i<
n; i++) {
1055 gPad->PaintPolyMarker(1,&
x[i],&
y[i]);
1059 gPad->PaintPolyMarker(1,&
x[i],&
y[i]);
1084 std::vector<Int_t> order;
1085 std::vector<Double_t> dist;
1089 Error(
"PaintTriangles",
"No TView in current pad");
1104 std::vector<Double_t> glev;
1105 if (!tri1 && !tri2 && !wire) {
1108 Double_t binLow = 0, binHigh = 0, binWidth = 0;
1113 if (!r0 || !r1)
return;
1117 binLow, binHigh, nbins, binWidth,
" ");
1122 binWidth = (binHigh-binLow)/nbins;
1127 for (
Int_t i = 0; i < nblev; ++i) glev[i] = binLow+i*binWidth;
1151 for (it=0; it<
fNdt; it++) {
1157 if ((cp >= 0) && (sp >= 0.)) {
1159 }
else if ((cp <= 0) && (sp >= 0.)) {
1162 }
else if ((cp <= 0) && (sp <= 0.)) {
1179 for (it=0; it<
fNdt; it++) {
1183 for (
Int_t k=0; k<3; k++) {
1186 temp1[0] =
fX[t[k]-1];
1187 temp1[1] =
fY[t[k]-1];
1188 temp1[2] =
fZ[t[k]-1];
1196 view->
WCtoNDC(temp1, &temp2[0]);
1203 if (!tri1 && !tri2 && !wire) {
1204 gPad->PaintFillArea(3,
x,
y);
1207 if (!tri2)
gPad->PaintPolyLine(4,
x,
y);
1216 gPad->PaintPolyMarker(3,
x,
y);
1240 Error(
"PaintTriangles",
"No TView in current pad");
1255 std::vector<Double_t> glev;
1256 if (!tri1 && !tri2 && !wire) {
1259 Double_t binLow = 0, binHigh = 0, binWidth = 0;
1264 if (!r0 || !r1)
return;
1268 binLow, binHigh, nbins, binWidth,
" ");
1273 binWidth = (binHigh-binLow)/nbins;
1278 for (
Int_t i = 0; i < nblev; ++i) glev[i] = binLow+i*binWidth;
1301 if ((cp >= 0) && (sp >= 0.)) {
1303 }
else if ((cp <= 0) && (sp >= 0.)) {
1306 }
else if ((cp <= 0) && (sp <= 0.)) {
1313 typedef std::pair<Double_t, TGraphDelaunay2D::Triangles::const_iterator> DistEntry;
1314 std::vector<DistEntry> dist;
1317 Double_t xd = (face.x[0] + face.x[1] + face.x[2]) / 3;
1318 Double_t yd = (face.y[0] + face.y[1] + face.y[2]) / 3;
1320 dist.emplace_back(fDist(xd, yd), it);
1323 std::sort(dist.begin(), dist.end(),
1324 [&](
const DistEntry &
a,
const DistEntry &
b){ return !reverse ? (a.first < b.first) : (b.first < a .first); });
1334 for (
const auto & it : dist) {
1335 p[0] = it.second->idx[0];
1336 p[1] = it.second->idx[1];
1337 p[2] = it.second->idx[2];
1338 for (
Int_t k=0; k<3; k++) {
1341 temp1[0] =
fX[
p[k]];
1342 temp1[1] =
fY[
p[k]];
1343 temp1[2] =
fZ[
p[k]];
1351 view->
WCtoNDC(temp1, &temp2[0]);
1358 if (!tri1 && !tri2 && !wire) {
1359 gPad->PaintFillArea(3,
x,
y);
1362 if (!tri2)
gPad->PaintPolyLine(4,
x,
y);
1371 gPad->PaintPolyMarker(3,
x,
y);
RooPlot * contour(RooRealVar &var1, RooRealVar &var2, double n1=1, double n2=2, double n3=0.0, double n4=0.0, double n5=0.0, double n6=0.0)
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize fs
Option_t Option_t TPoint TPoint const char y1
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.
Int_t * fNTried
! Pointer to fDelaunay->fNTried
Double_t * fYN
! Pointer to fDelaunay->fYN
TGraphDelaunay * fDelaunay
! Pointer to the TGraphDelaunay2D to be painted
void Paint(Option_t *option) override
Paint a TGraphDelaunay according to the value of "option":
Double_t fYmin
! fGraph2D->fHistogram Ymin
Double_t * fZ
! Pointer to fGraph2D->fZ
void PaintLevels(Int_t *v, Double_t *x, Double_t *y, Int_t nblev=0, Double_t *glev=nullptr)
Paints one triangle.
TGraphDelaunay2D * fDelaunay2D
! Pointer to the TGraphDelaunay2D to be painted
TGraph2D * fGraph2D
! Pointer to the TGraph2D in fDelaunay
void PaintErrors(Option_t *option)
Paints the 2D graph as error bars.
Double_t * fXN
! Pointer to fDelaunay->fXN
Int_t * fMTried
! Pointer to fDelaunay->fMTried
void FindTriangles()
Find triangles in fDelaunay and initialise the TGraph2DPainter values needed to paint triangles or fi...
Int_t * fPTried
! Pointer to fDelaunay->fPTried
Double_t fXNmin
! Equal to fDelaunay->fXNmin
Double_t fXmax
! fGraph2D->fHistogram Xmax
Double_t * fEZhigh
! Pointer to fGraph2D->fZEhigh
Int_t fNpoints
! Equal to fGraph2D->fNpoints
Double_t fZmin
! fGraph2D->fHistogram Zmin
Int_t fNdt
! Equal to fDelaunay->fNdt
Double_t * fEYlow
! Pointer to fGraph2D->fYElow
TList * GetContourList(Double_t contour)
Returns the X and Y graphs building a contour.
Double_t * fX
! Pointer to fGraph2D->fX
Double_t fYmax
! fGraph2D->fHistogram Ymax
Double_t * fEXhigh
! Pointer to fGraph2D->fXEhigh
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->fY
Double_t fYNmin
! Equal to fDelaunay->fYNmin
Double_t * fEXlow
! Pointer to fGraph2D->fXElow
void PaintPolyLine(Option_t *option)
Paints the 2D graph as PaintPolyLine.
Double_t * fEYhigh
! Pointer to fGraph2D->fYEhigh
TGraph2DPainter()
TGraph2DPainter default constructor.
Double_t fZmax
! fGraph2D->fHistogram Zmax
void PaintTriangles_old(Option_t *option)
Paints the 2D graph as triangles (old implementation)
~TGraph2DPainter() override
TGraph2DPainter destructor.
Double_t fYNmax
! Equal to fDelaunay->fYNmax
Double_t * fEZlow
! Pointer to fGraph2D->fZElow
Double_t fXmin
! fGraph2D->fHistogram Xmin
Double_t fXNmax
! Equal to fDelaunay->fXNmax
void PaintTriangles_new(Option_t *option)
Paints the 2D graph as triangles (new implementation)
virtual Double_t * GetEZhigh() const
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 * GetEYhigh() const
virtual Double_t * GetEY() const
virtual Double_t * GetEXhigh() const
virtual Double_t * GetEXlow() const
virtual Double_t * GetEX() const
virtual Double_t * GetEZlow() const
virtual Double_t * GetEYlow() 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.
TH1 is the base class of all histogram classes in ROOT.
virtual Double_t GetContourLevelPad(Int_t level) const
Return the value of contour number "level" in Pad coordinates.
@ kUserContour
User specified contour levels.
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 Int_t GetContour(Double_t *levels=nullptr)
Return contour values into array levels if pointer levels is non zero.
virtual void SetContour(Int_t nlevels, const Double_t *levels=nullptr)
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...
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.
void Add(TObject *obj) override
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual void Delete(Option_t *option="")
Delete this object.
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
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
void Sort(Index n, const Element *a, Index *index, Bool_t down=kTRUE)
Sort the n elements of the array a of generic templated type Element.
Double_t Log10(Double_t x)
Returns the common (base-10) logarithm of x.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Histograms' drawing options 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