3265 const Int_t big = 9999;
3266 const Int_t kMaxDiff = 7;
3277 Int_t curdist = big;
3278 Int_t yxaxis, dyaxis,xyaxis, dxaxis;
3281 if (!PadPointer)
return 0;
3295 if (d3 <= kMaxDiff) {
gPad->SetSelected(
fZaxis);
return 0;}
3297 if (d1 <= kMaxDiff) {
gPad->SetSelected(
fXaxis);
return 0;}
3299 if (d2 <= kMaxDiff) {
gPad->SetSelected(
fYaxis);
return 0;}
3300 if ( px > puxmin && px < puxmax && py > puymax && py < puymin) curdist = 1;
3311 if (px <= xyaxis+dyaxis && px >= xyaxis && py >puymax && py < puymin) {
3320 if (px >= xyaxis-dyaxis && px <= xyaxis && py >puymax && py < puymin) {
3332 if (py >= yxaxis-dxaxis && py <= yxaxis && px <puxmax && px > puxmin) {
3341 if (yxaxis < puymin) yxaxis = puymin;
3342 if (py <= yxaxis+dxaxis && py >= yxaxis && px <puxmax && px > puxmin) {
3352 if ((px > puxmin) && (py < puymin) && (px < puxmax) && (py > puymax))
3368 Int_t bin =
th2->FindBin(pxu, pyu);
3369 if (bin>0) curdist = 1;
3375 if ( px > puxmin + delta2
3376 && px < puxmax - delta2
3377 && py > puymax + delta2
3378 && py < puymin - delta2) {curdist =1;
goto FUNCTIONS;}
3382 if (
gPad->IsVertical()) {
3387 if (binval == 0 && pybin < puymin) pybin = 10000;
3393 for (
Int_t ibin=bin+1; ibin<binsup; ibin++) {
3395 if (binvalmin>binvaltmp) binvalmin=binvaltmp;
3396 if (binvalmax<binvaltmp) binvalmax=binvaltmp;
3398 Int_t pybinmin =
gPad->YtoAbsPixel(
gPad->YtoPad(binvalmax));
3399 Int_t pybinmax =
gPad->YtoAbsPixel(
gPad->YtoPad(binvalmin));
3400 if (py<pybinmax+kMaxDiff/2 && py>pybinmin-kMaxDiff/2) pybin = py;
3402 if (bin != binsup) {
3404 Int_t pybinsub =
gPad->YtoAbsPixel(
gPad->YtoPad(binsupval));
3405 if (py <=
TMath::Max(pybinsub,pybin) && py >=
TMath::Min(pybinsub,pybin) && pybin != 10000)
return 0;
3415 if (binval == 0 && pxbin > puxmin) pxbin = 10000;
3421 for (
Int_t ibin=bin+1; ibin<binsup; ibin++) {
3423 if (binvalmin>binvaltmp) binvalmin=binvaltmp;
3424 if (binvalmax<binvaltmp) binvalmax=binvaltmp;
3426 Int_t pxbinmin =
gPad->XtoAbsPixel(
gPad->XtoPad(binvalmax));
3427 Int_t pxbinmax =
gPad->XtoAbsPixel(
gPad->XtoPad(binvalmin));
3428 if (px<pxbinmax+kMaxDiff/2 && px>pxbinmin-kMaxDiff/2) pxbin = px;
3438 if (
f->InheritsFrom(TF1::Class())) dist =
f->DistancetoPrimitive(-px,py);
3439 else dist =
f->DistancetoPrimitive(px,py);
3440 if (dist < kMaxDiff) {
gPad->SetSelected(
f);
return dist;}
3453 Error(
"DrawPanel",
"need to draw histogram first");
3458 gROOT->ProcessLine(
Form(
"((TCanvas*)0x%zx)->Selected((TVirtualPad*)0x%zx,(TObject*)0x%zx,1)",
3459 (
size_t)
gPad->GetCanvas(), (
size_t)
gPad, (
size_t)
fH));
3473 static Int_t bin, px1, py1, px2, py2, pyold;
3474 static TBox *zoombox =
nullptr;
3478 Double_t xlow, xup, ylow, binval,
x, baroffset, barwidth, binwidth;
3481 if (!
gPad->IsEditable())
return;
3502 if (IsSame.
Index(
"same")>=0) {
3504 TIter next(
gPad->GetListOfPrimitives());
3505 while ((
h1 = (
TH1 *)next())) {
3522 if (!opaque)
gVirtualX->SetLineColor(-1);
3523 fH->TAttLine::Modify();
3525 if (opaque && dimension ==2) {
3526 zbx1 =
gPad->AbsPixeltoX(px);
3527 zbx2 =
gPad->AbsPixeltoX(px);
3528 zby1 =
gPad->AbsPixeltoY(py);
3529 zby2 =
gPad->AbsPixeltoY(py);
3532 if (
gPad->GetLogx()) {
3536 if (
gPad->GetLogy()) {
3540 if (zoombox)
Error(
"ExecuteEvent",
"Last zoom box was not deleted");
3541 zoombox =
new TBox(zbx1, zby1, zbx2, zby2);
3558 if (dimension ==1) {
3566 x =
gPad->AbsPixeltoX(px);
3570 xup =
gPad->XtoPad(xlow + barwidth*binwidth);
3571 ylow =
gPad->GetUymin();
3572 px1 =
gPad->XtoAbsPixel(xlow);
3573 px2 =
gPad->XtoAbsPixel(xup);
3574 py1 =
gPad->YtoAbsPixel(ylow);
3584 if (dimension ==1) {
3585 if (
gROOT->GetEditHistograms()) {
3594 binval =
gPad->PadtoY(
gPad->AbsPixeltoY(py2))/factor;
3601 if (opaque && dimension ==2) {
3603 zbx2 =
gPad->AbsPixeltoX(px);
3604 zby2 =
gPad->AbsPixeltoY(py);
3608 zoombox->
SetX2(zbx2);
3609 zoombox->
SetY2(zby2);
3620 if (dimension ==2) {
3625 if (bin2>bin1) xaxis->
SetRange(bin1,bin2);
3630 if (bin2>bin1) yaxis->
SetRange(bin1,bin2);
3639 if (dimension == 2) {
3644 if (bin2>bin1) xaxis->
SetRange(bin1,bin2);
3649 if (bin2>bin1) yaxis->
SetRange(bin1,bin2);
3657 if (dimension ==1) {
3658 if (
gROOT->GetEditHistograms()) {
3659 binval =
gPad->PadtoY(
gPad->AbsPixeltoY(py2))/factor;
3667 if (opaque && dimension ==2) {
3677 if (
x1<
x2 && y1<y2) {
3696 event =
gVirtualX->RequestLocator(1, 1, px, py);
3723 if (!dt && !dtOld)
return nullptr;
3742 if (!
gPad)
return (
char*)
"";
3752 if (
gPad->GetView() || drawOption.
Index(
"cont") >= 0) {
3753 uxmin=
gPad->GetUxmin();
3754 uxmax=
gPad->GetUxmax();
3758 uymin=
gPad->GetUymin();
3759 uymax=
gPad->GetUymax();
3765 Int_t binx,biny,binmin=0,binx1;
3766 if (
gPad->IsVertical()) {
3768 if (drawOption.
Index(
"same") >= 0) {
3770 TIter next(
gPad->GetListOfPrimitives());
3771 while ((
h1 = (
TH1 *)next())) {
3784 for (
Int_t ibin=binx+1; ibin<binx1; ibin++) {
3796 if (drawOption.
Index(
"same") >= 0) {
3798 TIter next(
gPad->GetListOfPrimitives());
3799 while ((
h1 = (
TH1 *)next())) {
3812 for (
Int_t ibin=binx+1; ibin<binx1; ibin++) {
3838 biny =
th2->FindBin(
x,
y);
3840 th2->GetBinTitle(biny),
x,
y,biny,
th2->GetBinContent(biny));
3846 fObjectInfo.
Form(
"(x=%g, y=%g, binx=%d, biny=%d, binc=%g, bine=%g, binn=%d)",
3902 if (!changedBin)
return;
3928 if (
gPad->GetLogx()) {
3932 if (
gPad->GetLogy()) {
3939 if (
gPad->IsVertical()) {
3941 if ((hcenter < uxmin) || (hcenter > uxmax))
return;
3944 if ((hcenter < uymin) || (hcenter > uymax))
return;
3948 if ((hcenter < uymin) || (hcenter > uymax))
return;
3953 if (
gPad->IsVertical()) {
4043 Int_t nch = strlen(choptin);
4044 strlcpy(chopt,choptin,128);
4070 for (
Int_t i=0;i<nch;i++) chopt[i] = toupper(chopt[i]);
4076 char *l1 = strstr(chopt,
"PFC");
4077 char *l2 = strstr(chopt,
"PLC");
4078 char *l3 = strstr(chopt,
"PMC");
4079 if (l1 || l2 || l3) {
4087 l = strstr(chopt,
"MIN0");
4093 l = strstr(chopt,
"SPEC");
4098 l = strstr(chopt,
"BF(");
4100 if (sscanf(&
l[3],
"%d",&bs) > 0) {
4113 l = strstr(chopt,
"GL");
4117 l = strstr(chopt,
"X+");
4122 l = strstr(chopt,
"Y+");
4130 l = strstr(chopt,
"SAMES");
4137 l = strstr(chopt,
"SAME");
4145 l = strstr(chopt,
"PIE");
4152 l = strstr(chopt,
"CANDLE");
4159 l = strstr(chopt,
"VIOLIN");
4166 l = strstr(chopt,
"LEGO");
4177 l = strstr(chopt,
"0");
if (
l) {
Hoption.
Zero = 1; memcpy(
l,
" ",1); }
4180 l = strstr(chopt,
"SURF");
4195 l = strstr(chopt,
"TF3");
4202 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,
"COLZ");
4278 l = strstr(chopt,
"0");
if (
l) {
Hoption.
Zero = 1; memcpy(
l,
" ",1); }
4284 l = strstr(chopt,
"COL" );
4291 l = strstr(chopt,
"0");
if (
l) {
Hoption.
Zero = 1; memcpy(
l,
" ",1); }
4299 l = strstr(chopt,
"AXIS");
if (
l) {
Hoption.
Axis = 1; memcpy(
l,
" ",4); }
4300 l = strstr(chopt,
"AXIG");
if (
l) {
Hoption.
Axis = 2; memcpy(
l,
" ",4); }
4301 l = strstr(chopt,
"SCAT");
if (
l) {
Hoption.
Scat = 1; memcpy(
l,
" ",4); }
4302 l = strstr(chopt,
"TEXT");
4305 if (sscanf(&
l[4],
"%d",&angle) > 0) {
4306 if (angle < 0) angle=0;
4307 if (angle > 90) angle=90;
4313 l = strstr(chopt,
"N");
4322 l = strstr(chopt,
"TRI");
4329 l = strstr(chopt,
"ERR");
if (
l) memcpy(
l,
" ",3);
4332 l = strstr(chopt,
"AITOFF");
4336 l = strstr(chopt,
"MERCATOR");
4340 l = strstr(chopt,
"SINUSOIDAL");
4344 l = strstr(chopt,
"PARABOLIC");
4370 if (strstr(chopt,
"E")) {
4380 if (strstr(chopt,
"X0")) {
4403 Warning(
"MakeChopt",
"option SURF5 is not supported in Cartesian and Polar modes");
4424 char *left = (
char*)strchr(choptin,
'[');
4425 if (!left)
return 0;
4426 char *right = (
char*)strchr(choptin,
']');
4427 if (!right)
return 0;
4428 Int_t nch = right-left;
4429 if (nch < 2)
return 0;
4430 char *cuts = left+1;
4432 char *comma, *minus;
4435 comma = strchr(cuts,
',');
4436 if (comma) *comma = 0;
4437 minus = strchr(cuts,
'-');
4438 if (minus) cuts = minus+1;
4439 while (*cuts ==
' ') cuts++;
4440 Int_t nc = strlen(cuts);
4441 while (cuts[nc-1] ==
' ') {cuts[nc-1] = 0; nc--;}
4445 while ((obj = next())) {
4447 if (strcmp(obj->
GetName(),cuts))
continue;
4460 for (i=0;i<=nch;i++) left[i] =
' ';
4488 gROOT->ProcessLineFast(
Form(
"TSpectrum2Painter::PaintSpectrum((TH2F*)0x%zx,\"%s\",%d)",
4503 Error(
"Paint",
"Option PIE is for 1D histograms only");
4537 Int_t logysav=0, logzsav=0;
4572 gPad->RangeAxisChanged();
4589 if (gridx)
gPad->SetGridx(0);
4590 if (gridy)
gPad->SetGridy(0);
4592 if (gridx)
gPad->SetGridx(1);
4593 if (gridy)
gPad->SetGridy(1);
4628 if (gridx)
gPad->SetGridx(0);
4629 if (gridy)
gPad->SetGridy(0);
4631 if (gridx)
gPad->SetGridx(1);
4632 if (gridy)
gPad->SetGridy(1);
4641 while ((obj = next())) {
4649 if (!
gPad->PadInSelectionMode() && !
gPad->PadInHighlightMode())
4677 arrow->SetAngle(30);
4678 arrow->SetFillStyle(1001);
4684 Int_t ncolors=0, ndivz=0;
4698 for (
Int_t id=1;
id<=2;
id++) {
4705 if (!
IsInside(xk+0.5*xstep,yk+0.5*ystep))
continue;
4723 }
else if (
id == 2) {
4735 if (theColor > ncolors-1) theColor = ncolors-1;
4740 arrow->PaintArrow(
x1, y1,
x2, y2, 0.015,
"|>");
4742 arrow->PaintArrow(
x1, y1,
x2, y2, 0.005,
"|>");
4765 if (drawGridOnly && (
gPad->PadInHighlightMode() ||
gPad->PadInSelectionMode()))
4777 TIter next(
gPad->GetListOfPrimitives());
4780 while ((obj = next())) {
4786 if (strstr(opt,
"hbar")) {
4790 if (!strcmp(xaxis->
GetName(),
"xaxis")) {
4800 static char chopt[10] =
"";
4802 Int_t ndiv, ndivx, ndivy, nx1, nx2, ndivsave;
4803 Int_t useHparam = 0;
4804 Double_t umin, umax, uminsave, umaxsave;
4820 TIter next(
gPad->GetListOfPrimitives());
4821 while ((obj=next())) {
4832 if (
gPad->PadInSelectionMode())
4836 if (
gPad->PadInSelectionMode() || !
gPad->PadInHighlightMode() || (
gPad->PadInHighlightMode() &&
gPad->GetSelected() ==
fXaxis)) {
4847 strlcat(chopt,
"SDH",10);
4848 if (ndivx < 0) strlcat(chopt,
"N",10);
4849 if (
gPad->GetGridx()) {
4850 gridl = (aymax-aymin)/(
gPad->GetY2() -
gPad->GetY1());
4851 strlcat(chopt,
"W",10);
4856 strlcat(chopt,
"G",10);
4878 strlcat(chopt,
"t",10);
4886 if (xAxisPos == 1) {
4902 strlcat(chopt,
"-",10);
4911 umin, umax, ndiv, chopt, gridl, drawGridOnly);
4916 if (
gPad->GetTickx() && !
gPad->PadInSelectionMode() && !
gPad->PadInHighlightMode()) {
4918 cw=strstr(chopt,
"-");
4921 strlcat(chopt,
"-",10);
4923 if (
gPad->GetTickx() < 2) strlcat(chopt,
"U",10);
4924 if ((cw=strstr(chopt,
"W"))) *cw=
'z';
4928 uminsave, umaxsave, ndivsave, chopt, gridl, drawGridOnly);
4934 if (
gPad->PadInSelectionMode())
4938 if (
gPad->PadInSelectionMode() || !
gPad->PadInHighlightMode() || (
gPad->PadInHighlightMode() &&
gPad->GetSelected() ==
fYaxis)) {
4943 strlcat(chopt,
"SDH",10);
4944 if (ndivy < 0) strlcat(chopt,
"N",10);
4945 if (
gPad->GetGridy()) {
4946 gridl = (axmax-axmin)/(
gPad->GetX2() -
gPad->GetX1());
4947 strlcat(chopt,
"W",10);
4952 strlcat(chopt,
"G",10);
4974 strlcat(chopt,
"t",10);
4982 if (yAxisPos == 1) {
4998 strlcat(chopt,
"+L",10);
5007 umin, umax, ndiv, chopt, gridl, drawGridOnly);
5012 if (
gPad->GetTicky() && !
gPad->PadInSelectionMode() && !
gPad->PadInHighlightMode()) {
5013 if (
gPad->GetTicky() < 2) {
5014 strlcat(chopt,
"U",10);
5017 strlcat(chopt,
"+L",10);
5019 if ((cw=strstr(chopt,
"W"))) *cw=
'z';
5023 uminsave, umaxsave, ndivsave, chopt, gridl, drawGridOnly);
5046 if (hcolor ==
gPad->GetFrameFillColor()) ++hcolor;
5048 box.SetFillColor(hcolor);
5049 box.SetFillStyle(hstyle);
5059 if (ymax < gPad->GetUymin())
continue;
5061 if (ymin < gPad->GetUymin())
ymin =
gPad->GetUymin();
5075 box.SetFillColor(hcolor);
5095 if (!strcmp(xaxis->
GetName(),
"xaxis")) {
5109 if (hcolor ==
gPad->GetFrameFillColor()) ++hcolor;
5111 box.SetFillColor(hcolor);
5112 box.SetFillStyle(hstyle);
5121 if (xmax < gPad->GetUxmin())
continue;
5123 if (xmin < gPad->GetUxmin())
xmin =
gPad->GetUxmin();
5136 box.SetFillColor(hcolor);
5149 while ((obj = next())) {
5170 fH->TAttLine::Modify();
5171 fH->TAttFill::Modify();
5173 Double_t z, xk,xstep, yk, ystep, xcent, ycent, xlow, xup, ylow, yup;