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// //
15// TH2Editor //
16// Editor for changing TH2 histogram attributes, rebinning & fitting. //
17// For all possible draw options (there are a few which are not imple- //
18// mentable in a graphical user interface) see THistPainter::Paint in //
19// root/histpainter/THistPainter.cxx //
20//
21//Begin_Html
22/*
23<img src="gif/TH2Editor_1.gif">
24*/
25//End_Html
26//Begin_Html
27/*
28<img src="gif/TH2Editor_2.gif">
29*/
30//End_Html
31// These changes can be made via the TH2Editor: //
32// Style Tab: //
33// 'Line' : change Line attributes (color, thickness) //
34// see TAttLineEditor //
35// 'Fill' : change Fill attributes (color, pattern) //
36// see TAttFillEditor //
37// 'Title' : TextEntry: set the title of the histogram //
38// 'Histogram': change the draw options of the histogram //
39// 'Plot' : Radiobutton: draw a 2D or 3D plot of the histogram //
40// according to the Plot dimension there will be //
41// different drawing possibilities (ComboBoxes/ //
42// CheckBoxes) //
43// 2d Plot: //
44// 'Contour' : ComboBox: draw a contour plot (None, Cont0..4) //
45// 'Cont #' : TGNumberEntry: set the number of Contours //
46// 2d Plot checkboxes: //
47// 'Arrow' : arrow mode. Shows gradient between adjacent cells //
48// 'Col' : a box is drawn for each cell with a color scale //
49// varying with contents //
50// 'Text' : Draw bin contents as text //
51// 'Box' : a box is drawn for each cell with surface //
52// proportional to contents //
53// 'Scat' : Draw a scatter-plot (default) //
54// 'Palette' : the color palette is drawn //
55// //
56// 3d Plot: //
57// 'Type' : ComboBox: set histogram type Lego or Surface-Plot //
58// draw(Lego, Lego1..4, Surf, Surf1..5) //
59// see THistPainter::Paint //
60// 'Coords' : ComboBox: set the coordinate system (Cartesian, .. //
61// Spheric) see THistPainter::Paint //
62// 'Cont #' : TGNumberEntry: set the number of Contours (for e.g. //
63// Lego2 drawoption //
64// 3d Plot checkboxes: //
65// 'Errors' : draw errors in a cartesian lego plot //
66// 'Palette' : the color palette is drawn //
67// 'Front' : draw the front box of a cartesian lego plot //
68// 'Back' : draw the back box of a cartesian lego plot //
69// Available for a 3D lego plot: //
70// 'Bar' : change the bar attributes //
71// 'W' : change Bar Width //
72// 'O' : change Bar Offset //
73// Further Editor: //
74// 'Marker' : change the Marker attributes (color, appearance, //
75// thickness) see TAttMarkerEditor //
76// //
77//Begin_Html
78/*
79<img src="gif/TH2Editor1_1.gif">
80*/
81//End_Html
82//Begin_Html
83/*
84<img src="gif/TH2Editor1_2.gif">
85*/
86//End_Html
87// //
88// Rebinning Tab: //
89// This Tab has two different layouts. One is for a histogram which//
90// is not drawn from an ntuple. The other one is available for a //
91// histogram which is drawn from an ntuple. In this case the rebin //
92// algorithm can create a rebinned histogram from the original data//
93// i.e. the ntuple. //
94// To see te differences do for example: //
95// TFile f("hsimple.root"); //
96// hpxpy->Draw("Lego2"); // non ntuple histogram //
97// ntuple->Draw("px:py","","Lego2"); // ntuple histogram //
98// Non ntuple histogram: //
99// 'Rebin': with the Sliders (one for the x, one for the y axis) //
100// the number of bins (shown in the field below the //
101// Slider) can be changed to any number which divides //
102// the number of bins of the original histogram. //
103// Pushing 'Apply' will delete the origin histogram and //
104// replace it by the rebinned one on the screen. //
105// Pushing 'Ignore' the origin histogram will be restored//
106// Histogram drawn from an ntuple: //
107// 'Rebin' with the sliders the number of bins can be enlarged by//
108// a factor of 2,3,4,5 (moving to the right) or reduced //
109// by a factor of 1/2, 1/3, 1/4, 1/5 //
110// 'BinOffset': with the BinOffset slider the origin of the //
111// histogram can be changed within one binwidth //
112// Using this slider the effect of binning the data into //
113// bins can be made visible => statistical fluctuations //
114// 'Axis Range': with the DoubleSlider it is possible to zoom into//
115// the specified axis range. It is also possible to set //
116// the upper and lower limit in fields below the slider //
117// 'Delayed drawing': all the Binning sliders can be set to delay //
118// draw mode. Then the changes on the histogram are only //
119// updated, when the Slider is released. This should be //
120// activated if the redrawing of the histogram is too //
121// time consuming. //
122//////////////////////////////////////////////////////////////////////////
123
124
125#include "TH2Editor.h"
126#include "TGedEditor.h"
127#include "TGComboBox.h"
128#include "TGTextEntry.h"
129#include "TGToolTip.h"
130#include "TGLabel.h"
131#include "TVirtualPad.h"
132#include "TStyle.h"
133#include "TString.h"
134#include "TGButtonGroup.h"
135#include "TGNumberEntry.h"
136#include "TG3DLine.h"
137#include "TGDoubleSlider.h"
138#include "TGSlider.h"
139#include "TView.h"
140#include "TCanvas.h"
141#include "TGedPatternSelect.h"
142#include "TGColorSelect.h"
143#include "TColor.h"
144#include "TTreePlayer.h"
145#include "TSelectorDraw.h"
146#include "TGTab.h"
147#include "TGMsgBox.h"
148#include "TH2.h"
149#include "TROOT.h"
150#include "TVirtualX.h"
151
152
154
172
173////////////////////////////////////////////////////////////////////////////////
174/// Constructor of histogram attribute GUI.
175
177 Int_t height, UInt_t options, Pixel_t back)
178 : TGedFrame(p, width, height, options | kVerticalFrame, back),
179 fHist(0),
180 fBin(0),
181 fBinHist(0)
182{
183 MakeTitle("Title");
184
185 // Histogram title
186 fTitlePrec = 2;
187 fTitle = new TGTextEntry(this, new TGTextBuffer(50), kTH2_TITLE);
189 fTitle->SetToolTipText("Enter the histogram title string");
190 AddFrame(fTitle, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5));
191
192
193 // 2D or 3D Plot?
194 TGCompositeFrame *f2 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
195 fDimGroup = new TGHButtonGroup(f2,"Plot");
197 fDim->SetToolTipText("A 2-d plot of the histogram is dawn");
199 fDim0->SetToolTipText("A 3-d plot of the histogram is dawn");
202 fDimGroup->Show();
204 f2->AddFrame(fDimGroup, new TGLayoutHints(kLHintsTop, 4, 1, 0, 0));
205 AddFrame(f2, new TGLayoutHints(kLHintsTop, 1, 1, 2, 5));
206
207 // 2D Plot drawoptions
208 f6 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
209 AddFrame(f6, new TGLayoutHints(kLHintsTop, 3, 1, 4, 2));
210
211 TGCompositeFrame *f7 = new TGCompositeFrame(f6, 40, 20);
212 f6->AddFrame(f7, new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
213
214 TGLabel *fAddLabel = new TGLabel(f7, "Contour:");
215 f7->AddFrame(fAddLabel, new TGLayoutHints(kLHintsLeft, 6, 4, 4, 4));
216
217 fColContLbl = new TGLabel(f7, "Cont #:");
218 f7->AddFrame(fColContLbl, new TGLayoutHints( kLHintsLeft, 6, 4, 4, 4));
219
220 fAddArr = new TGCheckButton(f7, "Arrow", kARROW_ONOFF);
221 fAddArr ->SetToolTipText("Shows gradient between adjacent cells");
222 f7->AddFrame(fAddArr, new TGLayoutHints(kLHintsLeft, 6, 1, 2, 0));
223
224 fAddCol = new TGCheckButton(f7, "Col", kCOL_ONOFF);
225 fAddCol ->SetToolTipText("A box is drawn for each cell with a color scale varying with contents");
226 f7->AddFrame(fAddCol, new TGLayoutHints(kLHintsLeft, 6, 1, 1, 0));
227
228 fAddText = new TGCheckButton(f7, "Text", kTEXT_ONOFF);
229 fAddText ->SetToolTipText("Draw bin contents as text");
230 f7->AddFrame(fAddText, new TGLayoutHints(kLHintsLeft, 6, 1, 1, 3));
231
233 f6->AddFrame(f8, new TGLayoutHints(kLHintsLeft, 5, 1, 0, 0));
234
236 f8->AddFrame(fContCombo, new TGLayoutHints(kLHintsLeft, 6, 1, 2, 1));
237 fContCombo->Resize(61, 20);
238 fContCombo->Associate(this);
239
240 fContLevels = new TGNumberEntry(f8, 20, 0, kCONT_LEVELS,
244 f8->AddFrame(fContLevels, new TGLayoutHints(kLHintsLeft, 6, 1, 3, 1));
245 fContLevels->GetNumberEntry()->SetToolTipText("Set number of contours (1..99)");
246 fContLevels->Resize(60,20);
247
248 fAddBox = new TGCheckButton(f8, "Box", kBOX_ONOFF);
249 fAddBox ->SetToolTipText("A box is drawn for each cell with surface proportional to contents");
250 f8->AddFrame(fAddBox, new TGLayoutHints(kLHintsLeft, 6, 1, 3, 0));
251
252 fAddScat = new TGCheckButton(f8, "Scat", kSCAT_ONOFF);
253 fAddScat ->SetToolTipText("Draw a scatter-plot");
254 f8->AddFrame(fAddScat, new TGLayoutHints(kLHintsLeft, 6, 1, 1, 0));
255
256 fAddPalette = new TGCheckButton(f8, "Palette", kPALETTE_ONOFF);
257 fAddPalette ->SetToolTipText("Add color palette beside the histogram");
258 f8->AddFrame(fAddPalette, new TGLayoutHints(kLHintsLeft, 6, 1, 1, 0));
259
260 f9 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
261 AddFrame(f9, new TGLayoutHints(kLHintsTop, 3, 1, 2, 0));
262
263 TGCompositeFrame *f10 = new TGCompositeFrame(f9, 40, 20);
264 f9->AddFrame(f10, new TGLayoutHints(kLHintsLeft, 0, 0, 3, 0));
265
266 TGLabel *fType = new TGLabel(f10, "Type:");
267 f10->AddFrame(fType, new TGLayoutHints(kLHintsNormal, 1, 1, 1, 1));
268
269 TGLabel *fCoords = new TGLabel(f10, "Coords:");
270 f10->AddFrame(fCoords, new TGLayoutHints(kLHintsLeft, 1, 1, 5, 1));
271
272 fColContLbl1 = new TGLabel(f10, "Cont #:");
273 f10->AddFrame(fColContLbl1, new TGLayoutHints( kLHintsLeft, 1, 1, 5, 3));
274
275 fAddFB = new TGCheckButton(f10, "Front", kFRONTBOX_ONOFF);
276 fAddFB ->SetToolTipText("Supress the drawing of the front box");
277 f10->AddFrame(fAddFB, new TGLayoutHints(kLHintsLeft, 0, 1, 6, 0));
278 fAddBB = new TGCheckButton(f10, "Back", kBACKBOX_ONOFF);
279 fAddBB ->SetToolTipText("Supress the drawing of the back box");
280 f10->AddFrame(fAddBB, new TGLayoutHints(kLHintsLeft, 0, 1, 3, 0));
281
282 TGCompositeFrame *f11 = new TGCompositeFrame(f9, 40, 20);
283 f9->AddFrame(f11, new TGLayoutHints(kLHintsLeft, 5, 1, 0, 0));
284
286 f11->AddFrame(fTypeCombo, new TGLayoutHints(kLHintsLeft, 0, 1, 2, 1));
287 fTypeCombo->Resize(80, 20);
288 fTypeCombo->Associate(this);
289
291 f11->AddFrame(fCoordsCombo, new TGLayoutHints(kLHintsLeft, 0, 1, 2, 1));
292 fCoordsCombo->Resize(80, 20);
293 fCoordsCombo->Associate(this);
294
295 fContLevels1 = new TGNumberEntry(f11, 20, 0, kCONT_LEVELS1,
299 fContLevels1->GetNumberEntry()->SetToolTipText("Set number of contours (1..99)");
300 fContLevels1->Resize(78,20);
301 f11->AddFrame(fContLevels1, new TGLayoutHints(kLHintsLeft, 0, 1, 2, 1));
302
303 fAddError = new TGCheckButton(f11, "Errors", kERROR_ONOFF);
304 fAddError ->SetToolTipText("Add color palette beside the histogram");
305 f11->AddFrame(fAddError, new TGLayoutHints(kLHintsLeft, 0, 1, 4, 0));
306 fAddPalette1 = new TGCheckButton(f11, "Palette", kPALETTE_ONOFF1);
307 fAddPalette1 ->SetToolTipText("Add color palette beside the histogram");
308 f11->AddFrame(fAddPalette1, new TGLayoutHints(kLHintsLeft, 0, 1, 3, 0));
309
310
311 // Bin bar settings
312 f12 = new TGCompositeFrame(this, 145, 10, kHorizontalFrame |
316 f12->AddFrame(new TGLabel(f12,"Bar"),
317 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
319 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
320 AddFrame(f12, new TGLayoutHints(kLHintsTop,0,0,6,4));
321
322 f13 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
323 TGLabel *fWidthLbl = new TGLabel(f13, "W:");
324 f13->AddFrame(fWidthLbl, new TGLayoutHints( kLHintsLeft, 1, 3, 4, 1));
325 fBarWidth = new TGNumberEntry(f13, 1.00, 6, kBAR_WIDTH,
329 fBarWidth->GetNumberEntry()->SetToolTipText("Set bar chart width");
330 fBarWidth->Resize(45,20);
331 f13->AddFrame(fBarWidth, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 1));
332
333 TGLabel *fOffsetLbl = new TGLabel(f13, "O:");
334 f13->AddFrame(fOffsetLbl, new TGLayoutHints(kLHintsLeft, 6,3, 4, 1));
335 fBarOffset = new TGNumberEntry(f13, 0.00, 5, kBAR_OFFSET,
339 fBarOffset->GetNumberEntry()->SetToolTipText("Set bar chart offset");
340 fBarOffset->Resize(50,20);
341 f13->AddFrame(fBarOffset, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 1));
342 AddFrame(f13, new TGLayoutHints(kLHintsTop, 1, 1, 0, 4));
343
344
345 // Set the color and pattern of the Frame (only for Cartesian 3D plot).
346 f38 = new TGCompositeFrame(this, 80, 20, kVerticalFrame);
351 f39->AddFrame(new TGLabel(f39,"Frame Fill"),
352 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
353 f39->AddFrame(new TGHorizontal3DLine(f39),
354 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
355 f38->AddFrame(f39, new TGLayoutHints(kLHintsTop,0,0,6,1));
356
358 fFrameColor = new TGColorSelect(f21, 0, kCOLOR);
359 f21->AddFrame(fFrameColor, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 0));
362 f21->AddFrame(fFramePattern, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 0));
364 f38->AddFrame(f21, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
366
367 fCutString = "";
368
369 CreateBinTab();
370
371 // add itself in the least of cleanups to be notified when attached histogram is deleted
372 gROOT->GetListOfCleanups()->Add(this);
373}
374
375////////////////////////////////////////////////////////////////////////////////
376/// Create the Binning tab.
377
379{
380 fBin = CreateEditorTabSubFrame("Binning");
381
382 // Editor for rebinning a histogram which does NOT derive from an Ntuple
384 TGCompositeFrame *title1 = new TGCompositeFrame(fBinXCont, 145, 10,
389 title1->AddFrame(new TGLabel(title1, "Rebin"),
390 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
391 title1->AddFrame(new TGHorizontal3DLine(title1),
392 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
393 fBinXCont->AddFrame(title1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
394
397 TGLabel *binSliderXLbl = new TGLabel(f22,"x:");
398 f22->AddFrame(binSliderXLbl,
399 new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 4,0, 4, 1));
400 fBinXSlider = new TGHSlider(f22, 100, kSlider1 | kScaleBoth);
401 fBinXSlider->Resize(107,20);
402 f22->AddFrame(fBinXSlider, new TGLayoutHints(kLHintsLeft, 2,0,0,3));
403 fBinXCont->AddFrame(f22, new TGLayoutHints(kLHintsTop, 3, 7, 3, 5));
404
407 TGLabel *binXLabel1 = new TGLabel(f23, "# of Bins:");
408 f23->AddFrame(binXLabel1, new TGLayoutHints(kLHintsLeft, 20, 1, 2, 1));
411 ((TGTextEntry*)fBinXNumberEntry)->SetToolTipText("Set the number of x axis bins in the rebinned histogram");
412 fBinXNumberEntry->Resize(57,20);
413 f23->AddFrame(fBinXNumberEntry, new TGLayoutHints(kLHintsRight, 8, 0, 0, 0));
414 fBinXCont->AddFrame(f23, new TGLayoutHints(kLHintsTop, 0, 7, 3, 4));
415
418 TGLabel *binSliderYLbl = new TGLabel(f37,"y:");
419 f37->AddFrame(binSliderYLbl,
420 new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 4,0, 4, 1));
421 fBinYSlider = new TGHSlider(f37, 100, kSlider1 | kScaleBoth);
422 fBinYSlider->Resize(107,20);
423 f37->AddFrame(fBinYSlider, new TGLayoutHints(kLHintsLeft, 1,0,0,3));
424 fBinXCont->AddFrame(f37, new TGLayoutHints(kLHintsTop, 3, 7, 3, 5));
425
428 TGLabel *binYLabel1 = new TGLabel(f36, "# of Bins:");
429 f36->AddFrame(binYLabel1, new TGLayoutHints(kLHintsLeft, 20, 1, 2, 1));
432 ((TGTextEntry*)fBinYNumberEntry)->SetToolTipText("Set the number of y axis bins in the rebinned histogram");
433 fBinYNumberEntry->Resize(57,20);
434 f36->AddFrame(fBinYNumberEntry, new TGLayoutHints(kLHintsRight, 8, 0, 0, 0));
435 fBinXCont->AddFrame(f36, new TGLayoutHints(kLHintsTop, 0, 7, 3, 4));
436
437 // Text buttons Apply & Ignore for rebinned histogram shown on the screen.
438 TGCompositeFrame *f24 = new TGCompositeFrame(fBinXCont, 118, 20,
441 fApply = new TGTextButton(f24, " &Apply ");
442 f24->AddFrame(fApply,
443 new TGLayoutHints(kLHintsExpandX | kLHintsLeft ,0, 3, 4, 4));
444 fCancel = new TGTextButton(f24, " &Ignore ");
445 f24->AddFrame(fCancel,
446 new TGLayoutHints(kLHintsExpandX | kLHintsLeft, 3, 0, 4, 4));
447 fBinXCont->AddFrame(f24, new TGLayoutHints(kLHintsTop, 20, 3, 3, 4));
449
450 // Widgets for rebinning a histogram which derives from an Ntuple
451
453 TGCompositeFrame *title2 = new TGCompositeFrame(fBinXCont1, 145, 10,
458 title2->AddFrame(new TGLabel(title2, "X-Axis"),
459 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
460 title2->AddFrame(new TGHorizontal3DLine(title2),
461 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
462 fBinXCont1->AddFrame(title2, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
463
466 fBinXSlider1 = new TGHSlider(f26, 100, kSlider1 | kScaleBoth);
467 fBinXSlider1->Resize(120,20);
471 f26->AddFrame(fBinXSlider1, new TGLayoutHints(kLHintsLeft, 2,0,0,0));
472 fBinXCont1->AddFrame(f26, new TGLayoutHints(kLHintsTop, 3, 7, 3, 0));
473
474 // Lettering of the Rebin Slider
477 TGLabel *l1 = new TGLabel(f27, "-5");
478 f27->AddFrame(l1, new TGLayoutHints(kLHintsLeft, 5, 1, -1, 0));
479 TGLabel *l2 = new TGLabel(f27, "-2");
480 f27->AddFrame(l2, new TGLayoutHints(kLHintsLeft, 31, 2, -1, 0));
481 TGLabel *l3 = new TGLabel(f27, "2");
482 f27->AddFrame(l3, new TGLayoutHints(kLHintsLeft, 21, 2, -1, 0));
483 TGLabel *l4 = new TGLabel(f27, "5");
484 f27->AddFrame(l4, new TGLayoutHints(kLHintsLeft, 36, 3, -1, 0));
485 fBinXCont1->AddFrame(f27, new TGLayoutHints(kLHintsTop, 0, 0, 0, 0));
486
487 TGCompositeFrame *f28 = new TGCompositeFrame(fBinXCont1, 140, 20,
489 TGLabel *binXLabel2 = new TGLabel(f28, "# of Bins:");
490 f28->AddFrame(binXLabel2, new TGLayoutHints(kLHintsLeft, 8, 1, 4, 1));
491
494 ((TGTextEntry*)fBinXNumberEntry1)->SetToolTipText("Set the number of x axis bins in the rebinned histogram");
497 new TGLayoutHints(kLHintsLeft, 21, 0, 2, 0));
498 fBinXCont1->AddFrame(f28, new TGLayoutHints(kLHintsTop, 0, 7, 2, 4));
499
502 TGLabel *xOffsetLbl = new TGLabel(f29, "BinOffset:");
503 f29->AddFrame(xOffsetLbl, new TGLayoutHints(kLHintsLeft, 7, 1, 2, 1));
508 0., 1.);
509 ((TGTextEntry*)fXOffsetNumberEntry)->SetToolTipText("Add an x-offset to the origin of the histogram");
512 new TGLayoutHints(kLHintsRight, 21, 0, 0, 0));
513 fBinXCont1->AddFrame(f29, new TGLayoutHints(kLHintsTop, 0, 7, 3, 1));
514
517 fXBinOffsetSld = new TGHSlider(f30, 100, kSlider1 | kScaleBoth);
518 fXBinOffsetSld->Resize(120,20);
520 fBinXCont1->AddFrame(f30, new TGLayoutHints(kLHintsTop, 3, 7, 3, 3));
522
523 // Same for Y-Axis:
524 // Widgets for rebinning a histogram which derives from an Ntuple
525
527 TGCompositeFrame *title3 = new TGCompositeFrame(fBinYCont1, 145, 10,
532 title3->AddFrame(new TGLabel(title3, "Y-Axis"),
533 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
534 title3->AddFrame(new TGHorizontal3DLine(title3),
535 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
536 fBinYCont1->AddFrame(title3, new TGLayoutHints(kLHintsTop, 0, 0, 7, 0));
537
540 fBinYSlider1 = new TGHSlider(f31, 100, kSlider1 | kScaleBoth);
541 fBinYSlider1->Resize(120,20);
545 f31->AddFrame(fBinYSlider1, new TGLayoutHints(kLHintsLeft, 2,0,0,0));
546 fBinYCont1->AddFrame(f31, new TGLayoutHints(kLHintsTop, 3, 7, 3, 0));
547
548 // Lettering of the Rebin Slider
551 TGLabel *l5 = new TGLabel(f32, "-5");
552 f32->AddFrame(l5, new TGLayoutHints(kLHintsLeft, 5, 1, -1, 0));
553 TGLabel *l6 = new TGLabel(f32, "-2");
554 f32->AddFrame(l6, new TGLayoutHints(kLHintsLeft, 31, 2, -1, 0));
555 TGLabel *l7 = new TGLabel(f32, "2");
556 f32->AddFrame(l7, new TGLayoutHints(kLHintsLeft, 21, 2, -1, 0));
557 TGLabel *l8 = new TGLabel(f32, "5");
558 f32->AddFrame(l8, new TGLayoutHints(kLHintsLeft, 36, 3, -1, 0));
559 fBinYCont1->AddFrame(f32, new TGLayoutHints(kLHintsTop, 0, 0, 0, 0));
560
561 TGCompositeFrame *f33 = new TGCompositeFrame(fBinYCont1, 140, 20,
563 TGLabel *binYLabel2 = new TGLabel(f33, "# of Bins:");
564 f33->AddFrame(binYLabel2, new TGLayoutHints(kLHintsLeft, 8, 1, 4, 1));
565
568 ((TGTextEntry*)fBinYNumberEntry1)->SetToolTipText("Set the number of Y axis bins in the rebinned histogram");
571 new TGLayoutHints(kLHintsLeft, 21, 0, 2, 0));
572 fBinYCont1->AddFrame(f33, new TGLayoutHints(kLHintsTop, 0, 7, 2, 4));
573
576 TGLabel *yOffsetLbl = new TGLabel(f34, "BinOffset:");
577 f34->AddFrame(yOffsetLbl, new TGLayoutHints(kLHintsLeft, 7, 1, 2, 1));
582 0., 1.);
583 ((TGTextEntry*)fYOffsetNumberEntry)->SetToolTipText("Add an Y-offset to the origin of the histogram");
586 new TGLayoutHints(kLHintsRight, 21, 0, 0, 0));
587 fBinYCont1->AddFrame(f34, new TGLayoutHints(kLHintsTop, 0, 7, 3, 1));
588
591 fYBinOffsetSld = new TGHSlider(f35, 100, kSlider1 | kScaleBoth);
592 fYBinOffsetSld->Resize(120,20);
595 fBinYCont1->AddFrame(f35, new TGLayoutHints(kLHintsTop, 3, 7, 3, 3));
597
598 // Axis ranges
599 TGCompositeFrame *title4 = new TGCompositeFrame(fBin, 145, 10,
604 title4->AddFrame(new TGLabel(title4, "Axis Range"),
605 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
606 title4->AddFrame(new TGHorizontal3DLine(title4),
607 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
608 fBin->AddFrame(title4, new TGLayoutHints(kLHintsTop, 0, 0, 5, 0));
609
611 TGLabel *fSliderXLbl = new TGLabel(f14,"x:");
612 f14->AddFrame(fSliderXLbl,
613 new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 4,3, 2, 1));
614 fSliderX = new TGDoubleHSlider(f14, 1, 2);
615 fSliderX->Resize(119,20);
617 fBin->AddFrame(f14, new TGLayoutHints(kLHintsTop, 3, 7, 4, 1));
618
623 ((TGTextEntry*)fSldXMin)->SetToolTipText("Set the minimum value of the x-axis");
624 fSldXMin->Resize(57,20);
625 f17->AddFrame(fSldXMin, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
629 ((TGTextEntry*)fSldXMax)->SetToolTipText("Set the maximum value of the x-axis");
630 fSldXMax->Resize(57,20);
631 f17->AddFrame(fSldXMax, new TGLayoutHints(kLHintsLeft, 4, 0, 0, 0));
632 fBin->AddFrame(f17, new TGLayoutHints(kLHintsTop, 20, 3, 5, 0));
633
635 TGLabel *fSliderYLbl = new TGLabel(f15,"y:");
636 f15->AddFrame(fSliderYLbl,
637 new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 4,2, 4, 1));
638 fSliderY = new TGDoubleHSlider(f15, 1, 2);
639 fSliderY->Resize(119,20);
641 fBin->AddFrame(f15, new TGLayoutHints(kLHintsTop, 3, 7, 4, 1));
642
647 ((TGTextEntry*)fSldYMin)->SetToolTipText("Set the minimum value of the y-axis");
648 fSldYMin->Resize(57,20);
649 f18->AddFrame(fSldYMin, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
653 ((TGTextEntry*)fSldYMax)->SetToolTipText("Set the maximum value of the y-axis");
654 fSldYMax->Resize(57,20);
655 f18->AddFrame(fSldYMax, new TGLayoutHints(kLHintsLeft, 4, 0, 0, 0));
656 fBin->AddFrame(f18, new TGLayoutHints(kLHintsTop, 20, 3, 5, 0));
657
659 fDelaydraw = new TGCheckButton(f20, "Delayed drawing", kDELAYED_DRAWING);
660 fDelaydraw ->SetToolTipText("Draw the new axis range when the Slider is released");
661 f20->AddFrame(fDelaydraw, new TGLayoutHints(kLHintsLeft, 6, 1, 1, 0));
662 fBin->AddFrame(f20, new TGLayoutHints(kLHintsTop, 2, 1, 5, 3));
663
664 fXBinOffsetSld->SetRange(0,100);
667
668 fYBinOffsetSld->SetRange(0,100);
671
674
675}
676
677////////////////////////////////////////////////////////////////////////////////
678/// Destructor.
679
681{
682 // remove itselef from the list of cleanups
683 gROOT->GetListOfCleanups()->Remove(this);
684
685 // children of TGButonGroup are not deleted
686 delete fDim;
687 delete fDim0;
688 delete fDimlh;
689 delete fDim0lh;
690
691 if (fBinHist) delete fBinHist;
692 fBinHist = 0;
693}
694
695////////////////////////////////////////////////////////////////////////////////
696/// Connect signals to slots.
697
699{
700 fTitle->Connect("TextChanged(const char *)", "TH2Editor", this, "DoTitle(const char *)");
701 fDimGroup->Connect("Clicked(Int_t)","TH2Editor",this,"DoHistView()");
702 fTypeCombo->Connect("Selected(Int_t)", "TH2Editor", this, "DoHistChanges()");
703 fCoordsCombo->Connect("Selected(Int_t)", "TH2Editor", this, "DoHistChanges()");
704 fContCombo->Connect("Selected(Int_t)", "TH2Editor", this, "DoHistChanges()");
705 fAddArr->Connect("Toggled(Bool_t)", "TH2Editor", this, "DoAddArr(Bool_t)");
706 fAddBox->Connect("Toggled(Bool_t)", "TH2Editor", this, "DoAddBox(Bool_t)");
707 fAddCol->Connect("Toggled(Bool_t)", "TH2Editor", this, "DoAddCol(Bool_t)");
708 fAddScat->Connect("Toggled(Bool_t)", "TH2Editor", this, "DoAddScat(Bool_t)");
709 fAddText->Connect("Toggled(Bool_t)", "TH2Editor", this, "DoAddText(Bool_t)");
710 fAddError->Connect("Toggled(Bool_t)", "TH2Editor", this, "DoAddError(Bool_t)");
711 fAddPalette->Connect("Toggled(Bool_t)", "TH2Editor", this, "DoAddPalette(Bool_t)");
712 fAddPalette1->Connect("Toggled(Bool_t)", "TH2Editor", this, "DoAddPalette(Bool_t)");
713 fAddFB->Connect("Toggled(Bool_t)", "TH2Editor", this, "DoAddFB()");
714 fAddBB->Connect("Toggled(Bool_t)", "TH2Editor", this, "DoAddBB()");
715 fContLevels->Connect("ValueSet(Long_t)", "TH2Editor", this, "DoContLevel()");
716 (fContLevels->GetNumberEntry())->Connect("ReturnPressed()", "TH2Editor",
717 this,"DoContLevel()");
718 fContLevels1->Connect("ValueSet(Long_t)", "TH2Editor", this, "DoContLevel1()");
719 (fContLevels1->GetNumberEntry())->Connect("ReturnPressed()", "TH2Editor",
720 this,"DoContLevel1()");
721 fBarWidth->Connect("ValueSet(Long_t)", "TH2Editor", this, "DoBarWidth()");
722 (fBarWidth->GetNumberEntry())->Connect("ReturnPressed()", "TH2Editor",
723 this, "DoBarWidth()");
724 fBarOffset->Connect("ValueSet(Long_t)", "TH2Editor", this, "DoBarOffset()");
725 (fBarOffset->GetNumberEntry())->Connect("ReturnPressed()", "TH2Editor",
726 this, "DoBarOffset()");
727 fBinXSlider->Connect("PositionChanged(Int_t)","TH2Editor",this, "DoBinMoved()");
728 fBinXSlider->Connect("Released()","TH2Editor",this, "DoBinReleased()");
729 fBinXSlider->Connect("Pressed()","TH2Editor",this, "DoBinPressed()");
730 fBinYSlider->Connect("PositionChanged(Int_t)","TH2Editor",this, "DoBinMoved()");
731 fBinYSlider->Connect("Released()","TH2Editor",this, "DoBinReleased()");
732 fBinYSlider->Connect("Pressed()","TH2Editor",this, "DoBinPressed()");
733 fBinXNumberEntry->Connect("ReturnPressed()", "TH2Editor", this, "DoBinLabel()");
734 fBinYNumberEntry->Connect("ReturnPressed()", "TH2Editor", this, "DoBinLabel()");
735 fApply->Connect("Clicked()", "TH2Editor", this, "DoApply()");
736 fCancel->Connect("Pressed()", "TH2Editor", this, "DoCancel()");
737 fBinXSlider1->Connect("Released()","TH2Editor",this, "DoBinReleased1()");
738 fBinXSlider1->Connect("PositionChanged(Int_t)","TH2Editor",this, "DoBinMoved1()");
739 fBinXNumberEntry1->Connect("ReturnPressed()", "TH2Editor", this, "DoBinLabel1()");
740 fXBinOffsetSld->Connect("PositionChanged(Int_t)","TH2Editor",this, "DoOffsetMoved()");
741 fXBinOffsetSld->Connect("Released()","TH2Editor",this, "DoOffsetReleased()");
742 fXBinOffsetSld->Connect("Pressed()","TH2Editor",this, "DoOffsetPressed()");
743 fXOffsetNumberEntry->Connect("ReturnPressed()", "TH2Editor", this, "DoBinOffset()");
744 fBinYSlider1->Connect("Released()","TH2Editor",this, "DoBinReleased1()");
745 fBinYSlider1->Connect("PositionChanged(Int_t)","TH2Editor",this, "DoBinMoved1()");
746 fBinYNumberEntry1->Connect("ReturnPressed()", "TH2Editor", this, "DoBinLabel1()");
747 fYBinOffsetSld->Connect("PositionChanged(Int_t)","TH2Editor",this,"DoOffsetMoved()");
748 fYBinOffsetSld->Connect("Released()","TH2Editor",this, "DoOffsetReleased()");
749 fYBinOffsetSld->Connect("Pressed()","TH2Editor",this, "DoOffsetPressed()");
750 fYOffsetNumberEntry->Connect("ReturnPressed()", "TH2Editor", this,"DoBinOffset()");
751 fSliderX->Connect("PositionChanged()","TH2Editor",this, "DoSliderXMoved()");
752 fSliderX->Connect("Pressed()","TH2Editor",this, "DoSliderXPressed()");
753 fSliderX->Connect("Released()","TH2Editor",this, "DoSliderXReleased()");
754 fSldXMin->Connect("ReturnPressed()", "TH2Editor", this, "DoXAxisRange()");
755 fSldXMax->Connect("ReturnPressed()", "TH2Editor", this, "DoXAxisRange()");
756 fSliderY->Connect("PositionChanged()","TH2Editor",this, "DoSliderYMoved()");
757 fSliderY->Connect("Pressed()","TH2Editor",this, "DoSliderYPressed()");
758 fSliderY->Connect("Released()","TH2Editor",this, "DoSliderYReleased()");
759 fSldYMin->Connect("ReturnPressed()", "TH2Editor", this, "DoYAxisRange()");
760 fSldYMax->Connect("ReturnPressed()", "TH2Editor", this, "DoYAxisRange()");
761 fFrameColor->Connect("ColorSelected(Pixel_t)", "TH2Editor", this, "DoFillColor(Pixel_t)");
762 fFramePattern->Connect("PatternSelected(Style_t)", "TH2Editor", this, "DoFillPattern(Style_t)");
763
764 fInit = kFALSE;
765}
766
767////////////////////////////////////////////////////////////////////////////////
768/// Check if object is able to configure with this editor.
769
771{
772 if (obj == 0 || !obj->InheritsFrom(TH2::Class()) ||
773 (!strcmp(((TH2 *)obj)->GetName(),"htemp") &&
774 ((TH2*)obj)->GetEntries() == 0)) { // htemp is an empty histogram
775 return kFALSE;
776 }
777 return kTRUE;
778}
779
780////////////////////////////////////////////////////////////////////////////////
781/// Pick up the values of current histogram attributes.
782
784{
786 if (fBinHist && (obj != fHist)) {
787 //we have probably moved to a different pad.
788 //let's restore the original histogram
789 if (fHist) {
790 fHist->Reset();
798 }
799 // delete in anycase fBinHist also when fHist is zero (i.e when it has been deleted)
800 delete fBinHist;
801 fBinHist = 0;
802 if (fGedEditor->GetPad()) {
805 }
806 }
807
808 fHist = (TH2*) obj;
809
810 const char *text = fHist->GetTitle();
812 TString str = GetDrawOption();
814 str.ToUpper();
815
816 if (str == "") {
817 // default options = Scatter-Plot
818 ShowFrame(f6);
819 HideFrame(f9);
820 HideFrame(f12);
821 HideFrame(f13);
822 HideFrame(f38);
828
839 } else if (!str.Contains("LEGO") && !str.Contains("SURF")) {
840 ShowFrame(f6);
841 HideFrame(f9);
842 HideFrame(f12);
843 HideFrame(f13);
844 HideFrame(f38);
849 if (str.Contains("CONT")){
850 if (str.Contains("CONT1")) fContCombo->Select(kCONT_1);
851 else if (str.Contains("CONT2")) fContCombo->Select(kCONT_2);
852 else if (str.Contains("CONT3")) fContCombo->Select(kCONT_3);
853 else if (str.Contains("CONT4")) fContCombo->Select(kCONT_4);
854 else if (str.Contains("CONT0") || str.Contains("CONT"))
857
858 if (str.Contains("ARR")) fAddArr->SetState(kButtonDown);
860 if (str.Contains("BOX")) fAddBox->SetState(kButtonDown);
862 if (str.Contains("COL")) fAddCol->SetState(kButtonDown);
864 if (str.Contains("SCAT")) {
865 if (str=="SCAT") fAddScat->SetState(kButtonDisabled);
867 } else fAddScat->SetState(kButtonUp);
868 if (str.Contains("TEXT")) fAddText->SetState(kButtonDown);
870
872 if (str.Contains("COL") || (str.Contains("CONT") &&
873 !str.Contains("CONT2") && !str.Contains("CONT3"))) {
880
881 } else if (str.Contains("LEGO") || str.Contains("SURF")) {
882 HideFrame(f6);
883 ShowFrame(f9);
884 ShowFrame(f12);
885 ShowFrame(f13);
886 ShowFrame(f38);
889 if (str.Contains("LEGO4")) fTypeCombo->Select(kTYPE_LEGO4);
890 else if (str.Contains("LEGO3")) fTypeCombo->Select(kTYPE_LEGO3);
891 else if (str.Contains("LEGO2")) fTypeCombo->Select(kTYPE_LEGO2);
892 else if (str.Contains("LEGO1")) fTypeCombo->Select(kTYPE_LEGO1);
893 else if (str.Contains("LEGO")) fTypeCombo->Select(kTYPE_LEGO);
894 else if (str.Contains("SURF5")) fTypeCombo->Select(kTYPE_SURF5);
895 else if (str.Contains("SURF4")) fTypeCombo->Select(kTYPE_SURF4);
896 else if (str.Contains("SURF3")) fTypeCombo->Select(kTYPE_SURF3);
897 else if (str.Contains("SURF2")) fTypeCombo->Select(kTYPE_SURF2);
898 else if (str.Contains("SURF1")) fTypeCombo->Select(kTYPE_SURF1);
899 else if (str.Contains("SURF")) fTypeCombo->Select(kTYPE_SURF);
900
901
902 if (str.Contains("CYL")) fCoordsCombo->Select(kCOORDS_CYL);
903 else if (str.Contains("POL")) fCoordsCombo->Select(kCOORDS_POL);
904 else if (str.Contains("SPH")) fCoordsCombo->Select(kCOORDS_SPH);
905 else if (str.Contains("PSR")) fCoordsCombo->Select(kCOORDS_PSR);
906 else fCoordsCombo->Select(kCOORDS_CAR); //default
907
914
922 } else {
923 if (str.Contains("FB")) fAddFB->SetState(kButtonUp);
925 if (str.Contains("BB")) fAddBB->SetState(kButtonUp);
927 if (str.Contains("E")){
928 TString dum = str;
929 if (str.Contains("LEGO"))
930 dum.Remove(strstr(dum.Data(),"LEGO")-dum.Data(),4);
931 if (str.Contains("TEXT"))
932 dum.Remove(strstr(dum.Data(),"TEXT")-dum.Data(),4);
933 if (dum.Contains("E")) fAddError->SetState(kButtonDown);
936 }
944 else if (str.Contains("Z")) fAddPalette1->SetState(kButtonDown);
946 }
947
950
951 Int_t nx = fHist -> GetXaxis() -> GetNbins();
952 Int_t nxbinmin = fHist -> GetXaxis() -> GetFirst();
953 Int_t nxbinmax = fHist -> GetXaxis() -> GetLast();
954 fSliderX->SetRange(1,nx);
955 fSliderX->SetPosition((Double_t)nxbinmin,(Double_t)nxbinmax);
958
959 Int_t ny = fHist -> GetYaxis() -> GetNbins();
960 Int_t nybinmin = fHist -> GetYaxis() -> GetFirst();
961 Int_t nybinmax = fHist -> GetYaxis() -> GetLast();
962 fSliderY->SetRange(1,ny);
963 fSliderY->SetPosition((Double_t)nybinmin,(Double_t)nybinmax);
966
968
969 if (str.Contains("COL") || fContCombo->GetSelected()!= kCONT_NONE)
971 else fColContLbl->Disable();
972
973 if (str.Contains("LEGO2") || str.Contains("SURF1") ||
974 str.Contains("SURF2") || str.Contains("SURF3") ||
975 str.Contains("SURF5")) fColContLbl1->Enable();
976 else fColContLbl1->Disable();
977
980
983
985
986
987 // Check if histogram is from ntupla/tree or not.
988 // If it is a standard histogram or a ntupla based histogram
989 // show a different frame in case of rebinning (fBinCont) with sliders and bin number entries
990 // connected to different methods.
991 // For example the entry field fBinXNumberEntry is connected to
992 // the method DoBinLabel in case of non-ntupla histograms which just call Th1::Rebin
993 // In csae of a tree based histogram the entry field fBinNumberEntry1 is used which is connected to
994 // TH1Editor::DoBinLabel1 which is re-filling the histograms with the cached values from the TTreePlayer.
995 // Since the actual number of histogram entry can be larger than the cache size of the TTreePlayer
996 // (see JIRA ROOT-5900 or http://root.cern.ch/phpBB3/viewtopic.php?f=3&t=17107 )
997 // the GUI frame based on a non-tupla histogram is used when the number of entries of the histogram is
998 // not the same as the number of filled entries in the TTreePlayer object.
999
1000 if (!player || player->GetHistogram()!=fHist ||
1001 fHist->GetEntries() != player->GetNfill()) {
1002 Int_t n1 = 0, n2 =0;
1003 Int_t upx =0, upy =0;
1004 if (fBinHist) n1 = fBinHist->GetXaxis()->GetNbins();
1005 else n1 = nx;
1006 if (fBinHist) n2 = fBinHist->GetYaxis()->GetNbins();
1007 else n2 = ny;
1011 if (n1 < 1) n1 = 1;
1012 if (n2 < 1) n2 = 1;
1013 Int_t* divx = Dividers(n1);
1014 Int_t* divy = Dividers(n2);
1015 if (divx[0]-1 <= 1) upx = 2;
1016 else upx = divx[0]-1;
1017 fBinXSlider->SetRange(1,upx);
1018 if (divy[0]-1 <= 1) upy = 2;
1019 else upy = divy[0]-1;
1020 fBinYSlider->SetRange(1,upy);
1021 Int_t i = 1; Int_t j = 1;
1024 else {
1025 while ( divx[i] != nx) i ++;
1026 fBinXSlider->SetPosition(divx[0] - i + 1);
1027 }
1030 else {
1031 while ( divy [j] != ny) j ++;
1032 fBinYSlider->SetPosition(divy[0] - j + 1);
1033 }
1038 delete [] divx;
1039 delete [] divy;
1040 }
1041 else if (player && fHist==player->GetHistogram() && fHist->GetEntries() == player->GetNfill()) {
1047 fBinXNumberEntry1->SetIntNumber(nxbinmax-nxbinmin+1);
1050 fBinYNumberEntry1->SetIntNumber(nybinmax-nybinmin+1);
1051 }
1052
1054 fHist->GetXaxis()->GetBinWidth(1));
1056 fHist->GetYaxis()->GetBinWidth(1));
1058
1062
1063}
1064
1065////////////////////////////////////////////////////////////////////////////////
1066/// Slot connected to the histogram title setting.
1067
1068void TH2Editor::DoTitle(const char *text)
1069{
1070 if (fAvoidSignal) return;
1072 Update();
1073}
1074
1075////////////////////////////////////////////////////////////////////////////////
1076/// Slot connected to the 'Plot' button group.
1077
1079{
1080 if (gPad && gPad->GetVirtCanvas()) gPad->GetVirtCanvas()->SetCursor(kWatch);
1081 gVirtualX->SetCursor(GetId(), gVirtualX->CreateCursor(kWatch));
1082
1083 if (fDim->GetState() == kButtonDown)
1084 DoHistSimple();
1085 else
1086 DoHistComplex();
1087
1088 if (gPad && gPad->GetVirtCanvas()) gPad->GetVirtCanvas()->SetCursor(kPointer);
1089 gVirtualX->SetCursor(GetId(), gVirtualX->CreateCursor(kPointer));
1090}
1091
1092////////////////////////////////////////////////////////////////////////////////
1093/// Slot connected to the 2D-Plot radio button.
1094
1096{
1097 if (fAvoidSignal) return;
1098 TString str = "";
1099 ShowFrame(f6);
1100 HideFrame(f9);
1101 HideFrame(f12);
1102 HideFrame(f13);
1103 HideFrame(f38);
1104 if (fContCombo->GetSelected()==-1)
1106 if ((fContCombo->GetSelected()!= kCONT_NONE) &&
1109
1111 if (str=="" || str=="SCAT" || str==fCutString) {
1114 } else if (fAddScat->GetState()==kButtonDisabled)
1116 if (str.Contains("COL") || fContCombo->GetSelected()!= kCONT_NONE)
1118 else fColContLbl->Disable();
1119
1121
1122 TString ocut = fCutString;
1123 ocut.ToUpper();
1124 if (!str.Contains(fCutString) && !str.Contains(ocut))
1125 str+=fCutString;
1126 SetDrawOption(str);
1127 Update();
1128}
1129
1130////////////////////////////////////////////////////////////////////////////////
1131/// Slot connected to the 3D-Plot radio button.
1132
1134{
1135 if (fAvoidSignal) return;
1136 TString str = "";
1137 HideFrame(f6);
1138 ShowFrame(f9);
1139 ShowFrame(f38);
1140 if (GetHistTypeLabel().Contains("LEGO")) {
1141 ShowFrame(f12);
1142 ShowFrame(f13);
1143 } else {
1144 HideFrame(f12);
1145 HideFrame(f13);
1146 }
1149
1151
1152 if (str.Contains("LEGO2") || str.Contains("SURF1") ||
1153 str.Contains("SURF2") || str.Contains("SURF3") ||
1154 str.Contains("SURF5")) {
1158 } else {
1161 }
1162
1164
1165 TString ocut = fCutString;
1166 ocut.ToUpper();
1167 if (!str.Contains(fCutString) && !str.Contains(ocut))
1168 str+=fCutString;
1169 SetDrawOption(str);
1170 Update();
1171}
1172
1173////////////////////////////////////////////////////////////////////////////////
1174/// Slot connected to histogram type, coordinate system, contour combo box.
1175
1177{
1178 if (fAvoidSignal) return;
1179 TString str = "";
1180 if (fDim->GetState() == kButtonDown) {
1184 fContCombo->GetSelected()!=kCONT_3) || str.Contains("COL")) {
1185
1186 if (str.Contains("Z")) fAddPalette->SetState(kButtonDown);
1189 if (str=="" || str=="SCAT" || str==fCutString) {
1192 } else if (fAddScat->GetState()==kButtonDisabled)
1195 if (str.Contains("COL") || fContCombo->GetSelected()!= kCONT_NONE)
1197 else
1199
1200 } else if (fDim0->GetState() == kButtonDown) {
1208 } else {
1215 }
1216 if ((fTypeCombo->GetSelected()==kTYPE_LEGO) ||
1225 if (GetHistTypeLabel().Contains("LEGO")) {
1226 ShowFrame(f12);
1227 ShowFrame(f13);
1228 } else {
1229 HideFrame(f12);
1230 HideFrame(f13);
1231 }
1234 if (str.Contains("LEGO2") || str.Contains("SURF1") ||
1235 str.Contains("SURF2") || str.Contains("SURF3") ||
1236 str.Contains("SURF5"))
1238 else
1240 }
1241
1242 TString ocut = fCutString;
1243 ocut.ToUpper();
1244 if (!str.Contains(fCutString) && !str.Contains(ocut))
1245 str+=fCutString;
1246 SetDrawOption(str);
1247 Update();
1248}
1249
1250////////////////////////////////////////////////////////////////////////////////
1251/// Slot connected to the "Arrow draw option" check button.
1252
1254{
1255 if (fAvoidSignal) return;
1257 TString str = GetDrawOption();
1258 str.ToUpper();
1259
1260 if (on) {
1261 if (!str.Contains("ARR")) {
1262 str += "ARR";
1265 make=kTRUE;
1266 }
1267 } else if (fAddArr->GetState()==kButtonUp) {
1268 if (str.Contains("ARR")) {
1269 str.Remove(strstr(str.Data(),"ARR")-str.Data(),3);
1270 if (str=="" || str=="SCAT" || str==fCutString) {
1273 }
1274 make=kTRUE;
1275 }
1276 }
1277 if (make) {
1278 DoHistChanges();
1279 }
1280}
1281
1282////////////////////////////////////////////////////////////////////////////////
1283/// Slot connected to the "Box draw option" check button.
1284
1286{
1287 if (fAvoidSignal) return;
1289 TString str = GetDrawOption();
1290 str.ToUpper();
1291
1292 if (on) {
1293 if (!str.Contains("BOX")) {
1294 str += "BOX";
1297 make=kTRUE;
1298 }
1299 } else if (fAddBox->GetState()==kButtonUp) {
1300 if (str.Contains("BOX")) {
1301 str.Remove(strstr(str.Data(),"BOX")-str.Data(),3);
1302 if (str=="" || str=="SCAT" || str==fCutString) {
1305 }
1306 make=kTRUE;
1307 }
1308 }
1309 if (make) {
1310 DoHistChanges();
1311 }
1312}
1313
1314////////////////////////////////////////////////////////////////////////////////
1315/// Slot connected to the "Col draw option" check button.
1316
1318{
1319 if (fAvoidSignal) return;
1321 TString str = GetDrawOption();
1322 str.ToUpper();
1323
1324 if (on) {
1325 if (!str.Contains("COL")) {
1326 str += "COL";
1327 fColContLbl->Enable() ;
1332 make=kTRUE;
1333 }
1334 } else if (fAddCol->GetState()==kButtonUp) {
1335 if (str.Contains("COL")) {
1336 str.Remove(strstr(str.Data(),"COL")-str.Data(),3);
1341 if (str.Contains("Z"))
1342 str.Remove(strstr(str.Data(),"Z")-str.Data(),1);
1343 }
1344 if (str=="" || str=="SCAT" || str==fCutString)
1347 fColContLbl->Enable() ;
1348 else fColContLbl->Disable();
1349 make=kTRUE;
1350 }
1351 }
1352 if (make) {
1353 DoHistChanges();
1354 }
1355}
1356
1357////////////////////////////////////////////////////////////////////////////////
1358/// Slot connected to the "Scat draw option" check button.
1359
1361{
1362 if (fAvoidSignal) return;
1364 TString str = GetDrawOption();
1365 str.ToUpper();
1366
1367 if (on) {
1368 if (!str.Contains("SCAT")) {
1369 str += "SCAT";
1370 make=kTRUE;
1371 }
1372 } else if (fAddScat->GetState()==kButtonUp) {
1373 if (str.Contains("SCAT")) {
1374 str.Remove(strstr(str.Data(),"SCAT")-str.Data(),4);
1375 make=kTRUE;
1376 }
1377 }
1378 if (make) {
1379 DoHistChanges();
1380 }
1381}
1382
1383////////////////////////////////////////////////////////////////////////////////
1384/// Slot connected to the "Text draw option" check button.
1385
1387{
1388 if (fAvoidSignal) return;
1390 TString str = GetDrawOption();
1391 str.ToUpper();
1392
1393 if (on) {
1394 if (!str.Contains("TEXT")) {
1395 str += "TEXT";
1398 make=kTRUE;
1399 }
1400 } else if (fAddText->GetState()==kButtonUp) {
1401 if (str.Contains("TEXT")) {
1402 str.Remove(strstr(str.Data(),"TEXT")-str.Data(),4);
1403 if (str=="" || str=="SCAT" || str==fCutString)
1405 make=kTRUE;
1406 }
1407 }
1408 if (make) {
1409 DoHistChanges();
1410 // next line is needed for marker editor refresh
1412 }
1413}
1414
1415////////////////////////////////////////////////////////////////////////////////
1416/// Slot connected to the "Error" check button.
1417
1419{
1420 if (fAvoidSignal) return;
1422 TString str = GetDrawOption();
1423 str.ToUpper();
1424
1425 TString dum = str;
1426 if (str.Contains("LEGO"))
1427 dum.Remove(strstr(dum.Data(),"LEGO")-dum.Data(),4);
1428 if (str.Contains("TEXT"))
1429 dum.Remove(strstr(dum.Data(),"TEXT")-dum.Data(),4);
1430 if (on) {
1431 if (!dum.Contains("E")) {
1432 str += "E";
1433 make=kTRUE;
1434 }
1435 } else if (fAddError->GetState() == kButtonUp) {
1436 if (str.Contains("E")) {
1437 if (fDim->GetState() == kButtonDown)
1439 else
1442 make=kTRUE;
1443 }
1444 }
1445 if (make) {
1446 DoHistChanges();
1447 }
1448}
1449
1450////////////////////////////////////////////////////////////////////////////////
1451/// Slot connected to the color palette check button.
1452
1454{
1455 if (fAvoidSignal) return;
1457 TString str = GetDrawOption();
1458 str.ToUpper();
1459
1460 if (on) {
1461 if (!str.Contains("Z")) {
1462 str += "Z";
1463 make=kTRUE;
1464 }
1465 } else if (fAddPalette->GetState()==kButtonUp ||
1467 if (str.Contains("Z")) {
1468 str.Remove(strstr(str.Data(),"Z")-str.Data(),1);
1469 make=kTRUE;
1470 }
1471 }
1472 if (make) {
1473 DoHistChanges();
1474 }
1475}
1476
1477////////////////////////////////////////////////////////////////////////////////
1478/// Slot connected to the "FB front-box draw option" check button.
1479
1481{
1482 if (fAvoidSignal) return;
1484 TString str = GetDrawOption();
1485 str.ToUpper();
1486
1487 if (fAddFB->GetState()==kButtonDown) {
1488 if (str.Contains("FB")) {
1489 if (str.Contains("SURF") && !(str.Contains("1") ||
1490 str.Contains("2") || str.Contains("3") ||
1491 str.Contains("4") || str.Contains("5"))) {
1492 TString dum = str;
1493 dum.Remove(strstr(dum.Data(),"SURF")-dum.Data(),4);
1494 if (dum.Contains("FB"))
1495 dum.Remove(strstr(dum.Data(),"FB")-dum.Data(),2);
1496 str = "SURF" + dum;
1497 } else str.Remove(strstr(str.Data(),"FB")-str.Data(),2);
1498 make = kTRUE;
1499 }
1500 } else if (fAddFB->GetState()==kButtonUp){
1501 if (!str.Contains("FB")) {
1502 str += "FB";
1503 make=kTRUE;
1504 }
1505 }
1506 if (make) {
1507 DoHistChanges();
1508 }
1509}
1510
1511////////////////////////////////////////////////////////////////////////////////
1512/// Slot connected to the "BB back-box draw option" check button.
1513
1515{
1516 if (fAvoidSignal) return;
1518 TString str = GetDrawOption();
1519 str.ToUpper();
1520
1521 if (fAddBB->GetState()==kButtonDown) {
1522 if (str.Contains("BB")) {
1523 if (str.Contains("FB")) {
1524 TString dum = str;
1525 dum.Remove(strstr(dum.Data(),"FB")-dum.Data(),2);
1526 dum.Remove(strstr(dum.Data(),"BB")-dum.Data(),2);
1527 str=dum+"FB";
1528 } else str.Remove(strstr(str.Data(),"BB")-str.Data(),2);
1529 make = kTRUE;
1530 }
1531 } else if (fAddBB->GetState()==kButtonUp){
1532 if (!str.Contains("BB")) {
1533 str += "BB";
1534 make=kTRUE;
1535 }
1536 }
1537 if (make) {
1538 DoHistChanges();
1539 }
1540}
1541
1542////////////////////////////////////////////////////////////////////////////////
1543/// Slot connected to the contour level number entry fContLevels.
1544
1546{
1547 if (fAvoidSignal) return;
1550 Update();
1551}
1552
1553////////////////////////////////////////////////////////////////////////////////
1554/// Slot connected to the contour level number entry fContLevels1.
1555
1557{
1558 if (fAvoidSignal) return;
1561 Update();
1562}
1563
1564////////////////////////////////////////////////////////////////////////////////
1565/// Slot connected to the bar width of the bar chart.
1566
1568{
1569 if (fAvoidSignal) return;
1571 Update();
1572}
1573
1574////////////////////////////////////////////////////////////////////////////////
1575/// Slot connected to the bar offset of the bar chart.
1576
1578{
1579 if (fAvoidSignal) return;
1581 Update();
1582}
1583
1584////////////////////////////////////////////////////////////////////////////////
1585/// Slot connected to the rebin slider in case of no ntuple histogram.
1586/// It updates some other widgets related to the rebin slider.
1587
1589{
1590 // Draw the rebinned histogram in case of the delay draw mode
1591 if (fAvoidSignal) return;
1593 if (!fBinHist) {
1594 fBinHist = (TH2*)fHist->Clone("BinHist");
1595 fBinHist->SetDirectory(0); // TH2Editor manages this histogram
1596 }
1597 Int_t nx = fBinHist->GetXaxis()->GetNbins();
1598 Int_t ny = fBinHist->GetYaxis()->GetNbins();
1599 Int_t numx = fBinXSlider->GetPosition();
1600 Int_t numy = fBinYSlider->GetPosition();
1601 Int_t* divx = Dividers(nx);
1602 Int_t* divy = Dividers(ny);
1603 if (divx[0]==2) fBinXSlider->SetPosition(2);
1604 if (divy[0]==2) fBinYSlider->SetPosition(2);
1605 if (divx[0]==2 && divy[0]==2) {
1606 delete [] divx;
1607 delete [] divy;
1608 return;
1609 }
1610 // delete the histogram which is on the screen
1611 fGedEditor->GetPad()->cd();
1612 fHist->Reset();
1615 ny,fBinHist->GetYaxis()->GetXmin(),
1616 fBinHist->GetYaxis()->GetXmax());
1617 fHist->Add(fBinHist);
1619 fHist->Rebin2D(divx[numx], divy[numy]);
1620
1621 //fModel=fHist;
1622
1623 if (divx[0]!=2) {
1624 TAxis* xaxis = fHist->GetXaxis();
1625 Double_t xBinWidth = xaxis->GetBinWidth(1);
1626 xaxis->SetRangeUser(fSldXMin->GetNumber()+xBinWidth/2,
1627 fSldXMax->GetNumber()-xBinWidth/2);
1628 fSliderX->SetRange(1,(Int_t)nx/divx[numx]);
1629 fSliderX->SetPosition(xaxis->FindBin(fSldXMin->GetNumber()+xBinWidth/2),
1630 xaxis->FindBin(fSldXMax->GetNumber()-xBinWidth/2));
1631 // the axis range could be changed a little bit by the Rebin algorithm
1632 fSldXMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
1633 fSldXMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
1634 }
1635 if (divy[0]!=2) {
1636 TAxis* yaxis = fHist->GetYaxis();
1637 Double_t yBinWidth = yaxis->GetBinWidth(1);
1638 yaxis->SetRangeUser(fSldYMin->GetNumber()+yBinWidth/2,
1639 fSldYMax->GetNumber()-yBinWidth/2);
1640 fSliderY->SetRange(1,(Int_t)ny/divy[numy]);
1641 fSliderY->SetPosition(yaxis->FindBin(fSldYMin->GetNumber()+yBinWidth/2),
1642 yaxis->FindBin(fSldYMax->GetNumber()-yBinWidth/2));
1643 fSldYMin->SetNumber(yaxis->GetBinLowEdge(yaxis->GetFirst()));
1644 fSldYMax->SetNumber(yaxis->GetBinUpEdge(yaxis->GetLast()));
1645 }
1648 Update();
1649 delete [] divx;
1650 delete [] divy;
1651 }
1652// fGedEditor->GetPad()->GetCanvas()->Selected(fGedEditor->GetPad(), fHist, 0);
1653 // fModel = fHist;
1654 Refresh(fHist);
1655}
1656
1657////////////////////////////////////////////////////////////////////////////////
1658/// Slot connected to the rebin slider in case of no ntuple histogram.
1659
1661{
1662 if (fAvoidSignal) return;
1663 Int_t* divx = Dividers(fHist->GetXaxis()->GetNbins());
1664 Int_t* divy = Dividers(fHist->GetYaxis()->GetNbins());
1665 if (divx[0]==2 && divy[0]==2 && !fBinHist)
1667 "TH2Editor", "It is not possible to rebin the histogram",
1669 // calling the MessageBox again does NOT work!*/
1670 delete [] divx;
1671 delete [] divy;
1672}
1673
1674////////////////////////////////////////////////////////////////////////////////
1675/// Slot connected to the rebin sliders in case of no ntuple histogram
1676/// does the rebinning of the selected histogram.
1677
1679{
1680 // create a clone in the background, when the slider is moved for 1st time
1681 if (fAvoidSignal) return;
1682 if (!fBinHist /*&& fDelaydraw->GetState()!=kButtonDown*/) {
1683 Int_t* divx = Dividers(fHist->GetXaxis()->GetNbins());
1684 Int_t* divy = Dividers(fHist->GetYaxis()->GetNbins());
1685 // if there is nothing to rebin:
1686 if (divx[0]==2 && divy[0]==2) {
1687 delete [] divx;
1688 delete [] divy;
1689 return;
1690 }
1691 fBinHist = (TH2*)fHist->Clone("BinHist");
1692 fBinHist->SetDirectory(0); // TH2Editor manages this histogram
1693 delete [] divx;
1694 delete [] divy;
1695 }
1696 // if the slider already has been moved and the clone is saved
1697 Int_t nx = fBinHist->GetXaxis()->GetNbins();
1698 Int_t ny = fBinHist->GetYaxis()->GetNbins();
1699 Int_t numx = fBinXSlider->GetPosition();
1700 Int_t numy = fBinYSlider->GetPosition();
1701 if (nx < 1 || ny < 1) return;
1702 Int_t* divx = Dividers(nx);
1703 Int_t* divy = Dividers(ny);
1704 if (divx[0]==2) {
1706 numx=1;
1707 }
1708 if (divy[0]==2) {
1710 numy=1;
1711 }
1712 Int_t maxx = (Int_t)nx/divx[numx];
1713 Int_t maxy = (Int_t)ny/divy[numy];
1714 if (maxx==1) maxx=2;
1715 if (maxy==1) maxy=2;
1716 if (fDelaydraw->GetState()==kButtonUp){
1717 // delete the histogram which is on the screen
1718 fGedEditor->GetPad()->cd();
1719 fHist->Reset();
1722 ny,fBinHist->GetYaxis()->GetXmin(),
1723 fBinHist->GetYaxis()->GetXmax());
1724 fHist->Add(fBinHist);
1726 fHist->Rebin2D(divx[numx], divy[numy]);
1727 //fModel=fHist;
1728 if (divx[0]!=2) {
1729 TAxis* xaxis = fHist->GetXaxis();
1730 Double_t xBinWidth = xaxis->GetBinWidth(1);
1731 // if the user has zoomed into a special area the range will be reset:
1732 xaxis->SetRangeUser(fSldXMin->GetNumber()+xBinWidth/2,
1733 fSldXMax->GetNumber()-xBinWidth/2);
1734 fSliderX->SetRange(1,maxx);
1735 fSliderX->SetPosition(xaxis->FindBin(fSldXMin->GetNumber()+xBinWidth/2),
1736 xaxis->FindBin(fSldXMax->GetNumber()-xBinWidth/2));
1737 // the axis range could be changed a little bit by the Rebin algorithm
1738 fSldXMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
1739 fSldXMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
1741 }
1742 if (divy[0]!=2) {
1743 TAxis* yaxis = fHist->GetYaxis();
1744 Double_t yBinWidth = yaxis->GetBinWidth(1);
1745 yaxis->SetRangeUser(fSldYMin->GetNumber()+yBinWidth/2,
1746 fSldYMax->GetNumber()-yBinWidth/2);
1747 fSliderY->SetRange(1,maxy);
1748 fSliderY->SetPosition(yaxis->FindBin(fSldYMin->GetNumber()+yBinWidth/2),
1749 yaxis->FindBin(fSldYMax->GetNumber()-yBinWidth/2));
1750 fSldYMin->SetNumber(yaxis->GetBinLowEdge(yaxis->GetFirst()));
1751 fSldYMax->SetNumber(yaxis->GetBinUpEdge(yaxis->GetLast()));
1753 }
1754 Update();
1755 }
1756 // set the according NumberEntries
1763 delete [] divx;
1764 delete [] divy;
1765}
1766
1767////////////////////////////////////////////////////////////////////////////////
1768/// Slot connected to the Bin Number Entry for the Rebin.
1769
1771{
1772 if (fAvoidSignal) return;
1773 Int_t i;
1776 Int_t nx = 0;
1777 if (fBinHist) nx = fBinHist->GetXaxis()->GetNbins();
1778 else nx = fHist->GetXaxis()->GetNbins();
1779 Int_t ny = 0;
1780 if (fBinHist) ny = fBinHist->GetYaxis()->GetNbins();
1781 else ny = fHist->GetYaxis()->GetNbins();
1782 if (nx < 2 || ny < 2) return;
1783 // Get the divider of nx/ny which is closest to numx/numy
1784 Int_t *divx = Dividers(nx);
1785 Int_t *divy = Dividers(ny);
1786 Int_t diff = TMath::Abs(numx - divx[1]);
1787 Int_t c = 1; Int_t d = 1;
1788 for (i = 2; i <= divx[0]; i++) {
1789 if ((TMath::Abs(numx - divx[i])) < diff) {
1790 c = i;
1791 diff = TMath::Abs(numx - divx[i]);
1792 }
1793 }
1794 diff = TMath::Abs(numy - divy[1]);
1795 for (i = 2; i <= divy[0]; i++) {
1796 if ((TMath::Abs(numy - divy[i])) < diff) {
1797 d = i;
1798 diff = TMath::Abs(numy - divy[i]);
1799 }
1800 }
1801 if (divx[c]!= fHist->GetXaxis()->GetNbins() ||
1802 divy[d]!= fHist->GetYaxis()->GetNbins()) {
1804 fBinXSlider->SetPosition(divx[0] - c +1);
1806 fBinYSlider->SetPosition(divy[0] - d +1);
1808 else DoBinReleased();
1809 }
1810// fGedEditor->GetPad()->GetCanvas()->Selected(fGedEditor->GetPad(), fHist, 0);
1811// fModel = fHist;
1812 Refresh(fHist);
1813 delete [] divx;
1814 delete [] divy;
1815}
1816
1817////////////////////////////////////////////////////////////////////////////////
1818/// Slot connected to the Apply Button in the Rebinned histogram Window.
1819
1821{
1822 Int_t ret = 0;
1824 "TH2 Editor", "Replace origin histogram with rebinned one?",
1826 if (ret==1) {
1827 if (fBinHist) {
1828 delete fBinHist;
1829 fBinHist = 0;
1830 }
1831 Int_t nx = fHist->GetXaxis()->GetNbins();
1832 Int_t ny = fHist->GetYaxis()->GetNbins();
1833 Int_t *divx = Dividers(nx);
1834 Int_t *divy = Dividers(ny);
1835 Int_t upx = 0, upy = 0;
1836 if (divx[0]-1 <= 1) upx = 2;
1837 else upx = divx[0]-1;
1838 if (divy[0]-1 <= 1) upy = 2;
1839 else upy = divy[0]-1;
1840 fBinXSlider->SetRange(1,upx);
1841 fBinYSlider->SetRange(1,upy);
1842 if (fBinXSlider->GetMaxPosition()==2 && divx[0]==2 )
1844 else fBinXSlider->SetPosition(1);
1845 if (fBinYSlider->GetMaxPosition()==2 && divy[0]==2 )
1847 else fBinYSlider->SetPosition(1);
1850 Update();
1851 delete [] divx;
1852 delete [] divy;
1853 } else if (ret==2) DoCancel();
1854}
1855
1856////////////////////////////////////////////////////////////////////////////////
1857/// Slot connected to the Cancel Button in the Rebinned histogram Window.
1858
1860{
1861 if (fBinHist) {
1862 fGedEditor->GetPad()->cd();
1863 fHist->Reset();
1869 fBinHist->GetYaxis()->GetXmax());
1870 fHist->Add(fBinHist);
1872 fBinHist->GetXaxis()->GetLast());
1874 fBinHist->GetYaxis()->GetLast());
1875
1876 delete fBinHist;
1877 fBinHist = 0;
1878
1881 Int_t* divx = Dividers(fHist->GetXaxis()->GetNbins());
1882 Int_t* divy = Dividers(fHist->GetYaxis()->GetNbins());
1883 if (divx[0]!=2) fBinXSlider->SetPosition(1);
1884 if (divy[0]!=2) fBinYSlider->SetPosition(1);
1885 // Consigning the new Histogram to all other Editors
1886// fGedEditor->GetPad()->GetCanvas()->Selected(fGedEditor->GetPad(), fHist, 0);
1887 Update();
1888 // fModel = fHist;
1889 Refresh(fHist);
1890 delete [] divx;
1891 delete [] divy;
1892 }
1893}
1894
1895
1896////////////////////////////////////////////////////////////////////////////////
1897/// Slot connected to the BinNumber Slider in case of a 'ntuple histogram'.
1898/// It does the rebin.
1899
1901{
1902 if (fAvoidSignal) return;
1903 Double_t oldXOffset = fXOffsetNumberEntry->GetNumber();
1904 Int_t xnumber = fBinXSlider1->GetPosition();
1905 Double_t oldYOffset = fYOffsetNumberEntry->GetNumber();
1906 Int_t ynumber = fBinYSlider1->GetPosition();
1907 if (xnumber==5 && ynumber==5) return;
1908 Int_t xfact = 0;
1909 Int_t yfact = 0;
1910 Int_t xBinNumber = 0;
1911 Int_t yBinNumber = 0;
1912 TAxis* xaxis = fHist->GetXaxis();
1913 TAxis* yaxis = fHist->GetYaxis();
1914 //"compute" the scaling factor:
1915 if (xnumber >= 5) xfact = xnumber - 4;
1916 else xfact = xnumber - 6;
1917 if (ynumber >= 5) yfact = ynumber - 4;
1918 else yfact = ynumber - 6;
1920 if (!player) return;
1921 Int_t nx = xaxis->GetNbins();
1922 Int_t ny = yaxis->GetNbins();
1923 Int_t firstx = xaxis->GetFirst();
1924 Int_t lastx = xaxis->GetLast();
1925 Int_t firsty = yaxis->GetFirst();
1926 Int_t lasty = yaxis->GetLast();
1927 Double_t minx = xaxis->GetBinLowEdge(1); // overall min in user coords
1928 Double_t maxx = xaxis->GetBinUpEdge(nx); // overall max in user coords
1929 Double_t miny = yaxis->GetBinLowEdge(1); // overall min in user coords
1930 Double_t maxy = yaxis->GetBinUpEdge(ny); // overall max in user coords
1931 Double_t rminx = xaxis->GetBinLowEdge(firstx); // recent min in user coords
1932 Double_t rmaxx = xaxis->GetBinUpEdge(lastx); // recent max in user coords
1933 Double_t rminy = yaxis->GetBinLowEdge(firsty); // recent min in user coords
1934 Double_t rmaxy = yaxis->GetBinUpEdge(lasty); // recent max in user coords
1935
1936 ((TH2*)player->GetHistogram())->SetCanExtend(TH1::kNoAxis);
1937 ((TH2*)player->GetHistogram())->Reset();
1938
1939 // Get new Number of bins
1940 if (xfact > 0) xBinNumber = xfact*nx;
1941 if (xfact < 0) xBinNumber = (Int_t) ((-1)*nx/xfact+0.5);
1942 if (xBinNumber < 1) xBinNumber = 1;
1943 if (xBinNumber > 1000) xBinNumber= 1000;
1944 if (yfact > 0) yBinNumber = yfact*ny;
1945 if (yfact < 0) yBinNumber = (Int_t) ((-1)*ny/yfact+0.5);
1946 if (yBinNumber < 1) yBinNumber = 1;
1947 if (yBinNumber > 1000) yBinNumber= 1000;
1948 Double_t xOffset = 1.*fXBinOffsetSld->GetPosition()/100*((maxx-minx)/xBinNumber);
1949 Double_t yOffset = 1.*fYBinOffsetSld->GetPosition()/100*((maxy-miny)/yBinNumber);
1950 // create new histogram - the main job is done by sel->TakeAction()
1951
1952 ((TH2*)player->GetHistogram())->SetBins(xBinNumber, minx-oldXOffset+xOffset,
1953 maxx-oldXOffset+xOffset,
1954 yBinNumber, miny-oldYOffset+yOffset,
1955 maxy-oldYOffset+yOffset);
1956 TSelectorDraw *sel = (TSelectorDraw*)player->GetSelector();
1957 if (!sel) return;
1958 sel->TakeAction();
1959
1960 // Restore and set all the attributes which were changed by TakeAction()
1962 fSliderX->SetRange(1,xBinNumber);
1963 fSliderY->SetRange(1,yBinNumber);
1964 Double_t xBinWidth = xaxis->GetBinWidth(1);
1965 Double_t yBinWidth = yaxis->GetBinWidth(1);
1966 fSliderX->SetPosition(xaxis->FindBin(rminx+xBinWidth/2),
1967 xaxis->FindBin(rmaxx-xBinWidth/2));
1968 fSliderY->SetPosition(yaxis->FindBin(rminy+yBinWidth/2),
1969 yaxis->FindBin(rmaxy-yBinWidth/2));
1970 xOffset = 1.*fXBinOffsetSld->GetPosition()/100*xBinWidth; // nessesary ??
1971 yOffset = 1.*fYBinOffsetSld->GetPosition()/100*yBinWidth; // nessesary ??
1972
1973 // SetRange in BinNumbers along x and y!
1974 xaxis->SetRange(xaxis->FindBin(rminx+xBinWidth/2),
1975 xaxis->FindBin(rmaxx-xBinWidth/2));
1976 yaxis->SetRange(yaxis->FindBin(rminy+yBinWidth/2),
1977 yaxis->FindBin(rmaxy-yBinWidth/2));
1978 fSldXMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
1979 fSldXMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
1980 fSldYMin->SetNumber(yaxis->GetBinLowEdge(yaxis->GetFirst()));
1981 fSldYMax->SetNumber(yaxis->GetBinUpEdge(yaxis->GetLast()));
1982 fBinXNumberEntry1->SetNumber(xaxis->GetLast() - xaxis->GetFirst()+1);
1983 fBinYNumberEntry1->SetNumber(yaxis->GetLast() - yaxis->GetFirst()+1);
1989 xaxis->GetBinWidth(1));
1991 yaxis->GetBinWidth(1));
1993 // when you 2-clicks on a slider, sometimes it gets caught on wrong position! (2 or -2)
1995 // when you 2-clicks on a slider, sometimes it gets caught on wrong position! (2 or -2)
1996 Update();
1997}
1998
1999////////////////////////////////////////////////////////////////////////////////
2000/// Slot connected to the rebin slider in case of an ntuple histogram.
2001/// Updates the BinNumberEntryField during the BinSlider movement.
2002
2004{
2005 if (fAvoidSignal) return;
2006 TAxis* xaxis = fHist->GetXaxis();
2007 TAxis* yaxis = fHist->GetYaxis();
2008 Int_t firstx = xaxis->GetFirst();
2009 Int_t lastx = xaxis->GetLast();
2010 Int_t firsty = yaxis->GetFirst();
2011 Int_t lasty = yaxis->GetLast();
2012 Int_t xnumber = fBinXSlider1->GetPosition();
2013 Int_t ynumber = fBinYSlider1->GetPosition();
2014 Int_t numx = lastx-firstx+1;
2015 Int_t numy = lasty-firsty+1;
2016 Int_t xfact = 0;
2017 Int_t yfact = 0;
2018 Int_t xBinNumber = 0;
2019 Int_t yBinNumber = 0;
2020 if (xnumber >= 5) xfact = xnumber - 4;
2021 else xfact = xnumber - 6;
2022 if (xfact > 0) xBinNumber = xfact*numx;
2023 if (xfact < 0) xBinNumber = (Int_t) ((-1)*numx/xfact+0.5);
2024 if (xBinNumber < 1) xBinNumber = 1;
2025 if (xBinNumber > 1000) xBinNumber= 1000;
2026 if (fBinXNumberEntry1->GetNumber()!=xBinNumber)
2027 fBinXNumberEntry1->SetIntNumber(xBinNumber);
2028
2029 if (ynumber >= 5) yfact = ynumber - 4;
2030 else yfact = ynumber - 6;
2031 if (yfact > 0) yBinNumber = yfact*numy;
2032 if (yfact < 0) yBinNumber = (Int_t) ((-1)*numy/yfact+0.5);
2033 if (yBinNumber < 1) yBinNumber = 1;
2034 if (yBinNumber > 1000) yBinNumber= 1000;
2035 if (fBinYNumberEntry1->GetNumber()!=yBinNumber)
2036 fBinYNumberEntry1->SetIntNumber(yBinNumber);
2037}
2038
2039////////////////////////////////////////////////////////////////////////////////
2040/// Slot connected to the Bin Number Entry for the Rebin.
2041
2043{
2044 if (fAvoidSignal) return;
2045 Double_t oldXOffset = fXOffsetNumberEntry->GetNumber();
2047 Double_t oldYOffset = fYOffsetNumberEntry->GetNumber();
2049 TAxis* xaxis = fHist->GetXaxis();
2050 TAxis* yaxis = fHist->GetYaxis();
2052 if (!player) return;
2053 Int_t firstx = xaxis->GetFirst();
2054 Int_t lastx = xaxis->GetLast();
2055 Int_t firsty = yaxis->GetFirst();
2056 Int_t lasty = yaxis->GetLast();
2057 Int_t nx = xaxis->GetNbins();
2058 Int_t ny = yaxis->GetNbins();
2059 Double_t minx = xaxis->GetBinLowEdge(1); // overall min in user coords
2060 Double_t maxx = xaxis->GetBinUpEdge(nx); // overall max in user coords
2061 Double_t miny = yaxis->GetBinLowEdge(1); // overall min in user coords
2062 Double_t maxy = yaxis->GetBinUpEdge(ny); // overall max in user coords
2063 Double_t rminx = xaxis->GetBinLowEdge(firstx); // recent min in user coords
2064 Double_t rmaxx = xaxis->GetBinUpEdge(lastx); // recent max in user coords
2065 Double_t rminy = yaxis->GetBinLowEdge(firsty); // recent min in user coords
2066 Double_t rmaxy = yaxis->GetBinUpEdge(lasty); // recent max in user coords
2067
2068 ((TH2*)player->GetHistogram())->SetCanExtend(TH1::kNoAxis);
2069 ((TH2*)player->GetHistogram())->Reset();
2070
2071 // Calculate the new number of bins in the complete range
2072 Int_t xBinNumber = (Int_t) ((maxx-minx)/(rmaxx - rminx)*numx + 0.5);
2073 if (xBinNumber < 1) xBinNumber = 1;
2074 if (xBinNumber > 1000) xBinNumber= 1000;
2075 Double_t xOffset = 1.*(fXBinOffsetSld->GetPosition())/100*(maxx-minx)/xBinNumber;
2076 Int_t yBinNumber = (Int_t) ((maxy-miny)/(rmaxy - rminy)*numy + 0.5);
2077 if (yBinNumber < 1) yBinNumber = 1;
2078 if (yBinNumber > 1000) yBinNumber= 1000;
2079 Double_t yOffset = 1.*(fYBinOffsetSld->GetPosition())/100*(maxy-miny)/yBinNumber;
2080 // create new histogram - the main job is done by sel->TakeAction()
2081 ((TH2*)player->GetHistogram())->SetBins(xBinNumber, minx-oldXOffset+xOffset,
2082 maxx-oldXOffset+xOffset,
2083 yBinNumber, miny-oldYOffset+yOffset,
2084 maxy-oldYOffset+yOffset);
2085 TSelectorDraw *sel = (TSelectorDraw*)player->GetSelector();
2086 if (!sel) return;
2087 sel->TakeAction();
2088
2089 // Restore and set all the attributes which were changed by TakeAction()
2091 fSliderX->SetRange(1,xBinNumber);
2092 fSliderY->SetRange(1,yBinNumber);
2093 Double_t xBinWidth = xaxis->GetBinWidth(1);
2094 Double_t yBinWidth = yaxis->GetBinWidth(1);
2095 fSliderX->SetPosition(xaxis->FindBin(rminx+xBinWidth/2),
2096 xaxis->FindBin(rmaxx-xBinWidth/2));
2097 fSliderY->SetPosition(yaxis->FindBin(rminy+yBinWidth/2),
2098 yaxis->FindBin(rmaxy-yBinWidth/2));
2099 xOffset = 1.*fXBinOffsetSld->GetPosition()/100*xBinWidth; //nesessary ??
2100 yOffset = 1.*fYBinOffsetSld->GetPosition()/100*yBinWidth; //nesessary ??
2101
2102 // SetRange in BinNumbers along x and y!
2103 xaxis->SetRange(xaxis->FindBin(rminx+xBinWidth/2),
2104 xaxis->FindBin(rmaxx-xBinWidth/2));
2105 yaxis->SetRange(yaxis->FindBin(rminy+yBinWidth/2),
2106 yaxis->FindBin(rmaxy-yBinWidth/2));
2107 fSldXMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
2108 fSldXMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
2109 fSldYMin->SetNumber(yaxis->GetBinLowEdge(yaxis->GetFirst()));
2110 fSldYMax->SetNumber(yaxis->GetBinUpEdge(yaxis->GetLast()));
2115 Update();
2116}
2117
2118////////////////////////////////////////////////////////////////////////////////
2119/// Slot connected to the OffSetSlider. It saves the OldBinOffset
2120/// (nessesary for delay draw mode).
2121
2123{
2124 if (fAvoidSignal) return;
2127}
2128
2129////////////////////////////////////////////////////////////////////////////////
2130/// Slot connected to the OffSetSlider that
2131/// changes the origin of the histogram inbetween a binwidth;
2132/// rebin the histogram with the new Offset given by the slider.
2133/// problem: histogram with variable binwidth??
2134
2136{
2137 if (fAvoidSignal) return;
2141 TAxis* xaxis = fHist->GetXaxis();
2142 TAxis* yaxis = fHist->GetYaxis();
2143 Double_t xBinWidth = xaxis->GetBinWidth(1);
2144 Double_t yBinWidth = yaxis->GetBinWidth(1);
2145 Double_t xOffset = 1.*numx/100*xBinWidth;
2146 Double_t yOffset = 1.*numy/100*yBinWidth;
2147 Double_t oldXOffset = fOldXOffset;
2148 Double_t oldYOffset = fOldYOffset;
2149 Int_t nx = xaxis->GetNbins();
2150 Int_t ny = yaxis->GetNbins();
2151
2153 if (!player) return;
2154
2155 Int_t firstx = xaxis->GetFirst();
2156 Int_t lastx = xaxis->GetLast();
2157 Int_t firsty = yaxis->GetFirst();
2158 Int_t lasty = yaxis->GetLast();
2159 Double_t minx = xaxis->GetBinLowEdge(1); // overall min in user coords
2160 Double_t maxx = xaxis->GetBinUpEdge(nx); // overall max in user coords
2161 Double_t miny = yaxis->GetBinLowEdge(1); // overall min in user coords
2162 Double_t maxy = yaxis->GetBinUpEdge(ny); // overall max in user coords
2163 Double_t rminx = xaxis->GetBinLowEdge(firstx); // recent min in user coords
2164 Double_t rmaxx = xaxis->GetBinUpEdge(lastx); // recent max in user coords
2165 Double_t rminy = yaxis->GetBinLowEdge(firsty); // recent min in user coords
2166 Double_t rmaxy = yaxis->GetBinUpEdge(lasty); // recent max in user coords
2167
2168 ((TH2*)player->GetHistogram())->SetCanExtend(TH1::kNoAxis);
2169 ((TH2*)player->GetHistogram())->Reset();
2170
2171 ((TH2*)player->GetHistogram())->SetBins(nx, minx-oldXOffset+xOffset,
2172 maxx-oldXOffset+xOffset,
2173 ny, miny-oldYOffset+yOffset,
2174 maxy-oldYOffset+yOffset);
2175 TSelectorDraw *sel = (TSelectorDraw*)player->GetSelector();
2176 if (!sel) return;
2177 sel->TakeAction();
2178
2179 // Restore all the attributes which were changed by TakeAction()
2181
2182 // SetRange in BinNumbers along x and y!
2183 xaxis->SetRange(xaxis->FindBin(rminx+xOffset-oldXOffset+xBinWidth/2),
2184 xaxis->FindBin(rmaxx+xOffset-oldXOffset-xBinWidth/2));
2185 yaxis->SetRange(yaxis->FindBin(rminy+yOffset-oldYOffset+yBinWidth/2),
2186 yaxis->FindBin(rmaxy+yOffset-oldYOffset-yBinWidth/2));
2187 fSldXMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
2188 fSldXMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
2189 fSldYMin->SetNumber(yaxis->GetBinLowEdge(yaxis->GetFirst()));
2190 fSldYMax->SetNumber(yaxis->GetBinUpEdge(yaxis->GetLast()));
2193 Update();
2194 }
2195}
2196
2197////////////////////////////////////////////////////////////////////////////////
2198/// Slot connected to the OffSetSlider.
2199/// It changes the origin of the histogram inbetween a binwidth;
2200/// rebin the histogram with the new offset given by the slider.
2201/// problem: histogram with variable binwidth??
2202
2204{
2205 if (fAvoidSignal) return;
2208 TAxis* xaxis = fHist->GetXaxis();
2209 TAxis* yaxis = fHist->GetYaxis();
2210 Double_t xBinWidth = xaxis->GetBinWidth(1);
2211 Double_t yBinWidth = yaxis->GetBinWidth(1);
2212 Double_t xOffset = 1.*numx/100*xBinWidth;
2213 Double_t yOffset = 1.*numy/100*yBinWidth;
2214 if (fDelaydraw->GetState()==kButtonUp){
2215 Double_t oldXOffset = fXOffsetNumberEntry->GetNumber();
2216 Double_t oldYOffset = fYOffsetNumberEntry->GetNumber();
2217 Int_t nx = xaxis->GetNbins();
2218 Int_t ny = yaxis->GetNbins();
2219
2221 if (!player) return;
2222
2223 Int_t firstx = xaxis->GetFirst();
2224 Int_t lastx = xaxis->GetLast();
2225 Int_t firsty = yaxis->GetFirst();
2226 Int_t lasty = yaxis->GetLast();
2227 Double_t minx = xaxis->GetBinLowEdge(1); // overall min in user coords
2228 Double_t maxx = xaxis->GetBinUpEdge(nx); // overall max in user coords
2229 Double_t miny = yaxis->GetBinLowEdge(1); // overall min in user coords
2230 Double_t maxy = yaxis->GetBinUpEdge(ny); // overall max in user coords
2231 Double_t rminx = xaxis->GetBinLowEdge(firstx); // recent min in user coords
2232 Double_t rmaxx = xaxis->GetBinUpEdge(lastx); // recent max in user coords
2233 Double_t rminy = yaxis->GetBinLowEdge(firsty); // recent min in user coords
2234 Double_t rmaxy = yaxis->GetBinUpEdge(lasty); // recent max in user coords
2235
2236 ((TH2*)player->GetHistogram())->SetCanExtend(TH1::kNoAxis);
2237 ((TH2*)player->GetHistogram())->Reset();
2238
2239 ((TH2*)player->GetHistogram())->SetBins(nx,minx-oldXOffset+xOffset,
2240 maxx-oldXOffset+xOffset,
2241 ny, miny-oldYOffset+yOffset,
2242 maxy-oldYOffset+yOffset);
2243 TSelectorDraw *sel = (TSelectorDraw*)player->GetSelector();
2244 if (!sel) return;
2245 sel->TakeAction();
2246
2247 // Restore all the attributes which were changed by TakeAction()
2249
2250 // SetRange in BinNumbers along x and y!
2251 xaxis->SetRange(xaxis->FindBin(rminx+xOffset-oldXOffset+xBinWidth/2),
2252 xaxis->FindBin(rmaxx+xOffset-oldXOffset-xBinWidth/2));
2253 yaxis->SetRange(yaxis->FindBin(rminy+yOffset-oldYOffset+yBinWidth/2),
2254 yaxis->FindBin(rmaxy+yOffset-oldYOffset-yBinWidth/2));
2255 fSldXMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
2256 fSldXMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
2257 fSldYMin->SetNumber(yaxis->GetBinLowEdge(yaxis->GetFirst()));
2258 fSldYMax->SetNumber(yaxis->GetBinUpEdge(yaxis->GetLast()));
2261 Update();
2262 }
2267}
2268
2269////////////////////////////////////////////////////////////////////////////////
2270/// Slot connected to the OffSetNumberEntry, related to the OffSetSlider
2271/// changes the origin of the histogram inbetween a binwidth.
2272
2274{
2275 if (fAvoidSignal) return;
2276 TAxis* xaxis = fHist->GetXaxis();
2277 TAxis* yaxis = fHist->GetYaxis();
2278 Double_t xBinWidth = xaxis->GetBinWidth(1);
2279 Double_t yBinWidth = yaxis->GetBinWidth(1);
2281 Double_t oldXOffset = 1.*fXBinOffsetSld->GetPosition()/100*xBinWidth;
2283 Double_t oldYOffset = 1.*fYBinOffsetSld->GetPosition()/100*yBinWidth;
2284 Int_t nx = xaxis->GetNbins();
2285 Int_t ny = yaxis->GetNbins();
2287 if (!player) return;
2288 Int_t firstx = xaxis->GetFirst();
2289 Int_t lastx = xaxis->GetLast();
2290 Int_t firsty = yaxis->GetFirst();
2291 Int_t lasty = yaxis->GetLast();
2292 Double_t minx = xaxis->GetBinLowEdge(1); // overall min in user coords
2293 Double_t maxx = xaxis->GetBinUpEdge(nx); // overall max in user coords
2294 Double_t miny = yaxis->GetBinLowEdge(1); // overall min in user coords
2295 Double_t maxy = yaxis->GetBinUpEdge(ny); // overall max in user coords
2296 Double_t rminx = xaxis->GetBinLowEdge(firstx); // recent min in user coords
2297 Double_t rmaxx = xaxis->GetBinUpEdge(lastx); // recent max in user coords
2298 Double_t rminy = yaxis->GetBinLowEdge(firsty); // recent min in user coords
2299 Double_t rmaxy = yaxis->GetBinUpEdge(lasty); // recent max in user coords
2300
2301 ((TH2*)player->GetHistogram())->SetCanExtend(TH1::kNoAxis);
2302 ((TH2*)player->GetHistogram())->Reset();
2303
2304 ((TH2*)player->GetHistogram())->SetBins(nx,minx+xOffset-oldXOffset,
2305 maxx+xOffset-oldXOffset,
2306 ny,miny+yOffset-oldYOffset,
2307 maxy+yOffset-oldYOffset);
2308 TSelectorDraw *sel = (TSelectorDraw*)player->GetSelector();
2309 if (!sel) return;
2310 sel->TakeAction();
2311
2312 // Restore all the attributes which were changed by TakeAction()
2314
2315 // SetRange in BinNumbers along x and y!
2316 xaxis->SetRange(xaxis->FindBin(rminx+xOffset-oldXOffset+xBinWidth/2),
2317 xaxis->FindBin(rmaxx+xOffset-oldXOffset-xBinWidth/2));
2318 yaxis->SetRange(yaxis->FindBin(rminy+yOffset-oldYOffset+yBinWidth/2),
2319 yaxis->FindBin(rmaxy+yOffset-oldYOffset-yBinWidth/2));
2320 fSldXMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
2321 fSldXMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
2322 fXBinOffsetSld->SetPosition((Int_t)(xOffset/xBinWidth*100));
2323 fSldYMin->SetNumber(yaxis->GetBinLowEdge(yaxis->GetFirst()));
2324 fSldYMax->SetNumber(yaxis->GetBinUpEdge(yaxis->GetLast()));
2325 fYBinOffsetSld->SetPosition((Int_t)(yOffset/yBinWidth*100));
2326 Update();
2327}
2328
2329////////////////////////////////////////////////////////////////////////////////
2330/// Slot connected to the x-Slider that redraws the histogram
2331/// with the new slider range.
2332
2334{
2335 if (fAvoidSignal) return;
2336 TAxis* xaxis = fHist->GetXaxis();
2338 // 2D plot
2339 Int_t px1,py1,px2,py2;
2340 Float_t ymin,ymax,xleft,xright;
2341 xleft = xaxis->GetBinLowEdge((Int_t)((fSliderX->GetMinPosition())+0.5));
2342 xright = xaxis->GetBinUpEdge((Int_t)((fSliderX->GetMaxPosition())+0.5));
2345 px1 = fGedEditor->GetPad()->XtoAbsPixel(xleft);
2346 py1 = fGedEditor->GetPad()->YtoAbsPixel(ymin);
2347 px2 = fGedEditor->GetPad()->XtoAbsPixel(xright);
2348 py2 = fGedEditor->GetPad()->YtoAbsPixel(ymax);
2349 if (fGedEditor->GetPad()->GetCanvas())
2351 fGedEditor->GetPad()->cd();
2355 gVirtualX->DrawBox(px1, py1, px2, py2, TVirtualX::kHollow);
2356 fPx1old = px1;
2357 fPy1old = py1;
2358 fPx2old = px2 ;
2359 fPy2old = py2;
2360 gVirtualX->Update(0);
2361 fSldXMin->SetNumber(xleft);
2362 fSldXMax->SetNumber(xright);
2363 } else if (fDelaydraw->GetState()==kButtonDown &&
2366 // 3D plot
2367 Float_t p1[3], p2[3], p3[3], p4[3], p5[3], p6[3], p7[3], p8[3];
2368 if (fGedEditor->GetPad()->GetCanvas())
2370 fGedEditor->GetPad()->cd();
2371 TView *fView = fGedEditor->GetPad()->GetView();
2372 if (!fView) return;
2373 Double_t *rmin = fView->GetRmin();
2374 if (!rmin) return;
2375 Double_t *rmax = fView->GetRmax();
2376 if (!rmax) return;
2377 p1[0] = p4[0] = p5[0] = p8[0] =
2378 xaxis->GetBinLowEdge((Int_t)((fSliderX->GetMinPosition())+0.5));
2379 p2[0] = p3[0] = p6[0] = p7[0] =
2380 xaxis->GetBinUpEdge((Int_t)((fSliderX->GetMaxPosition())+0.5));
2381 p1[1] = p2[1] = p3[1] = p4[1] = rmin[1];
2382 p5[1] = p6[1] = p7[1] = p8[1] = rmax[1];
2383 p1[2] = p2[2] = p5[2] = p6[2] = rmin[2];
2384 p3[2] = p4[2] = p7[2] = p8[2] = rmax[2];
2389 PaintBox3D(p2, p3, p7, p6);
2390 PaintBox3D(p1, p4, p8, p5);
2391 for (Int_t i = 0; i<3; i++){
2392 fP1oldx[i] = p1[i];
2393 fP2oldx[i] = p2[i];
2394 fP3oldx[i] = p3[i];
2395 fP4oldx[i] = p4[i];
2396 fP5oldx[i] = p5[i];
2397 fP6oldx[i] = p6[i];
2398 fP7oldx[i] = p7[i];
2399 fP8oldx[i] = p8[i];
2400 }
2401 fSldXMin->SetNumber(p1[0]);
2402 fSldXMax->SetNumber(p2[0]);
2403 } else if (fDelaydraw->GetState()==kButtonDown &&
2407 } else {
2409 (Int_t)((fSliderX->GetMaxPosition())+0.5));
2410 fSldXMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
2411 fSldXMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
2413 Update();
2414 }
2417}
2418
2419////////////////////////////////////////////////////////////////////////////////
2420/// Slot connected to the x axis range slider that initialises
2421/// the "virtual" box which is drawn in delay draw mode.
2422
2424{
2425 if (fAvoidSignal) return;
2426 TAxis* xaxis = fHist->GetXaxis();
2427 Float_t ymin,ymax,xleft,xright;
2429 // 2D Plot
2430 if (!fGedEditor->GetPad()) return;
2431 fGedEditor->GetPad()->cd();
2432 if (fGedEditor->GetPad()->GetCanvas())
2436 xleft = xaxis->GetBinLowEdge((Int_t)((fSliderX->GetMinPosition())+0.5));
2437 xright = xaxis->GetBinUpEdge((Int_t)((fSliderX->GetMaxPosition())+0.5));
2440 fPx1old = fGedEditor->GetPad()->XtoAbsPixel(xleft);
2442 fPx2old = fGedEditor->GetPad()->XtoAbsPixel(xright);
2445 } else if (fDelaydraw->GetState()==kButtonDown &&
2448 // 3D plot
2449 if (!fGedEditor->GetPad()) return;
2450 fGedEditor->GetPad()->cd();
2451 TView *fView = fGedEditor->GetPad()->GetView();
2452 if (!fView) return;
2453 Double_t *rmin = fView->GetRmin();
2454 if (!rmin) return;
2455 Double_t *rmax = fView->GetRmax();
2456 if (!rmax) return;
2457 fP1oldx[0] = fP4oldx[0] = fP5oldx[0] = fP8oldx[0] =
2458 xaxis->GetBinLowEdge((Int_t)((fSliderX->GetMinPosition())+0.5));
2459 fP2oldx[0] = fP3oldx[0] = fP6oldx[0] = fP7oldx[0] =
2460 xaxis->GetBinUpEdge((Int_t)((fSliderX->GetMaxPosition())+0.5));
2461 fP1oldx[1] = fP2oldx[1] = fP3oldx[1] = fP4oldx[1] = rmin[1];
2462 fP5oldx[1] = fP6oldx[1] = fP7oldx[1] = fP8oldx[1] = rmax[1];
2463 fP1oldx[2] = fP2oldx[2] = fP5oldx[2] = fP6oldx[2] = rmin[2];
2464 fP3oldx[2] = fP4oldx[2] = fP7oldx[2] = fP8oldx[2] = rmax[2];
2465 if (fGedEditor->GetPad()->GetCanvas())
2471 }
2472}
2473
2474////////////////////////////////////////////////////////////////////////////////
2475/// Slot connected to the x-axis slider finalizing values after
2476/// the slider movement.
2477
2479{
2480 if (fAvoidSignal) return;
2483 (Int_t)((fSliderX->GetMaxPosition())+0.5));
2486 Update();
2487 }
2489 if (player) if (player->GetHistogram() == fHist) {
2490 Int_t last = fHist->GetXaxis()->GetLast();
2493 Update();
2494 }
2495}
2496
2497////////////////////////////////////////////////////////////////////////////////
2498/// Slot connected to the Max/Min number entry fields showing x-axis range.
2499
2501{
2502 TAxis* xaxis = fHist->GetXaxis();
2503 Int_t nx = xaxis->GetNbins();
2504 Double_t width = xaxis->GetBinWidth(1);
2505 if ((fSldXMin->GetNumber()+width/2) < (xaxis->GetBinLowEdge(1)))
2506 fSldXMin->SetNumber(xaxis->GetBinLowEdge(1));
2507 if ((fSldXMax->GetNumber()-width/2) > (xaxis->GetBinUpEdge(nx)))
2508 fSldXMax->SetNumber(xaxis->GetBinUpEdge(nx));
2510 fSldXMax->GetNumber()-width/2);
2511 Int_t nxbinmin = xaxis->GetFirst();
2512 Int_t nxbinmax = xaxis->GetLast();
2513 fSliderX->SetPosition((Double_t)(nxbinmin),(Double_t)(nxbinmax));
2514 Update();
2515}
2516
2517////////////////////////////////////////////////////////////////////////////////
2518/// Slot connected to the x-slider for redrawing the
2519/// histogram with the new slider Range (immediately).
2520
2522{
2523 if (fAvoidSignal) return;
2524 TAxis* yaxis = fHist->GetYaxis();
2526 Int_t px1,py1,px2,py2;
2527 Float_t xmin,xmax,ybottom,ytop;
2528 ybottom = yaxis->GetBinLowEdge((Int_t)((fSliderY->GetMinPosition())+0.5));
2529 ytop = yaxis->GetBinUpEdge((Int_t)((fSliderY->GetMaxPosition())+0.5));
2532 px1 = fGedEditor->GetPad()->XtoAbsPixel(xmin);
2533 py1 = fGedEditor->GetPad()->YtoAbsPixel(ybottom);
2534 px2 = fGedEditor->GetPad()->XtoAbsPixel(xmax);
2535 py2 = fGedEditor->GetPad()->YtoAbsPixel(ytop);
2536 if (fGedEditor->GetPad()->GetCanvas())
2538 fGedEditor->GetPad()->cd();
2542 gVirtualX->DrawBox(px1, py1, px2, py2, TVirtualX::kHollow);
2543 fPx1old = px1;
2544 fPy1old = py1;
2545 fPx2old = px2 ;
2546 fPy2old = py2;
2547 gVirtualX->Update(0);
2548 fSldYMin->SetNumber(ybottom);
2549 fSldYMax->SetNumber(ytop);
2550 } else if (fDelaydraw->GetState()==kButtonDown &&
2553 // 3D plot
2554 Float_t p1[3], p2[3], p3[3], p4[3], p5[3], p6[3], p7[3], p8[3];
2555 if (fGedEditor->GetPad()->GetCanvas())
2557 fGedEditor->GetPad()->cd();
2558 TView *fView = fGedEditor->GetPad()->GetView();
2559 if (!fView) return;
2560 Double_t *rmin = fView->GetRmin();
2561 if (!rmin) return;
2562 Double_t *rmax = fView->GetRmax();
2563 if (!rmax) return;
2564 p1[0] = p2[0] = p3[0] = p4[0] = rmin[0];
2565 p5[0] = p6[0] = p7[0] = p8[0] = rmax[0];
2566 p1[1] = p4[1] = p5[1] = p8[1] =
2567 yaxis->GetBinLowEdge((Int_t)((fSliderY->GetMinPosition())+0.5));
2568 p2[1] = p3[1] = p6[1] = p7[1] =
2569 yaxis->GetBinUpEdge((Int_t)((fSliderY->GetMaxPosition())+0.5));
2570 p1[2] = p2[2] = p5[2] = p6[2] = rmin[2];
2571 p3[2] = p4[2] = p7[2] = p8[2] = rmax[2];
2576 PaintBox3D(p2, p3, p7, p6);
2577 PaintBox3D(p1, p4, p8, p5);
2578 for (Int_t i = 0; i<3; i++) {
2579 fP1oldy[i] = p1[i];
2580 fP2oldy[i] = p2[i];
2581 fP3oldy[i] = p3[i];
2582 fP4oldy[i] = p4[i];
2583 fP5oldy[i] = p5[i];
2584 fP6oldy[i] = p6[i];
2585 fP7oldy[i] = p7[i];
2586 fP8oldy[i] = p8[i];
2587 }
2588 fSldYMin->SetNumber(p1[1]);
2589 fSldYMax->SetNumber(p2[1]);
2590 } else if (fDelaydraw->GetState()==kButtonDown &&
2594 } else {
2595 yaxis->SetRange((Int_t)((fSliderY->GetMinPosition())+0.5),
2596 (Int_t)((fSliderY->GetMaxPosition())+0.5));
2597 fSldYMin->SetNumber(yaxis->GetBinLowEdge(yaxis->GetFirst()));
2598 fSldYMax->SetNumber(yaxis->GetBinUpEdge(yaxis->GetLast()));
2600 Update();
2601 }
2604}
2605
2606////////////////////////////////////////////////////////////////////////////////
2607/// Slot connected to y-axis slider which initialises
2608/// the "virtual" box which is drawn in delay draw mode.
2609
2611{
2612 if (fAvoidSignal) return;
2613 TAxis* yaxis = fHist->GetYaxis();
2614 Float_t xmin,xmax,ytop,ybottom;
2616 // 2D plot:
2617 if (!fGedEditor->GetPad()) return;
2618 fGedEditor->GetPad()->cd();
2619 if (fGedEditor->GetPad()->GetCanvas())
2623 ybottom = yaxis->GetBinLowEdge((Int_t)((fSliderY->GetMinPosition())+0.5));
2624 ytop = yaxis->GetBinUpEdge((Int_t)((fSliderY->GetMaxPosition())+0.5));
2628 fPy1old = fGedEditor->GetPad()->YtoAbsPixel(ybottom);
2632 } else if (fDelaydraw->GetState()==kButtonDown &&
2635 // 3D plot
2636 if (!fGedEditor->GetPad()) return;
2637 fGedEditor->GetPad()->cd();
2638 TView *fView = fGedEditor->GetPad()->GetView();
2639 if (!fView) return;
2640 Double_t *rmin = fView->GetRmin();
2641 if (!rmin) return;
2642 Double_t *rmax = fView->GetRmax();
2643 if (!rmax) return;
2644 fP1oldy[0] = fP2oldy[0] = fP3oldy[0] = fP4oldy[0] = rmin[0];
2645 fP5oldy[0] = fP6oldy[0] = fP7oldy[0] = fP8oldy[0] = rmax[0];
2646 fP1oldy[1] = fP4oldy[1] = fP5oldy[1] = fP8oldy[1] =
2647 yaxis->GetBinLowEdge((Int_t)((fSliderY->GetMinPosition())+0.5));
2648 fP2oldy[1] = fP3oldy[1] = fP6oldy[1] = fP7oldy[1] =
2649 yaxis->GetBinUpEdge((Int_t)((fSliderY->GetMaxPosition())+0.5));
2650 fP1oldy[2] = fP2oldy[2] = fP5oldy[2] = fP6oldy[2] = rmin[2];
2651 fP3oldy[2] = fP4oldy[2] = fP7oldy[2] = fP8oldy[2] = rmax[2];
2652 if (fGedEditor->GetPad()->GetCanvas())
2658 }
2659}
2660
2661////////////////////////////////////////////////////////////////////////////////
2662/// Slot connected to the y-axis slider finalizing values after
2663/// the slider movement.
2664
2666{
2667 if (fAvoidSignal) return;
2670 (Int_t)((fSliderY->GetMaxPosition())+0.5));
2673 Update();
2674 }
2675
2677 if (player) if (player->GetHistogram() == fHist) {
2678 Int_t last = fHist->GetYaxis()->GetLast();
2681 Update();
2682 }
2683}
2684
2685////////////////////////////////////////////////////////////////////////////////
2686/// Slot connected to the Max/Min number entry fields showing y-axis range.
2687
2689{
2690 if (fAvoidSignal) return;
2691 TAxis* yaxis = fHist->GetYaxis();
2692 Int_t ny = yaxis->GetNbins();
2693 Double_t width = yaxis->GetBinWidth(1);
2694
2695 if ((fSldYMin->GetNumber()+width/2) < (yaxis->GetBinLowEdge(1)))
2696 fSldYMin->SetNumber(yaxis->GetBinLowEdge(1));
2697 if ((fSldYMax->GetNumber()-width/2) > (yaxis->GetBinUpEdge(ny)))
2698 fSldYMax->SetNumber(yaxis->GetBinUpEdge(ny));
2699
2701 fSldYMax->GetNumber()-width/2);
2702 Int_t nybinmin = yaxis -> GetFirst();
2703 Int_t nybinmax = yaxis -> GetLast();
2704 fSliderY->SetPosition((Double_t)(nybinmin),(Double_t)(nybinmax));
2705 Update();
2706}
2707
2708////////////////////////////////////////////////////////////////////////////////
2709/// Slot connected to the fill area color.
2710
2712{
2713 if (fAvoidSignal || !fGedEditor->GetPad()) return;
2714 fGedEditor->GetPad()->cd();
2716 Update();
2717}
2718
2719////////////////////////////////////////////////////////////////////////////////
2720/// Slot connected to the fill area pattern.
2721
2723{
2724 if (fAvoidSignal || !fGedEditor->GetPad()) return;
2725 fGedEditor->GetPad()->cd();
2727 Update();
2728}
2729
2730////////////////////////////////////////////////////////////////////////////////
2731/// Return the immediate histogram type (HIST, LEGO1-4, SURF1-5).
2732
2734{
2735 TString s="";
2736 switch (fTypeCombo->GetSelected()){
2737 case (-1) : {s = ""; break;}
2738 case (kTYPE_LEGO ): {s = "LEGO"; break;}
2739 case (kTYPE_LEGO1): {s = "LEGO1"; break;}
2740 case (kTYPE_LEGO2): {s = "LEGO2"; break;}
2741 case (kTYPE_LEGO3): {s = "LEGO3"; break;}
2742 case (kTYPE_LEGO4): {s = "LEGO4"; break;}
2743 case (kTYPE_SURF ): {s = "SURF"; break;}
2744 case (kTYPE_SURF1): {s = "SURF1"; break;}
2745 case (kTYPE_SURF2): {s = "SURF2"; break;}
2746 case (kTYPE_SURF3): {s = "SURF3"; break;}
2747 case (kTYPE_SURF4): {s = "SURF4"; break;}
2748 case (kTYPE_SURF5): {s = "SURF5"; break;}
2749 default: break;
2750 }
2751 return s;
2752}
2753
2754////////////////////////////////////////////////////////////////////////////////
2755/// Return the immediate coordinate system of the histogram.
2756/// (POL, CYL, SPH,PSR)
2757
2759{
2760 TString s="";
2761 switch (fCoordsCombo->GetSelected()){
2762 case (-1) : {s = ""; break;}
2763 case (kCOORDS_CAR): {s = ""; break;}
2764 case (kCOORDS_POL): {s = "POL"; break;}
2765 case (kCOORDS_CYL): {s = "CYL"; break;}
2766 case (kCOORDS_SPH): {s = "SPH"; break;}
2767 case (kCOORDS_PSR): {s = "PSR"; break;}
2768 default: break;
2769 }
2770 return s;
2771}
2772
2773////////////////////////////////////////////////////////////////////////////////
2774/// Returns histogram contour option (None,Cont0..5).
2775
2777{
2778 TString s="";
2779 switch (fContCombo->GetSelected()){
2780 case (-1) : {s = ""; break;}
2781 case (kCONT_NONE) : {s = ""; break;}
2782 case (kCONT_0) : {s = "CONT0"; break;}
2783 case (kCONT_1) : {s = "CONT1"; break;}
2784 case (kCONT_2) : {s = "CONT2"; break;}
2785 case (kCONT_3) : {s = "CONT3"; break;}
2786 case (kCONT_4) : {s = "CONT4"; break;}
2787 default: break;
2788 }
2789 return s;
2790}
2791
2792////////////////////////////////////////////////////////////////////////////////
2793/// Return histogram additive options (Arr,Box,Col,Scat,Col,Text,E,Z,FB,BB).
2794
2796{
2797 TString s="";
2798 if (fDim->GetState()==kButtonDown) {
2799 if (fAddArr->GetState()==kButtonDown) s+="ARR";
2800 if (fAddBox->GetState()==kButtonDown) s+="BOX";
2801 if (fAddCol->GetState()==kButtonDown) s+="COL";
2802 if (fAddScat->GetState()==kButtonDown) s+="SCAT";
2803 if (fAddText->GetState()==kButtonDown) s+="TEXT";
2804 if (fAddPalette->GetState()==kButtonDown) s+="Z";
2805 } else if (fDim0->GetState()==kButtonDown){
2806 if (fAddPalette1->GetState()==kButtonDown) s+="Z";
2807 if (fAddError->GetState()==kButtonDown) s+="E";
2808 if (fAddFB->GetState()==kButtonUp) s+="FB";
2809 if (fAddBB->GetState()==kButtonUp) s+="BB";
2810 }
2811 return s;
2812}
2813
2814////////////////////////////////////////////////////////////////////////////////
2815/// Return draw option string related to graphical cut in use.
2816
2818{
2819 TString cutopt = " ";
2820 TString opt = GetDrawOption();
2821 Int_t scut = opt.First('[');
2822 if (scut != -1) {
2823 Int_t ecut = opt.First(']');
2824 cutopt += opt(scut,ecut);
2825 }
2826 return cutopt;
2827}
2828
2829////////////////////////////////////////////////////////////////////////////////
2830/// Create histogram type combo box.
2831
2833{
2834 TGComboBox *c = new TGComboBox(parent, id);
2835
2836 c->AddEntry("Lego" , kTYPE_LEGO);
2837 c->AddEntry("Lego1", kTYPE_LEGO1);
2838 c->AddEntry("Lego2", kTYPE_LEGO2);
2839 c->AddEntry("Lego3", kTYPE_LEGO3);
2840 c->AddEntry("Lego4", kTYPE_LEGO4);
2841 c->AddEntry("Surf" , kTYPE_SURF);
2842 c->AddEntry("Surf1", kTYPE_SURF1);
2843 c->AddEntry("Surf2", kTYPE_SURF2);
2844 c->AddEntry("Surf3", kTYPE_SURF3);
2845 c->AddEntry("Surf4", kTYPE_SURF4);
2846 c->AddEntry("Surf5", kTYPE_SURF5);
2847
2848 return c;
2849}
2850
2851////////////////////////////////////////////////////////////////////////////////
2852/// Create coordinate system combo box.
2853
2855{
2856 TGComboBox *c = new TGComboBox(parent, id);
2857
2858 c->AddEntry("Cartesian", kCOORDS_CAR);
2859 c->AddEntry("Cylindric", kCOORDS_CYL);
2860 c->AddEntry("Polar", kCOORDS_POL);
2861 c->AddEntry("Rapidity", kCOORDS_PSR);
2862 c->AddEntry("Spheric", kCOORDS_SPH);
2863 TGListBox* lb = c->GetListBox();
2864 lb->Resize(lb->GetWidth(), 83);
2865
2866 return c;
2867}
2868
2869////////////////////////////////////////////////////////////////////////////////
2870/// Create contour combo box.
2871
2873{
2874 TGComboBox *c = new TGComboBox(parent, id);
2875
2876 c->AddEntry("None" , kCONT_NONE);
2877 c->AddEntry("Cont0", kCONT_0);
2878 c->AddEntry("Cont1", kCONT_1);
2879 c->AddEntry("Cont2", kCONT_2);
2880 c->AddEntry("Cont3", kCONT_3);
2881 c->AddEntry("Cont4", kCONT_4);
2882
2883 return c;
2884}
2885
2886////////////////////////////////////////////////////////////////////////////////
2887/// Paint a square in 3D.
2888
2890{
2891 fGedEditor->GetPad()->PaintLine3D(p1, p2);
2892 fGedEditor->GetPad()->PaintLine3D(p2, p3);
2893 fGedEditor->GetPad()->PaintLine3D(p3, p4);
2894 fGedEditor->GetPad()->PaintLine3D(p4, p1);
2895}
2896////////////////////////////////////////////////////////////////////////////////
2897/// Give an array of dividers of n (without the trivial divider n))
2898/// in the first entry the number of dividers is saved.
2899
2901{
2902 Int_t* div;
2903 if (n <= 0) {
2904 div = new Int_t[1];
2905 div[0]=0;
2906 } else if (n == 1) {
2907 div = new Int_t[2];
2908 div[0]=div[1]=1;
2909 } else {
2910 div = new Int_t[(Int_t) n/2+2];
2911 div[0]=0;
2912 div[1]=1;
2913
2914 Int_t num = 1;
2915 for (Int_t i=2; i <= n/2; i++) {
2916 if (n % i == 0) {
2917 num++;
2918 div[num] = i;
2919 }
2920 }
2921 num++;
2922 div[num]=n;
2923 div[0] = num;
2924 }
2925 return div;
2926}
2927
2928////////////////////////////////////////////////////////////////////////////////
2929/// Skip TH1Editor in building list of editors.
2930
2932{
2933 fGedEditor->ActivateEditors(TH1::Class()->GetListOfBases(), kTRUE);
2934}
2935
2936////////////////////////////////////////////////////////////////////////////////
2937/// If the contained histogram obj is deleted we must set its pointer to zero
2938
2940{
2941 if (obj == fHist) {
2942 fHist = 0;
2943 }
2944}
2945
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:374
@ kPointer
Definition: GuiTypes.h:374
ULong_t Pixel_t
Definition: GuiTypes.h:39
#define d(i)
Definition: RSha256.hxx:102
#define c(i)
Definition: RSha256.hxx:101
int Int_t
Definition: RtypesCore.h:43
const Bool_t kFALSE
Definition: RtypesCore.h:90
double Double_t
Definition: RtypesCore.h:57
short Style_t
Definition: RtypesCore.h:78
float Float_t
Definition: RtypesCore.h:55
const Bool_t kTRUE
Definition: RtypesCore.h:89
#define ClassImp(name)
Definition: Rtypes.h:361
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:33
@ kLHintsLeft
Definition: TGLayout.h:31
@ kLHintsCenterY
Definition: TGLayout.h:35
@ kLHintsNormal
Definition: TGLayout.h:39
@ kLHintsTop
Definition: TGLayout.h:34
@ kLHintsExpandX
Definition: TGLayout.h:37
@ kMBNo
Definition: TGMsgBox.h:43
@ kMBYes
Definition: TGMsgBox.h:42
@ kMBOk
Definition: TGMsgBox.h:44
@ kMBIconExclamation
Definition: TGMsgBox.h:35
@ kMBIconQuestion
Definition: TGMsgBox.h:34
@ kScaleBoth
Definition: TGSlider.h:62
@ kSlider1
Definition: TGSlider.h:56
ETH2Wid
Definition: TH2Editor.cxx:155
@ kTYPE_SURF2
Definition: TH2Editor.cxx:159
@ kSLIDERX_MAX
Definition: TH2Editor.cxx:167
@ kBINYSLIDER
Definition: TH2Editor.cxx:169
@ kSLIDERX_MIN
Definition: TH2Editor.cxx:167
@ kTYPE_SURF5
Definition: TH2Editor.cxx:159
@ kBACKBOX_ONOFF
Definition: TH2Editor.cxx:163
@ kCONT_1
Definition: TH2Editor.cxx:165
@ kERROR_ONOFF
Definition: TH2Editor.cxx:161
@ kCOORDS_PSR
Definition: TH2Editor.cxx:160
@ kYBINOFFSET
Definition: TH2Editor.cxx:170
@ kPALETTE_ONOFF1
Definition: TH2Editor.cxx:161
@ kTYPE_SURF
Definition: TH2Editor.cxx:159
@ kTYPE_LEGO
Definition: TH2Editor.cxx:158
@ kTYPE_SURF3
Definition: TH2Editor.cxx:159
@ kTYPE_LEGO3
Definition: TH2Editor.cxx:158
@ kCONT_4
Definition: TH2Editor.cxx:165
@ kTYPE_LEGO2
Definition: TH2Editor.cxx:158
@ kCONT_TYPE
Definition: TH2Editor.cxx:161
@ kARROW_ONOFF
Definition: TH2Editor.cxx:162
@ kPATTERN
Definition: TH2Editor.cxx:168
@ kTYPE_SURF1
Definition: TH2Editor.cxx:159
@ kCOORDS_CAR
Definition: TH2Editor.cxx:160
@ kCONT_LEVELS1
Definition: TH2Editor.cxx:166
@ kTYPE_LEGO4
Definition: TH2Editor.cxx:158
@ kCONT_2
Definition: TH2Editor.cxx:165
@ kSLIDERY_MAX
Definition: TH2Editor.cxx:167
@ kDIM_COMPLEX
Definition: TH2Editor.cxx:157
@ kPALETTE_ONOFF
Definition: TH2Editor.cxx:161
@ kCOORDS_POL
Definition: TH2Editor.cxx:160
@ kTYPE_SURF4
Definition: TH2Editor.cxx:159
@ kCOORD_TYPE
Definition: TH2Editor.cxx:160
@ kCONT_0
Definition: TH2Editor.cxx:165
@ kBINXSLIDER1
Definition: TH2Editor.cxx:169
@ kBAR_OFFSET
Definition: TH2Editor.cxx:164
@ kCONT_NONE
Definition: TH2Editor.cxx:165
@ kBOX_ONOFF
Definition: TH2Editor.cxx:162
@ kSLIDERY_MIN
Definition: TH2Editor.cxx:167
@ kBINXSLIDER
Definition: TH2Editor.cxx:169
@ kCOORDS_SPH
Definition: TH2Editor.cxx:160
@ kCONT_LEVELS
Definition: TH2Editor.cxx:166
@ kCOLOR
Definition: TH2Editor.cxx:168
@ kCOORDS_CYL
Definition: TH2Editor.cxx:160
@ kDELAYED_DRAWING
Definition: TH2Editor.cxx:168
@ kBINYSLIDER1
Definition: TH2Editor.cxx:169
@ kCOL_ONOFF
Definition: TH2Editor.cxx:162
@ kFRONTBOX_ONOFF
Definition: TH2Editor.cxx:163
@ kSCAT_ONOFF
Definition: TH2Editor.cxx:162
@ kTEXT_ONOFF
Definition: TH2Editor.cxx:162
@ kXBINOFFSET
Definition: TH2Editor.cxx:170
@ kTYPE_LEGO1
Definition: TH2Editor.cxx:158
@ kTH2_TITLE
Definition: TH2Editor.cxx:156
@ kHIST_TYPE
Definition: TH2Editor.cxx:157
@ kDIM_SIMPLE
Definition: TH2Editor.cxx:157
@ kCONT_3
Definition: TH2Editor.cxx:165
@ kBAR_WIDTH
Definition: TH2Editor.cxx:164
float xmin
Definition: THbookFile.cxx:93
float ymin
Definition: THbookFile.cxx:93
float xmax
Definition: THbookFile.cxx:93
float ymax
Definition: THbookFile.cxx:93
#define gROOT
Definition: TROOT.h:406
#define gPad
Definition: TVirtualPad.h:287
#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:290
virtual Double_t GetBinLowEdge(Int_t bin) const
Return low edge of bin.
Definition: TAxis.cxx:515
Int_t GetLast() const
Return last bin on the axis i.e.
Definition: TAxis.cxx:466
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).
Definition: TAxis.cxx:939
virtual void SetRange(Int_t first=0, Int_t last=0)
Set the viewing range for the axis from bin first to last.
Definition: TAxis.cxx:914
virtual Double_t GetBinWidth(Int_t bin) const
Return bin width.
Definition: TAxis.cxx:537
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
Definition: TAxis.cxx:525
Int_t GetFirst() const
Return first bin on the axis i.e.
Definition: TAxis.cxx:455
virtual void Selected(TVirtualPad *pad, TObject *obj, Int_t event)
Emit Selected() signal.
Definition: TCanvas.cxx:1609
void FeedbackMode(Bool_t set)
Turn rubberband feedback mode on or off.
Definition: TCanvas.cxx:1113
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:2016
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:1769
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:397
virtual EButtonState GetState() const
Definition: TGButton.h:112
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set button state.
Definition: TGButton.cxx:187
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set check button state.
Definition: TGButton.cxx:1202
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
void SetColor(Pixel_t color, Bool_t emit=kTRUE)
Set color.
virtual Int_t GetSelected() const
Definition: TGComboBox.h:134
virtual void Select(Int_t id, Bool_t emit=kTRUE)
Make the selected item visible in the combo box window and emit signals according to the second param...
Definition: TGComboBox.cxx:451
TGCompositeFrame(const TGCompositeFrame &)
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1101
virtual void Layout()
Layout the elements of the composite frame.
Definition: TGFrame.cxx:1241
virtual void ChangeOptions(UInt_t options)
Change composite frame options. Options is an OR of the EFrameTypes.
Definition: TGFrame.cxx:1027
virtual void ShowFrame(TGFrame *f)
Show sub frame.
Definition: TGFrame.cxx:1188
virtual void HideFrame(TGFrame *f)
Hide sub frame.
Definition: TGFrame.cxx:1174
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)
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:216
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:589
Bool_t Contains(Int_t x, Int_t y) const
Definition: TGFrame.h:263
UInt_t GetWidth() const
Definition: TGFrame.h:249
virtual void Resize(UInt_t w, UInt_t h)
Resize the frame.
Definition: TGSlider.h:173
virtual void Disable(Bool_t on=kTRUE)
Definition: TGLabel.h:97
virtual void Enable()
Definition: TGLabel.h:99
virtual void Resize(UInt_t w, UInt_t h)
Resize the listbox widget.
Definition: TGListBox.cxx:1420
virtual Double_t GetNumber() const
Get the numeric value (floating point representation).
virtual void SetLimits(ELimit limits=kNELNoLimits, Double_t min=0, Double_t max=1)
Set the numerical limits.
virtual void SetIntNumber(Long_t val)
Set the numeric value (integer representation).
virtual void SetNumber(Double_t val)
Set the numeric value (floating point representation).
virtual void SetNumber(Double_t val)
virtual void SetIntNumber(Long_t val)
TGNumberEntryField * GetNumberEntry() const
virtual Double_t GetNumber() const
TGClient * fClient
Definition: TGObject.h:37
Handle_t GetId() const
Definition: TGObject.h:47
virtual Int_t GetMaxPosition() const
Definition: TGSlider.h:111
virtual Int_t GetPosition() const
Definition: TGSlider.h:109
virtual void SetPosition(Int_t pos)
Definition: TGSlider.h:105
virtual void SetRange(Int_t min, Int_t max)
Definition: TGSlider.h:101
virtual void SetScale(Int_t scale)
Definition: TGSlider.h:100
Bool_t IsEnabled(Int_t tabIndex) const
Returns true if tab is enabled.
Definition: TGTab.cxx:448
virtual void SetEnabled(Int_t tabIndex, Bool_t on=kTRUE)
Enable or disable tab.
Definition: TGTab.cxx:436
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:508
Int_t GetCurrent() const
Definition: TGTab.h:105
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:84
virtual const TGWindow * GetMainFrame() const
Returns top level main frame.
Definition: TGWindow.cxx:142
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
Definition: TGWindow.cxx:326
TGTab * GetTab() const
Definition: TGedEditor.h:84
void ActivateEditors(TList *bcl, Bool_t recurse)
Searches GedFrames for classes in the given list.
Definition: TGedEditor.cxx:566
virtual TCanvas * GetCanvas() const
Definition: TGedEditor.h:88
virtual TVirtualPad * GetPad() const
Definition: TGedEditor.h:89
virtual Option_t * GetDrawOption() const
Get draw options of the selected object.
Definition: TGedFrame.cxx:81
TGedEditor * fGedEditor
Definition: TGedFrame.h:54
virtual TGVerticalFrame * CreateEditorTabSubFrame(const char *name)
Create a vertical frame to be used by 'owner' in extra tab 'name'.
Definition: TGedFrame.cxx:123
virtual void SetDrawOption(Option_t *option="")
Set drawing option for object.
Definition: TGedFrame.cxx:145
Bool_t fInit
Definition: TGedFrame.h:53
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition: TGedFrame.cxx:96
virtual void Refresh(TObject *model)
Refresh the GUI info about the object attributes.
Definition: TGedFrame.cxx:135
virtual void Update()
Update the current pad when an attribute is changed via GUI.
Definition: TGedFrame.cxx:73
Bool_t fAvoidSignal
Definition: TGedFrame.h:56
void SetPattern(Style_t pattern, Bool_t emit=kTRUE)
Set pattern.
virtual void SetDirectory(TDirectory *dir)
By default when an histogram is created, it is added to the list of histogram objects in the current ...
Definition: TH1.cxx:8393
virtual void SetTitle(const char *title)
See GetStatOverflows for more information.
Definition: TH1.cxx:6345
virtual Float_t GetBarWidth() const
Definition: TH1.h:252
virtual Float_t GetBarOffset() const
Definition: TH1.h:251
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
Definition: TH1.h:316
TObject * Clone(const char *newname=0) const
Make a complete copy of the underlying object.
Definition: TH1.cxx:2665
@ kNoAxis
NOTE: Must always be 0 !!!
Definition: TH1.h:69
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:778
TAxis * GetYaxis()
Definition: TH1.h:317
virtual void SetContour(Int_t nlevels, const Double_t *levels=0)
Set the number and values of contour levels.
Definition: TH1.cxx:7947
virtual void SetBarWidth(Float_t width=0.5)
Definition: TH1.h:356
virtual Double_t GetEntries() const
Return the current number of entries.
Definition: TH1.cxx:4302
virtual UInt_t SetCanExtend(UInt_t extendBitMask)
Make the histogram axes extendable / not extendable according to the bit mask returns the previous bi...
Definition: TH1.cxx:6291
virtual void SetBarOffset(Float_t offset=0.25)
Definition: TH1.h:355
virtual void SetBins(Int_t nx, Double_t xmin, Double_t xmax)
Redefine x axis parameters.
Definition: TH1.cxx:8223
virtual Int_t GetContour(Double_t *levels=0)
Return contour values into array levels if pointer levels is non zero.
Definition: TH1.cxx:7875
TGNumberEntryField * fSldXMin
Definition: TH2Editor.h:97
TGCheckButton * fAddArr
Definition: TH2Editor.h:67
TGNumberEntryField * fYOffsetNumberEntry
Definition: TH2Editor.h:94
virtual void DoOffsetPressed()
Slot connected to the OffSetSlider.
Definition: TH2Editor.cxx:2122
TGNumberEntry * fContLevels1
Definition: TH2Editor.h:75
virtual void DoBarWidth()
Slot connected to the bar width of the bar chart.
Definition: TH2Editor.cxx:1567
TGCompositeFrame * f9
Definition: TH2Editor.h:60
Float_t fP4oldy[3]
Definition: TH2Editor.h:137
virtual void SetModel(TObject *obj)
Pick up the values of current histogram attributes.
Definition: TH2Editor.cxx:783
virtual void DoBinReleased()
Slot connected to the rebin slider in case of no ntuple histogram.
Definition: TH2Editor.cxx:1588
TGCheckButton * fAddBB
Definition: TH2Editor.h:72
TGNumberEntryField * fXOffsetNumberEntry
Definition: TH2Editor.h:88
Float_t fP3oldx[3]
Definition: TH2Editor.h:128
Float_t fP5oldy[3]
Definition: TH2Editor.h:138
TGCheckButton * fAddFB
Definition: TH2Editor.h:71
virtual void RecursiveRemove(TObject *obj)
If the contained histogram obj is deleted we must set its pointer to zero.
Definition: TH2Editor.cxx:2939
TGCompositeFrame * fBinXCont
Definition: TH2Editor.h:78
virtual void DoBinPressed()
Slot connected to the rebin slider in case of no ntuple histogram.
Definition: TH2Editor.cxx:1660
TGDoubleHSlider * fSliderY
Definition: TH2Editor.h:99
void CreateBinTab()
Create the Binning tab.
Definition: TH2Editor.cxx:378
TH2 * fBinHist
Definition: TH2Editor.h:142
TGTextButton * fApply
Definition: TH2Editor.h:83
virtual Bool_t AcceptModel(TObject *model)
Check if object is able to configure with this editor.
Definition: TH2Editor.cxx:770
TGCompositeFrame * f6
Definition: TH2Editor.h:59
virtual void DoAddError(Bool_t on)
Slot connected to the "Error" check button.
Definition: TH2Editor.cxx:1418
virtual void DoAddArr(Bool_t on)
Slot connected to the "Arrow draw option" check button.
Definition: TH2Editor.cxx:1253
TGCheckButton * fAddError
Definition: TH2Editor.h:64
TGHSlider * fBinYSlider1
Definition: TH2Editor.h:92
Float_t fP8oldy[3]
Definition: TH2Editor.h:141
TGNumberEntryField * fBinXNumberEntry1
Definition: TH2Editor.h:87
virtual void DoAddBB()
Slot connected to the "BB back-box draw option" check button.
Definition: TH2Editor.cxx:1514
TGCheckButton * fAddPalette1
Definition: TH2Editor.h:66
TGCompositeFrame * f38
Definition: TH2Editor.h:63
virtual void DoFillPattern(Style_t)
Slot connected to the fill area pattern.
Definition: TH2Editor.cxx:2722
Float_t fP2oldx[3]
Definition: TH2Editor.h:127
TGDoubleHSlider * fSliderX
Definition: TH2Editor.h:96
virtual void DoApply()
Slot connected to the Apply Button in the Rebinned histogram Window.
Definition: TH2Editor.cxx:1820
TGNumberEntryField * fBinYNumberEntry
Definition: TH2Editor.h:82
TGHSlider * fBinYSlider
Definition: TH2Editor.h:81
Double_t fOldXOffset
Definition: TH2Editor.h:143
TGHSlider * fYBinOffsetSld
Definition: TH2Editor.h:95
TGNumberEntryField * fBinXNumberEntry
Definition: TH2Editor.h:80
Float_t fP7oldx[3]
Definition: TH2Editor.h:132
virtual void DoSliderYPressed()
Slot connected to y-axis slider which initialises the "virtual" box which is drawn in delay draw mode...
Definition: TH2Editor.cxx:2610
TGCheckButton * fAddPalette
Definition: TH2Editor.h:65
TGCompositeFrame * fBinXCont1
Definition: TH2Editor.h:85
Float_t fP1oldx[3]
Definition: TH2Editor.h:126
TString fCutString
Definition: TH2Editor.h:105
virtual void DoOffsetMoved()
Slot connected to the OffSetSlider.
Definition: TH2Editor.cxx:2203
void PaintBox3D(Float_t *p1, Float_t *p2, Float_t *p3, Float_t *p4)
Paint a square in 3D.
Definition: TH2Editor.cxx:2889
TGRadioButton * fDim
Definition: TH2Editor.h:55
TGNumberEntry * fBarWidth
Definition: TH2Editor.h:76
TGNumberEntryField * fSldYMin
Definition: TH2Editor.h:100
virtual void DoYAxisRange()
Slot connected to the Max/Min number entry fields showing y-axis range.
Definition: TH2Editor.cxx:2688
virtual void DoContLevel()
Slot connected to the contour level number entry fContLevels.
Definition: TH2Editor.cxx:1545
virtual void DoContLevel1()
Slot connected to the contour level number entry fContLevels1.
Definition: TH2Editor.cxx:1556
TGHSlider * fBinXSlider
Definition: TH2Editor.h:79
TGHSlider * fXBinOffsetSld
Definition: TH2Editor.h:89
virtual void DoAddPalette(Bool_t on)
Slot connected to the color palette check button.
Definition: TH2Editor.cxx:1453
TGRadioButton * fDim0
Definition: TH2Editor.h:56
virtual void DoHistChanges()
Slot connected to histogram type, coordinate system, contour combo box.
Definition: TH2Editor.cxx:1176
virtual void ConnectSignals2Slots()
Connect signals to slots.
Definition: TH2Editor.cxx:698
TGLayoutHints * fDimlh
Definition: TH2Editor.h:57
TGCheckButton * fAddScat
Definition: TH2Editor.h:69
virtual void DoBinLabel1()
Slot connected to the Bin Number Entry for the Rebin.
Definition: TH2Editor.cxx:2042
Int_t fTitlePrec
Definition: TH2Editor.h:53
TGLabel * fColContLbl
Definition: TH2Editor.h:51
TGNumberEntry * fContLevels
Definition: