ROOT  6.06/09
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 // //
17 // TH1Editor //
18 // //
19 // Editor changing histogram attributes (Type, Coords, Error, Style) //
20 // //
21 //////////////////////////////////////////////////////////////////////////
22 
23 #ifndef ROOT_TGedFrame
24 #include "TGedFrame.h"
25 #endif
26 
27 
28 class TH1;
29 class TGComboBox;
30 class TGNumberEntry;
31 class TGCheckButton;
32 class TGButtonGroup;
33 class TGHButtonGroup;
34 class TString;
35 class TGRadioButton;
36 class TGDoubleHSlider;
37 class TGHSlider;
38 class TGTextEntry;
39 class TGNumberEntryField;
40 class TGTextButton;
41 
42 class TH1Editor : public TGedFrame {
43 
44 protected:
45  TH1 *fHist; // histogram object
46  Bool_t fSameOpt; // flag for option "same"
47  TGCompositeFrame *fBin; // Contains the Binning Widgets
48  Int_t fTitlePrec; // font precision level
49  TGTextEntry *fTitle; // histogram title input field
50  TGHButtonGroup *fDimGroup; // Radiobuttongroup to change 2D <-> 3D-Plot
51  TGRadioButton *fDim; // 2D-Plot RadioButton
52  TGRadioButton *fDim0; // 3D-Plot RadioButton
53  TGLayoutHints *fDimlh; // layout hints for 2D-Plot RadioButton
54  TGLayoutHints *fDim0lh; // layout hints for 3D-Plot RadioButton
55  TGComboBox *fTypeCombo; // histogram type combo box
56  TGComboBox *fCoordsCombo; // Coordinate System combo box
57  TGComboBox *fErrorCombo; // Error combo box
58  TGCheckButton *fHistOnOff; // Draw a simple histogram with default options
59  TGCheckButton *fAddMarker; // Draw a Marker on top of each bin
60  TGCheckButton *fAddB; // Draw a Bar Chart
61  TGCheckButton *fAddBar; // Bar Option
62  TGCheckButton *fAdd; // Activate more Options
63  TGCheckButton *fMakeHBar; // Draw Horizontal Bar Chart
64  TGCheckButton *fAddSimple; // Draw a simple histogram (==HIST draw option)
65  TGNumberEntry *fBarWidth; // Change the Bar Width
66  TGNumberEntry *fBarOffset; // Change the Bar Offset
67  TGComboBox *fAddCombo; // Add Lines, Bars, Fill
68  TGComboBox *fPercentCombo; // Percentage of the Bar which is drawn in a different color
69  TGCompositeFrame *f3; // Contains Histogram Type
70  TGCompositeFrame *f6; // Contains the Add-ComboBox (Style)
71  TGCompositeFrame *f7; // Contains the Marker OnOff CheckBox
72  TGCompositeFrame *f8; // Contains the Bar Chart CheckBox
73  TGCompositeFrame *f9; // Contains the Bar Option CheckBox
74  TGCompositeFrame *f10; // Contains the Bar Option Title
75  TGCompositeFrame *f11; // Contains the Bar Width/Offset NumberEntries
76  TGCompositeFrame *f12; // Contains fPercentCombo, fMakeHBar
77  TGCompositeFrame *f15; // Contains outer line CheckBox
78  TGCompositeFrame *fBinCont; // Contains the Rebin Widgets for case 1
79  TGCompositeFrame *fBinCont1; // Contains the Rebin Widgets for case 2
80  TGHSlider *fBinSlider; // Slider to set rebinning integer value
81  TGHSlider *fBinSlider1; // Slider to set rebinning integer value for ntuple histogram
82  TGNumberEntryField *fBinNumberEntry; // Label which shows the rebinned bin number
83  TGNumberEntryField *fBinNumberEntry1; // Label which shows the rebinned bin number for ntuple histogram
84  TGHSlider *fBinOffsetSld; // Add an offset to the origin of the histogram
85  TGNumberEntryField *fOffsetNumberEntry;// Shows the offset to the origin of the histogram
86  TGDoubleHSlider *fSlider; // Slider to set x-axis range
87  TGNumberEntryField *fSldMin; // Contains the minimum value of the x-Axis
88  TGNumberEntryField *fSldMax; // Contains the maximum value of the x-Axis
89  TGCheckButton *fDelaydraw; // Delayed drawing of the new axis range
90  TGTextButton *fApply; // Apply-Button to accept the rebinned histogram
91  TGTextButton *fCancel; // Cancel-Button to reprobate the rebinned histogram
92 
93  static TGComboBox *BuildHistTypeComboBox(TGFrame *parent, Int_t id); // builts the Type ComboBox
94  static TGComboBox *BuildHistCoordsComboBox(TGFrame *parent, Int_t id); // builts the Coordinate ComboBox
95  static TGComboBox *BuildHistErrorComboBox(TGFrame *parent, Int_t id); // builts the Error ComboBox
96  static TGComboBox *BuildHistAddComboBox(TGFrame *parent, Int_t id); // builts the Add ComboBox
97  static TGComboBox *BuildPercentComboBox(TGFrame *parent, Int_t id); // builts the ComboBox for setting the Bar options bar1,..., bar4
98 
99  virtual void ConnectSignals2Slots(); // connect the signals to the slots
100  void CreateBinTab(); // Creates the Bin Tab (part of the SetGedEditor)
101 
102 
103 private:
104  Bool_t fMake; // Veto Variable
105  Bool_t fMakeB; // avoid execution of Bar Slots
106  Int_t fPx1old, // save the coordinates of the "virtual box" in delay draw mode (2D Plot)
107  fPy1old,
108  fPx2old,
109  fPy2old;
110  Float_t fP1NDCold[3], // save the coordinates of the "virtual box" in delay draw mode
111  fP2NDCold[3],
112  fP3NDCold[3],
113  fP4NDCold[3];
114  Float_t fP1old[3], // save the coordinates of the "virtual box" in delay draw mode (3D plot)
115  fP2old[3],
116  fP3old[3],
117  fP4old[3],
118  fP5old[3],
119  fP6old[3],
120  fP7old[3],
121  fP8old[3];
122  TH1 *fBinHist; // Cloned histogram for rebin
123  Double_t fOldOffset; // save the old offset of the histogram
124 
125  TString GetHistTypeLabel(); // Get the Histogram Type = String which contains the Histogram Draw Option
126  TString GetHistCoordsLabel(); // Get the histogram coordinate system (CYL, SPH, PSR, ..)
127  TString GetHistErrorLabel(); // Get the histogram Error type (E1, .., E4)
128  TString GetHistAddLabel(); // Get the histogram addon (smooth line, simple line, ..)
129  void ChangeErrorCombo(Int_t i);
130 
131 
132 public:
133  TH1Editor(const TGWindow *p = 0,
134  Int_t width = 140, Int_t height = 30,
135  UInt_t options = kChildFrame,
137  virtual ~TH1Editor();
138 
139  virtual Bool_t AcceptModel(TObject* model);
140  virtual void SetModel(TObject* obj);
141 
142  virtual void DoTitle(const char *text);
143  virtual void DoAddMarker(Bool_t on);
144  virtual void DoAddBar(Bool_t);
145  virtual void DoAddB(Bool_t);
146  virtual void DoAddSimple(Bool_t on);
147  virtual void DoHistSimple();
148  virtual void DoHistComplex();
149  virtual void DoHistChanges();
150  virtual void DoHistView();
151  virtual void DoBarOffset();
152  virtual void DoBarWidth();
153  virtual void DoPercent();
154  virtual void DoHBar(Bool_t on);
155  virtual void DoSliderMoved();
156  virtual void DoSliderPressed();
157  virtual void DoSliderReleased();
158  virtual void DoAxisRange();
159  virtual void DoBinMoved(Int_t number);
160  virtual void DoBinReleased();
161  virtual void DoBinPressed();
162  virtual void DoBinLabel();
163  virtual void DoBinReleased1();
164  virtual void DoBinMoved1();
165  virtual void DoBinLabel1();
166  virtual void DoOffsetMoved(Int_t num);
167  virtual void DoOffsetReleased();
168  virtual void DoOffsetPressed();
169  virtual void DoBinOffset();
170  virtual void DoApply();
171  virtual void DoCancel();
172  virtual void PaintBox3D(Float_t *p1, Float_t *p2,Float_t *p3, Float_t *p4);
173  Int_t* Dividers(Int_t n);
174  virtual void RecursiveRemove(TObject* obj);
175 
176 
177  ClassDef(TH1Editor,0) // TH1 editor
178 };
179 
180 #endif
TGNumberEntry * fBarOffset
Definition: TH1Editor.h:66
TString GetHistTypeLabel()
Returns the selected histogram type (HIST, LEGO1-2, SURF1-5).
Definition: TH1Editor.cxx:2213
TGCompositeFrame * fBinCont
Definition: TH1Editor.h:78
virtual void ConnectSignals2Slots()
Connect signals to slots.
Definition: TH1Editor.cxx:556
virtual void DoPercent()
Slot connected to the bar percentage settings.
Definition: TH1Editor.cxx:1439
static double p3(double t, double a, double b, double c, double d)
virtual void DoHistComplex()
Slot connected to the 3D radio button.
Definition: TH1Editor.cxx:1259
float Float_t
Definition: RtypesCore.h:53
static TGComboBox * BuildHistCoordsComboBox(TGFrame *parent, Int_t id)
Create coordinate system type combo box.
Definition: TH1Editor.cxx:2327
static TGComboBox * BuildHistAddComboBox(TGFrame *parent, Int_t id)
Create Line/Bar combo box.
Definition: TH1Editor.cxx:2362
TGCheckButton * fAddMarker
Definition: TH1Editor.h:59
virtual void DoBinOffset()
Slot connected to the OffSetNumberEntry which is related to the OffSetSlider changes the origin of th...
Definition: TH1Editor.cxx:2113
virtual void DoCancel()
Slot connected to the Cancel button of the Binning tab.
Definition: TH1Editor.cxx:2184
TGNumberEntry * fBarWidth
Definition: TH1Editor.h:65
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual void DoAddBar(Bool_t)
Slot connected to the bar Add check box.
Definition: TH1Editor.cxx:1015
virtual void DoBarOffset()
Slot connected to the Bar Offset of the Bar Charts.
Definition: TH1Editor.cxx:1428
TGCheckButton * fAddBar
Definition: TH1Editor.h:61
TString GetHistAddLabel()
Return the selected shape of the histogram (C, L, LF2).
Definition: TH1Editor.cxx:2277
TGComboBox * fPercentCombo
Definition: TH1Editor.h:68
TGNumberEntryField * fOffsetNumberEntry
Definition: TH1Editor.h:85
TH1 * fBinHist
Definition: TH1Editor.h:122
TGTextButton * fCancel
Definition: TH1Editor.h:91
void ChangeErrorCombo(Int_t i)
Change the error combo box entry.
Definition: TH1Editor.cxx:2396
TGCheckButton * fDelaydraw
Definition: TH1Editor.h:89
virtual void DoBinPressed()
Slot connected to the rebin slider in case of a not ntuple histogram.
Definition: TH1Editor.cxx:1822
TGCompositeFrame * f12
Definition: TH1Editor.h:76
Int_t fPx1old
Definition: TH1Editor.h:106
TH1 * fHist
Definition: TH1Editor.h:45
Bool_t fMake
Definition: TH1Editor.h:104
TGNumberEntryField * fSldMin
Definition: TH1Editor.h:87
TGCheckButton * fHistOnOff
Definition: TH1Editor.h:58
virtual void PaintBox3D(Float_t *p1, Float_t *p2, Float_t *p3, Float_t *p4)
Paint a 3D box.
Definition: TH1Editor.cxx:2425
Int_t fPy1old
Definition: TH1Editor.h:106
TGCompositeFrame * f3
Definition: TH1Editor.h:69
ULong_t Pixel_t
Definition: GuiTypes.h:41
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:665
void CreateBinTab()
Create binning tab.
Definition: TH1Editor.cxx:364
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:1761
TGComboBox * fAddCombo
Definition: TH1Editor.h:67
Bool_t fSameOpt
Definition: TH1Editor.h:46
virtual void DoSliderMoved()
Slot connected to the x-Slider for redrawing of the histogram according to the new Slider range...
Definition: TH1Editor.cxx:1505
TGTextEntry * fTitle
Definition: TH1Editor.h:49
static double p2(double t, double a, double b, double c)
Int_t fPy2old
Definition: TH1Editor.h:106
virtual void DoApply()
Slot connected to the Apply button of the Binning tab.
Definition: TH1Editor.cxx:2153
Int_t fTitlePrec
Definition: TH1Editor.h:48
virtual void SetModel(TObject *obj)
Pick up current values of histogram attributes.
Definition: TH1Editor.cxx:626
TGCheckButton * fAdd
Definition: TH1Editor.h:62
virtual void DoBinMoved1()
Slot connected to the rebin slider in case of an ntuple histogram.
Definition: TH1Editor.cxx:1902
virtual void DoBarWidth()
Slot connected to the Bar Width of the Bar Charts.
Definition: TH1Editor.cxx:1418
TGCheckButton * fAddSimple
Definition: TH1Editor.h:64
TGCompositeFrame * f11
Definition: TH1Editor.h:75
ClassDef(TGedFrame, 0)
virtual void RecursiveRemove(TObject *obj)
If the contained histogram obj is deleted we must set its pointer to zero.
Definition: TH1Editor.cxx:2474
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:1116
TGHButtonGroup * fDimGroup
Definition: TH1Editor.h:50
TString GetHistCoordsLabel()
Return the selected coordinate system of the histogram (POL,CYL,SPH,PSR).
Definition: TH1Editor.cxx:2236
virtual void DoSliderPressed()
Slot connected to the x-axis Range slider for initialising the values of the slider movement...
Definition: TH1Editor.cxx:1604
Double_t fOldOffset
Definition: TH1Editor.h:123
TGComboBox * fTypeCombo
Definition: TH1Editor.h:55
TGNumberEntryField * fBinNumberEntry1
Definition: TH1Editor.h:83
Int_t * Dividers(Int_t n)
Return an array of dividers of n (without the trivial divider n).
Definition: TH1Editor.cxx:2442
virtual Bool_t AcceptModel(TObject *model)
Check if object is able to configure with this editor.
Definition: TH1Editor.cxx:612
TGRadioButton * fDim
Definition: TH1Editor.h:51
unsigned int UInt_t
Definition: RtypesCore.h:42
TGCheckButton * fAddB
Definition: TH1Editor.h:60
TGCompositeFrame * f7
Definition: TH1Editor.h:71
static double p1(double t, double a, double b)
virtual void DoOffsetMoved(Int_t num)
Slot connected to the OffSetSlider.
Definition: TH1Editor.cxx:2065
Bool_t fMakeB
Definition: TH1Editor.h:105
TGCompositeFrame * fBinCont1
Definition: TH1Editor.h:79
TGTextButton * fApply
Definition: TH1Editor.h:90
virtual void DoBinLabel1()
Slot connected to the Bin number entry of the Rebinning tab.
Definition: TH1Editor.cxx:1955
virtual void DoBinReleased()
Slot connected to the rebin slider in case of a not ntuple histogram Updates some other widgets which...
Definition: TH1Editor.cxx:1706
static TGComboBox * BuildHistTypeComboBox(TGFrame *parent, Int_t id)
Create histogram type combo box.
Definition: TH1Editor.cxx:2307
virtual void DoBinReleased1()
Slot connected to the BinNumber Slider in case of a ntuple histogram (does the Rebinning of the histo...
Definition: TH1Editor.cxx:1840
virtual void DoHistView()
Slot connected to the 'Plot' button group.
Definition: TH1Editor.cxx:1150
virtual void DoAxisRange()
Slot connected to the number entry fields containing the Max/Min value of the x-axis.
Definition: TH1Editor.cxx:1682
virtual void DoBinLabel()
Slot connected to the Bin number entry of the Rebinning tab.
Definition: TH1Editor.cxx:1925
TGNumberEntryField * fSldMax
Definition: TH1Editor.h:88
TGLayoutHints * fDim0lh
Definition: TH1Editor.h:54
Int_t fPx2old
Definition: TH1Editor.h:106
TGHSlider * fBinSlider1
Definition: TH1Editor.h:81
double Double_t
Definition: RtypesCore.h:55
TText * text
TGCheckButton * fMakeHBar
Definition: TH1Editor.h:63
TString GetHistErrorLabel()
Return the selected error type (E,E1-5).
Definition: TH1Editor.cxx:2257
static TGComboBox * BuildHistErrorComboBox(TGFrame *parent, Int_t id)
Create error type combo box.
Definition: TH1Editor.cxx:2345
virtual void DoHBar(Bool_t on)
Slot connected to the Horizontal Bar check button.
Definition: TH1Editor.cxx:1479
The TH1 histogram class.
Definition: TH1.h:80
TGCompositeFrame * f8
Definition: TH1Editor.h:72
Mother of all ROOT objects.
Definition: TObject.h:58
TGHSlider * fBinOffsetSld
Definition: TH1Editor.h:84
TGCompositeFrame * f15
Definition: TH1Editor.h:77
virtual void DoTitle(const char *text)
Slot connected to the histogram title setting.
Definition: TH1Editor.cxx:916
TGCompositeFrame * f6
Definition: TH1Editor.h:70
virtual void DoHistChanges()
Slot connected to the histogram type, the coordinate type, the error type and the Add combo box...
Definition: TH1Editor.cxx:1307
TGCompositeFrame * f9
Definition: TH1Editor.h:73
TGComboBox * fErrorCombo
Definition: TH1Editor.h:57
TGHSlider * fBinSlider
Definition: TH1Editor.h:80
virtual void DoAddB(Bool_t)
Slot connected to the bar Add check box.
Definition: TH1Editor.cxx:972
TGLayoutHints * fDimlh
Definition: TH1Editor.h:53
TGComboBox * fCoordsCombo
Definition: TH1Editor.h:56
static TGComboBox * BuildPercentComboBox(TGFrame *parent, Int_t id)
Create Percentage combo box for bar option.
Definition: TH1Editor.cxx:2378
virtual void DoAddMarker(Bool_t on)
Slot connected to the show markers check box.
Definition: TH1Editor.cxx:926
TH1Editor(const TGWindow *p=0, Int_t width=140, Int_t height=30, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
Constructor of histogram attribute GUI.
Definition: TH1Editor.cxx:174
virtual void DoSliderReleased()
Slot connected to the x-axis Range slider for finalizing the values of the slider movement...
Definition: TH1Editor.cxx:1659
TGDoubleHSlider * fSlider
Definition: TH1Editor.h:86
TGRadioButton * fDim0
Definition: TH1Editor.h:52
TObject * obj
virtual void DoHistSimple()
Slot connected to the 2D radio button.
Definition: TH1Editor.cxx:1169
TGCompositeFrame * fBin
Definition: TH1Editor.h:47
const Int_t n
Definition: legend1.C:16
virtual void DoOffsetReleased()
Slot connected to the OffSetSlider.
Definition: TH1Editor.cxx:2017
virtual void DoOffsetPressed()
Slot connected to the OffSetSlider that saves the OldBinOffset (nessesary for delay draw mode)...
Definition: TH1Editor.cxx:2006
virtual ~TH1Editor()
Destructor of TH1 editor.
Definition: TH1Editor.cxx:538
TGNumberEntryField * fBinNumberEntry
Definition: TH1Editor.h:82
TGCompositeFrame * f10
Definition: TH1Editor.h:74