Logo ROOT  
Reference Guide
TH1Editor.h
Go to the documentation of this file.
1// @(#)root/ged:$Id$
2// Author: Carsten Hof 16/08/04
3
4/*************************************************************************
5 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TH1Editor
13#define ROOT_TH1Editor
14
15
16#include "TGedFrame.h"
17
18
19class TH1;
20class TGComboBox;
21class TGNumberEntry;
22class TGCheckButton;
23class TGButtonGroup;
24class TGHButtonGroup;
25class TString;
26class TGRadioButton;
27class TGDoubleHSlider;
28class TGHSlider;
29class TGTextEntry;
31class TGTextButton;
32
33class TH1Editor : public TGedFrame {
34
35protected:
36 TH1 *fHist; ///< histogram object
37 Bool_t fSameOpt; ///< flag for option "same"
38 TGCompositeFrame *fBin; ///< Contains the Binning Widgets
39 Int_t fTitlePrec; ///< font precision level
40 TGTextEntry *fTitle; ///< histogram title input field
41 TGHButtonGroup *fDimGroup; ///< Radiobuttongroup to change 2D <-> 3D-Plot
42 TGRadioButton *fDim; ///< 2D-Plot RadioButton
43 TGRadioButton *fDim0; ///< 3D-Plot RadioButton
44 TGLayoutHints *fDimlh; ///< layout hints for 2D-Plot RadioButton
45 TGLayoutHints *fDim0lh; ///< layout hints for 3D-Plot RadioButton
46 TGComboBox *fTypeCombo; ///< histogram type combo box
47 TGComboBox *fCoordsCombo; ///< Coordinate System combo box
48 TGComboBox *fErrorCombo; ///< Error combo box
49 TGCheckButton *fHistOnOff; ///< Draw a simple histogram with default options
50 TGCheckButton *fAddMarker; ///< Draw a Marker on top of each bin
51 TGCheckButton *fAddB; ///< Draw a Bar Chart
52 TGCheckButton *fAddBar; ///< Bar Option
53 TGCheckButton *fAdd; ///< Activate more Options
54 TGCheckButton *fMakeHBar; ///< Draw Horizontal Bar Chart
55 TGCheckButton *fAddSimple; ///< Draw a simple histogram (==HIST draw option)
56 TGNumberEntry *fBarWidth; ///< Change the Bar Width
57 TGNumberEntry *fBarOffset; ///< Change the Bar Offset
58 TGComboBox *fAddCombo; ///< Add Lines, Bars, Fill
59 TGComboBox *fPercentCombo; ///< Percentage of the Bar which is drawn in a different color
60 TGCompositeFrame *f3; ///< Contains Histogram Type
61 TGCompositeFrame *f6; ///< Contains the Add-ComboBox (Style)
62 TGCompositeFrame *f7; ///< Contains the Marker OnOff CheckBox
63 TGCompositeFrame *f8; ///< Contains the Bar Chart CheckBox
64 TGCompositeFrame *f9; ///< Contains the Bar Option CheckBox
65 TGCompositeFrame *f10; ///< Contains the Bar Option Title
66 TGCompositeFrame *f11; ///< Contains the Bar Width/Offset NumberEntries
67 TGCompositeFrame *f12; ///< Contains fPercentCombo, fMakeHBar
68 TGCompositeFrame *f15; ///< Contains outer line CheckBox
69 TGCompositeFrame *fBinCont; ///< Contains the Rebin Widgets for case 1
70 TGCompositeFrame *fBinCont1; ///< Contains the Rebin Widgets for case 2
71 TGHSlider *fBinSlider; ///< Slider to set rebinning integer value
72 TGHSlider *fBinSlider1; ///< Slider to set rebinning integer value for ntuple histogram
73 TGNumberEntryField *fBinNumberEntry; ///< Label which shows the rebinned bin number
74 TGNumberEntryField *fBinNumberEntry1; ///< Label which shows the rebinned bin number for ntuple histogram
75 TGHSlider *fBinOffsetSld; ///< Add an offset to the origin of the histogram
76 TGNumberEntryField *fOffsetNumberEntry;///< Shows the offset to the origin of the histogram
77 TGDoubleHSlider *fSlider; ///< Slider to set x-axis range
78 TGNumberEntryField *fSldMin; ///< Contains the minimum value of the x-Axis
79 TGNumberEntryField *fSldMax; ///< Contains the maximum value of the x-Axis
80 TGCheckButton *fDelaydraw; ///< Delayed drawing of the new axis range
81 TGTextButton *fApply; ///< Apply-Button to accept the rebinned histogram
82 TGTextButton *fCancel; ///< Cancel-Button to reprobate the rebinned histogram
83
84 static TGComboBox *BuildHistTypeComboBox(TGFrame *parent, Int_t id); // builts the Type ComboBox
85 static TGComboBox *BuildHistCoordsComboBox(TGFrame *parent, Int_t id); // builts the Coordinate ComboBox
86 static TGComboBox *BuildHistErrorComboBox(TGFrame *parent, Int_t id); // builts the Error ComboBox
87 static TGComboBox *BuildHistAddComboBox(TGFrame *parent, Int_t id); // builts the Add ComboBox
88 static TGComboBox *BuildPercentComboBox(TGFrame *parent, Int_t id); // builts the ComboBox for setting the Bar options bar1,..., bar4
89
90 virtual void ConnectSignals2Slots(); // connect the signals to the slots
91 void CreateBinTab(); // Creates the Bin Tab (part of the SetGedEditor)
92
93
94private:
95 Bool_t fMake; // Veto Variable
96 Bool_t fMakeB; // avoid execution of Bar Slots
97 Int_t fPx1old, // save the coordinates of the "virtual box" in delay draw mode (2D Plot)
101 Float_t fP1NDCold[3], // save the coordinates of the "virtual box" in delay draw mode
105 Float_t fP1old[3], // save the coordinates of the "virtual box" in delay draw mode (3D plot)
113 TH1 *fBinHist; // Cloned histogram for rebin
114 Double_t fOldOffset; // save the old offset of the histogram
115
116 TString GetHistTypeLabel(); // Get the Histogram Type = String which contains the Histogram Draw Option
117 TString GetHistCoordsLabel(); // Get the histogram coordinate system (CYL, SPH, PSR, ..)
118 TString GetHistErrorLabel(); // Get the histogram Error type (E1, .., E4)
119 TString GetHistAddLabel(); // Get the histogram addon (smooth line, simple line, ..)
120 void ChangeErrorCombo(Int_t i);
121
122
123public:
124 TH1Editor(const TGWindow *p = nullptr,
125 Int_t width = 140, Int_t height = 30,
126 UInt_t options = kChildFrame,
128 virtual ~TH1Editor();
129
130 virtual Bool_t AcceptModel(TObject* model);
131 virtual void SetModel(TObject* obj);
132
133 virtual void DoTitle(const char *text);
134 virtual void DoAddMarker(Bool_t on);
135 virtual void DoAddBar(Bool_t);
136 virtual void DoAddB(Bool_t);
137 virtual void DoAddSimple(Bool_t on);
138 virtual void DoHistSimple();
139 virtual void DoHistComplex();
140 virtual void DoHistChanges();
141 virtual void DoHistView();
142 virtual void DoBarOffset();
143 virtual void DoBarWidth();
144 virtual void DoPercent();
145 virtual void DoHBar(Bool_t on);
146 virtual void DoSliderMoved();
147 virtual void DoSliderPressed();
148 virtual void DoSliderReleased();
149 virtual void DoAxisRange();
150 virtual void DoBinMoved(Int_t number);
151 virtual void DoBinReleased();
152 virtual void DoBinPressed();
153 virtual void DoBinLabel();
154 virtual void DoBinReleased1();
155 virtual void DoBinMoved1();
156 virtual void DoBinLabel1();
157 virtual void DoOffsetMoved(Int_t num);
158 virtual void DoOffsetReleased();
159 virtual void DoOffsetPressed();
160 virtual void DoBinOffset();
161 virtual void DoApply();
162 virtual void DoCancel();
163 virtual void PaintBox3D(Float_t *p1, Float_t *p2,Float_t *p3, Float_t *p4);
165 virtual void RecursiveRemove(TObject* obj);
166
167
168 ClassDef(TH1Editor,0) // TH1 editor
169};
170
171#endif
@ kChildFrame
Definition: GuiTypes.h:379
ULong_t Pixel_t
Pixel value.
Definition: GuiTypes.h:40
float Float_t
Definition: RtypesCore.h:57
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
Option_t Option_t TPoint TPoint const char text
Organizes TGButton widgets in a group.
Definition: TGButtonGroup.h:21
Selects different options.
Definition: TGButton.h:264
A combobox (also known as a drop down listbox) allows the selection of one item out of a list of item...
Definition: TGComboBox.h:47
The base class for composite widgets (menu bars, list boxes, etc.).
Definition: TGFrame.h:287
Dragging the slider will generate the event:
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition: TGFrame.h:80
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:683
Organizes TGButton widgets in a group with one horizontal row.
Concrete class for horizontal slider.
Definition: TGSlider.h:119
This class describes layout hints used by the layout classes.
Definition: TGLayout.h:50
TGNumberEntry is a number entry input widget with up/down buttons.
Selects different options.
Definition: TGButton.h:321
Yield an action as soon as it is clicked.
Definition: TGButton.h:142
A TGTextEntry is a one line text input widget.
Definition: TGTextEntry.h:24
ROOT GUI Window base class.
Definition: TGWindow.h:23
Base frame for implementing GUI - a service class.
Definition: TGedFrame.h:27
ClassDef(TGedFrame, 0)
Editor for changing TH1 histogram attributes, rebinning & fitting.
Definition: TH1Editor.h:33
Float_t fP6old[3]
Definition: TH1Editor.h:110
static TGComboBox * BuildHistAddComboBox(TGFrame *parent, Int_t id)
Create Line/Bar combo box.
Definition: TH1Editor.cxx:2337
TGNumberEntryField * fSldMin
Contains the minimum value of the x-Axis.
Definition: TH1Editor.h:78
virtual void DoHistChanges()
Slot connected to the histogram type, the coordinate type, the error type and the Add combo box.
Definition: TH1Editor.cxx:1283
Float_t fP2NDCold[3]
Definition: TH1Editor.h:102
virtual void DoBinReleased1()
Slot connected to the BinNumber Slider in case of a ntuple histogram (does the Rebinning of the histo...
Definition: TH1Editor.cxx:1815
TGTextButton * fApply
Apply-Button to accept the rebinned histogram.
Definition: TH1Editor.h:81
TGHSlider * fBinOffsetSld
Add an offset to the origin of the histogram.
Definition: TH1Editor.h:75
Float_t fP1NDCold[3]
Definition: TH1Editor.h:101
TGNumberEntryField * fBinNumberEntry
Label which shows the rebinned bin number.
Definition: TH1Editor.h:73
TGCompositeFrame * fBinCont
Contains the Rebin Widgets for case 1.
Definition: TH1Editor.h:69
TGCheckButton * fAddSimple
Draw a simple histogram (==HIST draw option)
Definition: TH1Editor.h:55
TH1 * fHist
histogram object
Definition: TH1Editor.h:36
TGCheckButton * fAddMarker
Draw a Marker on top of each bin.
Definition: TH1Editor.h:50
Bool_t fMakeB
Definition: TH1Editor.h:96
TString GetHistTypeLabel()
Returns the selected histogram type (HIST, LEGO1-2, SURF1-5).
Definition: TH1Editor.cxx:2188
Int_t fPy1old
Definition: TH1Editor.h:98
virtual void DoOffsetMoved(Int_t num)
Slot connected to the OffSetSlider.
Definition: TH1Editor.cxx:2040
void ChangeErrorCombo(Int_t i)
Change the error combo box entry.
Definition: TH1Editor.cxx:2371
TGNumberEntry * fBarWidth
Change the Bar Width.
Definition: TH1Editor.h:56
Float_t fP3old[3]
Definition: TH1Editor.h:107
TGHSlider * fBinSlider1
Slider to set rebinning integer value for ntuple histogram.
Definition: TH1Editor.h:72
TGNumberEntryField * fSldMax
Contains the maximum value of the x-Axis.
Definition: TH1Editor.h:79
Float_t fP5old[3]
Definition: TH1Editor.h:109
TGDoubleHSlider * fSlider
Slider to set x-axis range.
Definition: TH1Editor.h:77
TGCompositeFrame * f11
Contains the Bar Width/Offset NumberEntries.
Definition: TH1Editor.h:66
virtual void DoHBar(Bool_t on)
Slot connected to the Horizontal Bar check button.
Definition: TH1Editor.cxx:1455
virtual void DoBinMoved(Int_t number)
Slot connected to the rebin slider in case of a not ntuple histogram (does the Rebinning of the histo...
Definition: TH1Editor.cxx:1737
static TGComboBox * BuildPercentComboBox(TGFrame *parent, Int_t id)
Create Percentage combo box for bar option.
Definition: TH1Editor.cxx:2353
TGHButtonGroup * fDimGroup
Radiobuttongroup to change 2D <-> 3D-Plot.
Definition: TH1Editor.h:41
TGCheckButton * fAddB
Draw a Bar Chart.
Definition: TH1Editor.h:51
virtual void DoAddMarker(Bool_t on)
Slot connected to the show markers check box.
Definition: TH1Editor.cxx:902
Int_t fPx1old
Definition: TH1Editor.h:97
static TGComboBox * BuildHistErrorComboBox(TGFrame *parent, Int_t id)
Create error type combo box.
Definition: TH1Editor.cxx:2320
Bool_t fMake
Definition: TH1Editor.h:95
TH1Editor(const TGWindow *p=nullptr, Int_t width=140, Int_t height=30, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
Constructor of histogram attribute GUI.
Definition: TH1Editor.cxx:150
TGComboBox * fErrorCombo
Error combo box.
Definition: TH1Editor.h:48
Double_t fOldOffset
Definition: TH1Editor.h:114
TGCheckButton * fDelaydraw
Delayed drawing of the new axis range.
Definition: TH1Editor.h:80
virtual void DoAxisRange()
Slot connected to the number entry fields containing the Max/Min value of the x-axis.
Definition: TH1Editor.cxx:1658
virtual void DoHistView()
Slot connected to the 'Plot' button group.
Definition: TH1Editor.cxx:1126
TGCheckButton * fMakeHBar
Draw Horizontal Bar Chart.
Definition: TH1Editor.h:54
virtual void ConnectSignals2Slots()
Connect signals to slots.
Definition: TH1Editor.cxx:532
Float_t fP3NDCold[3]
Definition: TH1Editor.h:103
TGCompositeFrame * f6
Contains the Add-ComboBox (Style)
Definition: TH1Editor.h:61
TGNumberEntryField * fOffsetNumberEntry
Shows the offset to the origin of the histogram.
Definition: TH1Editor.h:76
TGCheckButton * fAdd
Activate more Options.
Definition: TH1Editor.h:53
Float_t fP8old[3]
Definition: TH1Editor.h:112
TGCompositeFrame * fBinCont1
Contains the Rebin Widgets for case 2.
Definition: TH1Editor.h:70
virtual void SetModel(TObject *obj)
Pick up current values of histogram attributes.
Definition: TH1Editor.cxx:602
TGRadioButton * fDim0
3D-Plot RadioButton
Definition: TH1Editor.h:43
TGCompositeFrame * f12
Contains fPercentCombo, fMakeHBar.
Definition: TH1Editor.h:67
virtual void DoApply()
Slot connected to the Apply button of the Binning tab.
Definition: TH1Editor.cxx:2128
Int_t * Dividers(Int_t n)
Return an array of dividers of n (without the trivial divider n).
Definition: TH1Editor.cxx:2417
virtual ~TH1Editor()
Destructor of TH1 editor.
Definition: TH1Editor.cxx:514
TGComboBox * fPercentCombo
Percentage of the Bar which is drawn in a different color.
Definition: TH1Editor.h:59
TGTextButton * fCancel
Cancel-Button to reprobate the rebinned histogram.
Definition: TH1Editor.h:82
virtual void DoCancel()
Slot connected to the Cancel button of the Binning tab.
Definition: TH1Editor.cxx:2159
TGHSlider * fBinSlider
Slider to set rebinning integer value.
Definition: TH1Editor.h:71
Float_t fP1old[3]
Definition: TH1Editor.h:105
TGRadioButton * fDim
2D-Plot RadioButton
Definition: TH1Editor.h:42
Int_t fTitlePrec
font precision level
Definition: TH1Editor.h:39
TGCheckButton * fAddBar
Bar Option.
Definition: TH1Editor.h:52
virtual void DoHistComplex()
Slot connected to the 3D radio button.
Definition: TH1Editor.cxx:1235
virtual void DoSliderReleased()
Slot connected to the x-axis Range slider for finalizing the values of the slider movement.
Definition: TH1Editor.cxx:1635
Bool_t fSameOpt
flag for option "same"
Definition: TH1Editor.h:37
virtual void DoAddB(Bool_t)
Slot connected to the bar Add check box.
Definition: TH1Editor.cxx:948
TGCompositeFrame * f3
Contains Histogram Type.
Definition: TH1Editor.h:60
virtual void DoHistSimple()
Slot connected to the 2D radio button.
Definition: TH1Editor.cxx:1145
virtual void DoBinReleased()
Slot connected to the rebin slider in case of a not ntuple histogram Updates some other widgets which...
Definition: TH1Editor.cxx:1682
TGComboBox * fTypeCombo
histogram type combo box
Definition: TH1Editor.h:46
TGComboBox * fCoordsCombo
Coordinate System combo box.
Definition: TH1Editor.h:47
Int_t fPx2old
Definition: TH1Editor.h:99
TGTextEntry * fTitle
histogram title input field
Definition: TH1Editor.h:40
TString GetHistAddLabel()
Return the selected shape of the histogram (C, L, LF2).
Definition: TH1Editor.cxx:2252
TGLayoutHints * fDim0lh
layout hints for 3D-Plot RadioButton
Definition: TH1Editor.h:45
Float_t fP2old[3]
Definition: TH1Editor.h:106
virtual void DoBinPressed()
Slot connected to the rebin slider in case of a not ntuple histogram.
Definition: TH1Editor.cxx:1797
Float_t fP4NDCold[3]
Definition: TH1Editor.h:104
virtual void DoAddSimple(Bool_t on)
Slot connected to fAddSimple check box for drawing a simple histogram without errors (== HIST draw op...
Definition: TH1Editor.cxx:1092
virtual void DoPercent()
Slot connected to the bar percentage settings.
Definition: TH1Editor.cxx:1415
TH1 * fBinHist
Definition: TH1Editor.h:113
virtual void DoBarOffset()
Slot connected to the Bar Offset of the Bar Charts.
Definition: TH1Editor.cxx:1404
void CreateBinTab()
Create binning tab.
Definition: TH1Editor.cxx:340
virtual void DoBarWidth()
Slot connected to the Bar Width of the Bar Charts.
Definition: TH1Editor.cxx:1394
virtual void DoAddBar(Bool_t)
Slot connected to the bar Add check box.
Definition: TH1Editor.cxx:991
TGNumberEntryField * fBinNumberEntry1
Label which shows the rebinned bin number for ntuple histogram.
Definition: TH1Editor.h:74
virtual void PaintBox3D(Float_t *p1, Float_t *p2, Float_t *p3, Float_t *p4)
Paint a 3D box.
Definition: TH1Editor.cxx:2400
TString GetHistErrorLabel()
Return the selected error type (E,E1-5).
Definition: TH1Editor.cxx:2232
virtual void DoBinLabel()
Slot connected to the Bin number entry of the Rebinning tab.
Definition: TH1Editor.cxx:1900
TGLayoutHints * fDimlh
layout hints for 2D-Plot RadioButton
Definition: TH1Editor.h:44
TGCompositeFrame * f15
Contains outer line CheckBox.
Definition: TH1Editor.h:68
static TGComboBox * BuildHistCoordsComboBox(TGFrame *parent, Int_t id)
Create coordinate system type combo box.
Definition: TH1Editor.cxx:2302
TGNumberEntry * fBarOffset
Change the Bar Offset.
Definition: TH1Editor.h:57
virtual void RecursiveRemove(TObject *obj)
If the contained histogram obj is deleted we must set its pointer to zero.
Definition: TH1Editor.cxx:2449
TGCompositeFrame * f9
Contains the Bar Option CheckBox.
Definition: TH1Editor.h:64
virtual void DoOffsetReleased()
Slot connected to the OffSetSlider.
Definition: TH1Editor.cxx:1992
Float_t fP7old[3]
Definition: TH1Editor.h:111
Int_t fPy2old
Definition: TH1Editor.h:100
static TGComboBox * BuildHistTypeComboBox(TGFrame *parent, Int_t id)
Create histogram type combo box.
Definition: TH1Editor.cxx:2282
virtual Bool_t AcceptModel(TObject *model)
Check if object is able to configure with this editor.
Definition: TH1Editor.cxx:588
TGCompositeFrame * f7
Contains the Marker OnOff CheckBox.
Definition: TH1Editor.h:62
TGCompositeFrame * f8
Contains the Bar Chart CheckBox.
Definition: TH1Editor.h:63
TGCompositeFrame * fBin
Contains the Binning Widgets.
Definition: TH1Editor.h:38
virtual void DoBinLabel1()
Slot connected to the Bin number entry of the Rebinning tab.
Definition: TH1Editor.cxx:1930
TGComboBox * fAddCombo
Add Lines, Bars, Fill.
Definition: TH1Editor.h:58
TGCompositeFrame * f10
Contains the Bar Option Title.
Definition: TH1Editor.h:65
virtual void DoSliderMoved()
Slot connected to the x-Slider for redrawing of the histogram according to the new Slider range.
Definition: TH1Editor.cxx:1481
virtual void DoBinOffset()
Slot connected to the OffSetNumberEntry which is related to the OffSetSlider changes the origin of th...
Definition: TH1Editor.cxx:2088
virtual void DoOffsetPressed()
Slot connected to the OffSetSlider that saves the OldBinOffset (nessesary for delay draw mode).
Definition: TH1Editor.cxx:1981
virtual void DoTitle(const char *text)
Slot connected to the histogram title setting.
Definition: TH1Editor.cxx:892
TString GetHistCoordsLabel()
Return the selected coordinate system of the histogram (POL,CYL,SPH,PSR).
Definition: TH1Editor.cxx:2211
TGCheckButton * fHistOnOff
Draw a simple histogram with default options.
Definition: TH1Editor.h:49
virtual void DoBinMoved1()
Slot connected to the rebin slider in case of an ntuple histogram.
Definition: TH1Editor.cxx:1877
Float_t fP4old[3]
Definition: TH1Editor.h:108
virtual void DoSliderPressed()
Slot connected to the x-axis Range slider for initialising the values of the slider movement.
Definition: TH1Editor.cxx:1580
TH1 is the base class of all histogram classes in ROOT.
Definition: TH1.h:58
Mother of all ROOT objects.
Definition: TObject.h:41
Basic string class.
Definition: TString.h:136
const Int_t n
Definition: legend1.C:16