Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
tree141_parallelcoord.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_tree
3/// \notebook -nodraw
4/// Script illustrating the use of the TParallelCoord class
5///
6/// \macro_image
7/// \macro_code
8///
9/// \author Bastien Dallapiazza
10
11#include "TFile.h"
12#include "TCanvas.h"
13#include "TStyle.h"
14#include "TRandom.h"
15#include "TNtuple.h"
16#include "TParallelCoord.h"
17#include "TParallelCoordVar.h"
18#include "TParallelCoordRange.h"
19
20Double_t r1, r2, r3, r4, r5, r6, r7, r8, r9;
21Double_t dr = 3.5;
22TRandom *r;
23
25{
26 r1 = (2 * dr * r->Rndm(i)) - dr;
27 r2 = (2 * dr * r->Rndm(i)) - dr;
28 r7 = (2 * dr * r->Rndm(i)) - dr;
29 r9 = (2 * dr * r->Rndm(i)) - dr;
30 r4 = (2 * dr * r->Rndm(i)) - dr;
31 r3 = (2 * dr * r->Rndm(i)) - dr;
32 r5 = (2 * dr * r->Rndm(i)) - dr;
33 r6 = (2 * dr * r->Rndm(i)) - dr;
34 r8 = (2 * dr * r->Rndm(i)) - dr;
35}
36
38{
39 TNtuple *nt = nullptr;
40
44 r = new TRandom();;
45
46 new TCanvas("c1", "c1",0,0,800,700);
47
48 nt = new TNtuple("nt","Demo ntuple","x:y:z:u:v:w");
49
50 for (Int_t i = 0; i < 20000; i++) {
51 r->Sphere(s1x, s1y, s1z, 0.1);
52 r->Sphere(s2x, s2y, s2z, 0.2);
53 r->Sphere(s3x, s3y, s3z, 0.05);
54
56 nt->Fill(r1, r2, r3, r4, r5, r6);
57
59 nt->Fill(s1x, s1y, s1z, s2x, s2y, s2z);
60
62 nt->Fill(r1, r2, r3, r4, r5, r6);
63
65 nt->Fill(s2x-1, s2y-1, s2z, s1x+.5, s1y+.5, s1z+.5);
66
68 nt->Fill(r1, r2, r3, r4, r5, r6);
69
71 nt->Fill(s1x+1, s1y+1, s1z+1, s3x-2, s3y-2, s3z-2);
72
74 nt->Fill(r1, r2, r3, r4, r5, r6);
75 }
76 nt->Draw("x:y:z:u:v:w", "", "para", 5000);
77 auto para = (TParallelCoord*)gPad->GetListOfPrimitives()->FindObject("ParaCoord");
78 para->SetDotsSpacing(5);
79 auto firstaxis = (TParallelCoordVar*)para->GetVarList()->FindObject("x");
80 firstaxis->AddRange(new TParallelCoordRange(firstaxis, 0.846018, 1.158469));
81 para->AddSelection("violet");
82 para->GetCurrentSelection()->SetLineColor(kViolet);
83 firstaxis->AddRange(new TParallelCoordRange(firstaxis, -0.169447, 0.169042));
84 para->AddSelection("Orange");
85 para->GetCurrentSelection()->SetLineColor(kOrange+9);
86 firstaxis->AddRange(new TParallelCoordRange(firstaxis, -1.263024, -0.755292));
87}
int Int_t
Definition RtypesCore.h:45
double Double_t
Definition RtypesCore.h:59
@ kOrange
Definition Rtypes.h:67
@ kViolet
Definition Rtypes.h:67
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
#define gPad
The Canvas class.
Definition TCanvas.h:23
A simple TTree restricted to a list of float variables only.
Definition TNtuple.h:28
A TParallelCoordRange is a range used for parallel coordinates plots.
TParallelCoord axes.
Parallel Coordinates class.
This is the base class for the ROOT Random number generators.
Definition TRandom.h:27