Logo ROOT  
Reference Guide
TParallelCoord.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 "TParallelCoord.h"
13 #include "TParallelCoordVar.h"
14 #include "TParallelCoordRange.h"
15 
16 #include <cfloat>
17 #include <iostream>
18 
19 #include "TROOT.h"
20 #include "TVirtualPad.h"
21 #include "TPolyLine.h"
22 #include "TGraph.h"
23 #include "TPaveText.h"
24 #include "TStyle.h"
25 #include "TEntryList.h"
26 #include "TFrame.h"
27 #include "TTree.h"
28 #include "TTreePlayer.h"
29 #include "TSelectorDraw.h"
30 #include "TTreeFormula.h"
31 #include "TView.h"
32 #include "TRandom.h"
33 #include "TCanvas.h"
34 #include "TGaxis.h"
35 #include "TFile.h"
36 
38 
39 /** \class TParallelCoord
40 Parallel Coordinates class.
41 
42 The multidimensional system of Parallel coordinates is a common way of studying
43 high-dimensional geometry and visualizing multivariate problems. It has first
44 been proposed by A. Inselberg in 1981.
45 
46 To show a set of points in an n-dimensional space, a backdrop is drawn
47 consisting of n parallel lines. A point in n-dimensional space is represented as
48 a polyline with vertices on the parallel axes; the position of the vertex on the
49 i-th axis corresponds to the i-th coordinate of the point.
50 
51 This tool comes with a rather large gui in the editor. It is necessary to use
52 this editor in order to explore a data set, as explained below.
53 
54 ### Reduce cluttering:
55 
56 The main issue for parallel coordinates is the very high cluttering of the
57 output when dealing with large data set. Two techniques have been implemented to
58 bypass that so far:
59 
60  - Draw doted lines instead of plain lines with an adjustable dots spacing. A
61  slider to adjust the dots spacing is available in the editor.
62  - Sort the entries to display with a "weight cut". On each axis is drawn a
63  histogram describing the distribution of the data on the corresponding
64  variable. The "weight" of an entry is the sum of the bin content of each bin
65  the entry is going through. An entry going through the histograms peaks will
66  have a big weight wether an entry going randomly through the histograms will
67  have a rather small weight. Setting a cut on this weight allows to draw only
68  the most representative entries. A slider set the cut is also available in
69  the gui.
70 
71 ## Selections:
72 
73 Selections of specific entries can be defined over the data se using parallel
74 coordinates. With that representation, a selection is an ensemble of ranges
75 defined on the axes. Ranges defined on the same axis are conjugated with OR
76 (an entry must be in one or the other ranges to be selected). Ranges on
77 different axes are are conjugated with AND (an entry must be in all the ranges
78 to be selected). Several selections can be defined with different colors. It is
79 possible to generate an entry list from a given selection and apply it to the
80 tree using the editor ("Apply to tree" button).
81 
82 ## Axes:
83 
84 Options can be defined each axis separately using the right mouse click. These
85 options can be applied to every axes using the editor.
86 
87  - Axis width: If set to 0, the axis is simply a line. If higher, a color
88  histogram is drawn on the axis.
89  - Axis histogram height: If not 0, a usual bar histogram is drawn on the plot.
90 
91 The order in which the variables are drawn is essential to see the clusters. The
92 axes can be dragged to change their position. A zoom is also available. The
93 logarithm scale is also available by right clicking on the axis.
94 
95 ## Candle chart:
96 
97 TParallelCoord can also be used to display a candle chart. In that mode, every
98 variable is drawn in the same scale. The candle chart can be combined with the
99 parallel coordinates mode, drawing the candle sticks over the axes.
100 
101 ~~~ {.cpp}
102 {
103  TCanvas *c1 = new TCanvas("c1");
104  TFile *f = TFile::Open("cernstaff.root");
105  TTree *T = (TTree*)f->Get("T");
106  T->Draw("Age:Grade:Step:Cost:Division:Nation","","para");
107  TParallelCoord* para = (TParallelCoord*)gPad->GetListOfPrimitives()->FindObject("ParaCoord");
108  TParallelCoordVar* grade = (TParallelCoordVar*)para->GetVarList()->FindObject("Grade");
109  grade->AddRange(new TParallelCoordRange(grade,11.5,14));
110  para->AddSelection("less30");
111  para->GetCurrentSelection()->SetLineColor(kViolet);
112  TParallelCoordVar* age = (TParallelCoordVar*)para->GetVarList()->FindObject("Age");
113  age->AddRange(new TParallelCoordRange(age,21,30));
114 }
115 ~~~
116 
117 ### Some references:
118 
119  - Alfred Inselberg's Homepage <http://www.math.tau.ac.il/~aiisreal>, with
120  Visual Tutorial, History, Selected Publications and Applications.
121  - Almir Olivette Artero, Maria Cristina Ferreira de Oliveira, Haim Levkowitz,
122  "Uncovering Clusters in Crowded Parallel Coordinates Visualizations,"
123  infovis, pp. 81-88, IEEE Symposium on Information Visualization
124  (INFOVIS'04), 2004.
125 */
126 
127 ////////////////////////////////////////////////////////////////////////////////
128 /// Default constructor.
129 
131  :TNamed()
132 {
133  Init();
134 }
135 
136 ////////////////////////////////////////////////////////////////////////////////
137 /// Constructor without a reference to a tree,
138 /// the datas must be added afterwards with
139 /// TParallelCoord::AddVariable(Double_t*,const char*).
140 
142 {
143  Init();
146  fVarList = new TList();
147  fSelectList = new TList();
150 }
151 
152 ////////////////////////////////////////////////////////////////////////////////
153 /// Normal constructor, the datas must be added afterwards
154 /// with TParallelCoord::AddVariable(Double_t*,const char*).
155 
157  :TNamed("ParaCoord","ParaCoord")
158 {
159  Init();
160  Int_t estimate = tree->GetEstimate();
161  if (nentries>estimate) {
162  Warning("TParallelCoord","Call tree->SetEstimate(tree->GetEntries()) to display all the tree variables");
164  } else {
166  }
168  fTree = tree;
169  fTreeName = fTree->GetName();
171  else fTreeFileName = "";
172  fVarList = new TList();
173  fSelectList = new TList();
176 }
177 
178 ////////////////////////////////////////////////////////////////////////////////
179 /// Destructor.
180 
182 {
184  if (fVarList) {
185  fVarList->Delete();
186  delete fVarList;
187  }
188  if (fSelectList) {
189  fSelectList->Delete();
190  delete fSelectList;
191  }
192  if (fCandleAxis) delete fCandleAxis;
193  SetDotsSpacing(0);
194 }
195 
196 ////////////////////////////////////////////////////////////////////////////////
197 /// Add a variable.
198 
199 void TParallelCoord::AddVariable(Double_t* val, const char* title)
200 {
201  ++fNvar;
202  fVarList->Add(new TParallelCoordVar(val,title,fVarList->GetSize(),this));
203  SetAxesPosition();
204 }
205 
206 ////////////////////////////////////////////////////////////////////////////////
207 /// Add a variable from an expression.
208 
209 void TParallelCoord::AddVariable(const char* varexp)
210 {
211  if(!fTree) return; // The tree from which one will get the data must be defined.
212 
213  // Select in the only the entries of this TParallelCoord.
214  TEntryList *list = GetEntryList(kFALSE);
215  fTree->SetEntryList(list);
216 
217  // ensure that there is only one variable given:
218 
219  TString exp = varexp;
220 
221  if (exp.Contains(':') || exp.Contains(">>") || exp.Contains("<<")) {
222  Warning("AddVariable","Only a single variable can be added at a time.");
223  return;
224  }
225  if (exp == ""){
226  Warning("AddVariable","Nothing to add");
227  return;
228  }
229 
230  Long64_t en = fTree->Draw(varexp,"","goff");
231  if (en<0) {
232  Warning("AddVariable","%s could not be evaluated",varexp);
233  return;
234  }
235 
236  AddVariable(fTree->GetV1(),varexp);
237 }
238 
239 ////////////////////////////////////////////////////////////////////////////////
240 /// Add a selection.
241 
242 void TParallelCoord::AddSelection(const char* title)
243 {
244  TParallelCoordSelect *sel = new TParallelCoordSelect(title);
245  fSelectList->Add(sel);
246  fCurrentSelection = sel;
247 }
248 
249 ////////////////////////////////////////////////////////////////////////////////
250 /// Apply the current selection to the tree.
251 
253 {
254  if(!fTree) return;
255  if(fSelectList) {
256  if(fSelectList->GetSize() == 0) return;
258  }
261  fCurrentFirst = 0;
264  TString varexp = "";
265  TIter next(fVarList);
266  TParallelCoordVar* var;
267  while ((var = (TParallelCoordVar*)next())) varexp.Append(Form(":%s",var->GetTitle()));
268  varexp.Remove(TString::kLeading,':');
269  TSelectorDraw* selector = (TSelectorDraw*)((TTreePlayer*)fTree->GetPlayer())->GetSelector();
270  fTree->Draw(varexp.Data(),"","goff");
271  next.Reset();
272  Int_t i = 0;
273  while ((var = (TParallelCoordVar*)next())) {
274  var->SetValues(fNentries, selector->GetVal(i));
275  ++i;
276  }
277  if (fSelectList) { // FIXME It would be better to update the selections by deleting
278  fSelectList->Delete(); // the meaningless ranges (selecting everything or nothing for example)
279  fCurrentSelection = 0; // after applying a new entrylist to the tree.
280  }
281  gPad->Modified();
282  gPad->Update();
283 }
284 
285 ////////////////////////////////////////////////////////////////////////////////
286 /// Call constructor and add the variables.
287 
289 {
290  TParallelCoord* pc = new TParallelCoord(selector->GetTree(),selector->GetNfill());
291  pc->SetBit(kCanDelete);
292  selector->SetObject(pc);
293  TString varexp = "";
294  for(Int_t i=0;i<selector->GetDimension();++i) {
295  if (selector->GetVal(i)) {
296  if (selector->GetVar(i)) {
297  pc->AddVariable(selector->GetVal(i),selector->GetVar(i)->GetTitle());
298  varexp.Append(Form(":%s",selector->GetVar(i)->GetTitle()));
299  }
300  }
301  }
302  varexp.Remove(TString::kLeading,':');
303  if (selector->GetSelect()) varexp.Append(Form("{%s}",selector->GetSelect()->GetTitle()));
304  pc->SetTitle(varexp.Data());
305  if (!candle) pc->Draw();
306  else pc->Draw("candle");
307 }
308 
309 ////////////////////////////////////////////////////////////////////////////////
310 /// Clean up the selections from the ranges which could have been deleted
311 /// when a variable has been deleted.
312 
314 {
315  TIter next(fSelectList);
316  TParallelCoordSelect* select;
317  while ((select = (TParallelCoordSelect*)next())){
318  if(select->Contains(range)) select->Remove(range);
319  }
320 }
321 
322 ////////////////////////////////////////////////////////////////////////////////
323 /// Delete a selection.
324 
326 {
327  fSelectList->Remove(sel);
328  delete sel;
329  if(fSelectList->GetSize() == 0) fCurrentSelection = 0;
331 }
332 
333 ////////////////////////////////////////////////////////////////////////////////
334 /// Compute the distance from the TParallelCoord.
335 
337 {
338  if(!gPad) return 9999;
339 
340  TFrame *frame = gPad->GetFrame();
341 
342  Double_t x1,x2,y1,y2,xx,yy;
343 
344  x1 = frame->GetX1()+0.01;
345  x2 = frame->GetX2()-0.01;
346  y2 = frame->GetY2()-0.01;
347  y1 = frame->GetY1()+0.01;
348 
349  xx = gPad->AbsPixeltoX(px);
350  yy = gPad->AbsPixeltoY(py);
351 
352  if(xx>x1 && xx<x2 && yy>y1 && yy<y2) return 0;
353  else return 9999;
354 }
355 
356 ////////////////////////////////////////////////////////////////////////////////
357 /// Draw the parallel coordinates graph.
358 
360 {
361  if (!GetTree()) return;
363  Bool_t optcandle = kFALSE;
364  TString opt = option;
365  opt.ToLower();
366  if(opt.Contains("candle")) {
367  optcandle = kTRUE;
368  opt.ReplaceAll("candle","");
369  }
370  if(optcandle) {
374  }
375 
376  if (gPad) {
377  if (!gPad->IsEditable()) gROOT->MakeDefCanvas();
378  } else gROOT->MakeDefCanvas();
379  TView *view = gPad->GetView();
380  if(view){
381  delete view;
382  gPad->SetView(0);
383  }
384  gPad->Clear();
385  if (!optcandle) {
386  if (gPad && gPad->IsA() == TCanvas::Class()
387  && !((TCanvas*)gPad)->GetShowEditor()) {
388  ((TCanvas*)gPad)->ToggleEditor();
389  ((TCanvas*)gPad)->ToggleEventStatus();
390  }
391  }
392 
393  gPad->SetBit(TGraph::kClipFrame,kTRUE);
394 
395  TFrame *frame = new TFrame(0.1,0.1,0.9,0.9);
396  frame->SetBorderSize(0);
397  frame->SetBorderMode(0);
398  frame->SetFillStyle(0);
399  frame->SetLineColor(gPad->GetFillColor());
400  frame->Draw();
401  AppendPad(option);
402  TPaveText *title = new TPaveText(0.05,0.95,0.35,1);
403  title->AddText(GetTitle());
404  title->Draw();
405  SetAxesPosition();
406  TIter next(fVarList);
407  TParallelCoordVar* var;
408  while ((var = (TParallelCoordVar*)next())) {
409  if(optcandle) {
410  var->SetBoxPlot(kTRUE);
411  var->SetHistogramHeight(0.5);
412  var->SetHistogramLineWidth(0);
413  }
414  }
415 
416  if (optcandle) {
417  if (TestBit(kVertDisplay)) fCandleAxis = new TGaxis(0.05,0.1,0.05,0.9,GetGlobalMin(),GetGlobalMax());
418  else fCandleAxis = new TGaxis(0.1,0.05,0.9,0.05,GetGlobalMin(),GetGlobalMax());
419  fCandleAxis->Draw();
420  }
421 
422  if (gPad && gPad->IsA() == TCanvas::Class())
423  ((TCanvas*)gPad)->Selected(gPad,this,1);
424 }
425 
426 ////////////////////////////////////////////////////////////////////////////////
427 /// Execute the corresponding entry.
428 
429 void TParallelCoord::ExecuteEvent(Int_t /*entry*/, Int_t /*px*/, Int_t /*py*/)
430 {
431  if (!gPad) return;
432  gPad->SetCursor(kHand);
433 }
434 
435 ////////////////////////////////////////////////////////////////////////////////
436 /// Return the selection currently being edited.
437 
439 {
440  if (!fSelectList) return 0;
441  if (!fCurrentSelection) {
443  }
444  return fCurrentSelection;
445 }
446 
447 ////////////////////////////////////////////////////////////////////////////////
448 /// Get the whole entry list or one for a selection.
449 
451 {
452  if(!sel || fCurrentSelection->GetSize() == 0){ // If no selection is specified, return the entry list of all the entries.
453  return fInitEntries;
454  } else { // return the entry list corresponding to the current selection.
455  TEntryList *enlist = new TEntryList(fTree);
456  TIter next(fVarList);
457  for (Long64_t li=0;li<fNentries;++li) {
458  next.Reset();
459  Bool_t inrange=kTRUE;
460  TParallelCoordVar* var;
461  while((var = (TParallelCoordVar*)next())){
462  if(!var->Eval(li,fCurrentSelection)) inrange = kFALSE;
463  }
464  if(!inrange) continue;
465  enlist->Enter(fCurrentEntries->GetEntry(li));
466  }
467  return enlist;
468  }
469 }
470 
471 ////////////////////////////////////////////////////////////////////////////////
472 /// return the global maximum.
473 
475 {
476  Double_t gmax=-DBL_MAX;
477  TIter next(fVarList);
478  TParallelCoordVar* var;
479  while ((var = (TParallelCoordVar*)next())) {
480  if (gmax < var->GetCurrentMax()) gmax = var->GetCurrentMax();
481  }
482  return gmax;
483 }
484 
485 ////////////////////////////////////////////////////////////////////////////////
486 /// return the global minimum.
487 
489 {
490  Double_t gmin=DBL_MAX;
491  TIter next(fVarList);
492  TParallelCoordVar* var;
493  while ((var = (TParallelCoordVar*)next())) {
494  if (gmin > var->GetCurrentMin()) gmin = var->GetCurrentMin();
495  }
496  return gmin;
497 }
498 
499 ////////////////////////////////////////////////////////////////////////////////
500 /// get the binning of the histograms.
501 
503 {
504  return ((TParallelCoordVar*)fVarList->First())->GetNbins();
505 }
506 
507 ////////////////////////////////////////////////////////////////////////////////
508 /// Get a selection from its title.
509 
511 {
512  TIter next(fSelectList);
514  while ((sel = (TParallelCoordSelect*)next()) && strcmp(title,sel->GetTitle())) { }
515  return sel;
516 }
517 
518 ////////////////////////////////////////////////////////////////////////////////
519 /// return the tree if fTree is defined. If not, the method try to load the tree
520 /// from fTreeFileName.
521 
523 {
524  if (fTree) return fTree;
525  if (fTreeFileName=="" || fTreeName=="") {
526  Error("GetTree","Cannot load the tree: no tree defined!");
527  return 0;
528  }
530  if (!f) {
531  Error("GetTree","Tree file name : \"%s\" does not exist (Are you in the correct directory?).",fTreeFileName.Data());
532  return 0;
533  } else if (f->IsZombie()) {
534  Error("GetTree","while opening \"%s\".",fTreeFileName.Data());
535  return 0;
536  } else {
537  fTree = (TTree*)f->Get(fTreeName.Data());
538  if (!fTree) {
539  Error("GetTree","\"%s\" not found in \"%s\".", fTreeName.Data(), fTreeFileName.Data());
540  return 0;
541  } else {
543  TString varexp = "";
544  TIter next(fVarList);
545  TParallelCoordVar* var;
546  while ((var = (TParallelCoordVar*)next())) varexp.Append(Form(":%s",var->GetTitle()));
547  varexp.Remove(TString::kLeading,':');
548  fTree->Draw(varexp.Data(),"","goff");
549  TSelectorDraw* selector = (TSelectorDraw*)((TTreePlayer*)fTree->GetPlayer())->GetSelector();
550  next.Reset();
551  Int_t i = 0;
552  while ((var = (TParallelCoordVar*)next())) {
553  var->SetValues(fNentries, selector->GetVal(i));
554  ++i;
555  }
556  return fTree;
557  }
558  }
559 }
560 
561 ////////////////////////////////////////////////////////////////////////////////
562 /// Get the variables values from its title.
563 
564 Double_t* TParallelCoord::GetVariable(const char* vartitle)
565 {
566  TIter next(fVarList);
567  TParallelCoordVar* var = 0;
568  while(((var = (TParallelCoordVar*)next()) != 0) && (var->GetTitle() != vartitle)) { }
569  if(!var) return 0;
570  else return var->GetValues();
571 }
572 
573 ////////////////////////////////////////////////////////////////////////////////
574 /// Get the variables values from its index.
575 
577 {
578  if(i<0 || (UInt_t)i>fNvar) return 0;
579  else return ((TParallelCoordVar*)fVarList->At(i))->GetValues();
580 }
581 
582 ////////////////////////////////////////////////////////////////////////////////
583 /// Initialise the data members of TParallelCoord.
584 
586 {
587  fNentries = 0;
588  fVarList = 0;
589  fSelectList = 0;
597  fTree = 0;
598  fCurrentEntries = 0;
599  fInitEntries = 0;
600  fCurrentSelection = 0;
601  fNvar = 0;
602  fDotsSpacing = 0;
603  fCurrentFirst = 0;
604  fCurrentN = 0;
605  fCandleAxis = 0;
606  fWeightCut = 0;
607  fLineWidth = 1;
608  fLineColor = kGreen-8;
609  fTreeName = "";
610  fTreeFileName = "";
611 }
612 
613 ////////////////////////////////////////////////////////////////////////////////
614 /// Paint the parallel coordinates graph.
615 
617 {
618  if (!GetTree()) return;
619  gPad->Range(0,0,1,1);
620  TFrame *frame = gPad->GetFrame();
621  frame->SetLineColor(gPad->GetFillColor());
622  SetAxesPosition();
623  if(TestBit(kPaintEntries)){
624  PaintEntries(0);
625  TIter next(fSelectList);
627  while((sel = (TParallelCoordSelect*)next())) {
628  if(sel->GetSize()>0 && sel->TestBit(TParallelCoordSelect::kActivated)) {
629  PaintEntries(sel);
630  }
631  }
632  }
633  gPad->RangeAxis(0,0,1,1);
634 
635  TIter nextVar(fVarList);
636  TParallelCoordVar* var=0;
637  while((var = (TParallelCoordVar*)nextVar())) {
638  var->Paint();
639  }
640 }
641 
642 ////////////////////////////////////////////////////////////////////////////////
643 /// Loop over the entries and paint them.
644 
646 {
647  if (fVarList->GetSize() < 2) return;
648  Int_t i=0;
649  Long64_t n=0;
650 
651  Double_t *x = new Double_t[fNvar];
652  Double_t *y = new Double_t[fNvar];
653 
654  TGraph *gr = 0;
655  TPolyLine *pl = 0;
656  TAttLine *evline = 0;
657 
658  if (TestBit (kCurveDisplay)) {gr = new TGraph(fNvar); evline = (TAttLine*)gr;}
659  else {pl = new TPolyLine(fNvar); evline = (TAttLine*)pl;}
660 
661  if (fDotsSpacing == 0) evline->SetLineStyle(1);
662  else evline->SetLineStyle(11);
663  if (!sel){
664  evline->SetLineWidth(GetLineWidth());
665  evline->SetLineColor(GetLineColor());
666  } else {
667  evline->SetLineWidth(sel->GetLineWidth());
668  evline->SetLineColor(sel->GetLineColor());
669  }
670  TParallelCoordVar *var;
671 
672  TFrame *frame = gPad->GetFrame();
673  Double_t lx = ((frame->GetX2() - frame->GetX1())/(fNvar-1));
674  Double_t ly = ((frame->GetY2() - frame->GetY1())/(fNvar-1));
675  Double_t a,b;
676  TRandom r;
677 
679  TListIter next(fVarList);
680  Bool_t inrange = kTRUE;
681  // Loop to check whenever the entry must be painted.
682  if (sel) {
683  while ((var = (TParallelCoordVar*)next())){
684  if (!var->Eval(n,sel)) inrange = kFALSE;
685  }
686  }
687  if (fWeightCut > 0) {
688  next.Reset();
689  Int_t entryweight = 0;
690  while ((var = (TParallelCoordVar*)next())) entryweight+=var->GetEntryWeight(n);
691  if (entryweight/(Int_t)fNvar < fWeightCut) inrange = kFALSE;
692  }
693  if(!inrange) continue;
694  i = 0;
695  next.Reset();
696  // Loop to set the polyline points.
697  while ((var = (TParallelCoordVar*)next())) {
698  var->GetEntryXY(n,x[i],y[i]);
699  ++i;
700  }
701  // beginning to paint the first point at a random distance
702  // to avoid artefacts when increasing the dots spacing.
703  if (fDotsSpacing != 0) {
704  if (TestBit(kVertDisplay)) {
705  a = (y[1]-y[0])/(x[1]-x[0]);
706  b = y[0]-a*x[0];
707  x[0] = x[0]+lx*r.Rndm();
708  y[0] = a*x[0]+b;
709  } else {
710  a = (x[1]-x[0])/(y[1]-y[0]);
711  b = x[0]-a*y[0];
712  y[0] = y[0]+ly*r.Rndm();
713  x[0] = a*y[0]+b;
714  }
715  }
716  if (pl) pl->PaintPolyLine(fNvar,x,y);
717  else gr->PaintGraph(fNvar,x,y,"C");
718  }
719 
720  if (pl) delete pl;
721  if (gr) delete gr;
722  delete [] x;
723  delete [] y;
724 }
725 
726 ////////////////////////////////////////////////////////////////////////////////
727 /// Delete a variable from the graph.
728 
730 {
731  fVarList->Remove(var);
732  fNvar = fVarList->GetSize();
733  SetAxesPosition();
734 }
735 
736 ////////////////////////////////////////////////////////////////////////////////
737 /// Delete the variable "vartitle" from the graph.
738 
740 {
741  TIter next(fVarList);
742  TParallelCoordVar* var=0;
743  while((var = (TParallelCoordVar*)next())) {
744  if (!strcmp(var->GetTitle(),vartitle)) break;
745  }
746  if(!var) {
747  Error("RemoveVariable","\"%s\" not a variable",vartitle);
748  return kFALSE;
749  } else {
750  RemoveVariable(var);
751  delete var;
752  return kTRUE;
753  }
754 }
755 
756 ////////////////////////////////////////////////////////////////////////////////
757 /// Reset the tree entry list to the initial one..
758 
760 {
761  if(!fTree) return;
765  fCurrentFirst = 0;
767  TString varexp = "";
768  TIter next(fVarList);
769  TParallelCoordVar* var;
770  while ((var = (TParallelCoordVar*)next())) varexp.Append(Form(":%s",var->GetTitle()));
771  varexp.Remove(TString::kLeading,':');
772  fTree->Draw(varexp.Data(),"","goff");
773  next.Reset();
774  TSelectorDraw* selector = (TSelectorDraw*)((TTreePlayer*)fTree->GetPlayer())->GetSelector();
775  Int_t i = 0;
776  while ((var = (TParallelCoordVar*)next())) {
777  var->SetValues(fNentries, selector->GetVal(i));
778  ++i;
779  }
780  if (fSelectList) { // FIXME It would be better to update the selections by deleting
781  fSelectList->Delete(); // the meaningless ranges (selecting everything or nothing for example)
782  fCurrentSelection = 0; // after applying a new entrylist to the tree.
783  }
784  gPad->Modified();
785  gPad->Update();
786 }
787 
788 ////////////////////////////////////////////////////////////////////////////////
789 /// Save the entry lists in a root file "filename.root".
790 
791 void TParallelCoord::SaveEntryLists(const char* filename, Bool_t overwrite)
792 {
793  TString sfile = filename;
794  if (sfile == "") sfile = Form("%s_parallelcoord_entries.root",fTree->GetName());
795 
796  TFile* f = TFile::Open(sfile.Data());
797  if (f) {
798  Warning("SaveEntryLists","%s already exists.", sfile.Data());
799  if (!overwrite) return;
800  else Warning("SaveEntryLists","Overwriting.");
801  f = new TFile(sfile.Data(),"RECREATE");
802  } else {
803  f = new TFile(sfile.Data(),"CREATE");
804  }
805  gDirectory = f;
806  fInitEntries->Write("initentries");
807  fCurrentEntries->Write("currententries");
808  Info("SaveEntryLists","File \"%s\" written.",sfile.Data());
809 }
810 
811 ////////////////////////////////////////////////////////////////////////////////
812 /// Save the TParallelCoord in a macro.
813 
814 void TParallelCoord::SavePrimitive(std::ostream & out, Option_t* options)
815 {
816  TString opt = options;
817  opt.ToLower();
818  //Bool_t overwrite = opt.Contains("overwrite"); // Is there a way to specify "options" when saving ?
819  // Save the entrylists.
820  const char* filename = Form("%s_parallelcoord_entries.root",fTree->GetName());
821  SaveEntryLists(filename,kTRUE); // FIXME overwriting by default.
822  SaveTree(fTreeFileName,kTRUE); // FIXME overwriting by default.
823  out<<" // Create a TParallelCoord."<<std::endl;
824  out<<" TFile *f = TFile::Open(\""<<fTreeFileName.Data()<<"\");"<<std::endl;
825  out<<" TTree* tree = (TTree*)f->Get(\""<<fTreeName.Data()<<"\");"<<std::endl;
826  out<<" TParallelCoord* para = new TParallelCoord(tree,"<<fNentries<<");"<<std::endl;
827  out<<" // Load the entrylists."<<std::endl;
828  out<<" TFile *entries = TFile::Open(\""<<filename<<"\");"<<std::endl;
829  out<<" TEntryList *currententries = (TEntryList*)entries->Get(\"currententries\");"<<std::endl;
830  out<<" tree->SetEntryList(currententries);"<<std::endl;
831  out<<" para->SetInitEntries((TEntryList*)entries->Get(\"initentries\"));"<<std::endl;
832  out<<" para->SetCurrentEntries(currententries);"<<std::endl;
833  TIter next(fSelectList);
835  out<<" TParallelCoordSelect* sel;"<<std::endl;
836  out<<" para->GetSelectList()->Delete();"<<std::endl;
837  while ((sel = (TParallelCoordSelect*)next())) {
838  out<<" para->AddSelection(\""<<sel->GetTitle()<<"\");"<<std::endl;
839  out<<" sel = (TParallelCoordSelect*)para->GetSelectList()->Last();"<<std::endl;
840  out<<" sel->SetLineColor("<<sel->GetLineColor()<<");"<<std::endl;
841  out<<" sel->SetLineWidth("<<sel->GetLineWidth()<<");"<<std::endl;
842  }
843  TIter nextbis(fVarList);
844  TParallelCoordVar* var;
845  TString varexp = "";
846  while ((var = (TParallelCoordVar*)nextbis())) varexp.Append(Form(":%s",var->GetTitle()));
847  varexp.Remove(TString::kLeading,':');
848  out<<" tree->Draw(\""<<varexp.Data()<<"\",\"\",\"goff\");"<<std::endl;
849  out<<" TSelectorDraw* selector = (TSelectorDraw*)((TTreePlayer*)tree->GetPlayer())->GetSelector();"<<std::endl;
850  nextbis.Reset();
851  Int_t i=0;
852  out<<" TParallelCoordVar* var;"<<std::endl;
853  while ((var = (TParallelCoordVar*)nextbis())) {
854  out<<" //***************************************"<<std::endl;
855  out<<" // Create the axis \""<<var->GetTitle()<<"\"."<<std::endl;
856  out<<" para->AddVariable(selector->GetVal("<<i<<"),\""<<var->GetTitle()<<"\");"<<std::endl;
857  out<<" var = (TParallelCoordVar*)para->GetVarList()->Last();"<<std::endl;
858  var->SavePrimitive(out,"pcalled");
859  ++i;
860  }
861  out<<" //***************************************"<<std::endl;
862  out<<" // Set the TParallelCoord parameters."<<std::endl;
863  out<<" para->SetCurrentFirst("<<fCurrentFirst<<");"<<std::endl;
864  out<<" para->SetCurrentN("<<fCurrentN<<");"<<std::endl;
865  out<<" para->SetWeightCut("<<fWeightCut<<");"<<std::endl;
866  out<<" para->SetDotsSpacing("<<fDotsSpacing<<");"<<std::endl;
867  out<<" para->SetLineColor("<<GetLineColor()<<");"<<std::endl;
868  out<<" para->SetLineWidth("<<GetLineWidth()<<");"<<std::endl;
869  out<<" para->SetBit(TParallelCoord::kVertDisplay,"<<TestBit(kVertDisplay)<<");"<<std::endl;
870  out<<" para->SetBit(TParallelCoord::kCurveDisplay,"<<TestBit(kCurveDisplay)<<");"<<std::endl;
871  out<<" para->SetBit(TParallelCoord::kPaintEntries,"<<TestBit(kPaintEntries)<<");"<<std::endl;
872  out<<" para->SetBit(TParallelCoord::kLiveUpdate,"<<TestBit(kLiveUpdate)<<");"<<std::endl;
873  out<<" para->SetBit(TParallelCoord::kGlobalLogScale,"<<TestBit(kGlobalLogScale)<<");"<<std::endl;
874  if (TestBit(kGlobalScale)) out<<" para->SetGlobalScale(kTRUE);"<<std::endl;
875  if (TestBit(kCandleChart)) out<<" para->SetCandleChart(kTRUE);"<<std::endl;
876  if (TestBit(kGlobalLogScale)) out<<" para->SetGlobalLogScale(kTRUE);"<<std::endl;
877  out<<std::endl<<" para->Draw();"<<std::endl;
878 }
879 
880 ////////////////////////////////////////////////////////////////////////////////
881 /// Save the tree in a file if fTreeFileName == "".
882 
883 void TParallelCoord::SaveTree(const char* filename, Bool_t overwrite)
884 {
885  if (!(fTreeFileName=="")) return;
886  TString sfile = filename;
887  if (sfile == "") sfile = Form("%s.root",fTree->GetName());
888 
889  TFile* f = TFile::Open(sfile.Data());
890  if (f) {
891  Warning("SaveTree","%s already exists.", sfile.Data());
892  if (!overwrite) return;
893  else Warning("SaveTree","Overwriting.");
894  f = new TFile(sfile.Data(),"RECREATE");
895  } else {
896  f = new TFile(sfile.Data(),"CREATE");
897  }
898  gDirectory = f;
900  fTreeFileName = sfile;
901  Info("SaveTree","File \"%s\" written.",sfile.Data());
902 }
903 
904 ////////////////////////////////////////////////////////////////////////////////
905 /// Update the position of the axes.
906 
908 {
909  if(!gPad) return;
910  Bool_t vert = TestBit (kVertDisplay);
911  TFrame *frame = gPad->GetFrame();
912  if (fVarList->GetSize() > 1) {
913  if (vert) {
914  frame->SetX1(1.0/((Double_t)fVarList->GetSize()+1));
915  frame->SetX2(1-frame->GetX1());
916  frame->SetY1(0.1);
917  frame->SetY2(0.9);
918  gPad->RangeAxis(1.0/((Double_t)fVarList->GetSize()+1),0.1,1-frame->GetX1(),0.9);
919  } else {
920  frame->SetX1(0.1);
921  frame->SetX2(0.9);
922  frame->SetY1(1.0/((Double_t)fVarList->GetSize()+1));
923  frame->SetY2(1-frame->GetY1());
924  gPad->RangeAxis(0.1,1.0/((Double_t)fVarList->GetSize()+1),0.9,1-frame->GetY1());
925  }
926 
927  Double_t horSpace = (frame->GetX2() - frame->GetX1())/(fNvar-1);
928  Double_t verSpace = (frame->GetY2() - frame->GetY1())/(fNvar-1);
929  Int_t i=0;
930  TIter next(fVarList);
931 
932  TParallelCoordVar* var;
933  while((var = (TParallelCoordVar*)next())){
934  if (vert) var->SetX(gPad->GetFrame()->GetX1() + i*horSpace,TestBit(kGlobalScale));
935  else var->SetY(gPad->GetFrame()->GetY1() + i*verSpace,TestBit(kGlobalScale));
936  ++i;
937  }
938  } else if (fVarList->GetSize()==1) {
939  frame->SetX1(0.1);
940  frame->SetX2(0.9);
941  frame->SetY1(0.1);
942  frame->SetY2(0.9);
943  if (vert) ((TParallelCoordVar*)fVarList->First())->SetX(0.5,TestBit(kGlobalScale));
944  else ((TParallelCoordVar*)fVarList->First())->SetY(0.5,TestBit(kGlobalScale));
945  }
946 }
947 
948 ////////////////////////////////////////////////////////////////////////////////
949 /// Set the same histogram axis binning for all axis.
950 
952 {
953  TIter next(fVarList);
954  TParallelCoordVar *var;
955  while((var = (TParallelCoordVar*)next())) var->SetHistogramBinning(n);
956 }
957 
958 ////////////////////////////////////////////////////////////////////////////////
959 /// Set the same histogram axis height for all axis.
960 
962 {
963  TIter next(fVarList);
964  TParallelCoordVar *var;
965  while((var = (TParallelCoordVar*)next())) var->SetHistogramHeight(h);
966 }
967 
968 ////////////////////////////////////////////////////////////////////////////////
969 /// All axes in log scale.
970 
972 {
973  if (lt == TestBit(kGlobalLogScale)) return;
975  TIter next(fVarList);
976  TParallelCoordVar* var;
977  while ((var = (TParallelCoordVar*)next())) var->SetLogScale(lt);
979 }
980 
981 ////////////////////////////////////////////////////////////////////////////////
982 /// Constraint all axes to the same scale.
983 
985 {
986  SetBit(kGlobalScale,gl);
987  if (fCandleAxis) {
988  delete fCandleAxis;
989  fCandleAxis = 0;
990  }
991  if (gl) {
992  Double_t min,max;
993  min = GetGlobalMin();
994  max = GetGlobalMax();
995  if (TestBit(kGlobalLogScale) && min<=0) min = 0.00001*max;
996  if (TestBit(kVertDisplay)) {
997  if (!TestBit(kGlobalLogScale)) fCandleAxis = new TGaxis(0.05,0.1,0.05,0.9,min,max);
998  else fCandleAxis = new TGaxis(0.05,0.1,0.05,0.9,min,max,510,"G");
999  } else {
1000  if (!TestBit(kGlobalLogScale)) fCandleAxis = new TGaxis(0.1,0.05,0.9,0.05,min,max);
1001  else fCandleAxis = new TGaxis(0.1,0.05,0.9,0.05,min,max,510,"G");
1002  }
1003  fCandleAxis->Draw();
1004  SetGlobalMin(min);
1005  SetGlobalMax(max);
1006  TIter next(fVarList);
1007  TParallelCoordVar* var;
1008  while ((var = (TParallelCoordVar*)next())) var->GetHistogram();
1009  }
1010  gPad->Modified();
1011  gPad->Update();
1012 }
1013 
1014 ////////////////////////////////////////////////////////////////////////////////
1015 /// Set the same histogram axis line width for all axis.
1016 
1018 {
1019  TIter next(fVarList);
1020  TParallelCoordVar *var;
1021  while((var = (TParallelCoordVar*)next())) var->SetHistogramLineWidth(lw);
1022 }
1023 
1024 ////////////////////////////////////////////////////////////////////////////////
1025 /// Set a candle chart display.
1026 
1028 {
1029  SetBit(kCandleChart,can);
1030  SetGlobalScale(can);
1031  TIter next(fVarList);
1032  TParallelCoordVar* var;
1033  while ((var = (TParallelCoordVar*)next())) {
1034  var->SetBoxPlot(can);
1035  var->SetHistogramLineWidth(0);
1036  }
1037  if (fCandleAxis) delete fCandleAxis;
1038  fCandleAxis = 0;
1039  SetBit(kPaintEntries,!can);
1040  if (can) {
1041  if (TestBit(kVertDisplay)) fCandleAxis = new TGaxis(0.05,0.1,0.05,0.9,GetGlobalMin(),GetGlobalMax());
1042  else fCandleAxis = new TGaxis(0.1,0.05,0.9,0.05,GetGlobalMin(),GetGlobalMax());
1043  fCandleAxis->Draw();
1044  } else {
1045  if (fCandleAxis) {
1046  delete fCandleAxis;
1047  fCandleAxis = 0;
1048  }
1049  }
1050  gPad->Modified();
1051  gPad->Update();
1052 }
1053 
1054 ////////////////////////////////////////////////////////////////////////////////
1055 /// Set the first entry to be displayed.
1056 
1058 {
1059  if(f<0 || f>fNentries) return;
1060  fCurrentFirst = f;
1062  TIter next(fVarList);
1063  TParallelCoordVar* var;
1064  while ((var = (TParallelCoordVar*)next())) {
1065  var->GetMinMaxMean();
1066  var->GetHistogram();
1068  }
1069 }
1070 
1071 ////////////////////////////////////////////////////////////////////////////////
1072 /// Set the number of entry to be displayed.
1073 
1075 {
1076  if(n<=0) return;
1078  else fCurrentN = n;
1079  TIter next(fVarList);
1080  TParallelCoordVar* var;
1081  while ((var = (TParallelCoordVar*)next())) {
1082  var->GetMinMaxMean();
1083  var->GetHistogram();
1085  }
1086 }
1087 
1088 ////////////////////////////////////////////////////////////////////////////////
1089 /// Set the selection being edited.
1090 
1092 {
1094  TIter next(fSelectList);
1095  TParallelCoordSelect* sel;
1096  while((sel = (TParallelCoordSelect*)next()) && strcmp(sel->GetTitle(),title))
1097  if (sel) fCurrentSelection = sel;
1098  return sel;
1099 }
1100 
1101 ////////////////////////////////////////////////////////////////////////////////
1102 /// Set the selection being edited.
1103 
1105 {
1106  if (fCurrentSelection == sel) return;
1107  fCurrentSelection = sel;
1108 }
1109 
1110 ////////////////////////////////////////////////////////////////////////////////
1111 /// Set dots spacing. Modify the line style 11.
1112 /// If the canvas support transparency dot spacing is ignored.
1113 
1115 {
1116  if (gPad->GetCanvas()->SupportAlpha()) return;
1117  if (s == fDotsSpacing) return;
1118  fDotsSpacing = s;
1119  gStyle->SetLineStyleString(11,Form("%d %d",4,s*8));
1120 }
1121 
1122 ////////////////////////////////////////////////////////////////////////////////
1123 /// Set the entry lists of "para".
1124 
1126 {
1127  para->SetCurrentEntries(enlist);
1128  para->SetInitEntries(enlist);
1129 }
1130 
1131 ////////////////////////////////////////////////////////////////////////////////
1132 /// Force all variables to adopt the same max.
1133 
1135 {
1136  TIter next(fVarList);
1137  TParallelCoordVar* var;
1138  while ((var = (TParallelCoordVar*)next())) {
1139  var->SetCurrentMax(max);
1140  }
1141 }
1142 
1143 ////////////////////////////////////////////////////////////////////////////////
1144 /// Force all variables to adopt the same min.
1145 
1147 {
1148  TIter next(fVarList);
1149  TParallelCoordVar* var;
1150  while ((var = (TParallelCoordVar*)next())) {
1151  var->SetCurrentMin(min);
1152  }
1153 }
1154 
1155 ////////////////////////////////////////////////////////////////////////////////
1156 /// If true, the pad is updated while the motion of a dragged range.
1157 
1159 {
1160  SetBit(kLiveUpdate,on);
1161  TIter next(fVarList);
1162  TParallelCoordVar* var;
1163  while((var = (TParallelCoordVar*)next())) var->SetLiveRangesUpdate(on);
1164 }
1165 
1166 ////////////////////////////////////////////////////////////////////////////////
1167 /// Set the vertical or horizontal display.
1168 
1170 {
1171  if (vert == TestBit (kVertDisplay)) return;
1172  SetBit(kVertDisplay,vert);
1173  if (!gPad) return;
1174  TFrame* frame = gPad->GetFrame();
1175  if (!frame) return;
1176  UInt_t ui = 0;
1177  Double_t horaxisspace = (frame->GetX2() - frame->GetX1())/(fNvar-1);
1178  Double_t veraxisspace = (frame->GetY2() - frame->GetY1())/(fNvar-1);
1179  TIter next(fVarList);
1180  TParallelCoordVar* var;
1181  while ((var = (TParallelCoordVar*)next())) {
1182  if (vert) var->SetX(frame->GetX1() + ui*horaxisspace,TestBit(kGlobalScale));
1183  else var->SetY(frame->GetY1() + ui*veraxisspace,TestBit(kGlobalScale));
1184  ++ui;
1185  }
1186  if (TestBit(kCandleChart)) {
1187  if (fCandleAxis) delete fCandleAxis;
1188  if (TestBit(kVertDisplay)) fCandleAxis = new TGaxis(0.05,0.1,0.05,0.9,GetGlobalMin(),GetGlobalMax());
1189  else fCandleAxis = new TGaxis(0.1,0.05,0.9,0.05,GetGlobalMin(),GetGlobalMax());
1190  fCandleAxis->Draw();
1191  }
1192  gPad->Modified();
1193  gPad->Update();
1194 }
1195 
1196 ////////////////////////////////////////////////////////////////////////////////
1197 /// Unzoom all variables.
1198 
1200 {
1201  TIter next(fVarList);
1202  TParallelCoordVar* var;
1203  while((var = (TParallelCoordVar*)next())) var->Unzoom();
1204 }
TParallelCoord::fCurrentFirst
Long64_t fCurrentFirst
Definition: TParallelCoord.h:42
TParallelCoordVar
TParallelCoord axes.
Definition: TParallelCoordVar.h:24
TPolyLine
Defined by an array on N points in a 2-D space.
Definition: TPolyLine.h:23
TBox::SetY2
virtual void SetY2(Double_t y2)
Definition: TBox.h:64
n
const Int_t n
Definition: legend1.C:16
TParallelCoordVar::SetCurrentMax
void SetCurrentMax(Double_t max)
Set the current maximum of the axis.
Definition: TParallelCoordVar.cxx:912
TParallelCoord::kVertDisplay
@ kVertDisplay
Definition: TParallelCoord.h:31
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TTreePlayer.h
TWbox::SetBorderMode
virtual void SetBorderMode(Short_t bordermode)
Definition: TWbox.h:51
TObject::TestBit
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:172
TGraph::kClipFrame
@ kClipFrame
clip to the frame boundary
Definition: TGraph.h:70
f
#define f(i)
Definition: RSha256.hxx:104
TAttFill::SetFillStyle
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
Definition: TAttFill.h:39
Option_t
const char Option_t
Definition: RtypesCore.h:66
TParallelCoord::Draw
virtual void Draw(Option_t *options="")
Draw the parallel coordinates graph.
Definition: TParallelCoord.cxx:359
TTree::GetV1
virtual Double_t * GetV1()
Definition: TTree.h:531
TParallelCoord::fLineColor
Color_t fLineColor
Definition: TParallelCoord.h:46
TTree::GetPlayer
TVirtualTreePlayer * GetPlayer()
Load the TTreePlayer (if not already done).
Definition: TTree.cxx:6203
TParallelCoordVar::Eval
Bool_t Eval(Long64_t evtidx, TParallelCoordSelect *select)
Check if the entry is within the range(s) of "select".
Definition: TParallelCoordVar.cxx:160
TPolyLine::PaintPolyLine
virtual void PaintPolyLine(Int_t n, Double_t *x, Double_t *y, Option_t *option="")
Draw this polyline with new coordinates.
Definition: TPolyLine.cxx:544
kGreen
@ kGreen
Definition: Rtypes.h:66
TStyle::SetLineStyleString
void SetLineStyleString(Int_t i, const char *text)
Set line style string using the PostScript convention.
Definition: TStyle.cxx:1431
TParallelCoord::fInitEntries
TEntryList * fInitEntries
Definition: TParallelCoord.h:50
TList::Delete
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
Definition: TList.cxx:469
TParallelCoord::Init
void Init()
An axis used when displaying a candle chart.
Definition: TParallelCoord.cxx:585
TString::Data
const char * Data() const
Definition: TString.h:369
TParallelCoordVar::GetEntryXY
void GetEntryXY(Long64_t n, Double_t &x, Double_t &y)
Get the position of the variable on the graph for the n'th entry.
Definition: TParallelCoordVar.cxx:317
tree
Definition: tree.py:1
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
Form
char * Form(const char *fmt,...)
TNamed::GetTitle
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
TPolyLine.h
TBox::GetX1
Double_t GetX1() const
Definition: TBox.h:50
TParallelCoord::SetCurrentFirst
void SetCurrentFirst(Long64_t)
Set the first entry to be displayed.
Definition: TParallelCoord.cxx:1057
TParallelCoordVar::GetCurrentMin
Double_t GetCurrentMin() const
Definition: TParallelCoordVar.h:72
r
ROOT::R::TRInterface & r
Definition: Object.C:4
TGraph.h
TParallelCoordVar::SetX
void SetX(Double_t x, Bool_t gl)
Set the X position of the axis in the case of a vertical axis.
Definition: TParallelCoordVar.cxx:992
TObject::Info
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition: TObject.cxx:864
Long64_t
long long Long64_t
Definition: RtypesCore.h:73
TView.h
TObject::Error
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:890
TParallelCoord::SetGlobalScale
void SetGlobalScale(Bool_t gl)
Constraint all axes to the same scale.
Definition: TParallelCoord.cxx:984
TSelectorDraw::GetSelect
TTreeFormula * GetSelect() const
Definition: TSelectorDraw.h:88
TParallelCoordVar::SetBoxPlot
void SetBoxPlot(Bool_t box)
Set the axis to display a candle.
Definition: TParallelCoordVar.cxx:869
TTree
A TTree represents a columnar dataset.
Definition: TTree.h:79
TParallelCoordVar::SetLogScale
void SetLogScale(Bool_t log)
Set the axis in log scale.
Definition: TParallelCoordVar.cxx:955
exp
double exp(double)
TTreeFormula.h
TParallelCoordVar::GetValues
Double_t * GetValues()
Definition: TParallelCoordVar.h:88
TRandom.h
estimate
REAL estimate(int elen, REAL *e)
Definition: triangle.c:5087
TParallelCoordVar.h
TStyle.h
TGeant4Unit::s
static constexpr double s
Definition: TGeant4SystemOfUnits.h:162
TFile::Open
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
Definition: TFile.cxx:3995
TParallelCoord::ApplySelectionToTree
void ApplySelectionToTree()
Apply the current selection to the tree.
Definition: TParallelCoord.cxx:252
TParallelCoord
Parallel Coordinates class.
Definition: TParallelCoord.h:28
TParallelCoordVar::kShowBox
@ kShowBox
Definition: TParallelCoordVar.h:28
TParallelCoord::SaveTree
void SaveTree(const char *filename="", Bool_t overwrite=kFALSE)
Save the tree in a file if fTreeFileName == "".
Definition: TParallelCoord.cxx:883
TParallelCoord::fCurrentSelection
TParallelCoordSelect * fCurrentSelection
Definition: TParallelCoord.h:56
TObject::AppendPad
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
Definition: TObject.cxx:107
TSelectorDraw::GetNfill
virtual Int_t GetNfill() const
Definition: TSelectorDraw.h:86
TGeant4Unit::pc
static constexpr double pc
Definition: TGeant4SystemOfUnits.h:130
TString::Contains
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:624
TParallelCoord::GetSelection
TParallelCoordSelect * GetSelection(const char *title)
Get a selection from its title.
Definition: TParallelCoord.cxx:510
x
Double_t x[n]
Definition: legend1.C:17
TParallelCoordVar::SetValues
void SetValues(Long64_t length, Double_t *val)
Set the variable values.
Definition: TParallelCoordVar.cxx:977
nentries
int nentries
Definition: THbookFile.cxx:91
TParallelCoord::kGlobalScale
@ kGlobalScale
Definition: TParallelCoord.h:35
TIter::Reset
void Reset()
Definition: TCollection.h:252
TParallelCoord::GetLineWidth
Width_t GetLineWidth()
Definition: TParallelCoord.h:93
TParallelCoord::GetEntryList
TEntryList * GetEntryList(Bool_t sel=kTRUE)
Get the whole entry list or one for a selection.
Definition: TParallelCoord.cxx:450
TParallelCoord::SetEntryList
static void SetEntryList(TParallelCoord *para, TEntryList *enlist)
Set the entry lists of "para".
Definition: TParallelCoord.cxx:1125
TAttLine::SetLineColor
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition: TAttLine.h:40
TCollection::Contains
Bool_t Contains(const char *name) const
Definition: TCollection.h:169
TParallelCoordVar::SetY
void SetY(Double_t y, Bool_t gl)
Set the Y position of the axis in the case of a horizontal axis.
Definition: TParallelCoordVar.cxx:1011
TParallelCoord::SetGlobalMax
void SetGlobalMax(Double_t max)
Force all variables to adopt the same max.
Definition: TParallelCoord.cxx:1134
TCanvas.h
TTree.h
TParallelCoordVar::SetCurrentMin
void SetCurrentMin(Double_t min)
Set the current minimum of the axis.
Definition: TParallelCoordVar.cxx:904
TString
Basic string class.
Definition: TString.h:136
TParallelCoord::SetGlobalLogScale
void SetGlobalLogScale(Bool_t)
All axes in log scale.
Definition: TParallelCoord.cxx:971
TParallelCoord::fLineWidth
Width_t fLineWidth
Definition: TParallelCoord.h:47
TParallelCoord::fCandleAxis
TGaxis * fCandleAxis
Current Selection being edited.
Definition: TParallelCoord.h:57
TParallelCoord::SetLiveRangesUpdate
void SetLiveRangesUpdate(Bool_t)
If true, the pad is updated while the motion of a dragged range.
Definition: TParallelCoord.cxx:1158
TParallelCoord::GetGlobalMin
Double_t GetGlobalMin()
return the global minimum.
Definition: TParallelCoord.cxx:488
b
#define b(i)
Definition: RSha256.hxx:100
TFile.h
TParallelCoord::SetInitEntries
void SetInitEntries(TEntryList *entries)
Definition: TParallelCoord.h:126
TParallelCoordVar::SetLiveRangesUpdate
void SetLiveRangesUpdate(Bool_t on)
If true, the pad is updated while the motion of a dragged range.
Definition: TParallelCoordVar.cxx:945
bool
TTree::Write
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
Definition: TTree.cxx:9568
TString::ReplaceAll
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition: TString.h:692
TListIter
Iterator of linked list.
Definition: TList.h:200
TPaveText.h
TSelectorDraw::GetVar
TTreeFormula * GetVar(Int_t i) const
Return the TTreeFormula corresponding to the i-th component of the request formula (where the compone...
Definition: TSelectorDraw.cxx:1081
TParallelCoord::Paint
virtual void Paint(Option_t *options="")
Paint the parallel coordinates graph.
Definition: TParallelCoord.cxx:616
TParallelCoord::SetCurrentEntries
void SetCurrentEntries(TEntryList *entries)
Definition: TParallelCoord.h:115
TParallelCoordVar::GetHistogram
TH1F * GetHistogram()
Create or recreate the histogram.
Definition: TParallelCoordVar.cxx:355
TBox::SetY1
virtual void SetY1(Double_t y1)
Definition: TBox.h:63
x1
static const double x1[5]
Definition: RooGaussKronrodIntegrator1D.cxx:346
TParallelCoord::SetAxisHistogramBinning
void SetAxisHistogramBinning(Int_t n=100)
Set the same histogram axis binning for all axis.
Definition: TParallelCoord.cxx:951
TROOT.h
TPaveText::Draw
virtual void Draw(Option_t *option="")
Draw this pavetext with its current attributes.
Definition: TPaveText.cxx:234
TParallelCoord::GetLineColor
Color_t GetLineColor()
Definition: TParallelCoord.h:92
TList::First
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
Definition: TList.cxx:658
TTreePlayer
Implement some of the functionality of the class TTree requiring access to extra libraries (Histogram...
Definition: TTreePlayer.h:37
TParallelCoord::GetCurrentSelection
TParallelCoordSelect * GetCurrentSelection()
Return the selection currently being edited.
Definition: TParallelCoord.cxx:438
TTree::GetCurrentFile
TFile * GetCurrentFile() const
Return pointer to the current file.
Definition: TTree.cxx:5378
TList::At
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
Definition: TList.cxx:356
TEntryList::GetEntry
virtual Long64_t GetEntry(Int_t index)
Return the number of the entry #index of this TEntryList in the TTree or TChain See also Next().
Definition: TEntryList.cxx:657
TParallelCoordRange.h
TParallelCoordVar::GetCurrentMax
Double_t GetCurrentMax() const
Definition: TParallelCoordVar.h:73
TParallelCoordSelect
A TParallelCoordSelect is a specialised TList to hold TParallelCoordRanges used by TParallelCoord.
Definition: TParallelCoordRange.h:69
TRandom
This is the base class for the ROOT Random number generators.
Definition: TRandom.h:27
TParallelCoord::SetAxisHistogramHeight
void SetAxisHistogramHeight(Double_t h=0.5)
Set the same histogram axis height for all axis.
Definition: TParallelCoord.cxx:961
TAttLine
Line Attributes class.
Definition: TAttLine.h:18
TView
See TView3D.
Definition: TView.h:25
TParallelCoord::fDotsSpacing
Int_t fDotsSpacing
Definition: TParallelCoord.h:45
gStyle
R__EXTERN TStyle * gStyle
Definition: TStyle.h:412
TParallelCoord::fCurrentEntries
TEntryList * fCurrentEntries
Definition: TParallelCoord.h:49
TParallelCoord::SetCurrentN
void SetCurrentN(Long64_t)
Set the number of entry to be displayed.
Definition: TParallelCoord.cxx:1074
TParallelCoord::ExecuteEvent
virtual void ExecuteEvent(Int_t entry, Int_t px, Int_t py)
Execute the corresponding entry.
Definition: TParallelCoord.cxx:429
TParallelCoordVar::GetEntryWeight
Int_t GetEntryWeight(Long64_t evtidx)
Get the entry weight: The weight of an entry for a given variable is the bin content of the histogram...
Definition: TParallelCoordVar.cxx:346
h
#define h(i)
Definition: RSha256.hxx:106
TEntryList::Enter
virtual Bool_t Enter(Long64_t entry, TTree *tree=0)
Add entry #entry to the list.
Definition: TEntryList.cxx:560
TAttLine::GetLineColor
virtual Color_t GetLineColor() const
Return the line color.
Definition: TAttLine.h:33
TBox::GetY1
Double_t GetY1() const
Definition: TBox.h:52
TObject::SetBit
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:696
gr
TGraphErrors * gr
Definition: legend1.C:25
TParallelCoord::DeleteSelection
void DeleteSelection(TParallelCoordSelect *sel)
Delete a selection.
Definition: TParallelCoord.cxx:325
TParallelCoordVar::GetQuantiles
void GetQuantiles()
Get the box plot values (quantiles).
Definition: TParallelCoordVar.cxx:429
a
auto * a
Definition: textangle.C:12
TString::Remove
TString & Remove(Ssiz_t pos)
Definition: TString.h:673
TNamed
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
TParallelCoord::SetCandleChart
void SetCandleChart(Bool_t can)
Set a candle chart display.
Definition: TParallelCoord.cxx:1027
TParallelCoord::fCurrentN
Long64_t fCurrentN
Definition: TParallelCoord.h:43
TParallelCoordVar::Paint
virtual void Paint(Option_t *option="")
Paint the axis.
Definition: TParallelCoordVar.cxx:549
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TString::Append
TString & Append(const char *cs)
Definition: TString.h:564
TTree::SetEntryList
virtual void SetEntryList(TEntryList *list, Option_t *opt="")
Set an EntryList.
Definition: TTree.cxx:8866
TParallelCoord::fNvar
UInt_t fNvar
Definition: TParallelCoord.h:41
TParallelCoord::RemoveVariable
void RemoveVariable(TParallelCoordVar *var)
Delete a variable from the graph.
Definition: TParallelCoord.cxx:729
gDirectory
#define gDirectory
Definition: TDirectory.h:236
TParallelCoordVar::GetMinMaxMean
void GetMinMaxMean()
Get mean, min and max of those variable.
Definition: TParallelCoordVar.cxx:372
TBox::GetY2
Double_t GetY2() const
Definition: TBox.h:53
TParallelCoord.h
TTree::Draw
virtual void Draw(Option_t *opt)
Default Draw method for all objects.
Definition: TTree.h:427
TParallelCoord::SetGlobalMin
void SetGlobalMin(Double_t min)
Force all variables to adopt the same min.
Definition: TParallelCoord.cxx:1146
TListIter::Reset
void Reset()
Reset list iterator.
Definition: TList.cxx:1160
TVirtualPad.h
TWbox::SetBorderSize
virtual void SetBorderSize(Short_t bordersize)
Definition: TWbox.h:52
TParallelCoord::GetNbins
Int_t GetNbins()
get the binning of the histograms.
Definition: TParallelCoord.cxx:502
y
Double_t y[n]
Definition: legend1.C:17
TParallelCoordSelect::GetTitle
const char * GetTitle() const
Returns title of object.
Definition: TParallelCoordRange.h:84
TParallelCoord::SavePrimitive
void SavePrimitive(std::ostream &out, Option_t *options)
Save the TParallelCoord in a macro.
Definition: TParallelCoord.cxx:814
TBox::GetX2
Double_t GetX2() const
Definition: TBox.h:51
TParallelCoordVar::SetHistogramBinning
void SetHistogramBinning(Int_t n=100)
Set the histogram binning.
Definition: TParallelCoordVar.cxx:882
TParallelCoord::SetDotsSpacing
void SetDotsSpacing(Int_t s=0)
Set dots spacing.
Definition: TParallelCoord.cxx:1114
TParallelCoord::SaveEntryLists
void SaveEntryLists(const char *filename="", Bool_t overwrite=kFALSE)
Save the entry lists in a root file "filename.root".
Definition: TParallelCoord.cxx:791
TParallelCoord::DistancetoPrimitive
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute the distance from the TParallelCoord.
Definition: TParallelCoord.cxx:336
TObject::Warning
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:876
TObject::kCanDelete
@ kCanDelete
if object in a list can be deleted
Definition: TObject.h:58
TFile
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
Definition: TFile.h:54
kHand
@ kHand
Definition: GuiTypes.h:373
unsigned int
TFrame
Define a Frame.
Definition: TFrame.h:19
TEntryList
A List of entry numbers in a TTree or TChain.
Definition: TEntryList.h:26
TParallelCoord::GetTree
TTree * GetTree()
return the tree if fTree is defined.
Definition: TParallelCoord.cxx:522
TPaveText::AddText
virtual TText * AddText(Double_t x1, Double_t y1, const char *label)
Add a new Text line to this pavetext at given coordinates.
Definition: TPaveText.cxx:183
TParallelCoordVar::SavePrimitive
void SavePrimitive(std::ostream &out, Option_t *options)
Save the TParallelCoordVar as a macro.
Definition: TParallelCoordVar.cxx:831
TGaxis.h
TBox::SetX2
virtual void SetX2(Double_t x2)
Definition: TBox.h:62
TParallelCoord::AddVariable
void AddVariable(Double_t *val, const char *title="")
Add a variable.
Definition: TParallelCoord.cxx:199
TAttLine::SetLineWidth
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition: TAttLine.h:43
TParallelCoord::kCurveDisplay
@ kCurveDisplay
Definition: TParallelCoord.h:32
TParallelCoord::kPaintEntries
@ kPaintEntries
Definition: TParallelCoord.h:33
TParallelCoord::GetVariable
Double_t * GetVariable(const char *var)
Get the variables values from its title.
Definition: TParallelCoord.cxx:564
TParallelCoordRange
A TParallelCoordRange is a range used for parallel coordinates plots.
Definition: TParallelCoordRange.h:25
TObject::Draw
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition: TObject.cxx:197
TParallelCoord::GetGlobalMax
Double_t GetGlobalMax()
return the global maximum.
Definition: TParallelCoord.cxx:474
Double_t
double Double_t
Definition: RtypesCore.h:59
TGraph
A TGraph is an object made of two arrays X and Y with npoints each.
Definition: TGraph.h:41
TParallelCoordVar::SetHistogramHeight
void SetHistogramHeight(Double_t h=0)
Set the height of the bar histogram.
Definition: TParallelCoordVar.cxx:892
TSelectorDraw.h
TParallelCoord::fWeightCut
Int_t fWeightCut
Definition: TParallelCoord.h:48
TParallelCoordVar::SetHistogramLineWidth
void SetHistogramLineWidth(Int_t lw=2)
Definition: TParallelCoordVar.h:101
TCanvas
The Canvas class.
Definition: TCanvas.h:23
TList::Remove
virtual TObject * Remove(TObject *obj)
Remove object from the list.
Definition: TList.cxx:821
TSelectorDraw::GetVal
virtual Double_t * GetVal(Int_t i) const
Return the last values corresponding to the i-th component of the formula being processed (where the ...
Definition: TSelectorDraw.cxx:1069
TCollection::GetSize
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Definition: TCollection.h:182
TGaxis
The axis painter class.
Definition: TGaxis.h:23
TParallelCoord::UnzoomAll
void UnzoomAll()
Unzoom all variables.
Definition: TParallelCoord.cxx:1199
TParallelCoord::SetAxesPosition
void SetAxesPosition()
Update the position of the axes.
Definition: TParallelCoord.cxx:907
TParallelCoord::TParallelCoord
TParallelCoord()
Default constructor.
Definition: TParallelCoord.cxx:130
TParallelCoordSelect::kActivated
@ kActivated
Definition: TParallelCoordRange.h:72
TObject::Write
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
Definition: TObject.cxx:795
TList::Add
virtual void Add(TObject *obj)
Definition: TList.h:87
TParallelCoord::fSelectList
TList * fSelectList
Definition: TParallelCoord.h:55
TFrame.h
TEntryList.h
TParallelCoord::fNentries
Long64_t fNentries
Definition: TParallelCoord.h:44
TParallelCoord::fTreeFileName
TString fTreeFileName
Definition: TParallelCoord.h:53
TParallelCoord::PaintEntries
void PaintEntries(TParallelCoordSelect *sel=NULL)
Loop over the entries and paint them.
Definition: TParallelCoord.cxx:645
TParallelCoordVar::Unzoom
void Unzoom()
Definition: TParallelCoordVar.h:115
x2
static const double x2[5]
Definition: RooGaussKronrodIntegrator1D.cxx:364
gPad
#define gPad
Definition: TVirtualPad.h:287
TIter
Definition: TCollection.h:233
TFrame::Draw
virtual void Draw(Option_t *option="")
Draw this frame with its current attributes.
Definition: TFrame.cxx:67
TParallelCoord::BuildParallelCoord
static void BuildParallelCoord(TSelectorDraw *selector, Bool_t candle)
Call constructor and add the variables.
Definition: TParallelCoord.cxx:288
TString::kLeading
@ kLeading
Definition: TString.h:267
TParallelCoord::fTree
TTree * fTree
Definition: TParallelCoord.h:51
TPaveText
A Pave (see TPave) with text, lines or/and boxes inside.
Definition: TPaveText.h:21
TParallelCoord::ResetTree
void ResetTree()
Reset the tree entry list to the initial one..
Definition: TParallelCoord.cxx:759
TAttLine::GetLineWidth
virtual Width_t GetLineWidth() const
Return the line width.
Definition: TAttLine.h:35
TBox::SetX1
virtual void SetX1(Double_t x1)
Definition: TBox.h:61
TNamed::GetName
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
TParallelCoord::AddSelection
void AddSelection(const char *title)
Add a selection.
Definition: TParallelCoord.cxx:242
TSelector::SetObject
virtual void SetObject(TObject *obj)
Definition: TSelector.h:65
Class
void Class()
Definition: Class.C:29
TString::ToLower
void ToLower()
Change string to lower-case.
Definition: TString.cxx:1125
TParallelCoord::fVarList
TList * fVarList
Definition: TParallelCoord.h:54
TParallelCoord::fTreeName
TString fTreeName
Pointer to the TTree.
Definition: TParallelCoord.h:52
TAttLine::SetLineStyle
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
Definition: TAttLine.h:42
TParallelCoord::SetAxisHistogramLineWidth
void SetAxisHistogramLineWidth(Int_t lw=2)
Set the same histogram axis line width for all axis.
Definition: TParallelCoord.cxx:1017
TParallelCoord::CleanUpSelections
void CleanUpSelections(TParallelCoordRange *range)
Clean up the selections from the ranges which could have been deleted when a variable has been delete...
Definition: TParallelCoord.cxx:313
TParallelCoord::SetCurrentSelection
TParallelCoordSelect * SetCurrentSelection(const char *title)
Set the selection being edited.
Definition: TParallelCoord.cxx:1091
TGraph::PaintGraph
void PaintGraph(Int_t npoints, const Double_t *x, const Double_t *y, Option_t *chopt)
Draw the (x,y) as a graph.
Definition: TGraph.cxx:2039
TEntryList::GetN
virtual Long64_t GetN() const
Definition: TEntryList.h:75
TParallelCoord::kCandleChart
@ kCandleChart
Definition: TParallelCoord.h:36
TSelectorDraw::GetTree
TTree * GetTree() const
Definition: TSelectorDraw.h:90
TSelectorDraw::GetDimension
virtual Int_t GetDimension() const
Definition: TSelectorDraw.h:82
TParallelCoord::kGlobalLogScale
@ kGlobalLogScale
Definition: TParallelCoord.h:37
TList
A doubly linked list.
Definition: TList.h:44
TSelectorDraw
A specialized TSelector for TTree::Draw.
Definition: TSelectorDraw.h:33
TParallelCoord::~TParallelCoord
virtual ~TParallelCoord()
Destructor.
Definition: TParallelCoord.cxx:181
TParallelCoord::SetVertDisplay
void SetVertDisplay(Bool_t vert=kTRUE)
Set the vertical or horizontal display.
Definition: TParallelCoord.cxx:1169
gROOT
#define gROOT
Definition: TROOT.h:406
int
TParallelCoord::kLiveUpdate
@ kLiveUpdate
Definition: TParallelCoord.h:34