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 REveStraightLineSet. The elements in the set can be individually picked when enable
4/// secondary select. The REveStraightLineSet is a projectable class. It can be visible in RhoZ and RhoPhi projected
5/// views.
6///
7/// \macro_code
8///
9
10#include "TRandom.h"
11
12#include <ROOT/REveElement.hxx>
13#include <ROOT/REveScene.hxx>
14#include <ROOT/REveManager.hxx>
16
17namespace REX = ROOT::Experimental;
18
19REX::REveStraightLineSet *makeLineSet(Int_t nlines = 40, Int_t nmarkers = 4, bool sc = true)
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), r.Uniform(-s, s), r.Uniform(-s, s),
28 r.Uniform(-s, s));
29 // add random number of markers
30 Int_t nm = 1 + Int_t(nmarkers * r.Rndm());
31 for (Int_t m = 0; m < nm; m++)
32 ls->AddMarker(i, r.Rndm());
33 }
34
35 ls->SetMarkerSize(5);
36 ls->SetMarkerStyle(1);
37 ls->SetAlwaysSecSelect(sc);
39
40 return ls;
41}
42
43void lineset(bool secondarySelect = true)
44{
45 auto eveMng = REX::REveManager::Create();
46
47 auto ls1 = makeLineSet(50, 10, secondarySelect);
48 ls1->SetMainColor(kViolet);
49 ls1->SetMarkerColor(kGreen + 3);
50 ls1->SetName("LineSet_1");
51
52 auto ls2 = makeLineSet(200, 20, secondarySelect);
53 ls2->SetMainColor(kBlue);
54 ls2->SetMarkerColor(kCyan + 2);
55 ls2->SetName("LineSet_2");
56 ls2->InitMainTrans();
57 ls2->RefMainTrans().Move3LF(40, 200, 200);
58
59 eveMng->Show();
60}
int Int_t
Definition RtypesCore.h:45
float Float_t
Definition RtypesCore.h:57
@ kGreen
Definition Rtypes.h:66
@ kCyan
Definition Rtypes.h:66
@ kBlue
Definition Rtypes.h:66
@ kViolet
Definition Rtypes.h:67
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
virtual void AddElement(REveElement *el)
Add el to the list of children.
REveScene * GetEventScene() const
void Show(const RWebDisplayArgs &args="")
Show eve manager in specified browser.
REveStraightLineSet 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
ROOT::Experimental::REveManager * eveMng
REX::REveStraightLineSet * makeLineSet(Int_t nlines=40, Int_t nmarkers=4, bool sc=true)
Definition lineset.C:19
R__EXTERN REveManager * gEve
TMarker m
Definition textangle.C:8