ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
parallelcoord.C
Go to the documentation of this file.
1 #include "TFile.h"
2 #include "TCanvas.h"
3 #include "TStyle.h"
4 #include "TRandom.h"
5 #include "TNtuple.h"
6 #include "TParallelCoord.h"
7 #include "TParallelCoordVar.h"
8 #include "TParallelCoordRange.h"
9 
10 // script illustrating the use of the TParalleCoord class
11 //Author: Bastien Dallapiazza
12 
14 Double_t dr = 3.5;
16 
18  r1 = (2*dr*r->Rndm(i))-dr;
19  r2 = (2*dr*r->Rndm(i))-dr;
20  r7 = (2*dr*r->Rndm(i))-dr;
21  r9 = (2*dr*r->Rndm(i))-dr;
22  r4 = (2*dr*r->Rndm(i))-dr;
23  r3 = (2*dr*r->Rndm(i))-dr;
24  r5 = (2*dr*r->Rndm(i))-dr;
25  r6 = (2*dr*r->Rndm(i))-dr;
26  r8 = (2*dr*r->Rndm(i))-dr;
27 }
28 
29 void parallelcoord() {
30 
31  TNtuple *nt = NULL;
32 
33  Double_t s1x, s1y, s1z;
34  Double_t s2x, s2y, s2z;
35  Double_t s3x, s3y, s3z;
36  r = new TRandom();;
37 
38  new TCanvas("c1", "c1",0,0,800,700);
39  gStyle->SetPalette(1);
40 
41  nt = new TNtuple("nt","Demo ntuple","x:y:z:u:v:w");
42 
43  for (Int_t i=0; i<20000; i++) {
44  r->Sphere(s1x, s1y, s1z, 0.1);
45  r->Sphere(s2x, s2y, s2z, 0.2);
46  r->Sphere(s3x, s3y, s3z, 0.05);
47 
48  generate_random(i);
49  nt->Fill(r1, r2, r3, r4, r5, r6);
50 
51  generate_random(i);
52  nt->Fill(s1x, s1y, s1z, s2x, s2y, s2z);
53 
54  generate_random(i);
55  nt->Fill(r1, r2, r3, r4, r5, r6);
56 
57  generate_random(i);
58  nt->Fill(s2x-1, s2y-1, s2z, s1x+.5, s1y+.5, s1z+.5);
59 
60  generate_random(i);
61  nt->Fill(r1, r2, r3, r4, r5, r6);
62 
63  generate_random(i);
64  nt->Fill(s1x+1, s1y+1, s1z+1, s3x-2, s3y-2, s3z-2);
65 
66  generate_random(i);
67  nt->Fill(r1, r2, r3, r4, r5, r6);
68  }
69  nt->Draw("x:y:z:u:v:w","","para",5000);
70  TParallelCoord* para = (TParallelCoord*)gPad->GetListOfPrimitives()->FindObject("ParaCoord");
71  para->SetDotsSpacing(5);
72  TParallelCoordVar* firstaxis = (TParallelCoordVar*)para->GetVarList()->FindObject("x");
73  firstaxis->AddRange(new TParallelCoordRange(firstaxis,0.846018,1.158469));
74  para->AddSelection("violet");
76  firstaxis->AddRange(new TParallelCoordRange(firstaxis,-0.169447,0.169042));
77  para->AddSelection("Orange");
79  firstaxis->AddRange(new TParallelCoordRange(firstaxis,-1.263024,-0.755292));
80 }
void para(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
Definition: geodemo.C:362
TParallelCoordSelect * GetCurrentSelection()
Return the selection currently being edited.
Double_t r6
Definition: parallelcoord.C:13
virtual Double_t Rndm(Int_t i=0)
Machine independent random number generator.
Definition: TRandom.cxx:512
R__EXTERN TStyle * gStyle
Definition: TStyle.h:423
A TParallelCoordRange is a range used for parallel coordinates plots.
int Int_t
Definition: RtypesCore.h:41
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
Definition: TList.cxx:497
Double_t r8
Definition: parallelcoord.C:13
Double_t r2
Definition: parallelcoord.C:13
void parallelcoord()
Definition: parallelcoord.C:29
TParallelCoord axes.
TList * GetVarList()
Double_t r1
Definition: parallelcoord.C:13
This is the base class for the ROOT Random number generators.
Definition: TRandom.h:29
virtual void SetLineColor(Color_t lcolor)
Definition: TAttLine.h:54
void AddSelection(const char *title)
Add a selection.
A simple TTree restricted to a list of float variables only.
Definition: TNtuple.h:30
Double_t r9
Definition: parallelcoord.C:13
Double_t r5
Definition: parallelcoord.C:13
Double_t r3
Definition: parallelcoord.C:13
The Canvas class.
Definition: TCanvas.h:48
double Double_t
Definition: RtypesCore.h:55
TRandom * r
Definition: parallelcoord.C:15
Double_t r4
Definition: parallelcoord.C:13
virtual void Draw(Option_t *opt)
Default Draw method for all objects.
Definition: TTree.h:360
virtual Int_t Fill()
[fNvar] Array of variables
Definition: TNtuple.cxx:168
void SetDotsSpacing(Int_t s=0)
Set dots spacing.
virtual void Sphere(Double_t &x, Double_t &y, Double_t &z, Double_t r)
Generates random vectors, uniformly distributed over the surface of a sphere of given radius...
Definition: TRandom.cxx:588
Parallel Coordinates class.
void generate_random(Int_t i)
Definition: parallelcoord.C:17
Double_t r7
Definition: parallelcoord.C:13
Definition: Rtypes.h:62
#define NULL
Definition: Rtypes.h:82
#define gPad
Definition: TVirtualPad.h:288
Double_t dr
Definition: parallelcoord.C:14
void SetPalette(Int_t ncolors=kBird, Int_t *colors=0, Float_t alpha=1.)
See TColor::SetPalette.
Definition: TStyle.cxx:1445
Definition: Rtypes.h:62
void AddRange(TParallelCoordRange *range)
Add a range to the current selection on the axis.