Logo ROOT   6.21/01
Reference Guide
TH1Editor.cxx
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 //////////////////////////////////////////////////////////////////////////
13 // //
14 // TH1Editor //
15 // Editor for changing TH1 histogram attributes, rebinning & fitting. //
16 // For all possible draw options (there are a few which are not imple- //
17 // mentable in graphical user interface) see THistPainter::Paint in //
18 // root/histpainter/THistPainter.cxx //
19 //
20 //Begin_Html
21 /*
22 <img src="gif/TH1Editor_1.gif">
23 */
24 //End_Html
25 //Begin_Html
26 /*
27 <img src="gif/TH1Editor_2.gif">
28 */
29 //End_Html
30 //
31 // These changes can be made via the TH1Editor: //
32 // Style Tab: //
33 // 'Line' : change Line attributes (color, thickness) //
34 // see TAttLineEditor //
35 // 'Fill' : change Fill attributes (color, pattern) //
36 // see TAttFillEditor //
37 // 'Title' : TextEntry: set the title of the histogram //
38 // 'Histogram': change the draw options of the histogram //
39 // 'Plot' : Radiobutton: draw a 2D or 3D plot of the histogram //
40 // according to the Plot dimension there will be //
41 // different drawing possibilities (ComboBoxes/ //
42 // CheckBoxes) //
43 // 2d Plot: //
44 // 'Error' : ComboBox: add different error bars to the histogram //
45 // (no errors, simple, ..., see THistPainter::Paint //
46 // 'Add' : ComboBox: further things which can be added to the //
47 // histogram (None, simple/smooth line, fill area //
48 // 'Simple Drawing': CheckBox: draw a simple histogram without //
49 // errors (= "HIST" drawoption). In combination with //
50 // some other draw options an outer line is drawn on //
51 // top of the histogram //
52 // 'Show markers': CheckBox: draw a marker on to of each bin (="P" //
53 // drawoption) //
54 // 'Draw bar chart': CheckBox: draw a bar chart (="B" drawoption) //
55 // change the Fill Color with Fill in the Style Tab //
56 // => will show Bar menue in the Style Tab //
57 // 'Bar option': CheckBox: draw a bar chart (="BAR" drawoption) //
58 // => will show Bar menue in the Style Tab //
59 // 3d Plot: //
60 // 'Type' : ComboBox: set histogram type Lego-Plot or Surface //
61 // draw(Lego, Lego1.2, Surf, Surf1..5) //
62 // see THistPainter::Paint //
63 // 'Coords' : ComboBox: set the coordinate system (Cartesian, .. //
64 // Spheric) see THistPainter::Paint //
65 // 'Error' : see 2D plot //
66 // 'Bar' : change the bar attributes //
67 // 'W' : change Bar Width //
68 // 'O' : change Bar Offset //
69 // 'Percentage': specifies the percentage of the bar which is drawn//
70 // brighter and darker (10% == BAR1 drawoption) //
71 // 'Horizontal Bar': draw a horizontal bar chart //
72 // //
73 // 'Marker' : change the Marker attributes (color, appearance, //
74 // thickness) see TAttMarkerEditor //
75 //Begin_Html
76 /*
77 <img src="gif/TH1Editor1.gif">
78 */
79 //End_Html
80 // This Tab has two different layouts. One is for a histogram which//
81 // is not drawn from an ntuple. The other one is available for a //
82 // histogram which is drawn from an ntuple. In this case the rebin //
83 // algorithm can create a rebinned histogram from the original data//
84 // i.e. the ntuple. //
85 // To see te differences do: //
86 // TFile f("hsimple.root"); //
87 // hpx->Draw("BAR1"); // non ntuple histogram //
88 // ntuple->Draw("px"); // ntuple histogram //
89 // Non ntuple histogram: //
90 // 'Rebin': with the Slider the number of bins (shown in the field//
91 // below the Slider) can be changed to any number which //
92 // divides the number of bins of the original histogram. //
93 // Pushing 'Apply' will delete the origin histogram and //
94 // replace it by the rebinned one on the screen //
95 // Pushing 'Ignore' the origin histogram will be restored//
96 // Histogram drawn from an ntuple: //
97 // 'Rebin' with the slider the number of bins can be enlarged by //
98 // a factor of 2,3,4,5 (moving to the right) or reduced //
99 // by a factor of 1/2, 1/3, 1/4, 1/5 //
100 // 'BinOffset': with the BinOffset slider the origin of the //
101 // histogram can be changed within one binwidth //
102 // Using this slider the effect of binning the data into //
103 // bins can be made visible => statistical fluctuations //
104 // 'Axis Range': with the DoubleSlider it is possible to zoom into//
105 // the specified axis range. It is also possible to set //
106 // the upper and lower limit in fields below the slider //
107 // 'Delayed drawing': all the Binning sliders can set to delay //
108 // draw mode. Then the changes on the histogram are only //
109 // updated, when the Slider is released. This should be //
110 // activated if the redrawing of the histogram is too //
111 // time consuming. //
112 //////////////////////////////////////////////////////////////////////////
113 //
114 //Begin_Html
115 /*
116 <img src="gif/TH1Editor1_1.gif">
117 */
118 //End_Html
119 //Begin_Html
120 /*
121 <img src="gif/TH1Editor1_2.gif">
122 */
123 //End_Html
124 
125 
126 #include "TH1Editor.h"
127 #include "TH1.h"
128 #include "TGedEditor.h"
129 #include "TGComboBox.h"
130 #include "TGTextEntry.h"
131 #include "TGToolTip.h"
132 #include "TGLabel.h"
133 #include "TVirtualPad.h"
134 #include "TStyle.h"
135 #include "TString.h"
136 #include "TGButtonGroup.h"
137 #include "TGNumberEntry.h"
138 #include <stdlib.h>
139 #include "TG3DLine.h"
140 #include "TGDoubleSlider.h"
141 #include "TGSlider.h"
142 #include "TView.h"
143 #include "TCanvas.h"
144 #include "TTreePlayer.h"
145 #include "TSelectorDraw.h"
146 #include "TGMsgBox.h"
147 #include "TGTab.h"
148 #include "TROOT.h"
149 
151 
152 enum ETH1Wid{
168 };
169 
170 
171 ////////////////////////////////////////////////////////////////////////////////
172 /// Constructor of histogram attribute GUI.
173 
175  Int_t height, UInt_t options, Pixel_t back)
176  : TGedFrame(p, width, height, options | kVerticalFrame, back),
177  fHist(0),
178  fSameOpt(kFALSE),
179  fBin(0),
180  fBinHist(0)
181 {
182  // TextEntry for changing the title of the histogram
183  MakeTitle("Title");
184  fTitlePrec = 2;
185  fTitle = new TGTextEntry(this, new TGTextBuffer(50), kTH1_TITLE);
187  fTitle->SetToolTipText("Enter the histogram title string");
188  AddFrame(fTitle, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5));
189 
190  // Histogram draw options
191  TGCompositeFrame *fHistLbl = new TGCompositeFrame(this, 145, 10,
194  kFixedWidth |
196  fHistLbl->AddFrame(new TGLabel(fHistLbl,"Histogram"),
197  new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
198  fHistLbl->AddFrame(new TGHorizontal3DLine(fHistLbl),
199  new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 0));
200  AddFrame(fHistLbl, new TGLayoutHints(kLHintsTop,0,0,2,0));
201 
202  // TGButtonGroup to change: 2D plot <-> 3D plot
203  TGCompositeFrame *f2 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
204  fDimGroup = new TGHButtonGroup(f2,"Plot");
207  fDim->SetToolTipText("A 2-d plot of the histogram is dawn");
209  fDim0->SetToolTipText("A 3-d plot of the histogram is dawn");
212  fDimGroup->Show();
214  f2->AddFrame(fDimGroup, new TGLayoutHints(kLHintsTop, 4, 1, 0, 0));
215  AddFrame(f2, new TGLayoutHints(kLHintsTop, 1, 1, 2, 8));
216 
217  // Set the type of histogram (Lego0..2, Surf0..5) for 3D plot
218  f3 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
219  AddFrame(f3, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
220 
221  TGCompositeFrame *f3a = new TGCompositeFrame(f3, 40, 20);
222  f3->AddFrame(f3a, new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
223  TGLabel *fType = new TGLabel(f3a, "Add: ");
224  f3a->AddFrame(fType, new TGLayoutHints(kLHintsLeft, 6, 1, 4, 4));
225  TGLabel *fCoords = new TGLabel(f3a, "Coords:");
226  f3a->AddFrame(fCoords, new TGLayoutHints(kLHintsLeft, 6, 1, 4, 1));
227 
228  TGCompositeFrame *f3b = new TGCompositeFrame(f3, 40, 20);
229  f3->AddFrame(f3b, new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
231  f3b->AddFrame(fTypeCombo, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 1));
232  fTypeCombo->Resize(80, 20);
233  fTypeCombo->Associate(this);
234  //Set the coordinate system (Cartesian, Spheric, ...)
236  f3b->AddFrame(fCoordsCombo, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 1));
237  fCoordsCombo->Resize(80, 20);
238  fCoordsCombo->Associate(this);
239 
240  // Set the Error (No error, error1..5)
241  TGCompositeFrame *f5 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
242  AddFrame(f5, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
243 
244  TGCompositeFrame *f5a = new TGCompositeFrame(f5, 40, 20);
245  f5->AddFrame(f5a, new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
246  TGLabel *fError = new TGLabel(f5a, "Error:");
247  f5a->AddFrame(fError, new TGLayoutHints(kLHintsLeft, 6, 2, 4, 1));
248 
249  TGCompositeFrame *f5b = new TGCompositeFrame(f5, 40, 20);
250  f5->AddFrame(f5b, new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
252  f5b->AddFrame(fErrorCombo, new TGLayoutHints(kLHintsLeft, 15, 1, 2, 1));
253  fErrorCombo->Resize(80, 20);
254  fErrorCombo->Associate(this);
255 
256  // Further draw options: Smooth/Simple Line, Fill Area for 2D plot
257  f6 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
258  AddFrame(f6, new TGLayoutHints(kLHintsTop, 1, 1, 0, 3));
259 
260  TGCompositeFrame *f6a = new TGCompositeFrame(f6, 40, 20);
261  f6->AddFrame(f6a, new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
262  TGLabel *fAddLabel = new TGLabel(f6a, "Style:");
263  f6a->AddFrame(fAddLabel, new TGLayoutHints(kLHintsLeft, 6, 2, 4, 1));
264 
265  TGCompositeFrame *f6b = new TGCompositeFrame(f6, 40, 20);
266  f6->AddFrame(f6b, new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
268  f6b->AddFrame(fAddCombo, new TGLayoutHints(kLHintsLeft, 15, 1, 2, 1));
269  fAddCombo->Resize(80, 20);
270  fAddCombo->Associate(this);
271 
272  // option related to HIST: some changes needed here!
273  // because of inconsistencies
274  f15 = new TGCompositeFrame(this, 80, 20, kVerticalFrame);
275  fAddSimple = new TGCheckButton(f15, "Simple Drawing", kADD_LINE);
276  fAddSimple ->SetToolTipText("A simple histogram without errors is drawn (draw option: Hist)");
277  f15->AddFrame(fAddSimple, new TGLayoutHints(kLHintsLeft, 6, 1, 1, 0));
278  AddFrame(f15, new TGLayoutHints(kLHintsTop, 1, 1, 0, -1));
279 
280  // Show Marker Checkbox: draw marker (or not)
281  f7 = new TGCompositeFrame(this, 80, 20, kVerticalFrame);
282  fAddMarker = new TGCheckButton(f7, "Show markers", kMARKER_ONOFF);
283  fAddMarker ->SetToolTipText("Make marker visible/invisible");
284  f7->AddFrame(fAddMarker, new TGLayoutHints(kLHintsLeft, 6, 1, 1, 0));
285  AddFrame(f7, new TGLayoutHints(kLHintsTop, 1, 1, 2, 0));
286 
287  // Bar Chart Checkbox: draw with option B
288  f8 = new TGCompositeFrame(this, 80, 20, kVerticalFrame);
289  fAddB = new TGCheckButton(f8, "Draw bar chart", kB_ONOFF);
290  fAddB ->SetToolTipText("Draw a bar chart");
291  f8->AddFrame(fAddB, new TGLayoutHints(kLHintsLeft, 6, 1, 1, 0));
292  AddFrame(f8, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
293 
294  // Bar CheckBox: draw with option BAR +option selected by
295  // fPercentCombo (0..4) e.g. BAR2
296  f9 = new TGCompositeFrame(this, 80, 20, kVerticalFrame);
297  fAddBar = new TGCheckButton(f9, "Bar option", kBAR_ONOFF);
298  fAddBar ->SetToolTipText("Draw bar chart with bar-option");
299  f9->AddFrame(fAddBar, new TGLayoutHints(kLHintsLeft, 6, 1, 1, 0));
300  AddFrame(f9, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
301 
302  // Bar Menu => appears when the BAR checkbox is set
303  f10 = new TGCompositeFrame(this, 145, 10, kHorizontalFrame |
305  kFixedWidth |
307  f10->AddFrame(new TGLabel(f10,"Bar"),
308  new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
310  new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
311  AddFrame(f10, new TGLayoutHints(kLHintsTop,0,0,6,4));
312 
313  // NumberEntry to change the Bar Width
314  f11 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
315  TGLabel *fWidthLbl = new TGLabel(f11, "W:");
316  f11->AddFrame(fWidthLbl, new TGLayoutHints(kLHintsLeft, 1, 3, 4, 1));
317  fBarWidth = new TGNumberEntry(f11, 1.00, 6, kBAR_WIDTH,
321  fBarWidth->GetNumberEntry()->SetToolTipText("Set bin bar width");
322  fBarWidth->Resize(45,20);
323  f11->AddFrame(fBarWidth, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 1));
324 
325  // NumberEntry to change the Bar OFfset
326  TGLabel *foffsetLbl = new TGLabel(f11, "O:");
327  f11->AddFrame(foffsetLbl, new TGLayoutHints(kLHintsLeft, 6,3, 4, 1));
328  fBarOffset = new TGNumberEntry(f11, 0.00, 5, kBAR_OFFSET,
332  fBarOffset->GetNumberEntry()->SetToolTipText("Set bin bar offset");
333  fBarOffset->Resize(50,20);
334  f11->AddFrame(fBarOffset, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 1));
335  AddFrame(f11, new TGLayoutHints(kLHintsTop, 1, 1, 0, 4));
336 
337  // ComboBox which specifies the width of the Bar which should be drawn
338  // in another color i.e. specifies the number in BAR option e.g. BAR2
339  f12 = new TGCompositeFrame(this, 80, 20, kVerticalFrame);
341  TGLabel *percentLabel = new TGLabel(f13, "Percentage:");
342  f13->AddFrame(percentLabel, new TGLayoutHints(kLHintsLeft, 6, 1, 3, 1));
344  fPercentCombo->Resize(51, 20);
345  fPercentCombo->Associate(f13);
346  f13->AddFrame(fPercentCombo, new TGLayoutHints(kLHintsLeft, 14, 1, 2, 1));
347  f12->AddFrame(f13,new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
348 
349  // CHeckBox for horizontal drawing of the Histogram
350  fMakeHBar = new TGCheckButton(f12, "Horizontal Bar", kBAR_H);
351  fMakeHBar ->SetToolTipText("Draw a horizontal bar chart with hBar-Option");
352  f12->AddFrame(fMakeHBar, new TGLayoutHints(kLHintsLeft, 6, 1, 3, 0));
353  AddFrame(f12, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
354 
355  CreateBinTab();
356 
357  // add itself in the least of cleanups to be notified when attached histogram is deleted
358  gROOT->GetListOfCleanups()->Add(this);
359 }
360 
361 ////////////////////////////////////////////////////////////////////////////////
362 /// Create binning tab.
363 
365 {
366  fBin = CreateEditorTabSubFrame("Binning");
367 
368  TGCompositeFrame *title1 = new TGCompositeFrame(fBin, 145, 10,
371  kFixedWidth |
373  title1->AddFrame(new TGLabel(title1, "Rebin"),
374  new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
375  title1->AddFrame(new TGHorizontal3DLine(title1),
376  new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
377  fBin->AddFrame(title1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
378 
379  // Widgets for rebinning a histogram which does NOT derive from a ntuple
381  TGCompositeFrame *f18 = new TGCompositeFrame(fBinCont, 80, 20,
383  fBinSlider = new TGHSlider(f18, 100, kSlider1 | kScaleBoth);
384  fBinSlider->Resize(107,20);
385  f18->AddFrame(fBinSlider, new TGLayoutHints(kLHintsLeft, 3,0,0,3));
386  fBinCont->AddFrame(f18, new TGLayoutHints(kLHintsTop, 15, 7, 3, 5));
387 
388  TGCompositeFrame *f20 = new TGCompositeFrame(fBinCont, 80, 20,
390  TGLabel *binLabel1 = new TGLabel(f20, "# of Bins:");
391  f20->AddFrame(binLabel1, new TGLayoutHints(kLHintsLeft, 7, 1, 2, 1));
394  ((TGTextEntry*)fBinNumberEntry)->SetToolTipText("Set the number of bins in the rebinned histogram");
395  fBinNumberEntry->Resize(57,20);
396  f20->AddFrame(fBinNumberEntry, new TGLayoutHints(kLHintsRight, 21, 0, 0, 0));
397  fBinCont->AddFrame(f20, new TGLayoutHints(kLHintsTop, 0, 7, 3, 4));
398 
399  // Text buttons to Apply or Delete the rebinned histogram
400  TGCompositeFrame *f23 = new TGCompositeFrame(fBinCont, 118, 20,
402  kFixedWidth);
403  fApply = new TGTextButton(f23, " &Apply ");
404  f23->AddFrame(fApply,
405  new TGLayoutHints(kLHintsExpandX | kLHintsLeft , 0, 3, 4, 4));
406  fCancel = new TGTextButton(f23, " &Ignore ");
407  f23->AddFrame(fCancel,
408  new TGLayoutHints(kLHintsExpandX | kLHintsLeft, 3, 0, 4, 4));
409  fBinCont->AddFrame(f23, new TGLayoutHints(kLHintsTop, 20, 3, 3, 4));
411 
412  // Widgets for rebinning a histogram which derives from a ntuple
414  TGCompositeFrame *f21 = new TGCompositeFrame(fBinCont1, 80, 20,
416  fBinSlider1 = new TGHSlider(f21, 100, kSlider1 | kScaleBoth);
417  fBinSlider1->Resize(107,20);
418  fBinSlider1->SetRange(1,9);
419  fBinSlider1->SetScale(12);
421  f21->AddFrame(fBinSlider1, new TGLayoutHints(kLHintsLeft, 3,0,0,3));
422  fBinCont1->AddFrame(f21, new TGLayoutHints(kLHintsTop, 15, 7, 5, 0));
423 
424  // Lettering of the Rebin Slider
425  TGCompositeFrame *f24 = new TGCompositeFrame(fBinCont1, 80, 20,
427  TGLabel *l1 = new TGLabel(f24, "-5");
428  f24->AddFrame(l1, new TGLayoutHints(kLHintsLeft, 18, 1, -1, 0));
429  TGLabel *l2 = new TGLabel(f24, "-2");
430  f24->AddFrame(l2, new TGLayoutHints(kLHintsLeft, 26, 2, -1, 0));
431  TGLabel *l3 = new TGLabel(f24, "2");
432  f24->AddFrame(l3, new TGLayoutHints(kLHintsLeft, 17, 2, -1, 0));
433  TGLabel *l4 = new TGLabel(f24, "5");
434  f24->AddFrame(l4, new TGLayoutHints(kLHintsLeft, 32, 3, -1, 0));
435  fBinCont1->AddFrame(f24, new TGLayoutHints(kLHintsTop, 0, 0, 0, 0));
436 
437  TGCompositeFrame *f22 = new TGCompositeFrame(fBinCont1, 140, 20,
439  TGLabel *binLabel2 = new TGLabel(f22, "# of Bins:");
440  f22->AddFrame(binLabel2, new TGLayoutHints(kLHintsLeft, 7, 1, 4, 1));
441 
444  ((TGTextEntry*)fBinNumberEntry1)->SetToolTipText("Set the number of bins in the rebinned histogram");
445  fBinNumberEntry1->Resize(57,20);
446  f22->AddFrame(fBinNumberEntry1, new TGLayoutHints(kLHintsLeft, 21, 0, 2, 0));
447  fBinCont1->AddFrame(f22, new TGLayoutHints(kLHintsTop, 0, 7, 2, 4));
448 
449  TGCompositeFrame *f26 = new TGCompositeFrame(fBinCont1, 80, 20,
451  TGLabel *offsetLbl = new TGLabel(f26, "BinOffset:");
452  f26->AddFrame(offsetLbl, new TGLayoutHints(kLHintsLeft, 6, 1, 2, 1));
457  0., 1.);
458  ((TGTextEntry*)fOffsetNumberEntry)->SetToolTipText("Add an offset to the origin of the histogram");
459  fOffsetNumberEntry->Resize(57,20);
461  new TGLayoutHints(kLHintsRight, 21, 0, 0, 0));
462  fBinCont1->AddFrame(f26, new TGLayoutHints(kLHintsTop, 0, 7, 3, 1));
463 
464  TGCompositeFrame *f25 = new TGCompositeFrame(fBinCont1, 80, 20,
466  fBinOffsetSld = new TGHSlider(f25, 100, kSlider1 | kScaleBoth);
467  fBinOffsetSld->Resize(107,20);
468  f25->AddFrame(fBinOffsetSld, new TGLayoutHints(kLHintsLeft, 15,0,0,2));
469  fBinCont1->AddFrame(f25, new TGLayoutHints(kLHintsTop, 3, 7, 3, 3));
471 
472  // Sliders for axis range
473  TGCompositeFrame *sldCont = new TGCompositeFrame(fBin, 80, 20,
475  TGCompositeFrame *title2 = new TGCompositeFrame(sldCont, 145, 10,
478  kFixedWidth |
480  title2->AddFrame(new TGLabel(title2, "Axis Range"),
481  new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
482  title2->AddFrame(new TGHorizontal3DLine(title2),
483  new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
484  sldCont->AddFrame(title2, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
485 
486  TGCompositeFrame *f14 = new TGCompositeFrame(sldCont, 80, 20,
488  TGLabel *fSliderLbl = new TGLabel(f14,"x:");
489  f14->AddFrame(fSliderLbl,
490  new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 4,4, 4, 1));
491  fSlider = new TGDoubleHSlider(f14, 1, 2);
492  fSlider->Resize(118,20);
494  sldCont->AddFrame(f14, new TGLayoutHints(kLHintsTop, 3, 7, 4, 1));
495 
496  TGCompositeFrame *f16 = new TGCompositeFrame(sldCont, 80, 20,
498  fSldMin = new TGNumberEntryField(f16, kSLIDER_MIN, 0.0,
501  ((TGTextEntry*)fSldMin)->SetToolTipText("Set the minimum value of the x-axis");
502  fSldMin->Resize(57,20);
503  f16->AddFrame(fSldMin, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
504  fSldMax = new TGNumberEntryField(f16, kSLIDER_MAX, 0.0,
507  ((TGTextEntry*)fSldMax)->SetToolTipText("Set the maximum value of the x-axis");
508  fSldMax->Resize(57,20);
509  f16->AddFrame(fSldMax, new TGLayoutHints(kLHintsLeft, 4, 0, 0, 0));
510  sldCont->AddFrame(f16, new TGLayoutHints(kLHintsTop, 20, 3, 5, 0));
511 
512  TGCompositeFrame *f17 = new TGCompositeFrame(sldCont, 80, 20, kVerticalFrame);
513  fDelaydraw = new TGCheckButton(f17, "Delayed drawing", kDELAYED_DRAWING);
514  fDelaydraw ->SetToolTipText("Draw the new histogram only when any Slider is released");
515  f17->AddFrame(fDelaydraw, new TGLayoutHints(kLHintsLeft, 6, 1, 2, 0));
516  sldCont->AddFrame(f17, new TGLayoutHints(kLHintsTop, 1, 1, 5, 0));
517  fBin->AddFrame(sldCont, new TGLayoutHints(kLHintsTop));
518 
519  // to avoid jumping from DoAddBar to DoAddB and vice versa
520  fMakeB=kTRUE;
521  // to avoid calling SetDrawoption after every change
522  fMake=kTRUE;
523 
524  fBinHist = 0; // used to save a copy of the histogram
525 
526  // (when not drawn from an ntuple)
527  fBinOffsetSld->SetRange(0,100);
529  fOffsetNumberEntry->SetNumber(0.0000);
532 
533 } // end bin tab
534 
535 ////////////////////////////////////////////////////////////////////////////////
536 /// Destructor of TH1 editor.
537 
539 {
540  // remove itselef from the list of cleanups
541  gROOT->GetListOfCleanups()->Remove(this);
542 
543  // children of TGButonGroup are not deleted
544  delete fDim;
545  delete fDim0;
546  delete fDimlh;
547  delete fDim0lh;
548 
549  if (fBinHist) delete fBinHist;
550  fBinHist = 0;
551 }
552 
553 ////////////////////////////////////////////////////////////////////////////////
554 /// Connect signals to slots.
555 
557 {
558  //widgets for draw options
559  fAddB->Connect("Toggled(Bool_t)", "TH1Editor", this, "DoAddB(Bool_t)");
560  fAddBar->Connect("Toggled(Bool_t)", "TH1Editor", this, "DoAddBar(Bool_t)");
561  fTitle->Connect("TextChanged(const char *)", "TH1Editor", this, "DoTitle(const char *)");
562  fTypeCombo->Connect("Selected(Int_t)", "TH1Editor", this, "DoHistChanges()");
563  fCoordsCombo->Connect("Selected(Int_t)", "TH1Editor", this, "DoHistChanges()");
564  fErrorCombo->Connect("Selected(Int_t)", "TH1Editor", this, "DoHistChanges()");
565  fAddCombo->Connect("Selected(Int_t)", "TH1Editor", this, "DoHistChanges()");
566  fAddMarker->Connect("Toggled(Bool_t)", "TH1Editor", this, "DoAddMarker(Bool_t)");
567  fAddSimple->Connect("Toggled(Bool_t)", "TH1Editor", this, "DoAddSimple(Bool_t)");
568 
569  //change 2D <-> 3D plot
570  fDimGroup->Connect("Clicked(Int_t)","TH1Editor",this,"DoHistView()");
571 
572  // change Bar Width/Offset, the second connection is needed to have the ability to confirm the value also with enter
573  fBarWidth->Connect("ValueSet(Long_t)", "TH1Editor", this, "DoBarWidth()");
574  (fBarWidth->GetNumberEntry())->Connect("ReturnPressed()", "TH1Editor", this, "DoBarWidth()");
575  fBarOffset->Connect("ValueSet(Long_t)", "TH1Editor", this, "DoBarOffset()");
576  (fBarOffset->GetNumberEntry())->Connect("ReturnPressed()", "TH1Editor", this, "DoBarOffset()");
577  fPercentCombo->Connect("Selected(Int_t)", "TH1Editor", this, "DoPercent()");
578  fMakeHBar-> Connect("Toggled(Bool_t)","TH1Editor",this,"DoHBar(Bool_t))");
579 
580  // Connections for rebinning are created - i.e. slider is
581  // connected to the slots that perform the rebinning in the
582  // case of a histogram not derived from an ntuple.
583  fBinSlider->Connect("PositionChanged(Int_t)","TH1Editor",this, "DoBinMoved(Int_t)");
584  fBinSlider->Connect("Released()","TH1Editor",this, "DoBinReleased()");
585  fBinSlider->Connect("Pressed()","TH1Editor",this, "DoBinPressed()");
586  // numberEntry which shows/sets the actual number of bins
587  fBinNumberEntry->Connect("ReturnPressed()", "TH1Editor", this, "DoBinLabel()");
588  // Buttons to accept/reject the rebinned histogram
589  fApply->Connect("Clicked()", "TH1Editor", this, "DoApply()");
590  fCancel->Connect("Pressed()", "TH1Editor", this, "DoCancel()");
591  // in case of a histogram which is derived from an ntuple these slots are used
592  fBinSlider1->Connect("Released()","TH1Editor",this, "DoBinReleased1()");
593  fBinSlider1->Connect("PositionChanged(Int_t)","TH1Editor",this, "DoBinMoved1()");
594  fBinNumberEntry1->Connect("ReturnPressed()", "TH1Editor", this, "DoBinLabel1()");
595  // slider/slots to change the offset of the histogram
596  fBinOffsetSld->Connect("PositionChanged(Int_t)", "TH1Editor", this,"DoOffsetMoved(Int_t)");
597  fBinOffsetSld->Connect("Released()", "TH1Editor", this, "DoOffsetReleased()");
598  fBinOffsetSld->Connect("Pressed()", "TH1Editor", this, "DoOffsetPressed()");
599  fOffsetNumberEntry->Connect("ReturnPressed()", "TH1Editor", this, "DoBinOffset()");
600  // slider/slots to set the visible axisrange
601  fSlider->Connect("PositionChanged()","TH1Editor", this,"DoSliderMoved()");
602  fSlider->Connect("Pressed()","TH1Editor", this, "DoSliderPressed()");
603  fSlider->Connect("Released()","TH1Editor", this, "DoSliderReleased()");
604  fSldMin->Connect("ReturnPressed()", "TH1Editor", this, "DoAxisRange()");
605  fSldMax->Connect("ReturnPressed()", "TH1Editor", this, "DoAxisRange()");
606  fInit = kFALSE;
607 }
608 
609 ////////////////////////////////////////////////////////////////////////////////
610 /// Check if object is able to configure with this editor.
611 
613 {
614  if (obj == 0 || !obj->InheritsFrom(TH1::Class()) ||
615  ((TH1*)obj)->GetDimension()!=1 ||
616  ((TH1*)obj)->GetEntries() == 0
617  /*|| obj->InheritsFrom("TH2") || obj->InheritsFrom("TProfile")*/) {
618  return kFALSE;
619  }
620  return kTRUE;
621 }
622 
623 ////////////////////////////////////////////////////////////////////////////////
624 /// Pick up current values of histogram attributes.
625 
627 {
628 
629  if (fBinHist && (obj != fHist)) {
630  //we have probably moved to a different pad.
631  //let's restore the original histogram
632  if (fHist) {
633  fHist->Reset();
635  fBinHist->GetXaxis()->GetXmin(),
636  fBinHist->GetXaxis()->GetXmax());
637  fHist->Add(fBinHist);
638  }
639  // delete in anycase fBinHist also when fHist is zero (i.e when it has been deleted)
640  delete fBinHist; fBinHist = 0;
641  }
642 
643  fHist = (TH1*)obj;
645 
646  const char *text = fHist->GetTitle();
647  fTitle->SetText(text);
648 
649  fMake=kFALSE;
650  TString str = GetDrawOption();
651  str.ToUpper();
652  if (str.Contains("SAME"))
653  fSameOpt = kTRUE;
654  else
655  fSameOpt = kFALSE;
656  Bool_t errorset = kFALSE;
657  // if no draw option is specified: (default options)
658  if (str.IsNull() || str=="" ) {
661  HideFrame(f3); // Hiding the histogram type combo box
662  ShowFrame(f6);
663  ShowFrame(f7);
664  ShowFrame(f8);
665  ShowFrame(f9);
666  HideFrame(f10);
667  HideFrame(f11);
668  HideFrame(f12);
669  ShowFrame(f15);
672  errorset=kTRUE;
678  ChangeErrorCombo(1);
679  // in case of a 2D plot:
680  } else if (!str.Contains("LEGO") && !str.Contains("SURF")){
683  HideFrame(f3); // Hiding the histogram type combo box
684  ShowFrame(f7);
685  ShowFrame(f8);
686  ShowFrame(f9);
687  ShowFrame(f15);
689  // initialising fAddCombo
690  if (str.Contains("C")) {
691  if (str.Contains("CYL")) {
692  TString dum = str;
693  dum.Remove(strstr(dum.Data(),"CYL")-dum.Data(),3);
694  if (dum.Contains("C")) fAddCombo->Select(kADD_SMOOTH);
695  } else fAddCombo->Select(kADD_SMOOTH);
696  }
697  else if (str.Contains("LF2")) fAddCombo->Select(kADD_FILL);
698  else if (str.Contains("L")){
699  TString dum = str;
700  if (str.Contains("CYL")) {
701  dum.Remove(strstr(dum.Data(),"CYL")-dum.Data(),3);
702  if (dum.Contains("L")) fAddCombo->Select(kADD_SIMPLE);
703  }
704  if (str.Contains("POL")) {
705  dum.Remove(strstr(dum.Data(),"POL")-dum.Data(),3);
706  if (dum.Contains("L")) fAddCombo->Select(kADD_SIMPLE);
707  } else fAddCombo->Select(kADD_SIMPLE);
708  } else fAddCombo->Select(kADD_NONE);
709 
712  else if (str.Contains("HIST")) {
713  if (str=="HIST") fAddSimple->SetState(kButtonDisabled);
715  } else fAddSimple->SetState(kButtonUp);
716 
717  if (str.Contains("B")) {
718  TString dum = str;
719  if (str.Contains("BAR")) {
722  ShowFrame(f10);
723  ShowFrame(f11);
724  ShowFrame(f12);
725  } else {
729  ShowFrame(f10);
730  ShowFrame(f11);
731  HideFrame(f12);
732  }
733  } else {
736  HideFrame(f10);
737  HideFrame(f11);
738  HideFrame(f12);
739  }
740  if (str.Contains("P") ) {
743  } else if (!str.Contains("BAR")) fAddMarker->SetState(kButtonUp);
744  ChangeErrorCombo(1);
745 
746  // in case of a 3D plot
747  } else if (str.Contains("LEGO") || str.Contains("SURF")){
750  TGListBox* lb;
751  ChangeErrorCombo(0);
752  // set Coordinate ComboBox
753  if (str.Contains("SURF")){
754  // surf cannot be combined with spheric and cartesian coordinates
755  // i.e. remove them from the combobox
758  lb = fCoordsCombo->GetListBox();
759  lb->Resize(lb->GetWidth(), 49);
760  } else {
761  // surf cannot be combined with spheric and cartesian coordinates
762  // if surf was selected before here the removed items were added the combobox again
763  if (((TGLBContainer*)((TGListBox*)fCoordsCombo->GetListBox())->GetContainer())->GetPos(kCOORDS_SPH)==-1)
764  fCoordsCombo->AddEntry("Spheric", kCOORDS_SPH);
765  if (((TGLBContainer*)((TGListBox*)fCoordsCombo->GetListBox())->GetContainer())->GetPos(kCOORDS_CAR)==-1) {
766  fCoordsCombo->AddEntry("Cartesian", kCOORDS_CAR);
767  lb = fCoordsCombo->GetListBox();
768  lb->Resize(lb->GetWidth(), 83);
769  }
770  }
771  // initialising the Type Combobox
772  if (str.Contains("LEGO2")) fTypeCombo->Select(kTYPE_LEGO2);
773  else if (str.Contains("LEGO1")) fTypeCombo->Select(kTYPE_LEGO1);
774  else if (str.Contains("LEGO")) fTypeCombo->Select(kTYPE_LEGO);
775  else if (str.Contains("SURF5")) fTypeCombo->Select(kTYPE_SURF5);
776  else if (str.Contains("SURF4")) fTypeCombo->Select(kTYPE_SURF4);
777  else if (str.Contains("SURF3")) fTypeCombo->Select(kTYPE_SURF3);
778  else if (str.Contains("SURF2")) fTypeCombo->Select(kTYPE_SURF2);
779  else if (str.Contains("SURF1")) fTypeCombo->Select(kTYPE_SURF1);
780  else if (str.Contains("SURF")) fTypeCombo->Select(kTYPE_SURF);
781 
782  if (str.Contains("CYL")) fCoordsCombo->Select(kCOORDS_CYL);
783  else if (str.Contains("POL")) fCoordsCombo->Select(kCOORDS_POL);
784  else if (str.Contains("SPH")) fCoordsCombo->Select(kCOORDS_SPH);
785  else if (str.Contains("PSR")) fCoordsCombo->Select(kCOORDS_PSR);
786  else fCoordsCombo->Select(kCOORDS_CAR); //default
787 
788  HideFrame(f6);
789  HideFrame(f7);
790  HideFrame(f8);
791  HideFrame(f9);
792  HideFrame(f15);
793  if (str.Contains("LEGO")) {
794  ShowFrame(f10);
795  ShowFrame(f11);
796  HideFrame(f12);
797  } else {
798  HideFrame(f10);
799  HideFrame(f11);
800  HideFrame(f12);
801  }
804  }
805 
806  if (!errorset) {
807  if (str.Contains("E1")) fErrorCombo->Select(kERRORS_EDGES);
808  else if (str.Contains("E2")) fErrorCombo->Select(kERRORS_REC);
809  else if (str.Contains("E3")) fErrorCombo->Select(kERRORS_FILL);
810  else if (str.Contains("E4")) fErrorCombo->Select(kERRORS_CONTOUR);
811  else if (str.Contains("E")) {
812  if (str.Contains("LEGO")) {
813  TString dum=str;
814  dum.Remove(strstr(dum.Data(),"LEGO")-dum.Data(),4);
815  if (dum.Contains("E")) fErrorCombo->Select(kERRORS_SIMPLE);
817  } else fErrorCombo->Select(kERRORS_NO); //default
818  }
819 
821  HideFrame(f7);
822  HideFrame(f8);
823  }
824  if (str.Contains("BAR") || ((fAddBar->GetState()==kButtonDown) &&
825  (fDim->GetState()==kButtonDown))) {
826  ShowFrame(f10);
827  ShowFrame(f11);
828  ShowFrame(f12);
831  if (str.Contains("HBAR")) fMakeHBar->SetState(kButtonDown);
833 
834  if (str.Contains("BAR4")) fPercentCombo->Select(kPER_40);
835  else if (str.Contains("BAR3")) fPercentCombo->Select(kPER_30);
836  else if (str.Contains("BAR2")) fPercentCombo->Select(kPER_20);
837  else if (str.Contains("BAR1")) fPercentCombo->Select(kPER_10);
838  else fPercentCombo->Select(kPER_0);
839  }
840 
841  Int_t nx = fHist -> GetXaxis() -> GetNbins();
842  Int_t nxbinmin = fHist -> GetXaxis() -> GetFirst();
843  Int_t nxbinmax = fHist -> GetXaxis() -> GetLast();
844 
846 
848 
849  // Check if histogram is from ntupla/tree or not.
850  // If it is a standard histogram or a ntupla based histogram
851  // show a different frame in case of rebinning (fBinCont) with sliders and bin number entries
852  // connected to different methods.
853  // For example the entry field fBinNumberEntry is connected to
854  // the method DoBinLabel in case of non-ntupla histograms which just call Th1::Rebin
855  // In csae of a tree based histogram the entry field fBinNumberEntry1 is used which is connected to
856  // TH1Editor::DoBinLabel1 which is re-filling the histograms with the cached values from the TTreePlayer.
857  // Since the actual number of histogram entry can be larger than the cache size of the TTreePlayer
858  // (see JIRA ROOT-5900 or http://root.cern.ch/phpBB3/viewtopic.php?f=3&t=17107 )
859  // the GUI frame based on a non-tupla histogram is used when the number of entries of the histogram is
860  // not the same as the number of filled entries in the TTreePlayer object.
861 
862  if (!player || player->GetHistogram()!=fHist ||
863  fHist->GetEntries() != player->GetNfill()) {
864 
865  Int_t n = 0;
866  if (fBinHist) n = fBinHist->GetXaxis()->GetNbins();
867  else n = nx;
868  if (n < 1) n = 1;
871  Int_t* div = Dividers(n);
872  Int_t up = 0;
873  if (div[0]-1 <= 1) up = 2;
874  else up = div[0]-1;
875  fBinSlider->SetRange(1,up);
876  Int_t i = 1;
877  if (fBinSlider->GetMaxPosition()==2 && fBinSlider->GetPosition()==2)
879  else {
880  while ( div[i] != nx) i ++;
881  fBinSlider->SetPosition(div[0] - i + 1);
882  }
885  delete [] div;
886  }
887  else if (player && fHist==player->GetHistogram() && fHist->GetEntries() == player->GetNfill()) {
888  // in case of a ntupla/tree based histogram with number of entries not exceeding the TTreePlayer cache
891  fBinSlider->SetRange(0,1);
895  fBinNumberEntry1->SetIntNumber(nxbinmax-nxbinmin+1);
896  }
897 
898  fSlider->SetRange(1,nx);
899  fSlider->SetPosition((Double_t)nxbinmin,(Double_t)nxbinmax);
900 
901  fSldMin->SetNumber(fHist->GetXaxis()->GetBinLowEdge(nxbinmin));
902  fSldMax->SetNumber(fHist->GetXaxis()->GetBinUpEdge(nxbinmax));
903 
905  fHist->GetXaxis()->GetBinWidth(1));
906 
908  fMake=kTRUE;
911 }
912 
913 ////////////////////////////////////////////////////////////////////////////////
914 /// Slot connected to the histogram title setting.
915 
916 void TH1Editor::DoTitle(const char *text)
917 {
918  if (fAvoidSignal) return;
919  fHist->SetTitle(text);
920  Update();
921 }
922 
923 ////////////////////////////////////////////////////////////////////////////////
924 /// Slot connected to the show markers check box.
925 
927 {
928  if (fAvoidSignal) return;
929  TString str = GetDrawOption();
930  str.ToUpper();
931  if (str.Contains("SAME"))
932  fSameOpt = kTRUE;
933  else
934  fSameOpt = kFALSE;
935  TString dum = str;
936 
937  if (dum.Contains("POL")) dum.Remove(strstr(dum.Data(),"POL")-dum.Data(),3);
938  if (dum.Contains("SPH")) dum.Remove(strstr(dum.Data(),"SPH")-dum.Data(),3);
939  if (dum.Contains("PSR")) dum.Remove(strstr(dum.Data(),"PSR")-dum.Data(),3);
940  if (on) {
941  if (!dum.Contains("P")) str += "P";
943  if (str.Contains("HIST"))
944  str.Remove(strstr(str.Data(),"HIST")-str.Data(),4);
945  } else if (fAddMarker->GetState()==kButtonUp) {
946  if (str.Contains("POL") || str.Contains("SPH")) {
947  while (dum.Contains("P"))
948  dum.Remove(strstr(dum.Data(),"P")-dum.Data(),1);
949  if (str.Contains("POL")) str = dum + "POL";
950  if (str.Contains("SPH")) str = dum + "SPH";
951  if (str.Contains("PSR")) str = dum + "PSR";
952  } else if (str.Contains("P")) str.Remove(str.First("P"),1);
953  if ((str=="HIST") || (str=="") ||
954  (fAddB->GetState()==kButtonDown) ||
957  else if (str.Contains("HIST"))
959  else
961  }
962  if (fMake) {
963  if (fSameOpt) str += "SAME";
964  SetDrawOption(str);
965  Update();
966  }
967 }
968 
969 ////////////////////////////////////////////////////////////////////////////////
970 /// Slot connected to the bar Add check box.
971 
973 {
974  if (fAvoidSignal) return;
975  TString str = GetDrawOption();
976  str.ToUpper();
977  if (str.Contains("SAME"))
978  fSameOpt = kTRUE;
979  else
980  fSameOpt = kFALSE;
981  if (fMakeB) {
982  fMakeB=kFALSE;
983  if (on) {
984  if (!str.Contains("B")) str += "B";
985  ShowFrame(f10);
986  ShowFrame(f11);
987  HideFrame(f12);
992  } else if (fAddB->GetState()==kButtonUp) {
993  while (str.Contains("B"))
994  str.Remove(str.First("B"),1);
995  HideFrame(f10);
996  HideFrame(f11);
997  HideFrame(f12);
999  if (fAddMarker->GetState()!=kButtonDown &&
1000  !(str=="" || str=="HIST" ||
1003  }
1004  if (fSameOpt) str += "SAME";
1005  if (fMake) SetDrawOption(str);
1006  Update();
1007 
1008  fMakeB=kTRUE;
1009  }
1010 }
1011 
1012 ////////////////////////////////////////////////////////////////////////////////
1013 /// Slot connected to the bar Add check box.
1014 
1016 {
1017  if (fAvoidSignal) return;
1019  TString str = GetDrawOption();
1020  str.ToUpper();
1021  if (str.Contains("SAME"))
1022  fSameOpt = kTRUE;
1023  else
1024  fSameOpt = kFALSE;
1025  if (fMakeB) {
1026  fMakeB=kFALSE;
1027  Int_t o = 0;
1028  if (str.Contains("HBAR")) o=1;
1029  if (str.Contains("BAR4"))
1030  str.Remove(strstr(str.Data(),"BAR4")-str.Data()-o,4+o);
1031  else if (str.Contains("BAR3"))
1032  str.Remove(strstr(str.Data(),"BAR3")-str.Data()-o,4+o);
1033  else if (str.Contains("BAR2"))
1034  str.Remove(strstr(str.Data(),"BAR2")-str.Data()-o,4+o);
1035  else if (str.Contains("BAR1"))
1036  str.Remove(strstr(str.Data(),"BAR1")-str.Data()-o,4+o);
1037  else if (str.Contains("BAR0"))
1038  str.Remove(strstr(str.Data(),"BAR0")-str.Data()-o,4+o);
1039  else if (str.Contains("BAR"))
1040  str.Remove(strstr(str.Data(),"BAR")-str.Data()-o,3+o);
1041  if (on) {
1042  if ((fAddMarker->GetState()==kButtonDown) &&
1046  else if ((fAddMarker->GetState()!=kButtonDown) &&
1048  if (str.Contains("HIST"))
1050  else if (fAddCombo->GetSelected()!=kADD_NONE)
1052  else
1054  }
1055  switch (fPercentCombo->GetSelected()){
1056  case(-1): {
1057  str += "BAR";
1059  break;
1060  }
1061  case(kPER_0): {
1062  str += "BAR";
1063  break;
1064  }
1065  case(kPER_10): {
1066  str += "BAR1";
1067  break;
1068  }
1069  case(kPER_20): {
1070  str += "BAR2";
1071  break;
1072  }
1073  case(kPER_30): {
1074  str += "BAR3";
1075  break;
1076  }
1077  case(kPER_40): {
1078  str += "BAR4";
1079  break;
1080  }
1081  }
1082  ShowFrame(f10);
1083  ShowFrame(f11);
1084  ShowFrame(f12);
1085  if (fMakeHBar->GetState()==kButtonDown)
1086  str.Insert(strstr(str.Data(),"BAR")-str.Data(),"H");
1090  } else if (fAddBar->GetState()==kButtonUp) {
1091  HideFrame(f10);
1092  HideFrame(f11);
1093  HideFrame(f12);
1097  if (str=="" || str=="HIST" || fAddCombo->GetSelected() != kADD_NONE ||
1098  ((fAddMarker->GetState() == kButtonDown) &&
1101  }
1102  if (fSameOpt) str += "SAME";
1103  if (fMake) SetDrawOption(str);
1104  Update();
1105  ((TGMainFrame*)GetMainFrame())->Layout();
1106  fMakeB=kTRUE;
1107  }
1108  fAddMarker->Connect("Toggled(Bool_t)", "TH1Editor", this, "DoAddMarker(Bool_t)");
1109 }
1110 
1111 ////////////////////////////////////////////////////////////////////////////////
1112 /// Slot connected to fAddSimple check box for drawing a simple histogram
1113 /// without errors (== HIST draw option) in combination with some other
1114 /// draw options. It draws an additional line on the top of the bins.
1115 
1117 {
1118  if (fAvoidSignal) return;
1120  // Bool_t make=kFALSE;
1121  fMake = kFALSE;
1122  TString str = GetDrawOption();
1123  str.ToUpper();
1124  if (str.Contains("SAME"))
1125  fSameOpt = kTRUE;
1126  else
1127  fSameOpt = kFALSE;
1128  if (on) {
1129  if (!str.Contains("HIST")) {
1130  str += "HIST";
1132  fMake=kTRUE;
1133  }
1134  } else if (fAddSimple->GetState()==kButtonUp) {
1135  if (str.Contains("HIST")) {
1136  str.Remove(strstr(str.Data(),"HIST")-str.Data(),4);
1138  fMake=kTRUE;
1139  }
1140  }
1141  if (fSameOpt) str += "SAME";
1142  if (fMake) SetDrawOption(str);
1143  fAddMarker->Connect("Toggled(Bool_t)", "TH1Editor", this, "DoAddMarker(Bool_t)");
1144  Update();
1145 }
1146 
1147 ////////////////////////////////////////////////////////////////////////////////
1148 /// Slot connected to the 'Plot' button group.
1149 
1151 {
1152  if (gPad && gPad->GetVirtCanvas())
1153  gPad->GetVirtCanvas()->SetCursor(kWatch);
1154  gVirtualX->SetCursor(GetId(), gVirtualX->CreateCursor(kWatch));
1155 
1156  if (fDim->GetState() == kButtonDown)
1157  DoHistSimple();
1158  else
1159  DoHistComplex();
1160 
1161  if (gPad && gPad->GetVirtCanvas())
1162  gPad->GetVirtCanvas()->SetCursor(kPointer);
1163  gVirtualX->SetCursor(GetId(), gVirtualX->CreateCursor(kPointer));
1164 }
1165 
1166 ////////////////////////////////////////////////////////////////////////////////
1167 /// Slot connected to the 2D radio button.
1168 
1170 {
1171  if (fAvoidSignal) return;
1172  if (fDim->GetState()==kButtonDown){
1173  TString str ="";
1174  fMake=kFALSE;
1175  TGListBox* lb;
1176  HideFrame(f3);
1177  ShowFrame(f6);
1178  ShowFrame(f9);
1179  ShowFrame(f15);
1180  ChangeErrorCombo(1);
1181  if ((fAddBar->GetState() != kButtonDown ||
1185  else if ((fAddSimple->GetState()==kButtonDisabled) &&
1188  else if (fAddSimple->GetState()!=kButtonUp)
1193 
1195  ShowFrame(f7);
1196  ShowFrame(f8);
1197  } else {
1198  HideFrame(f7);
1199  HideFrame(f8);
1202  }
1203 
1204  if ((fAddB->GetState() == kButtonDisabled)) {
1205  if (fAddBar->GetState()==kButtonDown) {
1206  ShowFrame(f10);
1207  ShowFrame(f11);
1208  ShowFrame(f12);
1209  } else {
1210  HideFrame(f10);
1211  HideFrame(f11);
1212  HideFrame(f12);
1213  }
1214  }
1215  if (fAddBar->GetState() == kButtonDisabled){
1216  ShowFrame(f10);
1217  ShowFrame(f11);
1218  HideFrame(f12);
1219  }
1220  if ((fAddBar->GetState() == kButtonUp) &&
1221  (fAddB->GetState() == kButtonUp)) {
1222  HideFrame(f10);
1223  HideFrame(f11);
1224  HideFrame(f12);
1225  }
1229  lb = fAddCombo->GetListBox();
1230  lb->Resize(lb->GetWidth(),19);
1233  fAddCombo->Connect("Selected(Int_t)", "TH1Editor", this, "DoHistChanges()");
1234  } else {
1235  if (((TGLBContainer*)((TGListBox*)fAddCombo->GetListBox())->GetContainer())->GetPos(kADD_SIMPLE)==-1)
1236  ((TGListBox*)fAddCombo->GetListBox())->AddEntry("Simple Line", kADD_SIMPLE);
1237  if (((TGLBContainer*)((TGListBox*)fAddCombo->GetListBox())->GetContainer())->GetPos(kADD_SMOOTH)==-1)
1238  ((TGListBox*)fAddCombo->GetListBox())->AddEntry("Smooth Line", kADD_SMOOTH);
1239  if (((TGLBContainer*)((TGListBox*)fAddCombo->GetListBox())->GetContainer())->GetPos(kADD_FILL)==-1) {
1240  ((TGListBox*)fAddCombo->GetListBox())->AddEntry("Fill Area",kADD_FILL);
1241  lb = fAddCombo->GetListBox();
1242  lb->Resize(lb->GetWidth(),76);
1243  }
1244  }
1245  if (fAddSimple->GetState()==kButtonDown) str+="HIST";
1247  if (fSameOpt) str += "SAME";
1248  SetDrawOption(str);
1249  Update();
1250  //fGedEditor->GetTab()->Layout();
1251  ((TGMainFrame*)GetMainFrame())->Layout();
1252  fMake=kTRUE;
1253  }
1254 }
1255 
1256 ////////////////////////////////////////////////////////////////////////////////
1257 /// Slot connected to the 3D radio button.
1258 
1260 {
1261  if (fAvoidSignal) return;
1262  if (fDim0->GetState()==kButtonDown) {
1263  TString str ="";
1264  fMake=kFALSE;
1265  ShowFrame(f3);
1266  HideFrame(f6);
1267  HideFrame(f7);
1268  HideFrame(f8);
1269  HideFrame(f9);
1270  HideFrame(f15);
1271  ChangeErrorCombo(0);
1272  if (fTypeCombo->GetSelected()==-1 && fCoordsCombo->GetSelected()==-1) {
1273  str = "LEGO"+GetHistErrorLabel();
1276  } else if (fTypeCombo->GetSelected()==-1){
1277  str = "LEGO"+GetHistErrorLabel();
1279  } else if (fCoordsCombo->GetSelected()==-1) {
1282  } else {
1284  }
1285  if (str.Contains("LEGO")) {
1286  ShowFrame(f10);
1287  ShowFrame(f11);
1288  HideFrame(f12);
1289  } else {
1290  HideFrame(f10);
1291  HideFrame(f11);
1292  HideFrame(f12);
1293  }
1294  if (fSameOpt) str += "SAME";
1295  SetDrawOption(str);
1296  Update();
1297  ((TGMainFrame*)GetMainFrame())->Layout();
1298  fGedEditor->GetTab()->Layout();
1299  fMake=kTRUE;
1300  }
1301 }
1302 
1303 ////////////////////////////////////////////////////////////////////////////////
1304 /// Slot connected to the histogram type, the coordinate type, the error type
1305 /// and the Add combo box.
1306 
1308 {
1309  if (fAvoidSignal) return;
1310  fMakeB= kFALSE;
1311  TGListBox* lb;
1312  if (GetHistTypeLabel().Contains("SURF")) {
1318  lb = fCoordsCombo->GetListBox();
1319  lb->Resize(lb->GetWidth(), 49);
1320  } else {
1321  if (((TGLBContainer*)((TGListBox*)fCoordsCombo->GetListBox())->GetContainer())->GetPos(kCOORDS_SPH)==-1)
1322  ((TGListBox*)fCoordsCombo->GetListBox())->AddEntrySort("Spheric", kCOORDS_SPH);
1323  if (((TGLBContainer*)((TGListBox*)fCoordsCombo->GetListBox())->GetContainer())->GetPos(kCOORDS_CAR)==-1) {
1324  ((TGListBox*)fCoordsCombo->GetListBox())->AddEntrySort("Cartesian", kCOORDS_CAR);
1325  lb = fCoordsCombo->GetListBox();
1326  lb->Resize(lb->GetWidth(), 83);
1327  }
1328  }
1329  if (fDim->GetState()!=kButtonUp){
1330  if (fErrorCombo->GetSelected() != kERRORS_NO){
1331  HideFrame(f7);
1332  HideFrame(f8);
1333  ShowFrame(f9);
1341  lb = fAddCombo->GetListBox();
1342  lb->Resize(lb->GetWidth(),19);
1345  fAddCombo->Connect("Selected(Int_t)", "TH1Editor", this, "DoHistChanges()");
1346  if (fAddBar->GetState()==kButtonDown) {
1347  ShowFrame(f10);
1348  ShowFrame(f11);
1349  ShowFrame(f12);
1350  } else {
1351  HideFrame(f10);
1352  HideFrame(f11);
1353  HideFrame(f12);
1354  }
1355  } else {
1356  Bool_t on = fMake;
1357  fMake=kFALSE;
1358  ShowFrame(f7);
1359  ShowFrame(f8);
1360  ShowFrame(f9);
1363  if (fAddBar->GetState() != kButtonDown &&
1366  if (((TGLBContainer*)((TGListBox*)fAddCombo->GetListBox())->GetContainer())->GetPos(kADD_SIMPLE)==-1)
1367  ((TGListBox*)fAddCombo->GetListBox())->AddEntry("Simple Line", kADD_SIMPLE);
1368  if (((TGLBContainer*)((TGListBox*)fAddCombo->GetListBox())->GetContainer())->GetPos(kADD_SMOOTH)==-1)
1369  ((TGListBox*)fAddCombo->GetListBox())->AddEntry("Smooth Line", kADD_SMOOTH);
1370  if (((TGLBContainer*)((TGListBox*)fAddCombo->GetListBox())->GetContainer())->GetPos(kADD_FILL)==-1) {
1371  ((TGListBox*)fAddCombo->GetListBox())->AddEntry("Fill Area",kADD_FILL);
1372  lb = fAddCombo->GetListBox();
1373  lb->Resize(lb->GetWidth(),76);
1374  }
1375  fMake=on;
1376  }
1377  if (fAddCombo->GetSelected()!=kADD_NONE) {
1379  } else {
1382  else if (fAddSimple->GetState()==kButtonDisabled)
1384  }
1385  } else if (fDim0->GetState()==kButtonDown) {
1386  if (GetHistTypeLabel().Contains("LEGO")) {
1387  ShowFrame(f10);
1388  ShowFrame(f11);
1389  HideFrame(f12);
1390  } else {
1391  HideFrame(f10);
1392  HideFrame(f11);
1393  HideFrame(f12);
1394  }
1395  }
1396  if (fMake) {
1397  TString str = "";
1398  if (fDim->GetState()==kButtonDown)
1400  else if (fDim0->GetState()==kButtonDown)
1403  str += "HIST";
1404  if (fSameOpt)
1405  str += "SAME";
1406  SetDrawOption(str);
1407  if (str=="" || str=="HIST") fAddSimple->SetState(kButtonDisabled);
1408  Update();
1409  }
1410  ((TGMainFrame*)GetMainFrame())->Layout();
1411  // fGedEditor->GetTab()->Layout();
1412  fMakeB=kTRUE;
1413 }
1414 
1415 ////////////////////////////////////////////////////////////////////////////////
1416 /// Slot connected to the Bar Width of the Bar Charts.
1417 
1419 {
1420  if (fAvoidSignal) return;
1422  Update();
1423 }
1424 
1425 ////////////////////////////////////////////////////////////////////////////////
1426 /// Slot connected to the Bar Offset of the Bar Charts.
1427 
1429 {
1430  if (fAvoidSignal) return;
1432  fHist->SetBarOffset(f);
1433  Update();
1434 }
1435 
1436 ////////////////////////////////////////////////////////////////////////////////
1437 /// Slot connected to the bar percentage settings.
1438 
1440 {
1441  if (fAvoidSignal) return;
1442  TString str = GetDrawOption();
1443  str.ToUpper();
1444  if (str.Contains("SAME"))
1445  fSameOpt = kTRUE;
1446  else
1447  fSameOpt = kFALSE;
1448  Int_t o = 0;
1449  if (str.Contains("HBAR")) o=1;
1450  if (str.Contains("BAR4"))
1451  str.Remove(strstr(str.Data(),"BAR4")-str.Data()-1,4+o);
1452  else if (str.Contains("BAR3"))
1453  str.Remove(strstr(str.Data(),"BAR3")-str.Data()-o,4+o);
1454  else if (str.Contains("BAR2"))
1455  str.Remove(strstr(str.Data(),"BAR2")-str.Data()-o,4+o);
1456  else if (str.Contains("BAR1"))
1457  str.Remove(strstr(str.Data(),"BAR1")-str.Data()-o,4+o);
1458  else if (str.Contains("BAR0"))
1459  str.Remove(strstr(str.Data(),"BAR0")-str.Data()-o,4+o);
1460  else if (str.Contains("BAR"))
1461  str.Remove(strstr(str.Data(),"BAR")-str.Data()-o,3+o);
1462 
1463  if (fMakeHBar->GetState()==kButtonDown) str+="H";
1464  switch (fPercentCombo->GetSelected()){
1465  case (kPER_0) :{ str += "BAR"; break;}
1466  case (kPER_10):{ str += "BAR1"; break;}
1467  case (kPER_20):{ str += "BAR2"; break;}
1468  case (kPER_30):{ str += "BAR3"; break;}
1469  case (kPER_40):{ str += "BAR4"; break;}
1470  }
1471  if (fSameOpt) str += "SAME";
1472  if (fMake) SetDrawOption(str);
1473  Update();
1474 }
1475 
1476 ////////////////////////////////////////////////////////////////////////////////
1477 /// Slot connected to the Horizontal Bar check button.
1478 
1480 {
1481  if (fAvoidSignal) return;
1482  TString str = GetDrawOption();
1483  str.ToUpper();
1484  if (str.Contains("SAME"))
1485  fSameOpt = kTRUE;
1486  else
1487  fSameOpt = kFALSE;
1488  if (on) {
1489  if (!str.Contains("HBAR"))
1490  str.Insert(strstr(str.Data(),"BAR")-str.Data(),"H");
1491  }
1492  else if (fMakeHBar->GetState()==kButtonUp) {
1493  if (str.Contains("HBAR"))
1494  str.Remove(strstr(str.Data(),"BAR")-str.Data()-1,1);
1495  }
1496  if (fSameOpt) str += "SAME";
1497  if (fMake) SetDrawOption(str);
1498  Update();
1499 }
1500 
1501 ////////////////////////////////////////////////////////////////////////////////
1502 /// Slot connected to the x-Slider for redrawing of the histogram
1503 /// according to the new Slider range.
1504 
1506 {
1507  if (fAvoidSignal) return;
1508  if (fGedEditor->GetPad()->GetCanvas())
1510  fGedEditor->GetPad()->cd();
1512  static Int_t px1,py1,px2,py2;
1513  static Float_t ymin,ymax,xleft,xright;
1514  xleft = fHist->GetXaxis()->GetBinLowEdge((Int_t)((fSlider->GetMinPosition())+0.5));
1515  xright = fHist->GetXaxis()->GetBinUpEdge((Int_t)((fSlider->GetMaxPosition())+0.5));
1516  ymin = fGedEditor->GetPad()->GetUymin();
1517  ymax = fGedEditor->GetPad()->GetUymax();
1518  px1 = fGedEditor->GetPad()->XtoAbsPixel(xleft);
1519  py1 = fGedEditor->GetPad()->YtoAbsPixel(ymin);
1520  px2 = fGedEditor->GetPad()->XtoAbsPixel(xright);
1521  py2 = fGedEditor->GetPad()->YtoAbsPixel(ymax);
1522  if (fGedEditor->GetPad()->GetCanvas())
1528  fGedEditor->GetPad()->cd();
1530  gVirtualX->DrawBox(px1, py1, px2, py2, TVirtualX::kHollow);
1531  fPx1old = px1;
1532  fPy1old = py1;
1533  fPx2old = px2 ;
1534  fPy2old = py2;
1535  gVirtualX->Update(0);
1536  fSldMin->SetNumber(xleft);
1537  fSldMax->SetNumber(xright);
1538  } else if (fDelaydraw->GetState() == kButtonDown &&
1539  fDim0->GetState() == kButtonDown &&
1541  static Float_t p1[3], p2[3], p3[3], p4[3], p5[3], p6[3], p7[3], p8[3];
1542  TView *fView = fGedEditor->GetPad()->GetView();
1543  if (!fView) return;
1544  Double_t *rmin = fView->GetRmin();
1545  if (!rmin) return;
1546  Double_t *rmax = fView->GetRmax();
1547  if (!rmax) return;
1548  p1[0] = p4[0] = p5[0] = p8[0] =
1550  p2[0] = p3[0] = p6[0] = p7[0] =
1552  p1[1] = p2[1] = p3[1] = p4[1] = rmin[1];
1553  p5[1] = p6[1] = p7[1] = p8[1] = rmax[1];
1554  p1[2] = p2[2] = p5[2] = p6[2] = rmin[2];
1555  p3[2] = p4[2] = p7[2] = p8[2] = rmax[2];
1560  PaintBox3D(p2, p3, p7, p6);
1561  PaintBox3D(p1, p4, p8, p5);
1562  for (Int_t i = 0; i<3; i++){
1563  fP1old[i] = p1[i];
1564  fP2old[i] = p2[i];
1565  fP3old[i] = p3[i];
1566  fP4old[i] = p4[i];
1567  fP5old[i] = p5[i];
1568  fP6old[i] = p6[i];
1569  fP7old[i] = p7[i];
1570  fP8old[i] = p8[i];
1571  }
1572  fSldMin->SetNumber(p1[0]);
1573  fSldMax->SetNumber(p2[0]);
1574  } else if (fDelaydraw->GetState() == kButtonDown &&
1575  fDim0->GetState() == kButtonDown) {
1578  } else {
1580  (Int_t)((fSlider->GetMaxPosition())+0.5));
1584  Update();
1585  }
1587  if (player && player->GetHistogram() == fHist) {
1588  Int_t last = fHist->GetXaxis()->GetLast();
1589  Int_t first = fHist->GetXaxis()->GetFirst();
1591  // How to redraw the NumberEntry without calling Update??
1592  // Update kills the "virtual" painted box in Delayed draw mode
1594  // fGedEditor->GetTab()->Layout();
1595  }
1598 }
1599 
1600 ////////////////////////////////////////////////////////////////////////////////
1601 /// Slot connected to the x-axis Range slider for initialising the
1602 /// values of the slider movement.
1603 
1605 {
1606  if (fAvoidSignal) return;
1607  if (fGedEditor->GetPad()->GetCanvas())
1609  fGedEditor->GetPad()->cd();
1610  static Float_t ymin,ymax,xleft,xright;
1611  Int_t sldmin = (Int_t)((fSlider->GetMinPosition())+0.5);
1612  Int_t sldmax = (Int_t)((fSlider->GetMaxPosition())+0.5);
1613  if (fDelaydraw->GetState() == kButtonDown &&
1614  fDim->GetState()==kButtonDown) {
1615  if (fGedEditor->GetPad()->GetCanvas())
1619  xleft = fHist->GetXaxis()->GetBinLowEdge(sldmin);
1620  xright = fHist->GetXaxis()->GetBinUpEdge(sldmax);
1621  ymin = fGedEditor->GetPad()->GetUymin();
1622  ymax = fGedEditor->GetPad()->GetUymax();
1623  fPx1old = fGedEditor->GetPad()->XtoAbsPixel(xleft);
1625  fPx2old = fGedEditor->GetPad()->XtoAbsPixel(xright);
1628  } else if (fDelaydraw->GetState() == kButtonDown &&
1629  fDim0->GetState() == kButtonDown &&
1631  TView *fView = fGedEditor->GetPad()->GetView();
1632  if (!fView) return;
1633  Double_t *rmin = fView->GetRmin();
1634  if (!rmin) return;
1635  Double_t *rmax = fView->GetRmax();
1636  if (!rmax) return;
1637  fP1old[0] = fP4old[0] = fP5old[0] = fP8old[0] =
1638  fHist->GetXaxis()->GetBinLowEdge(sldmin);
1639  fP2old[0] = fP3old[0] = fP6old[0] = fP7old[0] =
1640  fHist->GetXaxis()->GetBinUpEdge(sldmax);
1641  fP1old[1] = fP2old[1] = fP3old[1] = fP4old[1] = rmin[1];
1642  fP5old[1] = fP6old[1] = fP7old[1] = fP8old[1] = rmax[1];
1643  fP1old[2] = fP2old[2] = fP5old[2] = fP6old[2] = rmin[2];
1644  fP3old[2] = fP4old[2] = fP7old[2] = fP8old[2] = rmax[2];
1645  if (fGedEditor->GetPad()->GetCanvas())
1651  }
1652  Update();
1653 }
1654 
1655 ////////////////////////////////////////////////////////////////////////////////
1656 /// Slot connected to the x-axis Range slider for finalizing the
1657 /// values of the slider movement.
1658 
1660 {
1661  if (fAvoidSignal) return;
1662  if (fDelaydraw->GetState()==kButtonDown) {
1664  (Int_t)((fSlider->GetMaxPosition())+0.5));
1667  Update();
1668  }
1670  if (player) if (player->GetHistogram() == fHist) {
1671  Int_t last = fHist->GetXaxis()->GetLast();
1672  Int_t first = fHist->GetXaxis()->GetFirst();
1674  Update();
1675  }
1676 }
1677 
1678 ////////////////////////////////////////////////////////////////////////////////
1679 /// Slot connected to the number entry fields containing the Max/Min
1680 /// value of the x-axis.
1681 
1683 {
1684  if (fAvoidSignal) return;
1685  Int_t nx = fHist->GetXaxis()->GetNbins();
1687  Double_t lowLimit = fHist->GetXaxis()->GetBinLowEdge(1);
1688  Double_t upLimit = fHist->GetXaxis()->GetBinUpEdge(nx);
1689  if ((fSldMin->GetNumber()+width/2) < (lowLimit))
1690  fSldMin->SetNumber(lowLimit);
1691  if ((fSldMax->GetNumber()-width/2) > (upLimit))
1692  fSldMax->SetNumber(upLimit);
1693 // Set the histogram range and the axis range slider
1695  fSldMax->GetNumber()-width/2);
1696  Int_t nxbinmin = fHist->GetXaxis()->GetFirst();
1697  Int_t nxbinmax = fHist->GetXaxis()->GetLast();
1698  fSlider->SetPosition((Double_t)(nxbinmin),(Double_t)(nxbinmax));
1699  Update();
1700 }
1701 
1702 ////////////////////////////////////////////////////////////////////////////////
1703 /// Slot connected to the rebin slider in case of a not ntuple histogram
1704 /// Updates some other widgets which are related to the rebin slider.
1705 
1707 {
1708  // draw the rebinned histogram in case of delay draw mode
1709  if (fAvoidSignal) return;
1710  if (fDelaydraw->GetState()==kButtonDown){
1711  if (!fBinHist) {
1712  fBinHist = (TH1*)fHist->Clone("BinHist");
1713  // we will manage this histogram
1714  fBinHist->SetDirectory(0);
1715  }
1716  Int_t nx = fBinHist->GetXaxis()->GetNbins();
1717  Int_t numx = fBinSlider->GetPosition();
1718  Int_t* divx = Dividers(nx);
1719  if (divx[0]==2) fBinSlider->SetPosition(2);
1720  if (divx[0]==2) {
1721  delete [] divx;
1722  return;
1723  }
1724  // delete the histogram which is on the screen
1725  fGedEditor->GetPad()->cd();
1726  fHist->Reset();
1728  fBinHist->GetXaxis()->GetXmax());
1729  fHist->Add(fBinHist);
1731  fHist->Rebin(divx[numx]);
1732  // fModel=fHist;
1733  if (divx[0]!=2) {
1734  TAxis* xaxis = fHist->GetXaxis();
1735  Double_t xBinWidth = xaxis->GetBinWidth(1);
1736  xaxis->SetRangeUser(fSldMin->GetNumber()+xBinWidth/2,
1737  fSldMax->GetNumber()-xBinWidth/2);
1738  fSlider->SetRange(1,(Int_t)nx/divx[numx]);
1739  fSlider->SetPosition(xaxis->FindBin(fSldMin->GetNumber()+xBinWidth/2),
1740  xaxis->FindBin(fSldMax->GetNumber()-xBinWidth/2));
1741  // the x-axis range could be changed a little bit by Rebin algorithm
1742  fSldMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
1743  fSldMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
1744  }
1749  Update();
1750  delete [] divx;
1751  }
1752 // fGedEditor->GetPad()->GetCanvas()->Selected(fGedEditor->GetPad(), fHist, 0);
1753  // fModel = fHist;
1754  Refresh(fHist);
1755 }
1756 
1757 ////////////////////////////////////////////////////////////////////////////////
1758 /// Slot connected to the rebin slider in case of a not ntuple histogram
1759 /// (does the Rebinning of the histogram).
1760 
1762 {
1763  // create a clone in the background, when the slider is moved for
1764  // the first time
1765  if (fAvoidSignal) return;
1766  if (!fBinHist /*&& fDelaydraw->GetState()!=kButtonDown*/) {
1767  Int_t* divx = Dividers(fHist->GetXaxis()->GetNbins());
1768  if (divx[0]==2) {
1769  delete [] divx;
1770  return;
1771  }
1772  fBinHist = (TH1*)fHist->Clone("BinHist");
1773  // the TH1Editor class manage this histogram
1774  fBinHist->SetDirectory(0);
1775  delete [] divx;
1776  }
1777  // if the slider already has been moved and the clone is saved
1778  Int_t nx = fBinHist->GetXaxis()->GetNbins();
1779  Int_t* divx = Dividers(nx);
1780  if (divx[0]==2) {
1781  fBinSlider->SetPosition(2);
1782  numx=1;
1783  delete [] divx;
1784  return;
1785  }
1786  Int_t maxx = (Int_t)nx/divx[numx];
1787  if (maxx==1) maxx=2;
1788  if (fDelaydraw->GetState() == kButtonUp) {
1789  fGedEditor->GetPad()->cd();
1790  fHist->Reset();
1792  fBinHist->GetXaxis()->GetXmax());
1793  fHist->Add(fBinHist);
1795  fHist->Rebin(divx[numx]);
1796  //fModel=fHist;
1797  TAxis* xaxis = fHist->GetXaxis();
1798  Double_t xBinWidth = xaxis->GetBinWidth(1);
1799  xaxis->SetRangeUser(fSldMin->GetNumber()+xBinWidth/2,
1800  fSldMax->GetNumber()-xBinWidth/2);
1801  fSlider->SetRange(1,maxx);
1802  fSlider->SetPosition(xaxis->FindBin(fSldMin->GetNumber()+xBinWidth/2),
1803  xaxis->FindBin(fSldMax->GetNumber()-xBinWidth/2));
1804  // the axis range could be changed a little bit by the Rebin algorithm
1805  fSldMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
1806  fSldMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
1808  Update();
1809  }
1814  if (fBinNumberEntry->GetNumber()!=maxx)
1815  fBinNumberEntry->SetNumber(maxx);
1816  delete [] divx;
1817 }
1818 
1819 ////////////////////////////////////////////////////////////////////////////////
1820 /// Slot connected to the rebin slider in case of a not ntuple histogram.
1821 
1823 {
1824  if (fAvoidSignal) return;
1825  Int_t* d = Dividers(fHist->GetXaxis()->GetNbins());
1826  if (d[0]==2 && !fBinHist) {
1827  new TGMsgBox(fClient->GetDefaultRoot(), this->GetMainFrame(),
1828  "TH1 Editor", "It is not possible to rebin the histogram",
1830  gVirtualX->GrabPointer(fBinSlider->GetId(),0,0,0);
1831  }
1832  delete [] d;
1833  // calling the MessageBox again does NOT work!*/
1834 }
1835 
1836 ////////////////////////////////////////////////////////////////////////////////
1837 /// Slot connected to the BinNumber Slider in case of a ntuple histogram
1838 /// (does the Rebinning of the histogram).
1839 
1841 {
1842  if (fAvoidSignal) return;
1843  Double_t oldOffset = fOffsetNumberEntry->GetNumber();
1844  Int_t number = fBinSlider1->GetPosition();
1845  if (number==5) return;
1846  Int_t fact = 0;
1847  Int_t binNumber = 0;
1848  TAxis* xaxis = fHist->GetXaxis();
1849  // "compute" the scaling factor:
1850  if (number > 5) fact = number - 4;
1851  else fact = number - 6;
1853  if (!player) return;
1854  Int_t first = xaxis->GetFirst();
1855  Int_t last = xaxis->GetLast();
1856  Int_t nx = xaxis->GetNbins();
1857  Double_t min = xaxis->GetBinLowEdge(1); // overall min in user coords
1858  Double_t max = xaxis->GetBinUpEdge(nx); // overall max in user coords
1859  Double_t rmin = xaxis->GetBinLowEdge(first); // recent min in user coords
1860  Double_t rmax = xaxis->GetBinUpEdge(last); // recent max in user coords
1861 
1862  ((TH1*)player->GetHistogram())->SetCanExtend(TH1::kNoAxis);
1863  ((TH1*)player->GetHistogram())->Reset();
1864 
1865  // get new Number of bins
1866  if (fact > 0) binNumber = fact*nx;
1867  if (fact < 0) binNumber = (Int_t) ((-1)*nx/fact+0.5);
1868  if (binNumber < 1) binNumber = 1;
1869  if (binNumber > 10000) binNumber= 10000;
1870  Double_t newOffset = 1.*fBinOffsetSld->GetPosition()/100*((max-min)/binNumber);
1871  // create new histogram - the main job is done by sel->TakeAction()
1872  ((TH1*)player->GetHistogram())->SetBins(binNumber,
1873  min-oldOffset+newOffset,
1874  max-oldOffset+newOffset);
1875  TSelectorDraw *sel = (TSelectorDraw*)player->GetSelector();
1876  if (!sel) return;
1877  sel->TakeAction();
1878 
1879  // restore and set all the attributes which were changed by TakeAction()
1880  fHist = (TH1*)((TTreePlayer*)TVirtualTreePlayer::GetCurrentPlayer())->GetHistogram();
1881  fSlider->SetRange(1,binNumber);
1882  Double_t binWidth = fHist->GetXaxis()->GetBinWidth(1);
1883  fSlider->SetPosition(xaxis->FindBin(rmin), xaxis->FindBin(rmax));
1884  Double_t offset = 1.*fBinOffsetSld->GetPosition()/100*binWidth;
1885  xaxis->SetRange(xaxis->FindBin(rmin+binWidth/2),
1886  xaxis->FindBin(rmax-binWidth/2)); // SetRange in binNumbers!
1887  fSldMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
1888  fSldMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
1889  fBinNumberEntry1->SetNumber(xaxis->GetLast() - xaxis->GetFirst() + 1);
1891  fOffsetNumberEntry->SetNumber(offset);
1893  xaxis->GetBinWidth(1));
1895  Update();
1896 }
1897 
1898 ////////////////////////////////////////////////////////////////////////////////
1899 /// Slot connected to the rebin slider in case of an ntuple histogram.
1900 /// It updates the BinNumberEntryField during the BinSlider movement.
1901 
1903 {
1904  if (fAvoidSignal) return;
1905  TAxis* xaxis = fHist->GetXaxis();
1906  Int_t first = xaxis->GetFirst();
1907  Int_t last = xaxis->GetLast();
1908  Int_t number = fBinSlider1->GetPosition();
1909  Int_t n = last -first+1;
1910  Int_t fact = 0;
1911  Int_t binNumber = 0;
1912  if (number >= 5) fact = number - 4;
1913  else fact = number - 6;
1914  if (fact > 0) binNumber = fact*n;
1915  if (fact < 0) binNumber = (Int_t) ((-1)*n/fact+0.5);
1916  if (binNumber < 1) binNumber = 1;
1917  if (binNumber > 10000) binNumber= 10000;
1918  fBinNumberEntry1->SetIntNumber(binNumber);
1919 // Update();
1920 }
1921 
1922 ////////////////////////////////////////////////////////////////////////////////
1923 /// Slot connected to the Bin number entry of the Rebinning tab.
1924 
1926 {
1927  if (fAvoidSignal) return;
1928  Int_t num = (Int_t)(fBinNumberEntry->GetNumber());
1929  Int_t nx = 0;
1930  if (fBinHist) nx = fBinHist->GetXaxis()->GetNbins();
1931  else nx = fHist->GetXaxis()->GetNbins();
1932  if (nx < 2) return;
1933  Int_t *div = Dividers(nx);
1934  Int_t diff = TMath::Abs(num - div[1]);
1935  Int_t c = 1;
1936  for (Int_t i = 2; i <= div[0]; i++) {
1937  if ((TMath::Abs(num - div[i])) < diff) {
1938  c = i;
1939  diff = TMath::Abs(num - div[i]);
1940  }
1941  }
1942  fBinNumberEntry->SetNumber(div[c]);
1943  fBinSlider->SetPosition(div[0] - c +1);
1944  if (fDelaydraw->GetState()==kButtonUp) DoBinMoved(div[0] - c +1);
1945  else DoBinReleased();
1946 // fGedEditor->GetPad()->GetCanvas()->Selected(fGedEditor->GetPad(), fHist, 0);
1947  // fModel = fHist;
1948  Refresh(fHist);
1949  delete [] div;
1950 }
1951 
1952 ////////////////////////////////////////////////////////////////////////////////
1953 /// Slot connected to the Bin number entry of the Rebinning tab.
1954 
1956 {
1957  if (fAvoidSignal) return;
1958  Double_t oldOffset = fOffsetNumberEntry->GetNumber();
1960  TAxis* xaxis = fHist->GetXaxis();
1962  if (!player) return;
1963  Int_t first = xaxis->GetFirst();
1964  Int_t last = xaxis->GetLast();
1965  Int_t nx = xaxis->GetNbins();
1966  Double_t min = xaxis->GetBinLowEdge(1); // overall min in user coords
1967  Double_t max = xaxis->GetBinUpEdge(nx); // overall max in user coords
1968  Double_t rmin = xaxis->GetBinLowEdge(first); // recent min in user coords
1969  Double_t rmax = xaxis->GetBinUpEdge(last); // recent max in user coords
1970 
1971  ((TH1*)player->GetHistogram())->SetCanExtend(TH1::kNoAxis);
1972  ((TH1*)player->GetHistogram())->Reset();
1973 
1974 // Calculate the new number of bins in the complete range
1975  Int_t binNumber = (Int_t) ((max-min)/(rmax - rmin)*num + 0.5);
1976  if (binNumber < 1) binNumber = 1;
1977  if (binNumber > 10000) binNumber = 10000;
1978  Double_t offset = 1.*(fBinOffsetSld->GetPosition())/100*(max-min)/binNumber;
1979 // create new histogram - the main job is done by sel->TakeAction()
1980  ((TH1*)player->GetHistogram())->SetBins(binNumber,
1981  min-oldOffset+offset,
1982  max-oldOffset+offset);
1983  TSelectorDraw *sel = (TSelectorDraw*)player->GetSelector();
1984  if (!sel) return;
1985  sel->TakeAction();
1986 
1987 // Restore and set all the attributes which were changed by TakeAction()
1988  fHist = (TH1*)((TTreePlayer*)TVirtualTreePlayer::GetCurrentPlayer())->GetHistogram();
1989  fSlider->SetRange(1,binNumber);
1990  Double_t binWidth = xaxis->GetBinWidth(1);
1991  fSlider->SetPosition(xaxis->FindBin(rmin), xaxis->FindBin(rmax));
1992  offset = 1.*fBinOffsetSld->GetPosition()/100*binWidth;
1993  xaxis->SetRange(xaxis->FindBin(rmin+binWidth/2),
1994  xaxis->FindBin(rmax-binWidth/2)); // SetRange in binNumbers!
1995  fSldMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
1996  fSldMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
1997  fOffsetNumberEntry->SetNumber(offset);
1999  Update();
2000 }
2001 
2002 ////////////////////////////////////////////////////////////////////////////////
2003 /// Slot connected to the OffSetSlider that saves the OldBinOffset
2004 /// (nessesary for delay draw mode).
2005 
2007 {
2008  if (fAvoidSignal) return;
2010 }
2011 
2012 ////////////////////////////////////////////////////////////////////////////////
2013 /// Slot connected to the OffSetSlider.
2014 /// It changes the origin of the histogram inbetween a binwidth and
2015 /// rebin the histogram with the new Offset given by the Slider.
2016 
2018 {
2019  // !!problem: histogram with variable binwidth??
2020  // computes the new histogram in "delay draw" mode
2021 
2022  if (fAvoidSignal) return;
2023  if (fDelaydraw->GetState()==kButtonDown) {
2024  Int_t num = (Int_t) fBinOffsetSld->GetPosition();
2025  TAxis* xaxis = fHist->GetXaxis();
2026  Double_t binWidth = xaxis->GetBinWidth(1);
2027  Double_t offset = 1.*num/100*binWidth;
2028  Double_t oldOffset = fOldOffset;
2029  Int_t nx = xaxis->GetNbins();
2031  if (!player) return;
2032  Int_t first = xaxis->GetFirst();
2033  Int_t last = xaxis->GetLast();
2034  Double_t min = xaxis->GetBinLowEdge(1); // overall min in user coords
2035  Double_t max = xaxis->GetBinUpEdge(nx); // overall max in user coords
2036  Double_t rmin = xaxis->GetBinLowEdge(first); // recent min in user coords
2037  Double_t rmax = xaxis->GetBinUpEdge(last); // recent max in user coords
2038 
2039  ((TH1*)player->GetHistogram())->SetCanExtend(TH1::kNoAxis);
2040  ((TH1*)player->GetHistogram())->Reset();
2041 
2042  ((TH1*)player->GetHistogram())->SetBins(nx,
2043  min+offset-oldOffset,
2044  max+offset-oldOffset);
2045  TSelectorDraw *sel = (TSelectorDraw*)player->GetSelector();
2046  if (!sel) return;
2047  sel->TakeAction();
2048 
2049  // Restore all the attributes which were changed by TakeAction()
2050  fHist = (TH1*)((TTreePlayer*)TVirtualTreePlayer::GetCurrentPlayer())->GetHistogram();
2051  xaxis->SetRange(xaxis->FindBin(rmin+offset-oldOffset+binWidth/2),
2052  xaxis->FindBin(rmax+offset-oldOffset-binWidth/2)); // in binNumbers!
2053  fSldMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
2054  fSldMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
2055  fOffsetNumberEntry->SetNumber(offset);
2056  Update();
2057  }
2058 }
2059 
2060 ////////////////////////////////////////////////////////////////////////////////
2061 /// Slot connected to the OffSetSlider.
2062 /// It changes the origin of the histogram inbetween a binwidth and
2063 /// rebin the histogram with the new offset given by the Slider.
2064 
2066 {
2067  // !!histogram with variable binwidth??
2068  // !!only works for histograms with fixed binwidth
2069 
2070  if (fAvoidSignal) return;
2071  TAxis* xaxis = fHist->GetXaxis();
2072  Double_t binWidth = xaxis->GetBinWidth(1);
2073  Double_t offset = 1.*num/100*binWidth;
2074  if (fDelaydraw->GetState()==kButtonUp) {
2075  Double_t oldOffset = fOffsetNumberEntry->GetNumber();
2076  Int_t nx = xaxis->GetNbins();
2078  if (!player) return;
2079  Int_t first = xaxis->GetFirst();
2080  Int_t last = xaxis->GetLast();
2081  Double_t min = xaxis->GetBinLowEdge(1); // overall min in user coords
2082  Double_t max = xaxis->GetBinUpEdge(nx); // overall max in user coords
2083  Double_t rmin = xaxis->GetBinLowEdge(first); // recent min in user coords
2084  Double_t rmax = xaxis->GetBinUpEdge(last); // recent max in user coords
2085 
2086  ((TH1*)player->GetHistogram())->SetCanExtend(TH1::kNoAxis);
2087  ((TH1*)player->GetHistogram())->Reset();
2088 
2089  ((TH1*)player->GetHistogram())->SetBins(nx,
2090  min+offset-oldOffset,
2091  max+offset-oldOffset);
2092  TSelectorDraw *sel = (TSelectorDraw*)player->GetSelector();
2093  if (!sel) return;
2094  sel->TakeAction();
2095 
2096  // Restore all the attributes which were changed by TakeAction()
2097  fHist = (TH1*)((TTreePlayer*)TVirtualTreePlayer::GetCurrentPlayer())->GetHistogram();
2098  xaxis->SetRange(xaxis->FindBin(rmin+offset-oldOffset+binWidth/2),
2099  xaxis->FindBin(rmax+offset-oldOffset-binWidth/2)); // in binNumbers!
2100  fSldMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
2101  fSldMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
2103  }
2104  fOffsetNumberEntry->SetNumber(offset);
2106  Update();
2107 }
2108 
2109 ////////////////////////////////////////////////////////////////////////////////
2110 /// Slot connected to the OffSetNumberEntry which is related to the
2111 /// OffSetSlider changes the origin of the histogram inbetween a binwidth.
2112 
2114 {
2115  if (fAvoidSignal) return;
2116  TAxis* xaxis = fHist->GetXaxis();
2117  Double_t binWidth = xaxis->GetBinWidth(1);
2119  Double_t oldOffset = 1.*fBinOffsetSld->GetPosition()/100*binWidth;
2120  Int_t nx = xaxis->GetNbins();
2122  if (!player) return;
2123  Int_t first = xaxis->GetFirst();
2124  Int_t last = xaxis->GetLast();
2125  Double_t min = xaxis->GetBinLowEdge(1); // overall min in user coords
2126  Double_t max = xaxis->GetBinUpEdge(nx); // overall max in user coords
2127  Double_t rmin = xaxis->GetBinLowEdge(first); // recent min in user coords
2128  Double_t rmax = xaxis->GetBinUpEdge(last); // recent max in user coords
2129 
2130  ((TH1*)player->GetHistogram())->SetCanExtend(TH1::kNoAxis);
2131  ((TH1*)player->GetHistogram())->Reset();
2132 
2133  ((TH1*)player->GetHistogram())->SetBins(nx,
2134  min+offset-oldOffset,
2135  max+offset-oldOffset);
2136  TSelectorDraw *sel = (TSelectorDraw*)player->GetSelector();
2137  if (!sel) return;
2138  sel->TakeAction();
2139 
2140  // Restore all the attributes which were changed by TakeAction()
2141  fHist = (TH1*)((TTreePlayer*)TVirtualTreePlayer::GetCurrentPlayer())->GetHistogram();
2142  xaxis->SetRange(xaxis->FindBin(rmin+offset-oldOffset+binWidth/2),
2143  xaxis->FindBin(rmax+offset-oldOffset-binWidth/2)); // in binNumbers!
2144  fSldMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
2145  fSldMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
2146  fBinOffsetSld->SetPosition((Int_t)(offset/binWidth*100));
2147  Update();
2148 }
2149 
2150 ////////////////////////////////////////////////////////////////////////////////
2151 /// Slot connected to the Apply button of the Binning tab.
2152 
2154 {
2155  Int_t ret = 0;
2156  new TGMsgBox(fClient->GetDefaultRoot(), this->GetMainFrame(),
2157  "TH1 Editor", "Replace origin histogram with rebinned one?",
2159  if (ret==1) {
2160  if (fBinHist) {
2161  delete fBinHist;
2162  fBinHist = 0;
2163  }
2164  Int_t nx = fHist->GetXaxis()->GetNbins();
2165  Int_t *div = Dividers(nx);
2166  Int_t up = 0;
2167  if (div[0]-1 <= 1) up = 2;
2168  else up = div[0]-1;
2169  fBinSlider->SetRange(1,up);
2170  if (fBinSlider->GetMaxPosition()==2 && div[0]==2 )
2171  fBinSlider->SetPosition(2);
2172  else
2173  fBinSlider->SetPosition(1);
2176  Update();
2177  delete [] div;
2178  } else if (ret==2) DoCancel();
2179 }
2180 
2181 ////////////////////////////////////////////////////////////////////////////////
2182 /// Slot connected to the Cancel button of the Binning tab.
2183 
2185 {
2186  if (fBinHist) {
2187  fGedEditor->GetPad()->cd();
2188  fHist->Reset();
2190  fBinHist->GetXaxis()->GetXmin(),
2191  fBinHist->GetXaxis()->GetXmax());
2192  fHist->Add(fBinHist);
2194  fBinHist->GetXaxis()->GetLast());
2195  delete fBinHist;
2196  fBinHist = 0;
2199  Int_t* divx = Dividers(fHist->GetXaxis()->GetNbins());
2200  if (divx[0]!=2) fBinSlider->SetPosition(1);
2201  // Consigning the new Histogram to all other Editors
2202 // fGedEditor->GetPad()->GetCanvas()->Selected(fGedEditor->GetPad(), fHist, 0);
2203  Update();
2204  //fModel = fHist;
2205  Refresh(fHist);
2206  delete [] divx;
2207  }
2208 }
2209 
2210 ////////////////////////////////////////////////////////////////////////////////
2211 /// Returns the selected histogram type (HIST, LEGO1-2, SURF1-5).
2212 
2214 {
2215  TString s="";
2216  switch (fTypeCombo->GetSelected()){
2217  case (-1) : {s = "LEGO"; break;}
2218  case (kTYPE_LEGO ): {s = "LEGO"; break;}
2219  case (kTYPE_LEGO1): {s = "LEGO1"; break;}
2220  case (kTYPE_LEGO2): {s = "LEGO2"; break;}
2221  case (kTYPE_SURF ): {s = "SURF"; break;}
2222  case (kTYPE_SURF1): {s = "SURF1"; break;}
2223  case (kTYPE_SURF2): {s = "SURF2"; break;}
2224  case (kTYPE_SURF3): {s = "SURF3"; break;}
2225  case (kTYPE_SURF4): {s = "SURF4"; break;}
2226  case (kTYPE_SURF5): {s = "SURF5"; break;}
2227  default: break;
2228  }
2229 
2230  return s;
2231 }
2232 
2233 ////////////////////////////////////////////////////////////////////////////////
2234 /// Return the selected coordinate system of the histogram (POL,CYL,SPH,PSR).
2235 
2237 {
2238  TString s="";
2239  if (fDim->GetState()!=kButtonDown) {
2240  switch (fCoordsCombo->GetSelected()){
2241  case (-1) : {s = "POL"; break;}
2242  case (kCOORDS_CAR): {s = ""; break;}
2243  case (kCOORDS_POL): {s = "POL"; break;}
2244  case (kCOORDS_CYL): {s = "CYL"; break;}
2245  case (kCOORDS_SPH): {s = "SPH"; break;}
2246  case (kCOORDS_PSR): {s = "PSR"; break;}
2247  default: break;
2248  }
2249  }
2250 
2251  return s;
2252 }
2253 
2254 ////////////////////////////////////////////////////////////////////////////////
2255 /// Return the selected error type (E,E1-5).
2256 
2258 {
2259  TString s="";
2260  switch (fErrorCombo->GetSelected()){
2261  case (-1) : {s = ""; break;}
2262  case (kERRORS_NO) : {s = ""; break;}
2263  case (kERRORS_SIMPLE) : {s = "E"; break;}
2264  case (kERRORS_EDGES) : {s = "E1"; break;}
2265  case (kERRORS_REC) : {s = "E2"; break;}
2266  case (kERRORS_FILL) : {s = "E3"; break;}
2267  case (kERRORS_CONTOUR): {s = "E4"; break;}
2268  default: break;
2269  }
2270 
2271  return s;
2272 }
2273 
2274 ////////////////////////////////////////////////////////////////////////////////
2275 /// Return the selected shape of the histogram (C, L, LF2).
2276 
2278 {
2279  TString s="";
2280  switch (fAddCombo->GetSelected()){
2281  case (-1) : {s = "" ; break;}
2282  case (kADD_NONE) : {s = "" ; break;}
2283  case (kADD_SMOOTH): {s = "C"; break;}
2284  case (kADD_SIMPLE): {s = "L"; break;}
2285  case (kADD_FILL) : {s = "LF2"; break;}
2286  default : break;
2287  }
2288  if (fAddMarker->GetState()==kButtonDown) s += "P";
2289  if (fAddB->GetState()==kButtonDown) s += "B";
2290  if (fAddBar->GetState()==kButtonDown){
2291  if (fMakeHBar->GetState()==kButtonDown) s+="H";
2292  switch (fPercentCombo->GetSelected()){
2293  case (kPER_0) : { s += "BAR" ; break;}
2294  case (kPER_10): { s += "BAR1"; break;}
2295  case (kPER_20): { s += "BAR2"; break;}
2296  case (kPER_30): { s += "BAR3"; break;}
2297  case (kPER_40): { s += "BAR4"; break;}
2298  }
2299  }
2300 
2301  return s;
2302 }
2303 
2304 ////////////////////////////////////////////////////////////////////////////////
2305 /// Create histogram type combo box.
2306 
2308 {
2309  TGComboBox *c = new TGComboBox(parent, id);
2310 
2311  c->AddEntry("Lego" , kTYPE_LEGO);
2312  c->AddEntry("Lego1", kTYPE_LEGO1);
2313  c->AddEntry("Lego2", kTYPE_LEGO2);
2314  c->AddEntry("Surf" , kTYPE_SURF);
2315  c->AddEntry("Surf1", kTYPE_SURF1);
2316  c->AddEntry("Surf2", kTYPE_SURF2);
2317  c->AddEntry("Surf3", kTYPE_SURF3);
2318  c->AddEntry("Surf4", kTYPE_SURF4);
2319  c->AddEntry("Surf5", kTYPE_SURF5);
2320 
2321  return c;
2322 }
2323 
2324 ////////////////////////////////////////////////////////////////////////////////
2325 /// Create coordinate system type combo box.
2326 
2328 {
2329  TGComboBox *c = new TGComboBox(parent, id);
2330 
2331  c->AddEntry("Cartesian", kCOORDS_CAR);
2332  c->AddEntry("Cylindric", kCOORDS_CYL);
2333  c->AddEntry("Polar", kCOORDS_POL);
2334  c->AddEntry("Rapidity", kCOORDS_PSR);
2335  c->AddEntry("Spheric", kCOORDS_SPH);
2336  TGListBox* lb = c->GetListBox();
2337  lb->Resize(lb->GetWidth(), 83);
2338 
2339  return c;
2340 }
2341 
2342 ////////////////////////////////////////////////////////////////////////////////
2343 /// Create error type combo box.
2344 
2346 {
2347  TGComboBox *c = new TGComboBox(parent, id);
2348 
2349  c->AddEntry("No Errors", kERRORS_NO);
2350  c->AddEntry("Simple", kERRORS_SIMPLE);
2351  c->AddEntry("Edges", kERRORS_EDGES);
2352  c->AddEntry("Rectangles",kERRORS_REC);
2353  c->AddEntry("Fill", kERRORS_FILL);
2354  c->AddEntry("Contour", kERRORS_CONTOUR);
2355 
2356  return c;
2357 }
2358 
2359 ////////////////////////////////////////////////////////////////////////////////
2360 /// Create Line/Bar combo box.
2361 
2363 {
2364  TGComboBox *c = new TGComboBox(parent, id);
2365 
2366  c->AddEntry("No Line", kADD_NONE);
2367  c->AddEntry("Simple Line", kADD_SIMPLE);
2368  c->AddEntry("Smooth Line", kADD_SMOOTH);
2369  c->AddEntry("Fill Area",kADD_FILL);
2370  TGListBox* lb = c->GetListBox();
2371  lb->Resize(lb->GetWidth(), 76);
2372  return c;
2373 }
2374 
2375 ////////////////////////////////////////////////////////////////////////////////
2376 /// Create Percentage combo box for bar option.
2377 
2379 {
2380  TGComboBox *c = new TGComboBox(parent, id);
2381 
2382  c->AddEntry(" 0 %", kPER_0);
2383  c->AddEntry("10 %", kPER_10);
2384  c->AddEntry("20 %", kPER_20);
2385  c->AddEntry("30 %", kPER_30);
2386  c->AddEntry("40 %", kPER_40);
2387  TGListBox* lb = c->GetListBox();
2388  lb->Resize(lb->GetWidth(), 83);
2389 
2390  return c;
2391 }
2392 
2393 ////////////////////////////////////////////////////////////////////////////////
2394 /// Change the error combo box entry.
2395 
2397 {
2398  switch (i){
2399  case 0: {
2400  if (((TGLBContainer*)((TGListBox*)fErrorCombo->GetListBox())->GetContainer())->GetPos(kERRORS_EDGES)!=-1)
2404  TGListBox* lb = fErrorCombo->GetListBox();
2405  lb->Resize(lb->GetWidth(),36);
2406  break;
2407  }
2408  case 1: {
2409  if (((TGLBContainer*)((TGListBox*)fErrorCombo->GetListBox())->GetContainer())->GetPos(kERRORS_EDGES)==-1) {
2410  fErrorCombo->AddEntry("Edges", kERRORS_EDGES);
2411  fErrorCombo->AddEntry("Rectangles",kERRORS_REC);
2412  fErrorCombo->AddEntry("Fill", kERRORS_FILL);
2413  fErrorCombo->AddEntry("Contour", kERRORS_CONTOUR);
2414  TGListBox* lb = fErrorCombo->GetListBox();
2415  lb->Resize(lb->GetWidth(),100);
2416  }
2417  break;
2418  }
2419  }
2420 }
2421 
2422  ///////////////////////////////////////////////////////////////////////////////
2423  /// Paint a 3D box.
2424 
2426 {
2427  if (fGedEditor->GetPad()->GetCanvas())
2431  fGedEditor->GetPad()->cd();
2432  fGedEditor->GetPad()->PaintLine3D(p1, p2);
2433  fGedEditor->GetPad()->PaintLine3D(p2, p3);
2434  fGedEditor->GetPad()->PaintLine3D(p3, p4);
2435  fGedEditor->GetPad()->PaintLine3D(p4, p1);
2436 }
2437 
2438 ////////////////////////////////////////////////////////////////////////////////
2439 /// Return an array of dividers of n (without the trivial divider n).
2440 /// The number of dividers is saved in the first entry.
2441 
2443 {
2444  Int_t* div;
2445  if (n <= 0) {
2446  div = new Int_t[1];
2447  div[0]=0;
2448  } else if (n == 1) {
2449  div = new Int_t[2];
2450  div[0]=div[1]=1;
2451  } else {
2452  div = new Int_t[(Int_t) n/2+2];
2453  div[0]=0;
2454  div[1]=1;
2455 
2456  Int_t num = 1;
2457  for (Int_t i=2; i <= n/2; i++) {
2458  if (n % i == 0) {
2459  num++;
2460  div[num] = i;
2461  }
2462  }
2463  num++;
2464  div[num]=n;
2465  div[0] = num;
2466 // for (Int_t a=0; a <= div[0]; a++) printf("div[%d] = %d\n", a , div[a]);
2467  }
2468  return div;
2469 }
2470 
2471 ////////////////////////////////////////////////////////////////////////////////
2472 /// If the contained histogram obj is deleted we must set its pointer to zero
2473 
2475 {
2476  if (obj == fHist) {
2477  fHist = 0;
2478  }
2479 }
virtual void HideFrame(TGFrame *f)
Hide sub frame.
Definition: TGFrame.cxx:1172
virtual Float_t GetMinPosition() const
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition: TAttLine.h:43
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:587
TGNumberEntry * fBarOffset
Definition: TH1Editor.h:64
TString GetHistTypeLabel()
Returns the selected histogram type (HIST, LEGO1-2, SURF1-5).
Definition: TH1Editor.cxx:2213
virtual void SetBarOffset(Float_t offset=0.25)
Definition: TH1.h:355
void FeedbackMode(Bool_t set)
Turn rubberband feedback mode on or off.
Definition: TCanvas.cxx:1108
TGCompositeFrame * fBinCont
Definition: TH1Editor.h:76
virtual void Resize(UInt_t w, UInt_t h)
Resize the listbox widget.
Definition: TGListBox.cxx:1419
Float_t fP2old[3]
Definition: TH1Editor.h:112
virtual void ConnectSignals2Slots()
Connect signals to slots.
Definition: TH1Editor.cxx:556
virtual TVirtualPad * GetPad() const
Definition: TGedEditor.h:89
Int_t GetFirst() const
Return first bin on the axis i.e.
Definition: TAxis.cxx:456
virtual Float_t GetMaxPosition() const
virtual void DoPercent()
Slot connected to the bar percentage settings.
Definition: TH1Editor.cxx:1439
virtual void DoHistComplex()
Slot connected to the 3D radio button.
Definition: TH1Editor.cxx:1259
virtual Int_t GetPosition() const
Definition: TGSlider.h:109
float Float_t
Definition: RtypesCore.h:53
virtual void SetDirectory(TDirectory *dir)
By default when an histogram is created, it is added to the list of histogram objects in the current ...
Definition: TH1.cxx:8359
virtual void SetRange(Int_t min, Int_t max)
Definition: TGSlider.h:101
virtual Double_t * GetRmax()=0
virtual Float_t GetBarOffset() const
Definition: TH1.h:251
virtual Double_t GetBinLowEdge(Int_t bin) const
Return low edge of bin.
Definition: TAxis.cxx:516
float ymin
Definition: THbookFile.cxx:93
virtual Option_t * GetDrawOption() const
Get draw options of the selected object.
Definition: TGedFrame.cxx:81
static TGComboBox * BuildHistCoordsComboBox(TGFrame *parent, Int_t id)
Create coordinate system type combo box.
Definition: TH1Editor.cxx:2327
virtual void SetToolTipText(const char *text, Long_t delayms=500)
Set tool tip text associated with this text entry.
static TGComboBox * BuildHistAddComboBox(TGFrame *parent, Int_t id)
Create Line/Bar combo box.
Definition: TH1Editor.cxx:2362
virtual void SetBins(Int_t nx, Double_t xmin, Double_t xmax)
Redefine x axis parameters.
Definition: TH1.cxx:8189
virtual void SetButton(Int_t id, Bool_t down=kTRUE)
Sets the button with id to be on/down, and if this is an exclusive group, all other button in the gro...
TGCheckButton * fAddMarker
Definition: TH1Editor.h:57
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
virtual void SetIntNumber(Long_t val)
Set the numeric value (integer representation).
virtual void SetNumber(Double_t val)
See TView3D.
Definition: TView.h:25
void ToUpper()
Change string to upper case.
Definition: TString.cxx:1138
TGNumberEntry * fBarWidth
Definition: TH1Editor.h:63
#define gROOT
Definition: TROOT.h:415
virtual void TakeAction()
Execute action for object obj fNfill times.
TGTab * GetTab() const
Definition: TGedEditor.h:84
Basic string class.
Definition: TString.h:131
virtual void ShowFrame(TGFrame *f)
Show sub frame.
Definition: TGFrame.cxx:1186
#define f(i)
Definition: RSha256.hxx:104
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:59
virtual void SetRange(Float_t min, Float_t max)
TString GetHistAddLabel()
Return the selected shape of the histogram (C, L, LF2).
Definition: TH1Editor.cxx:2277
TGComboBox * fPercentCombo
Definition: TH1Editor.h:66
UInt_t GetWidth() const
Definition: TGFrame.h:271
TGNumberEntryField * fOffsetNumberEntry
Definition: TH1Editor.h:83
TH1 * fBinHist
Definition: TH1Editor.h:120
TGTextButton * fCancel
Definition: TH1Editor.h:89
TString & Insert(Ssiz_t pos, const char *s)
Definition: TString.h:644
void ChangeErrorCombo(Int_t i)
Change the error combo box entry.
Definition: TH1Editor.cxx:2396
Short_t Abs(Short_t d)
Definition: TMathBase.h:120
Handle_t GetId() const
Definition: TGObject.h:47
virtual void Layout()
Layout the elements of the composite frame.
Definition: TGFrame.cxx:1239
TGCheckButton * fDelaydraw
Definition: TH1Editor.h:87
virtual void PaintLine3D(Float_t *p1, Float_t *p2)=0
virtual void DoBinPressed()
Slot connected to the rebin slider in case of a not ntuple histogram.
Definition: TH1Editor.cxx:1822
virtual TVirtualPad * cd(Int_t subpadnumber=0)=0
TGCompositeFrame * f12
Definition: TH1Editor.h:74
Int_t fPx1old
Definition: TH1Editor.h:104
TH1 * fHist
Definition: TH1Editor.h:43
Bool_t fMake
Definition: TH1Editor.h:102
virtual void Reset(Option_t *option="")
Reset this histogram: contents, errors, etc.
Definition: TH1.cxx:6707
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
Definition: TAxis.cxx:526
virtual void SetBarWidth(Float_t width=0.5)
Definition: TH1.h:356
TGNumberEntryField * fSldMin
Definition: TH1Editor.h:85
Float_t fP7old[3]
Definition: TH1Editor.h:112
virtual void SetRangeUser(Double_t ufirst, Double_t ulast)
Set the viewing range for the axis from ufirst to ulast (in user coordinates).
Definition: TAxis.cxx:940
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:104
Double_t GetXmin() const
Definition: TAxis.h:133
Bool_t fAvoidSignal
Definition: TGedFrame.h:56
TGCompositeFrame * f3
Definition: TH1Editor.h:67
ULong_t Pixel_t
Definition: GuiTypes.h:39
void Class()
Definition: Class.C:29
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
Bool_t Contains(Int_t x, Int_t y) const
Definition: TGFrame.h:285
TGComboBox * fAddCombo
Definition: TH1Editor.h:65
Bool_t fSameOpt
Definition: TH1Editor.h:44
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:47
virtual void Update()
Update the current pad when an attribute is changed via GUI.
Definition: TGedFrame.cxx:73
Int_t fPy2old
Definition: TH1Editor.h:104
virtual void Select(Int_t id, Bool_t emit=kTRUE)
Make the selected item visible in the combo box window and emit signals according to the second param...
Definition: TGComboBox.cxx:450
TGCompositeFrame(const TGCompositeFrame &)
virtual void DoApply()
Slot connected to the Apply button of the Binning tab.
Definition: TH1Editor.cxx:2153
Int_t fTitlePrec
Definition: TH1Editor.h:46
virtual TGVerticalFrame * CreateEditorTabSubFrame(const char *name)
Create a vertical frame to be used by &#39;owner&#39; in extra tab &#39;name&#39;.
Definition: TGedFrame.cxx:123
virtual void SetRadioButtonExclusive(Bool_t flag=kTRUE)
If enable is kTRUE, this button group will treat radio buttons as mutually exclusive, and other buttons according to IsExclusive().
virtual Double_t GetNumber() const
Get the numeric value (floating point representation).
virtual void SetModel(TObject *obj)
Pick up current values of histogram attributes.
Definition: TH1Editor.cxx:626
TSelector * GetSelector() const
Definition: TTreePlayer.h:82
virtual const TGWindow * GetMainFrame() const
Returns top level main frame.
Definition: TGWindow.cxx:133
Ssiz_t First(char c) const
Find first occurrence of a character c.
Definition: TString.cxx:499
static constexpr double s
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
static TVirtualTreePlayer * GetCurrentPlayer()
Static function: return the current player (if any)
virtual EButtonState GetState() const
Definition: TGButton.h:112
TGCheckButton * fAddSimple
Definition: TH1Editor.h:62
Definition: TGMsgBox.h:43
TGCompositeFrame * f11
Definition: TH1Editor.h:73
virtual TView * GetView() const =0
virtual Double_t GetUymax() const =0
virtual void SetLimits(ELimit limits=kNELNoLimits, Double_t min=0, Double_t max=1)
Set the numerical limits.
virtual void RecursiveRemove(TObject *obj)
If the contained histogram obj is deleted we must set its pointer to zero.
Definition: TH1Editor.cxx:2474
virtual TGListBox * GetListBox() const
Definition: TGComboBox.h:130
virtual Double_t GetUymin() const =0
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
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition: TAttLine.h:40
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot...
Definition: TQObject.cxx:867
Float_t fP3old[3]
Definition: TH1Editor.h:112
virtual void SetRange(Int_t first=0, Int_t last=0)
Set the viewing range for the axis from bin first to last.
Definition: TAxis.cxx:915
TGHButtonGroup * fDimGroup
Definition: TH1Editor.h:48
float ymax
Definition: THbookFile.cxx:93
TString GetHistCoordsLabel()
Return the selected coordinate system of the histogram (POL,CYL,SPH,PSR).
Definition: TH1Editor.cxx:2236
Int_t GetLast() const
Return last bin on the axis i.e.
Definition: TAxis.cxx:467
virtual void DoSliderPressed()
Slot connected to the x-axis Range slider for initialising the values of the slider movement...
Definition: TH1Editor.cxx:1604
virtual void SetLayoutHints(TGLayoutHints *l, TGButton *button=0)
Set layout hints for the specified button or if button=0 for all buttons.
virtual Int_t GetNfill() const
Definition: TTreePlayer.h:78
Class to manage histogram axis.
Definition: TAxis.h:30
Double_t fOldOffset
Definition: TH1Editor.h:121
TGComboBox * fTypeCombo
Definition: TH1Editor.h:53
virtual Int_t XtoAbsPixel(Double_t x) const =0
leg AddEntry(h1,"Histogram filled with random numbers","f")
TGNumberEntryField * fBinNumberEntry1
Definition: TH1Editor.h:81
Int_t * Dividers(Int_t n)
Return an array of dividers of n (without the trivial divider n).
Definition: TH1Editor.cxx:2442
virtual void Associate(const TGWindow *w)
Definition: TGWidget.h:84
virtual Int_t GetMaxPosition() const
Definition: TGSlider.h:111
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:443
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:49
virtual TH1 * Rebin(Int_t ngroup=2, const char *newname="", const Double_t *xbins=0)
Rebin this histogram.
Definition: TH1.cxx:5875
unsigned int UInt_t
Definition: RtypesCore.h:42
TGCheckButton * fAddB
Definition: TH1Editor.h:58
virtual void Refresh(TObject *model)
Refresh the GUI info about the object attributes.
Definition: TGedFrame.cxx:135
Float_t fP6old[3]
Definition: TH1Editor.h:112
virtual void SetPosition(Int_t pos)
Definition: TGSlider.h:105
virtual void ChangeOptions(UInt_t options)
Change composite frame options. Options is an OR of the EFrameTypes.
Definition: TGFrame.cxx:1025
TGCompositeFrame * f7
Definition: TH1Editor.h:69
TH1 * GetHistogram() const
Definition: TTreePlayer.h:75
virtual void DoOffsetMoved(Int_t num)
Slot connected to the OffSetSlider.
Definition: TH1Editor.cxx:2065
Bool_t fMakeB
Definition: TH1Editor.h:103
TGCompositeFrame * fBinCont1
Definition: TH1Editor.h:77
TGTextButton * fApply
Definition: TH1Editor.h:88
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
virtual Double_t * GetRmin()=0
#define gVirtualX
Definition: TVirtualX.h:345
static TGComboBox * BuildHistTypeComboBox(TGFrame *parent, Int_t id)
Create histogram type combo box.
Definition: TH1Editor.cxx:2307
A specialized TSelector for TTree::Draw.
Definition: TSelectorDraw.h:31
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 &#39;Plot&#39; button group.
Definition: TH1Editor.cxx:1150
const Bool_t kFALSE
Definition: RtypesCore.h:88
virtual void DoAxisRange()
Slot connected to the number entry fields containing the Max/Min value of the x-axis.
Definition: TH1Editor.cxx:1682
PyObject * fType
virtual void SetScale(Int_t scale)
Definition: TGSlider.h:100
include TDocParser_001 C image html pict1_TDocParser_001 png width
Definition: TDocParser.cxx:121
virtual Int_t FindBin(Double_t x)
Find bin number corresponding to abscissa x.
Definition: TAxis.cxx:291
virtual Int_t YtoAbsPixel(Double_t y) const =0
TString & Remove(Ssiz_t pos)
Definition: TString.h:668
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:238
#define d(i)
Definition: RSha256.hxx:102
virtual void DoBinLabel()
Slot connected to the Bin number entry of the Rebinning tab.
Definition: TH1Editor.cxx:1925
TGNumberEntryField * fSldMax
Definition: TH1Editor.h:86
TGLayoutHints * fDim0lh
Definition: TH1Editor.h:52
Int_t fPx2old
Definition: TH1Editor.h:104
#define ClassImp(name)
Definition: Rtypes.h:365
virtual void Resize(UInt_t w, UInt_t h)
Resize the frame.
Definition: TGSlider.h:173
TGHSlider * fBinSlider1
Definition: TH1Editor.h:79
double Double_t
Definition: RtypesCore.h:55
virtual void SetDrawOption(Option_t *option="")
Set drawing option for object.
Definition: TGedFrame.cxx:145
virtual void AddEntry(TGString *s, Int_t id)
Definition: TGComboBox.h:106
TText * text
TGCheckButton * fMakeHBar
Definition: TH1Editor.h:61
virtual Double_t GetNumber() const
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
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:619
The TH1 histogram class.
Definition: TH1.h:56
Bool_t Disconnect(const char *signal=0, void *receiver=0, const char *slot=0)
Disconnects signal of this object from slot of receiver.
Definition: TQObject.cxx:1025
virtual Double_t GetEntries() const
Return the current number of entries.
Definition: TH1.cxx:4277
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1099
virtual void Show()
Show group of buttons.
TGCompositeFrame * f8
Definition: TH1Editor.h:70
Bool_t IsNull() const
Definition: TString.h:402
virtual Bool_t Add(TF1 *h1, Double_t c1=1, Option_t *option="")
Performs the operation: this = this + c1*f1 if errors are defined (see TH1::Sumw2), errors are also recalculated.
Definition: TH1.cxx:777
virtual UInt_t SetCanExtend(UInt_t extendBitMask)
Make the histogram axes extendable / not extendable according to the bit mask returns the previous bi...
Definition: TH1.cxx:6262
Mother of all ROOT objects.
Definition: TObject.h:37
TGHSlider * fBinOffsetSld
Definition: TH1Editor.h:82
Float_t fP5old[3]
Definition: TH1Editor.h:112
NOTE: Must always be 0 !!!
Definition: TH1.h:69
TGCompositeFrame * f15
Definition: TH1Editor.h:75
virtual void DoTitle(const char *text)
Slot connected to the histogram title setting.
Definition: TH1Editor.cxx:916
TGCompositeFrame * f6
Definition: TH1Editor.h:68
virtual Double_t GetBinWidth(Int_t bin) const
Return bin width.
Definition: TAxis.cxx:538
Bool_t fInit
Definition: TGedFrame.h:53
virtual void SetNumber(Double_t val)
Set the numeric value (floating point representation).
Float_t fP1old[3]
Definition: TH1Editor.h:112
virtual Int_t GetSelected() const
Definition: TGComboBox.h:134
TGNumberEntryField * GetNumberEntry() const
Float_t fP8old[3]
Definition: TH1Editor.h:112
virtual void DoHistChanges()
Slot connected to the histogram type, the coordinate type, the error type and the Add combo box...
Definition: TH1Editor.cxx:1307
Float_t fP4old[3]
Definition: TH1Editor.h:112
TGCompositeFrame * f9
Definition: TH1Editor.h:71
TGClient * fClient
Definition: TGObject.h:37
TGComboBox * fErrorCombo
Definition: TH1Editor.h:55
TObject * Clone(const char *newname=0) const
Make a complete copy of the underlying object.
Definition: TH1.cxx:2664
const TGWindow * GetDefaultRoot() const
Returns the root (i.e.
Definition: TGClient.cxx:234
virtual void SetPosition(Float_t min, Float_t max)
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition: TGClient.cxx:372
TGHSlider * fBinSlider
Definition: TH1Editor.h:78
#define gPad
Definition: TVirtualPad.h:286
#define c(i)
Definition: RSha256.hxx:101
virtual void DoAddB(Bool_t)
Slot connected to the bar Add check box.
Definition: TH1Editor.cxx:972
TGLayoutHints * fDimlh
Definition: TH1Editor.h:51
TGComboBox * fCoordsCombo
Definition: TH1Editor.h:54
virtual void RemoveEntry(Int_t id=-1)
Remove entry. If id == -1, the currently selected entry is removed.
Definition: TGComboBox.cxx:515
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set check button state.
Definition: TGButton.cxx:1200
virtual void SetTitle(const char *title)
See GetStatOverflows for more information.
Definition: TH1.cxx:6316
static TGComboBox * BuildPercentComboBox(TGFrame *parent, Int_t id)
Create Percentage combo box for bar option.
Definition: TH1Editor.cxx:2378
Definition: first.py:1
virtual void SetText(const char *text, Bool_t emit=kTRUE)
Sets text entry to text, clears the selection and moves the cursor to the end of the line...
Int_t GetNbins() const
Definition: TAxis.h:121
virtual void DoAddMarker(Bool_t on)
Slot connected to the show markers check box.
Definition: TH1Editor.cxx:926
Implement some of the functionality of the class TTree requiring access to extra libraries (Histogram...
Definition: TTreePlayer.h:37
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:84
TGRadioButton * fDim0
Definition: TH1Editor.h:50
virtual void RemoveEntries(Int_t from_ID, Int_t to_ID)
Definition: TGComboBox.h:125
TGedEditor * fGedEditor
Definition: TGedFrame.h:54
const Bool_t kTRUE
Definition: RtypesCore.h:87
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition: TGedFrame.cxx:96
virtual void DoHistSimple()
Slot connected to the 2D radio button.
Definition: TH1Editor.cxx:1169
TGCompositeFrame * fBin
Definition: TH1Editor.h:45
Double_t GetXmax() const
Definition: TAxis.h:134
virtual void SetToolTipText(const char *text, Long_t delayms=400)
Set tool tip text associated with this button.
Definition: TGButton.cxx:395
const Int_t n
Definition: legend1.C:16
virtual Float_t GetBarWidth() const
Definition: TH1.h:252
virtual void DoOffsetReleased()
Slot connected to the OffSetSlider.
Definition: TH1Editor.cxx:2017
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
Definition: TH1.h:316
ETH1Wid
Definition: TH1Editor.cxx:152
virtual void DoOffsetPressed()
Slot connected to the OffSetSlider that saves the OldBinOffset (nessesary for delay draw mode)...
Definition: TH1Editor.cxx:2006
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
virtual ~TH1Editor()
Destructor of TH1 editor.
Definition: TH1Editor.cxx:538
TGNumberEntryField * fBinNumberEntry
Definition: TH1Editor.h:80
Definition: TGMsgBox.h:44
TGCompositeFrame * f10
Definition: TH1Editor.h:72
virtual TCanvas * GetCanvas() const =0
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set button state.
Definition: TGButton.cxx:185
virtual void SetEnabled(Int_t tabIndex, Bool_t on=kTRUE)
Enable or disable tab.
Definition: TGTab.cxx:435
const char * Data() const
Definition: TString.h:364