Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 "TGLabel.h"
130#include "TVirtualPad.h"
131#include "TString.h"
132#include "TGButtonGroup.h"
133#include "TGNumberEntry.h"
134#include "TG3DLine.h"
135#include "TGDoubleSlider.h"
136#include "TGSlider.h"
137#include "TView.h"
138#include "TCanvas.h"
139#include "TGedPatternSelect.h"
140#include "TGColorSelect.h"
141#include "TColor.h"
142#include "TTreePlayer.h"
143#include "TSelectorDraw.h"
144#include "TGTab.h"
145#include "TGMsgBox.h"
146#include "TH2.h"
147#include "TROOT.h"
148#include "TVirtualX.h"
149
150
152
170
171////////////////////////////////////////////////////////////////////////////////
172/// Constructor of histogram attribute GUI.
173
175 Int_t height, UInt_t options, Pixel_t back)
176 : TGedFrame(p, width, height, options | kVerticalFrame, back),
177 fHist(0),
178 fBin(0),
179 fBinHist(0)
180{
181 MakeTitle("Title");
182
183 // Histogram title
184 fTitlePrec = 2;
185 fTitle = new TGTextEntry(this, new TGTextBuffer(50), kTH2_TITLE);
187 fTitle->SetToolTipText("Enter the histogram title string");
188 AddFrame(fTitle, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5));
189
190
191 // 2D or 3D Plot?
192 TGCompositeFrame *f2 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
193 fDimGroup = new TGHButtonGroup(f2,"Plot");
195 fDim->SetToolTipText("A 2-d plot of the histogram is dawn");
197 fDim0->SetToolTipText("A 3-d plot of the histogram is dawn");
200 fDimGroup->Show();
202 f2->AddFrame(fDimGroup, new TGLayoutHints(kLHintsTop, 4, 1, 0, 0));
203 AddFrame(f2, new TGLayoutHints(kLHintsTop, 1, 1, 2, 5));
204
205 // 2D Plot drawoptions
206 f6 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
207 AddFrame(f6, new TGLayoutHints(kLHintsTop, 3, 1, 4, 2));
208
209 TGCompositeFrame *f7 = new TGCompositeFrame(f6, 40, 20);
210 f6->AddFrame(f7, new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
211
212 TGLabel *fAddLabel = new TGLabel(f7, "Contour:");
213 f7->AddFrame(fAddLabel, new TGLayoutHints(kLHintsLeft, 6, 4, 4, 4));
214
215 fColContLbl = new TGLabel(f7, "Cont #:");
216 f7->AddFrame(fColContLbl, new TGLayoutHints( kLHintsLeft, 6, 4, 4, 4));
217
218 fAddArr = new TGCheckButton(f7, "Arrow", kARROW_ONOFF);
219 fAddArr ->SetToolTipText("Shows gradient between adjacent cells");
220 f7->AddFrame(fAddArr, new TGLayoutHints(kLHintsLeft, 6, 1, 2, 0));
221
222 fAddCol = new TGCheckButton(f7, "Col", kCOL_ONOFF);
223 fAddCol ->SetToolTipText("A box is drawn for each cell with a color scale varying with contents");
224 f7->AddFrame(fAddCol, new TGLayoutHints(kLHintsLeft, 6, 1, 1, 0));
225
226 fAddText = new TGCheckButton(f7, "Text", kTEXT_ONOFF);
227 fAddText ->SetToolTipText("Draw bin contents as text");
228 f7->AddFrame(fAddText, new TGLayoutHints(kLHintsLeft, 6, 1, 1, 3));
229
231 f6->AddFrame(f8, new TGLayoutHints(kLHintsLeft, 5, 1, 0, 0));
232
234 f8->AddFrame(fContCombo, new TGLayoutHints(kLHintsLeft, 6, 1, 2, 1));
235 fContCombo->Resize(61, 20);
236 fContCombo->Associate(this);
237
238 fContLevels = new TGNumberEntry(f8, 20, 0, kCONT_LEVELS,
242 f8->AddFrame(fContLevels, new TGLayoutHints(kLHintsLeft, 6, 1, 3, 1));
243 fContLevels->GetNumberEntry()->SetToolTipText("Set number of contours (1..99)");
244 fContLevels->Resize(60,20);
245
246 fAddBox = new TGCheckButton(f8, "Box", kBOX_ONOFF);
247 fAddBox ->SetToolTipText("A box is drawn for each cell with surface proportional to contents");
248 f8->AddFrame(fAddBox, new TGLayoutHints(kLHintsLeft, 6, 1, 3, 0));
249
250 fAddScat = new TGCheckButton(f8, "Scat", kSCAT_ONOFF);
251 fAddScat ->SetToolTipText("Draw a scatter-plot");
252 f8->AddFrame(fAddScat, new TGLayoutHints(kLHintsLeft, 6, 1, 1, 0));
253
254 fAddPalette = new TGCheckButton(f8, "Palette", kPALETTE_ONOFF);
255 fAddPalette ->SetToolTipText("Add color palette beside the histogram");
256 f8->AddFrame(fAddPalette, new TGLayoutHints(kLHintsLeft, 6, 1, 1, 0));
257
258 f9 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
259 AddFrame(f9, new TGLayoutHints(kLHintsTop, 3, 1, 2, 0));
260
261 TGCompositeFrame *f10 = new TGCompositeFrame(f9, 40, 20);
262 f9->AddFrame(f10, new TGLayoutHints(kLHintsLeft, 0, 0, 3, 0));
263
264 TGLabel *fType = new TGLabel(f10, "Type:");
265 f10->AddFrame(fType, new TGLayoutHints(kLHintsNormal, 1, 1, 1, 1));
266
267 TGLabel *fCoords = new TGLabel(f10, "Coords:");
268 f10->AddFrame(fCoords, new TGLayoutHints(kLHintsLeft, 1, 1, 5, 1));
269
270 fColContLbl1 = new TGLabel(f10, "Cont #:");
271 f10->AddFrame(fColContLbl1, new TGLayoutHints( kLHintsLeft, 1, 1, 5, 3));
272
273 fAddFB = new TGCheckButton(f10, "Front", kFRONTBOX_ONOFF);
274 fAddFB ->SetToolTipText("Supress the drawing of the front box");
275 f10->AddFrame(fAddFB, new TGLayoutHints(kLHintsLeft, 0, 1, 6, 0));
276 fAddBB = new TGCheckButton(f10, "Back", kBACKBOX_ONOFF);
277 fAddBB ->SetToolTipText("Supress the drawing of the back box");
278 f10->AddFrame(fAddBB, new TGLayoutHints(kLHintsLeft, 0, 1, 3, 0));
279
280 TGCompositeFrame *f11 = new TGCompositeFrame(f9, 40, 20);
281 f9->AddFrame(f11, new TGLayoutHints(kLHintsLeft, 5, 1, 0, 0));
282
284 f11->AddFrame(fTypeCombo, new TGLayoutHints(kLHintsLeft, 0, 1, 2, 1));
285 fTypeCombo->Resize(80, 20);
286 fTypeCombo->Associate(this);
287
289 f11->AddFrame(fCoordsCombo, new TGLayoutHints(kLHintsLeft, 0, 1, 2, 1));
290 fCoordsCombo->Resize(80, 20);
291 fCoordsCombo->Associate(this);
292
293 fContLevels1 = new TGNumberEntry(f11, 20, 0, kCONT_LEVELS1,
297 fContLevels1->GetNumberEntry()->SetToolTipText("Set number of contours (1..99)");
298 fContLevels1->Resize(78,20);
299 f11->AddFrame(fContLevels1, new TGLayoutHints(kLHintsLeft, 0, 1, 2, 1));
300
301 fAddError = new TGCheckButton(f11, "Errors", kERROR_ONOFF);
302 fAddError ->SetToolTipText("Add color palette beside the histogram");
303 f11->AddFrame(fAddError, new TGLayoutHints(kLHintsLeft, 0, 1, 4, 0));
304 fAddPalette1 = new TGCheckButton(f11, "Palette", kPALETTE_ONOFF1);
305 fAddPalette1 ->SetToolTipText("Add color palette beside the histogram");
306 f11->AddFrame(fAddPalette1, new TGLayoutHints(kLHintsLeft, 0, 1, 3, 0));
307
308
309 // Bin bar settings
310 f12 = new TGCompositeFrame(this, 145, 10, kHorizontalFrame |
314 f12->AddFrame(new TGLabel(f12,"Bar"),
315 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
317 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
318 AddFrame(f12, new TGLayoutHints(kLHintsTop,0,0,6,4));
319
320 f13 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
321 TGLabel *fWidthLbl = new TGLabel(f13, "W:");
322 f13->AddFrame(fWidthLbl, new TGLayoutHints( kLHintsLeft, 1, 3, 4, 1));
323 fBarWidth = new TGNumberEntry(f13, 1.00, 6, kBAR_WIDTH,
327 fBarWidth->GetNumberEntry()->SetToolTipText("Set bar chart width");
328 fBarWidth->Resize(45,20);
329 f13->AddFrame(fBarWidth, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 1));
330
331 TGLabel *fOffsetLbl = new TGLabel(f13, "O:");
332 f13->AddFrame(fOffsetLbl, new TGLayoutHints(kLHintsLeft, 6,3, 4, 1));
333 fBarOffset = new TGNumberEntry(f13, 0.00, 5, kBAR_OFFSET,
337 fBarOffset->GetNumberEntry()->SetToolTipText("Set bar chart offset");
338 fBarOffset->Resize(50,20);
339 f13->AddFrame(fBarOffset, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 1));
340 AddFrame(f13, new TGLayoutHints(kLHintsTop, 1, 1, 0, 4));
341
342
343 // Set the color and pattern of the Frame (only for Cartesian 3D plot).
344 f38 = new TGCompositeFrame(this, 80, 20, kVerticalFrame);
349 f39->AddFrame(new TGLabel(f39,"Frame Fill"),
350 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
351 f39->AddFrame(new TGHorizontal3DLine(f39),
352 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
353 f38->AddFrame(f39, new TGLayoutHints(kLHintsTop,0,0,6,1));
354
356 fFrameColor = new TGColorSelect(f21, 0, kCOLOR);
357 f21->AddFrame(fFrameColor, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 0));
360 f21->AddFrame(fFramePattern, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 0));
362 f38->AddFrame(f21, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
364
365 fCutString = "";
366
367 CreateBinTab();
368
369 // add itself in the least of cleanups to be notified when attached histogram is deleted
370 gROOT->GetListOfCleanups()->Add(this);
371}
372
373////////////////////////////////////////////////////////////////////////////////
374/// Create the Binning tab.
375
377{
378 fBin = CreateEditorTabSubFrame("Binning");
379
380 // Editor for rebinning a histogram which does NOT derive from an Ntuple
382 TGCompositeFrame *title1 = new TGCompositeFrame(fBinXCont, 145, 10,
387 title1->AddFrame(new TGLabel(title1, "Rebin"),
388 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
389 title1->AddFrame(new TGHorizontal3DLine(title1),
390 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
391 fBinXCont->AddFrame(title1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
392
395 TGLabel *binSliderXLbl = new TGLabel(f22,"x:");
396 f22->AddFrame(binSliderXLbl,
397 new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 4,0, 4, 1));
398 fBinXSlider = new TGHSlider(f22, 100, kSlider1 | kScaleBoth);
399 fBinXSlider->Resize(107,20);
400 f22->AddFrame(fBinXSlider, new TGLayoutHints(kLHintsLeft, 2,0,0,3));
401 fBinXCont->AddFrame(f22, new TGLayoutHints(kLHintsTop, 3, 7, 3, 5));
402
405 TGLabel *binXLabel1 = new TGLabel(f23, "# of Bins:");
406 f23->AddFrame(binXLabel1, new TGLayoutHints(kLHintsLeft, 20, 1, 2, 1));
409 ((TGTextEntry*)fBinXNumberEntry)->SetToolTipText("Set the number of x axis bins in the rebinned histogram");
410 fBinXNumberEntry->Resize(57,20);
411 f23->AddFrame(fBinXNumberEntry, new TGLayoutHints(kLHintsRight, 8, 0, 0, 0));
412 fBinXCont->AddFrame(f23, new TGLayoutHints(kLHintsTop, 0, 7, 3, 4));
413
416 TGLabel *binSliderYLbl = new TGLabel(f37,"y:");
417 f37->AddFrame(binSliderYLbl,
418 new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 4,0, 4, 1));
419 fBinYSlider = new TGHSlider(f37, 100, kSlider1 | kScaleBoth);
420 fBinYSlider->Resize(107,20);
421 f37->AddFrame(fBinYSlider, new TGLayoutHints(kLHintsLeft, 1,0,0,3));
422 fBinXCont->AddFrame(f37, new TGLayoutHints(kLHintsTop, 3, 7, 3, 5));
423
426 TGLabel *binYLabel1 = new TGLabel(f36, "# of Bins:");
427 f36->AddFrame(binYLabel1, new TGLayoutHints(kLHintsLeft, 20, 1, 2, 1));
430 ((TGTextEntry*)fBinYNumberEntry)->SetToolTipText("Set the number of y axis bins in the rebinned histogram");
431 fBinYNumberEntry->Resize(57,20);
432 f36->AddFrame(fBinYNumberEntry, new TGLayoutHints(kLHintsRight, 8, 0, 0, 0));
433 fBinXCont->AddFrame(f36, new TGLayoutHints(kLHintsTop, 0, 7, 3, 4));
434
435 // Text buttons Apply & Ignore for rebinned histogram shown on the screen.
436 TGCompositeFrame *f24 = new TGCompositeFrame(fBinXCont, 118, 20,
439 fApply = new TGTextButton(f24, " &Apply ");
440 f24->AddFrame(fApply,
441 new TGLayoutHints(kLHintsExpandX | kLHintsLeft ,0, 3, 4, 4));
442 fCancel = new TGTextButton(f24, " &Ignore ");
443 f24->AddFrame(fCancel,
444 new TGLayoutHints(kLHintsExpandX | kLHintsLeft, 3, 0, 4, 4));
445 fBinXCont->AddFrame(f24, new TGLayoutHints(kLHintsTop, 20, 3, 3, 4));
447
448 // Widgets for rebinning a histogram which derives from an Ntuple
449
451 TGCompositeFrame *title2 = new TGCompositeFrame(fBinXCont1, 145, 10,
456 title2->AddFrame(new TGLabel(title2, "X-Axis"),
457 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
458 title2->AddFrame(new TGHorizontal3DLine(title2),
459 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
460 fBinXCont1->AddFrame(title2, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
461
464 fBinXSlider1 = new TGHSlider(f26, 100, kSlider1 | kScaleBoth);
465 fBinXSlider1->Resize(120,20);
469 f26->AddFrame(fBinXSlider1, new TGLayoutHints(kLHintsLeft, 2,0,0,0));
470 fBinXCont1->AddFrame(f26, new TGLayoutHints(kLHintsTop, 3, 7, 3, 0));
471
472 // Lettering of the Rebin Slider
475 TGLabel *l1 = new TGLabel(f27, "-5");
476 f27->AddFrame(l1, new TGLayoutHints(kLHintsLeft, 5, 1, -1, 0));
477 TGLabel *l2 = new TGLabel(f27, "-2");
478 f27->AddFrame(l2, new TGLayoutHints(kLHintsLeft, 31, 2, -1, 0));
479 TGLabel *l3 = new TGLabel(f27, "2");
480 f27->AddFrame(l3, new TGLayoutHints(kLHintsLeft, 21, 2, -1, 0));
481 TGLabel *l4 = new TGLabel(f27, "5");
482 f27->AddFrame(l4, new TGLayoutHints(kLHintsLeft, 36, 3, -1, 0));
483 fBinXCont1->AddFrame(f27, new TGLayoutHints(kLHintsTop, 0, 0, 0, 0));
484
485 TGCompositeFrame *f28 = new TGCompositeFrame(fBinXCont1, 140, 20,
487 TGLabel *binXLabel2 = new TGLabel(f28, "# of Bins:");
488 f28->AddFrame(binXLabel2, new TGLayoutHints(kLHintsLeft, 8, 1, 4, 1));
489
492 ((TGTextEntry*)fBinXNumberEntry1)->SetToolTipText("Set the number of x axis bins in the rebinned histogram");
495 new TGLayoutHints(kLHintsLeft, 21, 0, 2, 0));
496 fBinXCont1->AddFrame(f28, new TGLayoutHints(kLHintsTop, 0, 7, 2, 4));
497
500 TGLabel *xOffsetLbl = new TGLabel(f29, "BinOffset:");
501 f29->AddFrame(xOffsetLbl, new TGLayoutHints(kLHintsLeft, 7, 1, 2, 1));
506 0., 1.);
507 ((TGTextEntry*)fXOffsetNumberEntry)->SetToolTipText("Add an x-offset to the origin of the histogram");
510 new TGLayoutHints(kLHintsRight, 21, 0, 0, 0));
511 fBinXCont1->AddFrame(f29, new TGLayoutHints(kLHintsTop, 0, 7, 3, 1));
512
515 fXBinOffsetSld = new TGHSlider(f30, 100, kSlider1 | kScaleBoth);
516 fXBinOffsetSld->Resize(120,20);
518 fBinXCont1->AddFrame(f30, new TGLayoutHints(kLHintsTop, 3, 7, 3, 3));
520
521 // Same for Y-Axis:
522 // Widgets for rebinning a histogram which derives from an Ntuple
523
525 TGCompositeFrame *title3 = new TGCompositeFrame(fBinYCont1, 145, 10,
530 title3->AddFrame(new TGLabel(title3, "Y-Axis"),
531 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
532 title3->AddFrame(new TGHorizontal3DLine(title3),
533 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
534 fBinYCont1->AddFrame(title3, new TGLayoutHints(kLHintsTop, 0, 0, 7, 0));
535
538 fBinYSlider1 = new TGHSlider(f31, 100, kSlider1 | kScaleBoth);
539 fBinYSlider1->Resize(120,20);
543 f31->AddFrame(fBinYSlider1, new TGLayoutHints(kLHintsLeft, 2,0,0,0));
544 fBinYCont1->AddFrame(f31, new TGLayoutHints(kLHintsTop, 3, 7, 3, 0));
545
546 // Lettering of the Rebin Slider
549 TGLabel *l5 = new TGLabel(f32, "-5");
550 f32->AddFrame(l5, new TGLayoutHints(kLHintsLeft, 5, 1, -1, 0));
551 TGLabel *l6 = new TGLabel(f32, "-2");
552 f32->AddFrame(l6, new TGLayoutHints(kLHintsLeft, 31, 2, -1, 0));
553 TGLabel *l7 = new TGLabel(f32, "2");
554 f32->AddFrame(l7, new TGLayoutHints(kLHintsLeft, 21, 2, -1, 0));
555 TGLabel *l8 = new TGLabel(f32, "5");
556 f32->AddFrame(l8, new TGLayoutHints(kLHintsLeft, 36, 3, -1, 0));
557 fBinYCont1->AddFrame(f32, new TGLayoutHints(kLHintsTop, 0, 0, 0, 0));
558
559 TGCompositeFrame *f33 = new TGCompositeFrame(fBinYCont1, 140, 20,
561 TGLabel *binYLabel2 = new TGLabel(f33, "# of Bins:");
562 f33->AddFrame(binYLabel2, new TGLayoutHints(kLHintsLeft, 8, 1, 4, 1));
563
566 ((TGTextEntry*)fBinYNumberEntry1)->SetToolTipText("Set the number of Y axis bins in the rebinned histogram");
569 new TGLayoutHints(kLHintsLeft, 21, 0, 2, 0));
570 fBinYCont1->AddFrame(f33, new TGLayoutHints(kLHintsTop, 0, 7, 2, 4));
571
574 TGLabel *yOffsetLbl = new TGLabel(f34, "BinOffset:");
575 f34->AddFrame(yOffsetLbl, new TGLayoutHints(kLHintsLeft, 7, 1, 2, 1));
580 0., 1.);
581 ((TGTextEntry*)fYOffsetNumberEntry)->SetToolTipText("Add an Y-offset to the origin of the histogram");
584 new TGLayoutHints(kLHintsRight, 21, 0, 0, 0));
585 fBinYCont1->AddFrame(f34, new TGLayoutHints(kLHintsTop, 0, 7, 3, 1));
586
589 fYBinOffsetSld = new TGHSlider(f35, 100, kSlider1 | kScaleBoth);
590 fYBinOffsetSld->Resize(120,20);
593 fBinYCont1->AddFrame(f35, new TGLayoutHints(kLHintsTop, 3, 7, 3, 3));
595
596 // Axis ranges
597 TGCompositeFrame *title4 = new TGCompositeFrame(fBin, 145, 10,
602 title4->AddFrame(new TGLabel(title4, "Axis Range"),
603 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
604 title4->AddFrame(new TGHorizontal3DLine(title4),
605 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
606 fBin->AddFrame(title4, new TGLayoutHints(kLHintsTop, 0, 0, 5, 0));
607
609 TGLabel *fSliderXLbl = new TGLabel(f14,"x:");
610 f14->AddFrame(fSliderXLbl,
611 new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 4,3, 2, 1));
612 fSliderX = new TGDoubleHSlider(f14, 1, 2);
613 fSliderX->Resize(119,20);
615 fBin->AddFrame(f14, new TGLayoutHints(kLHintsTop, 3, 7, 4, 1));
616
621 ((TGTextEntry*)fSldXMin)->SetToolTipText("Set the minimum value of the x-axis");
622 fSldXMin->Resize(57,20);
623 f17->AddFrame(fSldXMin, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
627 ((TGTextEntry*)fSldXMax)->SetToolTipText("Set the maximum value of the x-axis");
628 fSldXMax->Resize(57,20);
629 f17->AddFrame(fSldXMax, new TGLayoutHints(kLHintsLeft, 4, 0, 0, 0));
630 fBin->AddFrame(f17, new TGLayoutHints(kLHintsTop, 20, 3, 5, 0));
631
633 TGLabel *fSliderYLbl = new TGLabel(f15,"y:");
634 f15->AddFrame(fSliderYLbl,
635 new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 4,2, 4, 1));
636 fSliderY = new TGDoubleHSlider(f15, 1, 2);
637 fSliderY->Resize(119,20);
639 fBin->AddFrame(f15, new TGLayoutHints(kLHintsTop, 3, 7, 4, 1));
640
645 ((TGTextEntry*)fSldYMin)->SetToolTipText("Set the minimum value of the y-axis");
646 fSldYMin->Resize(57,20);
647 f18->AddFrame(fSldYMin, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
651 ((TGTextEntry*)fSldYMax)->SetToolTipText("Set the maximum value of the y-axis");
652 fSldYMax->Resize(57,20);
653 f18->AddFrame(fSldYMax, new TGLayoutHints(kLHintsLeft, 4, 0, 0, 0));
654 fBin->AddFrame(f18, new TGLayoutHints(kLHintsTop, 20, 3, 5, 0));
655
657 fDelaydraw = new TGCheckButton(f20, "Delayed drawing", kDELAYED_DRAWING);
658 fDelaydraw ->SetToolTipText("Draw the new axis range when the Slider is released");
659 f20->AddFrame(fDelaydraw, new TGLayoutHints(kLHintsLeft, 6, 1, 1, 0));
660 fBin->AddFrame(f20, new TGLayoutHints(kLHintsTop, 2, 1, 5, 3));
661
662 fXBinOffsetSld->SetRange(0,100);
665
666 fYBinOffsetSld->SetRange(0,100);
669
672
673}
674
675////////////////////////////////////////////////////////////////////////////////
676/// Destructor.
677
679{
680 // remove itselef from the list of cleanups
681 gROOT->GetListOfCleanups()->Remove(this);
682
683 // children of TGButonGroup are not deleted
684 delete fDim;
685 delete fDim0;
686 delete fDimlh;
687 delete fDim0lh;
688
689 if (fBinHist) delete fBinHist;
690 fBinHist = 0;
691}
692
693////////////////////////////////////////////////////////////////////////////////
694/// Connect signals to slots.
695
697{
698 fTitle->Connect("TextChanged(const char *)", "TH2Editor", this, "DoTitle(const char *)");
699 fDimGroup->Connect("Clicked(Int_t)","TH2Editor",this,"DoHistView()");
700 fTypeCombo->Connect("Selected(Int_t)", "TH2Editor", this, "DoHistChanges()");
701 fCoordsCombo->Connect("Selected(Int_t)", "TH2Editor", this, "DoHistChanges()");
702 fContCombo->Connect("Selected(Int_t)", "TH2Editor", this, "DoHistChanges()");
703 fAddArr->Connect("Toggled(Bool_t)", "TH2Editor", this, "DoAddArr(Bool_t)");
704 fAddBox->Connect("Toggled(Bool_t)", "TH2Editor", this, "DoAddBox(Bool_t)");
705 fAddCol->Connect("Toggled(Bool_t)", "TH2Editor", this, "DoAddCol(Bool_t)");
706 fAddScat->Connect("Toggled(Bool_t)", "TH2Editor", this, "DoAddScat(Bool_t)");
707 fAddText->Connect("Toggled(Bool_t)", "TH2Editor", this, "DoAddText(Bool_t)");
708 fAddError->Connect("Toggled(Bool_t)", "TH2Editor", this, "DoAddError(Bool_t)");
709 fAddPalette->Connect("Toggled(Bool_t)", "TH2Editor", this, "DoAddPalette(Bool_t)");
710 fAddPalette1->Connect("Toggled(Bool_t)", "TH2Editor", this, "DoAddPalette(Bool_t)");
711 fAddFB->Connect("Toggled(Bool_t)", "TH2Editor", this, "DoAddFB()");
712 fAddBB->Connect("Toggled(Bool_t)", "TH2Editor", this, "DoAddBB()");
713 fContLevels->Connect("ValueSet(Long_t)", "TH2Editor", this, "DoContLevel()");
714 (fContLevels->GetNumberEntry())->Connect("ReturnPressed()", "TH2Editor",
715 this,"DoContLevel()");
716 fContLevels1->Connect("ValueSet(Long_t)", "TH2Editor", this, "DoContLevel1()");
717 (fContLevels1->GetNumberEntry())->Connect("ReturnPressed()", "TH2Editor",
718 this,"DoContLevel1()");
719 fBarWidth->Connect("ValueSet(Long_t)", "TH2Editor", this, "DoBarWidth()");
720 (fBarWidth->GetNumberEntry())->Connect("ReturnPressed()", "TH2Editor",
721 this, "DoBarWidth()");
722 fBarOffset->Connect("ValueSet(Long_t)", "TH2Editor", this, "DoBarOffset()");
723 (fBarOffset->GetNumberEntry())->Connect("ReturnPressed()", "TH2Editor",
724 this, "DoBarOffset()");
725 fBinXSlider->Connect("PositionChanged(Int_t)","TH2Editor",this, "DoBinMoved()");
726 fBinXSlider->Connect("Released()","TH2Editor",this, "DoBinReleased()");
727 fBinXSlider->Connect("Pressed()","TH2Editor",this, "DoBinPressed()");
728 fBinYSlider->Connect("PositionChanged(Int_t)","TH2Editor",this, "DoBinMoved()");
729 fBinYSlider->Connect("Released()","TH2Editor",this, "DoBinReleased()");
730 fBinYSlider->Connect("Pressed()","TH2Editor",this, "DoBinPressed()");
731 fBinXNumberEntry->Connect("ReturnPressed()", "TH2Editor", this, "DoBinLabel()");
732 fBinYNumberEntry->Connect("ReturnPressed()", "TH2Editor", this, "DoBinLabel()");
733 fApply->Connect("Clicked()", "TH2Editor", this, "DoApply()");
734 fCancel->Connect("Pressed()", "TH2Editor", this, "DoCancel()");
735 fBinXSlider1->Connect("Released()","TH2Editor",this, "DoBinReleased1()");
736 fBinXSlider1->Connect("PositionChanged(Int_t)","TH2Editor",this, "DoBinMoved1()");
737 fBinXNumberEntry1->Connect("ReturnPressed()", "TH2Editor", this, "DoBinLabel1()");
738 fXBinOffsetSld->Connect("PositionChanged(Int_t)","TH2Editor",this, "DoOffsetMoved()");
739 fXBinOffsetSld->Connect("Released()","TH2Editor",this, "DoOffsetReleased()");
740 fXBinOffsetSld->Connect("Pressed()","TH2Editor",this, "DoOffsetPressed()");
741 fXOffsetNumberEntry->Connect("ReturnPressed()", "TH2Editor", this, "DoBinOffset()");
742 fBinYSlider1->Connect("Released()","TH2Editor",this, "DoBinReleased1()");
743 fBinYSlider1->Connect("PositionChanged(Int_t)","TH2Editor",this, "DoBinMoved1()");
744 fBinYNumberEntry1->Connect("ReturnPressed()", "TH2Editor", this, "DoBinLabel1()");
745 fYBinOffsetSld->Connect("PositionChanged(Int_t)","TH2Editor",this,"DoOffsetMoved()");
746 fYBinOffsetSld->Connect("Released()","TH2Editor",this, "DoOffsetReleased()");
747 fYBinOffsetSld->Connect("Pressed()","TH2Editor",this, "DoOffsetPressed()");
748 fYOffsetNumberEntry->Connect("ReturnPressed()", "TH2Editor", this,"DoBinOffset()");
749 fSliderX->Connect("PositionChanged()","TH2Editor",this, "DoSliderXMoved()");
750 fSliderX->Connect("Pressed()","TH2Editor",this, "DoSliderXPressed()");
751 fSliderX->Connect("Released()","TH2Editor",this, "DoSliderXReleased()");
752 fSldXMin->Connect("ReturnPressed()", "TH2Editor", this, "DoXAxisRange()");
753 fSldXMax->Connect("ReturnPressed()", "TH2Editor", this, "DoXAxisRange()");
754 fSliderY->Connect("PositionChanged()","TH2Editor",this, "DoSliderYMoved()");
755 fSliderY->Connect("Pressed()","TH2Editor",this, "DoSliderYPressed()");
756 fSliderY->Connect("Released()","TH2Editor",this, "DoSliderYReleased()");
757 fSldYMin->Connect("ReturnPressed()", "TH2Editor", this, "DoYAxisRange()");
758 fSldYMax->Connect("ReturnPressed()", "TH2Editor", this, "DoYAxisRange()");
759 fFrameColor->Connect("ColorSelected(Pixel_t)", "TH2Editor", this, "DoFillColor(Pixel_t)");
760 fFramePattern->Connect("PatternSelected(Style_t)", "TH2Editor", this, "DoFillPattern(Style_t)");
761
762 fInit = kFALSE;
763}
764
765////////////////////////////////////////////////////////////////////////////////
766/// Check if object is able to configure with this editor.
767
769{
770 if (obj == 0 || !obj->InheritsFrom(TH2::Class()) ||
771 (!strcmp(((TH2 *)obj)->GetName(),"htemp") &&
772 ((TH2*)obj)->GetEntries() == 0)) { // htemp is an empty histogram
773 return kFALSE;
774 }
775 return kTRUE;
776}
777
778////////////////////////////////////////////////////////////////////////////////
779/// Pick up the values of current histogram attributes.
780
782{
784 if (fBinHist && (obj != fHist)) {
785 //we have probably moved to a different pad.
786 //let's restore the original histogram
787 if (fHist) {
788 fHist->Reset();
796 }
797 // delete in anycase fBinHist also when fHist is zero (i.e when it has been deleted)
798 delete fBinHist;
799 fBinHist = 0;
800 if (fGedEditor->GetPad()) {
803 }
804 }
805
806 fHist = (TH2*) obj;
807
808 const char *text = fHist->GetTitle();
810 TString str = GetDrawOption();
812 str.ToUpper();
813
814 if (str == "") {
815 // default options = Scatter-Plot
816 ShowFrame(f6);
817 HideFrame(f9);
818 HideFrame(f12);
819 HideFrame(f13);
820 HideFrame(f38);
826
837 } else if (!str.Contains("LEGO") && !str.Contains("SURF")) {
838 ShowFrame(f6);
839 HideFrame(f9);
840 HideFrame(f12);
841 HideFrame(f13);
842 HideFrame(f38);
847 if (str.Contains("CONT")){
848 if (str.Contains("CONT1")) fContCombo->Select(kCONT_1);
849 else if (str.Contains("CONT2")) fContCombo->Select(kCONT_2);
850 else if (str.Contains("CONT3")) fContCombo->Select(kCONT_3);
851 else if (str.Contains("CONT4")) fContCombo->Select(kCONT_4);
852 else if (str.Contains("CONT0") || str.Contains("CONT"))
855
856 if (str.Contains("ARR")) fAddArr->SetState(kButtonDown);
858 if (str.Contains("BOX")) fAddBox->SetState(kButtonDown);
860 if (str.Contains("COL")) fAddCol->SetState(kButtonDown);
862 if (str.Contains("SCAT")) {
863 if (str=="SCAT") fAddScat->SetState(kButtonDisabled);
865 } else fAddScat->SetState(kButtonUp);
866 if (str.Contains("TEXT")) fAddText->SetState(kButtonDown);
868
870 if (str.Contains("COL") || (str.Contains("CONT") &&
871 !str.Contains("CONT2") && !str.Contains("CONT3"))) {
878
879 } else if (str.Contains("LEGO") || str.Contains("SURF")) {
880 HideFrame(f6);
881 ShowFrame(f9);
882 ShowFrame(f12);
883 ShowFrame(f13);
884 ShowFrame(f38);
887 if (str.Contains("LEGO4")) fTypeCombo->Select(kTYPE_LEGO4);
888 else if (str.Contains("LEGO3")) fTypeCombo->Select(kTYPE_LEGO3);
889 else if (str.Contains("LEGO2")) fTypeCombo->Select(kTYPE_LEGO2);
890 else if (str.Contains("LEGO1")) fTypeCombo->Select(kTYPE_LEGO1);
891 else if (str.Contains("LEGO")) fTypeCombo->Select(kTYPE_LEGO);
892 else if (str.Contains("SURF5")) fTypeCombo->Select(kTYPE_SURF5);
893 else if (str.Contains("SURF4")) fTypeCombo->Select(kTYPE_SURF4);
894 else if (str.Contains("SURF3")) fTypeCombo->Select(kTYPE_SURF3);
895 else if (str.Contains("SURF2")) fTypeCombo->Select(kTYPE_SURF2);
896 else if (str.Contains("SURF1")) fTypeCombo->Select(kTYPE_SURF1);
897 else if (str.Contains("SURF")) fTypeCombo->Select(kTYPE_SURF);
898
899
900 if (str.Contains("CYL")) fCoordsCombo->Select(kCOORDS_CYL);
901 else if (str.Contains("POL")) fCoordsCombo->Select(kCOORDS_POL);
902 else if (str.Contains("SPH")) fCoordsCombo->Select(kCOORDS_SPH);
903 else if (str.Contains("PSR")) fCoordsCombo->Select(kCOORDS_PSR);
904 else fCoordsCombo->Select(kCOORDS_CAR); //default
905
912
920 } else {
921 if (str.Contains("FB")) fAddFB->SetState(kButtonUp);
923 if (str.Contains("BB")) fAddBB->SetState(kButtonUp);
925 if (str.Contains("E")){
926 TString dum = str;
927 if (str.Contains("LEGO"))
928 dum.Remove(strstr(dum.Data(),"LEGO")-dum.Data(),4);
929 if (str.Contains("TEXT"))
930 dum.Remove(strstr(dum.Data(),"TEXT")-dum.Data(),4);
931 if (dum.Contains("E")) fAddError->SetState(kButtonDown);
934 }
942 else if (str.Contains("Z")) fAddPalette1->SetState(kButtonDown);
944 }
945
948
949 Int_t nx = fHist -> GetXaxis() -> GetNbins();
950 Int_t nxbinmin = fHist -> GetXaxis() -> GetFirst();
951 Int_t nxbinmax = fHist -> GetXaxis() -> GetLast();
952 fSliderX->SetRange(1,nx);
953 fSliderX->SetPosition((Double_t)nxbinmin,(Double_t)nxbinmax);
956
957 Int_t ny = fHist -> GetYaxis() -> GetNbins();
958 Int_t nybinmin = fHist -> GetYaxis() -> GetFirst();
959 Int_t nybinmax = fHist -> GetYaxis() -> GetLast();
960 fSliderY->SetRange(1,ny);
961 fSliderY->SetPosition((Double_t)nybinmin,(Double_t)nybinmax);
964
966
967 if (str.Contains("COL") || fContCombo->GetSelected()!= kCONT_NONE)
969 else fColContLbl->Disable();
970
971 if (str.Contains("LEGO2") || str.Contains("SURF1") ||
972 str.Contains("SURF2") || str.Contains("SURF3") ||
973 str.Contains("SURF5")) fColContLbl1->Enable();
974 else fColContLbl1->Disable();
975
978
981
983
984
985 // Check if histogram is from ntupla/tree or not.
986 // If it is a standard histogram or a ntupla based histogram
987 // show a different frame in case of rebinning (fBinCont) with sliders and bin number entries
988 // connected to different methods.
989 // For example the entry field fBinXNumberEntry is connected to
990 // the method DoBinLabel in case of non-ntupla histograms which just call Th1::Rebin
991 // In csae of a tree based histogram the entry field fBinNumberEntry1 is used which is connected to
992 // TH1Editor::DoBinLabel1 which is re-filling the histograms with the cached values from the TTreePlayer.
993 // Since the actual number of histogram entry can be larger than the cache size of the TTreePlayer
994 // (see JIRA ROOT-5900 or http://root.cern.ch/phpBB3/viewtopic.php?f=3&t=17107 )
995 // the GUI frame based on a non-tupla histogram is used when the number of entries of the histogram is
996 // not the same as the number of filled entries in the TTreePlayer object.
997
998 if (!player || player->GetHistogram()!=fHist ||
999 fHist->GetEntries() != player->GetNfill()) {
1000 Int_t n1 = 0, n2 =0;
1001 Int_t upx =0, upy =0;
1002 if (fBinHist) n1 = fBinHist->GetXaxis()->GetNbins();
1003 else n1 = nx;
1004 if (fBinHist) n2 = fBinHist->GetYaxis()->GetNbins();
1005 else n2 = ny;
1009 if (n1 < 1) n1 = 1;
1010 if (n2 < 1) n2 = 1;
1011 Int_t* divx = Dividers(n1);
1012 Int_t* divy = Dividers(n2);
1013 if (divx[0]-1 <= 1) upx = 2;
1014 else upx = divx[0]-1;
1015 fBinXSlider->SetRange(1,upx);
1016 if (divy[0]-1 <= 1) upy = 2;
1017 else upy = divy[0]-1;
1018 fBinYSlider->SetRange(1,upy);
1019 Int_t i = 1; Int_t j = 1;
1022 else {
1023 while ( divx[i] != nx) i ++;
1024 fBinXSlider->SetPosition(divx[0] - i + 1);
1025 }
1028 else {
1029 while ( divy [j] != ny) j ++;
1030 fBinYSlider->SetPosition(divy[0] - j + 1);
1031 }
1036 delete [] divx;
1037 delete [] divy;
1038 }
1039 else if (player && fHist==player->GetHistogram() && fHist->GetEntries() == player->GetNfill()) {
1045 fBinXNumberEntry1->SetIntNumber(nxbinmax-nxbinmin+1);
1048 fBinYNumberEntry1->SetIntNumber(nybinmax-nybinmin+1);
1049 }
1050
1052 fHist->GetXaxis()->GetBinWidth(1));
1054 fHist->GetYaxis()->GetBinWidth(1));
1056
1060
1061}
1062
1063////////////////////////////////////////////////////////////////////////////////
1064/// Slot connected to the histogram title setting.
1065
1066void TH2Editor::DoTitle(const char *text)
1067{
1068 if (fAvoidSignal) return;
1070 Update();
1071}
1072
1073////////////////////////////////////////////////////////////////////////////////
1074/// Slot connected to the 'Plot' button group.
1075
1077{
1078 if (gPad && gPad->GetVirtCanvas()) gPad->GetVirtCanvas()->SetCursor(kWatch);
1079 gVirtualX->SetCursor(GetId(), gVirtualX->CreateCursor(kWatch));
1080
1081 if (fDim->GetState() == kButtonDown)
1082 DoHistSimple();
1083 else
1084 DoHistComplex();
1085
1086 if (gPad && gPad->GetVirtCanvas()) gPad->GetVirtCanvas()->SetCursor(kPointer);
1087 gVirtualX->SetCursor(GetId(), gVirtualX->CreateCursor(kPointer));
1088}
1089
1090////////////////////////////////////////////////////////////////////////////////
1091/// Slot connected to the 2D-Plot radio button.
1092
1094{
1095 if (fAvoidSignal) return;
1096 TString str = "";
1097 ShowFrame(f6);
1098 HideFrame(f9);
1099 HideFrame(f12);
1100 HideFrame(f13);
1101 HideFrame(f38);
1102 if (fContCombo->GetSelected()==-1)
1104 if ((fContCombo->GetSelected()!= kCONT_NONE) &&
1107
1109 if (str=="" || str=="SCAT" || str==fCutString) {
1112 } else if (fAddScat->GetState()==kButtonDisabled)
1114 if (str.Contains("COL") || fContCombo->GetSelected()!= kCONT_NONE)
1116 else fColContLbl->Disable();
1117
1119
1120 TString ocut = fCutString;
1121 ocut.ToUpper();
1122 if (!str.Contains(fCutString) && !str.Contains(ocut))
1123 str+=fCutString;
1124 SetDrawOption(str);
1125 Update();
1126}
1127
1128////////////////////////////////////////////////////////////////////////////////
1129/// Slot connected to the 3D-Plot radio button.
1130
1132{
1133 if (fAvoidSignal) return;
1134 TString str = "";
1135 HideFrame(f6);
1136 ShowFrame(f9);
1137 ShowFrame(f38);
1138 if (GetHistTypeLabel().Contains("LEGO")) {
1139 ShowFrame(f12);
1140 ShowFrame(f13);
1141 } else {
1142 HideFrame(f12);
1143 HideFrame(f13);
1144 }
1147
1149
1150 if (str.Contains("LEGO2") || str.Contains("SURF1") ||
1151 str.Contains("SURF2") || str.Contains("SURF3") ||
1152 str.Contains("SURF5")) {
1156 } else {
1159 }
1160
1162
1163 TString ocut = fCutString;
1164 ocut.ToUpper();
1165 if (!str.Contains(fCutString) && !str.Contains(ocut))
1166 str+=fCutString;
1167 SetDrawOption(str);
1168 Update();
1169}
1170
1171////////////////////////////////////////////////////////////////////////////////
1172/// Slot connected to histogram type, coordinate system, contour combo box.
1173
1175{
1176 if (fAvoidSignal) return;
1177 TString str = "";
1178 if (fDim->GetState() == kButtonDown) {
1182 fContCombo->GetSelected()!=kCONT_3) || str.Contains("COL")) {
1183
1184 if (str.Contains("Z")) fAddPalette->SetState(kButtonDown);
1187 if (str=="" || str=="SCAT" || str==fCutString) {
1190 } else if (fAddScat->GetState()==kButtonDisabled)
1193 if (str.Contains("COL") || fContCombo->GetSelected()!= kCONT_NONE)
1195 else
1197
1198 } else if (fDim0->GetState() == kButtonDown) {
1206 } else {
1213 }
1214 if ((fTypeCombo->GetSelected()==kTYPE_LEGO) ||
1223 if (GetHistTypeLabel().Contains("LEGO")) {
1224 ShowFrame(f12);
1225 ShowFrame(f13);
1226 } else {
1227 HideFrame(f12);
1228 HideFrame(f13);
1229 }
1232 if (str.Contains("LEGO2") || str.Contains("SURF1") ||
1233 str.Contains("SURF2") || str.Contains("SURF3") ||
1234 str.Contains("SURF5"))
1236 else
1238 }
1239
1240 TString ocut = fCutString;
1241 ocut.ToUpper();
1242 if (!str.Contains(fCutString) && !str.Contains(ocut))
1243 str+=fCutString;
1244 SetDrawOption(str);
1245 Update();
1246}
1247
1248////////////////////////////////////////////////////////////////////////////////
1249/// Slot connected to the "Arrow draw option" check button.
1250
1252{
1253 if (fAvoidSignal) return;
1254 Bool_t make=kFALSE;
1255 TString str = GetDrawOption();
1256 str.ToUpper();
1257
1258 if (on) {
1259 if (!str.Contains("ARR")) {
1260 str += "ARR";
1263 make=kTRUE;
1264 }
1265 } else if (fAddArr->GetState()==kButtonUp) {
1266 if (str.Contains("ARR")) {
1267 str.Remove(strstr(str.Data(),"ARR")-str.Data(),3);
1268 if (str=="" || str=="SCAT" || str==fCutString) {
1271 }
1272 make=kTRUE;
1273 }
1274 }
1275 if (make) {
1276 DoHistChanges();
1277 }
1278}
1279
1280////////////////////////////////////////////////////////////////////////////////
1281/// Slot connected to the "Box draw option" check button.
1282
1284{
1285 if (fAvoidSignal) return;
1286 Bool_t make=kFALSE;
1287 TString str = GetDrawOption();
1288 str.ToUpper();
1289
1290 if (on) {
1291 if (!str.Contains("BOX")) {
1292 str += "BOX";
1295 make=kTRUE;
1296 }
1297 } else if (fAddBox->GetState()==kButtonUp) {
1298 if (str.Contains("BOX")) {
1299 str.Remove(strstr(str.Data(),"BOX")-str.Data(),3);
1300 if (str=="" || str=="SCAT" || str==fCutString) {
1303 }
1304 make=kTRUE;
1305 }
1306 }
1307 if (make) {
1308 DoHistChanges();
1309 }
1310}
1311
1312////////////////////////////////////////////////////////////////////////////////
1313/// Slot connected to the "Col draw option" check button.
1314
1316{
1317 if (fAvoidSignal) return;
1318 Bool_t make=kFALSE;
1319 TString str = GetDrawOption();
1320 str.ToUpper();
1321
1322 if (on) {
1323 if (!str.Contains("COL")) {
1324 str += "COL";
1325 fColContLbl->Enable() ;
1330 make=kTRUE;
1331 }
1332 } else if (fAddCol->GetState()==kButtonUp) {
1333 if (str.Contains("COL")) {
1334 str.Remove(strstr(str.Data(),"COL")-str.Data(),3);
1339 if (str.Contains("Z"))
1340 str.Remove(strstr(str.Data(),"Z")-str.Data(),1);
1341 }
1342 if (str=="" || str=="SCAT" || str==fCutString)
1345 fColContLbl->Enable() ;
1346 else fColContLbl->Disable();
1347 make=kTRUE;
1348 }
1349 }
1350 if (make) {
1351 DoHistChanges();
1352 }
1353}
1354
1355////////////////////////////////////////////////////////////////////////////////
1356/// Slot connected to the "Scat draw option" check button.
1357
1359{
1360 if (fAvoidSignal) return;
1361 Bool_t make=kFALSE;
1362 TString str = GetDrawOption();
1363 str.ToUpper();
1364
1365 if (on) {
1366 if (!str.Contains("SCAT")) {
1367 str += "SCAT";
1368 make=kTRUE;
1369 }
1370 } else if (fAddScat->GetState()==kButtonUp) {
1371 if (str.Contains("SCAT")) {
1372 str.Remove(strstr(str.Data(),"SCAT")-str.Data(),4);
1373 make=kTRUE;
1374 }
1375 }
1376 if (make) {
1377 DoHistChanges();
1378 }
1379}
1380
1381////////////////////////////////////////////////////////////////////////////////
1382/// Slot connected to the "Text draw option" check button.
1383
1385{
1386 if (fAvoidSignal) return;
1387 Bool_t make=kFALSE;
1388 TString str = GetDrawOption();
1389 str.ToUpper();
1390
1391 if (on) {
1392 if (!str.Contains("TEXT")) {
1393 str += "TEXT";
1396 make=kTRUE;
1397 }
1398 } else if (fAddText->GetState()==kButtonUp) {
1399 if (str.Contains("TEXT")) {
1400 str.Remove(strstr(str.Data(),"TEXT")-str.Data(),4);
1401 if (str=="" || str=="SCAT" || str==fCutString)
1403 make=kTRUE;
1404 }
1405 }
1406 if (make) {
1407 DoHistChanges();
1408 // next line is needed for marker editor refresh
1410 }
1411}
1412
1413////////////////////////////////////////////////////////////////////////////////
1414/// Slot connected to the "Error" check button.
1415
1417{
1418 if (fAvoidSignal) return;
1419 Bool_t make=kFALSE;
1420 TString str = GetDrawOption();
1421 str.ToUpper();
1422
1423 TString dum = str;
1424 if (str.Contains("LEGO"))
1425 dum.Remove(strstr(dum.Data(),"LEGO")-dum.Data(),4);
1426 if (str.Contains("TEXT"))
1427 dum.Remove(strstr(dum.Data(),"TEXT")-dum.Data(),4);
1428 if (on) {
1429 if (!dum.Contains("E")) {
1430 str += "E";
1431 make=kTRUE;
1432 }
1433 } else if (fAddError->GetState() == kButtonUp) {
1434 if (str.Contains("E")) {
1435 if (fDim->GetState() == kButtonDown)
1437 else
1440 make=kTRUE;
1441 }
1442 }
1443 if (make) {
1444 DoHistChanges();
1445 }
1446}
1447
1448////////////////////////////////////////////////////////////////////////////////
1449/// Slot connected to the color palette check button.
1450
1452{
1453 if (fAvoidSignal) return;
1454 Bool_t make=kFALSE;
1455 TString str = GetDrawOption();
1456 str.ToUpper();
1457
1458 if (on) {
1459 if (!str.Contains("Z")) {
1460 str += "Z";
1461 make=kTRUE;
1462 }
1463 } else if (fAddPalette->GetState()==kButtonUp ||
1465 if (str.Contains("Z")) {
1466 str.Remove(strstr(str.Data(),"Z")-str.Data(),1);
1467 make=kTRUE;
1468 }
1469 }
1470 if (make) {
1471 DoHistChanges();
1472 }
1473}
1474
1475////////////////////////////////////////////////////////////////////////////////
1476/// Slot connected to the "FB front-box draw option" check button.
1477
1479{
1480 if (fAvoidSignal) return;
1481 Bool_t make=kFALSE;
1482 TString str = GetDrawOption();
1483 str.ToUpper();
1484
1485 if (fAddFB->GetState()==kButtonDown) {
1486 if (str.Contains("FB")) {
1487 if (str.Contains("SURF") && !(str.Contains("1") ||
1488 str.Contains("2") || str.Contains("3") ||
1489 str.Contains("4") || str.Contains("5"))) {
1490 TString dum = str;
1491 dum.Remove(strstr(dum.Data(),"SURF")-dum.Data(),4);
1492 if (dum.Contains("FB"))
1493 dum.Remove(strstr(dum.Data(),"FB")-dum.Data(),2);
1494 str = "SURF" + dum;
1495 } else str.Remove(strstr(str.Data(),"FB")-str.Data(),2);
1496 make = kTRUE;
1497 }
1498 } else if (fAddFB->GetState()==kButtonUp){
1499 if (!str.Contains("FB")) {
1500 str += "FB";
1501 make=kTRUE;
1502 }
1503 }
1504 if (make) {
1505 DoHistChanges();
1506 }
1507}
1508
1509////////////////////////////////////////////////////////////////////////////////
1510/// Slot connected to the "BB back-box draw option" check button.
1511
1513{
1514 if (fAvoidSignal) return;
1515 Bool_t make=kFALSE;
1516 TString str = GetDrawOption();
1517 str.ToUpper();
1518
1519 if (fAddBB->GetState()==kButtonDown) {
1520 if (str.Contains("BB")) {
1521 if (str.Contains("FB")) {
1522 TString dum = str;
1523 dum.Remove(strstr(dum.Data(),"FB")-dum.Data(),2);
1524 dum.Remove(strstr(dum.Data(),"BB")-dum.Data(),2);
1525 str=dum+"FB";
1526 } else str.Remove(strstr(str.Data(),"BB")-str.Data(),2);
1527 make = kTRUE;
1528 }
1529 } else if (fAddBB->GetState()==kButtonUp){
1530 if (!str.Contains("BB")) {
1531 str += "BB";
1532 make=kTRUE;
1533 }
1534 }
1535 if (make) {
1536 DoHistChanges();
1537 }
1538}
1539
1540////////////////////////////////////////////////////////////////////////////////
1541/// Slot connected to the contour level number entry fContLevels.
1542
1544{
1545 if (fAvoidSignal) return;
1548 Update();
1549}
1550
1551////////////////////////////////////////////////////////////////////////////////
1552/// Slot connected to the contour level number entry fContLevels1.
1553
1555{
1556 if (fAvoidSignal) return;
1559 Update();
1560}
1561
1562////////////////////////////////////////////////////////////////////////////////
1563/// Slot connected to the bar width of the bar chart.
1564
1566{
1567 if (fAvoidSignal) return;
1569 Update();
1570}
1571
1572////////////////////////////////////////////////////////////////////////////////
1573/// Slot connected to the bar offset of the bar chart.
1574
1576{
1577 if (fAvoidSignal) return;
1579 Update();
1580}
1581
1582////////////////////////////////////////////////////////////////////////////////
1583/// Slot connected to the rebin slider in case of no ntuple histogram.
1584/// It updates some other widgets related to the rebin slider.
1585
1587{
1588 // Draw the rebinned histogram in case of the delay draw mode
1589 if (fAvoidSignal) return;
1591 if (!fBinHist) {
1592 fBinHist = (TH2*)fHist->Clone("BinHist");
1593 fBinHist->SetDirectory(0); // TH2Editor manages this histogram
1594 }
1595 Int_t nx = fBinHist->GetXaxis()->GetNbins();
1596 Int_t ny = fBinHist->GetYaxis()->GetNbins();
1597 Int_t numx = fBinXSlider->GetPosition();
1598 Int_t numy = fBinYSlider->GetPosition();
1599 Int_t* divx = Dividers(nx);
1600 Int_t* divy = Dividers(ny);
1601 if (divx[0]==2) fBinXSlider->SetPosition(2);
1602 if (divy[0]==2) fBinYSlider->SetPosition(2);
1603 if (divx[0]==2 && divy[0]==2) {
1604 delete [] divx;
1605 delete [] divy;
1606 return;
1607 }
1608 // delete the histogram which is on the screen
1609 fGedEditor->GetPad()->cd();
1610 fHist->Reset();
1613 ny,fBinHist->GetYaxis()->GetXmin(),
1614 fBinHist->GetYaxis()->GetXmax());
1615 fHist->Add(fBinHist);
1617 fHist->Rebin2D(divx[numx], divy[numy]);
1618
1619 //fModel=fHist;
1620
1621 if (divx[0]!=2) {
1622 TAxis* xaxis = fHist->GetXaxis();
1623 Double_t xBinWidth = xaxis->GetBinWidth(1);
1624 xaxis->SetRangeUser(fSldXMin->GetNumber()+xBinWidth/2,
1625 fSldXMax->GetNumber()-xBinWidth/2);
1626 fSliderX->SetRange(1,(Int_t)nx/divx[numx]);
1627 fSliderX->SetPosition(xaxis->FindBin(fSldXMin->GetNumber()+xBinWidth/2),
1628 xaxis->FindBin(fSldXMax->GetNumber()-xBinWidth/2));
1629 // the axis range could be changed a little bit by the Rebin algorithm
1630 fSldXMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
1631 fSldXMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
1632 }
1633 if (divy[0]!=2) {
1634 TAxis* yaxis = fHist->GetYaxis();
1635 Double_t yBinWidth = yaxis->GetBinWidth(1);
1636 yaxis->SetRangeUser(fSldYMin->GetNumber()+yBinWidth/2,
1637 fSldYMax->GetNumber()-yBinWidth/2);
1638 fSliderY->SetRange(1,(Int_t)ny/divy[numy]);
1639 fSliderY->SetPosition(yaxis->FindBin(fSldYMin->GetNumber()+yBinWidth/2),
1640 yaxis->FindBin(fSldYMax->GetNumber()-yBinWidth/2));
1641 fSldYMin->SetNumber(yaxis->GetBinLowEdge(yaxis->GetFirst()));
1642 fSldYMax->SetNumber(yaxis->GetBinUpEdge(yaxis->GetLast()));
1643 }
1646 Update();
1647 delete [] divx;
1648 delete [] divy;
1649 }
1650// fGedEditor->GetPad()->GetCanvas()->Selected(fGedEditor->GetPad(), fHist, 0);
1651 // fModel = fHist;
1652 Refresh(fHist);
1653}
1654
1655////////////////////////////////////////////////////////////////////////////////
1656/// Slot connected to the rebin slider in case of no ntuple histogram.
1657
1659{
1660 if (fAvoidSignal) return;
1661 Int_t* divx = Dividers(fHist->GetXaxis()->GetNbins());
1662 Int_t* divy = Dividers(fHist->GetYaxis()->GetNbins());
1663 if (divx[0]==2 && divy[0]==2 && !fBinHist)
1665 "TH2Editor", "It is not possible to rebin the histogram",
1667 // calling the MessageBox again does NOT work!*/
1668 delete [] divx;
1669 delete [] divy;
1670}
1671
1672////////////////////////////////////////////////////////////////////////////////
1673/// Slot connected to the rebin sliders in case of no ntuple histogram
1674/// does the rebinning of the selected histogram.
1675
1677{
1678 // create a clone in the background, when the slider is moved for 1st time
1679 if (fAvoidSignal) return;
1680 if (!fBinHist /*&& fDelaydraw->GetState()!=kButtonDown*/) {
1681 Int_t* divx = Dividers(fHist->GetXaxis()->GetNbins());
1682 Int_t* divy = Dividers(fHist->GetYaxis()->GetNbins());
1683 // if there is nothing to rebin:
1684 if (divx[0]==2 && divy[0]==2) {
1685 delete [] divx;
1686 delete [] divy;
1687 return;
1688 }
1689 fBinHist = (TH2*)fHist->Clone("BinHist");
1690 fBinHist->SetDirectory(0); // TH2Editor manages this histogram
1691 delete [] divx;
1692 delete [] divy;
1693 }
1694 // if the slider already has been moved and the clone is saved
1695 Int_t nx = fBinHist->GetXaxis()->GetNbins();
1696 Int_t ny = fBinHist->GetYaxis()->GetNbins();
1697 Int_t numx = fBinXSlider->GetPosition();
1698 Int_t numy = fBinYSlider->GetPosition();
1699 if (nx < 1 || ny < 1) return;
1700 Int_t* divx = Dividers(nx);
1701 Int_t* divy = Dividers(ny);
1702 if (divx[0]==2) {
1704 numx=1;
1705 }
1706 if (divy[0]==2) {
1708 numy=1;
1709 }
1710 Int_t maxx = (Int_t)nx/divx[numx];
1711 Int_t maxy = (Int_t)ny/divy[numy];
1712 if (maxx==1) maxx=2;
1713 if (maxy==1) maxy=2;
1714 if (fDelaydraw->GetState()==kButtonUp){
1715 // delete the histogram which is on the screen
1716 fGedEditor->GetPad()->cd();
1717 fHist->Reset();
1720 ny,fBinHist->GetYaxis()->GetXmin(),
1721 fBinHist->GetYaxis()->GetXmax());
1722 fHist->Add(fBinHist);
1724 fHist->Rebin2D(divx[numx], divy[numy]);
1725 //fModel=fHist;
1726 if (divx[0]!=2) {
1727 TAxis* xaxis = fHist->GetXaxis();
1728 Double_t xBinWidth = xaxis->GetBinWidth(1);
1729 // if the user has zoomed into a special area the range will be reset:
1730 xaxis->SetRangeUser(fSldXMin->GetNumber()+xBinWidth/2,
1731 fSldXMax->GetNumber()-xBinWidth/2);
1732 fSliderX->SetRange(1,maxx);
1733 fSliderX->SetPosition(xaxis->FindBin(fSldXMin->GetNumber()+xBinWidth/2),
1734 xaxis->FindBin(fSldXMax->GetNumber()-xBinWidth/2));
1735 // the axis range could be changed a little bit by the Rebin algorithm
1736 fSldXMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
1737 fSldXMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
1739 }
1740 if (divy[0]!=2) {
1741 TAxis* yaxis = fHist->GetYaxis();
1742 Double_t yBinWidth = yaxis->GetBinWidth(1);
1743 yaxis->SetRangeUser(fSldYMin->GetNumber()+yBinWidth/2,
1744 fSldYMax->GetNumber()-yBinWidth/2);
1745 fSliderY->SetRange(1,maxy);
1746 fSliderY->SetPosition(yaxis->FindBin(fSldYMin->GetNumber()+yBinWidth/2),
1747 yaxis->FindBin(fSldYMax->GetNumber()-yBinWidth/2));
1748 fSldYMin->SetNumber(yaxis->GetBinLowEdge(yaxis->GetFirst()));
1749 fSldYMax->SetNumber(yaxis->GetBinUpEdge(yaxis->GetLast()));
1751 }
1752 Update();
1753 }
1754 // set the according NumberEntries
1761 delete [] divx;
1762 delete [] divy;
1763}
1764
1765////////////////////////////////////////////////////////////////////////////////
1766/// Slot connected to the Bin Number Entry for the Rebin.
1767
1769{
1770 if (fAvoidSignal) return;
1771 Int_t i;
1774 Int_t nx = 0;
1775 if (fBinHist) nx = fBinHist->GetXaxis()->GetNbins();
1776 else nx = fHist->GetXaxis()->GetNbins();
1777 Int_t ny = 0;
1778 if (fBinHist) ny = fBinHist->GetYaxis()->GetNbins();
1779 else ny = fHist->GetYaxis()->GetNbins();
1780 if (nx < 2 || ny < 2) return;
1781 // Get the divider of nx/ny which is closest to numx/numy
1782 Int_t *divx = Dividers(nx);
1783 Int_t *divy = Dividers(ny);
1784 Int_t diff = TMath::Abs(numx - divx[1]);
1785 Int_t c = 1; Int_t d = 1;
1786 for (i = 2; i <= divx[0]; i++) {
1787 if ((TMath::Abs(numx - divx[i])) < diff) {
1788 c = i;
1789 diff = TMath::Abs(numx - divx[i]);
1790 }
1791 }
1792 diff = TMath::Abs(numy - divy[1]);
1793 for (i = 2; i <= divy[0]; i++) {
1794 if ((TMath::Abs(numy - divy[i])) < diff) {
1795 d = i;
1796 diff = TMath::Abs(numy - divy[i]);
1797 }
1798 }
1799 if (divx[c]!= fHist->GetXaxis()->GetNbins() ||
1800 divy[d]!= fHist->GetYaxis()->GetNbins()) {
1802 fBinXSlider->SetPosition(divx[0] - c +1);
1804 fBinYSlider->SetPosition(divy[0] - d +1);
1806 else DoBinReleased();
1807 }
1808// fGedEditor->GetPad()->GetCanvas()->Selected(fGedEditor->GetPad(), fHist, 0);
1809// fModel = fHist;
1810 Refresh(fHist);
1811 delete [] divx;
1812 delete [] divy;
1813}
1814
1815////////////////////////////////////////////////////////////////////////////////
1816/// Slot connected to the Apply Button in the Rebinned histogram Window.
1817
1819{
1820 Int_t ret = 0;
1822 "TH2 Editor", "Replace origin histogram with rebinned one?",
1824 if (ret==1) {
1825 if (fBinHist) {
1826 delete fBinHist;
1827 fBinHist = 0;
1828 }
1829 Int_t nx = fHist->GetXaxis()->GetNbins();
1830 Int_t ny = fHist->GetYaxis()->GetNbins();
1831 Int_t *divx = Dividers(nx);
1832 Int_t *divy = Dividers(ny);
1833 Int_t upx = 0, upy = 0;
1834 if (divx[0]-1 <= 1) upx = 2;
1835 else upx = divx[0]-1;
1836 if (divy[0]-1 <= 1) upy = 2;
1837 else upy = divy[0]-1;
1838 fBinXSlider->SetRange(1,upx);
1839 fBinYSlider->SetRange(1,upy);
1840 if (fBinXSlider->GetMaxPosition()==2 && divx[0]==2 )
1842 else fBinXSlider->SetPosition(1);
1843 if (fBinYSlider->GetMaxPosition()==2 && divy[0]==2 )
1845 else fBinYSlider->SetPosition(1);
1848 Update();
1849 delete [] divx;
1850 delete [] divy;
1851 } else if (ret==2) DoCancel();
1852}
1853
1854////////////////////////////////////////////////////////////////////////////////
1855/// Slot connected to the Cancel Button in the Rebinned histogram Window.
1856
1858{
1859 if (fBinHist) {
1860 fGedEditor->GetPad()->cd();
1861 fHist->Reset();
1867 fBinHist->GetYaxis()->GetXmax());
1868 fHist->Add(fBinHist);
1870 fBinHist->GetXaxis()->GetLast());
1872 fBinHist->GetYaxis()->GetLast());
1873
1874 delete fBinHist;
1875 fBinHist = 0;
1876
1879 Int_t* divx = Dividers(fHist->GetXaxis()->GetNbins());
1880 Int_t* divy = Dividers(fHist->GetYaxis()->GetNbins());
1881 if (divx[0]!=2) fBinXSlider->SetPosition(1);
1882 if (divy[0]!=2) fBinYSlider->SetPosition(1);
1883 // Consigning the new Histogram to all other Editors
1884// fGedEditor->GetPad()->GetCanvas()->Selected(fGedEditor->GetPad(), fHist, 0);
1885 Update();
1886 // fModel = fHist;
1887 Refresh(fHist);
1888 delete [] divx;
1889 delete [] divy;
1890 }
1891}
1892
1893
1894////////////////////////////////////////////////////////////////////////////////
1895/// Slot connected to the BinNumber Slider in case of a 'ntuple histogram'.
1896/// It does the rebin.
1897
1899{
1900 if (fAvoidSignal) return;
1901 Double_t oldXOffset = fXOffsetNumberEntry->GetNumber();
1902 Int_t xnumber = fBinXSlider1->GetPosition();
1903 Double_t oldYOffset = fYOffsetNumberEntry->GetNumber();
1904 Int_t ynumber = fBinYSlider1->GetPosition();
1905 if (xnumber==5 && ynumber==5) return;
1906 Int_t xfact = 0;
1907 Int_t yfact = 0;
1908 Int_t xBinNumber = 0;
1909 Int_t yBinNumber = 0;
1910 TAxis* xaxis = fHist->GetXaxis();
1911 TAxis* yaxis = fHist->GetYaxis();
1912 //"compute" the scaling factor:
1913 if (xnumber >= 5) xfact = xnumber - 4;
1914 else xfact = xnumber - 6;
1915 if (ynumber >= 5) yfact = ynumber - 4;
1916 else yfact = ynumber - 6;
1918 if (!player) return;
1919 Int_t nx = xaxis->GetNbins();
1920 Int_t ny = yaxis->GetNbins();
1921 Int_t firstx = xaxis->GetFirst();
1922 Int_t lastx = xaxis->GetLast();
1923 Int_t firsty = yaxis->GetFirst();
1924 Int_t lasty = yaxis->GetLast();
1925 Double_t minx = xaxis->GetBinLowEdge(1); // overall min in user coords
1926 Double_t maxx = xaxis->GetBinUpEdge(nx); // overall max in user coords
1927 Double_t miny = yaxis->GetBinLowEdge(1); // overall min in user coords
1928 Double_t maxy = yaxis->GetBinUpEdge(ny); // overall max in user coords
1929 Double_t rminx = xaxis->GetBinLowEdge(firstx); // recent min in user coords
1930 Double_t rmaxx = xaxis->GetBinUpEdge(lastx); // recent max in user coords
1931 Double_t rminy = yaxis->GetBinLowEdge(firsty); // recent min in user coords
1932 Double_t rmaxy = yaxis->GetBinUpEdge(lasty); // recent max in user coords
1933
1934 ((TH2*)player->GetHistogram())->SetCanExtend(TH1::kNoAxis);
1935 ((TH2*)player->GetHistogram())->Reset();
1936
1937 // Get new Number of bins
1938 if (xfact > 0) xBinNumber = xfact*nx;
1939 if (xfact < 0) xBinNumber = (Int_t) ((-1)*nx/xfact+0.5);
1940 if (xBinNumber < 1) xBinNumber = 1;
1941 if (xBinNumber > 1000) xBinNumber= 1000;
1942 if (yfact > 0) yBinNumber = yfact*ny;
1943 if (yfact < 0) yBinNumber = (Int_t) ((-1)*ny/yfact+0.5);
1944 if (yBinNumber < 1) yBinNumber = 1;
1945 if (yBinNumber > 1000) yBinNumber= 1000;
1946 Double_t xOffset = 1.*fXBinOffsetSld->GetPosition()/100*((maxx-minx)/xBinNumber);
1947 Double_t yOffset = 1.*fYBinOffsetSld->GetPosition()/100*((maxy-miny)/yBinNumber);
1948 // create new histogram - the main job is done by sel->TakeAction()
1949
1950 ((TH2*)player->GetHistogram())->SetBins(xBinNumber, minx-oldXOffset+xOffset,
1951 maxx-oldXOffset+xOffset,
1952 yBinNumber, miny-oldYOffset+yOffset,
1953 maxy-oldYOffset+yOffset);
1954 TSelectorDraw *sel = (TSelectorDraw*)player->GetSelector();
1955 if (!sel) return;
1956 sel->TakeAction();
1957
1958 // Restore and set all the attributes which were changed by TakeAction()
1960 fSliderX->SetRange(1,xBinNumber);
1961 fSliderY->SetRange(1,yBinNumber);
1962 Double_t xBinWidth = xaxis->GetBinWidth(1);
1963 Double_t yBinWidth = yaxis->GetBinWidth(1);
1964 fSliderX->SetPosition(xaxis->FindBin(rminx+xBinWidth/2),
1965 xaxis->FindBin(rmaxx-xBinWidth/2));
1966 fSliderY->SetPosition(yaxis->FindBin(rminy+yBinWidth/2),
1967 yaxis->FindBin(rmaxy-yBinWidth/2));
1968 xOffset = 1.*fXBinOffsetSld->GetPosition()/100*xBinWidth; // nessesary ??
1969 yOffset = 1.*fYBinOffsetSld->GetPosition()/100*yBinWidth; // nessesary ??
1970
1971 // SetRange in BinNumbers along x and y!
1972 xaxis->SetRange(xaxis->FindBin(rminx+xBinWidth/2),
1973 xaxis->FindBin(rmaxx-xBinWidth/2));
1974 yaxis->SetRange(yaxis->FindBin(rminy+yBinWidth/2),
1975 yaxis->FindBin(rmaxy-yBinWidth/2));
1976 fSldXMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
1977 fSldXMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
1978 fSldYMin->SetNumber(yaxis->GetBinLowEdge(yaxis->GetFirst()));
1979 fSldYMax->SetNumber(yaxis->GetBinUpEdge(yaxis->GetLast()));
1980 fBinXNumberEntry1->SetNumber(xaxis->GetLast() - xaxis->GetFirst()+1);
1981 fBinYNumberEntry1->SetNumber(yaxis->GetLast() - yaxis->GetFirst()+1);
1987 xaxis->GetBinWidth(1));
1989 yaxis->GetBinWidth(1));
1991 // when you 2-clicks on a slider, sometimes it gets caught on wrong position! (2 or -2)
1993 // when you 2-clicks on a slider, sometimes it gets caught on wrong position! (2 or -2)
1994 Update();
1995}
1996
1997////////////////////////////////////////////////////////////////////////////////
1998/// Slot connected to the rebin slider in case of an ntuple histogram.
1999/// Updates the BinNumberEntryField during the BinSlider movement.
2000
2002{
2003 if (fAvoidSignal) return;
2004 TAxis* xaxis = fHist->GetXaxis();
2005 TAxis* yaxis = fHist->GetYaxis();
2006 Int_t firstx = xaxis->GetFirst();
2007 Int_t lastx = xaxis->GetLast();
2008 Int_t firsty = yaxis->GetFirst();
2009 Int_t lasty = yaxis->GetLast();
2010 Int_t xnumber = fBinXSlider1->GetPosition();
2011 Int_t ynumber = fBinYSlider1->GetPosition();
2012 Int_t numx = lastx-firstx+1;
2013 Int_t numy = lasty-firsty+1;
2014 Int_t xfact = 0;
2015 Int_t yfact = 0;
2016 Int_t xBinNumber = 0;
2017 Int_t yBinNumber = 0;
2018 if (xnumber >= 5) xfact = xnumber - 4;
2019 else xfact = xnumber - 6;
2020 if (xfact > 0) xBinNumber = xfact*numx;
2021 if (xfact < 0) xBinNumber = (Int_t) ((-1)*numx/xfact+0.5);
2022 if (xBinNumber < 1) xBinNumber = 1;
2023 if (xBinNumber > 1000) xBinNumber= 1000;
2024 if (fBinXNumberEntry1->GetNumber()!=xBinNumber)
2025 fBinXNumberEntry1->SetIntNumber(xBinNumber);
2026
2027 if (ynumber >= 5) yfact = ynumber - 4;
2028 else yfact = ynumber - 6;
2029 if (yfact > 0) yBinNumber = yfact*numy;
2030 if (yfact < 0) yBinNumber = (Int_t) ((-1)*numy/yfact+0.5);
2031 if (yBinNumber < 1) yBinNumber = 1;
2032 if (yBinNumber > 1000) yBinNumber= 1000;
2033 if (fBinYNumberEntry1->GetNumber()!=yBinNumber)
2034 fBinYNumberEntry1->SetIntNumber(yBinNumber);
2035}
2036
2037////////////////////////////////////////////////////////////////////////////////
2038/// Slot connected to the Bin Number Entry for the Rebin.
2039
2041{
2042 if (fAvoidSignal) return;
2043 Double_t oldXOffset = fXOffsetNumberEntry->GetNumber();
2045 Double_t oldYOffset = fYOffsetNumberEntry->GetNumber();
2047 TAxis* xaxis = fHist->GetXaxis();
2048 TAxis* yaxis = fHist->GetYaxis();
2050 if (!player) return;
2051 Int_t firstx = xaxis->GetFirst();
2052 Int_t lastx = xaxis->GetLast();
2053 Int_t firsty = yaxis->GetFirst();
2054 Int_t lasty = yaxis->GetLast();
2055 Int_t nx = xaxis->GetNbins();
2056 Int_t ny = yaxis->GetNbins();
2057 Double_t minx = xaxis->GetBinLowEdge(1); // overall min in user coords
2058 Double_t maxx = xaxis->GetBinUpEdge(nx); // overall max in user coords
2059 Double_t miny = yaxis->GetBinLowEdge(1); // overall min in user coords
2060 Double_t maxy = yaxis->GetBinUpEdge(ny); // overall max in user coords
2061 Double_t rminx = xaxis->GetBinLowEdge(firstx); // recent min in user coords
2062 Double_t rmaxx = xaxis->GetBinUpEdge(lastx); // recent max in user coords
2063 Double_t rminy = yaxis->GetBinLowEdge(firsty); // recent min in user coords
2064 Double_t rmaxy = yaxis->GetBinUpEdge(lasty); // recent max in user coords
2065
2066 ((TH2*)player->GetHistogram())->SetCanExtend(TH1::kNoAxis);
2067 ((TH2*)player->GetHistogram())->Reset();
2068
2069 // Calculate the new number of bins in the complete range
2070 Int_t xBinNumber = (Int_t) ((maxx-minx)/(rmaxx - rminx)*numx + 0.5);
2071 if (xBinNumber < 1) xBinNumber = 1;
2072 if (xBinNumber > 1000) xBinNumber= 1000;
2073 Double_t xOffset = 1.*(fXBinOffsetSld->GetPosition())/100*(maxx-minx)/xBinNumber;
2074 Int_t yBinNumber = (Int_t) ((maxy-miny)/(rmaxy - rminy)*numy + 0.5);
2075 if (yBinNumber < 1) yBinNumber = 1;
2076 if (yBinNumber > 1000) yBinNumber= 1000;
2077 Double_t yOffset = 1.*(fYBinOffsetSld->GetPosition())/100*(maxy-miny)/yBinNumber;
2078 // create new histogram - the main job is done by sel->TakeAction()
2079 ((TH2*)player->GetHistogram())->SetBins(xBinNumber, minx-oldXOffset+xOffset,
2080 maxx-oldXOffset+xOffset,
2081 yBinNumber, miny-oldYOffset+yOffset,
2082 maxy-oldYOffset+yOffset);
2083 TSelectorDraw *sel = (TSelectorDraw*)player->GetSelector();
2084 if (!sel) return;
2085 sel->TakeAction();
2086
2087 // Restore and set all the attributes which were changed by TakeAction()
2089 fSliderX->SetRange(1,xBinNumber);
2090 fSliderY->SetRange(1,yBinNumber);
2091 Double_t xBinWidth = xaxis->GetBinWidth(1);
2092 Double_t yBinWidth = yaxis->GetBinWidth(1);
2093 fSliderX->SetPosition(xaxis->FindBin(rminx+xBinWidth/2),
2094 xaxis->FindBin(rmaxx-xBinWidth/2));
2095 fSliderY->SetPosition(yaxis->FindBin(rminy+yBinWidth/2),
2096 yaxis->FindBin(rmaxy-yBinWidth/2));
2097 xOffset = 1.*fXBinOffsetSld->GetPosition()/100*xBinWidth; //nesessary ??
2098 yOffset = 1.*fYBinOffsetSld->GetPosition()/100*yBinWidth; //nesessary ??
2099
2100 // SetRange in BinNumbers along x and y!
2101 xaxis->SetRange(xaxis->FindBin(rminx+xBinWidth/2),
2102 xaxis->FindBin(rmaxx-xBinWidth/2));
2103 yaxis->SetRange(yaxis->FindBin(rminy+yBinWidth/2),
2104 yaxis->FindBin(rmaxy-yBinWidth/2));
2105 fSldXMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
2106 fSldXMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
2107 fSldYMin->SetNumber(yaxis->GetBinLowEdge(yaxis->GetFirst()));
2108 fSldYMax->SetNumber(yaxis->GetBinUpEdge(yaxis->GetLast()));
2113 Update();
2114}
2115
2116////////////////////////////////////////////////////////////////////////////////
2117/// Slot connected to the OffSetSlider. It saves the OldBinOffset
2118/// (nessesary for delay draw mode).
2119
2121{
2122 if (fAvoidSignal) return;
2125}
2126
2127////////////////////////////////////////////////////////////////////////////////
2128/// Slot connected to the OffSetSlider that
2129/// changes the origin of the histogram inbetween a binwidth;
2130/// rebin the histogram with the new Offset given by the slider.
2131/// problem: histogram with variable binwidth??
2132
2134{
2135 if (fAvoidSignal) return;
2139 TAxis* xaxis = fHist->GetXaxis();
2140 TAxis* yaxis = fHist->GetYaxis();
2141 Double_t xBinWidth = xaxis->GetBinWidth(1);
2142 Double_t yBinWidth = yaxis->GetBinWidth(1);
2143 Double_t xOffset = 1.*numx/100*xBinWidth;
2144 Double_t yOffset = 1.*numy/100*yBinWidth;
2145 Double_t oldXOffset = fOldXOffset;
2146 Double_t oldYOffset = fOldYOffset;
2147 Int_t nx = xaxis->GetNbins();
2148 Int_t ny = yaxis->GetNbins();
2149
2151 if (!player) return;
2152
2153 Int_t firstx = xaxis->GetFirst();
2154 Int_t lastx = xaxis->GetLast();
2155 Int_t firsty = yaxis->GetFirst();
2156 Int_t lasty = yaxis->GetLast();
2157 Double_t minx = xaxis->GetBinLowEdge(1); // overall min in user coords
2158 Double_t maxx = xaxis->GetBinUpEdge(nx); // overall max in user coords
2159 Double_t miny = yaxis->GetBinLowEdge(1); // overall min in user coords
2160 Double_t maxy = yaxis->GetBinUpEdge(ny); // overall max in user coords
2161 Double_t rminx = xaxis->GetBinLowEdge(firstx); // recent min in user coords
2162 Double_t rmaxx = xaxis->GetBinUpEdge(lastx); // recent max in user coords
2163 Double_t rminy = yaxis->GetBinLowEdge(firsty); // recent min in user coords
2164 Double_t rmaxy = yaxis->GetBinUpEdge(lasty); // recent max in user coords
2165
2166 ((TH2*)player->GetHistogram())->SetCanExtend(TH1::kNoAxis);
2167 ((TH2*)player->GetHistogram())->Reset();
2168
2169 ((TH2*)player->GetHistogram())->SetBins(nx, minx-oldXOffset+xOffset,
2170 maxx-oldXOffset+xOffset,
2171 ny, miny-oldYOffset+yOffset,
2172 maxy-oldYOffset+yOffset);
2173 TSelectorDraw *sel = (TSelectorDraw*)player->GetSelector();
2174 if (!sel) return;
2175 sel->TakeAction();
2176
2177 // Restore all the attributes which were changed by TakeAction()
2179
2180 // SetRange in BinNumbers along x and y!
2181 xaxis->SetRange(xaxis->FindBin(rminx+xOffset-oldXOffset+xBinWidth/2),
2182 xaxis->FindBin(rmaxx+xOffset-oldXOffset-xBinWidth/2));
2183 yaxis->SetRange(yaxis->FindBin(rminy+yOffset-oldYOffset+yBinWidth/2),
2184 yaxis->FindBin(rmaxy+yOffset-oldYOffset-yBinWidth/2));
2185 fSldXMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
2186 fSldXMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
2187 fSldYMin->SetNumber(yaxis->GetBinLowEdge(yaxis->GetFirst()));
2188 fSldYMax->SetNumber(yaxis->GetBinUpEdge(yaxis->GetLast()));
2191 Update();
2192 }
2193}
2194
2195////////////////////////////////////////////////////////////////////////////////
2196/// Slot connected to the OffSetSlider.
2197/// It changes the origin of the histogram inbetween a binwidth;
2198/// rebin the histogram with the new offset given by the slider.
2199/// problem: histogram with variable binwidth??
2200
2202{
2203 if (fAvoidSignal) return;
2206 TAxis* xaxis = fHist->GetXaxis();
2207 TAxis* yaxis = fHist->GetYaxis();
2208 Double_t xBinWidth = xaxis->GetBinWidth(1);
2209 Double_t yBinWidth = yaxis->GetBinWidth(1);
2210 Double_t xOffset = 1.*numx/100*xBinWidth;
2211 Double_t yOffset = 1.*numy/100*yBinWidth;
2212 if (fDelaydraw->GetState()==kButtonUp){
2213 Double_t oldXOffset = fXOffsetNumberEntry->GetNumber();
2214 Double_t oldYOffset = fYOffsetNumberEntry->GetNumber();
2215 Int_t nx = xaxis->GetNbins();
2216 Int_t ny = yaxis->GetNbins();
2217
2219 if (!player) return;
2220
2221 Int_t firstx = xaxis->GetFirst();
2222 Int_t lastx = xaxis->GetLast();
2223 Int_t firsty = yaxis->GetFirst();
2224 Int_t lasty = yaxis->GetLast();
2225 Double_t minx = xaxis->GetBinLowEdge(1); // overall min in user coords
2226 Double_t maxx = xaxis->GetBinUpEdge(nx); // overall max in user coords
2227 Double_t miny = yaxis->GetBinLowEdge(1); // overall min in user coords
2228 Double_t maxy = yaxis->GetBinUpEdge(ny); // overall max in user coords
2229 Double_t rminx = xaxis->GetBinLowEdge(firstx); // recent min in user coords
2230 Double_t rmaxx = xaxis->GetBinUpEdge(lastx); // recent max in user coords
2231 Double_t rminy = yaxis->GetBinLowEdge(firsty); // recent min in user coords
2232 Double_t rmaxy = yaxis->GetBinUpEdge(lasty); // recent max in user coords
2233
2234 ((TH2*)player->GetHistogram())->SetCanExtend(TH1::kNoAxis);
2235 ((TH2*)player->GetHistogram())->Reset();
2236
2237 ((TH2*)player->GetHistogram())->SetBins(nx,minx-oldXOffset+xOffset,
2238 maxx-oldXOffset+xOffset,
2239 ny, miny-oldYOffset+yOffset,
2240 maxy-oldYOffset+yOffset);
2241 TSelectorDraw *sel = (TSelectorDraw*)player->GetSelector();
2242 if (!sel) return;
2243 sel->TakeAction();
2244
2245 // Restore all the attributes which were changed by TakeAction()
2247
2248 // SetRange in BinNumbers along x and y!
2249 xaxis->SetRange(xaxis->FindBin(rminx+xOffset-oldXOffset+xBinWidth/2),
2250 xaxis->FindBin(rmaxx+xOffset-oldXOffset-xBinWidth/2));
2251 yaxis->SetRange(yaxis->FindBin(rminy+yOffset-oldYOffset+yBinWidth/2),
2252 yaxis->FindBin(rmaxy+yOffset-oldYOffset-yBinWidth/2));
2253 fSldXMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
2254 fSldXMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
2255 fSldYMin->SetNumber(yaxis->GetBinLowEdge(yaxis->GetFirst()));
2256 fSldYMax->SetNumber(yaxis->GetBinUpEdge(yaxis->GetLast()));
2259 Update();
2260 }
2265}
2266
2267////////////////////////////////////////////////////////////////////////////////
2268/// Slot connected to the OffSetNumberEntry, related to the OffSetSlider
2269/// changes the origin of the histogram inbetween a binwidth.
2270
2272{
2273 if (fAvoidSignal) return;
2274 TAxis* xaxis = fHist->GetXaxis();
2275 TAxis* yaxis = fHist->GetYaxis();
2276 Double_t xBinWidth = xaxis->GetBinWidth(1);
2277 Double_t yBinWidth = yaxis->GetBinWidth(1);
2279 Double_t oldXOffset = 1.*fXBinOffsetSld->GetPosition()/100*xBinWidth;
2281 Double_t oldYOffset = 1.*fYBinOffsetSld->GetPosition()/100*yBinWidth;
2282 Int_t nx = xaxis->GetNbins();
2283 Int_t ny = yaxis->GetNbins();
2285 if (!player) return;
2286 Int_t firstx = xaxis->GetFirst();
2287 Int_t lastx = xaxis->GetLast();
2288 Int_t firsty = yaxis->GetFirst();
2289 Int_t lasty = yaxis->GetLast();
2290 Double_t minx = xaxis->GetBinLowEdge(1); // overall min in user coords
2291 Double_t maxx = xaxis->GetBinUpEdge(nx); // overall max in user coords
2292 Double_t miny = yaxis->GetBinLowEdge(1); // overall min in user coords
2293 Double_t maxy = yaxis->GetBinUpEdge(ny); // overall max in user coords
2294 Double_t rminx = xaxis->GetBinLowEdge(firstx); // recent min in user coords
2295 Double_t rmaxx = xaxis->GetBinUpEdge(lastx); // recent max in user coords
2296 Double_t rminy = yaxis->GetBinLowEdge(firsty); // recent min in user coords
2297 Double_t rmaxy = yaxis->GetBinUpEdge(lasty); // recent max in user coords
2298
2299 ((TH2*)player->GetHistogram())->SetCanExtend(TH1::kNoAxis);
2300 ((TH2*)player->GetHistogram())->Reset();
2301
2302 ((TH2*)player->GetHistogram())->SetBins(nx,minx+xOffset-oldXOffset,
2303 maxx+xOffset-oldXOffset,
2304 ny,miny+yOffset-oldYOffset,
2305 maxy+yOffset-oldYOffset);
2306 TSelectorDraw *sel = (TSelectorDraw*)player->GetSelector();
2307 if (!sel) return;
2308 sel->TakeAction();
2309
2310 // Restore all the attributes which were changed by TakeAction()
2312
2313 // SetRange in BinNumbers along x and y!
2314 xaxis->SetRange(xaxis->FindBin(rminx+xOffset-oldXOffset+xBinWidth/2),
2315 xaxis->FindBin(rmaxx+xOffset-oldXOffset-xBinWidth/2));
2316 yaxis->SetRange(yaxis->FindBin(rminy+yOffset-oldYOffset+yBinWidth/2),
2317 yaxis->FindBin(rmaxy+yOffset-oldYOffset-yBinWidth/2));
2318 fSldXMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
2319 fSldXMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
2320 fXBinOffsetSld->SetPosition((Int_t)(xOffset/xBinWidth*100));
2321 fSldYMin->SetNumber(yaxis->GetBinLowEdge(yaxis->GetFirst()));
2322 fSldYMax->SetNumber(yaxis->GetBinUpEdge(yaxis->GetLast()));
2323 fYBinOffsetSld->SetPosition((Int_t)(yOffset/yBinWidth*100));
2324 Update();
2325}
2326
2327////////////////////////////////////////////////////////////////////////////////
2328/// Slot connected to the x-Slider that redraws the histogram
2329/// with the new slider range.
2330
2332{
2333 if (fAvoidSignal) return;
2334 TAxis* xaxis = fHist->GetXaxis();
2336 // 2D plot
2337 Int_t px1,py1,px2,py2;
2338 Float_t ymin,ymax,xleft,xright;
2339 xleft = xaxis->GetBinLowEdge((Int_t)((fSliderX->GetMinPosition())+0.5));
2340 xright = xaxis->GetBinUpEdge((Int_t)((fSliderX->GetMaxPosition())+0.5));
2343 px1 = fGedEditor->GetPad()->XtoAbsPixel(xleft);
2344 py1 = fGedEditor->GetPad()->YtoAbsPixel(ymin);
2345 px2 = fGedEditor->GetPad()->XtoAbsPixel(xright);
2346 py2 = fGedEditor->GetPad()->YtoAbsPixel(ymax);
2347 if (fGedEditor->GetPad()->GetCanvas())
2349 fGedEditor->GetPad()->cd();
2353 gVirtualX->DrawBox(px1, py1, px2, py2, TVirtualX::kHollow);
2354 fPx1old = px1;
2355 fPy1old = py1;
2356 fPx2old = px2 ;
2357 fPy2old = py2;
2358 gVirtualX->Update(0);
2359 fSldXMin->SetNumber(xleft);
2360 fSldXMax->SetNumber(xright);
2361 } else if (fDelaydraw->GetState()==kButtonDown &&
2364 // 3D plot
2365 Float_t p1[3], p2[3], p3[3], p4[3], p5[3], p6[3], p7[3], p8[3];
2366 if (fGedEditor->GetPad()->GetCanvas())
2368 fGedEditor->GetPad()->cd();
2369 TView *fView = fGedEditor->GetPad()->GetView();
2370 if (!fView) return;
2371 Double_t *rmin = fView->GetRmin();
2372 if (!rmin) return;
2373 Double_t *rmax = fView->GetRmax();
2374 if (!rmax) return;
2375 p1[0] = p4[0] = p5[0] = p8[0] =
2376 xaxis->GetBinLowEdge((Int_t)((fSliderX->GetMinPosition())+0.5));
2377 p2[0] = p3[0] = p6[0] = p7[0] =
2378 xaxis->GetBinUpEdge((Int_t)((fSliderX->GetMaxPosition())+0.5));
2379 p1[1] = p2[1] = p3[1] = p4[1] = rmin[1];
2380 p5[1] = p6[1] = p7[1] = p8[1] = rmax[1];
2381 p1[2] = p2[2] = p5[2] = p6[2] = rmin[2];
2382 p3[2] = p4[2] = p7[2] = p8[2] = rmax[2];
2387 PaintBox3D(p2, p3, p7, p6);
2388 PaintBox3D(p1, p4, p8, p5);
2389 for (Int_t i = 0; i<3; i++){
2390 fP1oldx[i] = p1[i];
2391 fP2oldx[i] = p2[i];
2392 fP3oldx[i] = p3[i];
2393 fP4oldx[i] = p4[i];
2394 fP5oldx[i] = p5[i];
2395 fP6oldx[i] = p6[i];
2396 fP7oldx[i] = p7[i];
2397 fP8oldx[i] = p8[i];
2398 }
2399 fSldXMin->SetNumber(p1[0]);
2400 fSldXMax->SetNumber(p2[0]);
2401 } else if (fDelaydraw->GetState()==kButtonDown &&
2405 } else {
2407 (Int_t)((fSliderX->GetMaxPosition())+0.5));
2408 fSldXMin->SetNumber(xaxis->GetBinLowEdge(xaxis->GetFirst()));
2409 fSldXMax->SetNumber(xaxis->GetBinUpEdge(xaxis->GetLast()));
2411 Update();
2412 }
2415}
2416
2417////////////////////////////////////////////////////////////////////////////////
2418/// Slot connected to the x axis range slider that initialises
2419/// the "virtual" box which is drawn in delay draw mode.
2420
2422{
2423 if (fAvoidSignal) return;
2424 TAxis* xaxis = fHist->GetXaxis();
2425 Float_t ymin,ymax,xleft,xright;
2427 // 2D Plot
2428 if (!fGedEditor->GetPad()) return;
2429 fGedEditor->GetPad()->cd();
2430 if (fGedEditor->GetPad()->GetCanvas())
2434 xleft = xaxis->GetBinLowEdge((Int_t)((fSliderX->GetMinPosition())+0.5));
2435 xright = xaxis->GetBinUpEdge((Int_t)((fSliderX->GetMaxPosition())+0.5));
2438 fPx1old = fGedEditor->GetPad()->XtoAbsPixel(xleft);
2440 fPx2old = fGedEditor->GetPad()->XtoAbsPixel(xright);
2443 } else if (fDelaydraw->GetState()==kButtonDown &&
2446 // 3D plot
2447 if (!fGedEditor->GetPad()) return;
2448 fGedEditor->GetPad()->cd();
2449 TView *fView = fGedEditor->GetPad()->GetView();
2450 if (!fView) return;
2451 Double_t *rmin = fView->GetRmin();
2452 if (!rmin) return;
2453 Double_t *rmax = fView->GetRmax();
2454 if (!rmax) return;
2455 fP1oldx[0] = fP4oldx[0] = fP5oldx[0] = fP8oldx[0] =
2456 xaxis->GetBinLowEdge((Int_t)((fSliderX->GetMinPosition())+0.5));
2457 fP2oldx[0] = fP3oldx[0] = fP6oldx[0] = fP7oldx[0] =
2458 xaxis->GetBinUpEdge((Int_t)((fSliderX->GetMaxPosition())+0.5));
2459 fP1oldx[1] = fP2oldx[1] = fP3oldx[1] = fP4oldx[1] = rmin[1];
2460 fP5oldx[1] = fP6oldx[1] = fP7oldx[1] = fP8oldx[1] = rmax[1];
2461 fP1oldx[2] = fP2oldx[2] = fP5oldx[2] = fP6oldx[2] = rmin[2];
2462 fP3oldx[2] = fP4oldx[2] = fP7oldx[2] = fP8oldx[2] = rmax[2];
2463 if (fGedEditor->GetPad()->GetCanvas())
2469 }
2470}
2471
2472////////////////////////////////////////////////////////////////////////////////
2473/// Slot connected to the x-axis slider finalizing values after
2474/// the slider movement.
2475
2477{
2478 if (fAvoidSignal) return;
2481 (Int_t)((fSliderX->GetMaxPosition())+0.5));
2484 Update();
2485 }
2487 if (player) if (player->GetHistogram() == fHist) {
2488 Int_t last = fHist->GetXaxis()->GetLast();
2491 Update();
2492 }
2493}
2494
2495////////////////////////////////////////////////////////////////////////////////
2496/// Slot connected to the Max/Min number entry fields showing x-axis range.
2497
2499{
2500 TAxis* xaxis = fHist->GetXaxis();
2501 Int_t nx = xaxis->GetNbins();
2502 Double_t width = xaxis->GetBinWidth(1);
2503 if ((fSldXMin->GetNumber()+width/2) < (xaxis->GetBinLowEdge(1)))
2504 fSldXMin->SetNumber(xaxis->GetBinLowEdge(1));
2505 if ((fSldXMax->GetNumber()-width/2) > (xaxis->GetBinUpEdge(nx)))
2506 fSldXMax->SetNumber(xaxis->GetBinUpEdge(nx));
2508 fSldXMax->GetNumber()-width/2);
2509 Int_t nxbinmin = xaxis->GetFirst();
2510 Int_t nxbinmax = xaxis->GetLast();
2511 fSliderX->SetPosition((Double_t)(nxbinmin),(Double_t)(nxbinmax));
2512 Update();
2513}
2514
2515////////////////////////////////////////////////////////////////////////////////
2516/// Slot connected to the x-slider for redrawing the
2517/// histogram with the new slider Range (immediately).
2518
2520{
2521 if (fAvoidSignal) return;
2522 TAxis* yaxis = fHist->GetYaxis();
2524 Int_t px1,py1,px2,py2;
2525 Float_t xmin,xmax,ybottom,ytop;
2526 ybottom = yaxis->GetBinLowEdge((Int_t)((fSliderY->GetMinPosition())+0.5));
2527 ytop = yaxis->GetBinUpEdge((Int_t)((fSliderY->GetMaxPosition())+0.5));
2530 px1 = fGedEditor->GetPad()->XtoAbsPixel(xmin);
2531 py1 = fGedEditor->GetPad()->YtoAbsPixel(ybottom);
2532 px2 = fGedEditor->GetPad()->XtoAbsPixel(xmax);
2533 py2 = fGedEditor->GetPad()->YtoAbsPixel(ytop);
2534 if (fGedEditor->GetPad()->GetCanvas())
2536 fGedEditor->GetPad()->cd();
2540 gVirtualX->DrawBox(px1, py1, px2, py2, TVirtualX::kHollow);
2541 fPx1old = px1;
2542 fPy1old = py1;
2543 fPx2old = px2 ;
2544 fPy2old = py2;
2545 gVirtualX->Update(0);
2546 fSldYMin->SetNumber(ybottom);
2547 fSldYMax->SetNumber(ytop);
2548 } else if (fDelaydraw->GetState()==kButtonDown &&
2551 // 3D plot
2552 Float_t p1[3], p2[3], p3[3], p4[3], p5[3], p6[3], p7[3], p8[3];
2553 if (fGedEditor->GetPad()->GetCanvas())
2555 fGedEditor->GetPad()->cd();
2556 TView *fView = fGedEditor->GetPad()->GetView();
2557 if (!fView) return;
2558 Double_t *rmin = fView->GetRmin();
2559 if (!rmin) return;
2560 Double_t *rmax = fView->GetRmax();
2561 if (!rmax) return;
2562 p1[0] = p2[0] = p3[0] = p4[0] = rmin[0];
2563 p5[0] = p6[0] = p7[0] = p8[0] = rmax[0];
2564 p1[1] = p4[1] = p5[1] = p8[1] =
2565 yaxis->GetBinLowEdge((Int_t)((fSliderY->GetMinPosition())+0.5));
2566 p2[1] = p3[1] = p6[1] = p7[1] =
2567 yaxis->GetBinUpEdge((Int_t)((fSliderY->GetMaxPosition())+0.5));
2568 p1[2] = p2[2] = p5[2] = p6[2] = rmin[2];
2569 p3[2] = p4[2] = p7[2] = p8[2] = rmax[2];
2574 PaintBox3D(p2, p3, p7, p6);
2575 PaintBox3D(p1, p4, p8, p5);
2576 for (Int_t i = 0; i<3; i++) {
2577 fP1oldy[i] = p1[i];
2578 fP2oldy[i] = p2[i];
2579 fP3oldy[i] = p3[i];
2580 fP4oldy[i] = p4[i];
2581 fP5oldy[i] = p5[i];
2582 fP6oldy[i] = p6[i];
2583 fP7oldy[i] = p7[i];
2584 fP8oldy[i] = p8[i];
2585 }
2586 fSldYMin->SetNumber(p1[1]);
2587 fSldYMax->SetNumber(p2[1]);
2588 } else if (fDelaydraw->GetState()==kButtonDown &&
2592 } else {
2593 yaxis->SetRange((Int_t)((fSliderY->GetMinPosition())+0.5),
2594 (Int_t)((fSliderY->GetMaxPosition())+0.5));
2595 fSldYMin->SetNumber(yaxis->GetBinLowEdge(yaxis->GetFirst()));
2596 fSldYMax->SetNumber(yaxis->GetBinUpEdge(yaxis->GetLast()));
2598 Update();
2599 }
2602}
2603
2604////////////////////////////////////////////////////////////////////////////////
2605/// Slot connected to y-axis slider which initialises
2606/// the "virtual" box which is drawn in delay draw mode.
2607
2609{
2610 if (fAvoidSignal) return;
2611 TAxis* yaxis = fHist->GetYaxis();
2612 Float_t xmin,xmax,ytop,ybottom;
2614 // 2D plot:
2615 if (!fGedEditor->GetPad()) return;
2616 fGedEditor->GetPad()->cd();
2617 if (fGedEditor->GetPad()->GetCanvas())
2621 ybottom = yaxis->GetBinLowEdge((Int_t)((fSliderY->GetMinPosition())+0.5));
2622 ytop = yaxis->GetBinUpEdge((Int_t)((fSliderY->GetMaxPosition())+0.5));
2626 fPy1old = fGedEditor->GetPad()->YtoAbsPixel(ybottom);
2630 } else if (fDelaydraw->GetState()==kButtonDown &&
2633 // 3D plot
2634 if (!fGedEditor->GetPad()) return;
2635 fGedEditor->GetPad()->cd();
2636 TView *fView = fGedEditor->GetPad()->GetView();
2637 if (!fView) return;
2638 Double_t *rmin = fView->GetRmin();
2639 if (!rmin) return;
2640 Double_t *rmax = fView->GetRmax();
2641 if (!rmax) return;
2642 fP1oldy[0] = fP2oldy[0] = fP3oldy[0] = fP4oldy[0] = rmin[0];
2643 fP5oldy[0] = fP6oldy[0] = fP7oldy[0] = fP8oldy[0] = rmax[0];
2644 fP1oldy[1] = fP4oldy[1] = fP5oldy[1] = fP8oldy[1] =
2645 yaxis->GetBinLowEdge((Int_t)((fSliderY->GetMinPosition())+0.5));
2646 fP2oldy[1] = fP3oldy[1] = fP6oldy[1] = fP7oldy[1] =
2647 yaxis->GetBinUpEdge((Int_t)((fSliderY->GetMaxPosition())+0.5));
2648 fP1oldy[2] = fP2oldy[2] = fP5oldy[2] = fP6oldy[2] = rmin[2];
2649 fP3oldy[2] = fP4oldy[2] = fP7oldy[2] = fP8oldy[2] = rmax[2];
2650 if (fGedEditor->GetPad()->GetCanvas())
2656 }
2657}
2658
2659////////////////////////////////////////////////////////////////////////////////
2660/// Slot connected to the y-axis slider finalizing values after
2661/// the slider movement.
2662
2664{
2665 if (fAvoidSignal) return;
2668 (Int_t)((fSliderY->GetMaxPosition())+0.5));
2671 Update();
2672 }
2673
2675 if (player) if (player->GetHistogram() == fHist) {
2676 Int_t last = fHist->GetYaxis()->GetLast();
2679 Update();
2680 }
2681}
2682
2683////////////////////////////////////////////////////////////////////////////////
2684/// Slot connected to the Max/Min number entry fields showing y-axis range.
2685
2687{
2688 if (fAvoidSignal) return;
2689 TAxis* yaxis = fHist->GetYaxis();
2690 Int_t ny = yaxis->GetNbins();
2691 Double_t width = yaxis->GetBinWidth(1);
2692
2693 if ((fSldYMin->GetNumber()+width/2) < (yaxis->GetBinLowEdge(1)))
2694 fSldYMin->SetNumber(yaxis->GetBinLowEdge(1));
2695 if ((fSldYMax->GetNumber()-width/2) > (yaxis->GetBinUpEdge(ny)))
2696 fSldYMax->SetNumber(yaxis->GetBinUpEdge(ny));
2697
2699 fSldYMax->GetNumber()-width/2);
2700 Int_t nybinmin = yaxis -> GetFirst();
2701 Int_t nybinmax = yaxis -> GetLast();
2702 fSliderY->SetPosition((Double_t)(nybinmin),(Double_t)(nybinmax));
2703 Update();
2704}
2705
2706////////////////////////////////////////////////////////////////////////////////
2707/// Slot connected to the fill area color.
2708
2710{
2711 if (fAvoidSignal || !fGedEditor->GetPad()) return;
2712 fGedEditor->GetPad()->cd();
2714 Update();
2715}
2716
2717////////////////////////////////////////////////////////////////////////////////
2718/// Slot connected to the fill area pattern.
2719
2721{
2722 if (fAvoidSignal || !fGedEditor->GetPad()) return;
2723 fGedEditor->GetPad()->cd();
2724 fGedEditor->GetPad()->SetFrameFillStyle(pattern);
2725 Update();
2726}
2727
2728////////////////////////////////////////////////////////////////////////////////
2729/// Return the immediate histogram type (HIST, LEGO1-4, SURF1-5).
2730
2732{
2733 TString s="";
2734 switch (fTypeCombo->GetSelected()){
2735 case (-1) : {s = ""; break;}
2736 case (kTYPE_LEGO ): {s = "LEGO"; break;}
2737 case (kTYPE_LEGO1): {s = "LEGO1"; break;}
2738 case (kTYPE_LEGO2): {s = "LEGO2"; break;}
2739 case (kTYPE_LEGO3): {s = "LEGO3"; break;}
2740 case (kTYPE_LEGO4): {s = "LEGO4"; break;}
2741 case (kTYPE_SURF ): {s = "SURF"; break;}
2742 case (kTYPE_SURF1): {s = "SURF1"; break;}
2743 case (kTYPE_SURF2): {s = "SURF2"; break;}
2744 case (kTYPE_SURF3): {s = "SURF3"; break;}
2745 case (kTYPE_SURF4): {s = "SURF4"; break;}
2746 case (kTYPE_SURF5): {s = "SURF5"; break;}
2747 default: break;
2748 }
2749 return s;
2750}
2751
2752////////////////////////////////////////////////////////////////////////////////
2753/// Return the immediate coordinate system of the histogram.
2754/// (POL, CYL, SPH,PSR)
2755
2757{
2758 TString s="";
2759 switch (fCoordsCombo->GetSelected()){
2760 case (-1) : {s = ""; break;}
2761 case (kCOORDS_CAR): {s = ""; break;}
2762 case (kCOORDS_POL): {s = "POL"; break;}
2763 case (kCOORDS_CYL): {s = "CYL"; break;}
2764 case (kCOORDS_SPH): {s = "SPH"; break;}
2765 case (kCOORDS_PSR): {s = "PSR"; break;}
2766 default: break;
2767 }
2768 return s;
2769}
2770
2771////////////////////////////////////////////////////////////////////////////////
2772/// Returns histogram contour option (None,Cont0..5).
2773
2775{
2776 TString s="";
2777 switch (fContCombo->GetSelected()){
2778 case (-1) : {s = ""; break;}
2779 case (kCONT_NONE) : {s = ""; break;}
2780 case (kCONT_0) : {s = "CONT0"; break;}
2781 case (kCONT_1) : {s = "CONT1"; break;}
2782 case (kCONT_2) : {s = "CONT2"; break;}
2783 case (kCONT_3) : {s = "CONT3"; break;}
2784 case (kCONT_4) : {s = "CONT4"; break;}
2785 default: break;
2786 }
2787 return s;
2788}
2789
2790////////////////////////////////////////////////////////////////////////////////
2791/// Return histogram additive options (Arr,Box,Col,Scat,Col,Text,E,Z,FB,BB).
2792
2794{
2795 TString s="";
2796 if (fDim->GetState()==kButtonDown) {
2797 if (fAddArr->GetState()==kButtonDown) s+="ARR";
2798 if (fAddBox->GetState()==kButtonDown) s+="BOX";
2799 if (fAddCol->GetState()==kButtonDown) s+="COL";
2800 if (fAddScat->GetState()==kButtonDown) s+="SCAT";
2801 if (fAddText->GetState()==kButtonDown) s+="TEXT";
2802 if (fAddPalette->GetState()==kButtonDown) s+="Z";
2803 } else if (fDim0->GetState()==kButtonDown){
2804 if (fAddPalette1->GetState()==kButtonDown) s+="Z";
2805 if (fAddError->GetState()==kButtonDown) s+="E";
2806 if (fAddFB->GetState()==kButtonUp) s+="FB";
2807 if (fAddBB->GetState()==kButtonUp) s+="BB";
2808 }
2809 return s;
2810}
2811
2812////////////////////////////////////////////////////////////////////////////////
2813/// Return draw option string related to graphical cut in use.
2814
2816{
2817 TString cutopt = " ";
2818 TString opt = GetDrawOption();
2819 Int_t scut = opt.First('[');
2820 if (scut != -1) {
2821 Int_t ecut = opt.First(']');
2822 cutopt += opt(scut,ecut);
2823 }
2824 return cutopt;
2825}
2826
2827////////////////////////////////////////////////////////////////////////////////
2828/// Create histogram type combo box.
2829
2831{
2832 TGComboBox *c = new TGComboBox(parent, id);
2833
2834 c->AddEntry("Lego" , kTYPE_LEGO);
2835 c->AddEntry("Lego1", kTYPE_LEGO1);
2836 c->AddEntry("Lego2", kTYPE_LEGO2);
2837 c->AddEntry("Lego3", kTYPE_LEGO3);
2838 c->AddEntry("Lego4", kTYPE_LEGO4);
2839 c->AddEntry("Surf" , kTYPE_SURF);
2840 c->AddEntry("Surf1", kTYPE_SURF1);
2841 c->AddEntry("Surf2", kTYPE_SURF2);
2842 c->AddEntry("Surf3", kTYPE_SURF3);
2843 c->AddEntry("Surf4", kTYPE_SURF4);
2844 c->AddEntry("Surf5", kTYPE_SURF5);
2845
2846 return c;
2847}
2848
2849////////////////////////////////////////////////////////////////////////////////
2850/// Create coordinate system combo box.
2851
2853{
2854 TGComboBox *c = new TGComboBox(parent, id);
2855
2856 c->AddEntry("Cartesian", kCOORDS_CAR);
2857 c->AddEntry("Cylindric", kCOORDS_CYL);
2858 c->AddEntry("Polar", kCOORDS_POL);
2859 c->AddEntry("Rapidity", kCOORDS_PSR);
2860 c->AddEntry("Spheric", kCOORDS_SPH);
2861 TGListBox* lb = c->GetListBox();
2862 lb->Resize(lb->GetWidth(), 83);
2863
2864 return c;
2865}
2866
2867////////////////////////////////////////////////////////////////////////////////
2868/// Create contour combo box.
2869
2871{
2872 TGComboBox *c = new TGComboBox(parent, id);
2873
2874 c->AddEntry("None" , kCONT_NONE);
2875 c->AddEntry("Cont0", kCONT_0);
2876 c->AddEntry("Cont1", kCONT_1);
2877 c->AddEntry("Cont2", kCONT_2);
2878 c->AddEntry("Cont3", kCONT_3);
2879 c->AddEntry("Cont4", kCONT_4);
2880
2881 return c;
2882}
2883
2884////////////////////////////////////////////////////////////////////////////////
2885/// Paint a square in 3D.
2886
2888{
2889 fGedEditor->GetPad()->PaintLine3D(p1, p2);
2890 fGedEditor->GetPad()->PaintLine3D(p2, p3);
2891 fGedEditor->GetPad()->PaintLine3D(p3, p4);
2892 fGedEditor->GetPad()->PaintLine3D(p4, p1);
2893}
2894////////////////////////////////////////////////////////////////////////////////
2895/// Give an array of dividers of n (without the trivial divider n))
2896/// in the first entry the number of dividers is saved.
2897
2899{
2900 Int_t* div;
2901 if (n <= 0) {
2902 div = new Int_t[1];
2903 div[0]=0;
2904 } else if (n == 1) {
2905 div = new Int_t[2];
2906 div[0]=div[1]=1;
2907 } else {
2908 div = new Int_t[(Int_t) n/2+2];
2909 div[0]=0;
2910 div[1]=1;
2911
2912 Int_t num = 1;
2913 for (Int_t i=2; i <= n/2; i++) {
2914 if (n % i == 0) {
2915 num++;
2916 div[num] = i;
2917 }
2918 }
2919 num++;
2920 div[num]=n;
2921 div[0] = num;
2922 }
2923 return div;
2924}
2925
2926////////////////////////////////////////////////////////////////////////////////
2927/// Skip TH1Editor in building list of editors.
2928
2930{
2931 fGedEditor->ActivateEditors(TH1::Class()->GetListOfBases(), kTRUE);
2932}
2933
2934////////////////////////////////////////////////////////////////////////////////
2935/// If the contained histogram obj is deleted we must set its pointer to zero
2936
2938{
2939 if (obj == fHist) {
2940 fHist = 0;
2941 }
2942}
2943
@ kChildFrame
Definition GuiTypes.h:379
@ kVerticalFrame
Definition GuiTypes.h:381
@ kFixedWidth
Definition GuiTypes.h:387
@ kFitWidth
Definition GuiTypes.h:386
@ kHorizontalFrame
Definition GuiTypes.h:382
@ kOwnBackground
Definition GuiTypes.h:391
@ kWatch
Definition GuiTypes.h:375
@ kPointer
Definition GuiTypes.h:375
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
#define d(i)
Definition RSha256.hxx:102
#define c(i)
Definition RSha256.hxx:101
int Int_t
Definition RtypesCore.h:45
const Bool_t kFALSE
Definition RtypesCore.h:92
double Double_t
Definition RtypesCore.h:59
short Style_t
Definition RtypesCore.h:80
float Float_t
Definition RtypesCore.h:57
const Bool_t kTRUE
Definition RtypesCore.h:91
#define ClassImp(name)
Definition Rtypes.h:364
@ kPATTERN
@ kCOLOR
include TDocParser_001 C image html pict1_TDocParser_001 png width
@ 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:39
@ kMBYes
Definition TGMsgBox.h:38
@ kMBOk
Definition TGMsgBox.h:40
@ kMBIconExclamation
Definition TGMsgBox.h:31
@ kMBIconQuestion
Definition TGMsgBox.h:30
@ kScaleBoth
Definition TGSlider.h:62
@ kSlider1
Definition TGSlider.h:56
@ kTYPE_SURF2
@ kTYPE_SURF5
@ kCOORDS_PSR
@ kTYPE_SURF
@ kTYPE_LEGO
@ kTYPE_SURF3
@ kTYPE_LEGO2
@ kTYPE_SURF1
@ kCOORDS_CAR
@ kDIM_COMPLEX
@ kCOORDS_POL
@ kTYPE_SURF4
@ kCOORD_TYPE
@ kBAR_OFFSET
@ kCOORDS_SPH
@ kCOORDS_CYL
@ kDELAYED_DRAWING
@ kTYPE_LEGO1
@ kHIST_TYPE
@ kDIM_SIMPLE
@ kBAR_WIDTH
ETH2Wid
@ kTYPE_SURF2
@ kSLIDERX_MAX
@ kBINYSLIDER
@ kSLIDERX_MIN
@ kTYPE_SURF5
@ kBACKBOX_ONOFF
@ kCONT_1
@ kERROR_ONOFF
@ kCOORDS_PSR
@ kYBINOFFSET
@ kPALETTE_ONOFF1
@ kTYPE_SURF
@ kTYPE_LEGO
@ kTYPE_SURF3
@ kTYPE_LEGO3
@ kCONT_4
@ kTYPE_LEGO2
@ kCONT_TYPE
@ kARROW_ONOFF
@ kPATTERN
@ kTYPE_SURF1
@ kCOORDS_CAR
@ kCONT_LEVELS1
@ kTYPE_LEGO4
@ kCONT_2
@ kSLIDERY_MAX
@ kDIM_COMPLEX
@ kPALETTE_ONOFF
@ kCOORDS_POL
@ kTYPE_SURF4
@ kCOORD_TYPE
@ kCONT_0
@ kBINXSLIDER1
@ kBAR_OFFSET
@ kCONT_NONE
@ kBOX_ONOFF
@ kSLIDERY_MIN
@ kBINXSLIDER
@ kCOORDS_SPH
@ kCONT_LEVELS
@ kCOLOR
@ kCOORDS_CYL
@ kDELAYED_DRAWING
@ kBINYSLIDER1
@ kCOL_ONOFF
@ kFRONTBOX_ONOFF
@ kSCAT_ONOFF
@ kTEXT_ONOFF
@ kXBINOFFSET
@ kTYPE_LEGO1
@ kTH2_TITLE
@ kHIST_TYPE
@ kDIM_SIMPLE
@ kCONT_3
@ kBAR_WIDTH
float xmin
float ymin
float xmax
float ymax
#define gROOT
Definition TROOT.h:406
#define gPad
#define gVirtualX
Definition TVirtualX.h:338
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition TAttLine.h:43
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition TAttLine.h:40
Color_t GetFrameFillColor() const
Definition TAttPad.h:53
void SetFrameFillColor(Color_t color=1)
Definition TAttPad.h:73
void SetFrameFillStyle(Style_t styl=0)
Definition TAttPad.h:75
Style_t GetFrameFillStyle() const
Definition TAttPad.h:55
Class to manage histogram axis.
Definition TAxis.h:30
Double_t GetXmax() const
Definition TAxis.h:134
virtual Int_t FindBin(Double_t x)
Find bin number corresponding to abscissa x.
Definition TAxis.cxx:293
virtual Double_t GetBinLowEdge(Int_t bin) const
Return low edge of bin.
Definition TAxis.cxx:518
Int_t GetLast() const
Return last bin on the axis i.e.
Definition TAxis.cxx:469
Double_t GetXmin() const
Definition TAxis.h:133
Int_t GetNbins() const
Definition TAxis.h:121
virtual void SetRangeUser(Double_t ufirst, Double_t ulast)
Set the viewing range for the axis from ufirst to ulast (in user coordinates, that is,...
Definition TAxis.cxx:946
virtual void SetRange(Int_t first=0, Int_t last=0)
Set the viewing range for the axis using bin numbers.
Definition TAxis.cxx:920
virtual Double_t GetBinWidth(Int_t bin) const
Return bin width.
Definition TAxis.cxx:540
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
Definition TAxis.cxx:528
Int_t GetFirst() const
Return first bin on the axis i.e.
Definition TAxis.cxx:458
virtual void Selected(TVirtualPad *pad, TObject *obj, Int_t event)
Emit Selected() signal.
Definition TCanvas.cxx:1641
void FeedbackMode(Bool_t set)
Turn rubberband feedback mode on or off.
Definition TCanvas.cxx:1120
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:398
virtual EButtonState GetState() const
Definition TGButton.h:112
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set button state.
Definition TGButton.cxx:188
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set check button state.
const TGWindow * GetDefaultRoot() const
Returns the root (i.e.
Definition TGClient.cxx:233
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition TGClient.cxx:371
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...
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1102
virtual void Layout()
Layout the elements of the composite frame.
Definition TGFrame.cxx:1242
virtual void ChangeOptions(UInt_t options)
Change composite frame options. Options is an OR of the EFrameTypes.
Definition TGFrame.cxx:1028
virtual void ShowFrame(TGFrame *f)
Show sub frame.
Definition TGFrame.cxx:1189
virtual void HideFrame(TGFrame *f)
Hide sub frame.
Definition TGFrame.cxx:1175
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:215
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition TGFrame.cxx:590
Bool_t Contains(Int_t x, Int_t y) const
Definition TGFrame.h:262
UInt_t GetWidth() const
Definition TGFrame.h:248
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.
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:449
virtual void SetEnabled(Int_t tabIndex, Bool_t on=kTRUE)
Enable or disable tab.
Definition TGTab.cxx:437
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:509
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:82
virtual const TGWindow * GetMainFrame() const
Returns top level main frame.
Definition TGWindow.cxx:151
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
Definition TGWindow.cxx:335
TGTab * GetTab() const
Definition TGedEditor.h:83
void ActivateEditors(TList *bcl, Bool_t recurse)
Searches GedFrames for classes in the given list.
virtual TCanvas * GetCanvas() const
Definition TGedEditor.h:87
virtual TVirtualPad * GetPad() const
Definition TGedEditor.h:88
virtual Option_t * GetDrawOption() const
Get draw options of the selected object.
Definition TGedFrame.cxx:81
TGedEditor * fGedEditor
Definition TGedFrame.h:55
virtual TGVerticalFrame * CreateEditorTabSubFrame(const char *name)
Create a vertical frame to be used by 'owner' in extra tab 'name'.
virtual void SetDrawOption(Option_t *option="")
Set drawing option for object.
Bool_t fInit
Definition TGedFrame.h:54
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.
virtual void Update()
Update the current pad when an attribute is changed via GUI.
Definition TGedFrame.cxx:73
Bool_t fAvoidSignal
Definition TGedFrame.h:57
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:8777
virtual void SetTitle(const char *title)
See GetStatOverflows for more information.
Definition TH1.cxx:6678
virtual void SetBarOffset(Float_t offset=0.25)
Set the bar offset as fraction of the bin width for drawing mode "B".
Definition TH1.h:359
virtual Float_t GetBarWidth() const
Definition TH1.h:256
virtual Float_t GetBarOffset() const
Definition TH1.h:255
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
Definition TH1.h:320
TObject * Clone(const char *newname=0) const
Make a complete copy of the underlying object.
Definition TH1.cxx:2740
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:822
TAxis * GetYaxis()
Definition TH1.h:321
virtual void SetContour(Int_t nlevels, const Double_t *levels=0)
Set the number and values of contour levels.
Definition TH1.cxx:8331
virtual Double_t GetEntries() const
Return the current number of entries.
Definition TH1.cxx:4386
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:6609
@ kNoAxis
NOTE: Must always be 0 !!!
Definition TH1.h:71
virtual void SetBins(Int_t nx, Double_t xmin, Double_t xmax)
Redefine x axis parameters.
Definition TH1.cxx:8607
virtual Int_t GetContour(Double_t *levels=0)
Return contour values into array levels if pointer levels is non zero.
Definition TH1.cxx:8259
virtual void SetBarWidth(Float_t width=0.5)
Set the width of bars as fraction of the bin width for drawing mode "B".
Definition TH1.h:360
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.
TGNumberEntry * fContLevels1
Definition TH2Editor.h:75
virtual void DoBarWidth()
Slot connected to the bar width of the bar chart.
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.
virtual void DoBinReleased()
Slot connected to the rebin slider in case of no ntuple histogram.
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.
TGCompositeFrame * fBinXCont
Definition TH2Editor.h:78
virtual void DoBinPressed()
Slot connected to the rebin slider in case of no ntuple histogram.
TGDoubleHSlider * fSliderY
Definition TH2Editor.h:99
void CreateBinTab()
Create the Binning tab.
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.
TGCompositeFrame * f6
Definition TH2Editor.h:59
virtual void DoAddError(Bool_t on)
Slot connected to the "Error" check button.
virtual void DoAddArr(Bool_t on)
Slot connected to the "Arrow draw option" check button.
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.
TGCheckButton * fAddPalette1
Definition TH2Editor.h:66
TGCompositeFrame * f38
Definition TH2Editor.h:63
virtual void DoFillPattern(Style_t)
Slot connected to the fill area pattern.
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.
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...
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.
void PaintBox3D(Float_t *p1, Float_t *p2, Float_t *p3, Float_t *p4)
Paint a square in 3D.
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.
virtual void DoContLevel()
Slot connected to the contour level number entry fContLevels.
virtual void DoContLevel1()
Slot connected to the contour level number entry fContLevels1.
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.
TGRadioButton * fDim0
Definition TH2Editor.h:56
virtual void DoHistChanges()
Slot connected to histogram type, coordinate system, contour combo box.
virtual void ConnectSignals2Slots()
Connect signals to slots.
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.
Int_t fTitlePrec
Definition TH2Editor.h:53
TGLabel * fColContLbl
Definition TH2Editor.h:51
TGNumberEntry * fContLevels
Definition TH2Editor.h:74
TString GetHistTypeLabel()
Return the immediate histogram type (HIST, LEGO1-4, SURF1-5).
TGedPatternSelect * fFramePattern
Definition TH2Editor.h:104
TGCheckButton * fDelaydraw
Definition TH2Editor.h:102
TGHSlider * fBinXSlider1
Definition TH2Editor.h:86
Float_t fP2oldy[3]
Definition TH2Editor.h:135
Float_t fP8oldx[3]
Definition TH2Editor.h:133
</