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/// \author Alja Mrak-Tadel
7
8#include "TRandom.h"
10#include <ROOT/REveScene.hxx>
11#include <ROOT/REveLine.hxx>
12#include <ROOT/REveCompound.hxx>
13
14namespace REX = ROOT::Experimental;
15
17{
18 auto line = new REX::REveLine;
19 line->SetMainColor(kGreen);
20
21 Float_t x = 0, y = 0, z = 0;
22 for (Int_t i = 0; i < n; ++i) {
23 line->SetNextPoint(x, y, z);
24 x += rnd.Uniform(0, delta);
25 y += rnd.Uniform(0, delta);
26 z += rnd.Uniform(0, delta);
27 }
28
29 return line;
30}
31
32void compound()
33{
34 // disable browser cache - all scripts and html files will be loaded every time, useful for development
35 // gEnv->SetValue("WebGui.HttpMaxAge", 0);
36
37 auto eveMng = REX::REveManager::Create();
38 TRandom rnd(0);
39 /*
40 auto* ml = random_line(rnd, 20, 10);
41 ml->SetMainColor(kRed);
42 ml->SetLineStyle(kDashed);
43 ml->SetLineWidth(3);
44 eveMng->InsertVizDBEntry("BigLine", ml);
45 */
46 auto cmp = new REX::REveCompound;
47 cmp->SetMainColor(kGreen);
48
49 cmp->OpenCompound();
50 cmp->AddElement(random_line(rnd, 20, 10));
51 cmp->AddElement(random_line(rnd, 20, 10));
52
53 auto line = random_line(rnd, 20, 12);
54 line->SetMainColor(kRed);
57 // line->ApplyVizTag("BigLine");
58 cmp->AddElement(line);
59
60 cmp->CloseCompound();
61
62 eveMng->GetEventScene()->AddElement(cmp);
63
64 eveMng->Show();
65}
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:60
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:72
@ kRed
Definition Rtypes.h:67
@ kGreen
Definition Rtypes.h:67
@ kDashed
Definition TAttLine.h:54
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.
REveLine An arbitrary polyline with fixed line and marker attributes.
Definition REveLine.hxx:30
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
Definition TAttLine.h:46
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition TAttLine.h:47
This is the base class for the ROOT Random number generators.
Definition TRandom.h:28
TLine * line
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
std::string compound(const std::string &name)
Namespace for ROOT features in testing.
Definition TROOT.h:100