Logo ROOT   6.18/05
Reference Guide
TH2Editor.h
Go to the documentation of this file.
1// @(#)root/ged:$Id$
2// Author: Carsten Hof 08/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_TH2Editor
13#define ROOT_TH2Editor
14
15//////////////////////////////////////////////////////////////////////////
16// //
17// TH2Editor //
18// //
19// Editor changing histogram attributes //
20// //
21//////////////////////////////////////////////////////////////////////////
22
23#include "TGedFrame.h"
24
25class TH2;
26class TGComboBox;
27class TGLabel;
28class TGTextEntry;
29class TGCheckButton;
30class TString;
31class TGDoubleHSlider;
32class TGHSlider;
33class TGNumberEntry;
34class TGHButtonGroup;
35class TGRadioButton;
37class TGColorSelect;
39class TGTextButton;
40
41class TH2Editor : public TGedFrame {
42
43protected:
44 TH2 *fHist; // histogram object
45 TGCompositeFrame *fBin; // Contains the Binning Widgets
46 TGCompositeFrame *fFit; // Contains the Fitting Widgets
47 TGTextEntry *fTitle; // histogram title input field
48 TGComboBox *fTypeCombo; // histogram type combo box
49 TGComboBox *fCoordsCombo; // Coordinate System combo box
50 TGComboBox *fContCombo; // Contour selecting combo box
51 TGLabel *fColContLbl; // No. of Contours Label 1
52 TGLabel *fColContLbl1; // No. of Contours Label 2
53 Int_t fTitlePrec; // font precision level
54 TGHButtonGroup *fDimGroup; // Radiobuttongroup to change 2D <-> 3D-Plot
55 TGRadioButton *fDim; // 2D-Plot RadioButton
56 TGRadioButton *fDim0; // 3D-Plot RadioButton
57 TGLayoutHints *fDimlh; // layout hints for 2D-Plot RadioButton
58 TGLayoutHints *fDim0lh; // layout hints for 3D-Plot RadioButton
59 TGCompositeFrame *f6; // Frame that contains the 2D CheckBox DrawOptions
60 TGCompositeFrame *f9; // Frame that contains the 3D CheckBox DrawOptions
61 TGCompositeFrame *f12; // Frame that contains the Bar-Title
62 TGCompositeFrame *f13; // Frame that contains the Bar Width/Offset NumberEntries
63 TGCompositeFrame *f38; // Frame that contains the Frame Fill widgets
64 TGCheckButton *fAddError; // CheckBox connected to error bars
65 TGCheckButton *fAddPalette; // CheckBox connected to Z option (2D)
66 TGCheckButton *fAddPalette1; // CheckBox connected to Z option (3D)
67 TGCheckButton *fAddArr; // CheckBox connected to Arr-Option
68 TGCheckButton *fAddBox; // CheckBox connected to Box-Option
69 TGCheckButton *fAddScat; // CheckBox connected to Scat-Option
70 TGCheckButton *fAddCol; // CheckBox connected to Col-Option
71 TGCheckButton *fAddFB; // Draw front box (or not)
72 TGCheckButton *fAddBB; // Draw back box (or not)
73 TGCheckButton *fAddText; // Draw bin contents as text
74 TGNumberEntry *fContLevels; // Set number of contour levels
75 TGNumberEntry *fContLevels1; // Set number of contour levels
76 TGNumberEntry *fBarWidth; // Set bar width of histogram
77 TGNumberEntry *fBarOffset; // Set bar offset of histogram
78 TGCompositeFrame *fBinXCont; // Contains the rebin widgets for case 1
79 TGHSlider *fBinXSlider; // Slider to set rebinning x integer value
80 TGNumberEntryField *fBinXNumberEntry; // Label which shows the rebinned bin number
81 TGHSlider *fBinYSlider; // Slider to set rebinning y integer value
82 TGNumberEntryField *fBinYNumberEntry; // Label which shows the rebinned bin number
83 TGTextButton *fApply; // Apply-Button to accept the rebinned histogram
84 TGTextButton *fCancel; // Cancel-Button to reprobate the rebinned histogram
85 TGCompositeFrame *fBinXCont1; // Contains the X Rebin Widgets for case 2
86 TGHSlider *fBinXSlider1; // Slider to set x rebinning integer value
87 TGNumberEntryField *fBinXNumberEntry1;// Label which shows the rebinned x bin number
88 TGNumberEntryField *fXOffsetNumberEntry; // Shows the offset to the x origin of the histogram
89 TGHSlider *fXBinOffsetSld; // Add an x-offset to the origin of the histogram
90
91 TGCompositeFrame *fBinYCont1; // Contains the Y Rebin Widgets for case 2
92 TGHSlider *fBinYSlider1; // Slider to set y rebinning integer value
93 TGNumberEntryField *fBinYNumberEntry1;// Label which shows the rebinned y bin number
94 TGNumberEntryField *fYOffsetNumberEntry; // Shows the offset to the y origin of the histogram
95 TGHSlider *fYBinOffsetSld; // Add an y-offset to the origin of the histogram
96 TGDoubleHSlider *fSliderX; // Slider to set x-axis range
97 TGNumberEntryField *fSldXMin; // Contains the minimum value of the x-Axis
98 TGNumberEntryField *fSldXMax; // Contains the maximum value of the x-Axis
99 TGDoubleHSlider *fSliderY; // Slider to set y-axis range
100 TGNumberEntryField *fSldYMin; // Contains the minimum value of the y-Axis
101 TGNumberEntryField *fSldYMax; // Contains the maximum value of the y-Axis
102 TGCheckButton *fDelaydraw; // Delayed drawing of the new axis range
103 TGColorSelect *fFrameColor; // Select the Frame Color
104 TGedPatternSelect *fFramePattern; // Select the Frame Pattern Style
105 TString fCutString; // Contais info about graphical cuts (if any)
106
107 static TGComboBox *BuildHistTypeComboBox(TGFrame *parent, Int_t id);
108 static TGComboBox *BuildHistCoordsComboBox(TGFrame *parent, Int_t id);
109 static TGComboBox *BuildHistContComboBox(TGFrame* parent, Int_t id);
110
111 virtual void ConnectSignals2Slots();
112 void CreateBinTab(); // Creates the Bin Tab (part of the SetGedEditor)
113
114private:
115 void PaintBox3D(Float_t *p1, Float_t *p2,Float_t *p3, Float_t *p4);
121
142 TH2 *fBinHist; // Cloned histogram for rebin
143 Double_t fOldXOffset; // saves the old x offset of the histogram
144 Double_t fOldYOffset; // saves the old y offset of the histogram
145
146public:
147 TH2Editor(const TGWindow *p = 0,
148 Int_t width = 140, Int_t height = 30,
149 UInt_t options = kChildFrame,
151 virtual ~TH2Editor();
152
153 virtual Bool_t AcceptModel(TObject* model);
154 virtual void SetModel(TObject* obj);
155 virtual void ActivateBaseClassEditors(TClass* cl);
156
157 virtual void DoTitle(const char *text);
158 virtual void DoHistView();
159 virtual void DoHistSimple();
160 virtual void DoHistComplex();
161 virtual void DoHistChanges();
162 virtual void DoAddArr(Bool_t on);
163 virtual void DoAddBox(Bool_t on);
164 virtual void DoAddCol(Bool_t on);
165 virtual void DoAddScat(Bool_t on);
166 virtual void DoAddText(Bool_t on);
167 virtual void DoAddError(Bool_t on);
168 virtual void DoAddPalette(Bool_t on);
169 virtual void DoAddFB();
170 virtual void DoAddBB();
171 virtual void DoContLevel();
172 virtual void DoContLevel1();
173 virtual void DoBarWidth();
174 virtual void DoBarOffset();
175 virtual void DoBinPressed();
176 virtual void DoBinMoved();
177 virtual void DoBinReleased();
178 virtual void DoBinLabel();
179 virtual void DoApply();
180 virtual void DoCancel();
181 virtual void DoBinReleased1();
182 virtual void DoBinMoved1();
183 virtual void DoBinLabel1();
184 virtual void DoOffsetMoved();
185 virtual void DoOffsetReleased();
186 virtual void DoOffsetPressed();
187 virtual void DoBinOffset();
188 virtual void DoSliderXMoved();
189 virtual void DoSliderXPressed();
190 virtual void DoSliderXReleased();
191 virtual void DoXAxisRange();
192 virtual void DoSliderYMoved();
193 virtual void DoSliderYPressed();
194 virtual void DoSliderYReleased();
195 virtual void DoYAxisRange();
196 virtual void DoFillColor(Pixel_t);
197 virtual void DoFillPattern(Style_t);
198
200
201 virtual void RecursiveRemove(TObject* obj);
202
203 ClassDef(TH2Editor,0) // TH2 editor
204};
205
206#endif
207
ULong_t Pixel_t
Definition: GuiTypes.h:39
int Int_t
Definition: RtypesCore.h:41
unsigned int UInt_t
Definition: RtypesCore.h:42
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
short Style_t
Definition: RtypesCore.h:76
float Float_t
Definition: RtypesCore.h:53
#define ClassDef(name, id)
Definition: Rtypes.h:326
include TDocParser_001 C image html pict1_TDocParser_001 png width
Definition: TDocParser.cxx:121
@ kChildFrame
Definition: TGFrame.h:57
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:75
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:665
TGNumberEntryField * fSldXMin
Definition: TH2Editor.h:97
TGCheckButton * fAddArr
Definition: TH2Editor.h:67
TGNumberEntryField * fYOffsetNumberEntry
Definition: TH2Editor.h:94
virtual void DoOffsetPressed()
Slot connected to the OffSetSlider.
Definition: TH2Editor.cxx:2121
TGNumberEntry * fContLevels1
Definition: TH2Editor.h:75
virtual void DoBarWidth()
Slot connected to the bar width of the bar chart.
Definition: TH2Editor.cxx:1566
TGCompositeFrame * f9
Definition: TH2Editor.h:60
Float_t fP4oldy[3]
Definition: TH2Editor.h:137
virtual void SetModel(TObject *obj)
Pick up the values of current histogram attributes.
Definition: TH2Editor.cxx:782
virtual void DoBinReleased()
Slot connected to the rebin slider in case of no ntuple histogram.
Definition: TH2Editor.cxx:1587
TGCheckButton * fAddBB
Definition: TH2Editor.h:72
TGNumberEntryField * fXOffsetNumberEntry
Definition: TH2Editor.h:88
Float_t fP3oldx[3]
Definition: TH2Editor.h:128
Float_t fP5oldy[3]
Definition: TH2Editor.h:138
TGCheckButton * fAddFB
Definition: TH2Editor.h:71
virtual void RecursiveRemove(TObject *obj)
If the contained histogram obj is deleted we must set its pointer to zero.
Definition: TH2Editor.cxx:2938
TGCompositeFrame * fBinXCont
Definition: TH2Editor.h:78
virtual void DoBinPressed()
Slot connected to the rebin slider in case of no ntuple histogram.
Definition: TH2Editor.cxx:1659
TGDoubleHSlider * fSliderY
Definition: TH2Editor.h:99
void CreateBinTab()
Create the Binning tab.
Definition: TH2Editor.cxx:377
TH2 * fBinHist
Definition: TH2Editor.h:142
TGTextButton * fApply
Definition: TH2Editor.h:83
virtual Bool_t AcceptModel(TObject *model)
Check if object is able to configure with this editor.
Definition: TH2Editor.cxx:769
TGCompositeFrame * f6
Definition: TH2Editor.h:59
virtual void DoAddError(Bool_t on)
Slot connected to the "Error" check button.
Definition: TH2Editor.cxx:1417
virtual void DoAddArr(Bool_t on)
Slot connected to the "Arrow draw option" check button.
Definition: TH2Editor.cxx:1252
TGCheckButton * fAddError
Definition: TH2Editor.h:64
TGHSlider * fBinYSlider1
Definition: TH2Editor.h:92
Float_t fP8oldy[3]
Definition: TH2Editor.h:141
TGNumberEntryField * fBinXNumberEntry1
Definition: TH2Editor.h:87
virtual void DoAddBB()
Slot connected to the "BB back-box draw option" check button.
Definition: TH2Editor.cxx:1513
TGCheckButton * fAddPalette1
Definition: TH2Editor.h:66
TGCompositeFrame * f38
Definition: TH2Editor.h:63
virtual void DoFillPattern(Style_t)
Slot connected to the fill area pattern.
Definition: TH2Editor.cxx:2721
Float_t fP2oldx[3]
Definition: TH2Editor.h:127
TGDoubleHSlider * fSliderX
Definition: TH2Editor.h:96
virtual void DoApply()
Slot connected to the Apply Button in the Rebinned histogram Window.
Definition: TH2Editor.cxx:1819
TGNumberEntryField * fBinYNumberEntry
Definition: TH2Editor.h:82
TGHSlider * fBinYSlider
Definition: TH2Editor.h:81
Double_t fOldXOffset
Definition: TH2Editor.h:143
TGHSlider * fYBinOffsetSld
Definition: TH2Editor.h:95
TGNumberEntryField * fBinXNumberEntry
Definition: TH2Editor.h:80
Float_t fP7oldx[3]
Definition: TH2Editor.h:132
virtual void DoSliderYPressed()
Slot connected to y-axis slider which initialises the "virtual" box which is drawn in delay draw mode...
Definition: TH2Editor.cxx:2609
TGCheckButton * fAddPalette
Definition: TH2Editor.h:65
TGCompositeFrame * fBinXCont1
Definition: TH2Editor.h:85
Float_t fP1oldx[3]
Definition: TH2Editor.h:126
TString fCutString
Definition: TH2Editor.h:105
virtual void DoOffsetMoved()
Slot connected to the OffSetSlider.
Definition: TH2Editor.cxx:2202
void PaintBox3D(Float_t *p1, Float_t *p2, Float_t *p3, Float_t *p4)
Paint a square in 3D.
Definition: TH2Editor.cxx:2888
TGRadioButton * fDim
Definition: TH2Editor.h:55
TGNumberEntry * fBarWidth
Definition: TH2Editor.h:76
TGNumberEntryField * fSldYMin
Definition: TH2Editor.h:100
virtual void DoYAxisRange()
Slot connected to the Max/Min number entry fields showing y-axis range.
Definition: TH2Editor.cxx:2687
virtual void DoContLevel()
Slot connected to the contour level number entry fContLevels.
Definition: TH2Editor.cxx:1544
virtual void DoContLevel1()
Slot connected to the contour level number entry fContLevels1.
Definition: TH2Editor.cxx:1555
TGHSlider * fBinXSlider
Definition: TH2Editor.h:79
TGHSlider * fXBinOffsetSld
Definition: TH2Editor.h:89
virtual void DoAddPalette(Bool_t on)
Slot connected to the color palette check button.
Definition: TH2Editor.cxx:1452
TGRadioButton * fDim0
Definition: TH2Editor.h:56
virtual void DoHistChanges()
Slot connected to histogram type, coordinate system, contour combo box.
Definition: TH2Editor.cxx:1175
virtual void ConnectSignals2Slots()
Connect signals to slots.
Definition: TH2Editor.cxx:697
TGLayoutHints * fDimlh
Definition: TH2Editor.h:57
TGCheckButton * fAddScat
Definition: TH2Editor.h:69
virtual void DoBinLabel1()
Slot connected to the Bin Number Entry for the Rebin.
Definition: TH2Editor.cxx:2041
Int_t fTitlePrec
Definition: TH2Editor.h:53
TGCompositeFrame * fFit
Definition: TH2Editor.h:46
TGLabel * fColContLbl
Definition: TH2Editor.h:51
TGNumberEntry * fContLevels
Definition: TH2Editor.h:74
TString GetHistTypeLabel()
Return the immediate histogram type (HIST, LEGO1-4, SURF1-5).
Definition: TH2Editor.cxx:2732
TGedPatternSelect * fFramePattern
Definition: TH2Editor.h:104
TGCheckButton * fDelaydraw
Definition: TH2Editor.h:102
TGHSlider * fBinXSlider1
Definition: TH2Editor.h:86
Float_t fP2oldy[3]
Definition: TH2Editor.h:135
Float_t fP8oldx[3]
Definition: TH2Editor.h:133
static TGComboBox * BuildHistCoordsComboBox(TGFrame *parent, Int_t id)
Create coordinate system combo box.
Definition: TH2Editor.cxx:2853
virtual void ActivateBaseClassEditors(TClass *cl)
Skip TH1Editor in building list of editors.
Definition: TH2Editor.cxx:2930
TGLayoutHints * fDim0lh
Definition: TH2Editor.h:58
virtual void DoAddScat(Bool_t on)
Slot connected to the "Scat draw option" check button.
Definition: TH2Editor.cxx:1359
TH2Editor(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: TH2Editor.cxx:175
virtual void DoSliderXReleased()
Slot connected to the x-axis slider finalizing values after the slider movement.
Definition: TH2Editor.cxx:2477
TGCheckButton * fAddCol
Definition: TH2Editor.h:70
virtual void DoSliderXPressed()
Slot connected to the x axis range slider that initialises the "virtual" box which is drawn in delay ...
Definition: TH2Editor.cxx:2422
TGCheckButton * fAddBox
Definition: TH2Editor.h:68
virtual void DoAddText(Bool_t on)
Slot connected to the "Text draw option" check button.
Definition: TH2Editor.cxx:1385
TH2 * fHist
Definition: TH2Editor.h:44
virtual void DoHistView()
Slot connected to the 'Plot' button group.
Definition: TH2Editor.cxx:1077
virtual void DoXAxisRange()
Slot connected to the Max/Min number entry fields showing x-axis range.
Definition: TH2Editor.cxx:2499
Float_t fP6oldx[3]
Definition: TH2Editor.h:131
TGCheckButton * fAddText
Definition: TH2Editor.h:73
TString GetCutOptionString()
Return draw option string related to graphical cut in use.
Definition: TH2Editor.cxx:2816
Int_t * Dividers(Int_t n)
Give an array of dividers of n (without the trivial divider n)) in the first entry the number of divi...
Definition: TH2Editor.cxx:2899
TString GetHistContLabel()
Returns histogram contour option (None,Cont0..5).
Definition: TH2Editor.cxx:2775
virtual void DoBinReleased1()
Slot connected to the BinNumber Slider in case of a 'ntuple histogram'.
Definition: TH2Editor.cxx:1899
TGColorSelect * fFrameColor
Definition: TH2Editor.h:103
TString GetHistCoordsLabel()
Return the immediate coordinate system of the histogram.
Definition: TH2Editor.cxx:2757
Int_t fPx1old
Definition: TH2Editor.h:122
virtual void DoSliderYMoved()
Slot connected to the x-slider for redrawing the histogram with the new slider Range (immediately).
Definition: TH2Editor.cxx:2520
virtual void DoBinLabel()
Slot connected to the Bin Number Entry for the Rebin.
Definition: TH2Editor.cxx:1769
TGTextButton * fCancel
Definition: TH2Editor.h:84
TGCompositeFrame * fBin
Definition: TH2Editor.h:45
TGNumberEntryField * fSldYMax
Definition: TH2Editor.h:101
Double_t fOldYOffset
Definition: TH2Editor.h:144
TGCompositeFrame * f13
Definition: TH2Editor.h:62
TGNumberEntryField * fSldXMax
Definition: TH2Editor.h:98
virtual void DoBinMoved1()
Slot connected to the rebin slider in case of an ntuple histogram.
Definition: TH2Editor.cxx:2002
virtual void DoTitle(const char *text)
Slot connected to the histogram title setting.
Definition: TH2Editor.cxx:1067
Float_t fP5oldx[3]
Definition: TH2Editor.h:130
Float_t fP4oldx[3]
Definition: TH2Editor.h:129
TGComboBox * fContCombo
Definition: TH2Editor.h:50
Int_t fPy2old
Definition: TH2Editor.h:125
Int_t fPy1old
Definition: TH2Editor.h:123
TGTextEntry * fTitle
Definition: TH2Editor.h:47
virtual void DoAddCol(Bool_t on)
Slot connected to the "Col draw option" check button.
Definition: TH2Editor.cxx:1316
virtual void DoBarOffset()
Slot connected to the bar offset of the bar chart.
Definition: TH2Editor.cxx:1576
virtual void DoOffsetReleased()
Slot connected to the OffSetSlider that changes the origin of the histogram inbetween a binwidth; reb...
Definition: TH2Editor.cxx:2134
virtual ~TH2Editor()
Destructor.
Definition: TH2Editor.cxx:679
virtual void DoBinOffset()
Slot connected to the OffSetNumberEntry, related to the OffSetSlider changes the origin of the histog...
Definition: TH2Editor.cxx:2272
TGLabel * fColContLbl1
Definition: TH2Editor.h:52
static TGComboBox * BuildHistTypeComboBox(TGFrame *parent, Int_t id)
Create histogram type combo box.
Definition: TH2Editor.cxx:2831
Float_t fP3oldy[3]
Definition: TH2Editor.h:136
Float_t fP1oldy[3]
Definition: TH2Editor.h:134
static TGComboBox * BuildHistContComboBox(TGFrame *parent, Int_t id)
Create contour combo box.
Definition: TH2Editor.cxx:2871
TGNumberEntry * fBarOffset
Definition: TH2Editor.h:77
TGComboBox * fCoordsCombo
Definition: TH2Editor.h:49
virtual void DoCancel()
Slot connected to the Cancel Button in the Rebinned histogram Window.
Definition: TH2Editor.cxx:1858
Float_t fP7oldy[3]
Definition: TH2Editor.h:140
Int_t fPx2old
Definition: TH2Editor.h:124
TGCompositeFrame * fBinYCont1
Definition: TH2Editor.h:91
Float_t fP6oldy[3]
Definition: TH2Editor.h:139
virtual void DoSliderYReleased()
Slot connected to the y-axis slider finalizing values after the slider movement.
Definition: TH2Editor.cxx:2664
TGHButtonGroup * fDimGroup
Definition: TH2Editor.h:54
virtual void DoBinMoved()
Slot connected to the rebin sliders in case of no ntuple histogram does the rebinning of the selected...
Definition: TH2Editor.cxx:1677
virtual void DoAddFB()
Slot connected to the "FB front-box draw option" check button.
Definition: TH2Editor.cxx:1479
TString GetHistAdditiveLabel()
Return histogram additive options (Arr,Box,Col,Scat,Col,Text,E,Z,FB,BB).
Definition: TH2Editor.cxx:2794
TGNumberEntryField * fBinYNumberEntry1
Definition: TH2Editor.h:93
TGComboBox * fTypeCombo
Definition: TH2Editor.h:48
virtual void DoHistSimple()
Slot connected to the 2D-Plot radio button.
Definition: TH2Editor.cxx:1094
virtual void DoFillColor(Pixel_t)
Slot connected to the fill area color.
Definition: TH2Editor.cxx:2710
virtual void DoAddBox(Bool_t on)
Slot connected to the "Box draw option" check button.
Definition: TH2Editor.cxx:1284
virtual void DoHistComplex()
Slot connected to the 3D-Plot radio button.
Definition: TH2Editor.cxx:1132
virtual void DoSliderXMoved()
Slot connected to the x-Slider that redraws the histogram with the new slider range.
Definition: TH2Editor.cxx:2332
TGCompositeFrame * f12
Definition: TH2Editor.h:61
Service class for 2-Dim histogram classes.
Definition: TH2.h:30
Mother of all ROOT objects.
Definition: TObject.h:37
Basic string class.
Definition: TString.h:131
TText * text
const Int_t n
Definition: legend1.C:16