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 secondary select.
4/// The REveStraightLineSet is a projectable class. It can be visible in RhoZ and RhoPhi projected views.
5///
6/// \macro_code
7///
8
9#include "TRandom.h"
10
11#include <ROOT/REveElement.hxx>
12#include <ROOT/REveScene.hxx>
13#include <ROOT/REveManager.hxx>
15
16namespace REX = ROOT::Experimental;
17
18REX::REveStraightLineSet* makeLineSet(Int_t nlines = 40, Int_t nmarkers = 4, bool sc = true)
19{
20 TRandom r(0);
21 Float_t s = 100;
22
23 auto ls = new REX::REveStraightLineSet();
24
25 for (Int_t i = 0; i<nlines; i++) {
26 ls->AddLine( r.Uniform(-s,s), r.Uniform(-s,s), r.Uniform(-s,s),
27 r.Uniform(-s,s), r.Uniform(-s,s), r.Uniform(-s,s));
28 // add random number of markers
29 Int_t nm = 1 + Int_t(nmarkers * r.Rndm());
30 for (Int_t m = 0; m < nm; m++) ls->AddMarker(i, r.Rndm());
31 }
32
33 ls->SetMarkerSize(5);
34 ls->SetMarkerStyle(1);
35 ls->SetAlwaysSecSelect(sc);
37
38 return ls;
39}
40
41void lineset(bool secondarySelect = true)
42{
43 auto eveMng = REX::REveManager::Create();
44
45 auto ls1 = makeLineSet(50, 10, secondarySelect);
46 ls1->SetMainColor(kViolet);
47 ls1->SetMarkerColor(kGreen + 3);
48 ls1->SetName("LineSet_1");
49
50 auto ls2 = makeLineSet(200, 20, secondarySelect);
51 ls2->SetMainColor(kBlue);
52 ls2->SetMarkerColor(kCyan + 2);
53 ls2->SetName("LineSet_2");
54 ls2->InitMainTrans();
55 ls2->RefMainTrans().Move3LF(40, 200, 200);
56
57 eveMng->Show();
58}
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:18
R__EXTERN REveManager * gEve
TMarker m
Definition textangle.C:8