Logo ROOT  
Reference Guide
TH2Editor.cxx
Go to the documentation of this file.
1// @(#)root/ged:$Id$
2// Author: Carsten Hof 09/08/04
3// Authors mail: Carsten_Hof@web.de
4
5/*************************************************************************
6 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
7 * All rights reserved. *
8 * *
9 * For the licensing terms see $ROOTSYS/LICENSE. *
10 * For the list of contributors see $ROOTSYS/README/CREDITS. *
11 *************************************************************************/
12
13
14/**\class TH2Editor
15 \ingroup ged
16
17Editor for changing TH2 histogram attributes, rebinning & fitting.
18For all possible draw options (there are a few which are not implementable
19in a graphical user interface) see THistPainter::Paint.
20
21These changes can be made via the TH2Editor:
22Style Tab:
23 'Line' : change Line attributes (color, thickness)
24 see TAttLineEditor
25 'Fill' : change Fill attributes (color, pattern)
26 see TAttFillEditor
27 'Title' : TextEntry: set the title of the histogram
28 'Histogram': change the draw options of the histogram
29 'Plot' : Radiobutton: draw a 2D or 3D plot of the histogram
30 according to the Plot dimension there will be
31 different drawing possibilities (ComboBoxes/
32 CheckBoxes)
332d Plot:
34 'Contour' : ComboBox: draw a contour plot (None, Cont0..4)
35 'Cont #' : TGNumberEntry: set the number of Contours
362d Plot checkboxes:
37 'Arrow' : arrow mode. Shows gradient between adjacent cells
38 'Col' : a box is drawn for each cell with a color scale
39 varying with contents
40 'Text' : Draw bin contents as text
41 'Box' : a box is drawn for each cell with surface
42 proportional to contents
43 'Scat' : Draw a scatter-plot (default)
44 'Palette' : the color palette is drawn
45
463d Plot:
47 'Type' : ComboBox: set histogram type Lego or Surface-Plot
48 draw(Lego, Lego1..4, Surf, Surf1..5)
49 see THistPainter::Paint
50 'Coords' : ComboBox: set the coordinate system (Cartesian, ..
51 Spheric) see THistPainter::Paint
52 'Cont #' : TGNumberEntry: set the number of Contours (for e.g.
53 Lego2 drawoption
543d Plot checkboxes:
55 'Errors' : draw errors in a cartesian lego plot
56 'Palette' : the color palette is drawn
57 'Front' : draw the front box of a cartesian lego plot
58 'Back' : draw the back box of a cartesian lego plot
59Available for a 3D lego plot:
60 'Bar' : change the bar attributes
61 'W' : change Bar Width
62 'O' : change Bar Offset
63Further Editor:
64 'Marker' : change the Marker attributes (color, appearance,
65 thickness) see TAttMarkerEditor
66
67
68Rebinning Tab:
69 This Tab has two different layouts. One is for a histogram which
70 is not drawn from an ntuple. The other one is available for a
71 histogram which is drawn from an ntuple. In this case the rebin
72 algorithm can create a rebinned histogram from the original data
73 i.e. the ntuple.
74 To see te differences do for example:
75 TFile f("hsimple.root");
76 hpxpy->Draw("Lego2"); // non ntuple histogram
77 ntuple->Draw("px:py","","Lego2"); // ntuple histogram
78Non ntuple histogram:
79 'Rebin': with the Sliders (one for the x, one for the y axis)
80 the number of bins (shown in the field below the
81 Slider) can be changed to any number which divides
82 the number of bins of the original histogram.
83 Pushing 'Apply' will delete the origin histogram and
84 replace it by the rebinned one on the screen.
85 Pushing 'Ignore' the origin histogram will be restored
86Histogram drawn from an ntuple:
87 'Rebin' with the sliders the number of bins can be enlarged by
88 a factor of 2,3,4,5 (moving to the right) or reduced
89 by a factor of 1/2, 1/3, 1/4, 1/5
90 'BinOffset': with the BinOffset slider the origin of the
91 histogram can be changed within one binwidth
92 Using this slider the effect of binning the data into
93 bins can be made visible => statistical fluctuations
94 'Axis Range': with the DoubleSlider it is possible to zoom into
95 the specified axis range. It is also possible to set
96 the upper and lower limit in fields below the slider
97 'Delayed drawing': all the Binning sliders can be set to delay
98 draw mode. Then the changes on the histogram are only
99 updated, when the Slider is released. This should be
100 activated if the redrawing of the histogram is too
101 time consuming. //
102*/
103
104
105#include "TH2Editor.h"
106#include "TGedEditor.h"
107#include "TGComboBox.h"
108#include "TGTextEntry.h"
109#include "TGLabel.h"
110#include "TVirtualPad.h"
111#include "TString.h"
112#include "TGButtonGroup.h"
113#include "TGNumberEntry.h"
114#include "TG3DLine.h"
115#include "TGDoubleSlider.h"
116#include "TGSlider.h"
117#include "TView.h"
118#include "TCanvas.h"
119#include "TGedPatternSelect.h"
120#include "TGColorSelect.h"
121#include "TColor.h"
122#include "TTreePlayer.h"
123#include "TSelectorDraw.h"
124#include "TGTab.h"
125#include "TGMsgBox.h"
126#include "TH2.h"
127#include "TROOT.h"
128#include "TVirtualX.h"
129
130
132
150
151////////////////////////////////////////////////////////////////////////////////
152/// Constructor of histogram attribute GUI.
153
155 Int_t height, UInt_t options, Pixel_t back)
156 : TGedFrame(p, width, height, options | kVerticalFrame, back),
157 fHist(0),
158 fBin(0),
159 fBinHist(0)
160{
161 MakeTitle("Title");
162
163 // Histogram title
164 fTitlePrec = 2;
165 fTitle = new TGTextEntry(this, new TGTextBuffer(50), kTH2_TITLE);
167 fTitle->SetToolTipText("Enter the histogram title string");
168 AddFrame(fTitle, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5));
169
170
171 // 2D or 3D Plot?
172 TGCompositeFrame *f2 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
173 fDimGroup = new TGHButtonGroup(f2,"Plot");
175 fDim->SetToolTipText("A 2-d plot of the histogram is dawn");
177 fDim0->SetToolTipText("A 3-d plot of the histogram is dawn");
180 fDimGroup->Show();
182 f2->AddFrame(fDimGroup, new TGLayoutHints(kLHintsTop, 4, 1, 0, 0));
183 AddFrame(f2, new TGLayoutHints(kLHintsTop, 1, 1, 2, 5));
184
185 // 2D Plot drawoptions
186 f6 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
187 AddFrame(f6, new TGLayoutHints(kLHintsTop, 3, 1, 4, 2));
188
189 TGCompositeFrame *f7 = new TGCompositeFrame(f6, 40, 20);
190 f6->AddFrame(f7, new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
191
192 TGLabel *fAddLabel = new TGLabel(f7, "Contour:");
193 f7->AddFrame(fAddLabel, new TGLayoutHints(kLHintsLeft, 6, 4, 4, 4));
194
195 fColContLbl = new TGLabel(f7, "Cont #:");
196 f7->AddFrame(fColContLbl, new TGLayoutHints( kLHintsLeft, 6, 4, 4, 4));
197
198 fAddArr = new TGCheckButton(f7, "Arrow", kARROW_ONOFF);
199 fAddArr ->SetToolTipText("Shows gradient between adjacent cells");
200 f7->AddFrame(fAddArr, new TGLayoutHints(kLHintsLeft, 6, 1, 2, 0));
201
202 fAddCol = new TGCheckButton(f7, "Col", kCOL_ONOFF);
203 fAddCol ->SetToolTipText("A box is drawn for each cell with a color scale varying with contents");
204 f7->AddFrame(fAddCol, new TGLayoutHints(kLHintsLeft, 6, 1, 1, 0));
205
206 fAddText = new TGCheckButton(f7, "Text", kTEXT_ONOFF);
207 fAddText ->SetToolTipText("Draw bin contents as text");
208 f7->AddFrame(fAddText, new TGLayoutHints(kLHintsLeft, 6, 1, 1, 3));
209
211 f6->AddFrame(f8, new TGLayoutHints(kLHintsLeft, 5, 1, 0, 0));
212
214 f8->AddFrame(fContCombo, new TGLayoutHints(kLHintsLeft, 6, 1, 2, 1));
215 fContCombo->Resize(61, 20);
216 fContCombo->Associate(this);
217
218 fContLevels = new TGNumberEntry(f8, 20, 0, kCONT_LEVELS,
222 f8->AddFrame(fContLevels, new TGLayoutHints(kLHintsLeft, 6, 1, 3, 1));
223 fContLevels->GetNumberEntry()->SetToolTipText("Set number of contours (1..99)");
224 fContLevels->Resize(60,20);
225
226 fAddBox = new TGCheckButton(f8, "Box", kBOX_ONOFF);
227 fAddBox ->SetToolTipText("A box is drawn for each cell with surface proportional to contents");
228 f8->AddFrame(fAddBox, new TGLayoutHints(kLHintsLeft, 6, 1, 3, 0));
229
230 fAddScat = new TGCheckButton(f8, "Scat", kSCAT_ONOFF);
231 fAddScat ->SetToolTipText("Draw a scatter-plot");
232 f8->AddFrame(fAddScat, new TGLayoutHints(kLHintsLeft, 6, 1, 1, 0));
233
234 fAddPalette = new TGCheckButton(f8, "Palette", kPALETTE_ONOFF);
235 fAddPalette ->SetToolTipText("Add color palette beside the histogram");
236 f8->AddFrame(fAddPalette, new TGLayoutHints(kLHintsLeft, 6, 1, 1, 0));
237
238 f9 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
239 AddFrame(f9, new TGLayoutHints(kLHintsTop, 3, 1, 2, 0));
240
241 TGCompositeFrame *f10 = new TGCompositeFrame(f9, 40, 20);
242 f9->AddFrame(f10, new TGLayoutHints(kLHintsLeft, 0, 0, 3, 0));
243
244 TGLabel *fType = new TGLabel(f10, "Type:");
245 f10->AddFrame(fType, new TGLayoutHints(kLHintsNormal, 1, 1, 1, 1));
246
247 TGLabel *fCoords = new TGLabel(f10, "Coords:");
248 f10->AddFrame(fCoords, new TGLayoutHints(kLHintsLeft, 1, 1, 5, 1));
249
250 fColContLbl1 = new TGLabel(f10, "Cont #:");
251 f10->AddFrame(fColContLbl1, new TGLayoutHints( kLHintsLeft, 1, 1, 5, 3));
252
253 fAddFB = new TGCheckButton(f10, "Front", kFRONTBOX_ONOFF);
254 fAddFB ->SetToolTipText("Supress the drawing of the front box");
255 f10->AddFrame(fAddFB, new TGLayoutHints(kLHintsLeft, 0, 1, 6, 0));
256 fAddBB = new TGCheckButton(f10, "Back", kBACKBOX_ONOFF);
257 fAddBB ->SetToolTipText("Supress the drawing of the back box");
258 f10->AddFrame(fAddBB, new TGLayoutHints(kLHintsLeft, 0, 1, 3, 0));
259
260 TGCompositeFrame *f11 = new TGCompositeFrame(f9, 40, 20);
261 f9->AddFrame(f11, new TGLayoutHints(kLHintsLeft, 5, 1, 0, 0));
262
264 f11->AddFrame(fTypeCombo, new TGLayoutHints(kLHintsLeft, 0, 1, 2, 1));
265 fTypeCombo->Resize(80, 20);
266 fTypeCombo->Associate(this);
267
269 f11->AddFrame(fCoordsCombo, new TGLayoutHints(kLHintsLeft, 0, 1, 2, 1));
270 fCoordsCombo->Resize(80, 20);
271 fCoordsCombo->Associate(this);
272
273 fContLevels1 = new TGNumberEntry(f11, 20, 0, kCONT_LEVELS1,
277 fContLevels1->GetNumberEntry()->SetToolTipText("Set number of contours (1..99)");
278 fContLevels1->Resize(78,20);
279 f11->AddFrame(fContLevels1, new TGLayoutHints(kLHintsLeft, 0, 1, 2, 1));
280
281 fAddError = new TGCheckButton(f11, "Errors", kERROR_ONOFF);
282 fAddError ->SetToolTipText("Add color palette beside the histogram");
283 f11->AddFrame(fAddError, new TGLayoutHints(kLHintsLeft, 0, 1, 4, 0));
284 fAddPalette1 = new TGCheckButton(f11, "Palette", kPALETTE_ONOFF1);
285 fAddPalette1 ->SetToolTipText("Add color palette beside the histogram");
286 f11->AddFrame(fAddPalette1, new TGLayoutHints(kLHintsLeft, 0, 1, 3, 0));
287
288
289 // Bin bar settings
290 f12 = new TGCompositeFrame(this, 145, 10, kHorizontalFrame |
294 f12->AddFrame(new TGLabel(f12,"Bar"),
295 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
297 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
298 AddFrame(f12, new TGLayoutHints(kLHintsTop,0,0,6,4));
299
300 f13 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
301 TGLabel *fWidthLbl = new TGLabel(f13, "W:");
302 f13->AddFrame(fWidthLbl, new TGLayoutHints( kLHintsLeft, 1, 3, 4, 1));
303 fBarWidth = new TGNumberEntry(f13, 1.00, 6, kBAR_WIDTH,
307 fBarWidth->GetNumberEntry()->SetToolTipText("Set bar chart width");
308 fBarWidth->Resize(45,20);
309 f13->AddFrame(fBarWidth, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 1));
310
311 TGLabel *fOffsetLbl = new TGLabel(f13, "O:");
312 f13->AddFrame(fOffsetLbl, new TGLayoutHints(kLHintsLeft, 6,3, 4, 1));
313 fBarOffset = new TGNumberEntry(f13, 0.00, 5, kBAR_OFFSET,
317 fBarOffset->GetNumberEntry()->SetToolTipText("Set bar chart offset");
318 fBarOffset->Resize(50,20);
319 f13->AddFrame(fBarOffset, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 1));
320 AddFrame(f13, new TGLayoutHints(kLHintsTop, 1, 1, 0, 4));
321
322
323 // Set the color and pattern of the Frame (only for Cartesian 3D plot).
324 f38 = new TGCompositeFrame(this, 80, 20, kVerticalFrame);
329 f39->AddFrame(new TGLabel(f39,"Frame Fill"),
330 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
331 f39->AddFrame(new TGHorizontal3DLine(f39),
332 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
333 f38->AddFrame(f39, new TGLayoutHints(kLHintsTop,0,0,6,1));
334
336 fFrameColor = new TGColorSelect(f21, 0, kCOLOR);
337 f21->AddFrame(fFrameColor, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 0));
340 f21->AddFrame(fFramePattern, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 0));
342 f38->AddFrame(f21, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
344
345 fCutString = "";
346
347 CreateBinTab();
348
349 // add itself in the least of cleanups to be notified when attached histogram is deleted
350 gROOT->GetListOfCleanups()->Add(this);
351}
352
353////////////////////////////////////////////////////////////////////////////////
354/// Create the Binning tab.
355
357{
358 fBin = CreateEditorTabSubFrame("Binning");
359
360 // Editor for rebinning a histogram which does NOT derive from an Ntuple
362 TGCompositeFrame *title1 = new TGCompositeFrame(fBinXCont, 145, 10,
367 title1->AddFrame(new TGLabel(title1, "Rebin"),
368 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
369 title1->AddFrame(new TGHorizontal3DLine(title1),
370 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
371 fBinXCont->AddFrame(title1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
372
375 TGLabel *binSliderXLbl = new TGLabel(f22,"x:");
376 f22->AddFrame(binSliderXLbl,
377 new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 4,0, 4, 1));
378 fBinXSlider = new TGHSlider(f22, 100, kSlider1 | kScaleBoth);
379 fBinXSlider->Resize(107,20);
380 f22->AddFrame(fBinXSlider, new TGLayoutHints(kLHintsLeft, 2,0,0,3));
381 fBinXCont->AddFrame(f22, new TGLayoutHints(kLHintsTop, 3, 7, 3, 5));
382
385 TGLabel *binXLabel1 = new TGLabel(f23, "# of Bins:");
386 f23->AddFrame(binXLabel1, new TGLayoutHints(kLHintsLeft, 20, 1, 2, 1));
389 ((TGTextEntry*)fBinXNumberEntry)->SetToolTipText("Set the number of x axis bins in the rebinned histogram");
390 fBinXNumberEntry->Resize(57,20);
391 f23->AddFrame(fBinXNumberEntry, new TGLayoutHints(kLHintsRight, 8, 0, 0, 0));
392 fBinXCont->AddFrame(f23, new TGLayoutHints(kLHintsTop, 0, 7, 3, 4));
393
396 TGLabel *binSliderYLbl = new TGLabel(f37,"y:");
397 f37->AddFrame(binSliderYLbl,
398 new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 4,0, 4, 1));
399 fBinYSlider = new TGHSlider(f37, 100, kSlider1 | kScaleBoth);
400 fBinYSlider->Resize(107,20);
401 f37->AddFrame(fBinYSlider, new TGLayoutHints(kLHintsLeft, 1,0,0,3));
402 fBinXCont->AddFrame(f37, new TGLayoutHints(kLHintsTop, 3, 7, 3, 5));
403
406 TGLabel *binYLabel1 = new TGLabel(f36, "# of Bins:");
407 f36->AddFrame(binYLabel1, new TGLayoutHints(kLHintsLeft, 20, 1, 2, 1));
410 ((TGTextEntry*)fBinYNumberEntry)->SetToolTipText("Set the number of y axis bins in the rebinned histogram");
411 fBinYNumberEntry->Resize(57,20);
412 f36->AddFrame(fBinYNumberEntry, new TGLayoutHints(kLHintsRight, 8, 0, 0, 0));
413 fBinXCont->AddFrame(f36, new TGLayoutHints(kLHintsTop, 0, 7, 3, 4));
414
415 // Text buttons Apply & Ignore for rebinned histogram shown on the screen.
416 TGCompositeFrame *f24 = new TGCompositeFrame(fBinXCont, 118, 20,
419 fApply = new TGTextButton(f24, " &Apply ");
420 f24->AddFrame(fApply,
421 new TGLayoutHints(kLHintsExpandX | kLHintsLeft ,0, 3, 4, 4));
422 fCancel = new TGTextButton(f24, " &Ignore ");
423 f24->AddFrame(fCancel,
424 new TGLayoutHints(kLHintsExpandX | kLHintsLeft, 3, 0, 4, 4));
425 fBinXCont->AddFrame(f24, new TGLayoutHints(kLHintsTop, 20, 3, 3, 4));
427
428 // Widgets for rebinning a histogram which derives from an Ntuple
429
431 TGCompositeFrame *title2 = new TGCompositeFrame(fBinXCont1, 145, 10,
436 title2->AddFrame(new TGLabel(title2, "X-Axis"),
437 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
438 title2->AddFrame(new TGHorizontal3DLine(title2),
439 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
440 fBinXCont1->AddFrame(title2, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
441
444 fBinXSlider1 = new TGHSlider(f26, 100, kSlider1 | kScaleBoth);
445 fBinXSlider1->Resize(120,20);
449 f26->AddFrame(fBinXSlider1, new TGLayoutHints(kLHintsLeft, 2,0,0,0));
450 fBinXCont1->AddFrame(f26, new TGLayoutHints(kLHintsTop, 3, 7, 3, 0));
451
452 // Lettering of the Rebin Slider
455 TGLabel *l1 = new TGLabel(f27, "-5");
456 f27->AddFrame(l1, new TGLayoutHints(kLHintsLeft, 5, 1, -1, 0));
457 TGLabel *l2 = new TGLabel(f27, "-2");
458 f27->AddFrame(l2, new TGLayoutHints(kLHintsLeft, 31, 2, -1, 0));
459 TGLabel *l3 = new TGLabel(f27, "2");
460 f27->AddFrame(l3, new TGLayoutHints(kLHintsLeft, 21, 2, -1, 0));
461 TGLabel *l4 = new TGLabel(f27, "5");
462 f27->AddFrame(l4, new TGLayoutHints(kLHintsLeft, 36, 3, -1, 0));
463 fBinXCont1->AddFrame(f27, new TGLayoutHints(kLHintsTop, 0, 0, 0, 0));
464
465 TGCompositeFrame *f28 = new TGCompositeFrame(fBinXCont1, 140, 20,
467 TGLabel *binXLabel2 = new TGLabel(f28, "# of Bins:");
468 f28->AddFrame(binXLabel2, new TGLayoutHints(kLHintsLeft, 8, 1, 4, 1));
469
472 ((TGTextEntry*)fBinXNumberEntry1)->SetToolTipText("Set the number of x axis bins in the rebinned histogram");
475 new TGLayoutHints(kLHintsLeft, 21, 0, 2, 0));
476 fBinXCont1->AddFrame(f28, new TGLayoutHints(kLHintsTop, 0, 7, 2, 4));
477
480 TGLabel *xOffsetLbl = new TGLabel(f29, "BinOffset:");
481 f29->AddFrame(xOffsetLbl, new TGLayoutHints(kLHintsLeft, 7, 1, 2, 1));
486 0., 1.);
487 ((TGTextEntry*)fXOffsetNumberEntry)->SetToolTipText("Add an x-offset to the origin of the histogram");
490 new TGLayoutHints(kLHintsRight, 21, 0, 0, 0));
491 fBinXCont1->AddFrame(f29, new TGLayoutHints(kLHintsTop, 0, 7, 3, 1));
492
495 fXBinOffsetSld = new TGHSlider(f30, 100, kSlider1 | kScaleBoth);
496 fXBinOffsetSld->Resize(120,20);
498 fBinXCont1->AddFrame(f30, new TGLayoutHints(kLHintsTop, 3, 7, 3, 3));
500
501 // Same for Y-Axis:
502 // Widgets for rebinning a histogram which derives from an Ntuple
503
505 TGCompositeFrame *title3 = new TGCompositeFrame(fBinYCont1, 145, 10,
510 title3->AddFrame(new TGLabel(title3, "Y-Axis"),
511 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
512 title3->AddFrame(new TGHorizontal3DLine(title3),
513 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
514 fBinYCont1->AddFrame(title3, new TGLayoutHints(kLHintsTop, 0, 0, 7, 0));
515
518 fBinYSlider1 = new TGHSlider(f31, 100, kSlider1 | kScaleBoth);
519 fBinYSlider1->Resize(120,20);
523 f31->AddFrame(fBinYSlider1, new TGLayoutHints(kLHintsLeft, 2,0,0,0));
524 fBinYCont1->AddFrame(f31, new TGLayoutHints(kLHintsTop, 3, 7, 3, 0));
525
526 // Lettering of the Rebin Slider
529 TGLabel *l5 = new TGLabel(f32, "-5");
530 f32->AddFrame(l5, new TGLayoutHints(kLHintsLeft, 5, 1, -1, 0));
531 TGLabel *l6 = new TGLabel(f32, "-2");
532 f32->AddFrame(l6, new TGLayoutHints(kLHintsLeft, 31, 2, -1, 0));
533 TGLabel *l7 = new TGLabel(f32, "2");
534 f32->AddFrame(l7, new TGLayoutHints(kLHintsLeft, 21, 2, -1, 0));
535 TGLabel *l8 = new TGLabel(f32, "5");
536 f32->AddFrame(l8, new TGLayoutHints(kLHintsLeft, 36, 3, -1, 0));
537 fBinYCont1->AddFrame(f32, new TGLayoutHints(kLHintsTop, 0, 0, 0, 0));
538
539 TGCompositeFrame *f33 = new TGCompositeFrame(fBinYCont1, 140, 20,
541 TGLabel *binYLabel2 = new TGLabel(f33, "# of Bins:");
542 f33->AddFrame(binYLabel2, new TGLayoutHints(kLHintsLeft, 8, 1, 4, 1));
543
546 ((TGTextEntry*)fBinYNumberEntry1)->SetToolTipText("Set the number of Y axis bins in the rebinned histogram");
549 new TGLayoutHints(kLHintsLeft, 21, 0, 2, 0));
550 fBinYCont1->AddFrame(f33, new TGLayoutHints(kLHintsTop, 0, 7, 2, 4));
551
554 TGLabel *yOffsetLbl = new TGLabel(f34, "BinOffset:");
555 f34->AddFrame(yOffsetLbl, new TGLayoutHints(kLHintsLeft, 7, 1, 2, 1));
560 0., 1.);
561 ((TGTextEntry*)fYOffsetNumberEntry)->SetToolTipText("Add an Y-offset to the origin of the histogram");
564 new TGLayoutHints(kLHintsRight, 21, 0, 0, 0));
565 fBinYCont1->AddFrame(f34, new TGLayoutHints(kLHintsTop, 0, 7, 3, 1));
566
569 fYBinOffsetSld = new TGHSlider(f35, 100, kSlider1 | kScaleBoth);
570 fYBinOffsetSld->Resize(120,20);
573 fBinYCont1->AddFrame(f35, new TGLayoutHints(kLHintsTop, 3, 7, 3, 3));
575
576 // Axis ranges
577 TGCompositeFrame *title4 = new TGCompositeFrame(fBin, 145, 10,
582 title4->AddFrame(new TGLabel(title4, "Axis Range"),
583 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
584 title4->AddFrame(new TGHorizontal3DLine(title4),
585 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
586 fBin->AddFrame(title4, new TGLayoutHints(kLHintsTop, 0, 0, 5, 0));
587
589 TGLabel *fSliderXLbl = new TGLabel(f14,"x:");
590 f14->AddFrame(fSliderXLbl,
591 new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 4,3, 2, 1));
592 fSliderX = new TGDoubleHSlider(f14, 1, 2);
593 fSliderX->Resize(119,20);
595 fBin->AddFrame(f14, new TGLayoutHints(kLHintsTop, 3, 7, 4, 1));
596
601 ((TGTextEntry*)fSldXMin)->SetToolTipText("Set the minimum value of the x-axis");
602 fSldXMin->Resize(57,20);
603 f17->AddFrame(fSldXMin, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
607 ((TGTextEntry*)fSldXMax)->SetToolTipText("Set the maximum value of the x-axis");
608 fSldXMax->Resize(57,20);
609 f17->AddFrame(fSldXMax, new TGLayoutHints(kLHintsLeft, 4, 0, 0, 0));
610 fBin->AddFrame(f17, new TGLayoutHints(kLHintsTop, 20, 3, 5, 0));
611
613 TGLabel *fSliderYLbl = new TGLabel(f15,"y:");
614 f15->AddFrame(fSliderYLbl,
615 new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 4,2, 4, 1));
616 fSliderY = new TGDoubleHSlider(f15, 1, 2);
617 fSliderY->Resize(119,20);
619 fBin->AddFrame(f15, new TGLayoutHints(kLHintsTop, 3, 7, 4, 1));
620
625 ((TGTextEntry*)fSldYMin)->SetToolTipText("Set the minimum value of the y-axis");
626 fSldYMin->Resize(57,20);
627 f18->AddFrame(fSldYMin, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
631 ((TGTextEntry*)fSldYMax)->SetToolTipText("Set the maximum value of the y-axis");
632 fSldYMax->Resize(57,20);
633 f18->AddFrame(fSldYMax, new TGLayoutHints(kLHintsLeft, 4, 0, 0, 0));
634 fBin->AddFrame(f18, new TGLayoutHints(kLHintsTop, 20, 3, 5, 0));
635
637 fDelaydraw = new TGCheckButton(f20, "Delayed drawing", kDELAYED_DRAWING);
638 fDelaydraw ->SetToolTipText("Draw the new axis range when the Slider is released");
639 f20->AddFrame(fDelaydraw, new TGLayoutHints(kLHintsLeft, 6, 1, 1, 0));
640 fBin->AddFrame(f20, new TGLayoutHints(kLHintsTop, 2, 1, 5, 3));
641
642 fXBinOffsetSld->SetRange(0,100);
645
646 fYBinOffsetSld->SetRange(0,100);
649
652
653}
654
655////////////////////////////////////////////////////////////////////////////////
656/// Destructor.
657
659{
660 // remove itselef from the list of cleanups
661 gROOT->GetListOfCleanups()->Remove(this);
662
663 // children of TGButonGroup are not deleted
664 delete fDim;
665 delete fDim0;
666 delete fDimlh;
667 delete fDim0lh;
668
669 if (fBinHist) delete fBinHist;
670 fBinHist = 0;
671}
672
673////////////////////////////////////////////////////////////////////////////////
674/// Connect signals to slots.
675
677{
678 fTitle->Connect("TextChanged(const char *)", "TH2Editor", this, "DoTitle(const char *)");
679 fDimGroup->Connect("Clicked(Int_t)","TH2Editor",this,"DoHistView()");
680 fTypeCombo->Connect("Selected(Int_t)", "TH2Editor", this, "DoHistChanges()");
681 fCoordsCombo->Connect("Selected(Int_t)", "TH2Editor", this, "DoHistChanges()");
682 fContCombo->Connect("Selected(Int_t)", "TH2Editor", this, "DoHistChanges()");
683 fAddArr->Connect("Toggled(Bool_t)", "TH2Editor", this, "DoAddArr(Bool_t)");
684 fAddBox->Connect("Toggled(Bool_t)", "TH2Editor", this, "DoAddBox(Bool_t)");
685 fAddCol->Connect("Toggled(Bool_t)", "TH2Editor", this, "DoAddCol(Bool_t)");
686 fAddScat->Connect("Toggled(Bool_t)", "TH2Editor", this, "DoAddScat(Bool_t)");
687 fAddText->Connect("Toggled(Bool_t)", "TH2Editor", this, "DoAddText(Bool_t)");
688 fAddError->Connect("Toggled(Bool_t)", "TH2Editor", this, "DoAddError(Bool_t)");
689 fAddPalette->Connect("Toggled(Bool_t)", "TH2Editor", this, "DoAddPalette(Bool_t)");
690 fAddPalette1->Connect("Toggled(Bool_t)", "TH2Editor", this, "DoAddPalette(Bool_t)");
691 fAddFB->Connect("Toggled(Bool_t)", "TH2Editor", this, "DoAddFB()");
692 fAddBB->Connect("Toggled(Bool_t)", "TH2Editor", this, "DoAddBB()");
693 fContLevels->Connect("ValueSet(Long_t)", "TH2Editor", this, "DoContLevel()");
694 (fContLevels->GetNumberEntry())->Connect("ReturnPressed()", "TH2Editor",
695 this,"DoContLevel()");
696 fContLevels1->Connect("ValueSet(Long_t)", "TH2Editor", this, "DoContLevel1()");
697 (fContLevels1->GetNumberEntry())->Connect("ReturnPressed()", "TH2Editor",
698 this,"DoContLevel1()");
699 fBarWidth->Connect("ValueSet(Long_t)", "TH2Editor", this, "DoBarWidth()");
700 (fBarWidth->GetNumberEntry())->Connect("ReturnPressed()", "TH2Editor",
701 this, "DoBarWidth()");
702 fBarOffset->Connect("ValueSet(Long_t)", "TH2Editor", this, "DoBarOffset()");
703 (fBarOffset->GetNumberEntry())->Connect("ReturnPressed()", "TH2Editor",
704 this, "DoBarOffset()");
705 fBinXSlider->Connect("PositionChanged(Int_t)","TH2Editor",this, "DoBinMoved()");
706 fBinXSlider->Connect("Released()","TH2Editor",this, "DoBinReleased()");
707 fBinXSlider->Connect("Pressed()","TH2Editor",this, "DoBinPressed()");
708 fBinYSlider->Connect("PositionChanged(Int_t)","TH2Editor",this, "DoBinMoved()");
709 fBinYSlider->Connect("Released()","TH2Editor",this, "DoBinReleased()");
710 fBinYSlider->Connect("Pressed()","TH2Editor",this, "DoBinPressed()");
711 fBinXNumberEntry->Connect("ReturnPressed()", "TH2Editor", this, "DoBinLabel()");
712 fBinYNumberEntry->Connect("ReturnPressed()", "TH2Editor", this, "DoBinLabel()");
713 fApply->Connect("Clicked()", "TH2Editor", this, "DoApply()");
714 fCancel->Connect("Pressed()", "TH2Editor", this, "DoCancel()");
715 fBinXSlider1->Connect("Released()","TH2Editor",this, "DoBinReleased1()");
716 fBinXSlider1->Connect("PositionChanged(Int_t)","TH2Editor",this, "DoBinMoved1()");
717 fBinXNumberEntry1->Connect("ReturnPressed()", "TH2Editor", this, "DoBinLabel1()");
718 fXBinOffsetSld->Connect("PositionChanged(Int_t)","TH2Editor",this, "DoOffsetMoved()");
719 fXBinOffsetSld->Connect("Released()","TH2Editor",this, "DoOffsetReleased()");
720 fXBinOffsetSld->Connect("Pressed()","TH2Editor",this, "DoOffsetPressed()");
721 fXOffsetNumberEntry->Connect("ReturnPressed()", "TH2Editor", this, "DoBinOffset()");
722 fBinYSlider1->Connect("Released()","TH2Editor",this, "DoBinReleased1()");
723 fBinYSlider1->Connect("PositionChanged(Int_t)","TH2Editor",this, "DoBinMoved1()");
724 fBinYNumberEntry1->Connect("ReturnPressed()", "TH2Editor", this, "DoBinLabel1()");
725 fYBinOffsetSld->Connect("PositionChanged(Int_t)","TH2Editor",this,"DoOffsetMoved()");
726 fYBinOffsetSld->Connect("Released()","TH2Editor",this, "DoOffsetReleased()");
727 fYBinOffsetSld->Connect("Pressed()","TH2Editor",this, "DoOffsetPressed()");
728 fYOffsetNumberEntry->Connect("ReturnPressed()", "TH2Editor", this,"DoBinOffset()");
729 fSliderX->Connect("PositionChanged()","TH2Editor",this, "DoSliderXMoved()");
730 fSliderX->Connect("Pressed()","TH2Editor",this, "DoSliderXPressed()");
731 fSliderX->Connect("Released()","TH2Editor",this, "DoSliderXReleased()");
732 fSldXMin->Connect("ReturnPressed()", "TH2Editor", this, "DoXAxisRange()");
733 fSldXMax->Connect("ReturnPressed()", "TH2Editor", this, "DoXAxisRange()");
734 fSliderY->Connect("PositionChanged()","TH2Editor",this, "DoSliderYMoved()");
735 fSliderY->Connect("Pressed()","TH2Editor",this, "DoSliderYPressed()");
736 fSliderY->Connect("Released()","TH2Editor",this, "DoSliderYReleased()");
737 fSldYMin->Connect("ReturnPressed()", "TH2Editor", this, "DoYAxisRange()");
738 fSldYMax->Connect("ReturnPressed()", "TH2Editor", this, "DoYAxisRange()");
739 fFrameColor->Connect("ColorSelected(Pixel_t)", "TH2Editor", this, "DoFillColor(Pixel_t)");
740 fFramePattern->Connect("PatternSelected(Style_t)", "TH2Editor", this, "DoFillPattern(Style_t)");
741
742 fInit = kFALSE;
743}
744
745////////////////////////////////////////////////////////////////////////////////
746/// Check if object is able to configure with this editor.
747
749{
750 if (obj == 0 || !obj->InheritsFrom(TH2::Class()) ||
751 (!strcmp(((TH2 *)obj)->GetName(),"htemp") &&
752 ((TH2*)obj)->GetEntries() == 0)) { // htemp is an empty histogram
753 return kFALSE;
754 }
755 return kTRUE;
756}
757
758////////////////////////////////////////////////////////////////////////////////
759/// Pick up the values of current histogram attributes.
760
762{
764 if (fBinHist && (obj != fHist)) {
765 //we have probably moved to a different pad.
766 //let's restore the original histogram
767 if (fHist) {
768 fHist->Reset();
776 }
777 // delete in anycase fBinHist also when fHist is zero (i.e when it has been deleted)
778 delete fBinHist;
779 fBinHist = 0;
780 if (fGedEditor->GetPad()) {
783 }
784 }
785
786 fHist = (TH2*) obj;
787
788 const char *text = fHist->GetTitle();
790 TString str = GetDrawOption();
792 str.ToUpper();
793
794 if (str == "") {
795 // default options = Scatter-Plot
796 ShowFrame(f6);
797 HideFrame(f9);
798 HideFrame(f12);
799 HideFrame(f13);
800 HideFrame(f38);
806
817 } else if (!str.Contains("LEGO") && !str.Contains("SURF")) {
818 ShowFrame(f6);
819 HideFrame(f9);
820 HideFrame(f12);
821 HideFrame(f13);
822 HideFrame(f38);
827 if (str.Contains("CONT")){
828 if (str.Contains("CONT1")) fContCombo->Select(kCONT_1);
829 else if (str.Contains("CONT2")) fContCombo->Select(kCONT_2);
830 else if (str.Contains("CONT3")) fContCombo->Select(kCONT_3);
831 else if (str.Contains("CONT4")) fContCombo->Select(kCONT_4);
832 else if (str.Contains("CONT0") || str.Contains("CONT"))
835
836 if (str.Contains("ARR")) fAddArr->SetState(kButtonDown);
838 if (str.Contains("BOX")) fAddBox->SetState(kButtonDown);
840 if (str.Contains("COL")) fAddCol->SetState(kButtonDown);
842 if (str.Contains("SCAT")) {
843 if (str=="SCAT") fAddScat->SetState(kButtonDisabled);
845 } else fAddScat->SetState(kButtonUp);
846 if (str.Contains("TEXT")) fAddText->SetState(kButtonDown);
848
850 if (str.Contains("COL") || (str.Contains("CONT") &&
851 !str.Contains("CONT2") && !str.Contains("CONT3"))) {
858
859 } else if (str.Contains("LEGO") || str.Contains("SURF")) {
860 HideFrame(f6);
861 ShowFrame(f9);
862 ShowFrame(f12);
863 ShowFrame(f13);
864 ShowFrame(f38);
867 if (str.Contains("LEGO4")) fTypeCombo->Select(kTYPE_LEGO4);
868 else if (str.Contains("LEGO3")) fTypeCombo->Select(kTYPE_LEGO3);
869 else if (str.Contains("LEGO2")) fTypeCombo->Select(kTYPE_LEGO2);
870 else if (str.Contains("LEGO1")) fTypeCombo->Select(kTYPE_LEGO1);
871 else if (str.Contains("LEGO")) fTypeCombo->Select(kTYPE_LEGO);
872 else if (str.Contains("SURF5")) fTypeCombo->Select(kTYPE_SURF5);
873 else if (str.Contains("SURF4")) fTypeCombo->Select(kTYPE_SURF4);
874 else if (str.Contains("SURF3")) fTypeCombo->Select(kTYPE_SURF3);
875 else if (str.Contains("SURF2")) fTypeCombo->Select(kTYPE_SURF2);
876 else if (str.Contains("SURF1")) fTypeCombo->Select(kTYPE_SURF1);
877 else if (str.Contains("SURF")) fTypeCombo->Select(kTYPE_SURF);
878
879
880 if (str.Contains("CYL")) fCoordsCombo->Select(kCOORDS_CYL);
881 else if (str.Contains("POL")) fCoordsCombo->Select(kCOORDS_POL);
882 else if (str.Contains("SPH")) fCoordsCombo->Select(kCOORDS_SPH);
883 else if (str.Contains("PSR")) fCoordsCombo->Select(kCOORDS_PSR);
884 else fCoordsCombo->Select(kCOORDS_CAR); //default
885
892
900 } else {
901 if (str.Contains("FB")) fAddFB->SetState(kButtonUp);
903 if (str.Contains("BB")) fAddBB->SetState(kButtonUp);
905 if (str.Contains("E")){
906 TString dum = str;
907 if (str.Contains("LEGO"))
908 dum.Remove(strstr(dum.Data(),"LEGO")-dum.Data(),4);
909 if (str.Contains("TEXT"))
910 dum.Remove(strstr(dum.Data(),"TEXT")-dum.Data(),4);
911 if (dum.Contains("E")) fAddError->SetState(kButtonDown);
914 }
922 else if (str.Contains("Z")) fAddPalette1->SetState(kButtonDown);
924 }
925
928
929 Int_t nx = fHist -> GetXaxis() -> GetNbins();
930 Int_t nxbinmin = fHist -> GetXaxis() -> GetFirst();
931 Int_t nxbinmax = fHist -> GetXaxis() -> GetLast();
932 fSliderX->SetRange(1,nx);
933 fSliderX->SetPosition((Double_t)nxbinmin,(Double_t)nxbinmax);
936
937 Int_t ny = fHist -> GetYaxis() -> GetNbins();
938 Int_t nybinmin = fHist -> GetYaxis() -> GetFirst();
939 Int_t nybinmax = fHist -> GetYaxis() -> GetLast();
940 fSliderY->SetRange(1,ny);
941 fSliderY->SetPosition((Double_t)nybinmin,(Double_t)nybinmax);
944
946
947 if (str.Contains("COL") || fContCombo->GetSelected()!= kCONT_NONE)
949 else fColContLbl->Disable();
950
951 if (str.Contains("LEGO2") || str.Contains("SURF1") ||
952 str.Contains("SURF2") || str.Contains("SURF3") ||
953 str.Contains("SURF5")) fColContLbl1->Enable();
954 else fColContLbl1->Disable();
955
958
961
963
964
965 // Check if histogram is from ntupla/tree or not.
966 // If it is a standard histogram or a ntupla based histogram
967 // show a different frame in case of rebinning (fBinCont) with sliders and bin number entries
968 // connected to different methods.
969 // For example the entry field fBinXNumberEntry is connected to
970 // the method DoBinLabel in case of non-ntupla histograms which just call Th1::Rebin
971 // In csae of a tree based histogram the entry field fBinNumberEntry1 is used which is connected to
972 // TH1Editor::DoBinLabel1 which is re-filling the histograms with the cached values from the TTreePlayer.
973 // Since the actual number of histogram entry can be larger than the cache size of the TTreePlayer
974 // (see JIRA ROOT-5900 or http://root.cern.ch/phpBB3/viewtopic.php?f=3&t=17107 )
975 // the GUI frame based on a non-tupla histogram is used when the number of entries of the histogram is
976 // not the same as the number of filled entries in the TTreePlayer object.
977
978 if (!player || player->GetHistogram()!=fHist ||
979 fHist->GetEntries() != player->GetNfill()) {
980 Int_t n1 = 0, n2 =0;
981 Int_t upx =0, upy =0;
982 if (fBinHist) n1 = fBinHist->GetXaxis()->GetNbins();
983 else n1 = nx;
984 if (fBinHist) n2 = fBinHist->GetYaxis()->GetNbins();
985 else n2 = ny;
989 if (n1 < 1) n1 = 1;
990 if (n2 < 1) n2 = 1;
991 Int_t* divx = Dividers(n1);
992 Int_t* divy = Dividers(n2);
993 if (divx[0]-1 <= 1) upx = 2;
994 else upx = divx[0]-1;
995 fBinXSlider->SetRange(1,upx);
996 if (divy[0]-1 <= 1) upy = 2;
997 else upy = divy[0]-1;
998 fBinYSlider->SetRange(1,upy);
999 Int_t i = 1; Int_t j = 1;
1002 else {
1003 while ( divx[i] != nx) i ++;
1004 fBinXSlider->SetPosition(divx[0] - i + 1);
1005 }
1008 else {
1009 while ( divy [j] != ny) j ++;
1010 fBinYSlider->SetPosition(divy[0] - j + 1);
1011 }
1016 delete [] divx;
1017 delete [] divy;
1018 }
1019 else if (player && fHist==player->GetHistogram() && fHist->GetEntries() == player->GetNfill()) {
1025 fBinXNumberEntry1->SetIntNumber(nxbinmax-nxbinmin+1);
1028 fBinYNumberEntry1->SetIntNumber(nybinmax-nybinmin+1);
1029 }
1030
1032 fHist->GetXaxis()->GetBinWidth(1));
1034 fHist->GetYaxis()->GetBinWidth(1));
1036
1040
1041}
1042
1043////////////////////////////////////////////////////////////////////////////////
1044/// Slot connected to the histogram title setting.
1045
1046void TH2Editor::DoTitle(const char *text)
1047{
1048 if (fAvoidSignal) return;
1050 Update();
1051}
1052
1053////////////////////////////////////////////////////////////////////////////////
1054/// Slot connected to the 'Plot' button group.
1055
1057{
1058 if (gPad && gPad->GetVirtCanvas()) gPad->GetVirtCanvas()->SetCursor(kWatch);
1059 gVirtualX->SetCursor(GetId(), gVirtualX->CreateCursor(kWatch));
1060
1061 if (fDim->GetState() == kButtonDown)
1062 DoHistSimple();
1063 else
1064 DoHistComplex();
1065
1066 if (gPad && gPad->GetVirtCanvas()) gPad->GetVirtCanvas()->SetCursor(kPointer);
1067 gVirtualX->SetCursor(GetId(), gVirtualX->CreateCursor(kPointer));
1068}
1069
1070////////////////////////////////////////////////////////////////////////////////
1071/// Slot connected to the 2D-Plot radio button.
1072
1074{
1075 if (fAvoidSignal) return;
1076 TString str = "";
1077 ShowFrame(f6);
1078 HideFrame(f9);
1079 HideFrame(f12);
1080 HideFrame(f13);
1081 HideFrame(f38);
1082 if (fContCombo->GetSelected()==-1)
1084 if ((fContCombo->GetSelected()!= kCONT_NONE) &&
1087
1089 if (str=="" || str=="SCAT" || str==fCutString) {
1092 } else if (fAddScat->GetState()==kButtonDisabled)
1094 if (str.Contains("COL") || fContCombo->GetSelected()!= kCONT_NONE)
1096 else fColContLbl->Disable();
1097
1099
1100 TString ocut = fCutString;
1101 ocut.ToUpper();
1102 if (!str.Contains(fCutString) && !str.Contains(ocut))
1103 str+=fCutString;
1104 SetDrawOption(str);
1105 Update();
1106}
1107
1108////////////////////////////////////////////////////////////////////////////////
1109/// Slot connected to the 3D-Plot radio button.
1110
1112{
1113 if (fAvoidSignal) return;
1114 TString str = "";
1115 HideFrame(f6);
1116 ShowFrame(f9);
1117 ShowFrame(f38);
1118 if (GetHistTypeLabel().Contains("LEGO")) {
1119 ShowFrame(f12);
1120 ShowFrame(f13);
1121 } else {
1122 HideFrame(f12);
1123 HideFrame(f13);
1124 }
1127
1129
1130 if (str.Contains("LEGO2") || str.Contains("SURF1") ||
1131 str.Contains("SURF2") || str.Contains("SURF3") ||
1132 str.Contains("SURF5")) {
1136 } else {
1139 }
1140
1142
1143 TString ocut = fCutString;
1144 ocut.ToUpper();
1145 if (!str.Contains(fCutString) && !str.Contains(ocut))
1146 str+=fCutString;
1147 SetDrawOption(str);
1148 Update();
1149}
1150
1151////////////////////////////////////////////////////////////////////////////////
1152/// Slot connected to histogram type, coordinate system, contour combo box.
1153
1155{
1156 if (fAvoidSignal) return;
1157 TString str = "";
1158 if (fDim->GetState() == kButtonDown) {
1162 fContCombo->GetSelected()!=kCONT_3) || str.Contains("COL")) {
1163
1164 if (str.Contains("Z")) fAddPalette->SetState(kButtonDown);
1167 if (str=="" || str=="SCAT" || str==fCutString) {
1170 } else if (fAddScat->GetState()==kButtonDisabled)
1173 if (str.Contains("COL") || fContCombo->GetSelected()!= kCONT_NONE)
1175 else
1177
1178 } else if (fDim0->GetState() == kButtonDown) {
1186 } else {
1193 }
1194 if ((fTypeCombo->GetSelected()==kTYPE_LEGO) ||
1203 if (GetHistTypeLabel().Contains("LEGO")) {
1204 ShowFrame(f12);
1205 ShowFrame(f13);
1206 } else {
1207 HideFrame(f12);
1208 HideFrame(f13);
1209 }
1212 if (str.Contains("LEGO2") || str.Contains("SURF1") ||
1213 str.Contains("SURF2") || str.Contains("SURF3") ||
1214 str.Contains("SURF5"))
1216 else
1218 }
1219
1220 TString ocut = fCutString;
1221 ocut.ToUpper();
1222 if (!str.Contains(fCutString) && !str.Contains(ocut))
1223 str+=fCutString;
1224 SetDrawOption(str);
1225 Update();
1226}
1227
1228////////////////////////////////////////////////////////////////////////////////
1229/// Slot connected to the "Arrow draw option" check button.
1230
1232{
1233 if (fAvoidSignal) return;
1235 TString str = GetDrawOption();
1236 str.ToUpper();
1237
1238 if (on) {
1239 if (!str.Contains("ARR")) {
1240 str += "ARR";
1243 make=kTRUE;
1244 }
1245 } else if (fAddArr->GetState()==kButtonUp) {
1246 if (str.Contains("ARR")) {
1247 str.Remove(strstr(str.Data(),"ARR")-str.Data(),3);
1248 if (str=="" || str=="SCAT" || str==fCutString) {
1251 }
1252 make=kTRUE;
1253 }
1254 }
1255 if (make) {
1256 DoHistChanges();
1257 }
1258}
1259
1260////////////////////////////////////////////////////////////////////////////////
1261/// Slot connected to the "Box draw option" check button.
1262
1264{
1265 if (fAvoidSignal) return;
1267 TString str = GetDrawOption();
1268 str.ToUpper();
1269
1270 if (on) {
1271 if (!str.Contains("BOX")) {
1272 str += "BOX";
1275 make=kTRUE;
1276 }
1277 } else if (fAddBox->GetState()==kButtonUp) {
1278 if (str.Contains("BOX")) {
1279 str.Remove(strstr(str.Data(),"BOX")-str.Data(),3);
1280 if (str=="" || str=="SCAT" || str==fCutString) {
1283 }
1284 make=kTRUE;
1285 }
1286 }
1287 if (make) {
1288 DoHistChanges();
1289 }
1290}
1291
1292////////////////////////////////////////////////////////////////////////////////
1293/// Slot connected to the "Col draw option" check button.
1294
1296{
1297 if (fAvoidSignal) return;
1299 TString str = GetDrawOption();
1300 str.ToUpper();
1301
1302 if (on) {
1303 if (!str.Contains("COL")) {
1304 str += "COL";
1305 fColContLbl->Enable() ;
1310 make=kTRUE;
1311 }
1312 } else if (fAddCol->GetState()==kButtonUp) {
1313 if (str.Contains("COL")) {
1314 str.Remove(strstr(str.Data(),"COL")-str.Data(),3);
1319 if (str.Contains("Z"))
1320 str.Remove(strstr(str.Data(),"Z")-str.Data(),1);
1321 }
1322 if (str=="" || str=="SCAT" || str==fCutString)
1325 fColContLbl->Enable() ;
1326 else fColContLbl->Disable();
1327 make=kTRUE;
1328 }
1329 }
1330 if (make) {
1331 DoHistChanges();
1332 }
1333}
1334
1335////////////////////////////////////////////////////////////////////////////////
1336/// Slot connected to the "Scat draw option" check button.
1337
1339{
1340 if (fAvoidSignal) return;
1342 TString str = GetDrawOption();
1343 str.ToUpper();
1344
1345 if (on) {
1346 if (!str.Contains("SCAT")) {
1347 str += "SCAT";
1348 make=kTRUE;
1349 }
1350 } else if (fAddScat->GetState()==kButtonUp) {
1351 if (str.Contains("SCAT")) {
1352 str.Remove(strstr(str.Data(),"SCAT")-str.Data(),4);
1353 make=kTRUE;
1354 }
1355 }
1356 if (make) {
1357 DoHistChanges();
1358 }
1359}
1360
1361////////////////////////////////////////////////////////////////////////////////
1362/// Slot connected to the "Text draw option" check button.
1363
1365{
1366 if (fAvoidSignal) return;
1368 TString str = GetDrawOption();
1369 str.ToUpper();
1370
1371 if (on) {
1372 if (!str.Contains("TEXT")) {
1373 str += "TEXT";
1376 make=kTRUE;
1377 }
1378 } else if (fAddText->GetState()==kButtonUp) {
1379 if (str.Contains("TEXT")) {
1380 str.Remove(strstr(str.Data(),"TEXT")-str.Data(),4);
1381 if (str=="" || str=="SCAT" || str==fCutString)
1383 make=kTRUE;
1384 }
1385 }
1386 if (make) {
1387 DoHistChanges();
1388 // next line is needed for marker editor refresh
1390 }
1391}
1392
1393////////////////////////////////////////////////////////////////////////////////
1394/// Slot connected to the "Error" check button.
1395
1397{
1398 if (fAvoidSignal) return;
1400 TString str = GetDrawOption();
1401 str.ToUpper();
1402
1403 TString dum = str;
1404 if (str.Contains("LEGO"))
1405 dum.Remove(strstr(dum.Data(),"LEGO")-dum.Data(),4);
1406 if (str.Contains("TEXT"))
1407 dum.Remove(strstr(dum.Data(),"TEXT")-dum.Data(),4);
1408 if (on) {
1409 if (!dum.Contains("E")) {
1410 str += "E";
1411 make=kTRUE;
1412 }
1413 } else if (fAddError->GetState() == kButtonUp) {
1414 if (str.Contains("E")) {
1415 if (fDim->GetState() == kButtonDown)
1417 else
1420 make=kTRUE;
1421 }
1422 }
1423 if (make) {
1424 DoHistChanges();
1425 }
1426}
1427
1428////////////////////////////////////////////////////////////////////////////////
1429/// Slot connected to the color palette check button.
1430
1432{
1433 if (fAvoidSignal) return;
1435 TString str = GetDrawOption();
1436 str.ToUpper();
1437
1438 if (on) {
1439 if (!str.Contains("Z")) {
1440 str += "Z";
1441 make=kTRUE;
1442 }
1443 } else if (fAddPalette->GetState()==kButtonUp ||
1445 if (str.Contains("Z")) {
1446 str.Remove(strstr(str.Data(),"Z")-str.Data(),1);
1447 make=kTRUE;
1448 }
1449 }
1450 if (make) {
1451 DoHistChanges();
1452 }
1453}
1454
1455////////////////////////////////////////////////////////////////////////////////
1456/// Slot connected to the "FB front-box draw option" check button.
1457
1459{
1460 if (fAvoidSignal) return;
1462 TString str = GetDrawOption();
1463 str.ToUpper();
1464
1465 if (fAddFB->GetState()==kButtonDown) {
1466 if (str.Contains("FB")) {
1467 if (str.Contains("SURF") && !(str.Contains("1") ||
1468 str.Contains("2") || str.Contains("3") ||
1469 str.Contains("4") || str.Contains("5"))) {
1470 TString dum = str;
1471 dum.Remove(strstr(dum.Data(),"SURF")-dum.Data(),4);
1472 if (dum.Contains("FB"))
1473 dum.Remove(strstr(dum.Data(),"FB")-dum.Data(),2);
1474 str = "SURF" + dum;
1475 } else str.Remove(strstr(str.Data(),"FB")-str.Data(),2);
1476 make = kTRUE;
1477 }
1478 } else if (fAddFB->GetState()==kButtonUp){
1479 if (!str.Contains("FB")) {
1480 str += "FB";
1481 make=kTRUE;
1482 }
1483 }
1484 if (make) {
1485 DoHistChanges();
1486 }
1487}
1488
1489////////////////////////////////////////////////////////////////////////////////
1490/// Slot connected to the "BB back-box draw option" check button.
1491
1493{
1494 if (fAvoidSignal) return;
1496 TString str = GetDrawOption();
1497 str.ToUpper();
1498
1499 if (fAddBB->GetState()==kButtonDown) {
1500 if (str.Contains("BB")) {
1501 if (str.Contains("FB")) {
1502 TString dum = str;
1503 dum.Remove(strstr(dum.Data(),"FB")-dum.Data(),2);
1504 dum.Remove(strstr(dum.Data(),"BB")-dum.Data(),2);
1505 str=dum+"FB";
1506 } else str.Remove(strstr(str.Data(),"BB")-str.Data(),2);
1507 make = kTRUE;
1508 }
1509 } else if (fAddBB->GetState()==kButtonUp){
1510 if (!str.Contains("BB")) {
1511 str += "BB";
1512 make=kTRUE;
1513 }
1514 }
1515 if (make) {
1516 DoHistChanges();
1517 }
1518}
1519
1520////////////////////////////////////////////////////////////////////////////////
1521/// Slot connected to the contour level number entry fContLevels.
1522
1524{
1525 if (fAvoidSignal) return;
1528 Update();
1529}
1530
1531////////////////////////////////////////////////////////////////////////////////
1532/// Slot connected to the contour level number entry fContLevels1.
1533
1535{
1536 if (fAvoidSignal) return;
1539 Update();
1540}
1541
1542////////////////////////////////////////////////////////////////////////////////
1543/// Slot connected to the bar width of the bar chart.
1544
1546{
1547 if (fAvoidSignal) return;
1549 Update();
1550}
1551
1552////////////////////////////////////////////////////////////////////////////////
1553/// Slot connected to the bar offset of the bar chart.
1554
1556{
1557 if (fAvoidSignal) return;
1559 Update();
1560}
1561
1562////////////////////////////////////////////////////////////////////////////////
1563/// Slot connected to the rebin slider in case of no ntuple histogram.
1564/// It updates some other widgets related to the rebin slider.
1565
1567{
1568 // Draw the rebinned histogram in case of the delay draw mode
1569 if (fAvoidSignal) return;
1571 if (!fBinHist) {
1572 fBinHist = (TH2*)fHist->Clone("BinHist");
1573 fBinHist->SetDirectory(0); // TH2Editor manages this histogram
1574 }
1575 Int_t nx = fBinHist->GetXaxis()->GetNbins();
1576 Int_t ny = fBinHist->GetYaxis()->GetNbins();
1577 Int_t numx = fBinXSlider->GetPosition();
1578 Int_t numy = fBinYSlider->GetPosition();
1579 Int_t* divx = Dividers(nx);
1580 Int_t* divy = Dividers(ny);
1581 if (divx[0]==2) fBinXSlider->SetPosition(2);
1582 if (divy[0]==2) fBinYSlider->SetPosition(2);
1583 if (divx[0]==2 && divy[0]==2) {
1584 delete [] divx;
1585 delete [] divy;
1586 return;
1587 }
1588 // delete the histogram which is on the screen
1589 fGedEditor->GetPad()->cd();
1590 fHist->Reset();
1593 ny,fBinHist->GetYaxis()->GetXmin(),
1594 fBinHist->GetYaxis()->GetXmax());
1595 fHist->Add(fBinHist);
1597 fHist->Rebin2D(divx[numx], divy[numy]);
1598
1599 //fModel=fHist;
1600
1601 if (divx[0]!=2) {
1602 TAxis* xaxis = fHist->GetXaxis();
1603 Double_t xBinWidth = xaxis->GetBinWidth(1);
1604 xaxis->SetRangeUser(fSldXMin->GetNumber()+xBinWidth/2,
1605 fSldXMax->GetNumber()-xBinWidth/2);
1606 fSliderX->SetRange(1,(Int_t)nx/divx[numx]);
1607 fSliderX->SetPosition(xaxis->FindBin(fSldXMin->GetNumber()+xBinWidth/2),
1608 xaxis->FindBin(fSldXMax->GetNumber()-xBinWidth/2));
1609 // the axis range could be changed a little bit by the Rebin algorithm
1610 fSldXMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
1611 fSldXMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
1612 }
1613 if (divy[0]!=2) {
1614 TAxis* yaxis = fHist->GetYaxis();
1615 Double_t yBinWidth = yaxis->GetBinWidth(1);
1616 yaxis->SetRangeUser(fSldYMin->GetNumber()+yBinWidth/2,
1617 fSldYMax->GetNumber()-yBinWidth/2);
1618 fSliderY->SetRange(1,(Int_t)ny/divy[numy]);
1619 fSliderY->SetPosition(yaxis->FindBin(fSldYMin->GetNumber()+yBinWidth/2),
1620 yaxis->FindBin(fSldYMax->GetNumber()-yBinWidth/2));
1621 fSldYMin->SetNumber(yaxis->GetBinLowEdge(yaxis->GetFirst()));
1622 fSldYMax->SetNumber(yaxis->GetBinUpEdge(yaxis->GetLast()));
1623 }
1626 Update();
1627 delete [] divx;
1628 delete [] divy;
1629 }
1630// fGedEditor->GetPad()->GetCanvas()->Selected(fGedEditor->GetPad(), fHist, 0);
1631 // fModel = fHist;
1632 Refresh(fHist);
1633}
1634
1635////////////////////////////////////////////////////////////////////////////////
1636/// Slot connected to the rebin slider in case of no ntuple histogram.
1637
1639{
1640 if (fAvoidSignal) return;
1641 Int_t* divx = Dividers(fHist->GetXaxis()->GetNbins());
1642 Int_t* divy = Dividers(fHist->GetYaxis()->GetNbins());
1643 if (divx[0]==2 && divy[0]==2 && !fBinHist)
1645 "TH2Editor", "It is not possible to rebin the histogram",
1647 // calling the MessageBox again does NOT work!*/
1648 delete [] divx;
1649 delete [] divy;
1650}
1651
1652////////////////////////////////////////////////////////////////////////////////
1653/// Slot connected to the rebin sliders in case of no ntuple histogram
1654/// does the rebinning of the selected histogram.
1655
1657{
1658 // create a clone in the background, when the slider is moved for 1st time
1659 if (fAvoidSignal) return;
1660 if (!fBinHist /*&& fDelaydraw->GetState()!=kButtonDown*/) {
1661 Int_t* divx = Dividers(fHist->GetXaxis()->GetNbins());
1662 Int_t* divy = Dividers(fHist->GetYaxis()->GetNbins());
1663 // if there is nothing to rebin:
1664 if (divx[0]==2 && divy[0]==2) {
1665 delete [] divx;
1666 delete [] divy;
1667 return;
1668 }
1669 fBinHist = (TH2*)fHist->Clone("BinHist");
1670 fBinHist->SetDirectory(0); // TH2Editor manages this histogram
1671 delete [] divx;
1672 delete [] divy;
1673 }
1674 // if the slider already has been moved and the clone is saved
1675 Int_t nx = fBinHist->GetXaxis()->GetNbins();
1676 Int_t ny = fBinHist->GetYaxis()->GetNbins();
1677 Int_t numx = fBinXSlider->GetPosition();
1678 Int_t numy = fBinYSlider->GetPosition();
1679 if (nx < 1 || ny < 1) return;
1680 Int_t* divx = Dividers(nx);
1681 Int_t* divy = Dividers(ny);
1682 if (divx[0]==2) {
1684 numx=1;
1685 }
1686 if (divy[0]==2) {
1688 numy=1;
1689 }
1690 Int_t maxx = (Int_t)nx/divx[numx];
1691 Int_t maxy = (Int_t)ny/divy[numy];
1692 if (maxx==1) maxx=2;
1693 if (maxy==1) maxy=2;
1694 if (fDelaydraw->GetState()==kButtonUp){
1695 // delete the histogram which is on the screen
1696 fGedEditor->GetPad()->cd();
1697 fHist->Reset();
1700 ny,fBinHist->GetYaxis()->GetXmin(),
1701 fBinHist->GetYaxis()->GetXmax());
1702 fHist->Add(fBinHist);
1704 fHist->Rebin2D(divx[numx], divy[numy]);
1705 //fModel=fHist;
1706 if (divx[0]!=2) {
1707 TAxis* xaxis = fHist->GetXaxis();
1708 Double_t xBinWidth = xaxis->GetBinWidth(1);
1709 // if the user has zoomed into a special area the range will be reset:
1710 xaxis->SetRangeUser(fSldXMin->GetNumber()+xBinWidth/2,
1711 fSldXMax->GetNumber()-xBinWidth/2);
1712 fSliderX->SetRange(1,maxx);
1713 fSliderX->SetPosition(xaxis->FindBin(fSldXMin->GetNumber()+xBinWidth/2),
1714 xaxis->FindBin(fSldXMax->GetNumber()-xBinWidth/2));
1715 // the axis range could be changed a little bit by the Rebin algorithm
1716 fSldXMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
1717 fSldXMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
1719 }
1720 if (divy[0]!=2) {
1721 TAxis* yaxis = fHist->GetYaxis();
1722 Double_t yBinWidth = yaxis->GetBinWidth(1);
1723 yaxis->SetRangeUser(fSldYMin->GetNumber()+yBinWidth/2,
1724 fSldYMax->GetNumber()-yBinWidth/2);
1725 fSliderY->SetRange(1,maxy);
1726 fSliderY->SetPosition(yaxis->FindBin(fSldYMin->GetNumber()+yBinWidth/2),
1727 yaxis->FindBin(fSldYMax->GetNumber()-yBinWidth/2));
1728 fSldYMin->SetNumber(yaxis->GetBinLowEdge(yaxis->GetFirst()));
1729 fSldYMax->SetNumber(yaxis->GetBinUpEdge(yaxis->GetLast()));
1731 }
1732 Update();
1733 }
1734 // set the according NumberEntries
1741 delete [] divx;
1742 delete [] divy;
1743}
1744
1745////////////////////////////////////////////////////////////////////////////////
1746/// Slot connected to the Bin Number Entry for the Rebin.
1747
1749{
1750 if (fAvoidSignal) return;
1751 Int_t i;
1754 Int_t nx = 0;
1755 if (fBinHist) nx = fBinHist->GetXaxis()->GetNbins();
1756 else nx = fHist->GetXaxis()->GetNbins();
1757 Int_t ny = 0;
1758 if (fBinHist) ny = fBinHist->GetYaxis()->GetNbins();
1759 else ny = fHist->GetYaxis()->GetNbins();
1760 if (nx < 2 || ny < 2) return;
1761 // Get the divider of nx/ny which is closest to numx/numy
1762 Int_t *divx = Dividers(nx);
1763 Int_t *divy = Dividers(ny);
1764 Int_t diff = TMath::Abs(numx - divx[1]);
1765 Int_t c = 1; Int_t d = 1;
1766 for (i = 2; i <= divx[0]; i++) {
1767 if ((TMath::Abs(numx - divx[i])) < diff) {
1768 c = i;
1769 diff = TMath::Abs(numx - divx[i]);
1770 }
1771 }
1772 diff = TMath::Abs(numy - divy[1]);
1773 for (i = 2; i <= divy[0]; i++) {
1774 if ((TMath::Abs(numy - divy[i])) < diff) {
1775 d = i;
1776 diff = TMath::Abs(numy - divy[i]);
1777 }
1778 }
1779 if (divx[c]!= fHist->GetXaxis()->GetNbins() ||
1780 divy[d]!= fHist->GetYaxis()->GetNbins()) {
1782 fBinXSlider->SetPosition(divx[0] - c +1);
1784 fBinYSlider->SetPosition(divy[0] - d +1);
1786 else DoBinReleased();
1787 }
1788// fGedEditor->GetPad()->GetCanvas()->Selected(fGedEditor->GetPad(), fHist, 0);
1789// fModel = fHist;
1790 Refresh(fHist);
1791 delete [] divx;
1792 delete [] divy;
1793}
1794
1795////////////////////////////////////////////////////////////////////////////////
1796/// Slot connected to the Apply Button in the Rebinned histogram Window.
1797
1799{
1800 Int_t ret = 0;
1802 "TH2 Editor", "Replace origin histogram with rebinned one?",
1804 if (ret==1) {
1805 if (fBinHist) {
1806 delete fBinHist;
1807 fBinHist = 0;
1808 }
1809 Int_t nx = fHist->GetXaxis()->GetNbins();
1810 Int_t ny = fHist->GetYaxis()->GetNbins();
1811 Int_t *divx = Dividers(nx);
1812 Int_t *divy = Dividers(ny);
1813 Int_t upx = 0, upy = 0;
1814 if (divx[0]-1 <= 1) upx = 2;
1815 else upx = divx[0]-1;
1816 if (divy[0]-1 <= 1) upy = 2;
1817 else upy = divy[0]-1;
1818 fBinXSlider->SetRange(1,upx);
1819 fBinYSlider->SetRange(1,upy);
1820 if (fBinXSlider->GetMaxPosition()==2 && divx[0]==2 )
1822 else fBinXSlider->SetPosition(1);
1823 if (fBinYSlider->GetMaxPosition()==2 && divy[0]==2 )
1825 else fBinYSlider->SetPosition(1);
1828 Update();
1829 delete [] divx;
1830 delete [] divy;
1831 } else if (ret==2) DoCancel();
1832}
1833
1834////////////////////////////////////////////////////////////////////////////////
1835/// Slot connected to the Cancel Button in the Rebinned histogram Window.
1836
1838{
1839 if (fBinHist) {
1840 fGedEditor->GetPad()->cd();
1841 fHist->Reset();
1847 fBinHist->GetYaxis()->GetXmax());
1848 fHist->Add(fBinHist);
1850 fBinHist->GetXaxis()->GetLast());
1852 fBinHist->GetYaxis()->GetLast());
1853
1854 delete fBinHist;
1855 fBinHist = 0;
1856
1859 Int_t* divx = Dividers(fHist->GetXaxis()->GetNbins());
1860 Int_t* divy = Dividers(fHist->GetYaxis()->GetNbins());
1861 if (divx[0]!=2) fBinXSlider->SetPosition(1);
1862 if (divy[0]!=2) fBinYSlider->SetPosition(1);
1863 // Consigning the new Histogram to all other Editors
1864// fGedEditor->GetPad()->GetCanvas()->Selected(fGedEditor->GetPad(), fHist, 0);
1865 Update();
1866 // fModel = fHist;
1867 Refresh(fHist);
1868 delete [] divx;
1869 delete [] divy;
1870 }
1871}
1872
1873
1874////////////////////////////////////////////////////////////////////////////////
1875/// Slot connected to the BinNumber Slider in case of a 'ntuple histogram'.
1876/// It does the rebin.
1877
1879{
1880 if (fAvoidSignal) return;
1881 Double_t oldXOffset = fXOffsetNumberEntry->GetNumber();
1882 Int_t xnumber = fBinXSlider1->GetPosition();
1883 Double_t oldYOffset = fYOffsetNumberEntry->GetNumber();
1884 Int_t ynumber = fBinYSlider1->GetPosition();
1885 if (xnumber==5 && ynumber==5) return;
1886 Int_t xfact = 0;
1887 Int_t yfact = 0;
1888 Int_t xBinNumber = 0;
1889 Int_t yBinNumber = 0;
1890 TAxis* xaxis = fHist->GetXaxis();
1891 TAxis* yaxis = fHist->GetYaxis();
1892 //"compute" the scaling factor:
1893 if (xnumber >= 5) xfact = xnumber - 4;
1894 else xfact = xnumber - 6;
1895 if (ynumber >= 5) yfact = ynumber - 4;
1896 else yfact = ynumber - 6;
1898 if (!player) return;
1899 Int_t nx = xaxis->GetNbins();
1900 Int_t ny = yaxis->GetNbins();
1901 Int_t firstx = xaxis->GetFirst();
1902 Int_t lastx = xaxis->GetLast();
1903 Int_t firsty = yaxis->GetFirst();
1904 Int_t lasty = yaxis->GetLast();
1905 Double_t minx = xaxis->GetBinLowEdge(1); // overall min in user coords
1906 Double_t maxx = xaxis->GetBinUpEdge(nx); // overall max in user coords
1907 Double_t miny = yaxis->GetBinLowEdge(1); // overall min in user coords
1908 Double_t maxy = yaxis->GetBinUpEdge(ny); // overall max in user coords
1909 Double_t rminx = xaxis->GetBinLowEdge(firstx); // recent min in user coords
1910 Double_t rmaxx = xaxis->GetBinUpEdge(lastx); // recent max in user coords
1911 Double_t rminy = yaxis->GetBinLowEdge(firsty); // recent min in user coords
1912 Double_t rmaxy = yaxis->GetBinUpEdge(lasty); // recent max in user coords
1913
1914 ((TH2*)player->GetHistogram())->SetCanExtend(TH1::kNoAxis);
1915 ((TH2*)player->GetHistogram())->Reset();
1916
1917 // Get new Number of bins
1918 if (xfact > 0) xBinNumber = xfact*nx;
1919 if (xfact < 0) xBinNumber = (Int_t) ((-1)*nx/xfact+0.5);
1920 if (xBinNumber < 1) xBinNumber = 1;
1921 if (xBinNumber > 1000) xBinNumber= 1000;
1922 if (yfact > 0) yBinNumber = yfact*ny;
1923 if (yfact < 0) yBinNumber = (Int_t) ((-1)*ny/yfact+0.5);
1924 if (yBinNumber < 1) yBinNumber = 1;
1925 if (yBinNumber > 1000) yBinNumber= 1000;
1926 Double_t xOffset = 1.*fXBinOffsetSld->GetPosition()/100*((maxx-minx)/xBinNumber);
1927 Double_t yOffset = 1.*fYBinOffsetSld->GetPosition()/100*((maxy-miny)/yBinNumber);
1928 // create new histogram - the main job is done by sel->TakeAction()
1929
1930 ((TH2*)player->GetHistogram())->SetBins(xBinNumber, minx-oldXOffset+xOffset,
1931 maxx-oldXOffset+xOffset,
1932 yBinNumber, miny-oldYOffset+yOffset,
1933 maxy-oldYOffset+yOffset);
1934 TSelectorDraw *sel = (TSelectorDraw*)player->GetSelector();
1935 if (!sel) return;
1936 sel->TakeAction();
1937
1938 // Restore and set all the attributes which were changed by TakeAction()
1940 fSliderX->SetRange(1,xBinNumber);
1941 fSliderY->SetRange(1,yBinNumber);
1942 Double_t xBinWidth = xaxis->GetBinWidth(1);
1943 Double_t yBinWidth = yaxis->GetBinWidth(1);
1944 fSliderX->SetPosition(xaxis->FindBin(rminx+xBinWidth/2),
1945 xaxis->FindBin(rmaxx-xBinWidth/2));
1946 fSliderY->SetPosition(yaxis->FindBin(rminy+yBinWidth/2),
1947 yaxis->FindBin(rmaxy-yBinWidth/2));
1948 xOffset = 1.*fXBinOffsetSld->GetPosition()/100*xBinWidth; // nessesary ??
1949 yOffset = 1.*fYBinOffsetSld->GetPosition()/100*yBinWidth; // nessesary ??
1950
1951 // SetRange in BinNumbers along x and y!
1952 xaxis->SetRange(xaxis->FindBin(rminx+xBinWidth/2),
1953 xaxis->FindBin(rmaxx-xBinWidth/2));
1954 yaxis->SetRange(yaxis->FindBin(rminy+yBinWidth/2),
1955 yaxis->FindBin(rmaxy-yBinWidth/2));
1956 fSldXMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
1957 fSldXMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
1958 fSldYMin->SetNumber(yaxis->GetBinLowEdge(yaxis->GetFirst()));
1959 fSldYMax->SetNumber(yaxis->GetBinUpEdge(yaxis->GetLast()));
1960 fBinXNumberEntry1->SetNumber(xaxis->GetLast() - xaxis->GetFirst()+1);
1961 fBinYNumberEntry1->SetNumber(yaxis->GetLast() - yaxis->GetFirst()+1);
1967 xaxis->GetBinWidth(1));
1969 yaxis->GetBinWidth(1));
1971 // when you 2-clicks on a slider, sometimes it gets caught on wrong position! (2 or -2)
1973 // when you 2-clicks on a slider, sometimes it gets caught on wrong position! (2 or -2)
1974 Update();
1975}
1976
1977////////////////////////////////////////////////////////////////////////////////
1978/// Slot connected to the rebin slider in case of an ntuple histogram.
1979/// Updates the BinNumberEntryField during the BinSlider movement.
1980
1982{
1983 if (fAvoidSignal) return;
1984 TAxis* xaxis = fHist->GetXaxis();
1985 TAxis* yaxis = fHist->GetYaxis();
1986 Int_t firstx = xaxis->GetFirst();
1987 Int_t lastx = xaxis->GetLast();
1988 Int_t firsty = yaxis->GetFirst();
1989 Int_t lasty = yaxis->GetLast();
1990 Int_t xnumber = fBinXSlider1->GetPosition();
1991 Int_t ynumber = fBinYSlider1->GetPosition();
1992 Int_t numx = lastx-firstx+1;
1993 Int_t numy = lasty-firsty+1;
1994 Int_t xfact = 0;
1995 Int_t yfact = 0;
1996 Int_t xBinNumber = 0;
1997 Int_t yBinNumber = 0;
1998 if (xnumber >= 5) xfact = xnumber - 4;
1999 else xfact = xnumber - 6;
2000 if (xfact > 0) xBinNumber = xfact*numx;
2001 if (xfact < 0) xBinNumber = (Int_t) ((-1)*numx/xfact+0.5);
2002 if (xBinNumber < 1) xBinNumber = 1;
2003 if (xBinNumber > 1000) xBinNumber= 1000;
2004 if (fBinXNumberEntry1->GetNumber()!=xBinNumber)
2005 fBinXNumberEntry1->SetIntNumber(xBinNumber);
2006
2007 if (ynumber >= 5) yfact = ynumber - 4;
2008 else yfact = ynumber - 6;
2009 if (yfact > 0) yBinNumber = yfact*numy;
2010 if (yfact < 0) yBinNumber = (Int_t) ((-1)*numy/yfact+0.5);
2011 if (yBinNumber < 1) yBinNumber = 1;
2012 if (yBinNumber > 1000) yBinNumber= 1000;
2013 if (fBinYNumberEntry1->GetNumber()!=yBinNumber)
2014 fBinYNumberEntry1->SetIntNumber(yBinNumber);
2015}
2016
2017////////////////////////////////////////////////////////////////////////////////
2018/// Slot connected to the Bin Number Entry for the Rebin.
2019
2021{
2022 if (fAvoidSignal) return;
2023 Double_t oldXOffset = fXOffsetNumberEntry->GetNumber();
2025 Double_t oldYOffset = fYOffsetNumberEntry->GetNumber();
2027 TAxis* xaxis = fHist->GetXaxis();
2028 TAxis* yaxis = fHist->GetYaxis();
2030 if (!player) return;
2031 Int_t firstx = xaxis->GetFirst();
2032 Int_t lastx = xaxis->GetLast();
2033 Int_t firsty = yaxis->GetFirst();
2034 Int_t lasty = yaxis->GetLast();
2035 Int_t nx = xaxis->GetNbins();
2036 Int_t ny = yaxis->GetNbins();
2037 Double_t minx = xaxis->GetBinLowEdge(1); // overall min in user coords
2038 Double_t maxx = xaxis->GetBinUpEdge(nx); // overall max in user coords
2039 Double_t miny = yaxis->GetBinLowEdge(1); // overall min in user coords
2040 Double_t maxy = yaxis->GetBinUpEdge(ny); // overall max in user coords
2041 Double_t rminx = xaxis->GetBinLowEdge(firstx); // recent min in user coords
2042 Double_t rmaxx = xaxis->GetBinUpEdge(lastx); // recent max in user coords
2043 Double_t rminy = yaxis->GetBinLowEdge(firsty); // recent min in user coords
2044 Double_t rmaxy = yaxis->GetBinUpEdge(lasty); // recent max in user coords
2045
2046 ((TH2*)player->GetHistogram())->SetCanExtend(TH1::kNoAxis);
2047 ((TH2*)player->GetHistogram())->Reset();
2048
2049 // Calculate the new number of bins in the complete range
2050 Int_t xBinNumber = (Int_t) ((maxx-minx)/(rmaxx - rminx)*numx + 0.5);
2051 if (xBinNumber < 1) xBinNumber = 1;
2052 if (xBinNumber > 1000) xBinNumber= 1000;
2053 Double_t xOffset = 1.*(fXBinOffsetSld->GetPosition())/100*(maxx-minx)/xBinNumber;
2054 Int_t yBinNumber = (Int_t) ((maxy-miny)/(rmaxy - rminy)*numy + 0.5);
2055 if (yBinNumber < 1) yBinNumber = 1;
2056 if (yBinNumber > 1000) yBinNumber= 1000;
2057 Double_t yOffset = 1.*(fYBinOffsetSld->GetPosition())/100*(maxy-miny)/yBinNumber;
2058 // create new histogram - the main job is done by sel->TakeAction()
2059 ((TH2*)player->GetHistogram())->SetBins(xBinNumber, minx-oldXOffset+xOffset,
2060 maxx-oldXOffset+xOffset,
2061 yBinNumber, miny-oldYOffset+yOffset,
2062 maxy-oldYOffset+yOffset);
2063 TSelectorDraw *sel = (TSelectorDraw*)player->GetSelector();
2064 if (!sel) return;
2065 sel->TakeAction();
2066
2067 // Restore and set all the attributes which were changed by TakeAction()
2069 fSliderX->SetRange(1,xBinNumber);
2070 fSliderY->SetRange(1,yBinNumber);
2071 Double_t xBinWidth = xaxis->GetBinWidth(1);
2072 Double_t yBinWidth = yaxis->GetBinWidth(1);
2073 fSliderX->SetPosition(xaxis->FindBin(rminx+xBinWidth/2),
2074 xaxis->FindBin(rmaxx-xBinWidth/2));
2075 fSliderY->SetPosition(yaxis->FindBin(rminy+yBinWidth/2),
2076 yaxis->FindBin(rmaxy-yBinWidth/2));
2077 xOffset = 1.*fXBinOffsetSld->GetPosition()/100*xBinWidth; //nesessary ??
2078 yOffset = 1.*fYBinOffsetSld->GetPosition()/100*yBinWidth; //nesessary ??
2079
2080 // SetRange in BinNumbers along x and y!
2081 xaxis->SetRange(xaxis->FindBin(rminx+xBinWidth/2),
2082 xaxis->FindBin(rmaxx-xBinWidth/2));
2083 yaxis->SetRange(yaxis->FindBin(rminy+yBinWidth/2),
2084 yaxis->FindBin(rmaxy-yBinWidth/2));
2085 fSldXMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
2086 fSldXMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
2087 fSldYMin->SetNumber(yaxis->GetBinLowEdge(yaxis->GetFirst()));
2088 fSldYMax->SetNumber(yaxis->GetBinUpEdge(yaxis->GetLast()));
2093 Update();
2094}
2095
2096////////////////////////////////////////////////////////////////////////////////
2097/// Slot connected to the OffSetSlider. It saves the OldBinOffset
2098/// (nessesary for delay draw mode).
2099
2101{
2102 if (fAvoidSignal) return;
2105}
2106
2107////////////////////////////////////////////////////////////////////////////////
2108/// Slot connected to the OffSetSlider that
2109/// changes the origin of the histogram inbetween a binwidth;
2110/// rebin the histogram with the new Offset given by the slider.
2111/// problem: histogram with variable binwidth??
2112
2114{
2115 if (fAvoidSignal) return;
2119 TAxis* xaxis = fHist->GetXaxis();
2120 TAxis* yaxis = fHist->GetYaxis();
2121 Double_t xBinWidth = xaxis->GetBinWidth(1);
2122 Double_t yBinWidth = yaxis->GetBinWidth(1);
2123 Double_t xOffset = 1.*numx/100*xBinWidth;
2124 Double_t yOffset = 1.*numy/100*yBinWidth;
2125 Double_t oldXOffset = fOldXOffset;
2126 Double_t oldYOffset = fOldYOffset;
2127 Int_t nx = xaxis->GetNbins();
2128 Int_t ny = yaxis->GetNbins();
2129
2131 if (!player) return;
2132
2133 Int_t firstx = xaxis->GetFirst();
2134 Int_t lastx = xaxis->GetLast();
2135 Int_t firsty = yaxis->GetFirst();
2136 Int_t lasty = yaxis->GetLast();
2137 Double_t minx = xaxis->GetBinLowEdge(1); // overall min in user coords
2138 Double_t maxx = xaxis->GetBinUpEdge(nx); // overall max in user coords
2139 Double_t miny = yaxis->GetBinLowEdge(1); // overall min in user coords
2140 Double_t maxy = yaxis->GetBinUpEdge(ny); // overall max in user coords
2141 Double_t rminx = xaxis->GetBinLowEdge(firstx); // recent min in user coords
2142 Double_t rmaxx = xaxis->GetBinUpEdge(lastx); // recent max in user coords
2143 Double_t rminy = yaxis->GetBinLowEdge(firsty); // recent min in user coords
2144 Double_t rmaxy = yaxis->GetBinUpEdge(lasty); // recent max in user coords
2145
2146 ((TH2*)player->GetHistogram())->SetCanExtend(TH1::kNoAxis);
2147 ((TH2*)player->GetHistogram())->Reset();
2148
2149 ((TH2*)player->GetHistogram())->SetBins(nx, minx-oldXOffset+xOffset,
2150 maxx-oldXOffset+xOffset,
2151 ny, miny-oldYOffset+yOffset,
2152 maxy-oldYOffset+yOffset);
2153 TSelectorDraw *sel = (TSelectorDraw*)player->GetSelector();
2154 if (!sel) return;
2155 sel->TakeAction();
2156
2157 // Restore all the attributes which were changed by TakeAction()
2159
2160 // SetRange in BinNumbers along x and y!
2161 xaxis->SetRange(xaxis->FindBin(rminx+xOffset-oldXOffset+xBinWidth/2),
2162 xaxis->FindBin(rmaxx+xOffset-oldXOffset-xBinWidth/2));
2163 yaxis->SetRange(yaxis->FindBin(rminy+yOffset-oldYOffset+yBinWidth/2),
2164 yaxis->FindBin(rmaxy+yOffset-oldYOffset-yBinWidth/2));
2165 fSldXMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
2166 fSldXMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
2167 fSldYMin->SetNumber(yaxis->GetBinLowEdge(yaxis->GetFirst()));
2168 fSldYMax->SetNumber(yaxis->GetBinUpEdge(yaxis->GetLast()));
2171 Update();
2172 }
2173}
2174
2175////////////////////////////////////////////////////////////////////////////////
2176/// Slot connected to the OffSetSlider.
2177/// It changes the origin of the histogram inbetween a binwidth;
2178/// rebin the histogram with the new offset given by the slider.
2179/// problem: histogram with variable binwidth??
2180
2182{
2183 if (fAvoidSignal) return;
2186 TAxis* xaxis = fHist->GetXaxis();
2187 TAxis* yaxis = fHist->GetYaxis();
2188 Double_t xBinWidth = xaxis->GetBinWidth(1);
2189 Double_t yBinWidth = yaxis->GetBinWidth(1);
2190 Double_t xOffset = 1.*numx/100*xBinWidth;
2191 Double_t yOffset = 1.*numy/100*yBinWidth;
2192 if (fDelaydraw->GetState()==kButtonUp){
2193 Double_t oldXOffset = fXOffsetNumberEntry->GetNumber();
2194 Double_t oldYOffset = fYOffsetNumberEntry->GetNumber();
2195 Int_t nx = xaxis->GetNbins();
2196 Int_t ny = yaxis->GetNbins();
2197
2199 if (!player) return;
2200
2201 Int_t firstx = xaxis->GetFirst();
2202 Int_t lastx = xaxis->GetLast();
2203 Int_t firsty = yaxis->GetFirst();
2204 Int_t lasty = yaxis->GetLast();
2205 Double_t minx = xaxis->GetBinLowEdge(1); // overall min in user coords
2206 Double_t maxx = xaxis->GetBinUpEdge(nx); // overall max in user coords
2207 Double_t miny = yaxis->GetBinLowEdge(1); // overall min in user coords
2208 Double_t maxy = yaxis->GetBinUpEdge(ny); // overall max in user coords
2209 Double_t rminx = xaxis->GetBinLowEdge(firstx); // recent min in user coords
2210 Double_t rmaxx = xaxis->GetBinUpEdge(lastx); // recent max in user coords
2211 Double_t rminy = yaxis->GetBinLowEdge(firsty); // recent min in user coords
2212 Double_t rmaxy = yaxis->GetBinUpEdge(lasty); // recent max in user coords
2213
2214 ((TH2*)player->GetHistogram())->SetCanExtend(TH1::kNoAxis);
2215 ((TH2*)player->GetHistogram())->Reset();
2216
2217 ((TH2*)player->GetHistogram())->SetBins(nx,minx-oldXOffset+xOffset,
2218 maxx-oldXOffset+xOffset,
2219 ny, miny-oldYOffset+yOffset,
2220 maxy-oldYOffset+yOffset);
2221 TSelectorDraw *sel = (TSelectorDraw*)player->GetSelector();
2222 if (!sel) return;
2223 sel->TakeAction();
2224
2225 // Restore all the attributes which were changed by TakeAction()
2227
2228 // SetRange in BinNumbers along x and y!
2229 xaxis->SetRange(xaxis->FindBin(rminx+xOffset-oldXOffset+xBinWidth/2),
2230 xaxis->FindBin(rmaxx+xOffset-oldXOffset-xBinWidth/2));
2231 yaxis->SetRange(yaxis->FindBin(rminy+yOffset-oldYOffset+yBinWidth/2),
2232 yaxis->FindBin(rmaxy+yOffset-oldYOffset-yBinWidth/2));
2233 fSldXMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
2234 fSldXMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
2235 fSldYMin->SetNumber(yaxis->GetBinLowEdge(yaxis->GetFirst()));
2236 fSldYMax->SetNumber(yaxis->GetBinUpEdge(yaxis->GetLast()));
2239 Update();
2240 }
2245}
2246
2247////////////////////////////////////////////////////////////////////////////////
2248/// Slot connected to the OffSetNumberEntry, related to the OffSetSlider
2249/// changes the origin of the histogram inbetween a binwidth.
2250
2252{
2253 if (fAvoidSignal) return;
2254 TAxis* xaxis = fHist->GetXaxis();
2255 TAxis* yaxis = fHist->GetYaxis();
2256 Double_t xBinWidth = xaxis->GetBinWidth(1);
2257 Double_t yBinWidth = yaxis->GetBinWidth(1);
2259 Double_t oldXOffset = 1.*fXBinOffsetSld->GetPosition()/100*xBinWidth;
2261 Double_t oldYOffset = 1.*fYBinOffsetSld->GetPosition()/100*yBinWidth;
2262 Int_t nx = xaxis->GetNbins();
2263 Int_t ny = yaxis->GetNbins();
2265 if (!player) return;
2266 Int_t firstx = xaxis->GetFirst();
2267 Int_t lastx = xaxis->GetLast();
2268 Int_t firsty = yaxis->GetFirst();
2269 Int_t lasty = yaxis->GetLast();
2270 Double_t minx = xaxis->GetBinLowEdge(1); // overall min in user coords
2271 Double_t maxx = xaxis->GetBinUpEdge(nx); // overall max in user coords
2272 Double_t miny = yaxis->GetBinLowEdge(1); // overall min in user coords
2273 Double_t maxy = yaxis->GetBinUpEdge(ny); // overall max in user coords
2274 Double_t rminx = xaxis->GetBinLowEdge(firstx); // recent min in user coords
2275 Double_t rmaxx = xaxis->GetBinUpEdge(lastx); // recent max in user coords
2276 Double_t rminy = yaxis->GetBinLowEdge(firsty); // recent min in user coords
2277 Double_t rmaxy = yaxis->GetBinUpEdge(lasty); // recent max in user coords
2278
2279 ((TH2*)player->GetHistogram())->SetCanExtend(TH1::kNoAxis);
2280 ((TH2*)player->GetHistogram())->Reset();
2281
2282 ((TH2*)player->GetHistogram())->SetBins(nx,minx+xOffset-oldXOffset,
2283 maxx+xOffset-oldXOffset,
2284 ny,miny+yOffset-oldYOffset,
2285 maxy+yOffset-oldYOffset);
2286 TSelectorDraw *sel = (TSelectorDraw*)player->GetSelector();
2287 if (!sel) return;
2288 sel->TakeAction();
2289
2290 // Restore all the attributes which were changed by TakeAction()
2292
2293 // SetRange in BinNumbers along x and y!
2294 xaxis->SetRange(xaxis->FindBin(rminx+xOffset-oldXOffset+xBinWidth/2),
2295 xaxis->FindBin(rmaxx+xOffset-oldXOffset-xBinWidth/2));
2296 yaxis->SetRange(yaxis->FindBin(rminy+yOffset-oldYOffset+yBinWidth/2),
2297 yaxis->FindBin(rmaxy+yOffset-oldYOffset-yBinWidth/2));
2298 fSldXMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
2299 fSldXMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
2300 fXBinOffsetSld->SetPosition((Int_t)(xOffset/xBinWidth*100));
2301 fSldYMin->SetNumber(yaxis->GetBinLowEdge(yaxis->GetFirst()));
2302 fSldYMax->SetNumber(yaxis->GetBinUpEdge(yaxis->GetLast()));
2303 fYBinOffsetSld->SetPosition((Int_t)(yOffset/yBinWidth*100));
2304 Update();
2305}
2306
2307////////////////////////////////////////////////////////////////////////////////
2308/// Slot connected to the x-Slider that redraws the histogram
2309/// with the new slider range.
2310
2312{
2313 if (fAvoidSignal) return;
2314 TAxis* xaxis = fHist->GetXaxis();
2316 // 2D plot
2317 Int_t px1,py1,px2,py2;
2318 Float_t ymin,ymax,xleft,xright;
2319 xleft = xaxis->GetBinLowEdge((Int_t)((fSliderX->GetMinPosition())+0.5));
2320 xright = xaxis->GetBinUpEdge((Int_t)((fSliderX->GetMaxPosition())+0.5));
2323 px1 = fGedEditor->GetPad()->XtoAbsPixel(xleft);
2324 py1 = fGedEditor->GetPad()->YtoAbsPixel(ymin);
2325 px2 = fGedEditor->GetPad()->XtoAbsPixel(xright);
2326 py2 = fGedEditor->GetPad()->YtoAbsPixel(ymax);
2327 if (fGedEditor->GetPad()->GetCanvas())
2329 fGedEditor->GetPad()->cd();
2333 gVirtualX->DrawBox(px1, py1, px2, py2, TVirtualX::kHollow);
2334 fPx1old = px1;
2335 fPy1old = py1;
2336 fPx2old = px2 ;
2337 fPy2old = py2;
2338 gVirtualX->Update(0);
2339 fSldXMin->SetNumber(xleft);
2340 fSldXMax->SetNumber(xright);
2341 } else if (fDelaydraw->GetState()==kButtonDown &&
2344 // 3D plot
2345 Float_t p1[3], p2[3], p3[3], p4[3], p5[3], p6[3], p7[3], p8[3];
2346 if (fGedEditor->GetPad()->GetCanvas())
2348 fGedEditor->GetPad()->cd();
2349 TView *fView = fGedEditor->GetPad()->GetView();
2350 if (!fView) return;
2351 Double_t *rmin = fView->GetRmin();
2352 if (!rmin) return;
2353 Double_t *rmax = fView->GetRmax();
2354 if (!rmax) return;
2355 p1[0] = p4[0] = p5[0] = p8[0] =
2356 xaxis->GetBinLowEdge((Int_t)((fSliderX->GetMinPosition())+0.5));
2357 p2[0] = p3[0] = p6[0] = p7[0] =
2358 xaxis->GetBinUpEdge((Int_t)((fSliderX->GetMaxPosition())+0.5));
2359 p1[1] = p2[1] = p3[1] = p4[1] = rmin[1];
2360 p5[1] = p6[1] = p7[1] = p8[1] = rmax[1];
2361 p1[2] = p2[2] = p5[2] = p6[2] = rmin[2];
2362 p3[2] = p4[2] = p7[2] = p8[2] = rmax[2];
2367 PaintBox3D(p2, p3, p7, p6);
2368 PaintBox3D(p1, p4, p8, p5);
2369 for (Int_t i = 0; i<3; i++){
2370 fP1oldx[i] = p1[i];
2371 fP2oldx[i] = p2[i];
2372 fP3oldx[i] = p3[i];
2373 fP4oldx[i] = p4[i];
2374 fP5oldx[i] = p5[i];
2375 fP6oldx[i] = p6[i];
2376 fP7oldx[i] = p7[i];
2377 fP8oldx[i] = p8[i];
2378 }
2379 fSldXMin->SetNumber(p1[0]);
2380 fSldXMax->SetNumber(p2[0]);
2381 } else if (fDelaydraw->GetState()==kButtonDown &&
2385 } else {
2387 (Int_t)((fSliderX->GetMaxPosition())+0.5));
2388 fSldXMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
2389 fSldXMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
2391 Update();
2392 }
2395}
2396
2397////////////////////////////////////////////////////////////////////////////////
2398/// Slot connected to the x axis range slider that initialises
2399/// the "virtual" box which is drawn in delay draw mode.
2400
2402{
2403 if (fAvoidSignal) return;
2404 TAxis* xaxis = fHist->GetXaxis();
2405 Float_t ymin,ymax,xleft,xright;
2407 // 2D Plot
2408 if (!fGedEditor->GetPad()) return;
2409 fGedEditor->GetPad()->cd();
2410 if (fGedEditor->GetPad()->GetCanvas())
2414 xleft = xaxis->GetBinLowEdge((Int_t)((fSliderX->GetMinPosition())+0.5));
2415 xright = xaxis->GetBinUpEdge((Int_t)((fSliderX->GetMaxPosition())+0.5));
2418 fPx1old = fGedEditor->GetPad()->XtoAbsPixel(xleft);
2420 fPx2old = fGedEditor->GetPad()->XtoAbsPixel(xright);
2423 } else if (fDelaydraw->GetState()==kButtonDown &&
2426 // 3D plot
2427 if (!fGedEditor->GetPad()) return;
2428 fGedEditor->GetPad()->cd();
2429 TView *fView = fGedEditor->GetPad()->GetView();
2430 if (!fView) return;
2431 Double_t *rmin = fView->GetRmin();
2432 if (!rmin) return;
2433 Double_t *rmax = fView->GetRmax();
2434 if (!rmax) return;
2435 fP1oldx[0] = fP4oldx[0] = fP5oldx[0] = fP8oldx[0] =
2436 xaxis->GetBinLowEdge((Int_t)((fSliderX->GetMinPosition())+0.5));
2437 fP2oldx[0] = fP3oldx[0] = fP6oldx[0] = fP7oldx[0] =
2438 xaxis->GetBinUpEdge((Int_t)((fSliderX->GetMaxPosition())+0.5));
2439 fP1oldx[1] = fP2oldx[1] = fP3oldx[1] = fP4oldx[1] = rmin[1];
2440 fP5oldx[1] = fP6oldx[1] = fP7oldx[1] = fP8oldx[1] = rmax[1];
2441 fP1oldx[2] = fP2oldx[2] = fP5oldx[2] = fP6oldx[2] = rmin[2];
2442 fP3oldx[2] = fP4oldx[2] = fP7oldx[2] = fP8oldx[2] = rmax[2];
2443 if (fGedEditor->GetPad()->GetCanvas())
2449 }
2450}
2451
2452////////////////////////////////////////////////////////////////////////////////
2453/// Slot connected to the x-axis slider finalizing values after
2454/// the slider movement.
2455
2457{
2458 if (fAvoidSignal) return;
2461 (Int_t)((fSliderX->GetMaxPosition())+0.5));
2464 Update();
2465 }
2467 if (player) if (player->GetHistogram() == fHist) {
2468 Int_t last = fHist->GetXaxis()->GetLast();
2471 Update();
2472 }
2473}
2474
2475////////////////////////////////////////////////////////////////////////////////
2476/// Slot connected to the Max/Min number entry fields showing x-axis range.
2477
2479{
2480 TAxis* xaxis = fHist->GetXaxis();
2481 Int_t nx = xaxis->GetNbins();
2482 Double_t width = xaxis->GetBinWidth(1);
2483 if ((fSldXMin->GetNumber()+width/2) < (xaxis->GetBinLowEdge(1)))
2484 fSldXMin->SetNumber(xaxis->GetBinLowEdge(1));
2485 if ((fSldXMax->GetNumber()-width/2) > (xaxis->GetBinUpEdge(nx)))
2486 fSldXMax->SetNumber(xaxis->GetBinUpEdge(nx));
2488 fSldXMax->GetNumber()-width/2);
2489 Int_t nxbinmin = xaxis->GetFirst();
2490 Int_t nxbinmax = xaxis->GetLast();
2491 fSliderX->SetPosition((Double_t)(nxbinmin),(Double_t)(nxbinmax));
2492 Update();
2493}
2494
2495////////////////////////////////////////////////////////////////////////////////
2496/// Slot connected to the x-slider for redrawing the
2497/// histogram with the new slider Range (immediately).
2498
2500{
2501 if (fAvoidSignal) return;
2502 TAxis* yaxis = fHist->GetYaxis();
2504 Int_t px1,py1,px2,py2;
2505 Float_t xmin,xmax,ybottom,ytop;
2506 ybottom = yaxis->GetBinLowEdge((Int_t)((fSliderY->GetMinPosition())+0.5));
2507 ytop = yaxis->GetBinUpEdge((Int_t)((fSliderY->GetMaxPosition())+0.5));
2510 px1 = fGedEditor->GetPad()->XtoAbsPixel(xmin);
2511 py1 = fGedEditor->GetPad()->YtoAbsPixel(ybottom);
2512 px2 = fGedEditor->GetPad()->XtoAbsPixel(xmax);
2513 py2 = fGedEditor->GetPad()->YtoAbsPixel(ytop);
2514 if (fGedEditor->GetPad()->GetCanvas())
2516 fGedEditor->GetPad()->cd();
2520 gVirtualX->DrawBox(px1, py1, px2, py2, TVirtualX::kHollow);
2521 fPx1old = px1;
2522 fPy1old = py1;
2523 fPx2old = px2 ;
2524 fPy2old = py2;
2525 gVirtualX->Update(0);
2526 fSldYMin->SetNumber(ybottom);
2527 fSldYMax->SetNumber(ytop);
2528 } else if (fDelaydraw->GetState()==kButtonDown &&
2531 // 3D plot
2532 Float_t p1[3], p2[3], p3[3], p4[3], p5[3], p6[3], p7[3], p8[3];
2533 if (fGedEditor->GetPad()->GetCanvas())
2535 fGedEditor->GetPad()->cd();
2536 TView *fView = fGedEditor->GetPad()->GetView();
2537 if (!fView) return;
2538 Double_t *rmin = fView->GetRmin();
2539 if (!rmin) return;
2540 Double_t *rmax = fView->GetRmax();
2541 if (!rmax) return;
2542 p1[0] = p2[0] = p3[0] = p4[0] = rmin[0];
2543 p5[0] = p6[0] = p7[0] = p8[0] = rmax[0];
2544 p1[1] = p4[1] = p5[1] = p8[1] =
2545 yaxis->GetBinLowEdge((Int_t)((fSliderY->GetMinPosition())+0.5));
2546 p2[1] = p3[1] = p6[1] = p7[1] =
2547 yaxis->GetBinUpEdge((Int_t)((fSliderY->GetMaxPosition())+0.5));
2548 p1[2] = p2[2] = p5[2] = p6[2] = rmin[2];
2549 p3[2] = p4[2] = p7[2] = p8[2] = rmax[2];
2554 PaintBox3D(p2, p3, p7, p6);
2555 PaintBox3D(p1, p4, p8, p5);
2556 for (Int_t i = 0; i<3; i++) {
2557 fP1oldy[i] = p1[i];
2558 fP2oldy[i] = p2[i];
2559 fP3oldy[i] = p3[i];
2560 fP4oldy[i] = p4[i];
2561 fP5oldy[i] = p5[i];
2562 fP6oldy[i] = p6[i];
2563 fP7oldy[i] = p7[i];
2564 fP8oldy[i] = p8[i];
2565 }
2566 fSldYMin->SetNumber(p1[1]);
2567 fSldYMax->SetNumber(p2[1]);
2568 } else if (fDelaydraw->GetState()==kButtonDown &&
2572 } else {
2573 yaxis->SetRange((Int_t)((fSliderY->GetMinPosition())+0.5),
2574 (Int_t)((fSliderY->GetMaxPosition())+0.5));
2575 fSldYMin->SetNumber(yaxis->GetBinLowEdge(yaxis->GetFirst()));
2576 fSldYMax->SetNumber(yaxis->GetBinUpEdge(yaxis->GetLast()));
2578 Update();
2579 }
2582}
2583
2584////////////////////////////////////////////////////////////////////////////////
2585/// Slot connected to y-axis slider which initialises
2586/// the "virtual" box which is drawn in delay draw mode.
2587
2589{
2590 if (fAvoidSignal) return;
2591 TAxis* yaxis = fHist->GetYaxis();
2592 Float_t xmin,xmax,ytop,ybottom;
2594 // 2D plot:
2595 if (!fGedEditor->GetPad()) return;
2596 fGedEditor->GetPad()->cd();
2597 if (fGedEditor->GetPad()->GetCanvas())
2601 ybottom = yaxis->GetBinLowEdge((Int_t)((fSliderY->GetMinPosition())+0.5));
2602 ytop = yaxis->GetBinUpEdge((Int_t)((fSliderY->GetMaxPosition())+0.5));
2606 fPy1old = fGedEditor->GetPad()->YtoAbsPixel(ybottom);
2610 } else if (fDelaydraw->GetState()==kButtonDown &&
2613 // 3D plot
2614 if (!fGedEditor->GetPad()) return;
2615 fGedEditor->GetPad()->cd();
2616 TView *fView = fGedEditor->GetPad()->GetView();
2617 if (!fView) return;
2618 Double_t *rmin = fView->GetRmin();
2619 if (!rmin) return;
2620 Double_t *rmax = fView->GetRmax();
2621 if (!rmax) return;
2622 fP1oldy[0] = fP2oldy[0] = fP3oldy[0] = fP4oldy[0] = rmin[0];
2623 fP5oldy[0] = fP6oldy[0] = fP7oldy[0] = fP8oldy[0] = rmax[0];
2624 fP1oldy[1] = fP4oldy[1] = fP5oldy[1] = fP8oldy[1] =
2625 yaxis->GetBinLowEdge((Int_t)((fSliderY->GetMinPosition())+0.5));
2626 fP2oldy[1] = fP3oldy[1] = fP6oldy[1] = fP7oldy[1] =
2627 yaxis->GetBinUpEdge((Int_t)((fSliderY->GetMaxPosition())+0.5));
2628 fP1oldy[2] = fP2oldy[2] = fP5oldy[2] = fP6oldy[2] = rmin[2];
2629 fP3oldy[2] = fP4oldy[2] = fP7oldy[2] = fP8oldy[2] = rmax[2];
2630 if (fGedEditor->GetPad()->GetCanvas())
2636 }
2637}
2638
2639////////////////////////////////////////////////////////////////////////////////
2640/// Slot connected to the y-axis slider finalizing values after
2641/// the slider movement.
2642
2644{
2645 if (fAvoidSignal) return;
2648 (Int_t)((fSliderY->GetMaxPosition())+0.5));
2651 Update();
2652 }
2653
2655 if (player) if (player->GetHistogram() == fHist) {
2656 Int_t last = fHist->GetYaxis()->GetLast();
2659 Update();
2660 }
2661}
2662
2663////////////////////////////////////////////////////////////////////////////////
2664/// Slot connected to the Max/Min number entry fields showing y-axis range.
2665
2667{
2668 if (fAvoidSignal) return;
2669 TAxis* yaxis = fHist->GetYaxis();
2670 Int_t ny = yaxis->GetNbins();
2671 Double_t width = yaxis->GetBinWidth(1);
2672
2673 if ((fSldYMin->GetNumber()+width/2) < (yaxis->GetBinLowEdge(1)))
2674 fSldYMin->SetNumber(yaxis->GetBinLowEdge(1));
2675 if ((fSldYMax->GetNumber()-width/2) > (yaxis->GetBinUpEdge(ny)))
2676 fSldYMax->SetNumber(yaxis->GetBinUpEdge(ny));
2677
2679 fSldYMax->GetNumber()-width/2);
2680 Int_t nybinmin = yaxis -> GetFirst();
2681 Int_t nybinmax = yaxis -> GetLast();
2682 fSliderY->SetPosition((Double_t)(nybinmin),(Double_t)(nybinmax));
2683 Update();
2684}
2685
2686////////////////////////////////////////////////////////////////////////////////
2687/// Slot connected to the fill area color.
2688
2690{
2691 if (fAvoidSignal || !fGedEditor->GetPad()) return;
2692 fGedEditor->GetPad()->cd();
2694 Update();
2695}
2696
2697////////////////////////////////////////////////////////////////////////////////
2698/// Slot connected to the fill area pattern.
2699
2701{
2702 if (fAvoidSignal || !fGedEditor->GetPad()) return;
2703 fGedEditor->GetPad()->cd();
2705 Update();
2706}
2707
2708////////////////////////////////////////////////////////////////////////////////
2709/// Return the immediate histogram type (HIST, LEGO1-4, SURF1-5).
2710
2712{
2713 TString s="";
2714 switch (fTypeCombo->GetSelected()){
2715 case (-1) : {s = ""; break;}
2716 case (kTYPE_LEGO ): {s = "LEGO"; break;}
2717 case (kTYPE_LEGO1): {s = "LEGO1"; break;}
2718 case (kTYPE_LEGO2): {s = "LEGO2"; break;}
2719 case (kTYPE_LEGO3): {s = "LEGO3"; break;}
2720 case (kTYPE_LEGO4): {s = "LEGO4"; break;}
2721 case (kTYPE_SURF ): {s = "SURF"; break;}
2722 case (kTYPE_SURF1): {s = "SURF1"; break;}
2723 case (kTYPE_SURF2): {s = "SURF2"; break;}
2724 case (kTYPE_SURF3): {s = "SURF3"; break;}
2725 case (kTYPE_SURF4): {s = "SURF4"; break;}
2726 case (kTYPE_SURF5): {s = "SURF5"; break;}
2727 default: break;
2728 }
2729 return s;
2730}
2731
2732////////////////////////////////////////////////////////////////////////////////
2733/// Return the immediate coordinate system of the histogram.
2734/// (POL, CYL, SPH,PSR)
2735
2737{
2738 TString s="";
2739 switch (fCoordsCombo->GetSelected()){
2740 case (-1) : {s = ""; break;}
2741 case (kCOORDS_CAR): {s = ""; break;}
2742 case (kCOORDS_POL): {s = "POL"; break;}
2743 case (kCOORDS_CYL): {s = "CYL"; break;}
2744 case (kCOORDS_SPH): {s = "SPH"; break;}
2745 case (kCOORDS_PSR): {s = "PSR"; break;}
2746 default: break;
2747 }
2748 return s;
2749}
2750
2751////////////////////////////////////////////////////////////////////////////////
2752/// Returns histogram contour option (None,Cont0..5).
2753
2755{
2756 TString s="";
2757 switch (fContCombo->GetSelected()){
2758 case (-1) : {s = ""; break;}
2759 case (kCONT_NONE) : {s = ""; break;}
2760 case (kCONT_0) : {s = "CONT0"; break;}
2761 case (kCONT_1) : {s = "CONT1"; break;}
2762 case (kCONT_2) : {s = "CONT2"; break;}
2763 case (kCONT_3) : {s = "CONT3"; break;}
2764 case (kCONT_4) : {s = "CONT4"; break;}
2765 default: break;
2766 }
2767 return s;
2768}
2769
2770////////////////////////////////////////////////////////////////////////////////
2771/// Return histogram additive options (Arr,Box,Col,Scat,Col,Text,E,Z,FB,BB).
2772
2774{
2775 TString s="";
2776 if (fDim->GetState()==kButtonDown) {
2777 if (fAddArr->GetState()==kButtonDown) s+="ARR";
2778 if (fAddBox->GetState()==kButtonDown) s+="BOX";
2779 if (fAddCol->GetState()==kButtonDown) s+="COL";
2780 if (fAddScat->GetState()==kButtonDown) s+="SCAT";
2781 if (fAddText->GetState()==kButtonDown) s+="TEXT";
2782 if (fAddPalette->GetState()==kButtonDown) s+="Z";
2783 } else if (fDim0->GetState()==kButtonDown){
2784 if (fAddPalette1->GetState()==kButtonDown) s+="Z";
2785 if (fAddError->GetState()==kButtonDown) s+="E";
2786 if (fAddFB->GetState()==kButtonUp) s+="FB";
2787 if (fAddBB->GetState()==kButtonUp) s+="BB";
2788 }
2789 return s;
2790}
2791
2792////////////////////////////////////////////////////////////////////////////////
2793/// Return draw option string related to graphical cut in use.
2794
2796{
2797 TString cutopt = " ";
2798 TString opt = GetDrawOption();
2799 Int_t scut = opt.First('[');
2800 if (scut != -1) {
2801 Int_t ecut = opt.First(']');
2802 cutopt += opt(scut,ecut);
2803 }
2804 return cutopt;
2805}
2806
2807////////////////////////////////////////////////////////////////////////////////
2808/// Create histogram type combo box.
2809
2811{
2812 TGComboBox *c = new TGComboBox(parent, id);
2813
2814 c->AddEntry("Lego" , kTYPE_LEGO);
2815 c->AddEntry("Lego1", kTYPE_LEGO1);
2816 c->AddEntry("Lego2", kTYPE_LEGO2);
2817 c->AddEntry("Lego3", kTYPE_LEGO3);
2818 c->AddEntry("Lego4", kTYPE_LEGO4);
2819 c->AddEntry("Surf" , kTYPE_SURF);
2820 c->AddEntry("Surf1", kTYPE_SURF1);
2821 c->AddEntry("Surf2", kTYPE_SURF2);
2822 c->AddEntry("Surf3", kTYPE_SURF3);
2823 c->AddEntry("Surf4", kTYPE_SURF4);
2824 c->AddEntry("Surf5", kTYPE_SURF5);
2825
2826 return c;
2827}
2828
2829////////////////////////////////////////////////////////////////////////////////
2830/// Create coordinate system combo box.
2831
2833{
2834 TGComboBox *c = new TGComboBox(parent, id);
2835
2836 c->AddEntry("Cartesian", kCOORDS_CAR);
2837 c->AddEntry("Cylindric", kCOORDS_CYL);
2838 c->AddEntry("Polar", kCOORDS_POL);
2839 c->AddEntry("Rapidity", kCOORDS_PSR);
2840 c->AddEntry("Spheric", kCOORDS_SPH);
2841 TGListBox* lb = c->GetListBox();
2842 lb->Resize(lb->GetWidth(), 83);
2843
2844 return c;
2845}
2846
2847////////////////////////////////////////////////////////////////////////////////
2848/// Create contour combo box.
2849
2851{
2852 TGComboBox *c = new TGComboBox(parent, id);
2853
2854 c->AddEntry("None" , kCONT_NONE);
2855 c->AddEntry("Cont0", kCONT_0);
2856 c->AddEntry("Cont1", kCONT_1);
2857 c->AddEntry("Cont2", kCONT_2);
2858 c->AddEntry("Cont3", kCONT_3);
2859 c->AddEntry("Cont4", kCONT_4);
2860
2861 return c;
2862}
2863
2864////////////////////////////////////////////////////////////////////////////////
2865/// Paint a square in 3D.
2866
2868{
2869 fGedEditor->GetPad()->PaintLine3D(p1, p2);
2870 fGedEditor->GetPad()->PaintLine3D(p2, p3);
2871 fGedEditor->GetPad()->PaintLine3D(p3, p4);
2872 fGedEditor->GetPad()->PaintLine3D(p4, p1);
2873}
2874////////////////////////////////////////////////////////////////////////////////
2875/// Give an array of dividers of n (without the trivial divider n))
2876/// in the first entry the number of dividers is saved.
2877
2879{
2880 Int_t* div;
2881 if (n <= 0) {
2882 div = new Int_t[1];
2883 div[0]=0;
2884 } else if (n == 1) {
2885 div = new Int_t[2];
2886 div[0]=div[1]=1;
2887 } else {
2888 div = new Int_t[(Int_t) n/2+2];
2889 div[0]=0;
2890 div[1]=1;
2891
2892 Int_t num = 1;
2893 for (Int_t i=2; i <= n/2; i++) {
2894 if (n % i == 0) {
2895 num++;
2896 div[num] = i;
2897 }
2898 }
2899 num++;
2900 div[num]=n;
2901 div[0] = num;
2902 }
2903 return div;
2904}
2905
2906////////////////////////////////////////////////////////////////////////////////
2907/// Skip TH1Editor in building list of editors.
2908
2910{
2911 fGedEditor->ActivateEditors(TH1::Class()->GetListOfBases(), kTRUE);
2912}
2913
2914////////////////////////////////////////////////////////////////////////////////
2915/// If the contained histogram obj is deleted we must set its pointer to zero
2916
2918{
2919 if (obj == fHist) {
2920 fHist = 0;
2921 }
2922}
2923
void Class()
Definition: Class.C:29
@ 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
@ kWatch
Definition: GuiTypes.h:375
@ kPointer
Definition: GuiTypes.h:375
ULong_t Pixel_t
Pixel value.
Definition: GuiTypes.h:40
#define d(i)
Definition: RSha256.hxx:102
#define c(i)
Definition: RSha256.hxx:101
int Int_t
Definition: RtypesCore.h:45
unsigned int UInt_t
Definition: RtypesCore.h:46
const Bool_t kFALSE
Definition: RtypesCore.h:101
bool Bool_t
Definition: RtypesCore.h:63
double Double_t
Definition: RtypesCore.h:59
short Style_t
Definition: RtypesCore.h:89
float Float_t
Definition: RtypesCore.h:57
const Bool_t kTRUE
Definition: RtypesCore.h:100
#define ClassImp(name)
Definition: Rtypes.h:364
include TDocParser_001 C image html pict1_TDocParser_001 png width
Definition: TDocParser.cxx:121
@ 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
@ kLHintsNormal
Definition: TGLayout.h:32
@ 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
ETH2Wid
Definition: TH2Editor.cxx:133
@ kTYPE_SURF2
Definition: TH2Editor.cxx:137
@ kSLIDERX_MAX
Definition: TH2Editor.cxx:145
@ kBINYSLIDER
Definition: TH2Editor.cxx:147
@ kSLIDERX_MIN
Definition: TH2Editor.cxx:145
@ kTYPE_SURF5
Definition: TH2Editor.cxx:137
@ kBACKBOX_ONOFF
Definition: TH2Editor.cxx:141
@ kCONT_1
Definition: TH2Editor.cxx:143
@ kERROR_ONOFF
Definition: TH2Editor.cxx:139
@ kCOORDS_PSR
Definition: TH2Editor.cxx:138
@ kYBINOFFSET
Definition: TH2Editor.cxx:148
@ kPALETTE_ONOFF1
Definition: TH2Editor.cxx:139
@ kTYPE_SURF
Definition: TH2Editor.cxx:137
@ kTYPE_LEGO
Definition: TH2Editor.cxx:136
@ kTYPE_SURF3
Definition: TH2Editor.cxx:137
@ kTYPE_LEGO3
Definition: TH2Editor.cxx:136
@ kCONT_4
Definition: TH2Editor.cxx:143
@ kTYPE_LEGO2
Definition: TH2Editor.cxx:136
@ kCONT_TYPE
Definition: TH2Editor.cxx:139
@ kARROW_ONOFF
Definition: TH2Editor.cxx:140
@ kPATTERN
Definition: TH2Editor.cxx:146
@ kTYPE_SURF1
Definition: TH2Editor.cxx:137
@ kCOORDS_CAR
Definition: TH2Editor.cxx:138
@ kCONT_LEVELS1
Definition: TH2Editor.cxx:144
@ kTYPE_LEGO4
Definition: TH2Editor.cxx:136
@ kCONT_2
Definition: TH2Editor.cxx:143
@ kSLIDERY_MAX
Definition: TH2Editor.cxx:145
@ kDIM_COMPLEX
Definition: TH2Editor.cxx:135
@ kPALETTE_ONOFF
Definition: TH2Editor.cxx:139
@ kCOORDS_POL
Definition: TH2Editor.cxx:138
@ kTYPE_SURF4
Definition: TH2Editor.cxx:137
@ kCOORD_TYPE
Definition: TH2Editor.cxx:138
@ kCONT_0
Definition: TH2Editor.cxx:143
@ kBINXSLIDER1
Definition: TH2Editor.cxx:147
@ kBAR_OFFSET
Definition: TH2Editor.cxx:142
@ kCONT_NONE
Definition: TH2Editor.cxx:143
@ kBOX_ONOFF
Definition: TH2Editor.cxx:140
@ kSLIDERY_MIN
Definition: TH2Editor.cxx:145
@ kBINXSLIDER
Definition: TH2Editor.cxx:147
@ kCOORDS_SPH
Definition: TH2Editor.cxx:138
@ kCONT_LEVELS
Definition: TH2Editor.cxx:144
@ kCOLOR
Definition: TH2Editor.cxx:146
@ kCOORDS_CYL
Definition: TH2Editor.cxx:138
@ kDELAYED_DRAWING
Definition: TH2Editor.cxx:146
@ kBINYSLIDER1
Definition: TH2Editor.cxx:147
@ kCOL_ONOFF
Definition: TH2Editor.cxx:140
@ kFRONTBOX_ONOFF
Definition: TH2Editor.cxx:141
@ kSCAT_ONOFF
Definition: TH2Editor.cxx:140
@ kTEXT_ONOFF
Definition: TH2Editor.cxx:140
@ kXBINOFFSET
Definition: TH2Editor.cxx:148
@ kTYPE_LEGO1
Definition: TH2Editor.cxx:136
@ kTH2_TITLE
Definition: TH2Editor.cxx:134
@ kHIST_TYPE
Definition: TH2Editor.cxx:135
@ kDIM_SIMPLE
Definition: TH2Editor.cxx:135
@ kCONT_3
Definition: TH2Editor.cxx:143
@ kBAR_WIDTH
Definition: TH2Editor.cxx:142
float xmin
Definition: THbookFile.cxx:95
float ymin
Definition: THbookFile.cxx:95
float xmax
Definition: THbookFile.cxx:95
float ymax
Definition: THbookFile.cxx:95
#define gROOT
Definition: TROOT.h:404
#define gPad
Definition: TVirtualPad.h:288
#define gVirtualX
Definition: TVirtualX.h:338
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
Color_t GetFrameFillColor() const
Definition: TAttPad.h:53
void SetFrameFillColor(Color_t color=1)
Definition: TAttPad.h:73
void SetFrameFillStyle(Style_t styl=0)
Definition: TAttPad.h:75
Style_t GetFrameFillStyle() const
Definition: TAttPad.h:55
Class to manage histogram axis.
Definition: TAxis.h:30
Double_t GetXmax() const
Definition: TAxis.h:134
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:133
Int_t GetNbins() const
Definition: TAxis.h:121
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:946
virtual void SetRange(Int_t first=0, Int_t last=0)
Set the viewing range for the axis using bin numbers.
Definition: TAxis.cxx:920
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
virtual void Selected(TVirtualPad *pad, TObject *obj, Int_t event)
Emit Selected() signal.
Definition: TCanvas.cxx:1639
void FeedbackMode(Bool_t set)
Turn rubberband feedback mode on or off.
Definition: TCanvas.cxx:1118
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:80
static ULong_t Number2Pixel(Int_t ci)
Static method that given a color index number, returns the corresponding pixel value.
Definition: TColor.cxx:2069
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
Definition: TColor.cxx:1822
virtual void Show()
Show group of buttons.
virtual void SetLayoutHints(TGLayoutHints *l, TGButton *button=0)
Set layout hints for the specified button or if button=0 for all 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
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set check button state.
Definition: TGButton.cxx:1250
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
Like a checkbutton but instead of the check mark there is color area with a little down arrow.
void SetColor(Pixel_t color, Bool_t emit=kTRUE)
Set color.
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 Select(Int_t id, Bool_t emit=kTRUE)
Make the selected item visible in the combo box window and emit signals according to the second param...
Definition: TGComboBox.cxx:456
The base class for composite widgets (menu bars, list boxes, etc.).
Definition: TGFrame.h:287
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1117
virtual void Layout()
Layout the elements of the composite frame.
Definition: TGFrame.cxx:1257
virtual void ChangeOptions(UInt_t options)
Change composite frame options. Options is an OR of the EFrameTypes.
Definition: TGFrame.cxx:1043
TGCompositeFrame(const TGCompositeFrame &)=delete
virtual void ShowFrame(TGFrame *f)
Show sub frame.
Definition: TGFrame.cxx:1204
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
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:191
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:605
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:128
virtual void Resize(UInt_t w, UInt_t h)
Resize the frame.
Definition: TGSlider.h:147
A horizontal 3D line is a line that typically separates a toolbar from the menubar.
Definition: TG3DLine.h:18
This class handles GUI labels.
Definition: TGLabel.h:24
virtual void Disable(Bool_t on=kTRUE)
Definition: TGLabel.h:89
virtual void Enable()
Definition: TGLabel.h:91
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
virtual void Resize(UInt_t w, UInt_t h)
Resize the listbox widget.
Definition: TGListBox.cxx:1411
Defines top level windows that interact with the system Window Manager.
Definition: TGFrame.h:398
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
virtual void SetIntNumber(Long_t val, Bool_t emit=kTRUE)
virtual Double_t GetNumber() const
virtual void SetNumber(Double_t val, Bool_t emit=kTRUE)
@ kNEANonNegative
Non-negative number.
Definition: TGNumberEntry.h:42
@ kNEAAnyNumber
Attributes of number entry field.
Definition: TGNumberEntry.h:41
@ kNESInteger
Style of number entry field.
Definition: TGNumberEntry.h:25
@ kNESRealFour
Fixed fraction real, four digit.
Definition: TGNumberEntry.h:29
@ kNESRealTwo
Fixed fraction real, two digit.
Definition: TGNumberEntry.h:27
@ kNELLimitMinMax
Both lower and upper limits.
Definition: TGNumberEntry.h:50
TGClient * fClient
Connection to display server.
Definition: TGObject.h:27
Handle_t GetId() const
Definition: TGObject.h:37
Selects different options.
Definition: TGButton.h:322
virtual Int_t GetMaxPosition() const
Definition: TGSlider.h:85
virtual Int_t GetPosition() const
Definition: TGSlider.h:83
virtual void SetPosition(Int_t pos)
Definition: TGSlider.h:79
virtual void SetRange(Int_t min, Int_t max)
Definition: TGSlider.h:75
virtual void SetScale(Int_t scale)
Definition: TGSlider.h:74
Bool_t IsEnabled(Int_t tabIndex) const
Returns true if tab is enabled.
Definition: TGTab.cxx:498
virtual void SetEnabled(Int_t tabIndex, Bool_t on=kTRUE)
Enable or disable tab.
Definition: TGTab.cxx:470
virtual Bool_t SetTab(Int_t tabIndex, Bool_t emit=kTRUE)
Brings the composite frame with the index tabIndex to the front and generate the following event if t...
Definition: TGTab.cxx:558
Int_t GetCurrent() const
Definition: TGTab.h:90
A text buffer is used in several widgets, like TGTextEntry, TGFileDialog, etc.
Definition: TGTextBuffer.h:19
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
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
Definition: TGWindow.cxx:336
TGTab * GetTab() const
Definition: TGedEditor.h:73
void ActivateEditors(TList *bcl, Bool_t recurse)
Searches GedFrames for classes in the given list.
Definition: TGedEditor.cxx:560
virtual TCanvas * GetCanvas() const
Definition: TGedEditor.h:77
virtual TVirtualPad * GetPad() const
Definition: TGedEditor.h:78
Base frame for implementing GUI - a service class.
Definition: TGedFrame.h:27
virtual Option_t * GetDrawOption() const
Get draw options of the selected object.
Definition: TGedFrame.cxx:80
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'.
Definition: TGedFrame.cxx:122
virtual void SetDrawOption(Option_t *option="")
Set drawing option for object.
Definition: TGedFrame.cxx:144
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
virtual void Refresh(TObject *model)
Refresh the GUI info about the object attributes.
Definition: TGedFrame.cxx:134
virtual void Update()
Update the current pad when an attribute is changed via GUI.
Definition: TGedFrame.cxx:72
Bool_t fAvoidSignal
flag for executing slots
Definition: TGedFrame.h:50
is a button with pattern area with a little down arrow.
void SetPattern(Style_t pattern, Bool_t emit=kTRUE)
Set pattern.
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:8780
virtual void SetTitle(const char *title)
See GetStatOverflows for more information.
Definition: TH1.cxx:6680
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:359
@ kNoAxis
NOTE: Must always be 0 !!!
Definition: TH1.h:71
virtual Float_t GetBarWidth() const
Definition: TH1.h:256
virtual Float_t GetBarOffset() const
Definition: TH1.h:255
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
Definition: TH1.h:320
TObject * Clone(const char *newname=0) const
Make a complete copy of the underlying object.
Definition: TH1.cxx:2741
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:823
TAxis * GetYaxis()
Definition: TH1.h:321
virtual void SetContour(Int_t nlevels, const Double_t *levels=0)
Set the number and values of contour levels.
Definition: TH1.cxx:8326
virtual Double_t GetEntries() const
Return the current number of entries.
Definition: TH1.cxx:4387
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:6611
virtual void SetBins(Int_t nx, Double_t xmin, Double_t xmax)
Redefine x axis parameters.
Definition: TH1.cxx:8610
virtual Int_t GetContour(Double_t *levels=0)
Return contour values into array levels if pointer levels is non zero.
Definition: TH1.cxx:8254
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:360
Editor for changing TH2 histogram attributes, rebinning & fitting.
Definition: TH2Editor.h:34
TGNumberEntryField * fSldXMin
Contains the minimum value of the x-Axis.
Definition: TH2Editor.h:90
TGCheckButton * fAddArr
CheckBox connected to Arr-Option.
Definition: TH2Editor.h:60
TGNumberEntryField * fYOffsetNumberEntry
Shows the offset to the y origin of the histogram.
Definition: TH2Editor.h:87
virtual void DoOffsetPressed()
Slot connected to the OffSetSlider.
Definition: TH2Editor.cxx:2100
TGNumberEntry * fContLevels1
Set number of contour levels.
Definition: TH2Editor.h:68
virtual void DoBarWidth()
Slot connected to the bar width of the bar chart.
Definition: TH2Editor.cxx:1545
TGCompositeFrame * f9
Frame that contains the 3D CheckBox DrawOptions.
Definition: TH2Editor.h:53
Float_t fP4oldy[3]
Definition: TH2Editor.h:130
virtual void SetModel(TObject *obj)
Pick up the values of current histogram attributes.
Definition: TH2Editor.cxx:761
virtual void DoBinReleased()
Slot connected to the rebin slider in case of no ntuple histogram.
Definition: TH2Editor.cxx:1566
TGCheckButton * fAddBB
Draw back box (or not)
Definition: TH2Editor.h:65
TGNumberEntryField * fXOffsetNumberEntry
Shows the offset to the x origin of the histogram.
Definition: TH2Editor.h:81
Float_t fP3oldx[3]
Definition: TH2Editor.h:121
Float_t fP5oldy[3]
Definition: TH2Editor.h:131
TGCheckButton * fAddFB
Draw front box (or not)
Definition: TH2Editor.h:64
virtual void RecursiveRemove(TObject *obj)
If the contained histogram obj is deleted we must set its pointer to zero.
Definition: TH2Editor.cxx:2917
TGCompositeFrame * fBinXCont
Contains the rebin widgets for case 1.
Definition: TH2Editor.h:71
virtual void DoBinPressed()
Slot connected to the rebin slider in case of no ntuple histogram.
Definition: TH2Editor.cxx:1638
TGDoubleHSlider * fSliderY
Slider to set y-axis range.
Definition: TH2Editor.h:92
void CreateBinTab()
Create the Binning tab.
Definition: TH2Editor.cxx:356
TH2 * fBinHist
Definition: TH2Editor.h:135
TGTextButton * fApply
Apply-Button to accept the rebinned histogram.
Definition: TH2Editor.h:76
virtual Bool_t AcceptModel(TObject *model)
Check if object is able to configure with this editor.
Definition: TH2Editor.cxx:748
TGCompositeFrame * f6
Frame that contains the 2D CheckBox DrawOptions.
Definition: TH2Editor.h:52
virtual void DoAddError(Bool_t on)
Slot connected to the "Error" check button.
Definition: TH2Editor.cxx:1396
virtual void DoAddArr(Bool_t on)
Slot connected to the "Arrow draw option" check button.
Definition: TH2Editor.cxx:1231
TGCheckButton * fAddError
CheckBox connected to error bars.
Definition: TH2Editor.h:57
TGHSlider * fBinYSlider1
Slider to set y rebinning integer value.
Definition: TH2Editor.h:85
Float_t fP8oldy[3]
Definition: TH2Editor.h:134
TGNumberEntryField * fBinXNumberEntry1
Label which shows the rebinned x bin number.
Definition: TH2Editor.h:80
virtual void DoAddBB()
Slot connected to the "BB back-box draw option" check button.
Definition: TH2Editor.cxx:1492
TGCheckButton * fAddPalette1
CheckBox connected to Z option (3D)
Definition: TH2Editor.h:59
TGCompositeFrame * f38
Frame that contains the Frame Fill widgets.
Definition: TH2Editor.h:56
virtual void DoFillPattern(Style_t)
Slot connected to the fill area pattern.
Definition: TH2Editor.cxx:2700
Float_t fP2oldx[3]
Definition: TH2Editor.h:120
TGDoubleHSlider * fSliderX
Slider to set x-axis range.
Definition: TH2Editor.h:89
virtual void DoApply()
Slot connected to the Apply Button in the Rebinned histogram Window.
Definition: TH2Editor.cxx:1798
TGNumberEntryField * fBinYNumberEntry
Label which shows the rebinned bin number.
Definition: TH2Editor.h:75
TGHSlider * fBinYSlider
Slider to set rebinning y integer value.
Definition: TH2Editor.h:74
Double_t fOldXOffset
Definition: TH2Editor.h:136
TGHSlider * fYBinOffsetSld
Add an y-offset to the origin of the histogram.
Definition: TH2Editor.h:88
TGNumberEntryField * fBinXNumberEntry
Label which shows the rebinned bin number.
Definition: TH2Editor.h:73
Float_t fP7oldx[3]
Definition: TH2Editor.h:125
virtual void DoSliderYPressed()
Slot connected to y-axis slider which initialises the "virtual" box which is drawn in delay draw mode...
Definition: TH2Editor.cxx:2588
TGCheckButton * fAddPalette
CheckBox connected to Z option (2D)
Definition: TH2Editor.h:58
TGCompositeFrame * fBinXCont1
Contains the X Rebin Widgets for case 2.
Definition: TH2Editor.h:78
Float_t fP1oldx[3]
Definition: TH2Editor.h:119
TString fCutString
Contais info about graphical cuts (if any)
Definition: TH2Editor.h:98
virtual void DoOffsetMoved()
Slot connected to the OffSetSlider.
Definition: TH2Editor.cxx:2181
void PaintBox3D(Float_t *p1, Float_t *p2, Float_t *p3, Float_t *p4)
Paint a square in 3D.
Definition: TH2Editor.cxx:2867
TGRadioButton * fDim
2D-Plot RadioButton
Definition: