Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
lineset.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_eve
3/// Demonstrates usage of class TEveStraightLineSet.
4///
5/// \image html eve_lineset.png
6/// \macro_code
7///
8/// \author Matevz Tadel
9
10TEveStraightLineSet *lineset(Int_t nlines = 40, Int_t nmarkers = 4)
11{
13
14 TRandom r(0);
15 Float_t s = 100;
16
17 auto ls = new TEveStraightLineSet();
18
19 for (Int_t i = 0; i < nlines; i++) {
20 ls->AddLine(r.Uniform(-s, s), r.Uniform(-s, s), r.Uniform(-s, s), r.Uniform(-s, s), r.Uniform(-s, s),
21 r.Uniform(-s, s));
22 // add random number of markers
23 Int_t nm = Int_t(nmarkers * r.Rndm());
24 for (Int_t m = 0; m < nm; m++)
25 ls->AddMarker(i, r.Rndm());
26 }
27
28 ls->SetMarkerSize(1.5);
29 ls->SetMarkerStyle(4);
30
31 gEve->AddElement(ls);
32 gEve->Redraw3D();
33
34 return ls;
35}
36
37TEveStraightLineSet *lineset_2d(Int_t nlines = 40, Int_t nmarkers = 4)
38{
40
41 TRandom r(0);
42 Float_t s = 100;
43
44 auto ls = new TEveStraightLineSet();
45
46 for (Int_t i = 0; i < nlines; i++) {
47 ls->AddLine(r.Uniform(-s, s), r.Uniform(-s, s), 0, r.Uniform(-s, s), r.Uniform(-s, s), 0);
48 // add random number of markers
49 Int_t nm = Int_t(nmarkers * r.Rndm());
50 for (Int_t m = 0; m < nm; m++)
51 ls->AddMarker(i, r.Rndm());
52 }
53
54 ls->SetMarkerSize(1.5);
55 ls->SetMarkerStyle(4);
56
57 gEve->AddElement(ls);
58 gEve->Redraw3D();
59
60 return ls;
61}
int Int_t
Definition RtypesCore.h:45
float Float_t
Definition RtypesCore.h:57
R__EXTERN TEveManager * gEve
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
void AddElement(TEveElement *element, TEveElement *parent=nullptr)
Add an element.
static TEveManager * Create(Bool_t map_window=kTRUE, Option_t *opt="FIV")
If global TEveManager* gEve is not set initialize it.
void Redraw3D(Bool_t resetCameras=kFALSE, Bool_t dropLogicals=kFALSE)
Set of straight lines with optional markers along the lines.
This is the base class for the ROOT Random number generators.
Definition TRandom.h:27
TMarker m
Definition textangle.C:8