Logo ROOT   6.08/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 
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 (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 
700  TIter next(fParallel->GetSelectList());
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);
728  TIter next(fParallel->GetVarList());
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 
741  TIter next(fParallel->GetVarList());
742  TParallelCoordVar* var;
743  while ((var = (TParallelCoordVar*)next())) var->SetBit(TParallelCoordVar::kShowBarHisto,s);
744  Update();
745 }
746 
747 ////////////////////////////////////////////////////////////////////////////////
748 /// Slot to set the histograms fill style.
749 
751 {
752  if (fAvoidSignal) return;
753 
754  TIter next(fParallel->GetVarList());
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 
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 Float_t GetMinPosition() const
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition: TAttLine.h:49
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:107
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.
return c
virtual void DoHistBinning()
Slot to set the axes histogram binning.
virtual void DoHistShowBoxes(Bool_t)
Slot to set histogram height.
Bool_t TestBit(UInt_t f) const
Definition: TObject.h:157
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:581
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:364
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 Width_t GetLineWidth() const
Return the line width.
Definition: TAttLine.h:41
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:739
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: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
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:492
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:116
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
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:2170
TGNumberEntryField * fHistWidth
A doubly linked list.
Definition: TList.h:47
virtual void DoLiveDotsSpacing(Int_t a)
Slot to set the dots spacing online.
virtual TGListBox * GetListBox() const
Definition: TGComboBox.h:132
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:46
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:1137
TGColorSelect * fGlobalLineColor
TGCompositeFrame * fVarTab
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
Definition: TList.cxx:557
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.
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
char * Form(const char *fmt,...)
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:1706
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:628
Long64_t GetNentries()
Int_t GetWeightCut() const
virtual void DoNentries()
Slot to set the number of entries to display.
virtual Color_t GetLineColor() const
Return the line color.
Definition: TAttLine.h:39
virtual void DoDeleteSelection()
Slot to delete a selection.
const char * GetText() const
Definition: TGTextEntry.h:140
static ULong_t Number2Pixel(Int_t ci)
Static method that given a color index number, returns the corresponding pixel value.
Definition: TColor.cxx:1916
virtual void DoGlobalLineColor(Pixel_t)
Slot to set the global line color.
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
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:37
TGNumberEntryField * fAlphaField
virtual const char * GetTitle() const
Returns title of object.
Definition: TObject.cxx:460
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
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:95
const Bool_t kTRUE
Definition: Rtypes.h:91
TGCheckButton * fShowRanges
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
void SetShowRanges(Bool_t s)
Show the ranges needles.
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:52
Int_t fPriority
Definition: TGedFrame.h:61
virtual TGLBEntry * GetSelectedEntry() const
Definition: TGComboBox.h:137
virtual Int_t IndexOf(const TObject *obj) const
Return index of object in collection.
const char * Data() const
Definition: TString.h:349
void SetActivated(Bool_t on)
Activate the selection.