3260 const Int_t big = 9999;
3261 const Int_t kMaxDiff = 7;
3264 return fPie->DistancetoPrimitive(px, py);
3273 Int_t curdist = big;
3274 Int_t yxaxis, dyaxis,xyaxis, dxaxis;
3277 if (!PadPointer)
return 0;
3291 if (d3 <= kMaxDiff) {
gPad->SetSelected(
fZaxis);
return 0;}
3293 if (d1 <= kMaxDiff) {
gPad->SetSelected(
fXaxis);
return 0;}
3295 if (d2 <= kMaxDiff) {
gPad->SetSelected(
fYaxis);
return 0;}
3296 if ( px > puxmin && px < puxmax && py > puymax && py < puymin) curdist = 1;
3307 if (px <= xyaxis+dyaxis && px >= xyaxis && py >puymax && py < puymin) {
3316 if (px >= xyaxis-dyaxis && px <= xyaxis && py >puymax && py < puymin) {
3328 if (py >= yxaxis-dxaxis && py <= yxaxis && px <puxmax && px > puxmin) {
3337 if (yxaxis < puymin) yxaxis = puymin;
3338 if (py <= yxaxis+dxaxis && py >= yxaxis && px <puxmax && px > puxmin) {
3348 if ((px > puxmin) && (py < puymin) && (px < puxmax) && (py > puymax))
3364 Int_t bin =
th2->FindBin(pxu, pyu);
3365 if (bin>0) curdist = 1;
3371 if ( px > puxmin + delta2
3372 && px < puxmax - delta2
3373 && py > puymax + delta2
3374 && py < puymin - delta2) {curdist =1;
goto FUNCTIONS;}
3378 if (
gPad->IsVertical()) {
3383 if (binval == 0 && pybin < puymin) pybin = 10000;
3389 for (
Int_t ibin=bin+1; ibin<binsup; ibin++) {
3391 if (binvalmin>binvaltmp) binvalmin=binvaltmp;
3392 if (binvalmax<binvaltmp) binvalmax=binvaltmp;
3394 Int_t pybinmin =
gPad->YtoAbsPixel(
gPad->YtoPad(binvalmax));
3395 Int_t pybinmax =
gPad->YtoAbsPixel(
gPad->YtoPad(binvalmin));
3396 if (py<pybinmax+kMaxDiff/2 && py>pybinmin-kMaxDiff/2) pybin = py;
3398 if (bin != binsup) {
3400 Int_t pybinsub =
gPad->YtoAbsPixel(
gPad->YtoPad(binsupval));
3401 if (py <=
TMath::Max(pybinsub,pybin) && py >=
TMath::Min(pybinsub,pybin) && pybin != 10000)
return 0;
3411 if (binval == 0 && pxbin > puxmin) pxbin = 10000;
3417 for (
Int_t ibin=bin+1; ibin<binsup; ibin++) {
3419 if (binvalmin>binvaltmp) binvalmin=binvaltmp;
3420 if (binvalmax<binvaltmp) binvalmax=binvaltmp;
3422 Int_t pxbinmin =
gPad->XtoAbsPixel(
gPad->XtoPad(binvalmax));
3423 Int_t pxbinmax =
gPad->XtoAbsPixel(
gPad->XtoPad(binvalmin));
3424 if (px<pxbinmax+kMaxDiff/2 && px>pxbinmin-kMaxDiff/2) pxbin = px;
3434 if (
f->InheritsFrom(
TF1::Class())) dist =
f->DistancetoPrimitive(-px,py);
3435 else dist =
f->DistancetoPrimitive(px,py);
3436 if (dist < kMaxDiff) {
gPad->SetSelected(
f);
return dist;}
3449 Error(
"DrawPanel",
"need to draw histogram first");
3454 gROOT->ProcessLine(
TString::Format(
"((TCanvas*)0x%zx)->Selected((TVirtualPad*)0x%zx,(TObject*)0x%zx,1)",
3469 static Int_t bin, px1, py1, px2, py2, pyold;
3470 static std::unique_ptr<TBox> zoombox;
3474 Double_t xlow, xup, ylow, binval,
x, baroffset, barwidth, binwidth;
3477 if (!
gPad->IsEditable())
return;
3480 fPie->ExecuteEvent(event, px, py);
3498 if (IsSame.
Index(
"same")>=0) {
3500 TIter next(
gPad->GetListOfPrimitives());
3501 while ((
h1 = (
TH1 *)next())) {
3518 if (!opaque)
gVirtualX->SetLineColor(-1);
3519 fH->TAttLine::Modify();
3521 if (opaque && dimension ==2) {
3522 zbx1 =
gPad->AbsPixeltoX(px);
3523 zbx2 =
gPad->AbsPixeltoX(px);
3524 zby1 =
gPad->AbsPixeltoY(py);
3525 zby2 =
gPad->AbsPixeltoY(py);
3528 if (
gPad->GetLogx()) {
3532 if (
gPad->GetLogy()) {
3536 if (zoombox)
Error(
"ExecuteEvent",
"Last zoom box was not deleted");
3537 zoombox = std::make_unique<TBox>(zbx1, zby1, zbx2, zby2);
3542 zoombox->SetFillColor(ci);
3554 if (dimension ==1) {
3562 x =
gPad->AbsPixeltoX(px);
3566 xup =
gPad->XtoPad(xlow + barwidth*binwidth);
3567 ylow =
gPad->GetUymin();
3568 px1 =
gPad->XtoAbsPixel(xlow);
3569 px2 =
gPad->XtoAbsPixel(xup);
3570 py1 =
gPad->YtoAbsPixel(ylow);
3580 if (dimension ==1) {
3581 if (
gROOT->GetEditHistograms()) {
3590 binval =
gPad->PadtoY(
gPad->AbsPixeltoY(py2))/factor;
3597 if (opaque && dimension ==2) {
3599 zbx2 =
gPad->AbsPixeltoX(px);
3600 zby2 =
gPad->AbsPixeltoY(py);
3604 zoombox->SetX2(zbx2);
3605 zoombox->SetY2(zby2);
3616 if (dimension ==2) {
3621 if (bin2>bin1) xaxis->
SetRange(bin1,bin2);
3626 if (bin2>bin1) yaxis->
SetRange(bin1,bin2);
3635 if (dimension == 2) {
3640 if (bin2>bin1) xaxis->
SetRange(bin1,bin2);
3645 if (bin2>bin1) yaxis->
SetRange(bin1,bin2);
3653 if (dimension ==1) {
3654 if (
gROOT->GetEditHistograms()) {
3655 binval =
gPad->PadtoY(
gPad->AbsPixeltoY(py2))/factor;
3663 if (opaque && dimension ==2) {
3681 if (opaque)
gVirtualX->SetLineColor(-1);
3691 event =
gVirtualX->RequestLocator(1, 1, px, py);
3715 if (!dt && !dtOld)
return nullptr;
3720 ((
THistPainter*)
this)->fGraph2DPainter = dt ? std::make_unique<TGraph2DPainter>(dt) : std::make_unique<TGraph2DPainter>(dtOld);
3732 if (!
gPad)
return (
char*)
"";
3742 if (
gPad->GetView() || drawOption.
Index(
"cont") >= 0) {
3743 uxmin=
gPad->GetUxmin();
3744 uxmax=
gPad->GetUxmax();
3748 uymin=
gPad->GetUymin();
3749 uymax=
gPad->GetUymax();
3755 Int_t binx,biny,binmin=0,binx1;
3756 if (
gPad->IsVertical()) {
3758 if (drawOption.
Index(
"same") >= 0) {
3760 TIter next(
gPad->GetListOfPrimitives());
3761 while ((
h1 = (
TH1 *)next())) {
3774 for (
Int_t ibin=binx+1; ibin<binx1; ibin++) {
3786 if (drawOption.
Index(
"same") >= 0) {
3788 TIter next(
gPad->GetListOfPrimitives());
3789 while ((
h1 = (
TH1 *)next())) {
3802 for (
Int_t ibin=binx+1; ibin<binx1; ibin++) {
3828 biny =
th2->FindBin(
x,
y);
3830 th2->GetBinTitle(biny),
x,
y,biny,
th2->GetBinContent(biny));
3836 fObjectInfo.
Form(
"(x=%g, y=%g, binx=%d, biny=%d, binc=%g, bine=%g, binn=%d)",
3892 if (!changedBin)
return;
3918 if (
gPad->GetLogx()) {
3922 if (
gPad->GetLogy()) {
3929 if (
gPad->IsVertical()) {
3931 if ((hcenter < uxmin) || (hcenter > uxmax))
return;
3934 if ((hcenter < uymin) || (hcenter > uymax))
return;
3938 if ((hcenter < uymin) || (hcenter > uymax))
return;
3943 if (
gPad->IsVertical()) {
4033 Int_t nch = strlen(choptin);
4034 strlcpy(chopt,choptin,128);
4061 for (
Int_t i=0;i<nch;i++) chopt[i] = toupper(chopt[i]);
4067 char *l1 = strstr(chopt,
"PFC");
4068 char *l2 = strstr(chopt,
"PLC");
4069 char *l3 = strstr(chopt,
"PMC");
4070 if (l1 || l2 || l3) {
4078 l = strstr(chopt,
"MIN0");
4084 l = strstr(chopt,
"SPEC");
4089 l = strstr(chopt,
"BF(");
4091 if (sscanf(&
l[3],
"%d",&bs) > 0) {
4104 l = strstr(chopt,
"GL");
4108 l = strstr(chopt,
"X+");
4113 l = strstr(chopt,
"Y+");
4121 l = strstr(chopt,
"SAMES");
4128 l = strstr(chopt,
"SAME");
4136 l = strstr(chopt,
"SCAT");
4138 Warning(
"MakeChopt",
"option SCAT is deprecated.");
4144 l = strstr(chopt,
"PIE");
4151 l = strstr(chopt,
"CANDLE");
4158 l = strstr(chopt,
"VIOLIN");
4165 l = strstr(chopt,
"LEGO");
4176 l = strstr(chopt,
"0");
if (
l) {
Hoption.
Zero = 1; memcpy(
l,
" ",1); }
4179 l = strstr(chopt,
"SURF");
4194 l = strstr(chopt,
"TF3");
4201 l = strstr(chopt,
"ISO");
4209 l = strstr(chopt,
"LIST");
if (
l) {
Hoption.
List = 1; memcpy(
l,
" ",4);}
4211 l = strstr(chopt,
"CONT");
4226 l = strstr(chopt,
"HBAR");
4235 l = strstr(chopt,
"BAR");
4245 l = strstr(chopt,
"ARR" );
4251 l = strstr(chopt,
"COL");
if (
l) {
Hoption.
Arrow = 2; memcpy(
l,
" ",3); }
4257 l = strstr(chopt,
"BOX" );
4270 l = strstr(chopt,
"TEXT");
4273 if (sscanf(&
l[4],
"%d",&
angle) > 0) {
4281 l = strstr(chopt,
"N");
4285 l = strstr(chopt,
"COLZ");
4289 explicitColor =
kTRUE;
4293 l = strstr(chopt,
"0");
if (
l) {
Hoption.
Zero = 1; memcpy(
l,
" ",1); }
4299 l = strstr(chopt,
"COL" );
4303 explicitColor =
kTRUE;
4306 l = strstr(chopt,
"0");
if (
l) {
Hoption.
Zero = 1; memcpy(
l,
" ",1); }
4314 l = strstr(chopt,
"AXIS");
if (
l) {
Hoption.
Axis = 1; memcpy(
l,
" ",4); }
4315 l = strstr(chopt,
"AXIG");
if (
l) {
Hoption.
Axis = 2; memcpy(
l,
" ",4); }
4316 l = strstr(chopt,
"SCAT");
if (
l) {
Hoption.
Scat = 1; memcpy(
l,
" ",4); }
4322 l = strstr(chopt,
"TRI");
4328 l = strstr(chopt,
"ERR");
if (
l) memcpy(
l,
" ",3);
4331 l = strstr(chopt,
"AITOFF");
4335 l = strstr(chopt,
"MERCATOR");
4339 l = strstr(chopt,
"SINUSOIDAL");
4343 l = strstr(chopt,
"PARABOLIC");
4347 l = strstr(chopt,
"MOLLWEIDE");
4373 if (strstr(chopt,
"E")) {
4383 if (strstr(chopt,
"X0")) {
4406 Warning(
"MakeChopt",
"option SURF5 is not supported in Cartesian and Polar modes");
4427 char *left = (
char*)strchr(choptin,
'[');
4428 if (!left)
return 0;
4429 char *right = (
char*)strchr(choptin,
']');
4430 if (!right)
return 0;
4431 Int_t nch = right-left;
4432 if (nch < 2)
return 0;
4433 char *cuts = left+1;
4435 char *comma, *minus;
4438 comma = strchr(cuts,
',');
4439 if (comma) *comma = 0;
4440 minus = strchr(cuts,
'-');
4441 if (minus) cuts = minus+1;
4442 while (*cuts ==
' ') cuts++;
4443 Int_t nc = strlen(cuts);
4444 while (cuts[nc-1] ==
' ') {cuts[nc-1] = 0; nc--;}
4448 while ((obj = next())) {
4450 if (strcmp(obj->
GetName(),cuts))
continue;
4463 for (i=0;i<=nch;i++) left[i] =
' ';
4491 gROOT->ProcessLineFast(
TString::Format(
"TSpectrum2Painter::PaintSpectrum((TH2F*)0x%zx,\"%s\",%d)",
4504 fPie = std::make_unique<TPie>(
fH);
4507 Error(
"Paint",
"Option PIE is for 1D histograms only");
4541 Int_t logysav=0, logzsav=0;
4578 gPad->RangeAxisChanged();
4596 if (gridx)
gPad->SetGridx(0);
4597 if (gridy)
gPad->SetGridy(0);
4599 if (gridx)
gPad->SetGridx(1);
4600 if (gridy)
gPad->SetGridy(1);
4635 if (gridx)
gPad->SetGridx(0);
4636 if (gridy)
gPad->SetGridy(0);
4638 if (gridx)
gPad->SetGridx(1);
4639 if (gridy)
gPad->SetGridy(1);
4648 while ((obj = next())) {
4656 if (!
gPad->PadInSelectionMode() && !
gPad->PadInHighlightMode())
4683 arrow->SetAngle(30);
4684 arrow->SetFillStyle(1001);
4690 Int_t ncolors=0, ndivz=0;
4704 for (
Int_t id=1;
id<=2;
id++) {
4711 if (!
IsInside(xk+0.5*xstep,yk+0.5*ystep))
continue;
4729 }
else if (
id == 2) {
4741 if (theColor > ncolors-1) theColor = ncolors-1;
4771 if (drawGridOnly && (
gPad->PadInHighlightMode() ||
gPad->PadInSelectionMode()))
4779 TAxis *xaxis =
nullptr;
4780 TAxis *yaxis =
nullptr;
4783 TIter next(
gPad->GetListOfPrimitives());
4786 while ((obj = next())) {
4792 if (strstr(opt,
"hbar")) {
4796 if (!strcmp(xaxis->
GetName(),
"xaxis")) {
4806 static char chopt[10] =
"";
4808 Int_t ndiv, ndivx, ndivy, nx1, nx2, ndivsave;
4809 Int_t useHparam = 0;
4810 Double_t umin, umax, uminsave, umaxsave;
4826 TIter next(
gPad->GetListOfPrimitives());
4827 while ((obj=next())) {
4838 if (
gPad->PadInSelectionMode())
4842 if (
gPad->PadInSelectionMode() || !
gPad->PadInHighlightMode() || (
gPad->PadInHighlightMode() &&
gPad->GetSelected() ==
fXaxis)) {
4853 strlcat(chopt,
"SDH",10);
4854 if (ndivx < 0) strlcat(chopt,
"N",10);
4855 if (
gPad->GetGridx()) {
4856 gridl = (aymax-aymin)/(
gPad->GetY2() -
gPad->GetY1());
4857 strlcat(chopt,
"W",10);
4862 strlcat(chopt,
"G",10);
4884 strlcat(chopt,
"t",10);
4892 if (xAxisPos == 1) {
4908 strlcat(chopt,
"-",10);
4917 umin, umax, ndiv, chopt, gridl, drawGridOnly);
4922 if (
gPad->GetTickx() && !
gPad->PadInSelectionMode() && !
gPad->PadInHighlightMode()) {
4924 cw=strstr(chopt,
"-");
4927 strlcat(chopt,
"-",10);
4929 if (
gPad->GetTickx() < 2) strlcat(chopt,
"U",10);
4930 if ((cw=strstr(chopt,
"W"))) *cw=
'z';
4934 uminsave, umaxsave, ndivsave, chopt, gridl, drawGridOnly);
4940 if (
gPad->PadInSelectionMode())
4944 if (
gPad->PadInSelectionMode() || !
gPad->PadInHighlightMode() || (
gPad->PadInHighlightMode() &&
gPad->GetSelected() ==
fYaxis)) {
4949 strlcat(chopt,
"SDH",10);
4950 if (ndivy < 0) strlcat(chopt,
"N",10);
4951 if (
gPad->GetGridy()) {
4952 gridl = (axmax-axmin)/(
gPad->GetX2() -
gPad->GetX1());
4953 strlcat(chopt,
"W",10);
4958 strlcat(chopt,
"G",10);
4980 strlcat(chopt,
"t",10);
4988 if (yAxisPos == 1) {
5004 strlcat(chopt,
"+L",10);
5013 umin, umax, ndiv, chopt, gridl, drawGridOnly);
5018 if (
gPad->GetTicky() && !
gPad->PadInSelectionMode() && !
gPad->PadInHighlightMode()) {
5019 if (
gPad->GetTicky() < 2) {
5020 strlcat(chopt,
"U",10);
5023 strlcat(chopt,
"+L",10);
5025 if ((cw=strstr(chopt,
"W"))) *cw=
'z';
5029 uminsave, umaxsave, ndivsave, chopt, gridl, drawGridOnly);
5052 if (hcolor ==
gPad->GetFrameFillColor()) ++hcolor;
5054 box.SetFillColor(hcolor);
5055 box.SetFillStyle(hstyle);
5065 if (ymax < gPad->GetUymin())
continue;
5067 if (ymin < gPad->GetUymin())
ymin =
gPad->GetUymin();
5081 box.SetFillColor(hcolor);
5101 if (!strcmp(xaxis->
GetName(),
"xaxis")) {
5115 if (hcolor ==
gPad->GetFrameFillColor()) ++hcolor;
5117 box.SetFillColor(hcolor);
5118 box.SetFillStyle(hstyle);
5127 if (xmax < gPad->GetUxmin())
continue;
5129 if (xmin < gPad->GetUxmin())
xmin =
gPad->GetUxmin();
5142 box.SetFillColor(hcolor);
5155 while ((obj = next())) {
5176 fH->TAttLine::Modify();
5177 fH->TAttFill::Modify();
5179 Double_t z, xk,xstep, yk, ystep, xcent, ycent, xlow, xup, ylow, yup;