Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
compound.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_eve_7
3///
4/// \macro_code
5///
6#include "TRandom.h"
8#include <ROOT/REveScene.hxx>
9#include <ROOT/REveLine.hxx>
10#include <ROOT/REveCompound.hxx>
11
12namespace REX = ROOT::Experimental;
13
15{
16 auto line = new REX::REveLine;
17 line->SetMainColor(kGreen);
18
19 Float_t x = 0, y = 0, z = 0;
20 for (Int_t i = 0; i < n; ++i) {
21 line->SetNextPoint(x, y, z);
22 x += rnd.Uniform(0, delta);
23 y += rnd.Uniform(0, delta);
24 z += rnd.Uniform(0, delta);
25 }
26
27 return line;
28}
29
31{
32 // disable browser cache - all scripts and html files will be loaded every time, useful for development
33 // gEnv->SetValue("WebGui.HttpMaxAge", 0);
34
35 auto eveMng = REX::REveManager::Create();
36 TRandom rnd(0);
37 /*
38 auto* ml = random_line(rnd, 20, 10);
39 ml->SetMainColor(kRed);
40 ml->SetLineStyle(kDashed);
41 ml->SetLineWidth(3);
42 eveMng->InsertVizDBEntry("BigLine", ml);
43 */
44 auto cmp = new REX::REveCompound;
45 cmp->SetMainColor(kGreen);
46
47 cmp->OpenCompound();
48 cmp->AddElement(random_line(rnd, 20, 10));
49 cmp->AddElement(random_line(rnd, 20, 10));
50
51 auto line = random_line(rnd, 20, 12);
52 line->SetMainColor(kRed);
55 // line->ApplyVizTag("BigLine");
56 cmp->AddElement(line);
57
58 cmp->CloseCompound();
59
61
62 eveMng->Show();
63}
int Int_t
Definition RtypesCore.h:45
float Float_t
Definition RtypesCore.h:57
@ kRed
Definition Rtypes.h:66
@ kGreen
Definition Rtypes.h:66
@ kDashed
Definition TAttLine.h:52
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void SetMainColor(Color_t color) override
SetMainColor for the compound.
virtual void AddElement(REveElement *el)
Add el to the list of children.
REveLine An arbitrary polyline with fixed line and marker attributes.
Definition REveLine.hxx:30
REveScene * GetEventScene() const
void Show(const RWebDisplayArgs &args="")
Show eve manager in specified browser.
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
Definition TAttLine.h:44
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition TAttLine.h:45
This is the base class for the ROOT Random number generators.
Definition TRandom.h:27
ROOT::Experimental::REveManager * eveMng
TLine * line
void compound()
Definition compound.C:30
REX::REveLine * random_line(TRandom &rnd, Int_t n, Float_t delta)
Definition compound.C:14
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16