Logo ROOT   6.12/07
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 
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 
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 
125  TGHorizontalFrame *f2 = new TGHorizontalFrame(this);
127  fDotsSpacing->SetRange(0,60);
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);
147  fAlphaField->Resize(40,20);
150  }
151 
152  fLineTypeBgroup = new TGButtonGroup(this,2,1,0,0, "Line type");
155  fLineTypePoly->SetToolTipText("Draw the entries with a polyline");
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 
169  fSelectionSelect->Resize(140,20);
171 
172  TGHorizontalFrame *f3 = new TGHorizontalFrame(this);
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).");
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 
217 
218  TGHorizontalFrame *f6 = new TGHorizontalFrame(this);
219  TGVerticalFrame *v1 = new TGVerticalFrame(f6);
220  TGVerticalFrame *v2 = new TGVerticalFrame(f6);
221  v1->AddFrame(new TGLabel(v1,"First entry:"));
225  fFirstEntry->Resize(68,20);
226  v1->AddFrame(fFirstEntry);
227  v2->AddFrame(new TGLabel(v2,"# of entries:"));
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);
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:"));
293  fHistBinning->Resize(68,20);
294  v3->AddFrame(fHistBinning);
295  v4->AddFrame(new TGLabel(v4,"Width:"));
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 
312  f13->AddFrame(fHistColorSelect, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
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 (hasDeleted) 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  if (color) {
677  color->SetAlpha((Float_t)fAlphaField->GetNumber());
678  fParallel->SetLineColor(color->GetNumber());
679  }
680  }
681  Update();
682 }
683 
684 ////////////////////////////////////////////////////////////////////////////////
685 /// Slot to set the global line width.
686 
688 {
689  if (fAvoidSignal) return;
690 
691  fParallel->SetLineWidth(wid);
692  Update();
693 }
694 
695 ////////////////////////////////////////////////////////////////////////////////
696 /// Slot to hide all the ranges.
697 
699 {
700  if (fAvoidSignal) return;
701 
702  TIter next(fParallel->GetSelectList());
704  while((sel = (TParallelCoordSelect*)next())) sel->SetShowRanges(!on);
705  fShowRanges->SetOn(!on);
706  fShowRanges->SetEnabled(!on);
707  fShowRanges->SetOn(!on);
708  Update();
709 }
710 
711 ////////////////////////////////////////////////////////////////////////////////
712 /// Slot to set the axes histogram binning.
713 
715 {
716  if (fAvoidSignal) return;
717 
719  Update();
720 }
721 
722 ////////////////////////////////////////////////////////////////////////////////
723 /// Slot to set the histograms color.
724 
726 {
727  if (fAvoidSignal) return;
728 
729  Color_t col = TColor::GetColor(p);
730  TIter next(fParallel->GetVarList());
731  TParallelCoordVar *var = NULL;
732  while ((var = (TParallelCoordVar*)next())) var->SetFillColor(col);
733  Update();
734 }
735 
736 ////////////////////////////////////////////////////////////////////////////////
737 /// Slot to set histogram height.
738 
740 {
741  if (fAvoidSignal) return;
742 
743  TIter next(fParallel->GetVarList());
744  TParallelCoordVar* var;
745  while ((var = (TParallelCoordVar*)next())) var->SetBit(TParallelCoordVar::kShowBarHisto,s);
746  Update();
747 }
748 
749 ////////////////////////////////////////////////////////////////////////////////
750 /// Slot to set the histograms fill style.
751 
753 {
754  if (fAvoidSignal) return;
755 
756  TIter next(fParallel->GetVarList());
757  TParallelCoordVar *var = NULL;
758  while ((var = (TParallelCoordVar*)next())) var->SetFillStyle(sty);
759  Update();
760 }
761 
762 ////////////////////////////////////////////////////////////////////////////////
763 /// Slot to set histogram width.
764 
766 {
767  if (fAvoidSignal) return;
768 
770  Update();
771 }
772 
773 ////////////////////////////////////////////////////////////////////////////////
774 /// Slot to set the line type.
775 
777 {
778  if (fAvoidSignal) return;
779 
782  Update();
783 }
784 
785 ////////////////////////////////////////////////////////////////////////////////
786 /// Slot to set the dots spacing online.
787 
789 {
790  if (fAvoidSignal) return;
793  if (!fDelay) Update();
794 }
795 
796 ////////////////////////////////////////////////////////////////////////////////
797 /// Slot to set alpha value online.
798 
800 {
801  if (fAvoidSignal) return;
802  fAlphaField->SetNumber((Float_t)a/1000);
803 
804  if (TColor *color = gROOT->GetColor(fParallel->GetLineColor())) color->SetAlpha((Float_t)a/1000);
805  if (!fDelay) Update();
806 }
807 
808 ////////////////////////////////////////////////////////////////////////////////
809 /// Slot to update the entries fields from the slider position.
810 
812 {
813  if (fAvoidSignal) return;
814 
815  Long64_t nentries,firstentry;
816  firstentry = (Long64_t)fEntriesToDraw->GetMinPosition();
818 
819  fFirstEntry->SetNumber(firstentry);
820  fNentries->SetNumber(nentries);
821 
822  if (!fDelay) {
823  fParallel->SetCurrentFirst(firstentry);
824  fParallel->SetCurrentN(nentries);
825  Update();
826  }
827 }
828 
829 ////////////////////////////////////////////////////////////////////////////////
830 /// Slot to update the wieght cut entry field from the slider position.
831 
833 {
834  if (fAvoidSignal) return;
835 
837  if (!fDelay) {
839  Update();
840  }
841 }
842 
843 ////////////////////////////////////////////////////////////////////////////////
844 /// Slot to set the number of entries to display.
845 
847 {
848  if (fAvoidSignal) return;
849 
852  Update();
853 }
854 
855 ////////////////////////////////////////////////////////////////////////////////
856 /// Slot to postpone the entries drawing.
857 
859 {
860  if (fAvoidSignal) return;
861 
863  Update();
864 }
865 
866 ////////////////////////////////////////////////////////////////////////////////
867 /// Slot to set the line color of selection.
868 
870 {
871  if (fAvoidSignal) return;
872 
874  if (sel) sel->SetLineColor(TColor::GetColor(a));
876  Update();
877 }
878 
879 ////////////////////////////////////////////////////////////////////////////////
880 /// Slot to set the line width of selection.
881 
883 {
884  if (fAvoidSignal) return;
885 
887  if (sel) {
888  sel->SetLineWidth(wid);
889  Update();
890  }
891 }
892 
893 ////////////////////////////////////////////////////////////////////////////////
894 /// Slot to set the selection beeing edited.
895 
897 {
898  if (fAvoidSignal) return;
899 
900  if (!fParallel->SetCurrentSelection(title)) return;
901 
905 
907 
910 }
911 
912 ////////////////////////////////////////////////////////////////////////////////
913 /// Slot to show or not the ranges on the pad.
914 
916 {
917  if (fAvoidSignal) return;
918 
920  if (select) {
921  select->SetShowRanges(s);
922  Update();
923  }
924 }
925 
926 ////////////////////////////////////////////////////////////////////////////////
927 /// Slot to reset the tree entry list to the original one.
928 
930 {
931  if (fAvoidSignal) return;
932 
933  fParallel->ResetTree();
934  Update();
936 }
937 
938 ////////////////////////////////////////////////////////////////////////////////
939 /// Slot to select a variable.
940 
941 void TParallelCoordEditor::DoVariableSelect(const char* /*var*/)
942 {
943 }
944 
945 ////////////////////////////////////////////////////////////////////////////////
946 /// Slot to update the weight cut.
947 
949 {
950  if (fAvoidSignal) return;
951 
954  Update();
955 }
956 
957 ////////////////////////////////////////////////////////////////////////////////
958 /// Pick up the used parallel coordinates plot attributes.
959 
961 {
962  if (!obj) return;
963  fParallel = dynamic_cast<TParallelCoord*>(obj);
964  if (!fParallel) return;
966 
970 
972 
974 
975  if (!TCanvas::SupportAlpha()) {
978  }
979  else {
980  if (TColor *color = gROOT->GetColor(fParallel->GetLineColor())) {
981  fAlpha->SetPosition((Int_t)color->GetAlpha()*1000);
982  fAlphaField->SetNumber(color->GetAlpha());
983  }
984  }
985 
989 
991 
994 
997 
1000 
1002 
1003  fWeightCut->SetRange(0,(Int_t)(fParallel->GetNentries()/10)); // Maybe search here for better boundaries.
1006 
1009 
1010  if (fInit) ConnectSignals2Slots();
1011 
1012  fAvoidSignal = kFALSE;
1013 }
virtual Float_t GetMinPosition() const
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition: TAttLine.h:43
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.
Int_t GetHistBinning() const
void SetLineColor(Color_t col)
virtual Float_t GetMaxPosition() const
long long Long64_t
Definition: RtypesCore.h:69
TParallelCoordSelect * GetCurrentSelection()
Return the selection currently being edited.
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.
virtual Int_t GetPosition() const
Definition: TGSlider.h:109
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:101
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.
virtual TObject * Last() const
Return the last object in the list. Returns 0 when list is empty.
Definition: TList.cxx:689
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:402
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:172
void SetWeightCut(Int_t w=0)
virtual void ConnectSignals2Slots()
Connect signals to slots.
TGButtonGroup * fLineTypeBgroup
Basic string class.
Definition: TString.h:125
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
void SetCurrentFirst(Long64_t)
Set the first entry to be displayed.
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
Definition: TAttFill.h:39
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 Width_t GetLineWidth() const
Return the line width.
Definition: TAttLine.h:35
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:694
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.
Color_t GetLineColor()
Bool_t fAvoidSignal
Definition: TGedFrame.h:56
TList * GetVarList()
ULong_t Pixel_t
Definition: GuiTypes.h:39
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
TGColorSelect * fSelectLineColor
virtual void DoHistPatternSelect(Style_t)
Slot to set the histograms fill style.
virtual void DoDeleteVar()
Slot to delete a variable().
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 TGLBEntry * FindEntry(const char *s) const
Find entry by name.
Definition: TGComboBox.cxx:414
virtual TGVerticalFrame * CreateEditorTabSubFrame(const char *name)
Create a vertical frame to be used by &#39;owner&#39; in extra tab &#39;name&#39;.
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:495
virtual Double_t GetNumber() const
Get the numeric value (floating point representation).
virtual void DoSelectLineColor(Pixel_t)
Slot to set the line color of selection.
TGTextButton * fDeleteSelection
virtual EButtonState GetState() const
Definition: TGButton.h:112
TGTextButton * fButtonAddVar
virtual void RemoveAll()
Remove all entries from combo box.
Definition: TGComboBox.cxx:675
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
virtual TGLBEntry * GetEntry(Int_t id) const
Returns list box entry with specified id.
Definition: TGListBox.cxx:1380
TGNumberEntryField * fFirstEntry
Bool_t GetCurveDisplay() const
static Bool_t SupportAlpha()
Static function returning "true" if transparency is supported.
Definition: TCanvas.cxx:2235
TGNumberEntryField * fHistWidth
A doubly linked list.
Definition: TList.h:44
virtual void DoLiveDotsSpacing(Int_t a)
Slot to set the dots spacing online.
virtual TGListBox * GetListBox() const
Definition: TGComboBox.h:130
void RemoveVariable(TParallelCoordVar *var)
Delete a variable from the graph.
Long64_t GetCurrentFirst()
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition: TAttLine.h:40
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:867
TGColorSelect * fGlobalLineColor
TGCompositeFrame * fVarTab
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
Definition: TList.cxx:655
void AddSelection(const char *title)
Add a selection.
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 void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition: TAttFill.h:37
auto * a
Definition: textangle.C:12
TGLineWidthComboBox * fGlobalLineWidth
virtual void Associate(const TGWindow *w)
Definition: TGWidget.h:84
TList * GetSelectList()
TGDoubleHSlider * fEntriesToDraw
virtual void DoAddVariable()
Slot to add a variable.
unsigned int UInt_t
Definition: RtypesCore.h:42
char * Form(const char *fmt,...)
virtual void SetPosition(Int_t pos)
Definition: TGSlider.h:105
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:1751
void CleanUpVariables()
Clean up the variables combo box.
void SetPattern(Style_t pattern, Bool_t emit=kTRUE)
Set pattern.
const char * GetTitle() const
Returns title of object.
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.
Width_t GetLineWidth()
virtual void SetEnabled(Bool_t on=kTRUE)
Set state of combo box. If kTRUE=enabled, kFALSE=disabled.
Definition: TGComboBox.cxx:631
Long64_t GetNentries()
Int_t GetWeightCut() const
virtual void DoNentries()
Slot to set the number of entries to display.
const Bool_t kFALSE
Definition: RtypesCore.h:88
virtual Color_t GetLineColor() const
Return the line color.
Definition: TAttLine.h:33
virtual void DoDeleteSelection()
Slot to delete a selection.
const char * GetText() const
Definition: TGTextEntry.h:134
static ULong_t Number2Pixel(Int_t ci)
Static method that given a color index number, returns the corresponding pixel value.
Definition: TColor.cxx:1990
virtual void DoGlobalLineColor(Pixel_t)
Slot to set the global line color.
void SetEnabled(Bool_t flag=kTRUE)
Definition: TGTextEntry.h:164
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:359
TGNumberEntryField * fWeightCutField
virtual void AddEntry(TGString *s, Int_t id)
Definition: TGComboBox.h:106
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.
static constexpr double s
The color creation and management class.
Definition: TColor.h:19
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:120
void DeleteSelection(TParallelCoordSelect *sel)
Delete a selection.
void MakeVariablesTab()
Make the "variable" tab.
Parallel Coordinates class.
Mother of all ROOT objects.
Definition: TObject.h:37
TGNumberEntryField * fAlphaField
virtual const char * GetTitle() const
Returns title of object.
Definition: TObject.cxx:401
virtual void SetBackgroundColor(Pixel_t col)
Set background color (override from TGWindow base class).
Definition: TGListBox.h:70
TGNumberEntryField * fDotsSpacingField
Bool_t fInit
Definition: TGedFrame.h:53
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
TF1 * f1
Definition: legend1.C:11
TGNumberEntryField * fNentries
virtual void SetPosition(Float_t min, Float_t max)
TGTextButton * fAddSelection
Int_t GetDotsSpacing() const
virtual void DoDotsSpacingField()
Slot to set the line dotspacing from the entry field.
virtual Int_t GetSize() const
Definition: TCollection.h:180
TGCheckButton * fShowRanges
TGRadioButton * fLineTypePoly
const Bool_t kTRUE
Definition: RtypesCore.h:87
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
void SetShowRanges(Bool_t s)
Show the ranges needles.
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
Int_t fPriority
Definition: TGedFrame.h:59
virtual TGLBEntry * GetSelectedEntry() const
Definition: TGComboBox.h:135
virtual Int_t IndexOf(const TObject *obj) const
Return index of object in collection.
const char * Data() const
Definition: TString.h:345
void SetActivated(Bool_t on)
Activate the selection.