3254 const Int_t big = 9999;
3255 const Int_t kMaxDiff = 7;
3258 return fPie->DistancetoPrimitive(px, py);
3267 Int_t curdist = big;
3268 Int_t yxaxis, dyaxis,xyaxis, dxaxis;
3271 if (!PadPointer)
return 0;
3285 if (d3 <= kMaxDiff) {
gPad->SetSelected(
fZaxis);
return 0;}
3287 if (d1 <= kMaxDiff) {
gPad->SetSelected(
fXaxis);
return 0;}
3289 if (d2 <= kMaxDiff) {
gPad->SetSelected(
fYaxis);
return 0;}
3290 if ( px > puxmin && px < puxmax && py > puymax && py < puymin) curdist = 1;
3301 if (px <= xyaxis+dyaxis && px >= xyaxis && py >puymax && py < puymin) {
3310 if (px >= xyaxis-dyaxis && px <= xyaxis && py >puymax && py < puymin) {
3322 if (py >= yxaxis-dxaxis && py <= yxaxis && px <puxmax && px > puxmin) {
3331 if (yxaxis < puymin) yxaxis = puymin;
3332 if (py <= yxaxis+dxaxis && py >= yxaxis && px <puxmax && px > puxmin) {
3342 if ((px > puxmin) && (py < puymin) && (px < puxmax) && (py > puymax))
3358 Int_t bin =
th2->FindBin(pxu, pyu);
3359 if (bin>0) curdist = 1;
3365 if ( px > puxmin + delta2
3366 && px < puxmax - delta2
3367 && py > puymax + delta2
3368 && py < puymin - delta2) {curdist =1;
goto FUNCTIONS;}
3372 if (
gPad->IsVertical()) {
3377 if (binval == 0 && pybin < puymin) pybin = 10000;
3383 for (
Int_t ibin=bin+1; ibin<binsup; ibin++) {
3385 if (binvalmin>binvaltmp) binvalmin=binvaltmp;
3386 if (binvalmax<binvaltmp) binvalmax=binvaltmp;
3388 Int_t pybinmin =
gPad->YtoAbsPixel(
gPad->YtoPad(binvalmax));
3389 Int_t pybinmax =
gPad->YtoAbsPixel(
gPad->YtoPad(binvalmin));
3390 if (py<pybinmax+kMaxDiff/2 && py>pybinmin-kMaxDiff/2) pybin = py;
3392 if (bin != binsup) {
3394 Int_t pybinsub =
gPad->YtoAbsPixel(
gPad->YtoPad(binsupval));
3395 if (py <=
TMath::Max(pybinsub,pybin) && py >=
TMath::Min(pybinsub,pybin) && pybin != 10000)
return 0;
3405 if (binval == 0 && pxbin > puxmin) pxbin = 10000;
3411 for (
Int_t ibin=bin+1; ibin<binsup; ibin++) {
3413 if (binvalmin>binvaltmp) binvalmin=binvaltmp;
3414 if (binvalmax<binvaltmp) binvalmax=binvaltmp;
3416 Int_t pxbinmin =
gPad->XtoAbsPixel(
gPad->XtoPad(binvalmax));
3417 Int_t pxbinmax =
gPad->XtoAbsPixel(
gPad->XtoPad(binvalmin));
3418 if (px<pxbinmax+kMaxDiff/2 && px>pxbinmin-kMaxDiff/2) pxbin = px;
3429 else dist =
f->DistancetoPrimitive(px,py);
3443 Error(
"DrawPanel",
"need to draw histogram first");
3448 gROOT->ProcessLine(
TString::Format(
"((TCanvas*)0x%zx)->Selected((TVirtualPad*)0x%zx,(TObject*)0x%zx,1)",
3463 static Int_t bin, px1, py1, px2, py2, pyold;
3464 static std::unique_ptr<TBox> zoombox;
3468 Double_t xlow, xup, ylow, binval,
x, baroffset, barwidth, binwidth;
3471 if (!
gPad->IsEditable())
return;
3492 if (IsSame.
Index(
"same")>=0) {
3494 TIter next(
gPad->GetListOfPrimitives());
3495 while ((
h1 = (
TH1 *)next())) {
3512 if (!opaque)
gVirtualX->SetLineColor(-1);
3513 fH->TAttLine::Modify();
3515 if (opaque && dimension ==2) {
3516 zbx1 =
gPad->AbsPixeltoX(px);
3517 zbx2 =
gPad->AbsPixeltoX(px);
3518 zby1 =
gPad->AbsPixeltoY(py);
3519 zby2 =
gPad->AbsPixeltoY(py);
3522 if (
gPad->GetLogx()) {
3526 if (
gPad->GetLogy()) {
3530 if (zoombox)
Error(
"ExecuteEvent",
"Last zoom box was not deleted");
3531 zoombox = std::make_unique<TBox>(zbx1, zby1, zbx2, zby2);
3536 zoombox->SetFillColor(ci);
3548 if (dimension ==1) {
3556 x =
gPad->AbsPixeltoX(px);
3560 xup =
gPad->XtoPad(xlow + barwidth*binwidth);
3561 ylow =
gPad->GetUymin();
3562 px1 =
gPad->XtoAbsPixel(xlow);
3563 px2 =
gPad->XtoAbsPixel(xup);
3564 py1 =
gPad->YtoAbsPixel(ylow);
3574 if (dimension ==1) {
3575 if (
gROOT->GetEditHistograms()) {
3584 binval =
gPad->PadtoY(
gPad->AbsPixeltoY(py2))/factor;
3591 if (opaque && dimension ==2) {
3593 zbx2 =
gPad->AbsPixeltoX(px);
3594 zby2 =
gPad->AbsPixeltoY(py);
3598 zoombox->SetX2(zbx2);
3599 zoombox->SetY2(zby2);
3610 if (dimension ==2) {
3615 if (bin2>bin1) xaxis->
SetRange(bin1,bin2);
3620 if (bin2>bin1) yaxis->
SetRange(bin1,bin2);
3629 if (dimension == 2) {
3634 if (bin2>bin1) xaxis->
SetRange(bin1,bin2);
3639 if (bin2>bin1) yaxis->
SetRange(bin1,bin2);
3647 if (dimension ==1) {
3648 if (
gROOT->GetEditHistograms()) {
3649 binval =
gPad->PadtoY(
gPad->AbsPixeltoY(py2))/factor;
3657 if (opaque && dimension ==2) {
3675 if (opaque)
gVirtualX->SetLineColor(-1);
3685 event =
gVirtualX->RequestLocator(1, 1, px, py);
3709 if (!dt && !dtOld)
return nullptr;
3714 ((
THistPainter*)
this)->fGraph2DPainter = dt ? std::make_unique<TGraph2DPainter>(dt) : std::make_unique<TGraph2DPainter>(dtOld);
3726 if (!
gPad)
return (
char*)
"";
3736 if (
gPad->GetView() || drawOption.
Index(
"cont") >= 0) {
3737 uxmin=
gPad->GetUxmin();
3738 uxmax=
gPad->GetUxmax();
3742 uymin=
gPad->GetUymin();
3743 uymax=
gPad->GetUymax();
3749 Int_t binx,biny,binmin=0,binx1;
3750 if (
gPad->IsVertical()) {
3752 if (drawOption.
Index(
"same") >= 0) {
3754 TIter next(
gPad->GetListOfPrimitives());
3755 while ((
h1 = (
TH1 *)next())) {
3768 for (
Int_t ibin=binx+1; ibin<binx1; ibin++) {
3780 if (drawOption.
Index(
"same") >= 0) {
3782 TIter next(
gPad->GetListOfPrimitives());
3783 while ((
h1 = (
TH1 *)next())) {
3796 for (
Int_t ibin=binx+1; ibin<binx1; ibin++) {
3822 biny =
th2->FindBin(
x,
y);
3824 th2->GetBinTitle(biny),
x,
y,biny,
th2->GetBinContent(biny));
3830 fObjectInfo.
Form(
"(x=%g, y=%g, binx=%d, biny=%d, binc=%g, bine=%g, binn=%d)",
3886 if (!changedBin)
return;
3912 if (
gPad->GetLogx()) {
3916 if (
gPad->GetLogy()) {
3923 if (
gPad->IsVertical()) {
3925 if ((hcenter < uxmin) || (hcenter > uxmax))
return;
3928 if ((hcenter < uymin) || (hcenter > uymax))
return;
3932 if ((hcenter < uymin) || (hcenter > uymax))
return;
3937 if (
gPad->IsVertical()) {
4027 Int_t nch = strlen(choptin);
4028 strlcpy(chopt,choptin,128);
4054 for (
Int_t i=0;i<nch;i++) chopt[i] = toupper(chopt[i]);
4060 char *l1 = strstr(chopt,
"PFC");
4061 char *l2 = strstr(chopt,
"PLC");
4062 char *l3 = strstr(chopt,
"PMC");
4063 if (l1 || l2 || l3) {
4071 l = strstr(chopt,
"MIN0");
4077 l = strstr(chopt,
"SPEC");
4082 l = strstr(chopt,
"BF(");
4084 if (sscanf(&
l[3],
"%d",&bs) > 0) {
4097 l = strstr(chopt,
"GL");
4101 l = strstr(chopt,
"X+");
4106 l = strstr(chopt,
"Y+");
4114 l = strstr(chopt,
"SAMES");
4121 l = strstr(chopt,
"SAME");
4129 l = strstr(chopt,
"PIE");
4136 l = strstr(chopt,
"CANDLE");
4143 l = strstr(chopt,
"VIOLIN");
4150 l = strstr(chopt,
"LEGO");
4161 l = strstr(chopt,
"0");
if (
l) {
Hoption.
Zero = 1; memcpy(
l,
" ",1); }
4164 l = strstr(chopt,
"SURF");
4179 l = strstr(chopt,
"TF3");
4186 l = strstr(chopt,
"ISO");
4193 l = strstr(chopt,
"LIST");
if (
l) {
Hoption.
List = 1; memcpy(
l,
" ",4);}
4195 l = strstr(chopt,
"CONT");
4210 l = strstr(chopt,
"HBAR");
4219 l = strstr(chopt,
"BAR");
4229 l = strstr(chopt,
"ARR" );
4235 l = strstr(chopt,
"COL");
if (
l) {
Hoption.
Arrow = 2; memcpy(
l,
" ",3); }
4241 l = strstr(chopt,
"BOX" );
4254 l = strstr(chopt,
"COLZ");
4262 l = strstr(chopt,
"0");
if (
l) {
Hoption.
Zero = 1; memcpy(
l,
" ",1); }
4268 l = strstr(chopt,
"COL" );
4275 l = strstr(chopt,
"0");
if (
l) {
Hoption.
Zero = 1; memcpy(
l,
" ",1); }
4283 l = strstr(chopt,
"AXIS");
if (
l) {
Hoption.
Axis = 1; memcpy(
l,
" ",4); }
4284 l = strstr(chopt,
"AXIG");
if (
l) {
Hoption.
Axis = 2; memcpy(
l,
" ",4); }
4285 l = strstr(chopt,
"SCAT");
if (
l) {
Hoption.
Scat = 1; memcpy(
l,
" ",4); }
4286 l = strstr(chopt,
"TEXT");
4289 if (sscanf(&
l[4],
"%d",&
angle) > 0) {
4297 l = strstr(chopt,
"N");
4306 l = strstr(chopt,
"TRI");
4313 l = strstr(chopt,
"ERR");
if (
l) memcpy(
l,
" ",3);
4316 l = strstr(chopt,
"AITOFF");
4320 l = strstr(chopt,
"MERCATOR");
4324 l = strstr(chopt,
"SINUSOIDAL");
4328 l = strstr(chopt,
"PARABOLIC");
4354 if (strstr(chopt,
"E")) {
4364 if (strstr(chopt,
"X0")) {
4387 Warning(
"MakeChopt",
"option SURF5 is not supported in Cartesian and Polar modes");
4408 char *left = (
char*)strchr(choptin,
'[');
4409 if (!left)
return 0;
4410 char *right = (
char*)strchr(choptin,
']');
4411 if (!right)
return 0;
4412 Int_t nch = right-left;
4413 if (nch < 2)
return 0;
4414 char *cuts = left+1;
4416 char *comma, *minus;
4419 comma = strchr(cuts,
',');
4420 if (comma) *comma = 0;
4421 minus = strchr(cuts,
'-');
4422 if (minus) cuts = minus+1;
4423 while (*cuts ==
' ') cuts++;
4424 Int_t nc = strlen(cuts);
4425 while (cuts[nc-1] ==
' ') {cuts[nc-1] = 0; nc--;}
4429 while ((obj = next())) {
4431 if (strcmp(obj->
GetName(),cuts))
continue;
4444 for (i=0;i<=nch;i++) left[i] =
' ';
4472 gROOT->ProcessLineFast(
TString::Format(
"TSpectrum2Painter::PaintSpectrum((TH2F*)0x%zx,\"%s\",%d)",
4485 fPie = std::make_unique<TPie>(
fH);
4488 Error(
"Paint",
"Option PIE is for 1D histograms only");
4517 gPad->SetView(
nullptr);
4522 Int_t logysav=0, logzsav=0;
4559 gPad->RangeAxisChanged();
4577 if (gridx)
gPad->SetGridx(0);
4578 if (gridy)
gPad->SetGridy(0);
4580 if (gridx)
gPad->SetGridx(1);
4581 if (gridy)
gPad->SetGridy(1);
4616 if (gridx)
gPad->SetGridx(0);
4617 if (gridy)
gPad->SetGridy(0);
4619 if (gridx)
gPad->SetGridx(1);
4620 if (gridy)
gPad->SetGridy(1);
4629 while ((obj = next())) {
4637 if (!
gPad->PadInSelectionMode() && !
gPad->PadInHighlightMode())
4664 arrow->SetAngle(30);
4665 arrow->SetFillStyle(1001);
4671 Int_t ncolors=0, ndivz=0;
4685 for (
Int_t id=1;
id<=2;
id++) {
4692 if (!
IsInside(xk+0.5*xstep,yk+0.5*ystep))
continue;
4710 }
else if (
id == 2) {
4722 if (theColor > ncolors-1) theColor = ncolors-1;
4752 if (drawGridOnly && (
gPad->PadInHighlightMode() ||
gPad->PadInSelectionMode()))
4760 TAxis *xaxis =
nullptr;
4761 TAxis *yaxis =
nullptr;
4764 TIter next(
gPad->GetListOfPrimitives());
4767 while ((obj = next())) {
4773 if (strstr(opt,
"hbar")) {
4777 if (!strcmp(xaxis->
GetName(),
"xaxis")) {
4787 static char chopt[10] =
"";
4789 Int_t ndiv, ndivx, ndivy, nx1, nx2, ndivsave;
4790 Int_t useHparam = 0;
4791 Double_t umin, umax, uminsave, umaxsave;
4807 TIter next(
gPad->GetListOfPrimitives());
4808 while ((obj=next())) {
4819 if (
gPad->PadInSelectionMode())
4823 if (
gPad->PadInSelectionMode() || !
gPad->PadInHighlightMode() || (
gPad->PadInHighlightMode() &&
gPad->GetSelected() ==
fXaxis)) {
4834 strlcat(chopt,
"SDH",10);
4835 if (ndivx < 0) strlcat(chopt,
"N",10);
4836 if (
gPad->GetGridx()) {
4837 gridl = (aymax-aymin)/(
gPad->GetY2() -
gPad->GetY1());
4838 strlcat(chopt,
"W",10);
4843 strlcat(chopt,
"G",10);
4865 strlcat(chopt,
"t",10);
4873 if (xAxisPos == 1) {
4889 strlcat(chopt,
"-",10);
4898 umin, umax, ndiv, chopt, gridl, drawGridOnly);
4903 if (
gPad->GetTickx() && !
gPad->PadInSelectionMode() && !
gPad->PadInHighlightMode()) {
4905 cw=strstr(chopt,
"-");
4908 strlcat(chopt,
"-",10);
4910 if (
gPad->GetTickx() < 2) strlcat(chopt,
"U",10);
4911 if ((cw=strstr(chopt,
"W"))) *cw=
'z';
4915 uminsave, umaxsave, ndivsave, chopt, gridl, drawGridOnly);
4921 if (
gPad->PadInSelectionMode())
4925 if (
gPad->PadInSelectionMode() || !
gPad->PadInHighlightMode() || (
gPad->PadInHighlightMode() &&
gPad->GetSelected() ==
fYaxis)) {
4930 strlcat(chopt,
"SDH",10);
4931 if (ndivy < 0) strlcat(chopt,
"N",10);
4932 if (
gPad->GetGridy()) {
4933 gridl = (axmax-axmin)/(
gPad->GetX2() -
gPad->GetX1());
4934 strlcat(chopt,
"W",10);
4939 strlcat(chopt,
"G",10);
4961 strlcat(chopt,
"t",10);
4969 if (yAxisPos == 1) {
4985 strlcat(chopt,
"+L",10);
4994 umin, umax, ndiv, chopt, gridl, drawGridOnly);
4999 if (
gPad->GetTicky() && !
gPad->PadInSelectionMode() && !
gPad->PadInHighlightMode()) {
5000 if (
gPad->GetTicky() < 2) {
5001 strlcat(chopt,
"U",10);
5004 strlcat(chopt,
"+L",10);
5006 if ((cw=strstr(chopt,
"W"))) *cw=
'z';
5010 uminsave, umaxsave, ndivsave, chopt, gridl, drawGridOnly);
5033 if (hcolor ==
gPad->GetFrameFillColor()) ++hcolor;
5035 box.SetFillColor(hcolor);
5036 box.SetFillStyle(hstyle);
5046 if (ymax < gPad->GetUymin())
continue;
5048 if (ymin < gPad->GetUymin())
ymin =
gPad->GetUymin();
5062 box.SetFillColor(hcolor);
5082 if (!strcmp(xaxis->
GetName(),
"xaxis")) {
5096 if (hcolor ==
gPad->GetFrameFillColor()) ++hcolor;
5098 box.SetFillColor(hcolor);
5099 box.SetFillStyle(hstyle);
5108 if (xmax < gPad->GetUxmin())
continue;
5110 if (xmin < gPad->GetUxmin())
xmin =
gPad->GetUxmin();
5123 box.SetFillColor(hcolor);
5136 while ((obj = next())) {
5157 fH->TAttLine::Modify();
5158 fH->TAttFill::Modify();
5160 Double_t z, xk,xstep, yk, ystep, xcent, ycent, xlow, xup, ylow, yup;
5171 Double_t zminlin = zmin, zmaxlin = zmax;
5177 TIter next(
gPad->GetListOfPrimitives());
5178 while ((h2 = (
TH2 *)next())) {