GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
TGo4Marker.h
Go to the documentation of this file.
1// $Id$
2//-----------------------------------------------------------------------
3// The GSI Online Offline Object Oriented (Go4) Project
4// Experiment Data Processing at EE department, GSI
5//-----------------------------------------------------------------------
6// Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7// Planckstr. 1, 64291 Darmstadt, Germany
8// Contact: http://go4.gsi.de
9//-----------------------------------------------------------------------
10// This software can be used under the license agreements as stated
11// in Go4License.txt file which is part of the distribution.
12//-----------------------------------------------------------------------
13
14#ifndef TGO4MARKER_H
15#define TGO4MARKER_H
16
17#include "TMarker.h"
18#include "TString.h"
19
21class TH1;
22class TVirtualPad;
23
31
32class TGo4Marker : public TMarker {
33
34public:
35 TGo4Marker();
36 TGo4Marker(Double_t x, Double_t y, Int_t style);
37 virtual ~TGo4Marker();
38
41 void Print(Option_t *opt = "") const override;
42
44 void Paint(Option_t *opt = "") override;
45
47 void Draw(Option_t *opt = "") override;
48
50 virtual void UnDraw(Option_t *opt = "");
51
53 void Pop() override;
54
56 void ExecuteEvent(Int_t event, Int_t px, Int_t py) override;
57
60
61 void DeletePainter();
62
63 void SetVisible(Bool_t on) { fbVisible = on; }
64 Bool_t IsVisible() const { return fbVisible; }
65 virtual void SetName(const char *name) { fxName = name; } // *MENU*
66 // void DeleteMarker(); // *MENU*
67
69 void SetToBin(Int_t xbin, Int_t ybin = 0); // *MENU*
70 void SetLabelDraw(Bool_t on) { fbHasLabel = on; } // // *TOGGLE* *GETTER=HasLabel
71 Bool_t HasLabel() const { return fbHasLabel; }
72 void SetLineDraw(Bool_t on) { fbHasConnector = on; } // *TOGGLE* *GETTER=HasConnector
73 Bool_t HasConnector() const { return fbHasConnector; }
74 void SetXDraw(Bool_t on) { fbXDraw = on; } // *TOGGLE* *GETTER=IsXDraw
75 Bool_t IsXDraw() const { return fbXDraw; }
76 void SetYDraw(Bool_t on) { fbYDraw = on; } // *TOGGLE* *GETTER=IsYDraw
77 Bool_t IsYDraw() const { return fbYDraw; }
78 void SetXbinDraw(Bool_t on) { fbXbinDraw = on; } // *TOGGLE* *GETTER=IsXbinDraw
79 Bool_t IsXbinDraw() const { return fbXbinDraw; }
80 void SetYbinDraw(Bool_t on) { fbYbinDraw = on; } // *TOGGLE* *GETTER=IsYbinDraw
81 Bool_t IsYbinDraw() const { return fbYbinDraw; }
82 void SetContDraw(Bool_t on) { fbContDraw = on; } // *TOGGLE* *GETTER=IsContDraw
83 Bool_t IsContDraw() const { return fbContDraw; }
84
85 const char *GetNumFormat() const { return fxNumFormat.Data(); }
86 void SetNumFormat(const char *fmt="%.4E"){ fxNumFormat = fmt; }// *MENU*
87
89 void SaveLabelStyle(); // *MENU*
90
92 void ResetLabel(); // *MENU*
93
95 void InitLabelStyle();
96
97 void SetHistogram(TH1 *histo);
98 TH1 *GetHistogram() const { return fxHisto; }
99
101 const char *GetName() const override { return fxName.Data(); }
102
103 void SetXY(Double_t x, Double_t y)
104 {
105 SetX(x);
106 SetY(y);
107 }
108
110 Int_t GetXbin() const;
112 Int_t GetYbin() const;
114 Int_t GetCont() const;
116 Double_t GetLabelX() const;
118 Double_t GetLabelY() const;
119
120 static Int_t GetInstances();
121
122 TVirtualPad *GetDrawPad() const { return fxDrawPad; }
123
125 Bool_t CheckDrawPad() const;
127 Bool_t CheckHistogram() const;
128
130 static Bool_t fgbHASLABEL;
131
133 static Bool_t fgbHASCONNECTOR;
134
136 static Bool_t fgbXDRAW;
137
139 static Bool_t fgbYDRAW;
140
142 static Bool_t fgbXBINDRAW;
143
145 static Bool_t fgbYBINDRAW;
146
148 static Bool_t fgbCONTDRAW;
149
151 static TString fgxNUMFORMAT;
152
153 static void SetGlobalStyle(Bool_t HASLABEL, Bool_t HASCONNECTOR, Bool_t XDRAW, Bool_t YDRAW,
154 Bool_t XBINDRAW,Bool_t YBINDRAW,Bool_t CONTDRAW, const char *NUMFORMAT);
155
156 static void GetGlobalStyle(Bool_t &HASLABEL, Bool_t &HASCONNECTOR, Bool_t &XDRAW, Bool_t &YDRAW,
157 Bool_t &XBINDRAW, Bool_t &YBINDRAW, Bool_t &CONTDRAW, TString &NUMFORMAT);
158
159protected:
160
165
166 void SetPainted(Bool_t on) { fbIsPainted=on; }
167 Bool_t IsPainted() const { return fbIsPainted; }
168
169 void SetDrawPad(TVirtualPad *pad);
170
171private:
172
174 TString fxName;
175
178 Bool_t fbIsPainted{kFALSE};
179
181 Bool_t fbVisible{kTRUE};
182
184 Bool_t fbHasLabel{kTRUE};
185
187 Bool_t fbHasConnector{kTRUE};
188
190 Bool_t fbXDraw{kTRUE};
191
193 Bool_t fbYDraw{kTRUE};
194
196 Bool_t fbXbinDraw{kTRUE};
197
199 Bool_t fbYbinDraw{kTRUE};
200
202 Bool_t fbContDraw{kTRUE};
203
205 TString fxNumFormat;
206
208 TH1 *fxHisto{nullptr};
209
212 TVirtualPad *fxDrawPad{nullptr};
213
215 static UInt_t fguInstanceCounter;
216
217 ClassDefOverride(TGo4Marker,1)
218};
219
220#endif //TGO4MARKER_H
221
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.
Definition TGo4Marker.h:199
TString fxNumFormat
format string for all label numbers.
Definition TGo4Marker.h:205
TH1 * fxHisto
Reference to currently used histogram (for bin contents).
Definition TGo4Marker.h:208
Bool_t CheckDrawPad() const
True if current draw pad is still existing.
Bool_t IsContDraw() const
Definition TGo4Marker.h:83
static Bool_t fgbYBINDRAW
default setting for all markers of ybindraw flag.
Definition TGo4Marker.h:145
static Bool_t fgbYDRAW
default setting for all markers of ydraw flag.
Definition TGo4Marker.h:139
void SetToBin(Int_t xbin, Int_t ybin=0)
Set marker to position according to work histogram axis.
virtual void SetName(const char *name)
Definition TGo4Marker.h:65
Bool_t IsYDraw() const
Definition TGo4Marker.h:77
Bool_t fbXbinDraw
If true, draw corresponding value as label on working pad.
Definition TGo4Marker.h:196
static Bool_t fgbCONTDRAW
default setting for all markers of bin content flag.
Definition TGo4Marker.h:148
TVirtualPad * fxDrawPad
Remember last pad used for Draw.
Definition TGo4Marker.h:212
static UInt_t fguInstanceCounter
use this counter for automatic naming and coloring
Definition TGo4Marker.h:215
void SetVisible(Bool_t on)
Definition TGo4Marker.h:63
void ResetLabel()
Will reset label position to defaults.
Bool_t IsYbinDraw() const
Definition TGo4Marker.h:81
void DeletePainter()
void SetXDraw(Bool_t on)
Definition TGo4Marker.h:74
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.
Definition TGo4Marker.h:136
void SaveLabelStyle()
This will save draw flags into static default setup.
Bool_t fbXDraw
If true, draw corresponding value as label on working pad.
Definition TGo4Marker.h:190
TGo4MarkerPainter * fxPainter
Painter instance to display the condition in root pad.
Definition TGo4Marker.h:164
Bool_t fbHasLabel
Switch marker label on or off.
Definition TGo4Marker.h:184
void SetYbinDraw(Bool_t on)
Definition TGo4Marker.h:80
Double_t GetLabelY() const
Calculate initial label coordinate from marker position.
static Bool_t fgbXBINDRAW
default setting for all markers of xbindraw flag.
Definition TGo4Marker.h:142
Bool_t IsPainted() const
Definition TGo4Marker.h:167
const char * GetName() const override
TMarker is not TNamed, so we implement name ourself.
Definition TGo4Marker.h:101
static Bool_t fgbHASLABEL
default setting for all markers of label on/off flag.
Definition TGo4Marker.h:130
virtual TGo4MarkerPainter * CreatePainter()
Factory method to generate (optional subclass) implementation for painter.
void SetHistogram(TH1 *histo)
Bool_t fbVisible
Visibility of this marker on pad.
Definition TGo4Marker.h:181
Bool_t HasLabel() const
Definition TGo4Marker.h:71
void SetXbinDraw(Bool_t on)
Definition TGo4Marker.h:78
void SetNumFormat(const char *fmt="%.4E")
Definition TGo4Marker.h:86
TVirtualPad * GetDrawPad() const
Definition TGo4Marker.h:122
void Paint(Option_t *opt="") override
Display marker with plain root canvas and in go4 viewpanel.
Bool_t IsXbinDraw() const
Definition TGo4Marker.h:79
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.
Definition TGo4Marker.h:133
void SetLabelDraw(Bool_t on)
Definition TGo4Marker.h:70
void SetContDraw(Bool_t on)
Definition TGo4Marker.h:82
Bool_t IsVisible() const
Definition TGo4Marker.h:64
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.
const char * GetNumFormat() const
Definition TGo4Marker.h:85
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.
Definition TGo4Marker.h:193
virtual ~TGo4Marker()
Bool_t fbHasConnector
Switch connection line between marker and label on or off.
Definition TGo4Marker.h:187
Bool_t HasConnector() const
Definition TGo4Marker.h:73
void SetDrawPad(TVirtualPad *pad)
void SetLineDraw(Bool_t on)
Definition TGo4Marker.h:72
TH1 * GetHistogram() const
Definition TGo4Marker.h:98
TString fxName
since TMarker is not TNamed, we provide identifier string here:
Definition TGo4Marker.h:174
void Pop() override
Re-implement TObject method to pop all our views to front.
void SetXY(Double_t x, Double_t y)
Definition TGo4Marker.h:103
void SetYDraw(Bool_t on)
Definition TGo4Marker.h:76
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.
Definition TGo4Marker.h:202
Bool_t IsXDraw() const
Definition TGo4Marker.h:75
void Draw(Option_t *opt="") override
Draw this marker on current pad.
void SetPainted(Bool_t on)
Definition TGo4Marker.h:166
static TString fgxNUMFORMAT
default setting for all conditions with format string for numbers.
Definition TGo4Marker.h:151
Bool_t fbIsPainted
Flag to prevent Paint() method to redraw marker views after UnDraw.
Definition TGo4Marker.h:178
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.