3192 const Int_t big = 9999;
3193 const Int_t kMaxDiff = 7;
3204 Int_t curdist = big;
3205 Int_t yxaxis, dyaxis,xyaxis, dxaxis;
3208 if (!PadPointer)
return 0;
3222 if (d3 <= kMaxDiff) {
gPad->SetSelected(
fZaxis);
return 0;}
3224 if (d1 <= kMaxDiff) {
gPad->SetSelected(
fXaxis);
return 0;}
3226 if (d2 <= kMaxDiff) {
gPad->SetSelected(
fYaxis);
return 0;}
3227 if ( px > puxmin && px < puxmax && py > puymax && py < puymin) curdist = 1;
3238 if (px <= xyaxis+dyaxis && px >= xyaxis && py >puymax && py < puymin) {
3247 if (px >= xyaxis-dyaxis && px <= xyaxis && py >puymax && py < puymin) {
3259 if (py >= yxaxis-dxaxis && py <= yxaxis && px <puxmax && px > puxmin) {
3268 if (yxaxis < puymin) yxaxis = puymin;
3269 if (py <= yxaxis+dxaxis && py >= yxaxis && px <puxmax && px > puxmin) {
3279 if ((px > puxmin) && (py < puymin) && (px < puxmax) && (py > puymax))
3295 Int_t bin =
th2->FindBin(pxu, pyu);
3296 if (bin>0) curdist = 1;
3302 if ( px > puxmin + delta2
3303 && px < puxmax - delta2
3304 && py > puymax + delta2
3305 && py < puymin - delta2) {curdist =1;
goto FUNCTIONS;}
3309 if (
gPad->IsVertical()) {
3314 if (binval == 0 && pybin < puymin) pybin = 10000;
3320 for (
Int_t ibin=bin+1; ibin<binsup; ibin++) {
3322 if (binvalmin>binvaltmp) binvalmin=binvaltmp;
3323 if (binvalmax<binvaltmp) binvalmax=binvaltmp;
3325 Int_t pybinmin =
gPad->YtoAbsPixel(
gPad->YtoPad(binvalmax));
3326 Int_t pybinmax =
gPad->YtoAbsPixel(
gPad->YtoPad(binvalmin));
3327 if (py<pybinmax+kMaxDiff/2 && py>pybinmin-kMaxDiff/2) pybin = py;
3329 if (bin != binsup) {
3331 Int_t pybinsub =
gPad->YtoAbsPixel(
gPad->YtoPad(binsupval));
3332 if (py <=
TMath::Max(pybinsub,pybin) && py >=
TMath::Min(pybinsub,pybin) && pybin != 10000)
return 0;
3342 if (binval == 0 && pxbin > puxmin) pxbin = 10000;
3348 for (
Int_t ibin=bin+1; ibin<binsup; ibin++) {
3350 if (binvalmin>binvaltmp) binvalmin=binvaltmp;
3351 if (binvalmax<binvaltmp) binvalmax=binvaltmp;
3353 Int_t pxbinmin =
gPad->XtoAbsPixel(
gPad->XtoPad(binvalmax));
3354 Int_t pxbinmax =
gPad->XtoAbsPixel(
gPad->XtoPad(binvalmin));
3355 if (px<pxbinmax+kMaxDiff/2 && px>pxbinmin-kMaxDiff/2) pxbin = px;
3366 else dist =
f->DistancetoPrimitive(px,py);
3380 Error(
"DrawPanel",
"need to draw histogram first");
3385 gROOT->ProcessLine(
Form(
"((TCanvas*)0x%lx)->Selected((TVirtualPad*)0x%lx,(TObject*)0x%lx,1)",
3400 static Int_t bin, px1, py1, px2, py2, pyold;
3401 static TBox *zoombox;
3405 Double_t xlow, xup, ylow, binval,
x, baroffset, barwidth, binwidth;
3408 if (!
gPad->IsEditable())
return;
3429 if (IsSame.
Index(
"same")>=0) {
3431 TIter next(
gPad->GetListOfPrimitives());
3432 while ((
h1 = (
TH1 *)next())) {
3449 if (!opaque)
gVirtualX->SetLineColor(-1);
3450 fH->TAttLine::Modify();
3452 if (opaque && dimension ==2) {
3453 zbx1 =
gPad->AbsPixeltoX(px);
3454 zbx2 =
gPad->AbsPixeltoX(px);
3455 zby1 =
gPad->AbsPixeltoY(py);
3456 zby2 =
gPad->AbsPixeltoY(py);
3459 if (
gPad->GetLogx()) {
3463 if (
gPad->GetLogy()) {
3467 zoombox =
new TBox(zbx1, zby1, zbx2, zby2);
3484 if (dimension ==1) {
3492 x =
gPad->AbsPixeltoX(px);
3496 xup =
gPad->XtoPad(xlow + barwidth*binwidth);
3497 ylow =
gPad->GetUymin();
3498 px1 =
gPad->XtoAbsPixel(xlow);
3499 px2 =
gPad->XtoAbsPixel(xup);
3500 py1 =
gPad->YtoAbsPixel(ylow);
3510 if (dimension ==1) {
3511 if (
gROOT->GetEditHistograms()) {
3520 binval =
gPad->PadtoY(
gPad->AbsPixeltoY(py2))/factor;
3527 if (opaque && dimension ==2) {
3529 zbx2 =
gPad->AbsPixeltoX(px);
3530 zby2 =
gPad->AbsPixeltoY(py);
3533 zoombox->
SetX2(zbx2);
3534 zoombox->
SetY2(zby2);
3544 if (dimension ==2) {
3549 if (bin2>bin1) xaxis->
SetRange(bin1,bin2);
3554 if (bin2>bin1) yaxis->
SetRange(bin1,bin2);
3563 if (dimension == 2) {
3568 if (bin2>bin1) xaxis->
SetRange(bin1,bin2);
3573 if (bin2>bin1) yaxis->
SetRange(bin1,bin2);
3581 if (dimension ==1) {
3582 if (
gROOT->GetEditHistograms()) {
3583 binval =
gPad->PadtoY(
gPad->AbsPixeltoY(py2))/factor;
3591 if (opaque && dimension ==2) {
3601 if (
x1<
x2 && y1<y2) {
3610 if (opaque)
gVirtualX->SetLineColor(-1);
3620 event =
gVirtualX->RequestLocator(1, 1, px, py);
3647 if (!dt && !dtOld)
return nullptr;
3666 if (!
gPad)
return (
char*)
"";
3676 if (
gPad->GetView() || drawOption.
Index(
"cont") >= 0) {
3677 uxmin=
gPad->GetUxmin();
3678 uxmax=
gPad->GetUxmax();
3682 uymin=
gPad->GetUymin();
3683 uymax=
gPad->GetUymax();
3689 Int_t binx,biny,binmin=0,binx1;
3690 if (
gPad->IsVertical()) {
3692 if (drawOption.
Index(
"same") >= 0) {
3694 TIter next(
gPad->GetListOfPrimitives());
3695 while ((
h1 = (
TH1 *)next())) {
3708 for (
Int_t ibin=binx+1; ibin<binx1; ibin++) {
3720 if (drawOption.
Index(
"same") >= 0) {
3722 TIter next(
gPad->GetListOfPrimitives());
3723 while ((
h1 = (
TH1 *)next())) {
3736 for (
Int_t ibin=binx+1; ibin<binx1; ibin++) {
3762 biny =
th2->FindBin(
x,
y);
3764 th2->GetBinTitle(biny),
x,
y,biny,
th2->GetBinContent(biny));
3770 fObjectInfo.
Form(
"(x=%g, y=%g, binx=%d, biny=%d, binc=%g, bine=%g, binn=%d)",
3826 if (!changedBin)
return;
3852 if (
gPad->GetLogx()) {
3856 if (
gPad->GetLogy()) {
3863 if (
gPad->IsVertical()) {
3865 if ((hcenter < uxmin) || (hcenter > uxmax))
return;
3868 if ((hcenter < uymin) || (hcenter > uymax))
return;
3872 if ((hcenter < uymin) || (hcenter > uymax))
return;
3877 if (
gPad->IsVertical()) {
3967 Int_t nch = strlen(choptin);
3968 strlcpy(chopt,choptin,128);
3994 for (
Int_t i=0;i<nch;i++) chopt[i] = toupper(chopt[i]);
4000 char *l1 = strstr(chopt,
"PFC");
4001 char *l2 = strstr(chopt,
"PLC");
4002 char *l3 = strstr(chopt,
"PMC");
4003 if (l1 || l2 || l3) {
4011 l = strstr(chopt,
"MIN0");
4017 l = strstr(chopt,
"SPEC");
4022 l = strstr(chopt,
"BF(");
4024 if (sscanf(&
l[3],
"%d",&bs) > 0) {
4037 l = strstr(chopt,
"GL");
4041 l = strstr(chopt,
"X+");
4046 l = strstr(chopt,
"Y+");
4054 l = strstr(chopt,
"SAMES");
4061 l = strstr(chopt,
"SAME");
4069 l = strstr(chopt,
"PIE");
4076 l = strstr(chopt,
"CANDLE");
4083 l = strstr(chopt,
"VIOLIN");
4090 l = strstr(chopt,
"LEGO");
4101 l = strstr(chopt,
"0");
if (
l) {
Hoption.
Zero = 1; memcpy(
l,
" ",1); }
4104 l = strstr(chopt,
"SURF");
4119 l = strstr(chopt,
"TF3");
4126 l = strstr(chopt,
"ISO");
4133 l = strstr(chopt,
"LIST");
if (
l) {
Hoption.
List = 1; memcpy(
l,
" ",4);}
4135 l = strstr(chopt,
"CONT");
4150 l = strstr(chopt,
"HBAR");
4159 l = strstr(chopt,
"BAR");
4169 l = strstr(chopt,
"ARR" );
4175 l = strstr(chopt,
"COL");
if (
l) {
Hoption.
Arrow = 2; memcpy(
l,
" ",3); }
4181 l = strstr(chopt,
"BOX" );
4194 l = strstr(chopt,
"COLZ");
4202 l = strstr(chopt,
"0");
if (
l) {
Hoption.
Zero = 1; memcpy(
l,
" ",1); }
4208 l = strstr(chopt,
"COL" );
4215 l = strstr(chopt,
"0");
if (
l) {
Hoption.
Zero = 1; memcpy(
l,
" ",1); }
4224 l = strstr(chopt,
"AXIS");
if (
l) {
Hoption.
Axis = 1; memcpy(
l,
" ",4); }
4225 l = strstr(chopt,
"AXIG");
if (
l) {
Hoption.
Axis = 2; memcpy(
l,
" ",4); }
4226 l = strstr(chopt,
"SCAT");
if (
l) {
Hoption.
Scat = 1; memcpy(
l,
" ",4); }
4227 l = strstr(chopt,
"TEXT");
4230 if (sscanf(&
l[4],
"%d",&angle) > 0) {
4231 if (angle < 0) angle=0;
4232 if (angle > 90) angle=90;
4238 l = strstr(chopt,
"N");
4247 l = strstr(chopt,
"TRI");
4254 l = strstr(chopt,
"ERR");
if (
l) memcpy(
l,
" ",3);
4257 l = strstr(chopt,
"AITOFF");
4261 l = strstr(chopt,
"MERCATOR");
4265 l = strstr(chopt,
"SINUSOIDAL");
4269 l = strstr(chopt,
"PARABOLIC");
4295 if (strstr(chopt,
"E")) {
4305 if (strstr(chopt,
"X0")) {
4328 Warning(
"MakeChopt",
"option SURF5 is not supported in Cartesian and Polar modes");
4349 char *left = (
char*)strchr(choptin,
'[');
4350 if (!left)
return 0;
4351 char *right = (
char*)strchr(choptin,
']');
4352 if (!right)
return 0;
4353 Int_t nch = right-left;
4354 if (nch < 2)
return 0;
4355 char *cuts = left+1;
4357 char *comma, *minus;
4360 comma = strchr(cuts,
',');
4361 if (comma) *comma = 0;
4362 minus = strchr(cuts,
'-');
4363 if (minus) cuts = minus+1;
4364 while (*cuts ==
' ') cuts++;
4365 Int_t nc = strlen(cuts);
4366 while (cuts[nc-1] ==
' ') {cuts[nc-1] = 0; nc--;}
4370 while ((obj = next())) {
4372 if (strcmp(obj->
GetName(),cuts))
continue;
4385 for (i=0;i<=nch;i++) left[i] =
' ';
4413 gROOT->ProcessLineFast(
Form(
"TSpectrum2Painter::PaintSpectrum((TH2F*)0x%lx,\"%s\",%d)",
4423 Error(
"Paint",
"Option PIE is for 1D histograms only");
4457 Int_t logysav=0, logzsav=0;
4508 if (gridx)
gPad->SetGridx(0);
4509 if (gridy)
gPad->SetGridy(0);
4511 if (gridx)
gPad->SetGridx(1);
4512 if (gridy)
gPad->SetGridy(1);
4547 if (gridx)
gPad->SetGridx(0);
4548 if (gridy)
gPad->SetGridy(0);
4550 if (gridx)
gPad->SetGridx(1);
4551 if (gridy)
gPad->SetGridy(1);
4560 while ((obj = next())) {
4568 if (!
gPad->PadInSelectionMode() && !
gPad->PadInHighlightMode())
4596 arrow->SetAngle(30);
4597 arrow->SetFillStyle(1001);
4603 Int_t ncolors=0, ndivz=0;
4617 for (
Int_t id=1;
id<=2;
id++) {
4624 if (!
IsInside(xk+0.5*xstep,yk+0.5*ystep))
continue;
4642 }
else if (
id == 2) {
4654 if (theColor > ncolors-1) theColor = ncolors-1;
4659 arrow->PaintArrow(
x1, y1,
x2, y2, 0.015,
"|>");
4661 arrow->PaintArrow(
x1, y1,
x2, y2, 0.005,
"|>");
4684 if (drawGridOnly && (
gPad->PadInHighlightMode() ||
gPad->PadInSelectionMode()))
4696 TIter next(
gPad->GetListOfPrimitives());
4699 while ((obj = next())) {
4705 if (strstr(opt,
"hbar")) {
4709 if (!strcmp(xaxis->
GetName(),
"xaxis")) {
4719 static char chopt[10] =
"";
4721 Int_t ndiv, ndivx, ndivy, nx1, nx2, ndivsave;
4722 Int_t useHparam = 0;
4723 Double_t umin, umax, uminsave, umaxsave;
4739 TIter next(
gPad->GetListOfPrimitives());
4740 while ((obj=next())) {
4751 if (
gPad->PadInSelectionMode())
4755 if (
gPad->PadInSelectionMode() || !
gPad->PadInHighlightMode() || (
gPad->PadInHighlightMode() &&
gPad->GetSelected() ==
fXaxis)) {
4766 strlcat(chopt,
"SDH",10);
4767 if (ndivx < 0) strlcat(chopt,
"N",10);
4768 if (
gPad->GetGridx()) {
4769 gridl = (aymax-aymin)/(
gPad->GetY2() -
gPad->GetY1());
4770 strlcat(chopt,
"W",10);
4775 strlcat(chopt,
"G",10);
4797 strlcat(chopt,
"t",10);
4805 if (xAxisPos == 1) {
4821 strlcat(chopt,
"-",10);
4830 umin, umax, ndiv, chopt, gridl, drawGridOnly);
4835 if (
gPad->GetTickx() && !
gPad->PadInSelectionMode() && !
gPad->PadInHighlightMode()) {
4837 cw=strstr(chopt,
"-");
4840 strlcat(chopt,
"-",10);
4842 if (
gPad->GetTickx() < 2) strlcat(chopt,
"U",10);
4843 if ((cw=strstr(chopt,
"W"))) *cw=
'z';
4847 uminsave, umaxsave, ndivsave, chopt, gridl, drawGridOnly);
4853 if (
gPad->PadInSelectionMode())
4857 if (
gPad->PadInSelectionMode() || !
gPad->PadInHighlightMode() || (
gPad->PadInHighlightMode() &&
gPad->GetSelected() ==
fYaxis)) {
4862 strlcat(chopt,
"SDH",10);
4863 if (ndivy < 0) strlcat(chopt,
"N",10);
4864 if (
gPad->GetGridy()) {
4865 gridl = (axmax-axmin)/(
gPad->GetX2() -
gPad->GetX1());
4866 strlcat(chopt,
"W",10);
4871 strlcat(chopt,
"G",10);
4893 strlcat(chopt,
"t",10);
4901 if (yAxisPos == 1) {
4917 strlcat(chopt,
"+L",10);
4926 umin, umax, ndiv, chopt, gridl, drawGridOnly);
4931 if (
gPad->GetTicky() && !
gPad->PadInSelectionMode() && !
gPad->PadInHighlightMode()) {
4932 if (
gPad->GetTicky() < 2) {
4933 strlcat(chopt,
"U",10);
4936 strlcat(chopt,
"+L",10);
4938 if ((cw=strstr(chopt,
"W"))) *cw=
'z';
4942 uminsave, umaxsave, ndivsave, chopt, gridl, drawGridOnly);
4965 if (hcolor ==
gPad->GetFrameFillColor()) ++hcolor;
4967 box.SetFillColor(hcolor);
4968 box.SetFillStyle(hstyle);
4978 if (ymax < gPad->GetUymin())
continue;
4980 if (ymin < gPad->GetUymin())
ymin =
gPad->GetUymin();
4994 box.SetFillColor(hcolor);
5014 if (!strcmp(xaxis->
GetName(),
"xaxis")) {
5028 if (hcolor ==
gPad->GetFrameFillColor()) ++hcolor;
5030 box.SetFillColor(hcolor);
5031 box.SetFillStyle(hstyle);
5040 if (xmax < gPad->GetUxmin())
continue;
5042 if (xmin < gPad->GetUxmin())
xmin =
gPad->GetUxmin();
5055 box.SetFillColor(hcolor);
5068 while ((obj = next())) {
5089 fH->TAttLine::Modify();
5090 fH->TAttFill::Modify();
5092 Double_t z, xk,xstep, yk, ystep, xcent, ycent, xlow, xup, ylow, yup;
5103 Double_t zminlin = zmin, zmaxlin = zmax;
5109 TIter next(
gPad->GetListOfPrimitives());
5110 while ((h2 = (
TH2 *)next())) {