18#include "TVirtualPad.h"
104 if(gPad && gPad->GetListOfPrimitives()->FindObject(
this)==
nullptr) {
119 gROOT->GetListOfCanvases()->RecursiveRemove(
this);
135 TMarker::ExecuteEvent(event, px, py);
136 if (event == kButton1Up) {
145 painter->SetMarker(
this);
153 Int_t bin =
fxHisto->GetBin(xbin, ybin);
154 Stat_t content =
fxHisto->GetBinContent(bin);
155 Double_t x =
fxHisto->GetXaxis()->GetBinCenter(xbin);
157 if (
fxHisto->GetDimension() == 1) {
159 }
else if (
fxHisto->GetDimension() == 2) {
160 y =
fxHisto->GetYaxis()->GetBinCenter(ybin);
185 return (Int_t)
fxHisto->GetBinContent(bin);
193 Double_t xpos = GetX() + xoff;
206 ypos = GetY() + yoff;
212 TString textbuffer =
"Marker ";
214 textbuffer +=
" with";
217 textbuffer +=
" histogram: ";
218 textbuffer += hist->GetName();
220 textbuffer +=
"out histogram";
222 textbuffer += TString::Format(
"\n X: \t\tY: \t\tXbin:\t\tYbin:\t\tCounts:\n %.2f\t\t%.2f\t\t%d\t\t%d\t\t%d",
225 TString option = opt;
227 if (option.Contains(
"go4log"))
258 Bool_t XBINDRAW, Bool_t YBINDRAW, Bool_t CONTDRAW,
const char *NUMFORMAT)
272 Bool_t &XBINDRAW, Bool_t &YBINDRAW, Bool_t &CONTDRAW, TString &NUMFORMAT)
static const char * Message(Int_t prio, const char *text,...) GO4_PRINTF2_ARGS
Display a message.
Int_t GetXbin() const
Deliver x axis bin number of work histogram at marker position.
Bool_t fbYbinDraw
If true, draw corresponding value as label on working pad.
TString fxNumFormat
format string for all label numbers.
TH1 * fxHisto
Reference to currently used histogram (for bin contents).
Bool_t CheckDrawPad() const
True if current draw pad is still existing.
static Bool_t fgbYBINDRAW
default setting for all markers of ybindraw flag.
static Bool_t fgbYDRAW
default setting for all markers of ydraw flag.
void SetToBin(Int_t xbin, Int_t ybin=0)
Set marker to position according to work histogram axis.
Bool_t fbXbinDraw
If true, draw corresponding value as label on working pad.
static Bool_t fgbCONTDRAW
default setting for all markers of bin content flag.
TVirtualPad * fxDrawPad
Remember last pad used for Draw.
static UInt_t fguInstanceCounter
use this counter for automatic naming and coloring
void ResetLabel()
Will reset label position to defaults.
void InitLabelStyle()
Initialize label setup from static default variables.
void Print(Option_t *opt="") const override
Implement standard root print.
static Bool_t fgbXDRAW
default setting for all markers of xdraw flag.
void SaveLabelStyle()
This will save draw flags into static default setup.
Bool_t fbXDraw
If true, draw corresponding value as label on working pad.
TGo4MarkerPainter * fxPainter
Painter instance to display the condition in root pad.
Bool_t fbHasLabel
Switch marker label on or off.
Double_t GetLabelY() const
Calculate initial label coordinate from marker position.
static Bool_t fgbXBINDRAW
default setting for all markers of xbindraw flag.
const char * GetName() const override
TMarker is not TNamed, so we implement name ourself.
static Bool_t fgbHASLABEL
default setting for all markers of label on/off flag.
virtual TGo4MarkerPainter * CreatePainter()
Factory method to generate (optional subclass) implementation for painter.
void SetHistogram(TH1 *histo)
TVirtualPad * GetDrawPad() const
void Paint(Option_t *opt="") override
Display marker with plain root canvas and in go4 viewpanel.
static void SetGlobalStyle(Bool_t HASLABEL, Bool_t HASCONNECTOR, Bool_t XDRAW, Bool_t YDRAW, Bool_t XBINDRAW, Bool_t YBINDRAW, Bool_t CONTDRAW, const char *NUMFORMAT)
static Bool_t fgbHASCONNECTOR
default setting for all markers of connector line flag.
Int_t GetCont() const
Deliver bin content of work histogram at marker position.
static Int_t GetInstances()
Bool_t CheckHistogram() const
True if current histogram is still existing.
Int_t GetYbin() const
Deliver y axis bin number of work histogram at marker position.
virtual void UnDraw(Option_t *opt="")
Erase view of this marker from the pad.
Bool_t fbYDraw
If true, draw corresponding value as label on working pad.
Bool_t fbHasConnector
Switch connection line between marker and label on or off.
void SetDrawPad(TVirtualPad *pad)
TH1 * GetHistogram() const
TString fxName
since TMarker is not TNamed, we provide identifier string here:
void Pop() override
Re-implement TObject method to pop all our views to front.
static void GetGlobalStyle(Bool_t &HASLABEL, Bool_t &HASCONNECTOR, Bool_t &XDRAW, Bool_t &YDRAW, Bool_t &XBINDRAW, Bool_t &YBINDRAW, Bool_t &CONTDRAW, TString &NUMFORMAT)
Bool_t fbContDraw
If true, draw corresponding value as label on working pad.
void Draw(Option_t *opt="") override
Draw this marker on current pad.
void SetPainted(Bool_t on)
static TString fgxNUMFORMAT
default setting for all conditions with format string for numbers.
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Reimplemented to pop our labels to front when selected.
Double_t GetLabelX() const
Calculate initial label coordinate from marker position.
static void PrintLine(const char *text,...)
Print single line of debug output with appropriate indent.