4#include "KVPIDIntervalPainter.h"
20 if (active_intervals) {
80 :
TMarker(P->GetInterval()->GetPID(), P->GetHisto()->GetBinContent(P->GetHisto()->FindBin(P->GetInterval()->GetPID())), 23),
82 fLabel{GetX(), GetY(),
Form(
" (%d,%d)", P->GetInterval()->GetZ(), P->GetInterval()->GetA())},
84 pid{P->GetInterval()->GetPID()}
113 static Int_t pxold, pyold;
118 if (!
gPad->IsEditable())
return;
121 double fixed_Y = parent->GetHisto()->GetBinContent(parent->GetHisto()->FindBin(GetX()));
142 if (!opaque)
gVirtualX->DrawPolyMarker(1, &
p);
145 if (!opaque)
gVirtualX->DrawPolyMarker(1, &
p);
149 if (ndcsav) SetNDC(
kFALSE);
150 auto x =
gPad->PadtoX(
gPad->AbsPixeltoX(px));
151 if (CheckPosition(
x)) SetX(
x);
153 gPad->ShowGuidelines(
this,
event,
'i',
true);
161 if (ndcsav && !
TestBit(kMarkerNDC)) {
162 auto x = (fX -
gPad->GetX1()) / (
gPad->GetX2() -
gPad->GetX1());
163 if (CheckPosition(
x)) SetX(
x);
171 dpx =
gPad->GetX2() -
gPad->GetX1();
172 dpy =
gPad->GetY2() -
gPad->GetY1();
175 auto x = (
gPad->AbsPixeltoX(pxold) - xp1) / dpx;
176 if (CheckPosition(
x)) SetX(
x);
180 auto x =
gPad->PadtoX(
gPad->AbsPixeltoX(px));
181 if (CheckPosition(
x)) SetX(
x);
195 parent->GetInterval()->SetPID(
pid);
232 fLabel.SetTextColor(
kBlack);
237 fLabel.SetTextColor(def_color);
249 double fixed_Y = parent->GetHisto()->GetBinContent(parent->GetHisto()->FindBin(
pid));
252 fLabel.SetText(GetX(), GetY(),
Form(
" (%d,%d)", z,
a));
266 double fixed_Y1 = parent->GetCanvas()->GetFrame()->GetY1();
267 double fixed_Y2 = parent->GetCanvas()->GetFrame()->GetY2();
268 if (parent->GetCanvas()->GetLogy()) {
274 static Int_t d1, d2, px1, px2, py1, py2;
275 static Int_t pxold, pyold, px1old, py1old, px2old, py2old;
276 static Double_t oldX1, oldY1, oldX2, oldY2;
277 static Bool_t p1, p2, pL, ndcsav;
283 if (!
gPad->IsEditable())
return;
304 px1 =
gPad->UtoPixel(GetX1());
305 py1 =
gPad->VtoPixel(GetY1());
306 px2 =
gPad->UtoPixel(GetX2());
307 py2 =
gPad->VtoPixel(GetY2());
310 px1 =
gPad->XtoAbsPixel(
gPad->XtoPad(GetX1()));
311 py1 =
gPad->YtoAbsPixel(
gPad->YtoPad(GetY1()));
312 px2 =
gPad->XtoAbsPixel(
gPad->XtoPad(GetX2()));
313 py2 =
gPad->YtoAbsPixel(
gPad->YtoPad(GetY2()));
317 d1 =
abs(px1 - px) +
abs(py1 - py);
325 d2 =
abs(px2 - px) +
abs(py2 - py);
346 gVirtualX->DrawLine(px1old, py1old, px2, py2);
352 auto x =
gPad->GetX1() + oldX2 * (
gPad->GetX2() -
gPad->GetX1());
353 if (CheckPosition(
x)) SetX(
x);
364 gVirtualX->DrawLine(px1, py1, px2old, py2old);
370 auto x =
gPad->GetX1() + oldX1 * (
gPad->GetX2() -
gPad->GetX1());
371 if (CheckPosition(
x)) SetX(
x);
381 if (!opaque)
gVirtualX->DrawLine(px1, py1, px2, py2);
388 if (!opaque)
gVirtualX->DrawLine(px1, py1, px2, py2);
392 if (ndcsav) SetNDC(
kFALSE);
393 auto x =
gPad->AbsPixeltoX(px1);
394 if (CheckPosition(
x)) SetX(
x);
403 if (GetX1() > GetX2()) {
404 if (GetY1() > GetY2())
405 gPad->ShowGuidelines(
this,
event,
'2',
true);
407 gPad->ShowGuidelines(
this,
event,
'3',
true);
410 if (GetY1() > GetY2())
411 gPad->ShowGuidelines(
this,
event,
'1',
true);
413 gPad->ShowGuidelines(
this,
event,
'4',
true);
418 if (GetX1() > GetX2()) {
419 if (GetY1() > GetY2())
420 gPad->ShowGuidelines(
this,
event,
'4',
true);
422 gPad->ShowGuidelines(
this,
event,
'1',
true);
425 if (GetY1() > GetY2())
426 gPad->ShowGuidelines(
this,
event,
'3',
true);
428 gPad->ShowGuidelines(
this,
event,
'2',
true);
432 gPad->ShowGuidelines(
this,
event,
'i',
true);
441 if (
gROOT->IsEscaped()) {
454 if (ndcsav && !
TestBit(kLineNDC)) {
455 auto x = ((GetX1() -
gPad->GetX1()) / (
gPad->GetX2() -
gPad->GetX1()));
456 if (CheckPosition(
x)) SetX(
x);
466 dpx =
gPad->GetX2() -
gPad->GetX1();
467 dpy =
gPad->GetY2() -
gPad->GetY1();
471 auto x = (
gPad->AbsPixeltoX(px) - xp1) / dpx;
472 if (CheckPosition(
x)) SetX(
x);
477 auto x = ((
gPad->AbsPixeltoX(px) - xp1) / dpx);
478 if (CheckPosition(
x)) SetX(
x);
483 auto x = ((
gPad->AbsPixeltoX(px1) - xp1) / dpx);
484 if (CheckPosition(
x)) SetX(
x);
492 auto x = (
gPad->PadtoX(
gPad->AbsPixeltoX(px)));
493 if (CheckPosition(
x)) SetX(
x);
498 auto x = (
gPad->PadtoX(
gPad->AbsPixeltoX(px)));
499 if (CheckPosition(
x)) SetX(
x);
504 auto x = (
gPad->PadtoX(
gPad->AbsPixeltoX(px1)));
505 if (CheckPosition(
x)) SetX(
x);
512 if (p1) SetX2(GetX1());
513 if (p2) SetX1(GetX2());
516 if (p1) SetY2(fixed_Y1);
517 if (p2) SetY1(fixed_Y2);
521 if (!opaque)
gVirtualX->SetLineColor(-1);
530 event =
gVirtualX->RequestLocator(1, 1, px, py);
568 double fixed_Y1 = parent->GetCanvas()->GetFrame()->GetY1();
569 double fixed_Y2 = parent->GetCanvas()->GetFrame()->GetY2();
570 if (parent->GetCanvas()->GetLogy()) {
595 if (
type == limit_t::lower) {
599 ok = (
x > parent->GetPIDPosition()) && (
x > parent->GetPIDIntervalLowerLimit());
601 if (!ok)
return false;
602 bool ok_left = parent->get_left_interval() ?
603 x > parent->get_left_interval()->GetPIDIntervalUpperLimit() :
true;
604 bool ok_right = parent->get_right_interval() ?
605 x < parent->get_right_interval()->GetPIDIntervalLowerLimit() :
true;
606 return (ok && ok_left && ok_right);
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t SetLineWidth
Option_t Option_t SetLineColor
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
char * Form(const char *fmt,...)
void Paint(Option_t *option="")
bool CheckPosition(double x)
void ExecuteEvent(Int_t event, Int_t px, Int_t py)
void HighLight(bool hi=true)
void HighLight(bool hi=true)
void Update(int z, int a, double pid)
update Z, A, and position of PID marker
void ExecuteEvent(Int_t event, Int_t px, Int_t py)
void Paint(Option_t *option="")
Graphical representation of a PID interval in the KVIDZAFromZGrid mass assignation GUI.
Double_t GetHistoXAxisLowerLimit() const
double GetPIDIntervalUpperLimit() const
void Draw(Option_t *option="")
pid_line fLine1
represents lower limit of PID for interval
pid_marker fMarker
represents position of PID for interval
void HighLight(bool hi=true)
pid_line fLine2
represents upper limit of PID for interval
virtual void SetMarkerColor(Color_t mcolor=1)
virtual void SetTextAlign(Short_t align=11)
virtual void SetTextColor(Color_t tcolor=1)
virtual void SetTextFont(Font_t tfont=62)
virtual void SetTextSize(Float_t tsize=1)
void Paint(Option_t *option="") override
TObject * Remove(const TObjLinkPtr_t &lnk)
void Paint(Option_t *option="") override
virtual void SetTitle(const char *title="")
virtual void SetName(const char *name)
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
TList * GetListOfPrimitives() const override
void Modified(Bool_t flag=1) override
RVec< PromoteType< T > > abs(const RVec< T > &v)