Logo ROOT   6.18/05
Reference Guide
lineset.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_eve
3/// Demonstrates usage of class REveStraightLineSet.
4///
5/// \macro_code
6///
7
8#include "TRandom.h"
9
10#include <ROOT/REveElement.hxx>
11#include <ROOT/REveScene.hxx>
12#include <ROOT/REveManager.hxx>
13#include <ROOT/REveStraightLineSet.hxx>
14
15//#include <ROOT/REveJetCone.hxx>
16namespace REX = ROOT::Experimental;
17
18
19REX::REveStraightLineSet* makeLineSet(Int_t nlines = 40, Int_t nmarkers = 4)
20{
21 TRandom r(0);
22 Float_t s = 100;
23
24 auto ls = new REX::REveStraightLineSet();
25
26 for (Int_t i = 0; i<nlines; i++) {
27 ls->AddLine( r.Uniform(-s,s), r.Uniform(-s,s), r.Uniform(-s,s),
28 r.Uniform(-s,s), r.Uniform(-s,s), r.Uniform(-s,s));
29 // add random number of markers
30 Int_t nm = Int_t(nmarkers* r.Rndm());
31 for (Int_t m = 0; m < nm; m++) ls->AddMarker(i, r.Rndm());
32 }
33
34 ls->SetMarkerSize(0.5);
35 ls->SetMarkerStyle(1);
37
38 return ls;
39}
40
41void lineset()
42{
43 auto eveMng = REX::REveManager::Create();
44
45 auto ls1 = makeLineSet(10, 50);
46 ls1->SetMainColor(kViolet);
47 ls1->SetName("LineSet_1");
48
49 auto ls2 = makeLineSet(3, 4);
50 ls2->SetMainColor(kBlue);
51 ls2->SetName("LineSet_2");
52 //ls2->InitMainTrans();
53 // ls2->RefMainTrans().Move3LF(40, 100, 100);
54
55
56 eveMng->Show();
57}
ROOT::R::TRInterface & r
Definition: Object.C:4
int Int_t
Definition: RtypesCore.h:41
float Float_t
Definition: RtypesCore.h:53
@ kBlue
Definition: Rtypes.h:64
@ kViolet
Definition: Rtypes.h:65
R__EXTERN TEveManager * gEve
Definition: TEveManager.h:243
virtual void AddElement(TEveElement *el)
Add el to the list of children.
TEveScene * GetEventScene() const
Definition: TEveManager.h:148
This is the base class for the ROOT Random number generators.
Definition: TRandom.h:27
REX::REveManager * eveMng
void lineset()
Definition: lineset.C:41
REX::REveStraightLineSet * makeLineSet(Int_t nlines=40, Int_t nmarkers=4)
Definition: lineset.C:19
static constexpr double nm
static constexpr double s
auto * m
Definition: textangle.C:8