Logo ROOT   master
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 #include "TVirtualX.h"
150 
152 
153 enum ETH1Wid{
169 };
170 
171 
172 ////////////////////////////////////////////////////////////////////////////////
173 /// Constructor of histogram attribute GUI.
174 
176  Int_t height, UInt_t options, Pixel_t back)
177  : TGedFrame(p, width, height, options | kVerticalFrame, back),
178  fHist(0),
179  fSameOpt(kFALSE),
180  fBin(0),
181  fBinHist(0)
182 {
183  // TextEntry for changing the title of the histogram
184  MakeTitle("Title");
185  fTitlePrec = 2;
186  fTitle = new TGTextEntry(this, new TGTextBuffer(50), kTH1_TITLE);
188  fTitle->SetToolTipText("Enter the histogram title string");
189  AddFrame(fTitle, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5));
190 
191  // Histogram draw options
192  TGCompositeFrame *fHistLbl = new TGCompositeFrame(this, 145, 10,
195  kFixedWidth |
197  fHistLbl->AddFrame(new TGLabel(fHistLbl,"Histogram"),
198  new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
199  fHistLbl->AddFrame(new TGHorizontal3DLine(fHistLbl),
200  new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 0));
201  AddFrame(fHistLbl, new TGLayoutHints(kLHintsTop,0,0,2,0));
202 
203  // TGButtonGroup to change: 2D plot <-> 3D plot
204  TGCompositeFrame *f2 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
205  fDimGroup = new TGHButtonGroup(f2,"Plot");
208  fDim->SetToolTipText("A 2-d plot of the histogram is dawn");
210  fDim0->SetToolTipText("A 3-d plot of the histogram is dawn");
213  fDimGroup->Show();
215  f2->AddFrame(fDimGroup, new TGLayoutHints(kLHintsTop, 4, 1, 0, 0));
216  AddFrame(f2, new TGLayoutHints(kLHintsTop, 1, 1, 2, 8));
217 
218  // Set the type of histogram (Lego0..2, Surf0..5) for 3D plot
219  f3 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
220  AddFrame(f3, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
221 
222  TGCompositeFrame *f3a = new TGCompositeFrame(f3, 40, 20);
223  f3->AddFrame(f3a, new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
224  TGLabel *fType = new TGLabel(f3a, "Add: ");
225  f3a->AddFrame(fType, new TGLayoutHints(kLHintsLeft, 6, 1, 4, 4));
226  TGLabel *fCoords = new TGLabel(f3a, "Coords:");
227  f3a->AddFrame(fCoords, new TGLayoutHints(kLHintsLeft, 6, 1, 4, 1));
228 
229  TGCompositeFrame *f3b = new TGCompositeFrame(f3, 40, 20);
230  f3->AddFrame(f3b, new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
232  f3b->AddFrame(fTypeCombo, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 1));
233  fTypeCombo->Resize(80, 20);
234  fTypeCombo->Associate(this);
235  //Set the coordinate system (Cartesian, Spheric, ...)
237  f3b->AddFrame(fCoordsCombo, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 1));
238  fCoordsCombo->Resize(80, 20);
239  fCoordsCombo->Associate(this);
240 
241  // Set the Error (No error, error1..5)
242  TGCompositeFrame *f5 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
243  AddFrame(f5, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
244 
245  TGCompositeFrame *f5a = new TGCompositeFrame(f5, 40, 20);
246  f5->AddFrame(f5a, new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
247  TGLabel *fError = new TGLabel(f5a, "Error:");
248  f5a->AddFrame(fError, new TGLayoutHints(kLHintsLeft, 6, 2, 4, 1));
249 
250  TGCompositeFrame *f5b = new TGCompositeFrame(f5, 40, 20);
251  f5->AddFrame(f5b, new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
253  f5b->AddFrame(fErrorCombo, new TGLayoutHints(kLHintsLeft, 15, 1, 2, 1));
254  fErrorCombo->Resize(80, 20);
255  fErrorCombo->Associate(this);
256 
257  // Further draw options: Smooth/Simple Line, Fill Area for 2D plot
258  f6 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
259  AddFrame(f6, new TGLayoutHints(kLHintsTop, 1, 1, 0, 3));
260 
261  TGCompositeFrame *f6a = new TGCompositeFrame(f6, 40, 20);
262  f6->AddFrame(f6a, new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
263  TGLabel *fAddLabel = new TGLabel(f6a, "Style:");
264  f6a->AddFrame(fAddLabel, new TGLayoutHints(kLHintsLeft, 6, 2, 4, 1));
265 
266  TGCompositeFrame *f6b = new TGCompositeFrame(f6, 40, 20);
267  f6->AddFrame(f6b, new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
269  f6b->AddFrame(fAddCombo, new TGLayoutHints(kLHintsLeft, 15, 1, 2, 1));
270  fAddCombo->Resize(80, 20);
271  fAddCombo->Associate(this);
272 
273  // option related to HIST: some changes needed here!
274  // because of inconsistencies
275  f15 = new TGCompositeFrame(this, 80, 20, kVerticalFrame);
276  fAddSimple = new TGCheckButton(f15, "Simple Drawing", kADD_LINE);
277  fAddSimple ->SetToolTipText("A simple histogram without errors is drawn (draw option: Hist)");
278  f15->AddFrame(fAddSimple, new TGLayoutHints(kLHintsLeft, 6, 1, 1, 0));
279  AddFrame(f15, new TGLayoutHints(kLHintsTop, 1, 1, 0, -1));
280 
281  // Show Marker Checkbox: draw marker (or not)
282  f7 = new TGCompositeFrame(this, 80, 20, kVerticalFrame);
283  fAddMarker = new TGCheckButton(f7, "Show markers", kMARKER_ONOFF);
284  fAddMarker ->SetToolTipText("Make marker visible/invisible");
285  f7->AddFrame(fAddMarker, new TGLayoutHints(kLHintsLeft, 6, 1, 1, 0));
286  AddFrame(f7, new TGLayoutHints(kLHintsTop, 1, 1, 2, 0));
287 
288  // Bar Chart Checkbox: draw with option B
289  f8 = new TGCompositeFrame(this, 80, 20, kVerticalFrame);
290  fAddB = new TGCheckButton(f8, "Draw bar chart", kB_ONOFF);
291  fAddB ->SetToolTipText("Draw a bar chart");
292  f8->AddFrame(fAddB, new TGLayoutHints(kLHintsLeft, 6, 1, 1, 0));
293  AddFrame(f8, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
294 
295  // Bar CheckBox: draw with option BAR +option selected by
296  // fPercentCombo (0..4) e.g. BAR2
297  f9 = new TGCompositeFrame(this, 80, 20, kVerticalFrame);
298  fAddBar = new TGCheckButton(f9, "Bar option", kBAR_ONOFF);
299  fAddBar ->SetToolTipText("Draw bar chart with bar-option");
300  f9->AddFrame(fAddBar, new TGLayoutHints(kLHintsLeft, 6, 1, 1, 0));
301  AddFrame(f9, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
302 
303  // Bar Menu => appears when the BAR checkbox is set
304  f10 = new TGCompositeFrame(this, 145, 10, kHorizontalFrame |
306  kFixedWidth |
308  f10->AddFrame(new TGLabel(f10,"Bar"),
309  new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
311  new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
312  AddFrame(f10, new TGLayoutHints(kLHintsTop,0,0,6,4));
313 
314  // NumberEntry to change the Bar Width
315  f11 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
316  TGLabel *fWidthLbl = new TGLabel(f11, "W:");
317  f11->AddFrame(fWidthLbl, new TGLayoutHints(kLHintsLeft, 1, 3, 4, 1));
318  fBarWidth = new TGNumberEntry(f11, 1.00, 6, kBAR_WIDTH,
322  fBarWidth->GetNumberEntry()->SetToolTipText("Set bin bar width");
323  fBarWidth->Resize(45,20);
324  f11->AddFrame(fBarWidth, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 1));
325 
326  // NumberEntry to change the Bar OFfset
327  TGLabel *foffsetLbl = new TGLabel(f11, "O:");
328  f11->AddFrame(foffsetLbl, new TGLayoutHints(kLHintsLeft, 6,3, 4, 1));
329  fBarOffset = new TGNumberEntry(f11, 0.00, 5, kBAR_OFFSET,
333  fBarOffset->GetNumberEntry()->SetToolTipText("Set bin bar offset");
334  fBarOffset->Resize(50,20);
335  f11->AddFrame(fBarOffset, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 1));
336  AddFrame(f11, new TGLayoutHints(kLHintsTop, 1, 1, 0, 4));
337 
338  // ComboBox which specifies the width of the Bar which should be drawn
339  // in another color i.e. specifies the number in BAR option e.g. BAR2
340  f12 = new TGCompositeFrame(this, 80, 20, kVerticalFrame);
342  TGLabel *percentLabel = new TGLabel(f13, "Percentage:");
343  f13->AddFrame(percentLabel, new TGLayoutHints(kLHintsLeft, 6, 1, 3, 1));
345  fPercentCombo->Resize(51, 20);
346  fPercentCombo->Associate(f13);
347  f13->AddFrame(fPercentCombo, new TGLayoutHints(kLHintsLeft, 14, 1, 2, 1));
348  f12->AddFrame(f13,new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
349 
350  // CHeckBox for horizontal drawing of the Histogram
351  fMakeHBar = new TGCheckButton(f12, "Horizontal Bar", kBAR_H);
352  fMakeHBar ->SetToolTipText("Draw a horizontal bar chart with hBar-Option");
353  f12->AddFrame(fMakeHBar, new TGLayoutHints(kLHintsLeft, 6, 1, 3, 0));
354  AddFrame(f12, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
355 
356  CreateBinTab();
357 
358  // add itself in the least of cleanups to be notified when attached histogram is deleted
359  gROOT->GetListOfCleanups()->Add(this);
360 }
361 
362 ////////////////////////////////////////////////////////////////////////////////
363 /// Create binning tab.
364 
366 {
367  fBin = CreateEditorTabSubFrame("Binning");
368 
369  TGCompositeFrame *title1 = new TGCompositeFrame(fBin, 145, 10,
372  kFixedWidth |
374  title1->AddFrame(new TGLabel(title1, "Rebin"),
375  new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
376  title1->AddFrame(new TGHorizontal3DLine(title1),
377  new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
378  fBin->AddFrame(title1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
379 
380  // Widgets for rebinning a histogram which does NOT derive from a ntuple
382  TGCompositeFrame *f18 = new TGCompositeFrame(fBinCont, 80, 20,
384  fBinSlider = new TGHSlider(f18, 100, kSlider1 | kScaleBoth);
385  fBinSlider->Resize(107,20);
386  f18->AddFrame(fBinSlider, new TGLayoutHints(kLHintsLeft, 3,0,0,3));
387  fBinCont->AddFrame(f18, new TGLayoutHints(kLHintsTop, 15, 7, 3, 5));
388 
389  TGCompositeFrame *f20 = new TGCompositeFrame(fBinCont, 80, 20,
391  TGLabel *binLabel1 = new TGLabel(f20, "# of Bins:");
392  f20->AddFrame(binLabel1, new TGLayoutHints(kLHintsLeft, 7, 1, 2, 1));
395  ((TGTextEntry*)fBinNumberEntry)->SetToolTipText("Set the number of bins in the rebinned histogram");
396  fBinNumberEntry->Resize(57,20);
397  f20->AddFrame(fBinNumberEntry, new TGLayoutHints(kLHintsRight, 21, 0, 0, 0));
398  fBinCont->AddFrame(f20, new TGLayoutHints(kLHintsTop, 0, 7, 3, 4));
399 
400  // Text buttons to Apply or Delete the rebinned histogram
401  TGCompositeFrame *f23 = new TGCompositeFrame(fBinCont, 118, 20,
403  kFixedWidth);
404  fApply = new TGTextButton(f23, " &Apply ");
405  f23->AddFrame(fApply,
406  new TGLayoutHints(kLHintsExpandX | kLHintsLeft , 0, 3, 4, 4));
407  fCancel = new TGTextButton(f23, " &Ignore ");
408  f23->AddFrame(fCancel,
409  new TGLayoutHints(kLHintsExpandX | kLHintsLeft, 3, 0, 4, 4));
410  fBinCont->AddFrame(f23, new TGLayoutHints(kLHintsTop, 20, 3, 3, 4));
412 
413  // Widgets for rebinning a histogram which derives from a ntuple
415  TGCompositeFrame *f21 = new TGCompositeFrame(fBinCont1, 80, 20,
417  fBinSlider1 = new TGHSlider(f21, 100, kSlider1 | kScaleBoth);
418  fBinSlider1->Resize(107,20);
419  fBinSlider1->SetRange(1,9);
420  fBinSlider1->SetScale(12);
422  f21->AddFrame(fBinSlider1, new TGLayoutHints(kLHintsLeft, 3,0,0,3));
423  fBinCont1->AddFrame(f21, new TGLayoutHints(kLHintsTop, 15, 7, 5, 0));
424 
425  // Lettering of the Rebin Slider
426  TGCompositeFrame *f24 = new TGCompositeFrame(fBinCont1, 80, 20,
428  TGLabel *l1 = new TGLabel(f24, "-5");
429  f24->AddFrame(l1, new TGLayoutHints(kLHintsLeft, 18, 1, -1, 0));
430  TGLabel *l2 = new TGLabel(f24, "-2");
431  f24->AddFrame(l2, new TGLayoutHints(kLHintsLeft, 26, 2, -1, 0));
432  TGLabel *l3 = new TGLabel(f24, "2");
433  f24->AddFrame(l3, new TGLayoutHints(kLHintsLeft, 17, 2, -1, 0));
434  TGLabel *l4 = new TGLabel(f24, "5");
435  f24->AddFrame(l4, new TGLayoutHints(kLHintsLeft, 32, 3, -1, 0));
436  fBinCont1->AddFrame(f24, new TGLayoutHints(kLHintsTop, 0, 0, 0, 0));
437 
438  TGCompositeFrame *f22 = new TGCompositeFrame(fBinCont1, 140, 20,
440  TGLabel *binLabel2 = new TGLabel(f22, "# of Bins:");
441  f22->AddFrame(binLabel2, new TGLayoutHints(kLHintsLeft, 7, 1, 4, 1));
442 
445  ((TGTextEntry*)fBinNumberEntry1)->SetToolTipText("Set the number of bins in the rebinned histogram");
446  fBinNumberEntry1->Resize(57,20);
447  f22->AddFrame(fBinNumberEntry1, new TGLayoutHints(kLHintsLeft, 21, 0, 2, 0));
448  fBinCont1->AddFrame(f22, new TGLayoutHints(kLHintsTop, 0, 7, 2, 4));
449 
450  TGCompositeFrame *f26 = new TGCompositeFrame(fBinCont1, 80, 20,
452  TGLabel *offsetLbl = new TGLabel(f26, "BinOffset:");
453  f26->AddFrame(offsetLbl, new TGLayoutHints(kLHintsLeft, 6, 1, 2, 1));
458  0., 1.);
459  ((TGTextEntry*)fOffsetNumberEntry)->SetToolTipText("Add an offset to the origin of the histogram");
460  fOffsetNumberEntry->Resize(57,20);
462  new TGLayoutHints(kLHintsRight, 21, 0, 0, 0));
463  fBinCont1->AddFrame(f26, new TGLayoutHints(kLHintsTop, 0, 7, 3, 1));
464 
465  TGCompositeFrame *f25 = new TGCompositeFrame(fBinCont1, 80, 20,
467  fBinOffsetSld = new TGHSlider(f25, 100, kSlider1 | kScaleBoth);
468  fBinOffsetSld->Resize(107,20);
469  f25->AddFrame(fBinOffsetSld, new TGLayoutHints(kLHintsLeft, 15,0,0,2));
470  fBinCont1->AddFrame(f25, new TGLayoutHints(kLHintsTop, 3, 7, 3, 3));
472 
473  // Sliders for axis range
474  TGCompositeFrame *sldCont = new TGCompositeFrame(fBin, 80, 20,
476  TGCompositeFrame *title2 = new TGCompositeFrame(sldCont, 145, 10,
479  kFixedWidth |
481  title2->AddFrame(new TGLabel(title2, "Axis Range"),
482  new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
483  title2->AddFrame(new TGHorizontal3DLine(title2),
484  new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
485  sldCont->AddFrame(title2, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
486 
487  TGCompositeFrame *f14 = new TGCompositeFrame(sldCont, 80, 20,
489  TGLabel *fSliderLbl = new TGLabel(f14,"x:");
490  f14->AddFrame(fSliderLbl,
491  new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 4,4, 4, 1));
492  fSlider = new TGDoubleHSlider(f14, 1, 2);
493  fSlider->Resize(118,20);
495  sldCont->AddFrame(f14, new TGLayoutHints(kLHintsTop, 3, 7, 4, 1));
496 
497  TGCompositeFrame *f16 = new TGCompositeFrame(sldCont, 80, 20,
499  fSldMin = new TGNumberEntryField(f16, kSLIDER_MIN, 0.0,
502  ((TGTextEntry*)fSldMin)->SetToolTipText("Set the minimum value of the x-axis");
503  fSldMin->Resize(57,20);
504  f16->AddFrame(fSldMin, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
505  fSldMax = new TGNumberEntryField(f16, kSLIDER_MAX, 0.0,
508  ((TGTextEntry*)fSldMax)->SetToolTipText("Set the maximum value of the x-axis");
509  fSldMax->Resize(57,20);
510  f16->AddFrame(fSldMax, new TGLayoutHints(kLHintsLeft, 4, 0, 0, 0));
511  sldCont->AddFrame(f16, new TGLayoutHints(kLHintsTop, 20, 3, 5, 0));
512 
513  TGCompositeFrame *f17 = new TGCompositeFrame(sldCont, 80, 20, kVerticalFrame);
514  fDelaydraw = new TGCheckButton(f17, "Delayed drawing", kDELAYED_DRAWING);
515  fDelaydraw ->SetToolTipText("Draw the new histogram only when any Slider is released");
516  f17->AddFrame(fDelaydraw, new TGLayoutHints(kLHintsLeft, 6, 1, 2, 0));
517  sldCont->AddFrame(f17, new TGLayoutHints(kLHintsTop, 1, 1, 5, 0));
518  fBin->AddFrame(sldCont, new TGLayoutHints(kLHintsTop));
519 
520  // to avoid jumping from DoAddBar to DoAddB and vice versa
521  fMakeB=kTRUE;
522  // to avoid calling SetDrawoption after every change
523  fMake=kTRUE;
524 
525  fBinHist = 0; // used to save a copy of the histogram
526 
527  // (when not drawn from an ntuple)
528  fBinOffsetSld->SetRange(0,100);
530  fOffsetNumberEntry->SetNumber(0.0000);
533 
534 } // end bin tab
535 
536 ////////////////////////////////////////////////////////////////////////////////
537 /// Destructor of TH1 editor.
538 
540 {
541  // remove itselef from the list of cleanups
542  gROOT->GetListOfCleanups()->Remove(this);
543 
544  // children of TGButonGroup are not deleted
545  delete fDim;
546  delete fDim0;
547  delete fDimlh;
548  delete fDim0lh;
549 
550  if (fBinHist) delete fBinHist;
551  fBinHist = 0;
552 }
553 
554 ////////////////////////////////////////////////////////////////////////////////
555 /// Connect signals to slots.
556 
558 {
559  //widgets for draw options
560  fAddB->Connect("Toggled(Bool_t)", "TH1Editor", this, "DoAddB(Bool_t)");
561  fAddBar->Connect("Toggled(Bool_t)", "TH1Editor", this, "DoAddBar(Bool_t)");
562  fTitle->Connect("TextChanged(const char *)", "TH1Editor", this, "DoTitle(const char *)");
563  fTypeCombo->Connect("Selected(Int_t)", "TH1Editor", this, "DoHistChanges()");
564  fCoordsCombo->Connect("Selected(Int_t)", "TH1Editor", this, "DoHistChanges()");
565  fErrorCombo->Connect("Selected(Int_t)", "TH1Editor", this, "DoHistChanges()");
566  fAddCombo->Connect("Selected(Int_t)", "TH1Editor", this, "DoHistChanges()");
567  fAddMarker->Connect("Toggled(Bool_t)", "TH1Editor", this, "DoAddMarker(Bool_t)");
568  fAddSimple->Connect("Toggled(Bool_t)", "TH1Editor", this, "DoAddSimple(Bool_t)");
569 
570  //change 2D <-> 3D plot
571  fDimGroup->Connect("Clicked(Int_t)","TH1Editor",this,"DoHistView()");
572 
573  // change Bar Width/Offset, the second connection is needed to have the ability to confirm the value also with enter
574  fBarWidth->Connect("ValueSet(Long_t)", "TH1Editor", this, "DoBarWidth()");
575  (fBarWidth->GetNumberEntry())->Connect("ReturnPressed()", "TH1Editor", this, "DoBarWidth()");
576  fBarOffset->Connect("ValueSet(Long_t)", "TH1Editor", this, "DoBarOffset()");
577  (fBarOffset->GetNumberEntry())->Connect("ReturnPressed()", "TH1Editor", this, "DoBarOffset()");
578  fPercentCombo->Connect("Selected(Int_t)", "TH1Editor", this, "DoPercent()");
579  fMakeHBar-> Connect("Toggled(Bool_t)","TH1Editor",this,"DoHBar(Bool_t))");
580 
581  // Connections for rebinning are created - i.e. slider is
582  // connected to the slots that perform the rebinning in the
583  // case of a histogram not derived from an ntuple.
584  fBinSlider->Connect("PositionChanged(Int_t)","TH1Editor",this, "DoBinMoved(Int_t)");
585  fBinSlider->Connect("Released()","TH1Editor",this, "DoBinReleased()");
586  fBinSlider->Connect("Pressed()","TH1Editor",this, "DoBinPressed()");
587  // numberEntry which shows/sets the actual number of bins
588  fBinNumberEntry->Connect("ReturnPressed()", "TH1Editor", this, "DoBinLabel()");
589  // Buttons to accept/reject the rebinned histogram
590  fApply->Connect("Clicked()", "TH1Editor", this, "DoApply()");
591  fCancel->Connect("Pressed()", "TH1Editor", this, "DoCancel()");
592  // in case of a histogram which is derived from an ntuple these slots are used
593  fBinSlider1->Connect("Released()","TH1Editor",this, "DoBinReleased1()");
594  fBinSlider1->Connect("PositionChanged(Int_t)","TH1Editor",this, "DoBinMoved1()");
595  fBinNumberEntry1->Connect("ReturnPressed()", "TH1Editor", this, "DoBinLabel1()");
596  // slider/slots to change the offset of the histogram
597  fBinOffsetSld->Connect("PositionChanged(Int_t)", "TH1Editor", this,"DoOffsetMoved(Int_t)");
598  fBinOffsetSld->Connect("Released()", "TH1Editor", this, "DoOffsetReleased()");
599  fBinOffsetSld->Connect("Pressed()", "TH1Editor", this, "DoOffsetPressed()");
600  fOffsetNumberEntry->Connect("ReturnPressed()", "TH1Editor", this, "DoBinOffset()");
601  // slider/slots to set the visible axisrange
602  fSlider->Connect("PositionChanged()","TH1Editor", this,"DoSliderMoved()");
603  fSlider->Connect("Pressed()","TH1Editor", this, "DoSliderPressed()");
604  fSlider->Connect("Released()","TH1Editor", this, "DoSliderReleased()");
605  fSldMin->Connect("ReturnPressed()", "TH1Editor", this, "DoAxisRange()");
606  fSldMax->Connect("ReturnPressed()", "TH1Editor", this, "DoAxisRange()");
607  fInit = kFALSE;
608 }
609 
610 ////////////////////////////////////////////////////////////////////////////////
611 /// Check if object is able to configure with this editor.
612 
614 {
615  if (obj == 0 || !obj->InheritsFrom(TH1::Class()) ||
616  ((TH1*)obj)->GetDimension()!=1 ||
617  ((TH1*)obj)->GetEntries() == 0
618  /*|| obj->InheritsFrom("TH2") || obj->InheritsFrom("TProfile")*/) {
619  return kFALSE;
620  }
621  return kTRUE;
622 }
623 
624 ////////////////////////////////////////////////////////////////////////////////
625 /// Pick up current values of histogram attributes.
626 
628 {
629 
630  if (fBinHist && (obj != fHist)) {
631  //we have probably moved to a different pad.
632  //let's restore the original histogram
633  if (fHist) {
634  fHist->Reset();
636  fBinHist->GetXaxis()->GetXmin(),
637  fBinHist->GetXaxis()->GetXmax());
638  fHist->Add(fBinHist);
639  }
640  // delete in anycase fBinHist also when fHist is zero (i.e when it has been deleted)
641  delete fBinHist; fBinHist = 0;
642  }
643 
644  fHist = (TH1*)obj;
646 
647  const char *text = fHist->GetTitle();
648  fTitle->SetText(text);
649 
650  fMake=kFALSE;
651  TString str = GetDrawOption();
652  str.ToUpper();
653  if (str.Contains("SAME"))
654  fSameOpt = kTRUE;
655  else
656  fSameOpt = kFALSE;
657  Bool_t errorset = kFALSE;
658  // if no draw option is specified: (default options)
659  if (str.IsNull() || str=="" ) {
662  HideFrame(f3); // Hiding the histogram type combo box
663  ShowFrame(f6);
664  ShowFrame(f7);
665  ShowFrame(f8);
666  ShowFrame(f9);
667  HideFrame(f10);
668  HideFrame(f11);
669  HideFrame(f12);
670  ShowFrame(f15);
673  errorset=kTRUE;
679  ChangeErrorCombo(1);
680  // in case of a 2D plot:
681  } else if (!str.Contains("LEGO") && !str.Contains("SURF")){
684  HideFrame(f3); // Hiding the histogram type combo box
685  ShowFrame(f7);
686  ShowFrame(f8);
687  ShowFrame(f9);
688  ShowFrame(f15);
690  // initialising fAddCombo
691  if (str.Contains("C")) {
692  if (str.Contains("CYL")) {
693  TString dum = str;
694  dum.Remove(strstr(dum.Data(),"CYL")-dum.Data(),3);
695  if (dum.Contains("C")) fAddCombo->Select(kADD_SMOOTH);
696  } else fAddCombo->Select(kADD_SMOOTH);
697  }
698  else if (str.Contains("LF2")) fAddCombo->Select(kADD_FILL);
699  else if (str.Contains("L")){
700  TString dum = str;
701  if (str.Contains("CYL")) {
702  dum.Remove(strstr(dum.Data(),"CYL")-dum.Data(),3);
703  if (dum.Contains("L")) fAddCombo->Select(kADD_SIMPLE);
704  }
705  if (str.Contains("POL")) {
706  dum.Remove(strstr(dum.Data(),"POL")-dum.Data(),3);
707  if (dum.Contains("L")) fAddCombo->Select(kADD_SIMPLE);
708  } else fAddCombo->Select(kADD_SIMPLE);
709  } else fAddCombo->Select(kADD_NONE);
710 
713  else if (str.Contains("HIST")) {
714  if (str=="HIST") fAddSimple->SetState(kButtonDisabled);
716  } else fAddSimple->SetState(kButtonUp);
717 
718  if (str.Contains("B")) {
719  TString dum = str;
720  if (str.Contains("BAR")) {
723  ShowFrame(f10);
724  ShowFrame(f11);
725  ShowFrame(f12);
726  } else {
730  ShowFrame(f10);
731  ShowFrame(f11);
732  HideFrame(f12);
733  }
734  } else {
737  HideFrame(f10);
738  HideFrame(f11);
739  HideFrame(f12);
740  }
741  if (str.Contains("P") ) {
744  } else if (!str.Contains("BAR")) fAddMarker->SetState(kButtonUp);
745  ChangeErrorCombo(1);
746 
747  // in case of a 3D plot
748  } else if (str.Contains("LEGO") || str.Contains("SURF")){
751  TGListBox* lb;
752  ChangeErrorCombo(0);
753  // set Coordinate ComboBox
754  if (str.Contains("SURF")){
755  // surf cannot be combined with spheric and cartesian coordinates
756  // i.e. remove them from the combobox
759  lb = fCoordsCombo->GetListBox();
760  lb->Resize(lb->GetWidth(), 49);
761  } else {
762  // surf cannot be combined with spheric and cartesian coordinates
763  // if surf was selected before here the removed items were added the combobox again
764  if (((TGLBContainer*)((TGListBox*)fCoordsCombo->GetListBox())->GetContainer())->GetPos(kCOORDS_SPH)==-1)
765  fCoordsCombo->AddEntry("Spheric", kCOORDS_SPH);
766  if (((TGLBContainer*)((TGListBox*)fCoordsCombo->GetListBox())->GetContainer())->GetPos(kCOORDS_CAR)==-1) {
767  fCoordsCombo->AddEntry("Cartesian", kCOORDS_CAR);
768  lb = fCoordsCombo->GetListBox();
769  lb->Resize(lb->GetWidth(), 83);
770  }
771  }
772  // initialising the Type Combobox
773  if (str.Contains("LEGO2")) fTypeCombo->Select(kTYPE_LEGO2);
774  else if (str.Contains("LEGO1")) fTypeCombo->Select(kTYPE_LEGO1);
775  else if (str.Contains("LEGO")) fTypeCombo->Select(kTYPE_LEGO);
776  else if (str.Contains("SURF5")) fTypeCombo->Select(kTYPE_SURF5);
777  else if (str.Contains("SURF4")) fTypeCombo->Select(kTYPE_SURF4);
778  else if (str.Contains("SURF3")) fTypeCombo->Select(kTYPE_SURF3);
779  else if (str.Contains("SURF2")) fTypeCombo->Select(kTYPE_SURF2);
780  else if (str.Contains("SURF1")) fTypeCombo->Select(kTYPE_SURF1);
781  else if (str.Contains("SURF")) fTypeCombo->Select(kTYPE_SURF);
782 
783  if (str.Contains("CYL")) fCoordsCombo->Select(kCOORDS_CYL);
784  else if (str.Contains("POL")) fCoordsCombo->Select(kCOORDS_POL);
785  else if (str.Contains("SPH")) fCoordsCombo->Select(kCOORDS_SPH);
786  else if (str.Contains("PSR")) fCoordsCombo->Select(kCOORDS_PSR);
787  else fCoordsCombo->Select(kCOORDS_CAR); //default
788 
789  HideFrame(f6);
790  HideFrame(f7);
791  HideFrame(f8);
792  HideFrame(f9);
793  HideFrame(f15);
794  if (str.Contains("LEGO")) {
795  ShowFrame(f10);
796  ShowFrame(f11);
797  HideFrame(f12);
798  } else {
799  HideFrame(f10);
800  HideFrame(f11);
801  HideFrame(f12);
802  }
805  }
806 
807  if (!errorset) {
808  if (str.Contains("E1")) fErrorCombo->Select(kERRORS_EDGES);
809  else if (str.Contains("E2")) fErrorCombo->Select(kERRORS_REC);
810  else if (str.Contains("E3")) fErrorCombo->Select(kERRORS_FILL);
811  else if (str.Contains("E4")) fErrorCombo->Select(kERRORS_CONTOUR);
812  else if (str.Contains("E")) {
813  if (str.Contains("LEGO")) {
814  TString dum=str;
815  dum.Remove(strstr(dum.Data(),"LEGO")-dum.Data(),4);
816  if (dum.Contains("E")) fErrorCombo->Select(kERRORS_SIMPLE);
818  } else fErrorCombo->Select(kERRORS_NO); //default
819  }
820 
822  HideFrame(f7);
823  HideFrame(f8);
824  }
825  if (str.Contains("BAR") || ((fAddBar->GetState()==kButtonDown) &&
826  (fDim->GetState()==kButtonDown))) {
827  ShowFrame(f10);
828  ShowFrame(f11);
829  ShowFrame(f12);
832  if (str.Contains("HBAR")) fMakeHBar->SetState(kButtonDown);
834 
835  if (str.Contains("BAR4")) fPercentCombo->Select(kPER_40);
836  else if (str.Contains("BAR3")) fPercentCombo->Select(kPER_30);
837  else if (str.Contains("BAR2")) fPercentCombo->Select(kPER_20);
838  else if (str.Contains("BAR1")) fPercentCombo->Select(kPER_10);
839  else fPercentCombo->Select(kPER_0);
840  }
841 
842  Int_t nx = fHist -> GetXaxis() -> GetNbins();
843  Int_t nxbinmin = fHist -> GetXaxis() -> GetFirst();
844  Int_t nxbinmax = fHist -> GetXaxis() -> GetLast();
845 
847 
849 
850  // Check if histogram is from ntupla/tree or not.
851  // If it is a standard histogram or a ntupla based histogram
852  // show a different frame in case of rebinning (fBinCont) with sliders and bin number entries
853  // connected to different methods.
854  // For example the entry field fBinNumberEntry is connected to
855  // the method DoBinLabel in case of non-ntupla histograms which just call Th1::Rebin
856  // In csae of a tree based histogram the entry field fBinNumberEntry1 is used which is connected to
857  // TH1Editor::DoBinLabel1 which is re-filling the histograms with the cached values from the TTreePlayer.
858  // Since the actual number of histogram entry can be larger than the cache size of the TTreePlayer
859  // (see JIRA ROOT-5900 or http://root.cern.ch/phpBB3/viewtopic.php?f=3&t=17107 )
860  // the GUI frame based on a non-tupla histogram is used when the number of entries of the histogram is
861  // not the same as the number of filled entries in the TTreePlayer object.
862 
863  if (!player || player->GetHistogram()!=fHist ||
864  fHist->GetEntries() != player->GetNfill()) {
865 
866  Int_t n = 0;
867  if (fBinHist) n = fBinHist->GetXaxis()->GetNbins();
868  else n = nx;
869  if (n < 1) n = 1;
872  Int_t* div = Dividers(n);
873  Int_t up = 0;
874  if (div[0]-1 <= 1) up = 2;
875  else up = div[0]-1;
876  fBinSlider->SetRange(1,up);
877  Int_t i = 1;
878  if (fBinSlider->GetMaxPosition()==2 && fBinSlider->GetPosition()==2)
880  else {
881  while ( div[i] != nx) i ++;
882  fBinSlider->SetPosition(div[0] - i + 1);
883  }
886  delete [] div;
887  }
888  else if (player && fHist==player->GetHistogram() && fHist->GetEntries() == player->GetNfill()) {
889  // in case of a ntupla/tree based histogram with number of entries not exceeding the TTreePlayer cache
892  fBinSlider->SetRange(0,1);
896  fBinNumberEntry1->SetIntNumber(nxbinmax-nxbinmin+1);
897  }
898 
899  fSlider->SetRange(1,nx);
900  fSlider->SetPosition((Double_t)nxbinmin,(Double_t)nxbinmax);
901 
902  fSldMin->SetNumber(fHist->GetXaxis()->GetBinLowEdge(nxbinmin));
903  fSldMax->SetNumber(fHist->GetXaxis()->GetBinUpEdge(nxbinmax));
904 
906  fHist->GetXaxis()->GetBinWidth(1));
907 
909  fMake=kTRUE;
912 }
913 
914 ////////////////////////////////////////////////////////////////////////////////
915 /// Slot connected to the histogram title setting.
916 
917 void TH1Editor::DoTitle(const char *text)
918 {
919  if (fAvoidSignal) return;
920  fHist->SetTitle(text);
921  Update();
922 }
923 
924 ////////////////////////////////////////////////////////////////////////////////
925 /// Slot connected to the show markers check box.
926 
928 {
929  if (fAvoidSignal) return;
930  TString str = GetDrawOption();
931  str.ToUpper();
932  if (str.Contains("SAME"))
933  fSameOpt = kTRUE;
934  else
935  fSameOpt = kFALSE;
936  TString dum = str;
937 
938  if (dum.Contains("POL")) dum.Remove(strstr(dum.Data(),"POL")-dum.Data(),3);
939  if (dum.Contains("SPH")) dum.Remove(strstr(dum.Data(),"SPH")-dum.Data(),3);
940  if (dum.Contains("PSR")) dum.Remove(strstr(dum.Data(),"PSR")-dum.Data(),3);
941  if (on) {
942  if (!dum.Contains("P")) str += "P";
944  if (str.Contains("HIST"))
945  str.Remove(strstr(str.Data(),"HIST")-str.Data(),4);
946  } else if (fAddMarker->GetState()==kButtonUp) {
947  if (str.Contains("POL") || str.Contains("SPH")) {
948  while (dum.Contains("P"))
949  dum.Remove(strstr(dum.Data(),"P")-dum.Data(),1);
950  if (str.Contains("POL")) str = dum + "POL";
951  if (str.Contains("SPH")) str = dum + "SPH";
952  if (str.Contains("PSR")) str = dum + "PSR";
953  } else if (str.Contains("P")) str.Remove(str.First("P"),1);
954  if ((str=="HIST") || (str=="") ||
955  (fAddB->GetState()==kButtonDown) ||
958  else if (str.Contains("HIST"))
960  else
962  }
963  if (fMake) {
964  if (fSameOpt) str += "SAME";
965  SetDrawOption(str);
966  Update();
967  }
968 }
969 
970 ////////////////////////////////////////////////////////////////////////////////
971 /// Slot connected to the bar Add check box.
972 
974 {
975  if (fAvoidSignal) return;
976  TString str = GetDrawOption();
977  str.ToUpper();
978  if (str.Contains("SAME"))
979  fSameOpt = kTRUE;
980  else
981  fSameOpt = kFALSE;
982  if (fMakeB) {
983  fMakeB=kFALSE;
984  if (on) {
985  if (!str.Contains("B")) str += "B";
986  ShowFrame(f10);
987  ShowFrame(f11);
988  HideFrame(f12);
993  } else if (fAddB->GetState()==kButtonUp) {
994  while (str.Contains("B"))
995  str.Remove(str.First("B"),1);
996  HideFrame(f10);
997  HideFrame(f11);
998  HideFrame(f12);
1000  if (fAddMarker->GetState()!=kButtonDown &&
1001  !(str=="" || str=="HIST" ||
1004  }
1005  if (fSameOpt) str += "SAME";
1006  if (fMake) SetDrawOption(str);
1007  Update();
1008 
1009  fMakeB=kTRUE;
1010  }
1011 }
1012 
1013 ////////////////////////////////////////////////////////////////////////////////
1014 /// Slot connected to the bar Add check box.
1015 
1017 {
1018  if (fAvoidSignal) return;
1020  TString str = GetDrawOption();
1021  str.ToUpper();
1022  if (str.Contains("SAME"))
1023  fSameOpt = kTRUE;
1024  else
1025  fSameOpt = kFALSE;
1026  if (fMakeB) {
1027  fMakeB=kFALSE;
1028  Int_t o = 0;
1029  if (str.Contains("HBAR")) o=1;
1030  if (str.Contains("BAR4"))
1031  str.Remove(strstr(str.Data(),"BAR4")-str.Data()-o,4+o);
1032  else if (str.Contains("BAR3"))
1033  str.Remove(strstr(str.Data(),"BAR3")-str.Data()-o,4+o);
1034  else if (str.Contains("BAR2"))
1035  str.Remove(strstr(str.Data(),"BAR2")-str.Data()-o,4+o);
1036  else if (str.Contains("BAR1"))
1037  str.Remove(strstr(str.Data(),"BAR1")-str.Data()-o,4+o);
1038  else if (str.Contains("BAR0"))
1039  str.Remove(strstr(str.Data(),"BAR0")-str.Data()-o,4+o);
1040  else if (str.Contains("BAR"))
1041  str.Remove(strstr(str.Data(),"BAR")-str.Data()-o,3+o);
1042  if (on) {
1043  if ((fAddMarker->GetState()==kButtonDown) &&
1047  else if ((fAddMarker->GetState()!=kButtonDown) &&
1049  if (str.Contains("HIST"))
1051  else if (fAddCombo->GetSelected()!=kADD_NONE)
1053  else
1055  }
1056  switch (fPercentCombo->GetSelected()){
1057  case(-1): {
1058  str += "BAR";
1060  break;
1061  }
1062  case(kPER_0): {
1063  str += "BAR";
1064  break;
1065  }
1066  case(kPER_10): {
1067  str += "BAR1";
1068  break;
1069  }
1070  case(kPER_20): {
1071  str += "BAR2";
1072  break;
1073  }
1074  case(kPER_30): {
1075  str += "BAR3";
1076  break;
1077  }
1078  case(kPER_40): {
1079  str += "BAR4";
1080  break;
1081  }
1082  }
1083  ShowFrame(f10);
1084  ShowFrame(f11);
1085  ShowFrame(f12);
1086  if (fMakeHBar->GetState()==kButtonDown)
1087  str.Insert(strstr(str.Data(),"BAR")-str.Data(),"H");
1091  } else if (fAddBar->GetState()==kButtonUp) {
1092  HideFrame(f10);
1093  HideFrame(f11);
1094  HideFrame(f12);
1098  if (str=="" || str=="HIST" || fAddCombo->GetSelected() != kADD_NONE ||
1099  ((fAddMarker->GetState() == kButtonDown) &&
1102  }
1103  if (fSameOpt) str += "SAME";
1104  if (fMake) SetDrawOption(str);
1105  Update();
1106  ((TGMainFrame*)GetMainFrame())->Layout();
1107  fMakeB=kTRUE;
1108  }
1109  fAddMarker->Connect("Toggled(Bool_t)", "TH1Editor", this, "DoAddMarker(Bool_t)");
1110 }
1111 
1112 ////////////////////////////////////////////////////////////////////////////////
1113 /// Slot connected to fAddSimple check box for drawing a simple histogram
1114 /// without errors (== HIST draw option) in combination with some other
1115 /// draw options. It draws an additional line on the top of the bins.
1116 
1118 {
1119  if (fAvoidSignal) return;
1121  // Bool_t make=kFALSE;
1122  fMake = kFALSE;
1123  TString str = GetDrawOption();
1124  str.ToUpper();
1125  if (str.Contains("SAME"))
1126  fSameOpt = kTRUE;
1127  else
1128  fSameOpt = kFALSE;
1129  if (on) {
1130  if (!str.Contains("HIST")) {
1131  str += "HIST";
1133  fMake=kTRUE;
1134  }
1135  } else if (fAddSimple->GetState()==kButtonUp) {
1136  if (str.Contains("HIST")) {
1137  str.Remove(strstr(str.Data(),"HIST")-str.Data(),4);
1139  fMake=kTRUE;
1140  }
1141  }
1142  if (fSameOpt) str += "SAME";
1143  if (fMake) SetDrawOption(str);
1144  fAddMarker->Connect("Toggled(Bool_t)", "TH1Editor", this, "DoAddMarker(Bool_t)");
1145  Update();
1146 }
1147 
1148 ////////////////////////////////////////////////////////////////////////////////
1149 /// Slot connected to the 'Plot' button group.
1150 
1152 {
1153  if (gPad && gPad->GetVirtCanvas())
1154  gPad->GetVirtCanvas()->SetCursor(kWatch);
1155  gVirtualX->SetCursor(GetId(), gVirtualX->CreateCursor(kWatch));
1156 
1157  if (fDim->GetState() == kButtonDown)
1158  DoHistSimple();
1159  else
1160  DoHistComplex();
1161 
1162  if (gPad && gPad->GetVirtCanvas())
1163  gPad->GetVirtCanvas()->SetCursor(kPointer);
1164  gVirtualX->SetCursor(GetId(), gVirtualX->CreateCursor(kPointer));
1165 }
1166 
1167 ////////////////////////////////////////////////////////////////////////////////
1168 /// Slot connected to the 2D radio button.
1169 
1171 {
1172  if (fAvoidSignal) return;
1173  if (fDim->GetState()==kButtonDown){
1174  TString str ="";
1175  fMake=kFALSE;
1176  TGListBox* lb;
1177  HideFrame(f3);
1178  ShowFrame(f6);
1179  ShowFrame(f9);
1180  ShowFrame(f15);
1181  ChangeErrorCombo(1);
1182  if ((fAddBar->GetState() != kButtonDown ||
1186  else if ((fAddSimple->GetState()==kButtonDisabled) &&
1189  else if (fAddSimple->GetState()!=kButtonUp)
1194 
1196  ShowFrame(f7);
1197  ShowFrame(f8);
1198  } else {
1199  HideFrame(f7);
1200  HideFrame(f8);
1203  }
1204 
1205  if ((fAddB->GetState() == kButtonDisabled)) {
1206  if (fAddBar->GetState()==kButtonDown) {
1207  ShowFrame(f10);
1208  ShowFrame(f11);
1209  ShowFrame(f12);
1210  } else {
1211  HideFrame(f10);
1212  HideFrame(f11);
1213  HideFrame(f12);
1214  }
1215  }
1216  if (fAddBar->GetState() == kButtonDisabled){
1217  ShowFrame(f10);
1218  ShowFrame(f11);
1219  HideFrame(f12);
1220  }
1221  if ((fAddBar->GetState() == kButtonUp) &&
1222  (fAddB->GetState() == kButtonUp)) {
1223  HideFrame(f10);
1224  HideFrame(f11);
1225  HideFrame(f12);
1226  }
1230  lb = fAddCombo->GetListBox();
1231  lb->Resize(lb->GetWidth(),19);
1234  fAddCombo->Connect("Selected(Int_t)", "TH1Editor", this, "DoHistChanges()");
1235  } else {
1236  if (((TGLBContainer*)((TGListBox*)fAddCombo->GetListBox())->GetContainer())->GetPos(kADD_SIMPLE)==-1)
1237  ((TGListBox*)fAddCombo->GetListBox())->AddEntry("Simple Line", kADD_SIMPLE);
1238  if (((TGLBContainer*)((TGListBox*)fAddCombo->GetListBox())->GetContainer())->GetPos(kADD_SMOOTH)==-1)
1239  ((TGListBox*)fAddCombo->GetListBox())->AddEntry("Smooth Line", kADD_SMOOTH);
1240  if (((TGLBContainer*)((TGListBox*)fAddCombo->GetListBox())->GetContainer())->GetPos(kADD_FILL)==-1) {
1241  ((TGListBox*)fAddCombo->GetListBox())->AddEntry("Fill Area",kADD_FILL);
1242  lb = fAddCombo->GetListBox();
1243  lb->Resize(lb->GetWidth(),76);
1244  }
1245  }
1246  if (fAddSimple->GetState()==kButtonDown) str+="HIST";
1248  if (fSameOpt) str += "SAME";
1249  SetDrawOption(str);
1250  Update();
1251  //fGedEditor->GetTab()->Layout();
1252  ((TGMainFrame*)GetMainFrame())->Layout();
1253  fMake=kTRUE;
1254  }
1255 }
1256 
1257 ////////////////////////////////////////////////////////////////////////////////
1258 /// Slot connected to the 3D radio button.
1259 
1261 {
1262  if (fAvoidSignal) return;
1263  if (fDim0->GetState()==kButtonDown) {
1264  TString str ="";
1265  fMake=kFALSE;
1266  ShowFrame(f3);
1267  HideFrame(f6);
1268  HideFrame(f7);
1269  HideFrame(f8);
1270  HideFrame(f9);
1271  HideFrame(f15);
1272  ChangeErrorCombo(0);
1273  if (fTypeCombo->GetSelected()==-1 && fCoordsCombo->GetSelected()==-1) {
1274  str = "LEGO"+GetHistErrorLabel();
1277  } else if (fTypeCombo->GetSelected()==-1){
1278  str = "LEGO"+GetHistErrorLabel();
1280  } else if (fCoordsCombo->GetSelected()==-1) {
1283  } else {
1285  }
1286  if (str.Contains("LEGO")) {
1287  ShowFrame(f10);
1288  ShowFrame(f11);
1289  HideFrame(f12);
1290  } else {
1291  HideFrame(f10);
1292  HideFrame(f11);
1293  HideFrame(f12);
1294  }
1295  if (fSameOpt) str += "SAME";
1296  SetDrawOption(str);
1297  Update();
1298  ((TGMainFrame*)GetMainFrame())->Layout();
1299  fGedEditor->GetTab()->Layout();
1300  fMake=kTRUE;
1301  }
1302 }
1303 
1304 ////////////////////////////////////////////////////////////////////////////////
1305 /// Slot connected to the histogram type, the coordinate type, the error type
1306 /// and the Add combo box.
1307 
1309 {
1310  if (fAvoidSignal) return;
1311  fMakeB= kFALSE;
1312  TGListBox* lb;
1313  if (GetHistTypeLabel().Contains("SURF")) {
1319  lb = fCoordsCombo->GetListBox();
1320  lb->Resize(lb->GetWidth(), 49);
1321  } else {
1322  if (((TGLBContainer*)((TGListBox*)fCoordsCombo->GetListBox())->GetContainer())->GetPos(kCOORDS_SPH)==-1)
1323  ((TGListBox*)fCoordsCombo->GetListBox())->AddEntrySort("Spheric", kCOORDS_SPH);
1324  if (((TGLBContainer*)((TGListBox*)fCoordsCombo->GetListBox())->GetContainer())->GetPos(kCOORDS_CAR)==-1) {
1325  ((TGListBox*)fCoordsCombo->GetListBox())->AddEntrySort("Cartesian", kCOORDS_CAR);
1326  lb = fCoordsCombo->GetListBox();
1327  lb->Resize(lb->GetWidth(), 83);
1328  }
1329  }
1330  if (fDim->GetState()!=kButtonUp){
1331  if (fErrorCombo->GetSelected() != kERRORS_NO){
1332  HideFrame(f7);
1333  HideFrame(f8);
1334  ShowFrame(f9);
1342  lb = fAddCombo->GetListBox();
1343  lb->Resize(lb->GetWidth(),19);
1346  fAddCombo->Connect("Selected(Int_t)", "TH1Editor", this, "DoHistChanges()");
1347  if (fAddBar->GetState()==kButtonDown) {
1348  ShowFrame(f10);
1349  ShowFrame(f11);
1350  ShowFrame(f12);
1351  } else {
1352  HideFrame(f10);
1353  HideFrame(f11);
1354  HideFrame(f12);
1355  }
1356  } else {
1357  Bool_t on = fMake;
1358  fMake=kFALSE;
1359  ShowFrame(f7);
1360  ShowFrame(f8);
1361  ShowFrame(f9);
1364  if (fAddBar->GetState() != kButtonDown &&
1367  if (((TGLBContainer*)((TGListBox*)fAddCombo->GetListBox())->GetContainer())->GetPos(kADD_SIMPLE)==-1)
1368  ((TGListBox*)fAddCombo->GetListBox())->AddEntry("Simple Line", kADD_SIMPLE);
1369  if (((TGLBContainer*)((TGListBox*)fAddCombo->GetListBox())->GetContainer())->GetPos(kADD_SMOOTH)==-1)
1370  ((TGListBox*)fAddCombo->GetListBox())->AddEntry("Smooth Line", kADD_SMOOTH);
1371  if (((TGLBContainer*)((TGListBox*)fAddCombo->GetListBox())->GetContainer())->GetPos(kADD_FILL)==-1) {
1372  ((TGListBox*)fAddCombo->GetListBox())->AddEntry("Fill Area",kADD_FILL);
1373  lb = fAddCombo->GetListBox();
1374  lb->Resize(lb->GetWidth(),76);
1375  }
1376  fMake=on;
1377  }
1378  if (fAddCombo->GetSelected()!=kADD_NONE) {
1380  } else {
1383  else if (fAddSimple->GetState()==kButtonDisabled)
1385  }
1386  } else if (fDim0->GetState()==kButtonDown) {
1387  if (GetHistTypeLabel().Contains("LEGO")) {
1388  ShowFrame(f10);
1389  ShowFrame(f11);
1390  HideFrame(f12);
1391  } else {
1392  HideFrame(f10);
1393  HideFrame(f11);
1394  HideFrame(f12);
1395  }
1396  }
1397  if (fMake) {
1398  TString str = "";
1399  if (fDim->GetState()==kButtonDown)
1401  else if (fDim0->GetState()==kButtonDown)
1404  str += "HIST";
1405  if (fSameOpt)
1406  str += "SAME";
1407  SetDrawOption(str);
1408  if (str=="" || str=="HIST") fAddSimple->SetState(kButtonDisabled);
1409  Update();
1410  }
1411  ((TGMainFrame*)GetMainFrame())->Layout();
1412  // fGedEditor->GetTab()->Layout();
1413  fMakeB=kTRUE;
1414 }
1415 
1416 ////////////////////////////////////////////////////////////////////////////////
1417 /// Slot connected to the Bar Width of the Bar Charts.
1418 
1420 {
1421  if (fAvoidSignal) return;
1423  Update();
1424 }
1425 
1426 ////////////////////////////////////////////////////////////////////////////////
1427 /// Slot connected to the Bar Offset of the Bar Charts.
1428 
1430 {
1431  if (fAvoidSignal) return;
1433  fHist->SetBarOffset(f);
1434  Update();
1435 }
1436 
1437 ////////////////////////////////////////////////////////////////////////////////
1438 /// Slot connected to the bar percentage settings.
1439 
1441 {
1442  if (fAvoidSignal) return;
1443  TString str = GetDrawOption();
1444  str.ToUpper();
1445  if (str.Contains("SAME"))
1446  fSameOpt = kTRUE;
1447  else
1448  fSameOpt = kFALSE;
1449  Int_t o = 0;
1450  if (str.Contains("HBAR")) o=1;
1451  if (str.Contains("BAR4"))
1452  str.Remove(strstr(str.Data(),"BAR4")-str.Data()-1,4+o);
1453  else if (str.Contains("BAR3"))
1454  str.Remove(strstr(str.Data(),"BAR3")-str.Data()-o,4+o);
1455  else if (str.Contains("BAR2"))
1456  str.Remove(strstr(str.Data(),"BAR2")-str.Data()-o,4+o);
1457  else if (str.Contains("BAR1"))
1458  str.Remove(strstr(str.Data(),"BAR1")-str.Data()-o,4+o);
1459  else if (str.Contains("BAR0"))
1460  str.Remove(strstr(str.Data(),"BAR0")-str.Data()-o,4+o);
1461  else if (str.Contains("BAR"))
1462  str.Remove(strstr(str.Data(),"BAR")-str.Data()-o,3+o);
1463 
1464  if (fMakeHBar->GetState()==kButtonDown) str+="H";
1465  switch (fPercentCombo->GetSelected()){
1466  case (kPER_0) :{ str += "BAR"; break;}
1467  case (kPER_10):{ str += "BAR1"; break;}
1468  case (kPER_20):{ str += "BAR2"; break;}
1469  case (kPER_30):{ str += "BAR3"; break;}
1470  case (kPER_40):{ str += "BAR4"; break;}
1471  }
1472  if (fSameOpt) str += "SAME";
1473  if (fMake) SetDrawOption(str);
1474  Update();
1475 }
1476 
1477 ////////////////////////////////////////////////////////////////////////////////
1478 /// Slot connected to the Horizontal Bar check button.
1479 
1481 {
1482  if (fAvoidSignal) return;
1483  TString str = GetDrawOption();
1484  str.ToUpper();
1485  if (str.Contains("SAME"))
1486  fSameOpt = kTRUE;
1487  else
1488  fSameOpt = kFALSE;
1489  if (on) {
1490  if (!str.Contains("HBAR"))
1491  str.Insert(strstr(str.Data(),"BAR")-str.Data(),"H");
1492  }
1493  else if (fMakeHBar->GetState()==kButtonUp) {
1494  if (str.Contains("HBAR"))
1495  str.Remove(strstr(str.Data(),"BAR")-str.Data()-1,1);
1496  }
1497  if (fSameOpt) str += "SAME";
1498  if (fMake) SetDrawOption(str);
1499  Update();
1500 }
1501 
1502 ////////////////////////////////////////////////////////////////////////////////
1503 /// Slot connected to the x-Slider for redrawing of the histogram
1504 /// according to the new Slider range.
1505 
1507 {
1508  if (fAvoidSignal) return;
1509  if (fGedEditor->GetPad()->GetCanvas())
1511  fGedEditor->GetPad()->cd();
1513  static Int_t px1,py1,px2,py2;
1514  static Float_t ymin,ymax,xleft,xright;
1515  xleft = fHist->GetXaxis()->GetBinLowEdge((Int_t)((fSlider->GetMinPosition())+0.5));
1516  xright = fHist->GetXaxis()->GetBinUpEdge((Int_t)((fSlider->GetMaxPosition())+0.5));
1517  ymin = fGedEditor->GetPad()->GetUymin();
1518  ymax = fGedEditor->GetPad()->GetUymax();
1519  px1 = fGedEditor->GetPad()->XtoAbsPixel(xleft);
1520  py1 = fGedEditor->GetPad()->YtoAbsPixel(ymin);
1521  px2 = fGedEditor->GetPad()->XtoAbsPixel(xright);
1522  py2 = fGedEditor->GetPad()->YtoAbsPixel(ymax);
1523  if (fGedEditor->GetPad()->GetCanvas())
1529  fGedEditor->GetPad()->cd();
1531  gVirtualX->DrawBox(px1, py1, px2, py2, TVirtualX::kHollow);
1532  fPx1old = px1;
1533  fPy1old = py1;
1534  fPx2old = px2 ;
1535  fPy2old = py2;
1536  gVirtualX->Update(0);
1537  fSldMin->SetNumber(xleft);
1538  fSldMax->SetNumber(xright);
1539  } else if (fDelaydraw->GetState() == kButtonDown &&
1540  fDim0->GetState() == kButtonDown &&
1542  static Float_t p1[3], p2[3], p3[3], p4[3], p5[3], p6[3], p7[3], p8[3];
1543  TView *fView = fGedEditor->GetPad()->GetView();
1544  if (!fView) return;
1545  Double_t *rmin = fView->GetRmin();
1546  if (!rmin) return;
1547  Double_t *rmax = fView->GetRmax();
1548  if (!rmax) return;
1549  p1[0] = p4[0] = p5[0] = p8[0] =
1551  p2[0] = p3[0] = p6[0] = p7[0] =
1553  p1[1] = p2[1] = p3[1] = p4[1] = rmin[1];
1554  p5[1] = p6[1] = p7[1] = p8[1] = rmax[1];
1555  p1[2] = p2[2] = p5[2] = p6[2] = rmin[2];
1556  p3[2] = p4[2] = p7[2] = p8[2] = rmax[2];
1561  PaintBox3D(p2, p3, p7, p6);
1562  PaintBox3D(p1, p4, p8, p5);
1563  for (Int_t i = 0; i<3; i++){
1564  fP1old[i] = p1[i];
1565  fP2old[i] = p2[i];
1566  fP3old[i] = p3[i];
1567  fP4old[i] = p4[i];
1568  fP5old[i] = p5[i];
1569  fP6old[i] = p6[i];
1570  fP7old[i] = p7[i];
1571  fP8old[i] = p8[i];
1572  }
1573  fSldMin->SetNumber(p1[0]);
1574  fSldMax->SetNumber(p2[0]);
1575  } else if (fDelaydraw->GetState() == kButtonDown &&
1576  fDim0->GetState() == kButtonDown) {
1579  } else {
1581  (Int_t)((fSlider->GetMaxPosition())+0.5));
1585  Update();
1586  }
1588  if (player && player->GetHistogram() == fHist) {
1589  Int_t last = fHist->GetXaxis()->GetLast();
1590  Int_t first = fHist->GetXaxis()->GetFirst();
1592  // How to redraw the NumberEntry without calling Update??
1593  // Update kills the "virtual" painted box in Delayed draw mode
1595  // fGedEditor->GetTab()->Layout();
1596  }
1599 }
1600 
1601 ////////////////////////////////////////////////////////////////////////////////
1602 /// Slot connected to the x-axis Range slider for initialising the
1603 /// values of the slider movement.
1604 
1606 {
1607  if (fAvoidSignal) return;
1608  if (fGedEditor->GetPad()->GetCanvas())
1610  fGedEditor->GetPad()->cd();
1611  static Float_t ymin,ymax,xleft,xright;
1612  Int_t sldmin = (Int_t)((fSlider->GetMinPosition())+0.5);
1613  Int_t sldmax = (Int_t)((fSlider->GetMaxPosition())+0.5);
1614  if (fDelaydraw->GetState() == kButtonDown &&
1615  fDim->GetState()==kButtonDown) {
1616  if (fGedEditor->GetPad()->GetCanvas())
1620  xleft = fHist->GetXaxis()->GetBinLowEdge(sldmin);
1621  xright = fHist->GetXaxis()->GetBinUpEdge(sldmax);
1622  ymin = fGedEditor->GetPad()->GetUymin();
1623  ymax = fGedEditor->GetPad()->GetUymax();
1624  fPx1old = fGedEditor->GetPad()->XtoAbsPixel(xleft);
1626  fPx2old = fGedEditor->GetPad()->XtoAbsPixel(xright);
1629  } else if (fDelaydraw->GetState() == kButtonDown &&
1630  fDim0->GetState() == kButtonDown &&
1632  TView *fView = fGedEditor->GetPad()->GetView();
1633  if (!fView) return;
1634  Double_t *rmin = fView->GetRmin();
1635  if (!rmin) return;
1636  Double_t *rmax = fView->GetRmax();
1637  if (!rmax) return;
1638  fP1old[0] = fP4old[0] = fP5old[0] = fP8old[0] =
1639  fHist->GetXaxis()->GetBinLowEdge(sldmin);
1640  fP2old[0] = fP3old[0] = fP6old[0] = fP7old[0] =
1641  fHist->GetXaxis()->GetBinUpEdge(sldmax);
1642  fP1old[1] = fP2old[1] = fP3old[1] = fP4old[1] = rmin[1];
1643  fP5old[1] = fP6old[1] = fP7old[1] = fP8old[1] = rmax[1];
1644  fP1old[2] = fP2old[2] = fP5old[2] = fP6old[2] = rmin[2];
1645  fP3old[2] = fP4old[2] = fP7old[2] = fP8old[2] = rmax[2];
1646  if (fGedEditor->GetPad()->GetCanvas())
1652  }
1653  Update();
1654 }
1655 
1656 ////////////////////////////////////////////////////////////////////////////////
1657 /// Slot connected to the x-axis Range slider for finalizing the
1658 /// values of the slider movement.
1659 
1661 {
1662  if (fAvoidSignal) return;
1663  if (fDelaydraw->GetState()==kButtonDown) {
1665  (Int_t)((fSlider->GetMaxPosition())+0.5));
1668  Update();
1669  }
1671  if (player) if (player->GetHistogram() == fHist) {
1672  Int_t last = fHist->GetXaxis()->GetLast();
1673  Int_t first = fHist->GetXaxis()->GetFirst();
1675  Update();
1676  }
1677 }
1678 
1679 ////////////////////////////////////////////////////////////////////////////////
1680 /// Slot connected to the number entry fields containing the Max/Min
1681 /// value of the x-axis.
1682 
1684 {
1685  if (fAvoidSignal) return;
1686  Int_t nx = fHist->GetXaxis()->GetNbins();
1688  Double_t lowLimit = fHist->GetXaxis()->GetBinLowEdge(1);
1689  Double_t upLimit = fHist->GetXaxis()->GetBinUpEdge(nx);
1690  if ((fSldMin->GetNumber()+width/2) < (lowLimit))
1691  fSldMin->SetNumber(lowLimit);
1692  if ((fSldMax->GetNumber()-width/2) > (upLimit))
1693  fSldMax->SetNumber(upLimit);
1694 // Set the histogram range and the axis range slider
1696  fSldMax->GetNumber()-width/2);
1697  Int_t nxbinmin = fHist->GetXaxis()->GetFirst();
1698  Int_t nxbinmax = fHist->GetXaxis()->GetLast();
1699  fSlider->SetPosition((Double_t)(nxbinmin),(Double_t)(nxbinmax));
1700  Update();
1701 }
1702 
1703 ////////////////////////////////////////////////////////////////////////////////
1704 /// Slot connected to the rebin slider in case of a not ntuple histogram
1705 /// Updates some other widgets which are related to the rebin slider.
1706 
1708 {
1709  // draw the rebinned histogram in case of delay draw mode
1710  if (fAvoidSignal) return;
1711  if (fDelaydraw->GetState()==kButtonDown){
1712  if (!fBinHist) {
1713  fBinHist = (TH1*)fHist->Clone("BinHist");
1714  // we will manage this histogram
1715  fBinHist->SetDirectory(0);
1716  }
1717  Int_t nx = fBinHist->GetXaxis()->GetNbins();
1718  Int_t numx = fBinSlider->GetPosition();
1719  Int_t* divx = Dividers(nx);
1720  if (divx[0]==2) fBinSlider->SetPosition(2);
1721  if (divx[0]==2) {
1722  delete [] divx;
1723  return;
1724  }
1725  // delete the histogram which is on the screen
1726  fGedEditor->GetPad()->cd();
1727  fHist->Reset();
1729  fBinHist->GetXaxis()->GetXmax());
1730  fHist->Add(fBinHist);
1732  fHist->Rebin(divx[numx]);
1733  // fModel=fHist;
1734  if (divx[0]!=2) {
1735  TAxis* xaxis = fHist->GetXaxis();
1736  Double_t xBinWidth = xaxis->GetBinWidth(1);
1737  xaxis->SetRangeUser(fSldMin->GetNumber()+xBinWidth/2,
1738  fSldMax->GetNumber()-xBinWidth/2);
1739  fSlider->SetRange(1,(Int_t)nx/divx[numx]);
1740  fSlider->SetPosition(xaxis->FindBin(fSldMin->GetNumber()+xBinWidth/2),
1741  xaxis->FindBin(fSldMax->GetNumber()-xBinWidth/2));
1742  // the x-axis range could be changed a little bit by Rebin algorithm
1743  fSldMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
1744  fSldMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
1745  }
1750  Update();
1751  delete [] divx;
1752  }
1753 // fGedEditor->GetPad()->GetCanvas()->Selected(fGedEditor->GetPad(), fHist, 0);
1754  // fModel = fHist;
1755  Refresh(fHist);
1756 }
1757 
1758 ////////////////////////////////////////////////////////////////////////////////
1759 /// Slot connected to the rebin slider in case of a not ntuple histogram
1760 /// (does the Rebinning of the histogram).
1761 
1763 {
1764  // create a clone in the background, when the slider is moved for
1765  // the first time
1766  if (fAvoidSignal) return;
1767  if (!fBinHist /*&& fDelaydraw->GetState()!=kButtonDown*/) {
1768  Int_t* divx = Dividers(fHist->GetXaxis()->GetNbins());
1769  if (divx[0]==2) {
1770  delete [] divx;
1771  return;
1772  }
1773  fBinHist = (TH1*)fHist->Clone("BinHist");
1774  // the TH1Editor class manage this histogram
1775  fBinHist->SetDirectory(0);
1776  delete [] divx;
1777  }
1778  // if the slider already has been moved and the clone is saved
1779  Int_t nx = fBinHist->GetXaxis()->GetNbins();
1780  Int_t* divx = Dividers(nx);
1781  if (divx[0]==2) {
1782  fBinSlider->SetPosition(2);
1783  numx=1;
1784  delete [] divx;
1785  return;
1786  }
1787  Int_t maxx = (Int_t)nx/divx[numx];
1788  if (maxx==1) maxx=2;
1789  if (fDelaydraw->GetState() == kButtonUp) {
1790  fGedEditor->GetPad()->cd();
1791  fHist->Reset();
1793  fBinHist->GetXaxis()->GetXmax());
1794  fHist->Add(fBinHist);
1796  fHist->Rebin(divx[numx]);
1797  //fModel=fHist;
1798  TAxis* xaxis = fHist->GetXaxis();
1799  Double_t xBinWidth = xaxis->GetBinWidth(1);
1800  xaxis->SetRangeUser(fSldMin->GetNumber()+xBinWidth/2,
1801  fSldMax->GetNumber()-xBinWidth/2);
1802  fSlider->SetRange(1,maxx);
1803  fSlider->SetPosition(xaxis->FindBin(fSldMin->GetNumber()+xBinWidth/2),
1804  xaxis->FindBin(fSldMax->GetNumber()-xBinWidth/2));
1805  // the axis range could be changed a little bit by the Rebin algorithm
1806  fSldMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
1807  fSldMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
1809  Update();
1810  }
1815  if (fBinNumberEntry->GetNumber()!=maxx)
1816  fBinNumberEntry->SetNumber(maxx);
1817  delete [] divx;
1818 }
1819 
1820 ////////////////////////////////////////////////////////////////////////////////
1821 /// Slot connected to the rebin slider in case of a not ntuple histogram.
1822 
1824 {
1825  if (fAvoidSignal) return;
1826  Int_t* d = Dividers(fHist->GetXaxis()->GetNbins());
1827  if (d[0]==2 && !fBinHist) {
1828  new TGMsgBox(fClient->GetDefaultRoot(), this->GetMainFrame(),
1829  "TH1 Editor", "It is not possible to rebin the histogram",
1831  gVirtualX->GrabPointer(fBinSlider->GetId(),0,0,0);
1832  }
1833  delete [] d;
1834  // calling the MessageBox again does NOT work!*/
1835 }
1836 
1837 ////////////////////////////////////////////////////////////////////////////////
1838 /// Slot connected to the BinNumber Slider in case of a ntuple histogram
1839 /// (does the Rebinning of the histogram).
1840 
1842 {
1843  if (fAvoidSignal) return;
1844  Double_t oldOffset = fOffsetNumberEntry->GetNumber();
1845  Int_t number = fBinSlider1->GetPosition();
1846  if (number==5) return;
1847  Int_t fact = 0;
1848  Int_t binNumber = 0;
1849  TAxis* xaxis = fHist->GetXaxis();
1850  // "compute" the scaling factor:
1851  if (number > 5) fact = number - 4;
1852  else fact = number - 6;
1854  if (!player) return;
1855  Int_t first = xaxis->GetFirst();
1856  Int_t last = xaxis->GetLast();
1857  Int_t nx = xaxis->GetNbins();
1858  Double_t min = xaxis->GetBinLowEdge(1); // overall min in user coords
1859  Double_t max = xaxis->GetBinUpEdge(nx); // overall max in user coords
1860  Double_t rmin = xaxis->GetBinLowEdge(first); // recent min in user coords
1861  Double_t rmax = xaxis->GetBinUpEdge(last); // recent max in user coords
1862 
1863  ((TH1*)player->GetHistogram())->SetCanExtend(TH1::kNoAxis);
1864  ((TH1*)player->GetHistogram())->Reset();
1865 
1866  // get new Number of bins
1867  if (fact > 0) binNumber = fact*nx;
1868  if (fact < 0) binNumber = (Int_t) ((-1)*nx/fact+0.5);
1869  if (binNumber < 1) binNumber = 1;
1870  if (binNumber > 10000) binNumber= 10000;
1871  Double_t newOffset = 1.*fBinOffsetSld->GetPosition()/100*((max-min)/binNumber);
1872  // create new histogram - the main job is done by sel->TakeAction()
1873  ((TH1*)player->GetHistogram())->SetBins(binNumber,
1874  min-oldOffset+newOffset,
1875  max-oldOffset+newOffset);
1876  TSelectorDraw *sel = (TSelectorDraw*)player->GetSelector();
1877  if (!sel) return;
1878  sel->TakeAction();
1879 
1880  // restore and set all the attributes which were changed by TakeAction()
1881  fHist = (TH1*)((TTreePlayer*)TVirtualTreePlayer::GetCurrentPlayer())->GetHistogram();
1882  fSlider->SetRange(1,binNumber);
1883  Double_t binWidth = fHist->GetXaxis()->GetBinWidth(1);
1884  fSlider->SetPosition(xaxis->FindBin(rmin), xaxis->FindBin(rmax));
1885  Double_t offset = 1.*fBinOffsetSld->GetPosition()/100*binWidth;
1886  xaxis->SetRange(xaxis->FindBin(rmin+binWidth/2),
1887  xaxis->FindBin(rmax-binWidth/2)); // SetRange in binNumbers!
1888  fSldMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
1889  fSldMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
1890  fBinNumberEntry1->SetNumber(xaxis->GetLast() - xaxis->GetFirst() + 1);
1892  fOffsetNumberEntry->SetNumber(offset);
1894  xaxis->GetBinWidth(1));
1896  Update();
1897 }
1898 
1899 ////////////////////////////////////////////////////////////////////////////////
1900 /// Slot connected to the rebin slider in case of an ntuple histogram.
1901 /// It updates the BinNumberEntryField during the BinSlider movement.
1902 
1904 {
1905  if (fAvoidSignal) return;
1906  TAxis* xaxis = fHist->GetXaxis();
1907  Int_t first = xaxis->GetFirst();
1908  Int_t last = xaxis->GetLast();
1909  Int_t number = fBinSlider1->GetPosition();
1910  Int_t n = last -first+1;
1911  Int_t fact = 0;
1912  Int_t binNumber = 0;
1913  if (number >= 5) fact = number - 4;
1914  else fact = number - 6;
1915  if (fact > 0) binNumber = fact*n;
1916  if (fact < 0) binNumber = (Int_t) ((-1)*n/fact+0.5);
1917  if (binNumber < 1) binNumber = 1;
1918  if (binNumber > 10000) binNumber= 10000;
1919  fBinNumberEntry1->SetIntNumber(binNumber);
1920 // Update();
1921 }
1922 
1923 ////////////////////////////////////////////////////////////////////////////////
1924 /// Slot connected to the Bin number entry of the Rebinning tab.
1925 
1927 {
1928  if (fAvoidSignal) return;
1929  Int_t num = (Int_t)(fBinNumberEntry->GetNumber());
1930  Int_t nx = 0;
1931  if (fBinHist) nx = fBinHist->GetXaxis()->GetNbins();
1932  else nx = fHist->GetXaxis()->GetNbins();
1933  if (nx < 2) return;
1934  Int_t *div = Dividers(nx);
1935  Int_t diff = TMath::Abs(num - div[1]);
1936  Int_t c = 1;
1937  for (Int_t i = 2; i <= div[0]; i++) {
1938  if ((TMath::Abs(num - div[i])) < diff) {
1939  c = i;
1940  diff = TMath::Abs(num - div[i]);
1941  }
1942  }
1943  fBinNumberEntry->SetNumber(div[c]);
1944  fBinSlider->SetPosition(div[0] - c +1);
1945  if (fDelaydraw->GetState()==kButtonUp) DoBinMoved(div[0] - c +1);
1946  else DoBinReleased();
1947 // fGedEditor->GetPad()->GetCanvas()->Selected(fGedEditor->GetPad(), fHist, 0);
1948  // fModel = fHist;
1949  Refresh(fHist);
1950  delete [] div;
1951 }
1952 
1953 ////////////////////////////////////////////////////////////////////////////////
1954 /// Slot connected to the Bin number entry of the Rebinning tab.
1955 
1957 {
1958  if (fAvoidSignal) return;
1959  Double_t oldOffset = fOffsetNumberEntry->GetNumber();
1961  TAxis* xaxis = fHist->GetXaxis();
1963  if (!player) return;
1964  Int_t first = xaxis->GetFirst();
1965  Int_t last = xaxis->GetLast();
1966  Int_t nx = xaxis->GetNbins();
1967  Double_t min = xaxis->GetBinLowEdge(1); // overall min in user coords
1968  Double_t max = xaxis->GetBinUpEdge(nx); // overall max in user coords
1969  Double_t rmin = xaxis->GetBinLowEdge(first); // recent min in user coords
1970  Double_t rmax = xaxis->GetBinUpEdge(last); // recent max in user coords
1971 
1972  ((TH1*)player->GetHistogram())->SetCanExtend(TH1::kNoAxis);
1973  ((TH1*)player->GetHistogram())->Reset();
1974 
1975 // Calculate the new number of bins in the complete range
1976  Int_t binNumber = (Int_t) ((max-min)/(rmax - rmin)*num + 0.5);
1977  if (binNumber < 1) binNumber = 1;
1978  if (binNumber > 10000) binNumber = 10000;
1979  Double_t offset = 1.*(fBinOffsetSld->GetPosition())/100*(max-min)/binNumber;
1980 // create new histogram - the main job is done by sel->TakeAction()
1981  ((TH1*)player->GetHistogram())->SetBins(binNumber,
1982  min-oldOffset+offset,
1983  max-oldOffset+offset);
1984  TSelectorDraw *sel = (TSelectorDraw*)player->GetSelector();
1985  if (!sel) return;
1986  sel->TakeAction();
1987 
1988 // Restore and set all the attributes which were changed by TakeAction()
1989  fHist = (TH1*)((TTreePlayer*)TVirtualTreePlayer::GetCurrentPlayer())->GetHistogram();
1990  fSlider->SetRange(1,binNumber);
1991  Double_t binWidth = xaxis->GetBinWidth(1);
1992  fSlider->SetPosition(xaxis->FindBin(rmin), xaxis->FindBin(rmax));
1993  offset = 1.*fBinOffsetSld->GetPosition()/100*binWidth;
1994  xaxis->SetRange(xaxis->FindBin(rmin+binWidth/2),
1995  xaxis->FindBin(rmax-binWidth/2)); // SetRange in binNumbers!
1996  fSldMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
1997  fSldMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
1998  fOffsetNumberEntry->SetNumber(offset);
2000  Update();
2001 }
2002 
2003 ////////////////////////////////////////////////////////////////////////////////
2004 /// Slot connected to the OffSetSlider that saves the OldBinOffset
2005 /// (nessesary for delay draw mode).
2006 
2008 {
2009  if (fAvoidSignal) return;
2011 }
2012 
2013 ////////////////////////////////////////////////////////////////////////////////
2014 /// Slot connected to the OffSetSlider.
2015 /// It changes the origin of the histogram inbetween a binwidth and
2016 /// rebin the histogram with the new Offset given by the Slider.
2017 
2019 {
2020  // !!problem: histogram with variable binwidth??
2021  // computes the new histogram in "delay draw" mode
2022 
2023  if (fAvoidSignal) return;
2024  if (fDelaydraw->GetState()==kButtonDown) {
2025  Int_t num = (Int_t) fBinOffsetSld->GetPosition();
2026  TAxis* xaxis = fHist->GetXaxis();
2027  Double_t binWidth = xaxis->GetBinWidth(1);
2028  Double_t offset = 1.*num/100*binWidth;
2029  Double_t oldOffset = fOldOffset;
2030  Int_t nx = xaxis->GetNbins();
2032  if (!player) return;
2033  Int_t first = xaxis->GetFirst();
2034  Int_t last = xaxis->GetLast();
2035  Double_t min = xaxis->GetBinLowEdge(1); // overall min in user coords
2036  Double_t max = xaxis->GetBinUpEdge(nx); // overall max in user coords
2037  Double_t rmin = xaxis->GetBinLowEdge(first); // recent min in user coords
2038  Double_t rmax = xaxis->GetBinUpEdge(last); // recent max in user coords
2039 
2040  ((TH1*)player->GetHistogram())->SetCanExtend(TH1::kNoAxis);
2041  ((TH1*)player->GetHistogram())->Reset();
2042 
2043  ((TH1*)player->GetHistogram())->SetBins(nx,
2044  min+offset-oldOffset,
2045  max+offset-oldOffset);
2046  TSelectorDraw *sel = (TSelectorDraw*)player->GetSelector();
2047  if (!sel) return;
2048  sel->TakeAction();
2049 
2050  // Restore all the attributes which were changed by TakeAction()
2051  fHist = (TH1*)((TTreePlayer*)TVirtualTreePlayer::GetCurrentPlayer())->GetHistogram();
2052  xaxis->SetRange(xaxis->FindBin(rmin+offset-oldOffset+binWidth/2),
2053  xaxis->FindBin(rmax+offset-oldOffset-binWidth/2)); // in binNumbers!
2054  fSldMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
2055  fSldMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
2056  fOffsetNumberEntry->SetNumber(offset);
2057  Update();
2058  }
2059 }
2060 
2061 ////////////////////////////////////////////////////////////////////////////////
2062 /// Slot connected to the OffSetSlider.
2063 /// It changes the origin of the histogram inbetween a binwidth and
2064 /// rebin the histogram with the new offset given by the Slider.
2065 
2067 {
2068  // !!histogram with variable binwidth??
2069  // !!only works for histograms with fixed binwidth
2070 
2071  if (fAvoidSignal) return;
2072  TAxis* xaxis = fHist->GetXaxis();
2073  Double_t binWidth = xaxis->GetBinWidth(1);
2074  Double_t offset = 1.*num/100*binWidth;
2075  if (fDelaydraw->GetState()==kButtonUp) {
2076  Double_t oldOffset = fOffsetNumberEntry->GetNumber();
2077  Int_t nx = xaxis->GetNbins();
2079  if (!player) return;
2080  Int_t first = xaxis->GetFirst();
2081  Int_t last = xaxis->GetLast();
2082  Double_t min = xaxis->GetBinLowEdge(1); // overall min in user coords
2083  Double_t max = xaxis->GetBinUpEdge(nx); // overall max in user coords
2084  Double_t rmin = xaxis->GetBinLowEdge(first); // recent min in user coords
2085  Double_t rmax = xaxis->GetBinUpEdge(last); // recent max in user coords
2086 
2087  ((TH1*)player->GetHistogram())->SetCanExtend(TH1::kNoAxis);
2088  ((TH1*)player->GetHistogram())->Reset();
2089 
2090  ((TH1*)player->GetHistogram())->SetBins(nx,
2091  min+offset-oldOffset,
2092  max+offset-oldOffset);
2093  TSelectorDraw *sel = (TSelectorDraw*)player->GetSelector();
2094  if (!sel) return;
2095  sel->TakeAction();
2096 
2097  // Restore all the attributes which were changed by TakeAction()
2098  fHist = (TH1*)((TTreePlayer*)TVirtualTreePlayer::GetCurrentPlayer())->GetHistogram();
2099  xaxis->SetRange(xaxis->FindBin(rmin+offset-oldOffset+binWidth/2),
2100  xaxis->FindBin(rmax+offset-oldOffset-binWidth/2)); // in binNumbers!
2101  fSldMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
2102  fSldMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
2104  }
2105  fOffsetNumberEntry->SetNumber(offset);
2107  Update();
2108 }
2109 
2110 ////////////////////////////////////////////////////////////////////////////////
2111 /// Slot connected to the OffSetNumberEntry which is related to the
2112 /// OffSetSlider changes the origin of the histogram inbetween a binwidth.
2113 
2115 {
2116  if (fAvoidSignal) return;
2117  TAxis* xaxis = fHist->GetXaxis();
2118  Double_t binWidth = xaxis->GetBinWidth(1);
2120  Double_t oldOffset = 1.*fBinOffsetSld->GetPosition()/100*binWidth;
2121  Int_t nx = xaxis->GetNbins();
2123  if (!player) return;
2124  Int_t first = xaxis->GetFirst();
2125  Int_t last = xaxis->GetLast();
2126  Double_t min = xaxis->GetBinLowEdge(1); // overall min in user coords
2127  Double_t max = xaxis->GetBinUpEdge(nx); // overall max in user coords
2128  Double_t rmin = xaxis->GetBinLowEdge(first); // recent min in user coords
2129  Double_t rmax = xaxis->GetBinUpEdge(last); // recent max in user coords
2130 
2131  ((TH1*)player->GetHistogram())->SetCanExtend(TH1::kNoAxis);
2132  ((TH1*)player->GetHistogram())->Reset();
2133 
2134  ((TH1*)player->GetHistogram())->SetBins(nx,
2135  min+offset-oldOffset,
2136  max+offset-oldOffset);
2137  TSelectorDraw *sel = (TSelectorDraw*)player->GetSelector();
2138  if (!sel) return;
2139  sel->TakeAction();
2140 
2141  // Restore all the attributes which were changed by TakeAction()
2142  fHist = (TH1*)((TTreePlayer*)TVirtualTreePlayer::GetCurrentPlayer())->GetHistogram();
2143  xaxis->SetRange(xaxis->FindBin(rmin+offset-oldOffset+binWidth/2),
2144  xaxis->FindBin(rmax+offset-oldOffset-binWidth/2)); // in binNumbers!
2145  fSldMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
2146  fSldMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
2147  fBinOffsetSld->SetPosition((Int_t)(offset/binWidth*100));
2148  Update();
2149 }
2150 
2151 ////////////////////////////////////////////////////////////////////////////////
2152 /// Slot connected to the Apply button of the Binning tab.
2153 
2155 {
2156  Int_t ret = 0;
2157  new TGMsgBox(fClient->GetDefaultRoot(), this->GetMainFrame(),
2158  "TH1 Editor", "Replace origin histogram with rebinned one?",
2160  if (ret==1) {
2161  if (fBinHist) {
2162  delete fBinHist;
2163  fBinHist = 0;
2164  }
2165  Int_t nx = fHist->GetXaxis()->GetNbins();
2166  Int_t *div = Dividers(nx);
2167  Int_t up = 0;
2168  if (div[0]-1 <= 1) up = 2;
2169  else up = div[0]-1;
2170  fBinSlider->SetRange(1,up);
2171  if (fBinSlider->GetMaxPosition()==2 && div[0]==2 )
2172  fBinSlider->SetPosition(2);
2173  else
2174  fBinSlider->SetPosition(1);
2177  Update();
2178  delete [] div;
2179  } else if (ret==2) DoCancel();
2180 }
2181 
2182 ////////////////////////////////////////////////////////////////////////////////
2183 /// Slot connected to the Cancel button of the Binning tab.
2184 
2186 {
2187  if (fBinHist) {
2188  fGedEditor->GetPad()->cd();
2189  fHist->Reset();
2191  fBinHist->GetXaxis()->GetXmin(),
2192  fBinHist->GetXaxis()->GetXmax());
2193  fHist->Add(fBinHist);
2195  fBinHist->GetXaxis()->GetLast());
2196  delete fBinHist;
2197  fBinHist = 0;
2200  Int_t* divx = Dividers(fHist->GetXaxis()->GetNbins());
2201  if (divx[0]!=2) fBinSlider->SetPosition(1);
2202  // Consigning the new Histogram to all other Editors
2203 // fGedEditor->GetPad()->GetCanvas()->Selected(fGedEditor->GetPad(), fHist, 0);
2204  Update();
2205  //fModel = fHist;
2206  Refresh(fHist);
2207  delete [] divx;
2208  }
2209 }
2210 
2211 ////////////////////////////////////////////////////////////////////////////////
2212 /// Returns the selected histogram type (HIST, LEGO1-2, SURF1-5).
2213 
2215 {
2216  TString s="";
2217  switch (fTypeCombo->GetSelected()){
2218  case (-1) : {s = "LEGO"; break;}
2219  case (kTYPE_LEGO ): {s = "LEGO"; break;}
2220  case (kTYPE_LEGO1): {s = "LEGO1"; break;}
2221  case (kTYPE_LEGO2): {s = "LEGO2"; break;}
2222  case (kTYPE_SURF ): {s = "SURF"; break;}
2223  case (kTYPE_SURF1): {s = "SURF1"; break;}
2224  case (kTYPE_SURF2): {s = "SURF2"; break;}
2225  case (kTYPE_SURF3): {s = "SURF3"; break;}
2226  case (kTYPE_SURF4): {s = "SURF4"; break;}
2227  case (kTYPE_SURF5): {s = "SURF5"; break;}
2228  default: break;
2229  }
2230 
2231  return s;
2232 }
2233 
2234 ////////////////////////////////////////////////////////////////////////////////
2235 /// Return the selected coordinate system of the histogram (POL,CYL,SPH,PSR).
2236 
2238 {
2239  TString s="";
2240  if (fDim->GetState()!=kButtonDown) {
2241  switch (fCoordsCombo->GetSelected()){
2242  case (-1) : {s = "POL"; break;}
2243  case (kCOORDS_CAR): {s = ""; break;}
2244  case (kCOORDS_POL): {s = "POL"; break;}
2245  case (kCOORDS_CYL): {s = "CYL"; break;}
2246  case (kCOORDS_SPH): {s = "SPH"; break;}
2247  case (kCOORDS_PSR): {s = "PSR"; break;}
2248  default: break;
2249  }
2250  }
2251 
2252  return s;
2253 }
2254 
2255 ////////////////////////////////////////////////////////////////////////////////
2256 /// Return the selected error type (E,E1-5).
2257 
2259 {
2260  TString s="";
2261  switch (fErrorCombo->GetSelected()){
2262  case (-1) : {s = ""; break;}
2263  case (kERRORS_NO) : {s = ""; break;}
2264  case (kERRORS_SIMPLE) : {s = "E"; break;}
2265  case (kERRORS_EDGES) : {s = "E1"; break;}
2266  case (kERRORS_REC) : {s = "E2"; break;}
2267  case (kERRORS_FILL) : {s = "E3"; break;}
2268  case (kERRORS_CONTOUR): {s = "E4"; break;}
2269  default: break;
2270  }
2271 
2272  return s;
2273 }
2274 
2275 ////////////////////////////////////////////////////////////////////////////////
2276 /// Return the selected shape of the histogram (C, L, LF2).
2277 
2279 {
2280  TString s="";
2281  switch (fAddCombo->GetSelected()){
2282  case (-1) : {s = "" ; break;}
2283  case (kADD_NONE) : {s = "" ; break;}
2284  case (kADD_SMOOTH): {s = "C"; break;}
2285  case (kADD_SIMPLE): {s = "L"; break;}
2286  case (kADD_FILL) : {s = "LF2"; break;}
2287  default : break;
2288  }
2289  if (fAddMarker->GetState()==kButtonDown) s += "P";
2290  if (fAddB->GetState()==kButtonDown) s += "B";
2291  if (fAddBar->GetState()==kButtonDown){
2292  if (fMakeHBar->GetState()==kButtonDown) s+="H";
2293  switch (fPercentCombo->GetSelected()){
2294  case (kPER_0) : { s += "BAR" ; break;}
2295  case (kPER_10): { s += "BAR1"; break;}
2296  case (kPER_20): { s += "BAR2"; break;}
2297  case (kPER_30): { s += "BAR3"; break;}
2298  case (kPER_40): { s += "BAR4"; break;}
2299  }
2300  }
2301 
2302  return s;
2303 }
2304 
2305 ////////////////////////////////////////////////////////////////////////////////
2306 /// Create histogram type combo box.
2307 
2309 {
2310  TGComboBox *c = new TGComboBox(parent, id);
2311 
2312  c->AddEntry("Lego" , kTYPE_LEGO);
2313  c->AddEntry("Lego1", kTYPE_LEGO1);
2314  c->AddEntry("Lego2", kTYPE_LEGO2);
2315  c->AddEntry("Surf" , kTYPE_SURF);
2316  c->AddEntry("Surf1", kTYPE_SURF1);
2317  c->AddEntry("Surf2", kTYPE_SURF2);
2318  c->AddEntry("Surf3", kTYPE_SURF3);
2319  c->AddEntry("Surf4", kTYPE_SURF4);
2320  c->AddEntry("Surf5", kTYPE_SURF5);
2321 
2322  return c;
2323 }
2324 
2325 ////////////////////////////////////////////////////////////////////////////////
2326 /// Create coordinate system type combo box.
2327 
2329 {
2330  TGComboBox *c = new TGComboBox(parent, id);
2331 
2332  c->AddEntry("Cartesian", kCOORDS_CAR);
2333  c->AddEntry("Cylindric", kCOORDS_CYL);
2334  c->AddEntry("Polar", kCOORDS_POL);
2335  c->AddEntry("Rapidity", kCOORDS_PSR);
2336  c->AddEntry("Spheric", kCOORDS_SPH);
2337  TGListBox* lb = c->GetListBox();
2338  lb->Resize(lb->GetWidth(), 83);
2339 
2340  return c;
2341 }
2342 
2343 ////////////////////////////////////////////////////////////////////////////////
2344 /// Create error type combo box.
2345 
2347 {
2348  TGComboBox *c = new TGComboBox(parent, id);
2349 
2350  c->AddEntry("No Errors", kERRORS_NO);
2351  c->AddEntry("Simple", kERRORS_SIMPLE);
2352  c->AddEntry("Edges", kERRORS_EDGES);
2353  c->AddEntry("Rectangles",kERRORS_REC);
2354  c->AddEntry("Fill", kERRORS_FILL);
2355  c->AddEntry("Contour", kERRORS_CONTOUR);
2356 
2357  return c;
2358 }
2359 
2360 ////////////////////////////////////////////////////////////////////////////////
2361 /// Create Line/Bar combo box.
2362 
2364 {
2365  TGComboBox *c = new TGComboBox(parent, id);
2366 
2367  c->AddEntry("No Line", kADD_NONE);
2368  c->AddEntry("Simple Line", kADD_SIMPLE);
2369  c->AddEntry("Smooth Line", kADD_SMOOTH);
2370  c->AddEntry("Fill Area",kADD_FILL);
2371  TGListBox* lb = c->GetListBox();
2372  lb->Resize(lb->GetWidth(), 76);
2373  return c;
2374 }
2375 
2376 ////////////////////////////////////////////////////////////////////////////////
2377 /// Create Percentage combo box for bar option.
2378 
2380 {
2381  TGComboBox *c = new TGComboBox(parent, id);
2382 
2383  c->AddEntry(" 0 %", kPER_0);
2384  c->AddEntry("10 %", kPER_10);
2385  c->AddEntry("20 %", kPER_20);
2386  c->AddEntry("30 %", kPER_30);
2387  c->AddEntry("40 %", kPER_40);
2388  TGListBox* lb = c->GetListBox();
2389  lb->Resize(lb->GetWidth(), 83);
2390 
2391  return c;
2392 }
2393 
2394 ////////////////////////////////////////////////////////////////////////////////
2395 /// Change the error combo box entry.
2396 
2398 {
2399  switch (i){
2400  case 0: {
2401  if (((TGLBContainer*)((TGListBox*)fErrorCombo->GetListBox())->GetContainer())->GetPos(kERRORS_EDGES)!=-1)
2405  TGListBox* lb = fErrorCombo->GetListBox();
2406  lb->Resize(lb->GetWidth(),36);
2407  break;
2408  }
2409  case 1: {
2410  if (((TGLBContainer*)((TGListBox*)fErrorCombo->GetListBox())->GetContainer())->GetPos(kERRORS_EDGES)==-1) {
2411  fErrorCombo->AddEntry("Edges", kERRORS_EDGES);
2412  fErrorCombo->AddEntry("Rectangles",kERRORS_REC);
2413  fErrorCombo->AddEntry("Fill", kERRORS_FILL);
2414  fErrorCombo->AddEntry("Contour", kERRORS_CONTOUR);
2415  TGListBox* lb = fErrorCombo->GetListBox();
2416  lb->Resize(lb->GetWidth(),100);
2417  }
2418  break;
2419  }
2420  }
2421 }
2422 
2423  ///////////////////////////////////////////////////////////////////////////////
2424  /// Paint a 3D box.
2425 
2427 {
2428  if (fGedEditor->GetPad()->GetCanvas())
2432  fGedEditor->GetPad()->cd();
2433  fGedEditor->GetPad()->PaintLine3D(p1, p2);
2434  fGedEditor->GetPad()->PaintLine3D(p2, p3);
2435  fGedEditor->GetPad()->PaintLine3D(p3, p4);
2436  fGedEditor->GetPad()->PaintLine3D(p4, p1);
2437 }
2438 
2439 ////////////////////////////////////////////////////////////////////////////////
2440 /// Return an array of dividers of n (without the trivial divider n).
2441 /// The number of dividers is saved in the first entry.
2442 
2444 {
2445  Int_t* div;
2446  if (n <= 0) {
2447  div = new Int_t[1];
2448  div[0]=0;
2449  } else if (n == 1) {
2450  div = new Int_t[2];
2451  div[0]=div[1]=1;
2452  } else {
2453  div = new Int_t[(Int_t) n/2+2];
2454  div[0]=0;
2455  div[1]=1;
2456 
2457  Int_t num = 1;
2458  for (Int_t i=2; i <= n/2; i++) {
2459  if (n % i == 0) {
2460  num++;
2461  div[num] = i;
2462  }
2463  }
2464  num++;
2465  div[num]=n;
2466  div[0] = num;
2467 // for (Int_t a=0; a <= div[0]; a++) printf("div[%d] = %d\n", a , div[a]);
2468  }
2469  return div;
2470 }
2471 
2472 ////////////////////////////////////////////////////////////////////////////////
2473 /// If the contained histogram obj is deleted we must set its pointer to zero
2474 
2476 {
2477  if (obj == fHist) {
2478  fHist = 0;
2479  }
2480 }
virtual void HideFrame(TGFrame *f)
Hide sub frame.
Definition: TGFrame.cxx:1174
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:589
TGNumberEntry * fBarOffset
Definition: TH1Editor.h:64
TString GetHistTypeLabel()
Returns the selected histogram type (HIST, LEGO1-2, SURF1-5).
Definition: TH1Editor.cxx:2214
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:1113
TGCompositeFrame * fBinCont
Definition: TH1Editor.h:76
virtual void Resize(UInt_t w, UInt_t h)
Resize the listbox widget.
Definition: TGListBox.cxx:1420
Float_t fP2old[3]
Definition: TH1Editor.h:112
virtual void ConnectSignals2Slots()
Connect signals to slots.
Definition: TH1Editor.cxx:557
virtual TVirtualPad * GetPad() const
Definition: TGedEditor.h:89
Int_t GetFirst() const
Return first bin on the axis i.e.
Definition: TAxis.cxx:455
virtual Float_t GetMaxPosition() const
virtual void DoPercent()
Slot connected to the bar percentage settings.
Definition: TH1Editor.cxx:1440
virtual void DoHistComplex()
Slot connected to the 3D radio button.
Definition: TH1Editor.cxx:1260
virtual Int_t GetPosition() const
Definition: TGSlider.h:109
float Float_t
Definition: RtypesCore.h:55
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:8393
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:515
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:2328
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:2363
virtual void SetBins(Int_t nx, Double_t xmin, Double_t xmax)
Redefine x axis parameters.
Definition: TH1.cxx:8223
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:2114
virtual void DoCancel()
Slot connected to the Cancel button of the Binning tab.
Definition: TH1Editor.cxx:2185
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:404
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:1188
#define f(i)
Definition: RSha256.hxx:104
int Int_t
Definition: RtypesCore.h:43
virtual void DoAddBar(Bool_t)
Slot connected to the bar Add check box.
Definition: TH1Editor.cxx:1016
virtual void DoBarOffset()
Slot connected to the Bar Offset of the Bar Charts.
Definition: TH1Editor.cxx:1429
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:2278
TGComboBox * fPercentCombo
Definition: TH1Editor.h:66
UInt_t GetWidth() const
Definition: TGFrame.h:249
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:2397
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:1241
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:1823
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:6736
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
Definition: TAxis.cxx:525
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:939
virtual void PaintBox3D(Float_t *p1, Float_t *p2, Float_t *p3, Float_t *p4)
Paint a 3D box.
Definition: TH1Editor.cxx:2426
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:365
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:1762
Bool_t Contains(Int_t x, Int_t y) const
Definition: TGFrame.h:263
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:1506
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:451
TGCompositeFrame(const TGCompositeFrame &)
virtual void DoApply()
Slot connected to the Apply button of the Binning tab.
Definition: TH1Editor.cxx:2154
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:627
virtual const TGWindow * GetMainFrame() const
Returns top level main frame.
Definition: TGWindow.cxx:134
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:1903
virtual void DoBarWidth()
Slot connected to the Bar Width of the Bar Charts.
Definition: TH1Editor.cxx:1419
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 TSelector * GetSelector() const
Definition: TTreePlayer.h:82
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:2475
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:1117
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:866
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:914
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:2237
Int_t GetLast() const
Return last bin on the axis i.e.
Definition: TAxis.cxx:466
virtual void DoSliderPressed()
Slot connected to the x-axis Range slider for initialising the values of the slider movement...
Definition: TH1Editor.cxx:1605
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:2443
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:613
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:5904
unsigned int UInt_t
Definition: RtypesCore.h:44
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:1027
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:2066
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:1956
virtual void DoBinReleased()
Slot connected to the rebin slider in case of a not ntuple histogram Updates some other widgets which...
Definition: TH1Editor.cxx:1707
virtual Double_t * GetRmin()=0
#define gVirtualX
Definition: TVirtualX.h:338
static TGComboBox * BuildHistTypeComboBox(TGFrame *parent, Int_t id)
Create histogram type combo box.
Definition: TH1Editor.cxx:2308
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:1841
virtual void DoHistView()
Slot connected to the &#39;Plot&#39; button group.
Definition: TH1Editor.cxx:1151
const Bool_t kFALSE
Definition: RtypesCore.h:90
virtual void DoAxisRange()
Slot connected to the number entry fields containing the Max/Min value of the x-axis.
Definition: TH1Editor.cxx:1683
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:290
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:216
#define d(i)
Definition: RSha256.hxx:102
virtual void DoBinLabel()
Slot connected to the Bin number entry of the Rebinning tab.
Definition: TH1Editor.cxx:1926
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:361
virtual void Resize(UInt_t w, UInt_t h)
Resize the frame.
Definition: TGSlider.h:173
TGHSlider * fBinSlider1
Definition: TH1Editor.h:79
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:2258
static TGComboBox * BuildHistErrorComboBox(TGFrame *parent, Int_t id)
Create error type combo box.
Definition: TH1Editor.cxx:2346
virtual void DoHBar(Bool_t on)
Slot connected to the Horizontal Bar check button.
Definition: TH1Editor.cxx:1480
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:1024
virtual Double_t GetEntries() const
Return the current number of entries.
Definition: TH1.cxx:4302
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1101
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:778
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:6291
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:917
TGCompositeFrame * f6
Definition: TH1Editor.h:68
virtual Double_t GetBinWidth(Int_t bin) const
Return bin width.
Definition: TAxis.cxx:537
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:1308
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:2665
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:287
#define c(i)
Definition: RSha256.hxx:101
virtual void DoAddB(Bool_t)
Slot connected to the bar Add check box.
Definition: TH1Editor.cxx:973
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:516
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set check button state.
Definition: TGButton.cxx:1202
virtual void SetTitle(const char *title)
See GetStatOverflows for more information.
Definition: TH1.cxx:6345
static TGComboBox * BuildPercentComboBox(TGFrame *parent, Int_t id)
Create Percentage combo box for bar option.
Definition: TH1Editor.cxx:2379
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:927
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:175
virtual void DoSliderReleased()
Slot connected to the x-axis Range slider for finalizing the values of the slider movement...
Definition: TH1Editor.cxx:1660
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:89
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:1170
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:397
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:2018
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:153
virtual void DoOffsetPressed()
Slot connected to the OffSetSlider that saves the OldBinOffset (nessesary for delay draw mode)...
Definition: TH1Editor.cxx:2007
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
virtual ~TH1Editor()
Destructor of TH1 editor.
Definition: TH1Editor.cxx:539
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:187
virtual void SetEnabled(Int_t tabIndex, Bool_t on=kTRUE)
Enable or disable tab.
Definition: TGTab.cxx:436
const char * Data() const
Definition: TString.h:364