ROOT  6.06/09
Reference Guide
TParallelCoordEditor.cxx
Go to the documentation of this file.
1 // @(#)root/treeviewer:$Id$
2 // Author: Bastien Dalla Piazza 02/08/2007
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #include "TParallelCoordEditor.h"
13 #include "TParallelCoord.h"
14 #include "TParallelCoordRange.h"
15 #include "TParallelCoordVar.h"
16 
17 #include "TGFrame.h"
18 #include "TGButton.h"
19 #include "TGButtonGroup.h"
20 #include "TGNumberEntry.h"
21 #include "TGLabel.h"
22 #include "TGTextEntry.h"
23 #include "TGComboBox.h"
24 #include "TGColorSelect.h"
25 #include "TColor.h"
26 #include "TG3DLine.h"
27 #include "TGSlider.h"
28 #include "TGComboBox.h"
29 #include "TGDoubleSlider.h"
30 #include "TTree.h"
31 #include "TGListBox.h"
32 #include "TGedPatternSelect.h"
33 #include "TPad.h"
34 #include "TCanvas.h"
35 
36 #include "Riostream.h"
37 
38 #include "TROOT.h"
39 
41 
42 
43 /** \class TParallelCoordEditor
44 
45 This is the TParallelCoord editor. It brings tools to explore datas
46 Using parallel coordinates. The main tools are:
47 
48  - Dots spacing : Set the dots spacing with whichone the lines
49  must be drawn. This tool is useful to reduce the image
50  cluttering.
51  - The Selections section : Set the current edited selection and
52  allows to apply it to the tree through a generated entry list.
53  - The Entries section : Set how many events must be drawn.
54  A weight cut can be defioned here (see TParallelCoord for a
55  a description of the weight cut).
56  - The Variables tab : To define the global settings to display
57  the axes. It is also possible to add a variable from its
58  expression or delete a selected one (also possible using right
59  click on the pad.
60 */
61 
62 enum EParallelWid {
63  kGlobalLineColor,
64  kLineTypeBgroup,
65  kLineTypePoly,
66  kLineTypeCurves,
67  kGlobalLineWidth,
68  kDotsSpacing,
69  kDotsSpacingField,
70  kAlpha,
71  kAlphaField,
72  kSelectionSelect,
73  kSelectLineColor,
74  kSelectLineWidth,
75  kActivateSelection,
76  kDeleteSelection,
77  kAddSelection,
78  kAddSelectionEntry,
79  kShowRanges,
80  kPaintEntries,
81  kEntriesToDraw,
82  kFirstEntry,
83  kNentries,
84  kApplySelect,
85  kUnApply,
86  kDelayDrawing,
87  kHideAllRanges,
88  kVariables,
89  kDeleteVar,
90  kHistHeight,
91  kHistWidth,
92  kHistBinning,
93  kRenameVar,
94  kWeightCut,
95  kHistColorSelect,
96  kHistPatternSelect
97 };
98 
99 ////////////////////////////////////////////////////////////////////////////////
100 /// Normal constructor.
101 
103  Int_t/*width*/, Int_t /*height*/,
104  UInt_t /*options*/, Pixel_t /*back*/)
105 {
106  fPriority = 1;
107  fDelay = kTRUE;
108 
109  // Line
110  MakeTitle("Line");
111 
113  fGlobalLineColor = new TGColorSelect(f1,0,kGlobalLineColor);
115  fGlobalLineWidth = new TGLineWidthComboBox(f1, kGlobalLineWidth);
116  fGlobalLineWidth->Resize(91, 20);
117  f1->AddFrame(fGlobalLineWidth, new TGLayoutHints(kLHintsLeft, 3, 1, 1, 1));
119 
120  if (!TCanvas::SupportAlpha()) {
121 
122  AddFrame(new TGLabel(this,"Dots spacing"),
124 
126  fDotsSpacing = new TGHSlider(f2,100,kSlider2|kScaleNo,kDotsSpacing);
127  fDotsSpacing->SetRange(0,60);
129  fDotsSpacingField = new TGNumberEntryField(f2, kDotsSpacingField, 0,
132  fDotsSpacingField->Resize(40,20);
135  }
136  else {
137  TGLabel *AlphaLabel = new TGLabel(this,"Opacity");
138  AddFrame(AlphaLabel,
140  TGHorizontalFrame *f2a = new TGHorizontalFrame(this);
141  fAlpha = new TGHSlider(f2a,100,kSlider2|kScaleNo,kAlpha);
142  fAlpha->SetRange(0,1000);
144  fAlphaField = new TGNumberEntryField(f2a, kAlphaField, 0,
147  fAlphaField->Resize(40,20);
150  }
151 
152  fLineTypeBgroup = new TGButtonGroup(this,2,1,0,0, "Line type");
154  fLineTypePoly = new TGRadioButton(fLineTypeBgroup,"Polyline", kLineTypePoly);
155  fLineTypePoly->SetToolTipText("Draw the entries with a polyline");
157  kLineTypeCurves);
158  fLineTypeCurves->SetToolTipText("Draw the entries with a curve");
161 
162  // Selections
163  MakeTitle("Selections");
164 
165  fHideAllRanges = new TGCheckButton(this,"Hide all ranges",kHideAllRanges);
167 
168  fSelectionSelect = new TGComboBox(this,kSelectionSelect);
169  fSelectionSelect->Resize(140,20);
171 
172  TGHorizontalFrame *f3 = new TGHorizontalFrame(this);
173  fSelectLineColor = new TGColorSelect(f3,0,kSelectLineColor);
175  fSelectLineWidth = new TGLineWidthComboBox(f3, kSelectLineWidth);
176  fSelectLineWidth->Resize(94, 20);
177  f3->AddFrame(fSelectLineWidth, new TGLayoutHints(kLHintsLeft, 3, 1, 1, 1));
178  AddFrame(f3, new TGLayoutHints(kLHintsLeft | kLHintsTop,0,0,3,0));
179 
180  fActivateSelection = new TGCheckButton(this,"Activate",kActivateSelection);
181  fActivateSelection->SetToolTipText("Activate the current selection");
183  fShowRanges = new TGCheckButton(this,"Show ranges",kShowRanges);
185 
186  TGHorizontalFrame *f5 = new TGHorizontalFrame(this);
188  fAddSelectionField->Resize(57,20);
190  fAddSelection = new TGTextButton(f5,"Add");
191  fAddSelection->SetToolTipText("Add a new selection (Right click on the axes to add a range).");
193  fDeleteSelection = new TGTextButton(f5,"Delete",kDeleteSelection);
194  fDeleteSelection->SetToolTipText("Delete the current selection");
196  AddFrame(f5, new TGLayoutHints(kLHintsLeft | kLHintsCenterY,3,0,0,0));
197 
198  TGHorizontalFrame *f7 = new TGHorizontalFrame(this);
199  fApplySelect = new TGTextButton(f7,"Apply to tree",kApplySelect);
200  fApplySelect->SetToolTipText("Generate an entry list for the current selection and apply it to the tree.");
201  f7->AddFrame(fApplySelect);
202  fUnApply = new TGTextButton(f7,"Reset tree",kUnApply);
203  fUnApply->SetToolTipText("Reset the tree entry list");
205  AddFrame(f7, new TGLayoutHints(kLHintsLeft | kLHintsCenterY,0,0,3,0));
206 
207  // Entries
208  MakeTitle("Entries");
209 
210  fPaintEntries = new TGCheckButton(this,"Draw entries",kPaintEntries);
212  fDelayDrawing = new TGCheckButton(this,"Delay Drawing", kDelayDrawing);
214 
215  fEntriesToDraw = new TGDoubleHSlider(this,140,kDoubleScaleNo,kEntriesToDraw);
217 
218  TGHorizontalFrame *f6 = new TGHorizontalFrame(this);
220  TGVerticalFrame *v2 = new TGVerticalFrame(f6);
221  v1->AddFrame(new TGLabel(v1,"First entry:"));
222  fFirstEntry = new TGNumberEntryField(v1, kFirstEntry, 0,
225  fFirstEntry->Resize(68,20);
226  v1->AddFrame(fFirstEntry);
227  v2->AddFrame(new TGLabel(v2,"# of entries:"));
228  fNentries = new TGNumberEntryField(v2, kFirstEntry, 0,
231  fNentries->Resize(68,20);
232  v2->AddFrame(fNentries);
233  f6->AddFrame(v1);
234  f6->AddFrame(v2, new TGLayoutHints(kLHintsLeft,4,0,0,0));
235  AddFrame(f6);
236 
237  AddFrame(new TGLabel(this,"Weight cut:"));
238 
239  TGHorizontalFrame *f8 = new TGHorizontalFrame(this);
240  fWeightCut = new TGHSlider(f8,100,kSlider2|kScaleNo,kDotsSpacing);
241  fWeightCutField = new TGNumberEntryField(f8,kDotsSpacingField, 0,
244  fWeightCutField->Resize(40,20);
245  f8->AddFrame(fWeightCut);
247  AddFrame(f8);
248 
250 }
251 
252 ////////////////////////////////////////////////////////////////////////////////
253 /// Make the "variable" tab.
254 
256 {
257  fVarTab = CreateEditorTabSubFrame("Variables");
258  // Variable
259 
261  fAddVariable = new TGTextEntry(f9);
262  fAddVariable->Resize(71,20);
264  fButtonAddVar = new TGTextButton(f9,"Add");
265  fButtonAddVar->SetToolTipText("Add a new variable from the tree (must be a valid expression).");
267  fVarTab->AddFrame(f9);
268 
270  fVariables = new TGComboBox(f10,kVariables);
271  fVariables->Resize(105,20);
273  fVarTab->AddFrame(f10,new TGLayoutHints(kLHintsLeft,0,0,2,0));
274 
276  fDeleteVar = new TGTextButton(f12,"Delete",kDeleteVar);
277  fDeleteVar->SetToolTipText("Delete the current selected variable");
278  f12->AddFrame(fDeleteVar, new TGLayoutHints(kLHintsCenterY,1,0,0,0));
279  fRenameVar = new TGTextButton(f12,"Rename",kRenameVar);
280  fRenameVar->SetToolTipText("Rename the current selected variable");
281  f12->AddFrame(fRenameVar, new TGLayoutHints(kLHintsCenterY,4,0,0,0));
282  fVarTab->AddFrame(f12,new TGLayoutHints(kLHintsLeft,0,0,2,0));
283 
284  fVarTab->AddFrame(new TGLabel(fVarTab,"Axis histograms:"));
285 
287  TGVerticalFrame *v3 = new TGVerticalFrame(f11);
288  TGVerticalFrame *v4 = new TGVerticalFrame(f11);
289  v3->AddFrame(new TGLabel(v3,"Binning:"));
290  fHistBinning = new TGNumberEntryField(v3, kHistWidth, 0,
293  fHistBinning->Resize(68,20);
294  v3->AddFrame(fHistBinning);
295  v4->AddFrame(new TGLabel(v4,"Width:"));
296  fHistWidth = new TGNumberEntryField(v4, kHistWidth, 0,
299  fHistWidth->Resize(68,20);
300  v4->AddFrame(fHistWidth, new TGLayoutHints(kLHintsLeft,4,0,0,0));
301  f11->AddFrame(v3);
302  f11->AddFrame(v4);
303  fVarTab->AddFrame(f11);
304 
305  fHistShowBoxes = new TGCheckButton(fVarTab,"Show box histograms");
307 
308  fVarTab->AddFrame(new TGLabel(fVarTab,"Bar histograms style:"));
309 
311  fHistColorSelect = new TGColorSelect(f13, 0, kHistColorSelect);
312  f13->AddFrame(fHistColorSelect, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
314  fHistPatternSelect = new TGedPatternSelect(f13, 1, kHistPatternSelect);
315  f13->AddFrame(fHistPatternSelect, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
317  fVarTab->AddFrame(f13, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
318 }
319 
320 ////////////////////////////////////////////////////////////////////////////////
321 /// Destructor.
322 
324 {
325  delete fLineTypePoly;
326  delete fLineTypeCurves;
327 }
328 
329 ////////////////////////////////////////////////////////////////////////////////
330 /// Clean up the selection combo box.
331 
333 {
334  TList *list = fParallel->GetSelectList();
336  Bool_t enable = list->GetSize() > 0;
337  fSelectionSelect->SetEnabled(enable);
338  fSelectLineColor->SetEnabled(enable);
339  fSelectLineWidth->SetEnabled(enable);
341  fShowRanges->SetEnabled(enable);
342  fDeleteSelection->SetEnabled(enable);
343  if (list->GetSize() > 0) {
344  Int_t i = 0;
345  TIter next(list);
347  while ((sel = (TParallelCoordSelect*)next())) {
350  if (entry)
352  ++i;
353  }
355  if (sel) {
356  fSelectionSelect->Select(list->IndexOf(sel),kFALSE);
357  Color_t c;
358  Pixel_t p;
359  c = sel->GetLineColor();
360  p = TColor::Number2Pixel(c);
365  }
366  }
367 }
368 
369 ////////////////////////////////////////////////////////////////////////////////
370 /// Clean up the variables combo box.
371 
373 {
374  TList *list = fParallel->GetVarList();
376  Bool_t enable = list->GetSize() > 0;
377  fVariables->SetEnabled(enable);
378  fDeleteVar->SetEnabled(enable);
379  fHistShowBoxes->SetEnabled(enable);
380  fHistWidth->SetEnabled(enable);
381  fHistBinning->SetEnabled(enable);
382  if (list->GetSize() > 0) {
383  Int_t i = 0;
384  TIter next(list);
385  TParallelCoordVar* var;
386  while ((var = (TParallelCoordVar*)next())) {
387  fVariables->AddEntry(var->GetTitle(),i);
388  ++i;
389  }
390  var = (TParallelCoordVar*)list->First();
395  }
396 }
397 
398 ////////////////////////////////////////////////////////////////////////////////
399 /// Connect signals to slots.
400 
402 {
403  fGlobalLineColor->Connect("ColorSelected(Pixel_t)","TParallelCoordEditor",
404  this, "DoGlobalLineColor(Pixel_t)");
405  fGlobalLineWidth->Connect("Selected(Int_t)","TParallelCoordEditor",
406  this, "DoGlobalLineWidth(Int_t)");
407  if (!TCanvas::SupportAlpha()) {
408  fDotsSpacing->Connect("Released()","TParallelCoordEditor",
409  this, "DoDotsSpacing()");
410  fDotsSpacing->Connect("PositionChanged(Int_t)","TParallelCoordEditor",
411  this, "DoLiveDotsSpacing(Int_t)");
412  fDotsSpacingField->Connect("ReturnPressed()","TParallelCoordEditor",
413  this, "DoDotsSpacingField()");
414  }
415  else {
416  fAlpha->Connect("Released()","TParallelCoordEditor",
417  this, "DoAlpha()");
418  fAlpha->Connect("PositionChanged(Int_t)","TParallelCoordEditor",
419  this, "DoLiveAlpha(Int_t)");
420  fAlphaField->Connect("ReturnPressed()","TParallelCoordEditor",
421  this, "DoAlphaField()");
422  }
423  fLineTypeBgroup->Connect("Clicked(Int_t)", "TParallelCoordEditor",
424  this, "DoLineType()");
425  fSelectionSelect->Connect("Selected(const char*)","TParallelCoordEditor",
426  this, "DoSelectionSelect(const char*)");
427  fSelectLineColor->Connect("ColorSelected(Pixel_t)","TParallelCoordEditor",
428  this, "DoSelectLineColor(Pixel_t)");
429  fSelectLineWidth->Connect("Selected(Int_t)","TParallelCoordEditor",
430  this, "DoSelectLineWidth(Int_t)");
431  fActivateSelection->Connect("Toggled(Bool_t)","TParallelCoordEditor",
432  this, "DoActivateSelection(Bool_t)");
433  fShowRanges->Connect("Toggled(Bool_t)","TParallelCoordEditor",
434  this, "DoShowRanges(Bool_t)");
435  fDeleteSelection->Connect("Clicked()","TParallelCoordEditor",
436  this, "DoDeleteSelection()");
437  fAddSelection->Connect("Clicked()","TParallelCoordEditor",
438  this, "DoAddSelection()");
439  fPaintEntries->Connect("Toggled(Bool_t)","TParallelCoordEditor",
440  this, "DoPaintEntries(Bool_t)");
441  fEntriesToDraw->Connect("Released()","TParallelCoordEditor",
442  this, "DoEntriesToDraw()");
443  fEntriesToDraw->Connect("PositionChanged()","TParallelCoordEditor",
444  this, "DoLiveEntriesToDraw()");
445  fFirstEntry->Connect("ReturnPressed()","TParallelCoordEditor",
446  this, "DoFirstEntry()");
447  fNentries->Connect("ReturnPressed()","TParallelCoordEditor",
448  this, "DoNentries()");
449  fApplySelect->Connect("Clicked()","TParallelCoordEditor",
450  this, "DoApplySelect()");
451  fUnApply->Connect("Clicked()","TParallelCoordEditor",
452  this, "DoUnApply()");
453  fDelayDrawing->Connect("Toggled(Bool_t)","TParallelCoordEditor",
454  this, "DoDelayDrawing(Bool_t)");
455  fAddVariable->Connect("ReturnPressed()","TParallelCoordEditor",
456  this, "DoAddVariable()");
457  fButtonAddVar->Connect("Clicked()","TParallelCoordEditor",
458  this, "DoAddVariable()");
459  fHideAllRanges->Connect("Toggled(Bool_t)","TParallelCoordEditor",
460  this, "DoHideAllRanges(Bool_t)");
461  fVariables->Connect("Selected(const char*)","TParallelCoordEditor",
462  this, "DoVariableSelect(const char*)");
463  fDeleteVar->Connect("Clicked()","TParallelCoordEditor",
464  this, "DoDeleteVar()");
465  fHistWidth->Connect("ReturnPressed()","TParallelCoordEditor",
466  this, "DoHistWidth()");
467  fHistBinning->Connect("ReturnPressed()","TParallelCoordEditor",
468  this, "DoHistBinning()");
469  fWeightCut->Connect("Released()","TParallelCoordEditor",
470  this, "DoWeightCut()");
471  fWeightCut->Connect("PositionChanged(Int_t)","TParallelCoordEditor",
472  this, "DoLiveWeightCut(Int_t)");
473  fWeightCutField->Connect("ReturnPressed()","TParallelCoordEditor",
474  this, "DoWeightCut()");
475  fHistColorSelect->Connect("ColorSelected(Pixel_t)", "TParallelCoordEditor",
476  this, "DoHistColorSelect(Pixel_t)");
477  fHistPatternSelect->Connect("PatternSelected(Style_t)", "TParallelCoordEditor",
478  this, "DoHistPatternSelect(Style_t)");
479  fHistShowBoxes->Connect("Toggled(Bool_t)","TParallelCoordEditor",
480  this, "DoHistShowBoxes(Bool_t)");
481 
482  fInit = kFALSE;
483 }
484 
485 ////////////////////////////////////////////////////////////////////////////////
486 /// Slot to activate or not a selection.
487 
489 {
490  if (fAvoidSignal) return;
491 
493  if (sel) {
494  sel->SetActivated(on);
495  Update();
496  }
497 }
498 
499 ////////////////////////////////////////////////////////////////////////////////
500 /// Slot to add a selection.
501 
503 {
505  if (title == "") title = "Selection";
506  TString titlebis = title;
507  Bool_t found = kTRUE;
508  Int_t i=1;
509  while (found){
510  if (fSelectionSelect->FindEntry(titlebis)) {
511  titlebis = title;
512  titlebis.Append(Form("(%d)",i));
513  }
514  else found = kFALSE;
515  ++i;
516  }
517 
518  fParallel->AddSelection(titlebis.Data());
519 
521 }
522 
523 ////////////////////////////////////////////////////////////////////////////////
524 /// Slot to add a variable.
525 
527 {
528  if (fAvoidSignal) return;
529 
532  Update();
533 }
534 
535 ////////////////////////////////////////////////////////////////////////////////
536 /// Slot to apply a selection to the tree.
537 
539 {
540  //FIXME I forgot to update the slider over the entries
541  // (nentries and firstentry might have changed after applying the selection)
542 
543  if (fAvoidSignal) return;
544 
546  Update();
548 }
549 
550 ////////////////////////////////////////////////////////////////////////////////
551 /// Slot to delay the drawing.
552 
554 {
555  if (fAvoidSignal) return;
556 
557  fDelay = on;
559 }
560 
561 ////////////////////////////////////////////////////////////////////////////////
562 /// Slot to delete a selection.
563 
565 {
566  if (fAvoidSignal) return;
567 
569 
571  Update();
572 }
573 
574 ////////////////////////////////////////////////////////////////////////////////
575 /// Slot to delete a variable().
576 
578 {
579  if (fAvoidSignal) return;
580 
583  if (var) Update();
584 }
585 
586 ////////////////////////////////////////////////////////////////////////////////
587 /// Slot to set the line dotspacing.
588 
590 {
591  if (fAvoidSignal) return;
592 
595  Update();
596 }
597 
598 ////////////////////////////////////////////////////////////////////////////////
599 /// Slot to set the line dotspacing from the entry field.
600 
602 {
603  if (fAvoidSignal) return;
604 
607  Update();
608 }
609 
610 ////////////////////////////////////////////////////////////////////////////////
611 /// Slot to set the alpha value from the entry field.
612 
614 {
615  if (fAvoidSignal) return;
616 
617  if (TColor *color = gROOT->GetColor(fParallel->GetLineColor())) {
618  color->SetAlpha((Float_t)fAlphaField->GetNumber());
620  }
621  Update();
622 }
623 
624 ////////////////////////////////////////////////////////////////////////////////
625 /// Slot to set the alpha value
626 
628 {
629  if (fAvoidSignal) return;
630 
631  if (TColor *color = gROOT->GetColor(fParallel->GetLineColor())) {
632  color->SetAlpha((Float_t)fAlpha->GetPosition()/1000);
634  }
635  Update();
636 }
637 
638 ////////////////////////////////////////////////////////////////////////////////
639 /// Slot to select the entries to be drawn.
640 
642 {
643  if (fAvoidSignal) return;
644 
645  Long64_t nentries,firstentry;
646  firstentry = (Long64_t)fEntriesToDraw->GetMinPosition();
648 
649  fParallel->SetCurrentFirst(firstentry);
650  fParallel->SetCurrentN(nentries);
651  Update();
652 }
653 
654 ////////////////////////////////////////////////////////////////////////////////
655 /// Slot to set the first entry.
656 
658 {
659  if (fAvoidSignal) return;
660 
663  Update();
664 }
665 
666 ////////////////////////////////////////////////////////////////////////////////
667 /// Slot to set the global line color.
668 
670 {
671  if (fAvoidSignal) return;
672 
673  if (TColor *color = gROOT->GetColor(fParallel->GetLineColor())) {
674  color->SetAlpha(1);
675  color = gROOT->GetColor(TColor::GetColor(a));
676  color->SetAlpha((Float_t)fAlphaField->GetNumber());
677  fParallel->SetLineColor(color->GetNumber());
678  }
679  Update();
680 }
681 
682 ////////////////////////////////////////////////////////////////////////////////
683 /// Slot to set the global line width.
684 
686 {
687  if (fAvoidSignal) return;
688 
689  fParallel->SetLineWidth(wid);
690  Update();
691 }
692 
693 ////////////////////////////////////////////////////////////////////////////////
694 /// Slot to hide all the ranges.
695 
697 {
698  if (fAvoidSignal) return;
699 
702  while((sel = (TParallelCoordSelect*)next())) sel->SetShowRanges(!on);
703  fShowRanges->SetOn(!on);
704  fShowRanges->SetEnabled(!on);
705  fShowRanges->SetOn(!on);
706  Update();
707 }
708 
709 ////////////////////////////////////////////////////////////////////////////////
710 /// Slot to set the axes histogram binning.
711 
713 {
714  if (fAvoidSignal) return;
715 
717  Update();
718 }
719 
720 ////////////////////////////////////////////////////////////////////////////////
721 /// Slot to set the histograms color.
722 
724 {
725  if (fAvoidSignal) return;
726 
727  Color_t col = TColor::GetColor(p);
729  TParallelCoordVar *var = NULL;
730  while ((var = (TParallelCoordVar*)next())) var->SetFillColor(col);
731  Update();
732 }
733 
734 ////////////////////////////////////////////////////////////////////////////////
735 /// Slot to set histogram height.
736 
738 {
739  if (fAvoidSignal) return;
740 
742  TParallelCoordVar* var;
744  Update();
745 }
746 
747 ////////////////////////////////////////////////////////////////////////////////
748 /// Slot to set the histograms fill style.
749 
751 {
752  if (fAvoidSignal) return;
753 
755  TParallelCoordVar *var = NULL;
756  while ((var = (TParallelCoordVar*)next())) var->SetFillStyle(sty);
757  Update();
758 }
759 
760 ////////////////////////////////////////////////////////////////////////////////
761 /// Slot to set histogram width.
762 
764 {
765  if (fAvoidSignal) return;
766 
768  Update();
769 }
770 
771 ////////////////////////////////////////////////////////////////////////////////
772 /// Slot to set the line type.
773 
775 {
776  if (fAvoidSignal) return;
777 
780  Update();
781 }
782 
783 ////////////////////////////////////////////////////////////////////////////////
784 /// Slot to set the dots spacing online.
785 
787 {
788  if (fAvoidSignal) return;
791  if (!fDelay) Update();
792 }
793 
794 ////////////////////////////////////////////////////////////////////////////////
795 /// Slot to set alpha value online.
796 
798 {
799  if (fAvoidSignal) return;
800  fAlphaField->SetNumber((Float_t)a/1000);
801 
802  if (TColor *color = gROOT->GetColor(fParallel->GetLineColor())) color->SetAlpha((Float_t)a/1000);
803  if (!fDelay) Update();
804 }
805 
806 ////////////////////////////////////////////////////////////////////////////////
807 /// Slot to update the entries fields from the slider position.
808 
810 {
811  if (fAvoidSignal) return;
812 
813  Long64_t nentries,firstentry;
814  firstentry = (Long64_t)fEntriesToDraw->GetMinPosition();
816 
817  fFirstEntry->SetNumber(firstentry);
818  fNentries->SetNumber(nentries);
819 
820  if (!fDelay) {
821  fParallel->SetCurrentFirst(firstentry);
822  fParallel->SetCurrentN(nentries);
823  Update();
824  }
825 }
826 
827 ////////////////////////////////////////////////////////////////////////////////
828 /// Slot to update the wieght cut entry field from the slider position.
829 
831 {
832  if (fAvoidSignal) return;
833 
835  if (!fDelay) {
837  Update();
838  }
839 }
840 
841 ////////////////////////////////////////////////////////////////////////////////
842 /// Slot to set the number of entries to display.
843 
845 {
846  if (fAvoidSignal) return;
847 
850  Update();
851 }
852 
853 ////////////////////////////////////////////////////////////////////////////////
854 /// Slot to postpone the entries drawing.
855 
857 {
858  if (fAvoidSignal) return;
859 
861  Update();
862 }
863 
864 ////////////////////////////////////////////////////////////////////////////////
865 /// Slot to set the line color of selection.
866 
868 {
869  if (fAvoidSignal) return;
870 
872  if (sel) sel->SetLineColor(TColor::GetColor(a));
874  Update();
875 }
876 
877 ////////////////////////////////////////////////////////////////////////////////
878 /// Slot to set the line width of selection.
879 
881 {
882  if (fAvoidSignal) return;
883 
885  if (sel) {
886  sel->SetLineWidth(wid);
887  Update();
888  }
889 }
890 
891 ////////////////////////////////////////////////////////////////////////////////
892 /// Slot to set the selection beeing edited.
893 
895 {
896  if (fAvoidSignal) return;
897 
898  if (!fParallel->SetCurrentSelection(title)) return;
899 
903 
905 
908 }
909 
910 ////////////////////////////////////////////////////////////////////////////////
911 /// Slot to show or not the ranges on the pad.
912 
914 {
915  if (fAvoidSignal) return;
916 
918  if (select) {
919  select->SetShowRanges(s);
920  Update();
921  }
922 }
923 
924 ////////////////////////////////////////////////////////////////////////////////
925 /// Slot to reset the tree entry list to the original one.
926 
928 {
929  if (fAvoidSignal) return;
930 
931  fParallel->ResetTree();
932  Update();
934 }
935 
936 ////////////////////////////////////////////////////////////////////////////////
937 /// Slot to select a variable.
938 
939 void TParallelCoordEditor::DoVariableSelect(const char* /*var*/)
940 {
941 }
942 
943 ////////////////////////////////////////////////////////////////////////////////
944 /// Slot to update the weight cut.
945 
947 {
948  if (fAvoidSignal) return;
949 
952  Update();
953 }
954 
955 ////////////////////////////////////////////////////////////////////////////////
956 /// Pick up the used parallel coordinates plot attributes.
957 
959 {
960  if (!obj) return;
961  fParallel = dynamic_cast<TParallelCoord*>(obj);
962  if (!fParallel) return;
964 
968 
970 
972 
973  if (!TCanvas::SupportAlpha()) {
976  }
977  else {
978  if (TColor *color = gROOT->GetColor(fParallel->GetLineColor())) {
979  fAlpha->SetPosition((Int_t)color->GetAlpha()*1000);
980  fAlphaField->SetNumber(color->GetAlpha());
981  }
982  }
983 
985  if (cur) fLineTypeBgroup->SetButton(kLineTypeCurves,kTRUE);
986  else fLineTypeBgroup->SetButton(kLineTypePoly,kTRUE);
987 
989 
992 
995 
998 
1000 
1001  fWeightCut->SetRange(0,(Int_t)(fParallel->GetNentries()/10)); // Maybe search here for better boundaries.
1004 
1007 
1008  if (fInit) ConnectSignals2Slots();
1009 
1010  fAvoidSignal = kFALSE;
1011 }
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:52
virtual void SetLineWidth(Width_t lwidth)
Definition: TAttLine.h:57
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:587
A TParallelCoordSelect is a specialised TList to hold TParallelCoordRanges used by TParallelCoord...
This is the TParallelCoord editor.
virtual void DoApplySelect()
Slot to apply a selection to the tree.
void SetLineColor(Color_t col)
long long Long64_t
Definition: RtypesCore.h:69
TParallelCoordSelect * GetCurrentSelection()
Return the selection currently being edited.
const Double_t * v1
Definition: TArcBall.cxx:33
short Style_t
Definition: RtypesCore.h:76
virtual void DoShowRanges(Bool_t s)
Slot to show or not the ranges on the pad.
TParallelCoordEditor(const TGWindow *p=0, Int_t width=140, Int_t height=30, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
Normal constructor.
ClassImp(TSeqCollection) Int_t TSeqCollection TIter next(this)
Return index of object in collection.
float Float_t
Definition: RtypesCore.h:53
virtual void DoGlobalLineWidth(Int_t)
Slot to set the global line width.
virtual void SetRange(Int_t min, Int_t max)
Definition: TGSlider.h:105
virtual void DoHistColorSelect(Pixel_t)
Slot to set the histograms color.
virtual void DoHistBinning()
Slot to set the axes histogram binning.
virtual void DoHistShowBoxes(Bool_t)
Slot to set histogram height.
TGColorSelect * fHistColorSelect
virtual void DoSelectLineWidth(Int_t)
Slot to set the line width of selection.
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...
void SetColor(Pixel_t color, Bool_t emit=kTRUE)
Set color.
void SetLineWidth(Width_t wid)
void SetAxisHistogramLineWidth(Int_t lw=2)
Set the same histogram axis line width for all axis.
void SetEnabled(Bool_t e=kTRUE)
Set enabled or disabled state of button.
void SetLiveRangesUpdate(Bool_t)
If true, the pad is updated while the motion of a dragged range.
TGCheckButton * fPaintEntries
#define gROOT
Definition: TROOT.h:340
void SetWeightCut(Int_t w=0)
virtual void ConnectSignals2Slots()
Connect signals to slots.
TGButtonGroup * fLineTypeBgroup
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
virtual void DoFirstEntry()
Slot to set the first entry.
virtual void DoVariableSelect(const char *var)
Slot to select a variable.
TGCheckButton * fHideAllRanges
void ResetTree()
Reset the tree entry list to the initial one..
bool Bool_t
Definition: RtypesCore.h:59
TArc * a
Definition: textangle.C:12
const Bool_t kFALSE
Definition: Rtypes.h:92
void SetCurrentFirst(Long64_t)
Set the first entry to be displayed.
virtual void DoAlphaField()
Slot to set the alpha value from the entry field.
TGCheckButton * fDelayDrawing
void SetCurrentN(Long64_t)
Set the number of entry to be displayed.
virtual void SetRange(Float_t min, Float_t max)
virtual TGLBEntry * GetSelectedEntry() const
Definition: TGComboBox.h:137
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:732
virtual void DoLiveAlpha(Int_t a)
Slot to set alpha value online.
virtual void DoHistWidth()
Slot to set histogram width.
TParallelCoord axes.
virtual void DoWeightCut()
Slot to update the weight cut.
void SetAxisHistogramBinning(Int_t n=100)
Set the same histogram axis binning for all axis.
const char * Data() const
Definition: TString.h:349
Color_t GetLineColor()
Bool_t fAvoidSignal
Definition: TGedFrame.h:58
TList * GetVarList()
ULong_t Pixel_t
Definition: GuiTypes.h:41
virtual void DoLiveEntriesToDraw()
Slot to update the entries fields from the slider position.
void ApplySelectionToTree()
Apply the current selection to the tree.
virtual void DoDotsSpacing()
Slot to set the line dotspacing.
TGLineWidthComboBox * fSelectLineWidth
const char * GetTitle() const
Returns title of object.
TGColorSelect * fSelectLineColor
virtual void DoHistPatternSelect(Style_t)
Slot to set the histograms fill style.
virtual void DoDeleteVar()
Slot to delete a variable().
const char * GetText() const
Definition: TGTextEntry.h:140
TGCheckButton * fActivateSelection
virtual void Update()
Update the current pad when an attribute is changed via GUI.
Definition: TGedFrame.cxx:73
virtual void Select(Int_t id, Bool_t emit=kTRUE)
Make the selected item visible in the combo box window and emit signals according to the second param...
Definition: TGComboBox.cxx:443
TGCompositeFrame(const TGCompositeFrame &)
virtual TGVerticalFrame * CreateEditorTabSubFrame(const char *name)
Create a vertical frame to be used by 'owner' in extra tab 'name'.
Definition: TGedFrame.cxx:123
virtual void DoSelectionSelect(const char *title)
Slot to set the selection beeing edited.
virtual void SetRadioButtonExclusive(Bool_t flag=kTRUE)
If enable is kTRUE, this button group will treat radio buttons as mutually exclusive, and other buttons according to IsExclusive().
TString & Append(const char *cs)
Definition: TString.h:492
virtual void DoSelectLineColor(Pixel_t)
Slot to set the line color of selection.
TGTextButton * fDeleteSelection
Int_t GetHistBinning() const
TGTextButton * fButtonAddVar
virtual void RemoveAll()
Remove all entries from combo box.
Definition: TGComboBox.cxx:672
virtual void DoPaintEntries(Bool_t)
Slot to postpone the entries drawing.
Long64_t GetCurrentN()
virtual void DoEntriesToDraw()
Slot to select the entries to be drawn.
short Color_t
Definition: RtypesCore.h:79
TGNumberEntryField * fFirstEntry
static Bool_t SupportAlpha()
Static function returning "true" if transparency is supported.
Definition: TCanvas.cxx:2169
TGNumberEntryField * fHistWidth
A doubly linked list.
Definition: TList.h:47
virtual void DoLiveDotsSpacing(Int_t a)
Slot to set the dots spacing online.
void RemoveVariable(TParallelCoordVar *var)
Delete a variable from the graph.
Long64_t GetCurrentFirst()
virtual void SetLineColor(Color_t lcolor)
Definition: TAttLine.h:54
void CleanUpSelections()
Clean up the selection combo box.
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot...
Definition: TQObject.cxx:1135
TGColorSelect * fGlobalLineColor
TGCompositeFrame * fVarTab
virtual Int_t GetPosition() const
Definition: TGSlider.h:107
void AddSelection(const char *title)
Add a selection.
Int_t GetWeightCut() const
virtual void DoUnApply()
Slot to reset the tree entry list to the original one.
TParallelCoord * fParallel
TGNumberEntryField * fHistBinning
virtual void DoLineType()
Slot to set the line type.
virtual TGLBEntry * FindEntry(const char *s) const
Find entry by name.
Definition: TGComboBox.cxx:414
virtual EButtonState GetState() const
Definition: TGButton.h:116
TGLineWidthComboBox * fGlobalLineWidth
virtual void Associate(const TGWindow *w)
Definition: TGWidget.h:90
TList * GetSelectList()
TGDoubleHSlider * fEntriesToDraw
virtual void DoAddVariable()
Slot to add a variable.
unsigned int UInt_t
Definition: RtypesCore.h:42
Bool_t TestBit(UInt_t f) const
Definition: TObject.h:173
char * Form(const char *fmt,...)
virtual TGListBox * GetListBox() const
Definition: TGComboBox.h:132
virtual void SetPosition(Int_t pos)
Definition: TGSlider.h:106
virtual void ChangeOptions(UInt_t options)
Change composite frame options. Options is an OR of the EFrameTypes.
Definition: TGFrame.cxx:1025
TGRadioButton * fLineTypeCurves
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:1666
virtual Double_t GetNumber() const
Get the numeric value (floating point representation).
void CleanUpVariables()
Clean up the variables combo box.
void SetPattern(Style_t pattern, Bool_t emit=kTRUE)
Set pattern.
virtual void DoActivateSelection(Bool_t)
Slot to activate or not a selection.
void AddVariable(Double_t *val, const char *title="")
Add a variable.
virtual void DoAlpha()
Slot to set the alpha value.
virtual void SetModel(TObject *obj)
Pick up the used parallel coordinates plot attributes.
virtual Color_t GetLineColor() const
Definition: TAttLine.h:47
Width_t GetLineWidth()
Long64_t entry
virtual void SetEnabled(Bool_t on=kTRUE)
Set state of combo box. If kTRUE=enabled, kFALSE=disabled.
Definition: TGComboBox.cxx:628
Long64_t GetNentries()
virtual void DoNentries()
Slot to set the number of entries to display.
virtual void DoDeleteSelection()
Slot to delete a selection.
virtual TObject * Last() const
Return the last object in the list. Returns 0 when list is empty.
Definition: TList.cxx:580
static ULong_t Number2Pixel(Int_t ci)
Static method that given a color index number, returns the corresponding pixel value.
Definition: TColor.cxx:1862
virtual void DoGlobalLineColor(Pixel_t)
Slot to set the global line color.
virtual Int_t GetSize() const
Definition: TCollection.h:95
void SetEnabled(Bool_t flag=kTRUE)
Definition: TGTextEntry.h:170
virtual void DoDelayDrawing(Bool_t)
Slot to delay the drawing.
virtual void DoLiveWeightCut(Int_t n)
Slot to update the wieght cut entry field from the slider position.
#define ClassImp(name)
Definition: Rtypes.h:279
TGNumberEntryField * fWeightCutField
Bool_t GetCurveDisplay() const
virtual void AddEntry(TGString *s, Int_t id)
Definition: TGComboBox.h:108
virtual void SetEnabled(Bool_t e=kTRUE)
Set enabled or disabled state of button.
Definition: TGButton.cxx:409
TParallelCoordSelect * SetCurrentSelection(const char *title)
Set the selection being edited.
virtual void DoAddSelection()
Slot to add a selection.
int nentries
Definition: THbookFile.cxx:89
virtual void SetCurveDisplay(Bool_t curve=1)
void SetDotsSpacing(Int_t s=0)
Set dots spacing.
The color creation and management class.
Definition: TColor.h:23
TGedPatternSelect * fHistPatternSelect
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1099
virtual void SetOn(Bool_t on=kTRUE, Bool_t emit=kFALSE)
Definition: TGButton.h:124
void DeleteSelection(TParallelCoordSelect *sel)
Delete a selection.
void MakeVariablesTab()
Make the "variable" tab.
Parallel Coordinates class.
Mother of all ROOT objects.
Definition: TObject.h:58
TGNumberEntryField * fAlphaField
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
Definition: TList.cxx:556
virtual void SetBackgroundColor(Pixel_t col)
Set background color (override from TGWindow base class).
Definition: TGListBox.h:78
TGNumberEntryField * fDotsSpacingField
Bool_t fInit
Definition: TGedFrame.h:55
virtual void SetNumber(Double_t val)
Set the numeric value (floating point representation).
virtual void DoHideAllRanges(Bool_t)
Slot to hide all the ranges.
TGCheckButton * fHistShowBoxes
double f2(const double *x)
TF1 * f1
Definition: legend1.C:11
TGNumberEntryField * fNentries
virtual void SetPosition(Float_t min, Float_t max)
#define NULL
Definition: Rtypes.h:82
Int_t GetDotsSpacing() const
virtual Float_t GetMinPosition() const
TGTextButton * fAddSelection
virtual Float_t GetMaxPosition() const
virtual Int_t IndexOf(const TObject *obj) const
virtual void DoDotsSpacingField()
Slot to set the line dotspacing from the entry field.
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual Width_t GetLineWidth() const
Definition: TAttLine.h:49
TGCheckButton * fShowRanges
virtual const char * GetTitle() const
Returns title of object.
Definition: TObject.cxx:459
TObject * obj
TGRadioButton * fLineTypePoly
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition: TGedFrame.cxx:96
virtual void SetToolTipText(const char *text, Long_t delayms=400)
Set tool tip text associated with this button.
Definition: TGButton.cxx:395
const Int_t n
Definition: legend1.C:16
TGTextEntry * fAddSelectionField
virtual TGLBEntry * GetEntry(Int_t id) const
Returns list box entry with specified id.
Definition: TGListBox.cxx:1380
void SetShowRanges(Bool_t s)
Show the ranges needles.
Int_t fPriority
Definition: TGedFrame.h:61
void SetActivated(Bool_t on)
Activate the selection.