Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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/** \class TH1Editor
14 \ingroup ged
15
16Editor for changing TH1 histogram attributes, rebinning & fitting.
17For all possible draw options (there are a few which are not implementable
18in graphical user interface) see THistPainter::Paint
19
20 These changes can be made via the TH1Editor:
21 Style Tab:
22 'Line' : change Line attributes (color, thickness)
23 see TAttLineEditor
24 'Fill' : change Fill attributes (color, pattern)
25 see TAttFillEditor
26 'Title' : TextEntry: set the title of the histogram
27 'Histogram': change the draw options of the histogram
28 'Plot' : Radiobutton: draw a 2D or 3D plot of the histogram
29 according to the Plot dimension there will be
30 different drawing possibilities (ComboBoxes/
31 CheckBoxes)
32 2d Plot:
33 'Error' : ComboBox: add different error bars to the histogram
34 (no errors, simple, ..., see THistPainter::Paint
35 'Add' : ComboBox: further things which can be added to the
36 histogram (None, simple/smooth line, fill area
37 'Simple Drawing': CheckBox: draw a simple histogram without
38 errors (= "HIST" drawoption). In combination with
39 some other draw options an outer line is drawn on
40 top of the histogram
41 'Show markers': CheckBox: draw a marker on to of each bin (="P"
42 drawoption)
43 'Draw bar chart': CheckBox: draw a bar chart (="B" drawoption)
44 change the Fill Color with Fill in the Style Tab
45 => will show Bar menue in the Style Tab
46 'Bar option': CheckBox: draw a bar chart (="BAR" drawoption)
47 => will show Bar menue in the Style Tab
48 3d Plot:
49 'Type' : ComboBox: set histogram type Lego-Plot or Surface
50 draw(Lego, Lego1.2, Surf, Surf1..5)
51 see THistPainter::Paint
52 'Coords' : ComboBox: set the coordinate system (Cartesian, ..
53 Spheric) see THistPainter::Paint
54 'Error' : see 2D plot
55 'Bar' : change the bar attributes
56 'W' : change Bar Width
57 'O' : change Bar Offset
58 'Percentage': specifies the percentage of the bar which is drawn
59 brighter and darker (10% == BAR1 drawoption)
60 'Horizontal Bar': draw a horizontal bar chart
61
62 'Marker' : change the Marker attributes (color, appearance,
63 thickness) see TAttMarkerEditor
64
65 This Tab has two different layouts. One is for a histogram which
66 is not drawn from an ntuple. The other one is available for a
67 histogram which is drawn from an ntuple. In this case the rebin
68 algorithm can create a rebinned histogram from the original data
69 i.e. the ntuple.
70 To see te differences do:
71 TFile f("hsimple.root");
72 hpx->Draw("BAR1"); // non ntuple histogram
73 ntuple->Draw("px"); // ntuple histogram
74 Non ntuple histogram:
75 'Rebin': with the Slider the number of bins (shown in the field
76 below the Slider) can be changed to any number which
77 divides the number of bins of the original histogram.
78 Pushing 'Apply' will delete the origin histogram and
79 replace it by the rebinned one on the screen
80 Pushing 'Ignore' the origin histogram will be restored
81 Histogram drawn from an ntuple:
82 'Rebin' with the slider the number of bins can be enlarged by
83 a factor of 2,3,4,5 (moving to the right) or reduced
84 by a factor of 1/2, 1/3, 1/4, 1/5
85 'BinOffset': with the BinOffset slider the origin of the
86 histogram can be changed within one binwidth
87 Using this slider the effect of binning the data into
88 bins can be made visible => statistical fluctuations
89 'Axis Range': with the DoubleSlider it is possible to zoom into
90 the specified axis range. It is also possible to set
91 the upper and lower limit in fields below the slider
92 'Delayed drawing': all the Binning sliders can set to delay
93 draw mode. Then the changes on the histogram are only
94 updated, when the Slider is released. This should be
95 activated if the redrawing of the histogram is too
96 time consuming. //
97
98*/
99
100
101
102#include "TH1Editor.h"
103#include "TH1.h"
104#include "TGedEditor.h"
105#include "TGComboBox.h"
106#include "TGTextEntry.h"
107#include "TGLabel.h"
108#include "TVirtualPad.h"
109#include "TString.h"
110#include "TGButtonGroup.h"
111#include "TGNumberEntry.h"
112#include "TG3DLine.h"
113#include "TGDoubleSlider.h"
114#include "TGSlider.h"
115#include "TView.h"
116#include "TCanvas.h"
117#include "TTreePlayer.h"
118#include "TSelectorDraw.h"
119#include "TGMsgBox.h"
120#include "TGTab.h"
121#include "TROOT.h"
122#include "TVirtualX.h"
123
124#include <cstdlib>
125
127
145
146
147////////////////////////////////////////////////////////////////////////////////
148/// Constructor of histogram attribute GUI.
149
151 Int_t height, UInt_t options, Pixel_t back)
152 : TGedFrame(p, width, height, options | kVerticalFrame, back),
153 fHist(0),
154 fSameOpt(kFALSE),
155 fBin(0),
156 fBinHist(0)
157{
158 // TextEntry for changing the title of the histogram
159 MakeTitle("Title");
160 fTitlePrec = 2;
161 fTitle = new TGTextEntry(this, new TGTextBuffer(50), kTH1_TITLE);
163 fTitle->SetToolTipText("Enter the histogram title string");
164 AddFrame(fTitle, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5));
165
166 // Histogram draw options
167 TGCompositeFrame *fHistLbl = new TGCompositeFrame(this, 145, 10,
169 kFitWidth |
172 fHistLbl->AddFrame(new TGLabel(fHistLbl,"Histogram"),
173 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
174 fHistLbl->AddFrame(new TGHorizontal3DLine(fHistLbl),
175 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 0));
176 AddFrame(fHistLbl, new TGLayoutHints(kLHintsTop,0,0,2,0));
177
178 // TGButtonGroup to change: 2D plot <-> 3D plot
179 TGCompositeFrame *f2 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
180 fDimGroup = new TGHButtonGroup(f2,"Plot");
183 fDim->SetToolTipText("A 2-d plot of the histogram is dawn");
185 fDim0->SetToolTipText("A 3-d plot of the histogram is dawn");
188 fDimGroup->Show();
190 f2->AddFrame(fDimGroup, new TGLayoutHints(kLHintsTop, 4, 1, 0, 0));
191 AddFrame(f2, new TGLayoutHints(kLHintsTop, 1, 1, 2, 8));
192
193 // Set the type of histogram (Lego0..2, Surf0..5) for 3D plot
194 f3 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
195 AddFrame(f3, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
196
197 TGCompositeFrame *f3a = new TGCompositeFrame(f3, 40, 20);
198 f3->AddFrame(f3a, new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
199 TGLabel *fType = new TGLabel(f3a, "Add: ");
200 f3a->AddFrame(fType, new TGLayoutHints(kLHintsLeft, 6, 1, 4, 4));
201 TGLabel *fCoords = new TGLabel(f3a, "Coords:");
202 f3a->AddFrame(fCoords, new TGLayoutHints(kLHintsLeft, 6, 1, 4, 1));
203
204 TGCompositeFrame *f3b = new TGCompositeFrame(f3, 40, 20);
205 f3->AddFrame(f3b, new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
207 f3b->AddFrame(fTypeCombo, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 1));
208 fTypeCombo->Resize(80, 20);
209 fTypeCombo->Associate(this);
210 //Set the coordinate system (Cartesian, Spheric, ...)
212 f3b->AddFrame(fCoordsCombo, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 1));
213 fCoordsCombo->Resize(80, 20);
214 fCoordsCombo->Associate(this);
215
216 // Set the Error (No error, error1..5)
217 TGCompositeFrame *f5 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
218 AddFrame(f5, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
219
220 TGCompositeFrame *f5a = new TGCompositeFrame(f5, 40, 20);
221 f5->AddFrame(f5a, new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
222 TGLabel *fError = new TGLabel(f5a, "Error:");
223 f5a->AddFrame(fError, new TGLayoutHints(kLHintsLeft, 6, 2, 4, 1));
224
225 TGCompositeFrame *f5b = new TGCompositeFrame(f5, 40, 20);
226 f5->AddFrame(f5b, new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
228 f5b->AddFrame(fErrorCombo, new TGLayoutHints(kLHintsLeft, 15, 1, 2, 1));
229 fErrorCombo->Resize(80, 20);
230 fErrorCombo->Associate(this);
231
232 // Further draw options: Smooth/Simple Line, Fill Area for 2D plot
233 f6 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
234 AddFrame(f6, new TGLayoutHints(kLHintsTop, 1, 1, 0, 3));
235
236 TGCompositeFrame *f6a = new TGCompositeFrame(f6, 40, 20);
237 f6->AddFrame(f6a, new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
238 TGLabel *fAddLabel = new TGLabel(f6a, "Style:");
239 f6a->AddFrame(fAddLabel, new TGLayoutHints(kLHintsLeft, 6, 2, 4, 1));
240
241 TGCompositeFrame *f6b = new TGCompositeFrame(f6, 40, 20);
242 f6->AddFrame(f6b, new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
244 f6b->AddFrame(fAddCombo, new TGLayoutHints(kLHintsLeft, 15, 1, 2, 1));
245 fAddCombo->Resize(80, 20);
246 fAddCombo->Associate(this);
247
248 // option related to HIST: some changes needed here!
249 // because of inconsistencies
250 f15 = new TGCompositeFrame(this, 80, 20, kVerticalFrame);
251 fAddSimple = new TGCheckButton(f15, "Simple Drawing", kADD_LINE);
252 fAddSimple ->SetToolTipText("A simple histogram without errors is drawn (draw option: Hist)");
253 f15->AddFrame(fAddSimple, new TGLayoutHints(kLHintsLeft, 6, 1, 1, 0));
254 AddFrame(f15, new TGLayoutHints(kLHintsTop, 1, 1, 0, -1));
255
256 // Show Marker Checkbox: draw marker (or not)
257 f7 = new TGCompositeFrame(this, 80, 20, kVerticalFrame);
258 fAddMarker = new TGCheckButton(f7, "Show markers", kMARKER_ONOFF);
259 fAddMarker ->SetToolTipText("Make marker visible/invisible");
260 f7->AddFrame(fAddMarker, new TGLayoutHints(kLHintsLeft, 6, 1, 1, 0));
261 AddFrame(f7, new TGLayoutHints(kLHintsTop, 1, 1, 2, 0));
262
263 // Bar Chart Checkbox: draw with option B
264 f8 = new TGCompositeFrame(this, 80, 20, kVerticalFrame);
265 fAddB = new TGCheckButton(f8, "Draw bar chart", kB_ONOFF);
266 fAddB ->SetToolTipText("Draw a bar chart");
267 f8->AddFrame(fAddB, new TGLayoutHints(kLHintsLeft, 6, 1, 1, 0));
268 AddFrame(f8, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
269
270 // Bar CheckBox: draw with option BAR +option selected by
271 // fPercentCombo (0..4) e.g. BAR2
272 f9 = new TGCompositeFrame(this, 80, 20, kVerticalFrame);
273 fAddBar = new TGCheckButton(f9, "Bar option", kBAR_ONOFF);
274 fAddBar ->SetToolTipText("Draw bar chart with bar-option");
275 f9->AddFrame(fAddBar, new TGLayoutHints(kLHintsLeft, 6, 1, 1, 0));
276 AddFrame(f9, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
277
278 // Bar Menu => appears when the BAR checkbox is set
279 f10 = new TGCompositeFrame(this, 145, 10, kHorizontalFrame |
280 kFitWidth |
283 f10->AddFrame(new TGLabel(f10,"Bar"),
284 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
286 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
287 AddFrame(f10, new TGLayoutHints(kLHintsTop,0,0,6,4));
288
289 // NumberEntry to change the Bar Width
290 f11 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
291 TGLabel *fWidthLbl = new TGLabel(f11, "W:");
292 f11->AddFrame(fWidthLbl, new TGLayoutHints(kLHintsLeft, 1, 3, 4, 1));
293 fBarWidth = new TGNumberEntry(f11, 1.00, 6, kBAR_WIDTH,
297 fBarWidth->GetNumberEntry()->SetToolTipText("Set bin bar width");
298 fBarWidth->Resize(45,20);
299 f11->AddFrame(fBarWidth, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 1));
300
301 // NumberEntry to change the Bar OFfset
302 TGLabel *foffsetLbl = new TGLabel(f11, "O:");
303 f11->AddFrame(foffsetLbl, new TGLayoutHints(kLHintsLeft, 6,3, 4, 1));
304 fBarOffset = new TGNumberEntry(f11, 0.00, 5, kBAR_OFFSET,
308 fBarOffset->GetNumberEntry()->SetToolTipText("Set bin bar offset");
309 fBarOffset->Resize(50,20);
310 f11->AddFrame(fBarOffset, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 1));
311 AddFrame(f11, new TGLayoutHints(kLHintsTop, 1, 1, 0, 4));
312
313 // ComboBox which specifies the width of the Bar which should be drawn
314 // in another color i.e. specifies the number in BAR option e.g. BAR2
315 f12 = new TGCompositeFrame(this, 80, 20, kVerticalFrame);
317 TGLabel *percentLabel = new TGLabel(f13, "Percentage:");
318 f13->AddFrame(percentLabel, new TGLayoutHints(kLHintsLeft, 6, 1, 3, 1));
320 fPercentCombo->Resize(51, 20);
322 f13->AddFrame(fPercentCombo, new TGLayoutHints(kLHintsLeft, 14, 1, 2, 1));
323 f12->AddFrame(f13,new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
324
325 // CHeckBox for horizontal drawing of the Histogram
326 fMakeHBar = new TGCheckButton(f12, "Horizontal Bar", kBAR_H);
327 fMakeHBar ->SetToolTipText("Draw a horizontal bar chart with hBar-Option");
328 f12->AddFrame(fMakeHBar, new TGLayoutHints(kLHintsLeft, 6, 1, 3, 0));
329 AddFrame(f12, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
330
331 CreateBinTab();
332
333 // add itself in the least of cleanups to be notified when attached histogram is deleted
334 gROOT->GetListOfCleanups()->Add(this);
335}
336
337////////////////////////////////////////////////////////////////////////////////
338/// Create binning tab.
339
341{
342 fBin = CreateEditorTabSubFrame("Binning");
343
344 TGCompositeFrame *title1 = new TGCompositeFrame(fBin, 145, 10,
346 kFitWidth |
349 title1->AddFrame(new TGLabel(title1, "Rebin"),
350 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
351 title1->AddFrame(new TGHorizontal3DLine(title1),
352 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
353 fBin->AddFrame(title1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
354
355 // Widgets for rebinning a histogram which does NOT derive from a ntuple
357 TGCompositeFrame *f18 = new TGCompositeFrame(fBinCont, 80, 20,
359 fBinSlider = new TGHSlider(f18, 100, kSlider1 | kScaleBoth);
360 fBinSlider->Resize(107,20);
361 f18->AddFrame(fBinSlider, new TGLayoutHints(kLHintsLeft, 3,0,0,3));
362 fBinCont->AddFrame(f18, new TGLayoutHints(kLHintsTop, 15, 7, 3, 5));
363
364 TGCompositeFrame *f20 = new TGCompositeFrame(fBinCont, 80, 20,
366 TGLabel *binLabel1 = new TGLabel(f20, "# of Bins:");
367 f20->AddFrame(binLabel1, new TGLayoutHints(kLHintsLeft, 7, 1, 2, 1));
370 ((TGTextEntry*)fBinNumberEntry)->SetToolTipText("Set the number of bins in the rebinned histogram");
371 fBinNumberEntry->Resize(57,20);
372 f20->AddFrame(fBinNumberEntry, new TGLayoutHints(kLHintsRight, 21, 0, 0, 0));
373 fBinCont->AddFrame(f20, new TGLayoutHints(kLHintsTop, 0, 7, 3, 4));
374
375 // Text buttons to Apply or Delete the rebinned histogram
376 TGCompositeFrame *f23 = new TGCompositeFrame(fBinCont, 118, 20,
379 fApply = new TGTextButton(f23, " &Apply ");
380 f23->AddFrame(fApply,
381 new TGLayoutHints(kLHintsExpandX | kLHintsLeft , 0, 3, 4, 4));
382 fCancel = new TGTextButton(f23, " &Ignore ");
383 f23->AddFrame(fCancel,
384 new TGLayoutHints(kLHintsExpandX | kLHintsLeft, 3, 0, 4, 4));
385 fBinCont->AddFrame(f23, new TGLayoutHints(kLHintsTop, 20, 3, 3, 4));
387
388 // Widgets for rebinning a histogram which derives from a ntuple
392 fBinSlider1 = new TGHSlider(f21, 100, kSlider1 | kScaleBoth);
393 fBinSlider1->Resize(107,20);
394 fBinSlider1->SetRange(1,9);
397 f21->AddFrame(fBinSlider1, new TGLayoutHints(kLHintsLeft, 3,0,0,3));
398 fBinCont1->AddFrame(f21, new TGLayoutHints(kLHintsTop, 15, 7, 5, 0));
399
400 // Lettering of the Rebin Slider
403 TGLabel *l1 = new TGLabel(f24, "-5");
404 f24->AddFrame(l1, new TGLayoutHints(kLHintsLeft, 18, 1, -1, 0));
405 TGLabel *l2 = new TGLabel(f24, "-2");
406 f24->AddFrame(l2, new TGLayoutHints(kLHintsLeft, 26, 2, -1, 0));
407 TGLabel *l3 = new TGLabel(f24, "2");
408 f24->AddFrame(l3, new TGLayoutHints(kLHintsLeft, 17, 2, -1, 0));
409 TGLabel *l4 = new TGLabel(f24, "5");
410 f24->AddFrame(l4, new TGLayoutHints(kLHintsLeft, 32, 3, -1, 0));
411 fBinCont1->AddFrame(f24, new TGLayoutHints(kLHintsTop, 0, 0, 0, 0));
412
413 TGCompositeFrame *f22 = new TGCompositeFrame(fBinCont1, 140, 20,
415 TGLabel *binLabel2 = new TGLabel(f22, "# of Bins:");
416 f22->AddFrame(binLabel2, new TGLayoutHints(kLHintsLeft, 7, 1, 4, 1));
417
420 ((TGTextEntry*)fBinNumberEntry1)->SetToolTipText("Set the number of bins in the rebinned histogram");
421 fBinNumberEntry1->Resize(57,20);
422 f22->AddFrame(fBinNumberEntry1, new TGLayoutHints(kLHintsLeft, 21, 0, 2, 0));
423 fBinCont1->AddFrame(f22, new TGLayoutHints(kLHintsTop, 0, 7, 2, 4));
424
427 TGLabel *offsetLbl = new TGLabel(f26, "BinOffset:");
428 f26->AddFrame(offsetLbl, new TGLayoutHints(kLHintsLeft, 6, 1, 2, 1));
433 0., 1.);
434 ((TGTextEntry*)fOffsetNumberEntry)->SetToolTipText("Add an offset to the origin of the histogram");
437 new TGLayoutHints(kLHintsRight, 21, 0, 0, 0));
438 fBinCont1->AddFrame(f26, new TGLayoutHints(kLHintsTop, 0, 7, 3, 1));
439
442 fBinOffsetSld = new TGHSlider(f25, 100, kSlider1 | kScaleBoth);
443 fBinOffsetSld->Resize(107,20);
444 f25->AddFrame(fBinOffsetSld, new TGLayoutHints(kLHintsLeft, 15,0,0,2));
445 fBinCont1->AddFrame(f25, new TGLayoutHints(kLHintsTop, 3, 7, 3, 3));
447
448 // Sliders for axis range
449 TGCompositeFrame *sldCont = new TGCompositeFrame(fBin, 80, 20,
451 TGCompositeFrame *title2 = new TGCompositeFrame(sldCont, 145, 10,
453 kFitWidth |
456 title2->AddFrame(new TGLabel(title2, "Axis Range"),
457 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
458 title2->AddFrame(new TGHorizontal3DLine(title2),
459 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
460 sldCont->AddFrame(title2, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
461
462 TGCompositeFrame *f14 = new TGCompositeFrame(sldCont, 80, 20,
464 TGLabel *fSliderLbl = new TGLabel(f14,"x:");
465 f14->AddFrame(fSliderLbl,
466 new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 4,4, 4, 1));
467 fSlider = new TGDoubleHSlider(f14, 1, 2);
468 fSlider->Resize(118,20);
470 sldCont->AddFrame(f14, new TGLayoutHints(kLHintsTop, 3, 7, 4, 1));
471
472 TGCompositeFrame *f16 = new TGCompositeFrame(sldCont, 80, 20,
474 fSldMin = new TGNumberEntryField(f16, kSLIDER_MIN, 0.0,
477 ((TGTextEntry*)fSldMin)->SetToolTipText("Set the minimum value of the x-axis");
478 fSldMin->Resize(57,20);
479 f16->AddFrame(fSldMin, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
480 fSldMax = new TGNumberEntryField(f16, kSLIDER_MAX, 0.0,
483 ((TGTextEntry*)fSldMax)->SetToolTipText("Set the maximum value of the x-axis");
484 fSldMax->Resize(57,20);
485 f16->AddFrame(fSldMax, new TGLayoutHints(kLHintsLeft, 4, 0, 0, 0));
486 sldCont->AddFrame(f16, new TGLayoutHints(kLHintsTop, 20, 3, 5, 0));
487
488 TGCompositeFrame *f17 = new TGCompositeFrame(sldCont, 80, 20, kVerticalFrame);
489 fDelaydraw = new TGCheckButton(f17, "Delayed drawing", kDELAYED_DRAWING);
490 fDelaydraw ->SetToolTipText("Draw the new histogram only when any Slider is released");
491 f17->AddFrame(fDelaydraw, new TGLayoutHints(kLHintsLeft, 6, 1, 2, 0));
492 sldCont->AddFrame(f17, new TGLayoutHints(kLHintsTop, 1, 1, 5, 0));
493 fBin->AddFrame(sldCont, new TGLayoutHints(kLHintsTop));
494
495 // to avoid jumping from DoAddBar to DoAddB and vice versa
497 // to avoid calling SetDrawoption after every change
498 fMake=kTRUE;
499
500 fBinHist = 0; // used to save a copy of the histogram
501
502 // (when not drawn from an ntuple)
503 fBinOffsetSld->SetRange(0,100);
508
509} // end bin tab
510
511////////////////////////////////////////////////////////////////////////////////
512/// Destructor of TH1 editor.
513
515{
516 // remove itselef from the list of cleanups
517 gROOT->GetListOfCleanups()->Remove(this);
518
519 // children of TGButonGroup are not deleted
520 delete fDim;
521 delete fDim0;
522 delete fDimlh;
523 delete fDim0lh;
524
525 if (fBinHist) delete fBinHist;
526 fBinHist = 0;
527}
528
529////////////////////////////////////////////////////////////////////////////////
530/// Connect signals to slots.
531
533{
534 //widgets for draw options
535 fAddB->Connect("Toggled(Bool_t)", "TH1Editor", this, "DoAddB(Bool_t)");
536 fAddBar->Connect("Toggled(Bool_t)", "TH1Editor", this, "DoAddBar(Bool_t)");
537 fTitle->Connect("TextChanged(const char *)", "TH1Editor", this, "DoTitle(const char *)");
538 fTypeCombo->Connect("Selected(Int_t)", "TH1Editor", this, "DoHistChanges()");
539 fCoordsCombo->Connect("Selected(Int_t)", "TH1Editor", this, "DoHistChanges()");
540 fErrorCombo->Connect("Selected(Int_t)", "TH1Editor", this, "DoHistChanges()");
541 fAddCombo->Connect("Selected(Int_t)", "TH1Editor", this, "DoHistChanges()");
542 fAddMarker->Connect("Toggled(Bool_t)", "TH1Editor", this, "DoAddMarker(Bool_t)");
543 fAddSimple->Connect("Toggled(Bool_t)", "TH1Editor", this, "DoAddSimple(Bool_t)");
544
545 //change 2D <-> 3D plot
546 fDimGroup->Connect("Clicked(Int_t)","TH1Editor",this,"DoHistView()");
547
548 // change Bar Width/Offset, the second connection is needed to have the ability to confirm the value also with enter
549 fBarWidth->Connect("ValueSet(Long_t)", "TH1Editor", this, "DoBarWidth()");
550 (fBarWidth->GetNumberEntry())->Connect("ReturnPressed()", "TH1Editor", this, "DoBarWidth()");
551 fBarOffset->Connect("ValueSet(Long_t)", "TH1Editor", this, "DoBarOffset()");
552 (fBarOffset->GetNumberEntry())->Connect("ReturnPressed()", "TH1Editor", this, "DoBarOffset()");
553 fPercentCombo->Connect("Selected(Int_t)", "TH1Editor", this, "DoPercent()");
554 fMakeHBar-> Connect("Toggled(Bool_t)","TH1Editor",this,"DoHBar(Bool_t))");
555
556 // Connections for rebinning are created - i.e. slider is
557 // connected to the slots that perform the rebinning in the
558 // case of a histogram not derived from an ntuple.
559 fBinSlider->Connect("PositionChanged(Int_t)","TH1Editor",this, "DoBinMoved(Int_t)");
560 fBinSlider->Connect("Released()","TH1Editor",this, "DoBinReleased()");
561 fBinSlider->Connect("Pressed()","TH1Editor",this, "DoBinPressed()");
562 // numberEntry which shows/sets the actual number of bins
563 fBinNumberEntry->Connect("ReturnPressed()", "TH1Editor", this, "DoBinLabel()");
564 // Buttons to accept/reject the rebinned histogram
565 fApply->Connect("Clicked()", "TH1Editor", this, "DoApply()");
566 fCancel->Connect("Pressed()", "TH1Editor", this, "DoCancel()");
567 // in case of a histogram which is derived from an ntuple these slots are used
568 fBinSlider1->Connect("Released()","TH1Editor",this, "DoBinReleased1()");
569 fBinSlider1->Connect("PositionChanged(Int_t)","TH1Editor",this, "DoBinMoved1()");
570 fBinNumberEntry1->Connect("ReturnPressed()", "TH1Editor", this, "DoBinLabel1()");
571 // slider/slots to change the offset of the histogram
572 fBinOffsetSld->Connect("PositionChanged(Int_t)", "TH1Editor", this,"DoOffsetMoved(Int_t)");
573 fBinOffsetSld->Connect("Released()", "TH1Editor", this, "DoOffsetReleased()");
574 fBinOffsetSld->Connect("Pressed()", "TH1Editor", this, "DoOffsetPressed()");
575 fOffsetNumberEntry->Connect("ReturnPressed()", "TH1Editor", this, "DoBinOffset()");
576 // slider/slots to set the visible axisrange
577 fSlider->Connect("PositionChanged()","TH1Editor", this,"DoSliderMoved()");
578 fSlider->Connect("Pressed()","TH1Editor", this, "DoSliderPressed()");
579 fSlider->Connect("Released()","TH1Editor", this, "DoSliderReleased()");
580 fSldMin->Connect("ReturnPressed()", "TH1Editor", this, "DoAxisRange()");
581 fSldMax->Connect("ReturnPressed()", "TH1Editor", this, "DoAxisRange()");
582 fInit = kFALSE;
583}
584
585////////////////////////////////////////////////////////////////////////////////
586/// Check if object is able to configure with this editor.
587
589{
590 if (obj == 0 || !obj->InheritsFrom(TH1::Class()) ||
591 ((TH1*)obj)->GetDimension()!=1 ||
592 ((TH1*)obj)->GetEntries() == 0
593 /*|| obj->InheritsFrom("TH2") || obj->InheritsFrom("TProfile")*/) {
594 return kFALSE;
595 }
596 return kTRUE;
597}
598
599////////////////////////////////////////////////////////////////////////////////
600/// Pick up current values of histogram attributes.
601
603{
604
605 if (fBinHist && (obj != fHist)) {
606 //we have probably moved to a different pad.
607 //let's restore the original histogram
608 if (fHist) {
609 fHist->Reset();
614 }
615 // delete in anycase fBinHist also when fHist is zero (i.e when it has been deleted)
616 delete fBinHist; fBinHist = 0;
617 }
618
619 fHist = (TH1*)obj;
621
622 const char *text = fHist->GetTitle();
624
626 TString str = GetDrawOption();
627 str.ToUpper();
628 if (str.Contains("SAME"))
629 fSameOpt = kTRUE;
630 else
632 Bool_t errorset = kFALSE;
633 // if no draw option is specified: (default options)
634 if (str.IsNull() || str=="" ) {
637 HideFrame(f3); // Hiding the histogram type combo box
638 ShowFrame(f6);
639 ShowFrame(f7);
640 ShowFrame(f8);
641 ShowFrame(f9);
642 HideFrame(f10);
643 HideFrame(f11);
644 HideFrame(f12);
645 ShowFrame(f15);
648 errorset=kTRUE;
655 // in case of a 2D plot:
656 } else if (!str.Contains("LEGO") && !str.Contains("SURF")){
659 HideFrame(f3); // Hiding the histogram type combo box
660 ShowFrame(f7);
661 ShowFrame(f8);
662 ShowFrame(f9);
663 ShowFrame(f15);
665 // initialising fAddCombo
666 if (str.Contains("C")) {
667 if (str.Contains("CYL")) {
668 TString dum = str;
669 dum.Remove(strstr(dum.Data(),"CYL")-dum.Data(),3);
670 if (dum.Contains("C")) fAddCombo->Select(kADD_SMOOTH);
672 }
673 else if (str.Contains("LF2")) fAddCombo->Select(kADD_FILL);
674 else if (str.Contains("L")){
675 TString dum = str;
676 if (str.Contains("CYL")) {
677 dum.Remove(strstr(dum.Data(),"CYL")-dum.Data(),3);
678 if (dum.Contains("L")) fAddCombo->Select(kADD_SIMPLE);
679 }
680 if (str.Contains("POL")) {
681 dum.Remove(strstr(dum.Data(),"POL")-dum.Data(),3);
682 if (dum.Contains("L")) fAddCombo->Select(kADD_SIMPLE);
684 } else fAddCombo->Select(kADD_NONE);
685
688 else if (str.Contains("HIST")) {
689 if (str=="HIST") fAddSimple->SetState(kButtonDisabled);
692
693 if (str.Contains("B")) {
694 TString dum = str;
695 if (str.Contains("BAR")) {
698 ShowFrame(f10);
699 ShowFrame(f11);
700 ShowFrame(f12);
701 } else {
705 ShowFrame(f10);
706 ShowFrame(f11);
707 HideFrame(f12);
708 }
709 } else {
712 HideFrame(f10);
713 HideFrame(f11);
714 HideFrame(f12);
715 }
716 if (str.Contains("P") ) {
719 } else if (!str.Contains("BAR")) fAddMarker->SetState(kButtonUp);
721
722 // in case of a 3D plot
723 } else if (str.Contains("LEGO") || str.Contains("SURF")){
726 TGListBox* lb;
728 // set Coordinate ComboBox
729 if (str.Contains("SURF")){
730 // surf cannot be combined with spheric and cartesian coordinates
731 // i.e. remove them from the combobox
734 lb = fCoordsCombo->GetListBox();
735 lb->Resize(lb->GetWidth(), 49);
736 } else {
737 // surf cannot be combined with spheric and cartesian coordinates
738 // if surf was selected before here the removed items were added the combobox again
739 if (((TGLBContainer*)((TGListBox*)fCoordsCombo->GetListBox())->GetContainer())->GetPos(kCOORDS_SPH)==-1)
740 fCoordsCombo->AddEntry("Spheric", kCOORDS_SPH);
741 if (((TGLBContainer*)((TGListBox*)fCoordsCombo->GetListBox())->GetContainer())->GetPos(kCOORDS_CAR)==-1) {
742 fCoordsCombo->AddEntry("Cartesian", kCOORDS_CAR);
743 lb = fCoordsCombo->GetListBox();
744 lb->Resize(lb->GetWidth(), 83);
745 }
746 }
747 // initialising the Type Combobox
748 if (str.Contains("LEGO2")) fTypeCombo->Select(kTYPE_LEGO2);
749 else if (str.Contains("LEGO1")) fTypeCombo->Select(kTYPE_LEGO1);
750 else if (str.Contains("LEGO")) fTypeCombo->Select(kTYPE_LEGO);
751 else if (str.Contains("SURF5")) fTypeCombo->Select(kTYPE_SURF5);
752 else if (str.Contains("SURF4")) fTypeCombo->Select(kTYPE_SURF4);
753 else if (str.Contains("SURF3")) fTypeCombo->Select(kTYPE_SURF3);
754 else if (str.Contains("SURF2")) fTypeCombo->Select(kTYPE_SURF2);
755 else if (str.Contains("SURF1")) fTypeCombo->Select(kTYPE_SURF1);
756 else if (str.Contains("SURF")) fTypeCombo->Select(kTYPE_SURF);
757
758 if (str.Contains("CYL")) fCoordsCombo->Select(kCOORDS_CYL);
759 else if (str.Contains("POL")) fCoordsCombo->Select(kCOORDS_POL);
760 else if (str.Contains("SPH")) fCoordsCombo->Select(kCOORDS_SPH);
761 else if (str.Contains("PSR")) fCoordsCombo->Select(kCOORDS_PSR);
762 else fCoordsCombo->Select(kCOORDS_CAR); //default
763
764 HideFrame(f6);
765 HideFrame(f7);
766 HideFrame(f8);
767 HideFrame(f9);
768 HideFrame(f15);
769 if (str.Contains("LEGO")) {
770 ShowFrame(f10);
771 ShowFrame(f11);
772 HideFrame(f12);
773 } else {
774 HideFrame(f10);
775 HideFrame(f11);
776 HideFrame(f12);
777 }
780 }
781
782 if (!errorset) {
783 if (str.Contains("E1")) fErrorCombo->Select(kERRORS_EDGES);
784 else if (str.Contains("E2")) fErrorCombo->Select(kERRORS_REC);
785 else if (str.Contains("E3")) fErrorCombo->Select(kERRORS_FILL);
786 else if (str.Contains("E4")) fErrorCombo->Select(kERRORS_CONTOUR);
787 else if (str.Contains("E")) {
788 if (str.Contains("LEGO")) {
789 TString dum=str;
790 dum.Remove(strstr(dum.Data(),"LEGO")-dum.Data(),4);
793 } else fErrorCombo->Select(kERRORS_NO); //default
794 }
795
797 HideFrame(f7);
798 HideFrame(f8);
799 }
800 if (str.Contains("BAR") || ((fAddBar->GetState()==kButtonDown) &&
801 (fDim->GetState()==kButtonDown))) {
802 ShowFrame(f10);
803 ShowFrame(f11);
804 ShowFrame(f12);
807 if (str.Contains("HBAR")) fMakeHBar->SetState(kButtonDown);
809
810 if (str.Contains("BAR4")) fPercentCombo->Select(kPER_40);
811 else if (str.Contains("BAR3")) fPercentCombo->Select(kPER_30);
812 else if (str.Contains("BAR2")) fPercentCombo->Select(kPER_20);
813 else if (str.Contains("BAR1")) fPercentCombo->Select(kPER_10);
815 }
816
817 Int_t nx = fHist -> GetXaxis() -> GetNbins();
818 Int_t nxbinmin = fHist -> GetXaxis() -> GetFirst();
819 Int_t nxbinmax = fHist -> GetXaxis() -> GetLast();
820
822
824
825 // Check if histogram is from ntupla/tree or not.
826 // If it is a standard histogram or a ntupla based histogram
827 // show a different frame in case of rebinning (fBinCont) with sliders and bin number entries
828 // connected to different methods.
829 // For example the entry field fBinNumberEntry is connected to
830 // the method DoBinLabel in case of non-ntupla histograms which just call Th1::Rebin
831 // In csae of a tree based histogram the entry field fBinNumberEntry1 is used which is connected to
832 // TH1Editor::DoBinLabel1 which is re-filling the histograms with the cached values from the TTreePlayer.
833 // Since the actual number of histogram entry can be larger than the cache size of the TTreePlayer
834 // (see JIRA ROOT-5900 or http://root.cern.ch/phpBB3/viewtopic.php?f=3&t=17107 )
835 // the GUI frame based on a non-tupla histogram is used when the number of entries of the histogram is
836 // not the same as the number of filled entries in the TTreePlayer object.
837
838 if (!player || player->GetHistogram()!=fHist ||
839 fHist->GetEntries() != player->GetNfill()) {
840
841 Int_t n = 0;
842 if (fBinHist) n = fBinHist->GetXaxis()->GetNbins();
843 else n = nx;
844 if (n < 1) n = 1;
847 Int_t* div = Dividers(n);
848 Int_t up = 0;
849 if (div[0]-1 <= 1) up = 2;
850 else up = div[0]-1;
851 fBinSlider->SetRange(1,up);
852 Int_t i = 1;
855 else {
856 while ( div[i] != nx) i ++;
857 fBinSlider->SetPosition(div[0] - i + 1);
858 }
861 delete [] div;
862 }
863 else if (player && fHist==player->GetHistogram() && fHist->GetEntries() == player->GetNfill()) {
864 // in case of a ntupla/tree based histogram with number of entries not exceeding the TTreePlayer cache
867 fBinSlider->SetRange(0,1);
871 fBinNumberEntry1->SetIntNumber(nxbinmax-nxbinmin+1);
872 }
873
874 fSlider->SetRange(1,nx);
875 fSlider->SetPosition((Double_t)nxbinmin,(Double_t)nxbinmax);
876
879
881 fHist->GetXaxis()->GetBinWidth(1));
882
884 fMake=kTRUE;
887}
888
889////////////////////////////////////////////////////////////////////////////////
890/// Slot connected to the histogram title setting.
891
892void TH1Editor::DoTitle(const char *text)
893{
894 if (fAvoidSignal) return;
896 Update();
897}
898
899////////////////////////////////////////////////////////////////////////////////
900/// Slot connected to the show markers check box.
901
903{
904 if (fAvoidSignal) return;
905 TString str = GetDrawOption();
906 str.ToUpper();
907 if (str.Contains("SAME"))
908 fSameOpt = kTRUE;
909 else
911 TString dum = str;
912
913 if (dum.Contains("POL")) dum.Remove(strstr(dum.Data(),"POL")-dum.Data(),3);
914 if (dum.Contains("SPH")) dum.Remove(strstr(dum.Data(),"SPH")-dum.Data(),3);
915 if (dum.Contains("PSR")) dum.Remove(strstr(dum.Data(),"PSR")-dum.Data(),3);
916 if (on) {
917 if (!dum.Contains("P")) str += "P";
919 if (str.Contains("HIST"))
920 str.Remove(strstr(str.Data(),"HIST")-str.Data(),4);
921 } else if (fAddMarker->GetState()==kButtonUp) {
922 if (str.Contains("POL") || str.Contains("SPH")) {
923 while (dum.Contains("P"))
924 dum.Remove(strstr(dum.Data(),"P")-dum.Data(),1);
925 if (str.Contains("POL")) str = dum + "POL";
926 if (str.Contains("SPH")) str = dum + "SPH";
927 if (str.Contains("PSR")) str = dum + "PSR";
928 } else if (str.Contains("P")) str.Remove(str.First("P"),1);
929 if ((str=="HIST") || (str=="") ||
930 (fAddB->GetState()==kButtonDown) ||
933 else if (str.Contains("HIST"))
935 else
937 }
938 if (fMake) {
939 if (fSameOpt) str += "SAME";
940 SetDrawOption(str);
941 Update();
942 }
943}
944
945////////////////////////////////////////////////////////////////////////////////
946/// Slot connected to the bar Add check box.
947
949{
950 if (fAvoidSignal) return;
951 TString str = GetDrawOption();
952 str.ToUpper();
953 if (str.Contains("SAME"))
954 fSameOpt = kTRUE;
955 else
957 if (fMakeB) {
959 if (on) {
960 if (!str.Contains("B")) str += "B";
961 ShowFrame(f10);
962 ShowFrame(f11);
963 HideFrame(f12);
968 } else if (fAddB->GetState()==kButtonUp) {
969 while (str.Contains("B"))
970 str.Remove(str.First("B"),1);
971 HideFrame(f10);
972 HideFrame(f11);
973 HideFrame(f12);
976 !(str=="" || str=="HIST" ||
979 }
980 if (fSameOpt) str += "SAME";
981 if (fMake) SetDrawOption(str);
982 Update();
983
985 }
986}
987
988////////////////////////////////////////////////////////////////////////////////
989/// Slot connected to the bar Add check box.
990
992{
993 if (fAvoidSignal) return;
995 TString str = GetDrawOption();
996 str.ToUpper();
997 if (str.Contains("SAME"))
998 fSameOpt = kTRUE;
999 else
1000 fSameOpt = kFALSE;
1001 if (fMakeB) {
1002 fMakeB=kFALSE;
1003 Int_t o = 0;
1004 if (str.Contains("HBAR")) o=1;
1005 if (str.Contains("BAR4"))
1006 str.Remove(strstr(str.Data(),"BAR4")-str.Data()-o,4+o);
1007 else if (str.Contains("BAR3"))
1008 str.Remove(strstr(str.Data(),"BAR3")-str.Data()-o,4+o);
1009 else if (str.Contains("BAR2"))
1010 str.Remove(strstr(str.Data(),"BAR2")-str.Data()-o,4+o);
1011 else if (str.Contains("BAR1"))
1012 str.Remove(strstr(str.Data(),"BAR1")-str.Data()-o,4+o);
1013 else if (str.Contains("BAR0"))
1014 str.Remove(strstr(str.Data(),"BAR0")-str.Data()-o,4+o);
1015 else if (str.Contains("BAR"))
1016 str.Remove(strstr(str.Data(),"BAR")-str.Data()-o,3+o);
1017 if (on) {
1018 if ((fAddMarker->GetState()==kButtonDown) &&
1022 else if ((fAddMarker->GetState()!=kButtonDown) &&
1024 if (str.Contains("HIST"))
1026 else if (fAddCombo->GetSelected()!=kADD_NONE)
1028 else
1030 }
1031 switch (fPercentCombo->GetSelected()){
1032 case(-1): {
1033 str += "BAR";
1035 break;
1036 }
1037 case(kPER_0): {
1038 str += "BAR";
1039 break;
1040 }
1041 case(kPER_10): {
1042 str += "BAR1";
1043 break;
1044 }
1045 case(kPER_20): {
1046 str += "BAR2";
1047 break;
1048 }
1049 case(kPER_30): {
1050 str += "BAR3";
1051 break;
1052 }
1053 case(kPER_40): {
1054 str += "BAR4";
1055 break;
1056 }
1057 }
1058 ShowFrame(f10);
1059 ShowFrame(f11);
1060 ShowFrame(f12);
1062 str.Insert(strstr(str.Data(),"BAR")-str.Data(),"H");
1066 } else if (fAddBar->GetState()==kButtonUp) {
1067 HideFrame(f10);
1068 HideFrame(f11);
1069 HideFrame(f12);
1073 if (str=="" || str=="HIST" || fAddCombo->GetSelected() != kADD_NONE ||
1074 ((fAddMarker->GetState() == kButtonDown) &&
1077 }
1078 if (fSameOpt) str += "SAME";
1079 if (fMake) SetDrawOption(str);
1080 Update();
1082 fMakeB=kTRUE;
1083 }
1084 fAddMarker->Connect("Toggled(Bool_t)", "TH1Editor", this, "DoAddMarker(Bool_t)");
1085}
1086
1087////////////////////////////////////////////////////////////////////////////////
1088/// Slot connected to fAddSimple check box for drawing a simple histogram
1089/// without errors (== HIST draw option) in combination with some other
1090/// draw options. It draws an additional line on the top of the bins.
1091
1093{
1094 if (fAvoidSignal) return;
1096 // Bool_t make=kFALSE;
1097 fMake = kFALSE;
1098 TString str = GetDrawOption();
1099 str.ToUpper();
1100 if (str.Contains("SAME"))
1101 fSameOpt = kTRUE;
1102 else
1103 fSameOpt = kFALSE;
1104 if (on) {
1105 if (!str.Contains("HIST")) {
1106 str += "HIST";
1108 fMake=kTRUE;
1109 }
1110 } else if (fAddSimple->GetState()==kButtonUp) {
1111 if (str.Contains("HIST")) {
1112 str.Remove(strstr(str.Data(),"HIST")-str.Data(),4);
1114 fMake=kTRUE;
1115 }
1116 }
1117 if (fSameOpt) str += "SAME";
1118 if (fMake) SetDrawOption(str);
1119 fAddMarker->Connect("Toggled(Bool_t)", "TH1Editor", this, "DoAddMarker(Bool_t)");
1120 Update();
1121}
1122
1123////////////////////////////////////////////////////////////////////////////////
1124/// Slot connected to the 'Plot' button group.
1125
1127{
1128 if (gPad && gPad->GetVirtCanvas())
1129 gPad->GetVirtCanvas()->SetCursor(kWatch);
1130 gVirtualX->SetCursor(GetId(), gVirtualX->CreateCursor(kWatch));
1131
1132 if (fDim->GetState() == kButtonDown)
1133 DoHistSimple();
1134 else
1135 DoHistComplex();
1136
1137 if (gPad && gPad->GetVirtCanvas())
1138 gPad->GetVirtCanvas()->SetCursor(kPointer);
1139 gVirtualX->SetCursor(GetId(), gVirtualX->CreateCursor(kPointer));
1140}
1141
1142////////////////////////////////////////////////////////////////////////////////
1143/// Slot connected to the 2D radio button.
1144
1146{
1147 if (fAvoidSignal) return;
1148 if (fDim->GetState()==kButtonDown){
1149 TString str ="";
1150 fMake=kFALSE;
1151 TGListBox* lb;
1152 HideFrame(f3);
1153 ShowFrame(f6);
1154 ShowFrame(f9);
1155 ShowFrame(f15);
1157 if ((fAddBar->GetState() != kButtonDown ||
1161 else if ((fAddSimple->GetState()==kButtonDisabled) &&
1164 else if (fAddSimple->GetState()!=kButtonUp)
1169
1171 ShowFrame(f7);
1172 ShowFrame(f8);
1173 } else {
1174 HideFrame(f7);
1175 HideFrame(f8);
1178 }
1179
1180 if ((fAddB->GetState() == kButtonDisabled)) {
1181 if (fAddBar->GetState()==kButtonDown) {
1182 ShowFrame(f10);
1183 ShowFrame(f11);
1184 ShowFrame(f12);
1185 } else {
1186 HideFrame(f10);
1187 HideFrame(f11);
1188 HideFrame(f12);
1189 }
1190 }
1191 if (fAddBar->GetState() == kButtonDisabled){
1192 ShowFrame(f10);
1193 ShowFrame(f11);
1194 HideFrame(f12);
1195 }
1196 if ((fAddBar->GetState() == kButtonUp) &&
1197 (fAddB->GetState() == kButtonUp)) {
1198 HideFrame(f10);
1199 HideFrame(f11);
1200 HideFrame(f12);
1201 }
1205 lb = fAddCombo->GetListBox();
1206 lb->Resize(lb->GetWidth(),19);
1209 fAddCombo->Connect("Selected(Int_t)", "TH1Editor", this, "DoHistChanges()");
1210 } else {
1211 if (((TGLBContainer*)((TGListBox*)fAddCombo->GetListBox())->GetContainer())->GetPos(kADD_SIMPLE)==-1)
1212 ((TGListBox*)fAddCombo->GetListBox())->AddEntry("Simple Line", kADD_SIMPLE);
1213 if (((TGLBContainer*)((TGListBox*)fAddCombo->GetListBox())->GetContainer())->GetPos(kADD_SMOOTH)==-1)
1214 ((TGListBox*)fAddCombo->GetListBox())->AddEntry("Smooth Line", kADD_SMOOTH);
1215 if (((TGLBContainer*)((TGListBox*)fAddCombo->GetListBox())->GetContainer())->GetPos(kADD_FILL)==-1) {
1216 ((TGListBox*)fAddCombo->GetListBox())->AddEntry("Fill Area",kADD_FILL);
1217 lb = fAddCombo->GetListBox();
1218 lb->Resize(lb->GetWidth(),76);
1219 }
1220 }
1221 if (fAddSimple->GetState()==kButtonDown) str+="HIST";
1223 if (fSameOpt) str += "SAME";
1224 SetDrawOption(str);
1225 Update();
1226 //fGedEditor->GetTab()->Layout();
1228 fMake=kTRUE;
1229 }
1230}
1231
1232////////////////////////////////////////////////////////////////////////////////
1233/// Slot connected to the 3D radio button.
1234
1236{
1237 if (fAvoidSignal) return;
1238 if (fDim0->GetState()==kButtonDown) {
1239 TString str ="";
1240 fMake=kFALSE;
1241 ShowFrame(f3);
1242 HideFrame(f6);
1243 HideFrame(f7);
1244 HideFrame(f8);
1245 HideFrame(f9);
1246 HideFrame(f15);
1248 if (fTypeCombo->GetSelected()==-1 && fCoordsCombo->GetSelected()==-1) {
1249 str = "LEGO"+GetHistErrorLabel();
1252 } else if (fTypeCombo->GetSelected()==-1){
1253 str = "LEGO"+GetHistErrorLabel();
1255 } else if (fCoordsCombo->GetSelected()==-1) {
1258 } else {
1260 }
1261 if (str.Contains("LEGO")) {
1262 ShowFrame(f10);
1263 ShowFrame(f11);
1264 HideFrame(f12);
1265 } else {
1266 HideFrame(f10);
1267 HideFrame(f11);
1268 HideFrame(f12);
1269 }
1270 if (fSameOpt) str += "SAME";
1271 SetDrawOption(str);
1272 Update();
1274 fGedEditor->GetTab()->Layout();
1275 fMake=kTRUE;
1276 }
1277}
1278
1279////////////////////////////////////////////////////////////////////////////////
1280/// Slot connected to the histogram type, the coordinate type, the error type
1281/// and the Add combo box.
1282
1284{
1285 if (fAvoidSignal) return;
1286 fMakeB= kFALSE;
1287 TGListBox* lb;
1288 if (GetHistTypeLabel().Contains("SURF")) {
1294 lb = fCoordsCombo->GetListBox();
1295 lb->Resize(lb->GetWidth(), 49);
1296 } else {
1297 if (((TGLBContainer*)((TGListBox*)fCoordsCombo->GetListBox())->GetContainer())->GetPos(kCOORDS_SPH)==-1)
1298 ((TGListBox*)fCoordsCombo->GetListBox())->AddEntrySort("Spheric", kCOORDS_SPH);
1299 if (((TGLBContainer*)((TGListBox*)fCoordsCombo->GetListBox())->GetContainer())->GetPos(kCOORDS_CAR)==-1) {
1300 ((TGListBox*)fCoordsCombo->GetListBox())->AddEntrySort("Cartesian", kCOORDS_CAR);
1301 lb = fCoordsCombo->GetListBox();
1302 lb->Resize(lb->GetWidth(), 83);
1303 }
1304 }
1305 if (fDim->GetState()!=kButtonUp){
1307 HideFrame(f7);
1308 HideFrame(f8);
1309 ShowFrame(f9);
1317 lb = fAddCombo->GetListBox();
1318 lb->Resize(lb->GetWidth(),19);
1321 fAddCombo->Connect("Selected(Int_t)", "TH1Editor", this, "DoHistChanges()");
1322 if (fAddBar->GetState()==kButtonDown) {
1323 ShowFrame(f10);
1324 ShowFrame(f11);
1325 ShowFrame(f12);
1326 } else {
1327 HideFrame(f10);
1328 HideFrame(f11);
1329 HideFrame(f12);
1330 }
1331 } else {
1332 Bool_t on = fMake;
1333 fMake=kFALSE;
1334 ShowFrame(f7);
1335 ShowFrame(f8);
1336 ShowFrame(f9);
1339 if (fAddBar->GetState() != kButtonDown &&
1342 if (((TGLBContainer*)((TGListBox*)fAddCombo->GetListBox())->GetContainer())->GetPos(kADD_SIMPLE)==-1)
1343 ((TGListBox*)fAddCombo->GetListBox())->AddEntry("Simple Line", kADD_SIMPLE);
1344 if (((TGLBContainer*)((TGListBox*)fAddCombo->GetListBox())->GetContainer())->GetPos(kADD_SMOOTH)==-1)
1345 ((TGListBox*)fAddCombo->GetListBox())->AddEntry("Smooth Line", kADD_SMOOTH);
1346 if (((TGLBContainer*)((TGListBox*)fAddCombo->GetListBox())->GetContainer())->GetPos(kADD_FILL)==-1) {
1347 ((TGListBox*)fAddCombo->GetListBox())->AddEntry("Fill Area",kADD_FILL);
1348 lb = fAddCombo->GetListBox();
1349 lb->Resize(lb->GetWidth(),76);
1350 }
1351 fMake=on;
1352 }
1355 } else {
1358 else if (fAddSimple->GetState()==kButtonDisabled)
1360 }
1361 } else if (fDim0->GetState()==kButtonDown) {
1362 if (GetHistTypeLabel().Contains("LEGO")) {
1363 ShowFrame(f10);
1364 ShowFrame(f11);
1365 HideFrame(f12);
1366 } else {
1367 HideFrame(f10);
1368 HideFrame(f11);
1369 HideFrame(f12);
1370 }
1371 }
1372 if (fMake) {
1373 TString str = "";
1374 if (fDim->GetState()==kButtonDown)
1376 else if (fDim0->GetState()==kButtonDown)
1379 str += "HIST";
1380 if (fSameOpt)
1381 str += "SAME";
1382 SetDrawOption(str);
1383 if (str=="" || str=="HIST") fAddSimple->SetState(kButtonDisabled);
1384 Update();
1385 }
1387 // fGedEditor->GetTab()->Layout();
1388 fMakeB=kTRUE;
1389}
1390
1391////////////////////////////////////////////////////////////////////////////////
1392/// Slot connected to the Bar Width of the Bar Charts.
1393
1395{
1396 if (fAvoidSignal) return;
1398 Update();
1399}
1400
1401////////////////////////////////////////////////////////////////////////////////
1402/// Slot connected to the Bar Offset of the Bar Charts.
1403
1405{
1406 if (fAvoidSignal) return;
1409 Update();
1410}
1411
1412////////////////////////////////////////////////////////////////////////////////
1413/// Slot connected to the bar percentage settings.
1414
1416{
1417 if (fAvoidSignal) return;
1418 TString str = GetDrawOption();
1419 str.ToUpper();
1420 if (str.Contains("SAME"))
1421 fSameOpt = kTRUE;
1422 else
1423 fSameOpt = kFALSE;
1424 Int_t o = 0;
1425 if (str.Contains("HBAR")) o=1;
1426 if (str.Contains("BAR4"))
1427 str.Remove(strstr(str.Data(),"BAR4")-str.Data()-1,4+o);
1428 else if (str.Contains("BAR3"))
1429 str.Remove(strstr(str.Data(),"BAR3")-str.Data()-o,4+o);
1430 else if (str.Contains("BAR2"))
1431 str.Remove(strstr(str.Data(),"BAR2")-str.Data()-o,4+o);
1432 else if (str.Contains("BAR1"))
1433 str.Remove(strstr(str.Data(),"BAR1")-str.Data()-o,4+o);
1434 else if (str.Contains("BAR0"))
1435 str.Remove(strstr(str.Data(),"BAR0")-str.Data()-o,4+o);
1436 else if (str.Contains("BAR"))
1437 str.Remove(strstr(str.Data(),"BAR")-str.Data()-o,3+o);
1438
1439 if (fMakeHBar->GetState()==kButtonDown) str+="H";
1440 switch (fPercentCombo->GetSelected()){
1441 case (kPER_0) :{ str += "BAR"; break;}
1442 case (kPER_10):{ str += "BAR1"; break;}
1443 case (kPER_20):{ str += "BAR2"; break;}
1444 case (kPER_30):{ str += "BAR3"; break;}
1445 case (kPER_40):{ str += "BAR4"; break;}
1446 }
1447 if (fSameOpt) str += "SAME";
1448 if (fMake) SetDrawOption(str);
1449 Update();
1450}
1451
1452////////////////////////////////////////////////////////////////////////////////
1453/// Slot connected to the Horizontal Bar check button.
1454
1456{
1457 if (fAvoidSignal) return;
1458 TString str = GetDrawOption();
1459 str.ToUpper();
1460 if (str.Contains("SAME"))
1461 fSameOpt = kTRUE;
1462 else
1463 fSameOpt = kFALSE;
1464 if (on) {
1465 if (!str.Contains("HBAR"))
1466 str.Insert(strstr(str.Data(),"BAR")-str.Data(),"H");
1467 }
1468 else if (fMakeHBar->GetState()==kButtonUp) {
1469 if (str.Contains("HBAR"))
1470 str.Remove(strstr(str.Data(),"BAR")-str.Data()-1,1);
1471 }
1472 if (fSameOpt) str += "SAME";
1473 if (fMake) SetDrawOption(str);
1474 Update();
1475}
1476
1477////////////////////////////////////////////////////////////////////////////////
1478/// Slot connected to the x-Slider for redrawing of the histogram
1479/// according to the new Slider range.
1480
1482{
1483 if (fAvoidSignal) return;
1484 if (fGedEditor->GetPad()->GetCanvas())
1486 fGedEditor->GetPad()->cd();
1488 static Int_t px1,py1,px2,py2;
1489 static Float_t ymin,ymax,xleft,xright;
1490 xleft = fHist->GetXaxis()->GetBinLowEdge((Int_t)((fSlider->GetMinPosition())+0.5));
1491 xright = fHist->GetXaxis()->GetBinUpEdge((Int_t)((fSlider->GetMaxPosition())+0.5));
1494 px1 = fGedEditor->GetPad()->XtoAbsPixel(xleft);
1495 py1 = fGedEditor->GetPad()->YtoAbsPixel(ymin);
1496 px2 = fGedEditor->GetPad()->XtoAbsPixel(xright);
1497 py2 = fGedEditor->GetPad()->YtoAbsPixel(ymax);
1498 if (fGedEditor->GetPad()->GetCanvas())
1504 fGedEditor->GetPad()->cd();
1506 gVirtualX->DrawBox(px1, py1, px2, py2, TVirtualX::kHollow);
1507 fPx1old = px1;
1508 fPy1old = py1;
1509 fPx2old = px2 ;
1510 fPy2old = py2;
1511 gVirtualX->Update(0);
1512 fSldMin->SetNumber(xleft);
1513 fSldMax->SetNumber(xright);
1514 } else if (fDelaydraw->GetState() == kButtonDown &&
1515 fDim0->GetState() == kButtonDown &&
1517 static Float_t p1[3], p2[3], p3[3], p4[3], p5[3], p6[3], p7[3], p8[3];
1518 TView *fView = fGedEditor->GetPad()->GetView();
1519 if (!fView) return;
1520 Double_t *rmin = fView->GetRmin();
1521 if (!rmin) return;
1522 Double_t *rmax = fView->GetRmax();
1523 if (!rmax) return;
1524 p1[0] = p4[0] = p5[0] = p8[0] =
1526 p2[0] = p3[0] = p6[0] = p7[0] =
1528 p1[1] = p2[1] = p3[1] = p4[1] = rmin[1];
1529 p5[1] = p6[1] = p7[1] = p8[1] = rmax[1];
1530 p1[2] = p2[2] = p5[2] = p6[2] = rmin[2];
1531 p3[2] = p4[2] = p7[2] = p8[2] = rmax[2];
1536 PaintBox3D(p2, p3, p7, p6);
1537 PaintBox3D(p1, p4, p8, p5);
1538 for (Int_t i = 0; i<3; i++){
1539 fP1old[i] = p1[i];
1540 fP2old[i] = p2[i];
1541 fP3old[i] = p3[i];
1542 fP4old[i] = p4[i];
1543 fP5old[i] = p5[i];
1544 fP6old[i] = p6[i];
1545 fP7old[i] = p7[i];
1546 fP8old[i] = p8[i];
1547 }
1548 fSldMin->SetNumber(p1[0]);
1549 fSldMax->SetNumber(p2[0]);
1550 } else if (fDelaydraw->GetState() == kButtonDown &&
1551 fDim0->GetState() == kButtonDown) {
1554 } else {
1556 (Int_t)((fSlider->GetMaxPosition())+0.5));
1560 Update();
1561 }
1563 if (player && player->GetHistogram() == fHist) {
1564 Int_t last = fHist->GetXaxis()->GetLast();
1565 Int_t first = fHist->GetXaxis()->GetFirst();
1566 fBinNumberEntry1->SetIntNumber(last-first+1);
1567 // How to redraw the NumberEntry without calling Update??
1568 // Update kills the "virtual" painted box in Delayed draw mode
1570 // fGedEditor->GetTab()->Layout();
1571 }
1574}
1575
1576////////////////////////////////////////////////////////////////////////////////
1577/// Slot connected to the x-axis Range slider for initialising the
1578/// values of the slider movement.
1579
1581{
1582 if (fAvoidSignal) return;
1583 if (fGedEditor->GetPad()->GetCanvas())
1585 fGedEditor->GetPad()->cd();
1586 static Float_t ymin,ymax,xleft,xright;
1587 Int_t sldmin = (Int_t)((fSlider->GetMinPosition())+0.5);
1588 Int_t sldmax = (Int_t)((fSlider->GetMaxPosition())+0.5);
1589 if (fDelaydraw->GetState() == kButtonDown &&
1591 if (fGedEditor->GetPad()->GetCanvas())
1595 xleft = fHist->GetXaxis()->GetBinLowEdge(sldmin);
1596 xright = fHist->GetXaxis()->GetBinUpEdge(sldmax);
1599 fPx1old = fGedEditor->GetPad()->XtoAbsPixel(xleft);
1601 fPx2old = fGedEditor->GetPad()->XtoAbsPixel(xright);
1604 } else if (fDelaydraw->GetState() == kButtonDown &&
1605 fDim0->GetState() == kButtonDown &&
1607 TView *fView = fGedEditor->GetPad()->GetView();
1608 if (!fView) return;
1609 Double_t *rmin = fView->GetRmin();
1610 if (!rmin) return;
1611 Double_t *rmax = fView->GetRmax();
1612 if (!rmax) return;
1613 fP1old[0] = fP4old[0] = fP5old[0] = fP8old[0] =
1614 fHist->GetXaxis()->GetBinLowEdge(sldmin);
1615 fP2old[0] = fP3old[0] = fP6old[0] = fP7old[0] =
1616 fHist->GetXaxis()->GetBinUpEdge(sldmax);
1617 fP1old[1] = fP2old[1] = fP3old[1] = fP4old[1] = rmin[1];
1618 fP5old[1] = fP6old[1] = fP7old[1] = fP8old[1] = rmax[1];
1619 fP1old[2] = fP2old[2] = fP5old[2] = fP6old[2] = rmin[2];
1620 fP3old[2] = fP4old[2] = fP7old[2] = fP8old[2] = rmax[2];
1621 if (fGedEditor->GetPad()->GetCanvas())
1627 }
1628 Update();
1629}
1630
1631////////////////////////////////////////////////////////////////////////////////
1632/// Slot connected to the x-axis Range slider for finalizing the
1633/// values of the slider movement.
1634
1636{
1637 if (fAvoidSignal) return;
1640 (Int_t)((fSlider->GetMaxPosition())+0.5));
1643 Update();
1644 }
1646 if (player) if (player->GetHistogram() == fHist) {
1647 Int_t last = fHist->GetXaxis()->GetLast();
1648 Int_t first = fHist->GetXaxis()->GetFirst();
1649 fBinNumberEntry1->SetIntNumber(last-first+1);
1650 Update();
1651 }
1652}
1653
1654////////////////////////////////////////////////////////////////////////////////
1655/// Slot connected to the number entry fields containing the Max/Min
1656/// value of the x-axis.
1657
1659{
1660 if (fAvoidSignal) return;
1661 Int_t nx = fHist->GetXaxis()->GetNbins();
1663 Double_t lowLimit = fHist->GetXaxis()->GetBinLowEdge(1);
1664 Double_t upLimit = fHist->GetXaxis()->GetBinUpEdge(nx);
1665 if ((fSldMin->GetNumber()+width/2) < (lowLimit))
1666 fSldMin->SetNumber(lowLimit);
1667 if ((fSldMax->GetNumber()-width/2) > (upLimit))
1668 fSldMax->SetNumber(upLimit);
1669// Set the histogram range and the axis range slider
1671 fSldMax->GetNumber()-width/2);
1672 Int_t nxbinmin = fHist->GetXaxis()->GetFirst();
1673 Int_t nxbinmax = fHist->GetXaxis()->GetLast();
1674 fSlider->SetPosition((Double_t)(nxbinmin),(Double_t)(nxbinmax));
1675 Update();
1676}
1677
1678////////////////////////////////////////////////////////////////////////////////
1679/// Slot connected to the rebin slider in case of a not ntuple histogram
1680/// Updates some other widgets which are related to the rebin slider.
1681
1683{
1684 // draw the rebinned histogram in case of delay draw mode
1685 if (fAvoidSignal) return;
1687 if (!fBinHist) {
1688 fBinHist = (TH1*)fHist->Clone("BinHist");
1689 // we will manage this histogram
1691 }
1692 Int_t nx = fBinHist->GetXaxis()->GetNbins();
1693 Int_t numx = fBinSlider->GetPosition();
1694 Int_t* divx = Dividers(nx);
1695 if (divx[0]==2) fBinSlider->SetPosition(2);
1696 if (divx[0]==2) {
1697 delete [] divx;
1698 return;
1699 }
1700 // delete the histogram which is on the screen
1701 fGedEditor->GetPad()->cd();
1702 fHist->Reset();
1704 fBinHist->GetXaxis()->GetXmax());
1705 fHist->Add(fBinHist);
1707 fHist->Rebin(divx[numx]);
1708 // fModel=fHist;
1709 if (divx[0]!=2) {
1710 TAxis* xaxis = fHist->GetXaxis();
1711 Double_t xBinWidth = xaxis->GetBinWidth(1);
1712 xaxis->SetRangeUser(fSldMin->GetNumber()+xBinWidth/2,
1713 fSldMax->GetNumber()-xBinWidth/2);
1714 fSlider->SetRange(1,(Int_t)nx/divx[numx]);
1715 fSlider->SetPosition(xaxis->FindBin(fSldMin->GetNumber()+xBinWidth/2),
1716 xaxis->FindBin(fSldMax->GetNumber()-xBinWidth/2));
1717 // the x-axis range could be changed a little bit by Rebin algorithm
1718 fSldMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
1719 fSldMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
1720 }
1725 Update();
1726 delete [] divx;
1727 }
1728// fGedEditor->GetPad()->GetCanvas()->Selected(fGedEditor->GetPad(), fHist, 0);
1729 // fModel = fHist;
1730 Refresh(fHist);
1731}
1732
1733////////////////////////////////////////////////////////////////////////////////
1734/// Slot connected to the rebin slider in case of a not ntuple histogram
1735/// (does the Rebinning of the histogram).
1736
1738{
1739 // create a clone in the background, when the slider is moved for
1740 // the first time
1741 if (fAvoidSignal) return;
1742 if (!fBinHist /*&& fDelaydraw->GetState()!=kButtonDown*/) {
1743 Int_t* divx = Dividers(fHist->GetXaxis()->GetNbins());
1744 if (divx[0]==2) {
1745 delete [] divx;
1746 return;
1747 }
1748 fBinHist = (TH1*)fHist->Clone("BinHist");
1749 // the TH1Editor class manage this histogram
1751 delete [] divx;
1752 }
1753 // if the slider already has been moved and the clone is saved
1754 Int_t nx = fBinHist->GetXaxis()->GetNbins();
1755 Int_t* divx = Dividers(nx);
1756 if (divx[0]==2) {
1758 delete [] divx;
1759 return;
1760 }
1761 Int_t maxx = (Int_t)nx/divx[numx];
1762 if (maxx==1) maxx=2;
1763 if (fDelaydraw->GetState() == kButtonUp) {
1764 fGedEditor->GetPad()->cd();
1765 fHist->Reset();
1767 fBinHist->GetXaxis()->GetXmax());
1768 fHist->Add(fBinHist);
1770 fHist->Rebin(divx[numx]);
1771 //fModel=fHist;
1772 TAxis* xaxis = fHist->GetXaxis();
1773 Double_t xBinWidth = xaxis->GetBinWidth(1);
1774 xaxis->SetRangeUser(fSldMin->GetNumber()+xBinWidth/2,
1775 fSldMax->GetNumber()-xBinWidth/2);
1776 fSlider->SetRange(1,maxx);
1777 fSlider->SetPosition(xaxis->FindBin(fSldMin->GetNumber()+xBinWidth/2),
1778 xaxis->FindBin(fSldMax->GetNumber()-xBinWidth/2));
1779 // the axis range could be changed a little bit by the Rebin algorithm
1780 fSldMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
1781 fSldMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
1783 Update();
1784 }
1789 if (fBinNumberEntry->GetNumber()!=maxx)
1791 delete [] divx;
1792}
1793
1794////////////////////////////////////////////////////////////////////////////////
1795/// Slot connected to the rebin slider in case of a not ntuple histogram.
1796
1798{
1799 if (fAvoidSignal) return;
1801 if (d[0]==2 && !fBinHist) {
1803 "TH1 Editor", "It is not possible to rebin the histogram",
1805 gVirtualX->GrabPointer(fBinSlider->GetId(),0,0,0);
1806 }
1807 delete [] d;
1808 // calling the MessageBox again does NOT work!*/
1809}
1810
1811////////////////////////////////////////////////////////////////////////////////
1812/// Slot connected to the BinNumber Slider in case of a ntuple histogram
1813/// (does the Rebinning of the histogram).
1814
1816{
1817 if (fAvoidSignal) return;
1818 Double_t oldOffset = fOffsetNumberEntry->GetNumber();
1819 Int_t number = fBinSlider1->GetPosition();
1820 if (number==5) return;
1821 Int_t fact = 0;
1822 Int_t binNumber = 0;
1823 TAxis* xaxis = fHist->GetXaxis();
1824 // "compute" the scaling factor:
1825 if (number > 5) fact = number - 4;
1826 else fact = number - 6;
1828 if (!player) return;
1829 Int_t first = xaxis->GetFirst();
1830 Int_t last = xaxis->GetLast();
1831 Int_t nx = xaxis->GetNbins();
1832 Double_t min = xaxis->GetBinLowEdge(1); // overall min in user coords
1833 Double_t max = xaxis->GetBinUpEdge(nx); // overall max in user coords
1834 Double_t rmin = xaxis->GetBinLowEdge(first); // recent min in user coords
1835 Double_t rmax = xaxis->GetBinUpEdge(last); // recent max in user coords
1836
1837 ((TH1*)player->GetHistogram())->SetCanExtend(TH1::kNoAxis);
1838 ((TH1*)player->GetHistogram())->Reset();
1839
1840 // get new Number of bins
1841 if (fact > 0) binNumber = fact*nx;
1842 if (fact < 0) binNumber = (Int_t) ((-1)*nx/fact+0.5);
1843 if (binNumber < 1) binNumber = 1;
1844 if (binNumber > 10000) binNumber= 10000;
1845 Double_t newOffset = 1.*fBinOffsetSld->GetPosition()/100*((max-min)/binNumber);
1846 // create new histogram - the main job is done by sel->TakeAction()
1847 ((TH1*)player->GetHistogram())->SetBins(binNumber,
1848 min-oldOffset+newOffset,
1849 max-oldOffset+newOffset);
1851 if (!sel) return;
1852 sel->TakeAction();
1853
1854 // restore and set all the attributes which were changed by TakeAction()
1856 fSlider->SetRange(1,binNumber);
1857 Double_t binWidth = fHist->GetXaxis()->GetBinWidth(1);
1858 fSlider->SetPosition(xaxis->FindBin(rmin), xaxis->FindBin(rmax));
1859 Double_t offset = 1.*fBinOffsetSld->GetPosition()/100*binWidth;
1860 xaxis->SetRange(xaxis->FindBin(rmin+binWidth/2),
1861 xaxis->FindBin(rmax-binWidth/2)); // SetRange in binNumbers!
1862 fSldMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
1863 fSldMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
1864 fBinNumberEntry1->SetNumber(xaxis->GetLast() - xaxis->GetFirst() + 1);
1868 xaxis->GetBinWidth(1));
1870 Update();
1871}
1872
1873////////////////////////////////////////////////////////////////////////////////
1874/// Slot connected to the rebin slider in case of an ntuple histogram.
1875/// It updates the BinNumberEntryField during the BinSlider movement.
1876
1878{
1879 if (fAvoidSignal) return;
1880 TAxis* xaxis = fHist->GetXaxis();
1881 Int_t first = xaxis->GetFirst();
1882 Int_t last = xaxis->GetLast();
1883 Int_t number = fBinSlider1->GetPosition();
1884 Int_t n = last -first+1;
1885 Int_t fact = 0;
1886 Int_t binNumber = 0;
1887 if (number >= 5) fact = number - 4;
1888 else fact = number - 6;
1889 if (fact > 0) binNumber = fact*n;
1890 if (fact < 0) binNumber = (Int_t) ((-1)*n/fact+0.5);
1891 if (binNumber < 1) binNumber = 1;
1892 if (binNumber > 10000) binNumber= 10000;
1893 fBinNumberEntry1->SetIntNumber(binNumber);
1894// Update();
1895}
1896
1897////////////////////////////////////////////////////////////////////////////////
1898/// Slot connected to the Bin number entry of the Rebinning tab.
1899
1901{
1902 if (fAvoidSignal) return;
1904 Int_t nx = 0;
1905 if (fBinHist) nx = fBinHist->GetXaxis()->GetNbins();
1906 else nx = fHist->GetXaxis()->GetNbins();
1907 if (nx < 2) return;
1908 Int_t *div = Dividers(nx);
1909 Int_t diff = TMath::Abs(num - div[1]);
1910 Int_t c = 1;
1911 for (Int_t i = 2; i <= div[0]; i++) {
1912 if ((TMath::Abs(num - div[i])) < diff) {
1913 c = i;
1914 diff = TMath::Abs(num - div[i]);
1915 }
1916 }
1918 fBinSlider->SetPosition(div[0] - c +1);
1919 if (fDelaydraw->GetState()==kButtonUp) DoBinMoved(div[0] - c +1);
1920 else DoBinReleased();
1921// fGedEditor->GetPad()->GetCanvas()->Selected(fGedEditor->GetPad(), fHist, 0);
1922 // fModel = fHist;
1923 Refresh(fHist);
1924 delete [] div;
1925}
1926
1927////////////////////////////////////////////////////////////////////////////////
1928/// Slot connected to the Bin number entry of the Rebinning tab.
1929
1931{
1932 if (fAvoidSignal) return;
1933 Double_t oldOffset = fOffsetNumberEntry->GetNumber();
1935 TAxis* xaxis = fHist->GetXaxis();
1937 if (!player) return;
1938 Int_t first = xaxis->GetFirst();
1939 Int_t last = xaxis->GetLast();
1940 Int_t nx = xaxis->GetNbins();
1941 Double_t min = xaxis->GetBinLowEdge(1); // overall min in user coords
1942 Double_t max = xaxis->GetBinUpEdge(nx); // overall max in user coords
1943 Double_t rmin = xaxis->GetBinLowEdge(first); // recent min in user coords
1944 Double_t rmax = xaxis->GetBinUpEdge(last); // recent max in user coords
1945
1946 ((TH1*)player->GetHistogram())->SetCanExtend(TH1::kNoAxis);
1947 ((TH1*)player->GetHistogram())->Reset();
1948
1949// Calculate the new number of bins in the complete range
1950 Int_t binNumber = (Int_t) ((max-min)/(rmax - rmin)*num + 0.5);
1951 if (binNumber < 1) binNumber = 1;
1952 if (binNumber > 10000) binNumber = 10000;
1953 Double_t offset = 1.*(fBinOffsetSld->GetPosition())/100*(max-min)/binNumber;
1954// create new histogram - the main job is done by sel->TakeAction()
1955 ((TH1*)player->GetHistogram())->SetBins(binNumber,
1956 min-oldOffset+offset,
1957 max-oldOffset+offset);
1959 if (!sel) return;
1960 sel->TakeAction();
1961
1962// Restore and set all the attributes which were changed by TakeAction()
1964 fSlider->SetRange(1,binNumber);
1965 Double_t binWidth = xaxis->GetBinWidth(1);
1966 fSlider->SetPosition(xaxis->FindBin(rmin), xaxis->FindBin(rmax));
1967 offset = 1.*fBinOffsetSld->GetPosition()/100*binWidth;
1968 xaxis->SetRange(xaxis->FindBin(rmin+binWidth/2),
1969 xaxis->FindBin(rmax-binWidth/2)); // SetRange in binNumbers!
1970 fSldMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
1971 fSldMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
1974 Update();
1975}
1976
1977////////////////////////////////////////////////////////////////////////////////
1978/// Slot connected to the OffSetSlider that saves the OldBinOffset
1979/// (nessesary for delay draw mode).
1980
1982{
1983 if (fAvoidSignal) return;
1985}
1986
1987////////////////////////////////////////////////////////////////////////////////
1988/// Slot connected to the OffSetSlider.
1989/// It changes the origin of the histogram inbetween a binwidth and
1990/// rebin the histogram with the new Offset given by the Slider.
1991
1993{
1994 // !!problem: histogram with variable binwidth??
1995 // computes the new histogram in "delay draw" mode
1996
1997 if (fAvoidSignal) return;
2000 TAxis* xaxis = fHist->GetXaxis();
2001 Double_t binWidth = xaxis->GetBinWidth(1);
2002 Double_t offset = 1.*num/100*binWidth;
2003 Double_t oldOffset = fOldOffset;
2004 Int_t nx = xaxis->GetNbins();
2006 if (!player) return;
2007 Int_t first = xaxis->GetFirst();
2008 Int_t last = xaxis->GetLast();
2009 Double_t min = xaxis->GetBinLowEdge(1); // overall min in user coords
2010 Double_t max = xaxis->GetBinUpEdge(nx); // overall max in user coords
2011 Double_t rmin = xaxis->GetBinLowEdge(first); // recent min in user coords
2012 Double_t rmax = xaxis->GetBinUpEdge(last); // recent max in user coords
2013
2014 ((TH1*)player->GetHistogram())->SetCanExtend(TH1::kNoAxis);
2015 ((TH1*)player->GetHistogram())->Reset();
2016
2017 ((TH1*)player->GetHistogram())->SetBins(nx,
2018 min+offset-oldOffset,
2019 max+offset-oldOffset);
2021 if (!sel) return;
2022 sel->TakeAction();
2023
2024 // Restore all the attributes which were changed by TakeAction()
2026 xaxis->SetRange(xaxis->FindBin(rmin+offset-oldOffset+binWidth/2),
2027 xaxis->FindBin(rmax+offset-oldOffset-binWidth/2)); // in binNumbers!
2028 fSldMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
2029 fSldMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
2031 Update();
2032 }
2033}
2034
2035////////////////////////////////////////////////////////////////////////////////
2036/// Slot connected to the OffSetSlider.
2037/// It changes the origin of the histogram inbetween a binwidth and
2038/// rebin the histogram with the new offset given by the Slider.
2039
2041{
2042 // !!histogram with variable binwidth??
2043 // !!only works for histograms with fixed binwidth
2044
2045 if (fAvoidSignal) return;
2046 TAxis* xaxis = fHist->GetXaxis();
2047 Double_t binWidth = xaxis->GetBinWidth(1);
2048 Double_t offset = 1.*num/100*binWidth;
2049 if (fDelaydraw->GetState()==kButtonUp) {
2050 Double_t oldOffset = fOffsetNumberEntry->GetNumber();
2051 Int_t nx = xaxis->GetNbins();
2053 if (!player) return;
2054 Int_t first = xaxis->GetFirst();
2055 Int_t last = xaxis->GetLast();
2056 Double_t min = xaxis->GetBinLowEdge(1); // overall min in user coords
2057 Double_t max = xaxis->GetBinUpEdge(nx); // overall max in user coords
2058 Double_t rmin = xaxis->GetBinLowEdge(first); // recent min in user coords
2059 Double_t rmax = xaxis->GetBinUpEdge(last); // recent max in user coords
2060
2061 ((TH1*)player->GetHistogram())->SetCanExtend(TH1::kNoAxis);
2062 ((TH1*)player->GetHistogram())->Reset();
2063
2064 ((TH1*)player->GetHistogram())->SetBins(nx,
2065 min+offset-oldOffset,
2066 max+offset-oldOffset);
2068 if (!sel) return;
2069 sel->TakeAction();
2070
2071 // Restore all the attributes which were changed by TakeAction()
2073 xaxis->SetRange(xaxis->FindBin(rmin+offset-oldOffset+binWidth/2),
2074 xaxis->FindBin(rmax+offset-oldOffset-binWidth/2)); // in binNumbers!
2075 fSldMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
2076 fSldMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
2078 }
2081 Update();
2082}
2083
2084////////////////////////////////////////////////////////////////////////////////
2085/// Slot connected to the OffSetNumberEntry which is related to the
2086/// OffSetSlider changes the origin of the histogram inbetween a binwidth.
2087
2089{
2090 if (fAvoidSignal) return;
2091 TAxis* xaxis = fHist->GetXaxis();
2092 Double_t binWidth = xaxis->GetBinWidth(1);
2094 Double_t oldOffset = 1.*fBinOffsetSld->GetPosition()/100*binWidth;
2095 Int_t nx = xaxis->GetNbins();
2097 if (!player) return;
2098 Int_t first = xaxis->GetFirst();
2099 Int_t last = xaxis->GetLast();
2100 Double_t min = xaxis->GetBinLowEdge(1); // overall min in user coords
2101 Double_t max = xaxis->GetBinUpEdge(nx); // overall max in user coords
2102 Double_t rmin = xaxis->GetBinLowEdge(first); // recent min in user coords
2103 Double_t rmax = xaxis->GetBinUpEdge(last); // recent max in user coords
2104
2105 ((TH1*)player->GetHistogram())->SetCanExtend(TH1::kNoAxis);
2106 ((TH1*)player->GetHistogram())->Reset();
2107
2108 ((TH1*)player->GetHistogram())->SetBins(nx,
2109 min+offset-oldOffset,
2110 max+offset-oldOffset);
2112 if (!sel) return;
2113 sel->TakeAction();
2114
2115 // Restore all the attributes which were changed by TakeAction()
2117 xaxis->SetRange(xaxis->FindBin(rmin+offset-oldOffset+binWidth/2),
2118 xaxis->FindBin(rmax+offset-oldOffset-binWidth/2)); // in binNumbers!
2119 fSldMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
2120 fSldMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
2121 fBinOffsetSld->SetPosition((Int_t)(offset/binWidth*100));
2122 Update();
2123}
2124
2125////////////////////////////////////////////////////////////////////////////////
2126/// Slot connected to the Apply button of the Binning tab.
2127
2129{
2130 Int_t ret = 0;
2132 "TH1 Editor", "Replace origin histogram with rebinned one?",
2134 if (ret==1) {
2135 if (fBinHist) {
2136 delete fBinHist;
2137 fBinHist = 0;
2138 }
2139 Int_t nx = fHist->GetXaxis()->GetNbins();
2140 Int_t *div = Dividers(nx);
2141 Int_t up = 0;
2142 if (div[0]-1 <= 1) up = 2;
2143 else up = div[0]-1;
2144 fBinSlider->SetRange(1,up);
2145 if (fBinSlider->GetMaxPosition()==2 && div[0]==2 )
2147 else
2151 Update();
2152 delete [] div;
2153 } else if (ret==2) DoCancel();
2154}
2155
2156////////////////////////////////////////////////////////////////////////////////
2157/// Slot connected to the Cancel button of the Binning tab.
2158
2160{
2161 if (fBinHist) {
2162 fGedEditor->GetPad()->cd();
2163 fHist->Reset();
2166 fBinHist->GetXaxis()->GetXmax());
2167 fHist->Add(fBinHist);
2169 fBinHist->GetXaxis()->GetLast());
2170 delete fBinHist;
2171 fBinHist = 0;
2174 Int_t* divx = Dividers(fHist->GetXaxis()->GetNbins());
2175 if (divx[0]!=2) fBinSlider->SetPosition(1);
2176 // Consigning the new Histogram to all other Editors
2177// fGedEditor->GetPad()->GetCanvas()->Selected(fGedEditor->GetPad(), fHist, 0);
2178 Update();
2179 //fModel = fHist;
2180 Refresh(fHist);
2181 delete [] divx;
2182 }
2183}
2184
2185////////////////////////////////////////////////////////////////////////////////
2186/// Returns the selected histogram type (HIST, LEGO1-2, SURF1-5).
2187
2189{
2190 TString s="";
2191 switch (fTypeCombo->GetSelected()){
2192 case (-1) : {s = "LEGO"; break;}
2193 case (kTYPE_LEGO ): {s = "LEGO"; break;}
2194 case (kTYPE_LEGO1): {s = "LEGO1"; break;}
2195 case (kTYPE_LEGO2): {s = "LEGO2"; break;}
2196 case (kTYPE_SURF ): {s = "SURF"; break;}
2197 case (kTYPE_SURF1): {s = "SURF1"; break;}
2198 case (kTYPE_SURF2): {s = "SURF2"; break;}
2199 case (kTYPE_SURF3): {s = "SURF3"; break;}
2200 case (kTYPE_SURF4): {s = "SURF4"; break;}
2201 case (kTYPE_SURF5): {s = "SURF5"; break;}
2202 default: break;
2203 }
2204
2205 return s;
2206}
2207
2208////////////////////////////////////////////////////////////////////////////////
2209/// Return the selected coordinate system of the histogram (POL,CYL,SPH,PSR).
2210
2212{
2213 TString s="";
2214 if (fDim->GetState()!=kButtonDown) {
2215 switch (fCoordsCombo->GetSelected()){
2216 case (-1) : {s = "POL"; break;}
2217 case (kCOORDS_CAR): {s = ""; break;}
2218 case (kCOORDS_POL): {s = "POL"; break;}
2219 case (kCOORDS_CYL): {s = "CYL"; break;}
2220 case (kCOORDS_SPH): {s = "SPH"; break;}
2221 case (kCOORDS_PSR): {s = "PSR"; break;}
2222 default: break;
2223 }
2224 }
2225
2226 return s;
2227}
2228
2229////////////////////////////////////////////////////////////////////////////////
2230/// Return the selected error type (E,E1-5).
2231
2233{
2234 TString s="";
2235 switch (fErrorCombo->GetSelected()){
2236 case (-1) : {s = ""; break;}
2237 case (kERRORS_NO) : {s = ""; break;}
2238 case (kERRORS_SIMPLE) : {s = "E"; break;}
2239 case (kERRORS_EDGES) : {s = "E1"; break;}
2240 case (kERRORS_REC) : {s = "E2"; break;}
2241 case (kERRORS_FILL) : {s = "E3"; break;}
2242 case (kERRORS_CONTOUR): {s = "E4"; break;}
2243 default: break;
2244 }
2245
2246 return s;
2247}
2248
2249////////////////////////////////////////////////////////////////////////////////
2250/// Return the selected shape of the histogram (C, L, LF2).
2251
2253{
2254 TString s="";
2255 switch (fAddCombo->GetSelected()){
2256 case (-1) : {s = "" ; break;}
2257 case (kADD_NONE) : {s = "" ; break;}
2258 case (kADD_SMOOTH): {s = "C"; break;}
2259 case (kADD_SIMPLE): {s = "L"; break;}
2260 case (kADD_FILL) : {s = "LF2"; break;}
2261 default : break;
2262 }
2263 if (fAddMarker->GetState()==kButtonDown) s += "P";
2264 if (fAddB->GetState()==kButtonDown) s += "B";
2265 if (fAddBar->GetState()==kButtonDown){
2266 if (fMakeHBar->GetState()==kButtonDown) s+="H";
2267 switch (fPercentCombo->GetSelected()){
2268 case (kPER_0) : { s += "BAR" ; break;}
2269 case (kPER_10): { s += "BAR1"; break;}
2270 case (kPER_20): { s += "BAR2"; break;}
2271 case (kPER_30): { s += "BAR3"; break;}
2272 case (kPER_40): { s += "BAR4"; break;}
2273 }
2274 }
2275
2276 return s;
2277}
2278
2279////////////////////////////////////////////////////////////////////////////////
2280/// Create histogram type combo box.
2281
2283{
2284 TGComboBox *c = new TGComboBox(parent, id);
2285
2286 c->AddEntry("Lego" , kTYPE_LEGO);
2287 c->AddEntry("Lego1", kTYPE_LEGO1);
2288 c->AddEntry("Lego2", kTYPE_LEGO2);
2289 c->AddEntry("Surf" , kTYPE_SURF);
2290 c->AddEntry("Surf1", kTYPE_SURF1);
2291 c->AddEntry("Surf2", kTYPE_SURF2);
2292 c->AddEntry("Surf3", kTYPE_SURF3);
2293 c->AddEntry("Surf4", kTYPE_SURF4);
2294 c->AddEntry("Surf5", kTYPE_SURF5);
2295
2296 return c;
2297}
2298
2299////////////////////////////////////////////////////////////////////////////////
2300/// Create coordinate system type combo box.
2301
2303{
2304 TGComboBox *c = new TGComboBox(parent, id);
2305
2306 c->AddEntry("Cartesian", kCOORDS_CAR);
2307 c->AddEntry("Cylindric", kCOORDS_CYL);
2308 c->AddEntry("Polar", kCOORDS_POL);
2309 c->AddEntry("Rapidity", kCOORDS_PSR);
2310 c->AddEntry("Spheric", kCOORDS_SPH);
2311 TGListBox* lb = c->GetListBox();
2312 lb->Resize(lb->GetWidth(), 83);
2313
2314 return c;
2315}
2316
2317////////////////////////////////////////////////////////////////////////////////
2318/// Create error type combo box.
2319
2321{
2322 TGComboBox *c = new TGComboBox(parent, id);
2323
2324 c->AddEntry("No Errors", kERRORS_NO);
2325 c->AddEntry("Simple", kERRORS_SIMPLE);
2326 c->AddEntry("Edges", kERRORS_EDGES);
2327 c->AddEntry("Rectangles",kERRORS_REC);
2328 c->AddEntry("Fill", kERRORS_FILL);
2329 c->AddEntry("Contour", kERRORS_CONTOUR);
2330
2331 return c;
2332}
2333
2334////////////////////////////////////////////////////////////////////////////////
2335/// Create Line/Bar combo box.
2336
2338{
2339 TGComboBox *c = new TGComboBox(parent, id);
2340
2341 c->AddEntry("No Line", kADD_NONE);
2342 c->AddEntry("Simple Line", kADD_SIMPLE);
2343 c->AddEntry("Smooth Line", kADD_SMOOTH);
2344 c->AddEntry("Fill Area",kADD_FILL);
2345 TGListBox* lb = c->GetListBox();
2346 lb->Resize(lb->GetWidth(), 76);
2347 return c;
2348}
2349
2350////////////////////////////////////////////////////////////////////////////////
2351/// Create Percentage combo box for bar option.
2352
2354{
2355 TGComboBox *c = new TGComboBox(parent, id);
2356
2357 c->AddEntry(" 0 %", kPER_0);
2358 c->AddEntry("10 %", kPER_10);
2359 c->AddEntry("20 %", kPER_20);
2360 c->AddEntry("30 %", kPER_30);
2361 c->AddEntry("40 %", kPER_40);
2362 TGListBox* lb = c->GetListBox();
2363 lb->Resize(lb->GetWidth(), 83);
2364
2365 return c;
2366}
2367
2368////////////////////////////////////////////////////////////////////////////////
2369/// Change the error combo box entry.
2370
2372{
2373 switch (i){
2374 case 0: {
2375 if (((TGLBContainer*)((TGListBox*)fErrorCombo->GetListBox())->GetContainer())->GetPos(kERRORS_EDGES)!=-1)
2380 lb->Resize(lb->GetWidth(),36);
2381 break;
2382 }
2383 case 1: {
2384 if (((TGLBContainer*)((TGListBox*)fErrorCombo->GetListBox())->GetContainer())->GetPos(kERRORS_EDGES)==-1) {
2386 fErrorCombo->AddEntry("Rectangles",kERRORS_REC);
2390 lb->Resize(lb->GetWidth(),100);
2391 }
2392 break;
2393 }
2394 }
2395}
2396
2397 ///////////////////////////////////////////////////////////////////////////////
2398 /// Paint a 3D box.
2399
2401{
2402 if (fGedEditor->GetPad()->GetCanvas())
2406 fGedEditor->GetPad()->cd();
2407 fGedEditor->GetPad()->PaintLine3D(p1, p2);
2408 fGedEditor->GetPad()->PaintLine3D(p2, p3);
2409 fGedEditor->GetPad()->PaintLine3D(p3, p4);
2410 fGedEditor->GetPad()->PaintLine3D(p4, p1);
2411}
2412
2413////////////////////////////////////////////////////////////////////////////////
2414/// Return an array of dividers of n (without the trivial divider n).
2415/// The number of dividers is saved in the first entry.
2416
2418{
2419 Int_t* div;
2420 if (n <= 0) {
2421 div = new Int_t[1];
2422 div[0]=0;
2423 } else if (n == 1) {
2424 div = new Int_t[2];
2425 div[0]=div[1]=1;
2426 } else {
2427 div = new Int_t[(Int_t) n/2+2];
2428 div[0]=0;
2429 div[1]=1;
2430
2431 Int_t num = 1;
2432 for (Int_t i=2; i <= n/2; i++) {
2433 if (n % i == 0) {
2434 num++;
2435 div[num] = i;
2436 }
2437 }
2438 num++;
2439 div[num]=n;
2440 div[0] = num;
2441// for (Int_t a=0; a <= div[0]; a++) printf("div[%d] = %d\n", a , div[a]);
2442 }
2443 return div;
2444}
2445
2446////////////////////////////////////////////////////////////////////////////////
2447/// If the contained histogram obj is deleted we must set its pointer to zero
2448
2450{
2451 if (obj == fHist) {
2452 fHist = 0;
2453 }
2454}
@ kWatch
Definition GuiTypes.h:375
@ kPointer
Definition GuiTypes.h:375
@ kChildFrame
Definition GuiTypes.h:379
@ kVerticalFrame
Definition GuiTypes.h:381
@ kFixedWidth
Definition GuiTypes.h:387
@ kFitWidth
Definition GuiTypes.h:386
@ kHorizontalFrame
Definition GuiTypes.h:382
@ kOwnBackground
Definition GuiTypes.h:391
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
#define d(i)
Definition RSha256.hxx:102
#define f(i)
Definition RSha256.hxx:104
#define c(i)
Definition RSha256.hxx:101
int Int_t
Definition RtypesCore.h:45
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
#define ClassImp(name)
Definition Rtypes.h:377
@ kButtonDown
Definition TGButton.h:54
@ kButtonDisabled
Definition TGButton.h:56
@ kButtonUp
Definition TGButton.h:53
@ kLHintsRight
Definition TGLayout.h:26
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsCenterY
Definition TGLayout.h:28
@ kLHintsTop
Definition TGLayout.h:27
@ kLHintsExpandX
Definition TGLayout.h:30
@ kMBNo
Definition TGMsgBox.h:32
@ kMBYes
Definition TGMsgBox.h:31
@ kMBOk
Definition TGMsgBox.h:33
@ kMBIconExclamation
Definition TGMsgBox.h:24
@ kMBIconQuestion
Definition TGMsgBox.h:23
@ kScaleBoth
Definition TGSlider.h:36
@ kSlider1
Definition TGSlider.h:30
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t sel
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
Option_t Option_t TPoint TPoint const char text
@ kMARKER_ONOFF
ETH1Wid
@ kTYPE_SURF2
@ kADD_TYPE
@ kTH1_TITLE
@ kPER_40
@ kPER_10
@ kADD_NONE
@ kERROR_TYPE
@ kTYPE_HIST
@ kERRORS_EDGES
@ kTYPE_SURF5
@ kADD_FILL
@ kSLIDER_MIN
@ kCOORDS_PSR
@ kTYPE_SURF
@ kTYPE_LEGO
@ kERRORS_REC
@ kTYPE_SURF3
@ kMARKER_ONOFF
@ kTYPE_LEGO2
@ kBAR_H
@ kBAR_ONOFF
@ kTYPE_SURF1
@ kCOORDS_CAR
@ kERRORS_NO
@ kADD_SMOOTH
@ kDIM_COMPLEX
@ kBINSLIDER1
@ kCOORDS_POL
@ kTYPE_SURF4
@ kPER_30
@ kCOORD_TYPE
@ kBAR_OFFSET
@ kCOORDS_SPH
@ kCOORDS_CYL
@ kB_ONOFF
@ kSLIDER_MAX
@ kDELAYED_DRAWING
@ kADD_SIMPLE
@ kADD_LINE
@ kBINSLIDER
@ kPERCENT_TYPE
@ kADD_BAR
@ kTYPE_LEGO1
@ kERRORS_CONTOUR
@ kHIST_TYPE
@ kDIM_SIMPLE
@ kPER_0
@ kBINOFFSET
@ kERRORS_FILL
@ kERRORS_SIMPLE
@ kBAR_WIDTH
@ kPER_20
float ymin
float ymax
#define gROOT
Definition TROOT.h:407
#define gPad
#define gVirtualX
Definition TVirtualX.h:337
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition TAttLine.h:43
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition TAttLine.h:40
Class to manage histogram axis.
Definition TAxis.h:31
Double_t GetXmax() const
Definition TAxis.h:140
virtual Int_t FindBin(Double_t x)
Find bin number corresponding to abscissa x.
Definition TAxis.cxx:293
virtual Double_t GetBinLowEdge(Int_t bin) const
Return low edge of bin.
Definition TAxis.cxx:518
Int_t GetLast() const
Return last bin on the axis i.e.
Definition TAxis.cxx:469
Double_t GetXmin() const
Definition TAxis.h:139
Int_t GetNbins() const
Definition TAxis.h:125
virtual void SetRangeUser(Double_t ufirst, Double_t ulast)
Set the viewing range for the axis from ufirst to ulast (in user coordinates, that is,...
Definition TAxis.cxx:1080
virtual void SetRange(Int_t first=0, Int_t last=0)
Set the viewing range for the axis using bin numbers.
Definition TAxis.cxx:1052
virtual Double_t GetBinWidth(Int_t bin) const
Return bin width.
Definition TAxis.cxx:540
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
Definition TAxis.cxx:528
Int_t GetFirst() const
Return first bin on the axis i.e.
Definition TAxis.cxx:458
void FeedbackMode(Bool_t set)
Turn rubberband feedback mode on or off.
Definition TCanvas.cxx:1129
virtual void SetLayoutHints(TGLayoutHints *l, TGButton *button=nullptr)
Set layout hints for the specified button or if button=0 for all buttons.
virtual void SetRadioButtonExclusive(Bool_t flag=kTRUE)
If enable is kTRUE, this button group will treat radio buttons as mutually exclusive,...
virtual void Show()
Show group of buttons.
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...
virtual void SetToolTipText(const char *text, Long_t delayms=400)
Set tool tip text associated with this button.
Definition TGButton.cxx:445
virtual EButtonState GetState() const
Definition TGButton.h:112
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set button state.
Definition TGButton.cxx:235
Selects different options.
Definition TGButton.h:264
void SetState(EButtonState state, Bool_t emit=kFALSE) override
Set check button state.
const TGWindow * GetDefaultRoot() const
Returns the root (i.e.
Definition TGClient.cxx:234
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition TGClient.cxx:372
A combobox (also known as a drop down listbox) allows the selection of one item out of a list of item...
Definition TGComboBox.h:47
virtual Int_t GetSelected() const
Definition TGComboBox.h:114
virtual void AddEntry(TGString *s, Int_t id)
Definition TGComboBox.h:86
virtual void RemoveEntries(Int_t from_ID, Int_t to_ID)
Definition TGComboBox.h:105
virtual void RemoveEntry(Int_t id=-1)
Remove entry. If id == -1, the currently selected entry is removed.
virtual TGListBox * GetListBox() const
Definition TGComboBox.h:110
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...
The base class for composite widgets (menu bars, list boxes, etc.).
Definition TGFrame.h:287
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1117
void Layout() override
Layout the elements of the composite frame.
Definition TGFrame.cxx:1257
virtual void ShowFrame(TGFrame *f)
Show sub frame.
Definition TGFrame.cxx:1204
void ChangeOptions(UInt_t options) override
Change composite frame options. Options is an OR of the EFrameTypes.
Definition TGFrame.cxx:1043
virtual void HideFrame(TGFrame *f)
Hide sub frame.
Definition TGFrame.cxx:1190
Dragging the slider will generate the event:
virtual Float_t GetMaxPosition() const
virtual Float_t GetMinPosition() const
virtual void SetRange(Float_t min, Float_t max)
virtual void SetPosition(Float_t min, Float_t max)
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition TGFrame.h:80
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition TGFrame.cxx:605
virtual UInt_t GetDefaultHeight() const
Definition TGFrame.h:191
Bool_t Contains(Int_t x, Int_t y) const
Definition TGFrame.h:238
UInt_t GetWidth() const
Definition TGFrame.h:224
Organizes TGButton widgets in a group with one horizontal row.
Concrete class for horizontal slider.
Definition TGSlider.h:119
void Resize(UInt_t w, UInt_t h) override
Resize the frame.
Definition TGSlider.h:138
A horizontal 3D line is a line that typically separates a toolbar from the menubar.
Definition TG3DLine.h:18
A Composite frame that contains a list of TGLBEnties.
Definition TGListBox.h:163
This class handles GUI labels.
Definition TGLabel.h:24
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
A listbox is a box, possibly with scrollbar, containing entries.
Definition TGListBox.h:221
void Resize(UInt_t w, UInt_t h) override
Resize the listbox widget.
Defines top level windows that interact with the system Window Manager.
Definition TGFrame.h:397
virtual void SetNumber(Double_t val, Bool_t emit=kTRUE)
Set the numeric value (floating point representation).
virtual Double_t GetNumber() const
Get the numeric value (floating point representation).
virtual void SetIntNumber(Long_t val, Bool_t emit=kTRUE)
Set the numeric value (integer representation).
virtual void SetLimits(ELimit limits=kNELNoLimits, Double_t min=0, Double_t max=1)
Set the numerical limits.
TGNumberEntry is a number entry input widget with up/down buttons.
TGNumberEntryField * GetNumberEntry() const
Get the number entry field.
virtual Double_t GetNumber() const
virtual void SetNumber(Double_t val, Bool_t emit=kTRUE)
@ kNEANonNegative
Non-negative number.
@ kNEAAnyNumber
Attributes of number entry field.
@ kNESInteger
Style of number entry field.
@ kNESRealFour
Fixed fraction real, four digit.
@ kNESRealTwo
Fixed fraction real, two digit.
@ kNELLimitMinMax
Both lower and upper limits.
TGClient * fClient
Connection to display server.
Definition TGObject.h:25
Handle_t GetId() const
Definition TGObject.h:41
Selects different options.
Definition TGButton.h:321
virtual Int_t GetMaxPosition() const
Definition TGSlider.h:79
virtual Int_t GetPosition() const
Definition TGSlider.h:77
virtual void SetPosition(Int_t pos)
Set slider position.
Definition TGSlider.cxx:110
virtual void SetRange(Int_t min, Int_t max)
Set slider range.
Definition TGSlider.cxx:99
virtual void SetScale(Int_t scale)
Definition TGSlider.h:74
virtual void SetEnabled(Int_t tabIndex, Bool_t on=kTRUE)
Enable or disable tab.
Definition TGTab.cxx:470
A text buffer is used in several widgets, like TGTextEntry, TGFileDialog, etc.
Yield an action as soon as it is clicked.
Definition TGButton.h:142
A TGTextEntry is a one line text input widget.
Definition TGTextEntry.h:24
virtual void SetToolTipText(const char *text, Long_t delayms=500)
Set tool tip text associated with this text entry.
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.
virtual void Associate(const TGWindow *w)
Definition TGWidget.h:72
ROOT GUI Window base class.
Definition TGWindow.h:23
virtual const TGWindow * GetMainFrame() const
Returns top level main frame.
Definition TGWindow.cxx:152
TGTab * GetTab() const
Definition TGedEditor.h:73
virtual TVirtualPad * GetPad() const
Definition TGedEditor.h:78
Base frame for implementing GUI - a service class.
Definition TGedFrame.h:27
TGedEditor * fGedEditor
manager of this frame
Definition TGedFrame.h:48
virtual TGVerticalFrame * CreateEditorTabSubFrame(const char *name)
Create a vertical frame to be used by 'owner' in extra tab 'name'.
Bool_t fInit
init flag for setting signals/slots
Definition TGedFrame.h:47
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition TGedFrame.cxx:95
void SetDrawOption(Option_t *option="") override
Set drawing option for object.
virtual void Refresh(TObject *model)
Refresh the GUI info about the object attributes.
virtual void Update()
Update the current pad when an attribute is changed via GUI.
Definition TGedFrame.cxx:72
Option_t * GetDrawOption() const override
Get draw options of the selected object.
Definition TGedFrame.cxx:80
Bool_t fAvoidSignal
flag for executing slots
Definition TGedFrame.h:50
Editor for changing TH1 histogram attributes, rebinning & fitting.
Definition TH1Editor.h:33
Float_t fP6old[3]
Definition TH1Editor.h:110
static TGComboBox * BuildHistAddComboBox(TGFrame *parent, Int_t id)
Create Line/Bar combo box.
TGNumberEntryField * fSldMin
Contains the minimum value of the x-Axis.
Definition TH1Editor.h:78
virtual void DoHistChanges()
Slot connected to the histogram type, the coordinate type, the error type and the Add combo box.
virtual void DoBinReleased1()
Slot connected to the BinNumber Slider in case of a ntuple histogram (does the Rebinning of the histo...
TGTextButton * fApply
Apply-Button to accept the rebinned histogram.
Definition TH1Editor.h:81
TGHSlider * fBinOffsetSld
Add an offset to the origin of the histogram.
Definition TH1Editor.h:75
~TH1Editor() override
Destructor of TH1 editor.
TGNumberEntryField * fBinNumberEntry
Label which shows the rebinned bin number.
Definition TH1Editor.h:73
TGCompositeFrame * fBinCont
Contains the Rebin Widgets for case 1.
Definition TH1Editor.h:69
TGCheckButton * fAddSimple
Draw a simple histogram (==HIST draw option)
Definition TH1Editor.h:55
TH1 * fHist
histogram object
Definition TH1Editor.h:36
TGCheckButton * fAddMarker
Draw a Marker on top of each bin.
Definition TH1Editor.h:50
Bool_t fMakeB
Definition TH1Editor.h:96
TString GetHistTypeLabel()
Returns the selected histogram type (HIST, LEGO1-2, SURF1-5).
Int_t fPy1old
Definition TH1Editor.h:98
virtual void DoOffsetMoved(Int_t num)
Slot connected to the OffSetSlider.
void ChangeErrorCombo(Int_t i)
Change the error combo box entry.
TGNumberEntry * fBarWidth
Change the Bar Width.
Definition TH1Editor.h:56
Float_t fP3old[3]
Definition TH1Editor.h:107
TGHSlider * fBinSlider1
Slider to set rebinning integer value for ntuple histogram.
Definition TH1Editor.h:72
TGNumberEntryField * fSldMax
Contains the maximum value of the x-Axis.
Definition TH1Editor.h:79
Float_t fP5old[3]
Definition TH1Editor.h:109
TGDoubleHSlider * fSlider
Slider to set x-axis range.
Definition TH1Editor.h:77
TGCompositeFrame * f11
Contains the Bar Width/Offset NumberEntries.
Definition TH1Editor.h:66
virtual void DoHBar(Bool_t on)
Slot connected to the Horizontal Bar check button.
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...
static TGComboBox * BuildPercentComboBox(TGFrame *parent, Int_t id)
Create Percentage combo box for bar option.
TGHButtonGroup * fDimGroup
Radiobuttongroup to change 2D <-> 3D-Plot.
Definition TH1Editor.h:41
TGCheckButton * fAddB
Draw a Bar Chart.
Definition TH1Editor.h:51
virtual void DoAddMarker(Bool_t on)
Slot connected to the show markers check box.
Int_t fPx1old
Definition TH1Editor.h:97
static TGComboBox * BuildHistErrorComboBox(TGFrame *parent, Int_t id)
Create error type combo box.
Bool_t fMake
Definition TH1Editor.h:95
TH1Editor(const TGWindow *p=nullptr, Int_t width=140, Int_t height=30, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
Constructor of histogram attribute GUI.
TGComboBox * fErrorCombo
Error combo box.
Definition TH1Editor.h:48
Double_t fOldOffset
Definition TH1Editor.h:114
TGCheckButton * fDelaydraw
Delayed drawing of the new axis range.
Definition TH1Editor.h:80
virtual void DoAxisRange()
Slot connected to the number entry fields containing the Max/Min value of the x-axis.
virtual void DoHistView()
Slot connected to the 'Plot' button group.
TGCheckButton * fMakeHBar
Draw Horizontal Bar Chart.
Definition TH1Editor.h:54
virtual void ConnectSignals2Slots()
Connect signals to slots.
TGCompositeFrame * f6
Contains the Add-ComboBox (Style)
Definition TH1Editor.h:61
TGNumberEntryField * fOffsetNumberEntry
Shows the offset to the origin of the histogram.
Definition TH1Editor.h:76
Float_t fP8old[3]
Definition TH1Editor.h:112
TGCompositeFrame * fBinCont1
Contains the Rebin Widgets for case 2.
Definition TH1Editor.h:70
TGRadioButton * fDim0
3D-Plot RadioButton
Definition TH1Editor.h:43
TGCompositeFrame * f12
Contains fPercentCombo, fMakeHBar.
Definition TH1Editor.h:67
virtual void DoApply()
Slot connected to the Apply button of the Binning tab.
Int_t * Dividers(Int_t n)
Return an array of dividers of n (without the trivial divider n).
TGComboBox * fPercentCombo
Percentage of the Bar which is drawn in a different color.
Definition TH1Editor.h:59
TGTextButton * fCancel
Cancel-Button to reprobate the rebinned histogram.
Definition TH1Editor.h:82
virtual void DoCancel()
Slot connected to the Cancel button of the Binning tab.
TGHSlider * fBinSlider
Slider to set rebinning integer value.
Definition TH1Editor.h:71
Float_t fP1old[3]
Definition TH1Editor.h:105
TGRadioButton * fDim
2D-Plot RadioButton
Definition TH1Editor.h:42
Int_t fTitlePrec
font precision level
Definition TH1Editor.h:39
TGCheckButton * fAddBar
Bar Option.
Definition TH1Editor.h:52
virtual void DoHistComplex()
Slot connected to the 3D radio button.
virtual void DoSliderReleased()
Slot connected to the x-axis Range slider for finalizing the values of the slider movement.
Bool_t fSameOpt
flag for option "same"
Definition TH1Editor.h:37
virtual void DoAddB(Bool_t)
Slot connected to the bar Add check box.
TGCompositeFrame * f3
Contains Histogram Type.
Definition TH1Editor.h:60
virtual void DoHistSimple()
Slot connected to the 2D radio button.
virtual void DoBinReleased()
Slot connected to the rebin slider in case of a not ntuple histogram Updates some other widgets which...
TGComboBox * fTypeCombo
histogram type combo box
Definition TH1Editor.h:46
TGComboBox * fCoordsCombo
Coordinate System combo box.
Definition TH1Editor.h:47
Int_t fPx2old
Definition TH1Editor.h:99
TGTextEntry * fTitle
histogram title input field
Definition TH1Editor.h:40
TString GetHistAddLabel()
Return the selected shape of the histogram (C, L, LF2).
TGLayoutHints * fDim0lh
layout hints for 3D-Plot RadioButton
Definition TH1Editor.h:45
Float_t fP2old[3]
Definition TH1Editor.h:106
virtual void DoBinPressed()
Slot connected to the rebin slider in case of a not ntuple histogram.
virtual void DoAddSimple(Bool_t on)
Slot connected to fAddSimple check box for drawing a simple histogram without errors (== HIST draw op...
virtual void DoPercent()
Slot connected to the bar percentage settings.
TH1 * fBinHist
Definition TH1Editor.h:113
virtual void DoBarOffset()
Slot connected to the Bar Offset of the Bar Charts.
void CreateBinTab()
Create binning tab.
virtual void DoBarWidth()
Slot connected to the Bar Width of the Bar Charts.
void SetModel(TObject *obj) override
Pick up current values of histogram attributes.
virtual void DoAddBar(Bool_t)
Slot connected to the bar Add check box.
TGNumberEntryField * fBinNumberEntry1
Label which shows the rebinned bin number for ntuple histogram.
Definition TH1Editor.h:74
virtual void PaintBox3D(Float_t *p1, Float_t *p2, Float_t *p3, Float_t *p4)
Paint a 3D box.
TString GetHistErrorLabel()
Return the selected error type (E,E1-5).
virtual void DoBinLabel()
Slot connected to the Bin number entry of the Rebinning tab.
TGLayoutHints * fDimlh
layout hints for 2D-Plot RadioButton
Definition TH1Editor.h:44
TGCompositeFrame * f15
Contains outer line CheckBox.
Definition TH1Editor.h:68
static TGComboBox * BuildHistCoordsComboBox(TGFrame *parent, Int_t id)
Create coordinate system type combo box.
TGNumberEntry * fBarOffset
Change the Bar Offset.
Definition TH1Editor.h:57
TGCompositeFrame * f9
Contains the Bar Option CheckBox.
Definition TH1Editor.h:64
virtual void DoOffsetReleased()
Slot connected to the OffSetSlider.
Float_t fP7old[3]
Definition TH1Editor.h:111
Int_t fPy2old
Definition TH1Editor.h:100
static TGComboBox * BuildHistTypeComboBox(TGFrame *parent, Int_t id)
Create histogram type combo box.
TGCompositeFrame * f7
Contains the Marker OnOff CheckBox.
Definition TH1Editor.h:62
TGCompositeFrame * f8
Contains the Bar Chart CheckBox.
Definition TH1Editor.h:63
Bool_t AcceptModel(TObject *model) override
Check if object is able to configure with this editor.
TGCompositeFrame * fBin
Contains the Binning Widgets.
Definition TH1Editor.h:38
virtual void DoBinLabel1()
Slot connected to the Bin number entry of the Rebinning tab.
TGComboBox * fAddCombo
Add Lines, Bars, Fill.
Definition TH1Editor.h:58
TGCompositeFrame * f10
Contains the Bar Option Title.
Definition TH1Editor.h:65
virtual void DoSliderMoved()
Slot connected to the x-Slider for redrawing of the histogram according to the new Slider range.
virtual void DoBinOffset()
Slot connected to the OffSetNumberEntry which is related to the OffSetSlider changes the origin of th...
virtual void DoOffsetPressed()
Slot connected to the OffSetSlider that saves the OldBinOffset (nessesary for delay draw mode).
virtual void DoTitle(const char *text)
Slot connected to the histogram title setting.
TString GetHistCoordsLabel()
Return the selected coordinate system of the histogram (POL,CYL,SPH,PSR).
void RecursiveRemove(TObject *obj) override
If the contained histogram obj is deleted we must set its pointer to zero.
virtual void DoBinMoved1()
Slot connected to the rebin slider in case of an ntuple histogram.
Float_t fP4old[3]
Definition TH1Editor.h:108
virtual void DoSliderPressed()
Slot connected to the x-axis Range slider for initialising the values of the slider movement.
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:59
virtual void SetDirectory(TDirectory *dir)
By default, when a histogram is created, it is added to the list of histogram objects in the current ...
Definition TH1.cxx:8928
virtual void SetBarOffset(Float_t offset=0.25)
Set the bar offset as fraction of the bin width for drawing mode "B".
Definition TH1.h:364
@ kNoAxis
NOTE: Must always be 0 !!!
Definition TH1.h:72
void SetTitle(const char *title) override
Change/set the title.
Definition TH1.cxx:6709
virtual Float_t GetBarWidth() const
Definition TH1.h:257
virtual Float_t GetBarOffset() const
Definition TH1.h:256
static TClass * Class()
virtual void Reset(Option_t *option="")
Reset this histogram: contents, errors, etc.
Definition TH1.cxx:7094
TAxis * GetXaxis()
Definition TH1.h:324
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),...
Definition TH1.cxx:826
virtual Double_t GetEntries() const
Return the current number of entries.
Definition TH1.cxx:4423
virtual TH1 * Rebin(Int_t ngroup=2, const char *newname="", const Double_t *xbins=nullptr)
Rebin this histogram.
Definition TH1.cxx:6266
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:6640
TObject * Clone(const char *newname="") const override
Make a complete copy of the underlying object.
Definition TH1.cxx:2752
virtual void SetBins(Int_t nx, Double_t xmin, Double_t xmax)
Redefine x axis parameters.
Definition TH1.cxx:8758
virtual void SetBarWidth(Float_t width=0.5)
Set the width of bars as fraction of the bin width for drawing mode "B".
Definition TH1.h:365
const char * GetTitle() const override
Returns title of object.
Definition TNamed.h:48
Mother of all ROOT objects.
Definition TObject.h:41
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:525
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:869
Bool_t Disconnect(const char *signal=nullptr, void *receiver=nullptr, const char *slot=nullptr)
Disconnects signal of this object from slot of receiver.
A specialized TSelector for TTree::Draw.
Basic string class.
Definition TString.h:139
TString & Insert(Ssiz_t pos, const char *s)
Definition TString.h:661
Ssiz_t First(char c) const
Find first occurrence of a character c.
Definition TString.cxx:538
const char * Data() const
Definition TString.h:376
void ToUpper()
Change string to upper case.
Definition TString.cxx:1195
Bool_t IsNull() const
Definition TString.h:414
TString & Remove(Ssiz_t pos)
Definition TString.h:685
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:632
Implement some of the functionality of the class TTree requiring access to extra libraries (Histogram...
Definition TTreePlayer.h:37
TH1 * GetHistogram() const override
Definition TTreePlayer.h:75
Int_t GetNfill() const override
Definition TTreePlayer.h:78
TSelector * GetSelector() const override
Definition TTreePlayer.h:82
See TView3D.
Definition TView.h:25
virtual Double_t * GetRmax()=0
virtual Double_t * GetRmin()=0
virtual Int_t YtoAbsPixel(Double_t y) const =0
virtual Double_t GetUymax() const =0
virtual void PaintLine3D(Float_t *p1, Float_t *p2)=0
virtual TVirtualPad * cd(Int_t subpadnumber=0)=0
virtual Int_t XtoAbsPixel(Double_t x) const =0
virtual Double_t GetUymin() const =0
virtual TView * GetView() const =0
virtual TCanvas * GetCanvas() const =0
static TVirtualTreePlayer * GetCurrentPlayer()
Static function: return the current player (if any)
leg AddEntry(h1,"Histogram filled with random numbers","f")
const Int_t n
Definition legend1.C:16
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition TMathBase.h:123