Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 
25 class TH2;
26 class TGComboBox;
27 class TGLabel;
28 class TGTextEntry;
29 class TGCheckButton;
30 class TString;
31 class TGDoubleHSlider;
32 class TGHSlider;
33 class TGNumberEntry;
34 class TGHButtonGroup;
35 class TGRadioButton;
36 class TGNumberEntryField;
37 class TGColorSelect;
38 class TGedPatternSelect;
39 class TGTextButton;
40 
41 class TH2Editor : public TGedFrame {
42 
43 protected:
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 
114 private:
115  void PaintBox3D(Float_t *p1, Float_t *p2,Float_t *p3, Float_t *p4);
116  TString GetHistTypeLabel();
117  TString GetHistCoordsLabel();
118  TString GetHistContLabel();
119  TString GetHistAdditiveLabel();
120  TString GetCutOptionString();
121 
122  Int_t fPx1old,
123  fPy1old,
124  fPx2old,
125  fPy2old;
126  Float_t fP1oldx[3],
127  fP2oldx[3],
128  fP3oldx[3],
129  fP4oldx[3],
130  fP5oldx[3],
131  fP6oldx[3],
132  fP7oldx[3],
133  fP8oldx[3];
134  Float_t fP1oldy[3],
135  fP2oldy[3],
136  fP3oldy[3],
137  fP4oldy[3],
138  fP5oldy[3],
139  fP6oldy[3],
140  fP7oldy[3],
141  fP8oldy[3];
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 
146 public:
147  TH2Editor(const TGWindow *p = 0,
148  Int_t width = 140, Int_t height = 30,
149  UInt_t options = kChildFrame,
150  Pixel_t back = GetDefaultFrameBackground());
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 
199  Int_t* Dividers(Int_t n);
200 
201  virtual void RecursiveRemove(TObject* obj);
202 
203  ClassDef(TH2Editor,0) // TH2 editor
204 };
205 
206 #endif
207