Skip to content

Commit 7ac680e

Browse files
ferdymercurydpiparo
authored andcommitted
[hist] extend LIST option to support CONT1 CONT2 CONT3
Fixes #20858 Follow-up of d4b273b (cherry picked from commit fd3cd40)
1 parent 499f4f4 commit 7ac680e

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

hist/histpainter/src/THistPainter.cxx

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6045,7 +6045,7 @@ void THistPainter::PaintContour(Option_t *option)
60456045
TList *list = nullptr;
60466046
TGraph *graph = nullptr;
60476047
std::vector<Int_t> np;
6048-
if (Hoption.Contour == 1) {
6048+
if (Hoption.Contour == 1 || (Hoption.List && (Hoption.Contour == 11 || Hoption.Contour == 12 || Hoption.Contour == 13))) {
60496049
np.resize(ncontour);
60506050
for (i=0;i<ncontour;i++)
60516051
np[i] = 0;
@@ -6170,7 +6170,8 @@ void THistPainter::PaintContour(Option_t *option)
61706170
if (Hoption.Contour != 1) {
61716171
fH->TAttLine::Modify();
61726172
gPad->PaintPolyLine(2,xarr.data()+ix-1,yarr.data()+ix-1);
6173-
continue;
6173+
if ((Hoption.Contour != 11 && Hoption.Contour != 12 && Hoption.Contour != 13) || !Hoption.List)
6174+
continue;
61746175
}
61756176

61766177
ipoly = itarr[ix-1];
@@ -6192,7 +6193,10 @@ void THistPainter::PaintContour(Option_t *option)
61926193
Int_t first = ncontour;
61936194
std::vector<Int_t> polysort;
61946195
Int_t contListNb;
6195-
if (Hoption.Contour != 1) goto theEND;
6196+
if (Hoption.Contour != 1) {
6197+
if (!Hoption.List || (Hoption.Contour != 11 && Hoption.Contour != 12 && Hoption.Contour != 13))
6198+
goto theEND;
6199+
}
61966200

61976201
//The 2 points line generated above are now sorted/merged to generate
61986202
//a list of consecutive points.
@@ -6211,9 +6215,9 @@ void THistPainter::PaintContour(Option_t *option)
62116215
k = 0;
62126216
for (ipoly=first-1;ipoly>=0;ipoly--) {polysort[k] = ipoly; k++;}
62136217
for (ipoly=first;ipoly<ncontour;ipoly++) {polysort[k] = ipoly; k++;}
6214-
// we can now draw sorted contours
6218+
// if Contour==1 we can now draw sorted contours, otherwise (11,12,13) just store
62156219
contListNb = 0;
6216-
fH->SetFillStyle(1001);
6220+
if (Hoption.Contour == 1) fH->SetFillStyle(1001);
62176221
for (k=0;k<ncontour;k++) {
62186222
ipoly = polysort[k];
62196223
if (Hoption.List) list = (TList*)contours->At(contListNb);
@@ -6252,12 +6256,22 @@ void THistPainter::PaintContour(Option_t *option)
62526256
}
62536257
theColor = Int_t((ipoly+0.99)*Float_t(ncolors)/Float_t(ndivz));
62546258
icol = gStyle->GetColorPalette(theColor);
6255-
if (ndivz > 1) fH->SetFillColor(icol);
6256-
fH->TAttFill::Modify();
6257-
gPad->PaintFillArea(iplus-iminus+1,xp.data()+iminus,yp.data()+iminus);
6259+
if (Hoption.Contour == 1) {
6260+
if (ndivz > 1) fH->SetFillColor(icol);
6261+
fH->TAttFill::Modify();
6262+
gPad->PaintFillArea(iplus-iminus+1,xp.data()+iminus,yp.data()+iminus);
6263+
}
62586264
if (Hoption.List) {
62596265
graph = new TGraph(iplus-iminus+1,xp.data()+iminus,yp.data()+iminus);
6260-
graph->SetFillColor(icol);
6266+
if (Hoption.Contour == 1)
6267+
graph->SetFillColor(icol);
6268+
else if (Hoption.Contour == 11)
6269+
graph->SetLineColor(icol);
6270+
else if (Hoption.Contour == 12) {
6271+
mode = icol%5;
6272+
if (mode == 0) mode = 5;
6273+
graph->SetLineStyle(mode);
6274+
}
62616275
graph->SetLineWidth(fH->GetLineWidth());
62626276
list->Add(graph);
62636277
}

0 commit comments

Comments
 (0)