ROOT
v6-30
Reference Guide
Loading...
Searching...
No Matches
boxset.C File Reference
Tutorials
»
Event display tutorials
Detailed Description
Demonstrates usage of
REveBoxSet
class.
#include "
TRandom.h
"
#include <
ROOT/REveElement.hxx
>
#include <
ROOT/REveScene.hxx
>
#include <
ROOT/REveManager.hxx
>
#include <
ROOT/REveBoxSet.hxx
>
using namespace
ROOT::Experimental
;
std::string customTooltip(
const
ROOT::Experimental::REveDigitSet
*digitSet,
int
n
)
{
auto
d
= digitSet->
GetDigit
(
n
);
return
TString::Format
(
"Custom tooltip:\n value %d idx %d\n"
,
d
->fValue,
n
).
Data
();
}
REveBoxSet
* boxset(
Int_t
num=100)
{
auto
eveMng
= REveManager::Create();
TRandom
r
(0);
auto
pal =
new
REveRGBAPalette
(0, 130);
pal->SetMin(80);
auto
q
=
new
REveBoxSet
(
"BoxSet"
);
q
->SetPalette(pal);
q
->Reset(REveBoxSet::kBT_FreeBox,
kFALSE
, 64);
#define RND_BOX(x) (Float_t)r.Uniform(-(x), (x))
const
float
R
= 500;
const
float
A = 40;
const
float
D = 1;
for
(
int
i = 0; i < num; ++i) {
float
x
=
RND_BOX
(
R
);
float
y
=
RND_BOX
(
R
);
float
z =
RND_BOX
(
R
);
float
a
=
r
.Uniform(0.2*A, A);
float
d
= D;
float
verts[24] = {
x
-
a
+
RND_BOX
(
d
),
y
-
a
+
RND_BOX
(
d
), z -
a
+
RND_BOX
(
d
),
x
-
a
+
RND_BOX
(
d
),
y
+
a
+
RND_BOX
(
d
), z -
a
+
RND_BOX
(
d
),
x
+
a
+
RND_BOX
(
d
),
y
+
a
+
RND_BOX
(
d
), z -
a
+
RND_BOX
(
d
),
x
+
a
+
RND_BOX
(
d
),
y
-
a
+
RND_BOX
(
d
), z -
a
+
RND_BOX
(
d
),
x
-
a
+
RND_BOX
(
d
),
y
-
a
+
RND_BOX
(
d
), z +
a
+
RND_BOX
(
d
),
x
-
a
+
RND_BOX
(
d
),
y
+
a
+
RND_BOX
(
d
), z +
a
+
RND_BOX
(
d
),
x
+
a
+
RND_BOX
(
d
),
y
+
a
+
RND_BOX
(
d
), z +
a
+
RND_BOX
(
d
),
x
+
a
+
RND_BOX
(
d
),
y
-
a
+
RND_BOX
(
d
), z +
a
+
RND_BOX
(
d
) };
q
->AddBox(verts);
q
->DigitValue(
r
.Uniform(0, 130));
}
q
->RefitPlex();
#undef RND_BOX
// Uncomment these two lines to get internal highlight / selection.
q
->SetPickable(1);
q
->SetAlwaysSecSelect(1);
q
->SetTooltipCBFoo(customTooltip);
eveMng
->
GetEventScene
()->
AddElement
(
q
);
eveMng
->
Show
();
return
q
;
}
REveBoxSet
* boxset_axisaligned(
Float_t
x
=0,
Float_t
y
=0,
Float_t
z=0,
Int_t
num=100,
Bool_t
registerSet=
kTRUE
)
{
auto
eveMng
= REveManager::Create();
TRandom
r
(0);
auto
pal =
new
REveRGBAPalette
(0, 130);
auto
frm =
new
REveFrameBox
();
frm->SetAABoxCenterHalfSize(0, 0, 0, 12, 12, 12);
frm->SetFrameColor(
kCyan
);
frm->SetBackColorRGBA(120,120,120,20);
frm->SetDrawBack(
kTRUE
);
auto
q
=
new
REveBoxSet
(
"BoxSet"
);
q
->SetPalette(pal);
q
->SetFrame(frm);
q
->Reset(REveBoxSet::kBT_AABox,
kFALSE
, 64);
for
(
Int_t
i=0; i<num; ++i) {
q
->AddBox(
r
.Uniform(-10, 10),
r
.Uniform(-10, 10),
r
.Uniform(-10, 10),
r
.Uniform(0.2, 1),
r
.Uniform(0.2, 1),
r
.Uniform(0.2, 1));
q
->DigitValue(
r
.Uniform(0, 130));
}
q
->RefitPlex();
REveTrans
& t =
q
->RefMainTrans();
t.SetPos(
x
,
y
, z);
// Uncomment these two lines to get internal highlight / selection.
q
->SetPickable(1);
q
->SetAlwaysSecSelect(1);
if
(registerSet)
{
eveMng
->
GetEventScene
()->
AddElement
(
q
);
eveMng
->
Show
();
}
return
q
;
}
REveBoxSet
* boxset_colisval(
Float_t
x
=0,
Float_t
y
=0,
Float_t
z=0,
Int_t
num=100,
Bool_t
registerSet=
kTRUE
)
{
auto
eveMng
= REveManager::Create();
TRandom
r
(0);
auto
q
=
new
REveBoxSet
(
"BoxSet"
);
q
->Reset(REveBoxSet::kBT_AABox,
kTRUE
, 64);
for
(
Int_t
i=0; i<num; ++i) {
q
->AddBox(
r
.Uniform(-10, 10),
r
.Uniform(-10, 10),
r
.Uniform(-10, 10),
r
.Uniform(0.2, 1),
r
.Uniform(0.2, 1),
r
.Uniform(0.2, 1));
q
->DigitColor(
r
.Uniform(20, 255),
r
.Uniform(20, 255),
r
.Uniform(20, 255),
r
.Uniform(20, 255));
}
q
->RefitPlex();
REveTrans
& t =
q
->RefMainTrans();
t.SetPos(
x
,
y
, z);
if
(registerSet)
{
eveMng
->
GetEventScene
()->
AddElement
(
q
);
eveMng
->
Show
();
}
return
q
;
}
REveBoxSet
* boxset_single_color(
Float_t
x
=0,
Float_t
y
=0,
Float_t
z=0,
Int_t
num=100,
Bool_t
registerSet=
kTRUE
)
{
auto
eveMng
= REveManager::Create();
TRandom
r
(0);
auto
q
=
new
REveBoxSet
(
"BoxSet"
);
q
->UseSingleColor();
q
->SetMainColorPtr(
new
Color_t
);
q
->SetMainColor(
kRed
);
q
->SetMainTransparency(50);
q
->Reset(REveBoxSet::kBT_AABox,
kFALSE
, 64);
for
(
Int_t
i=0; i<num; ++i) {
q
->AddBox(
r
.Uniform(-10, 10),
r
.Uniform(-10, 10),
r
.Uniform(-10, 10),
r
.Uniform(0.2, 1),
r
.Uniform(0.2, 1),
r
.Uniform(0.2, 1));
}
q
->RefitPlex();
REveTrans
& t =
q
->RefMainTrans();
t.SetPos(
x
,
y
, z);
if
(registerSet) {
eveMng
->
GetEventScene
()->
AddElement
(
q
);
eveMng
->
Show
();
}
return
q
;
}
REveBoxSet
* boxset_hex(
Float_t
x
=0,
Float_t
y
=0,
Float_t
z=0,
Int_t
num=100,
Bool_t
registerSet=
kTRUE
)
{
auto
eveMng
= REveManager::Create();
TRandom
r
(0);
auto
q
=
new
REveBoxSet
(
"BoxSet"
);
q
->Reset(REveBoxSet::kBT_Hex,
kTRUE
, 64);
for
(
Int_t
i=0; i<num; ++i) {
q
->AddHex(
REveVector
(
r
.Uniform(-10, 10),
r
.Uniform(-10, 10),
r
.Uniform(-10, 10)),
r
.Uniform(0.2, 1),
r
.Uniform(0, 60),
r
.Uniform(0.2, 5));
q
->DigitColor(
r
.Uniform(20, 255),
r
.Uniform(20, 255),
r
.Uniform(20, 255),
r
.Uniform(20, 255));
}
q
->RefitPlex();
q
->SetPickable(
true
);
q
->SetAlwaysSecSelect(
true
);
REveTrans
& t =
q
->RefMainTrans();
t.SetPos(
x
,
y
, z);
if
(registerSet)
{
eveMng
->
GetEventScene
()->
AddElement
(
q
);
eveMng
->
Show
();
}
return
q
;
}
REveBoxSet.hxx
REveElement.hxx
REveManager.hxx
REveScene.hxx
d
#define d(i)
Definition
RSha256.hxx:102
a
#define a(i)
Definition
RSha256.hxx:99
Bool_t
bool Bool_t
Definition
RtypesCore.h:63
Int_t
int Int_t
Definition
RtypesCore.h:45
Color_t
short Color_t
Definition
RtypesCore.h:92
Float_t
float Float_t
Definition
RtypesCore.h:57
kFALSE
constexpr Bool_t kFALSE
Definition
RtypesCore.h:101
kTRUE
constexpr Bool_t kTRUE
Definition
RtypesCore.h:100
kRed
@ kRed
Definition
Rtypes.h:66
kCyan
@ kCyan
Definition
Rtypes.h:66
r
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
Definition
TGWin32VirtualXProxy.cxx:168
q
float * q
Definition
THbookFile.cxx:89
TRandom.h
REveBoxSet
Collection of 3D primitives (fixed-size boxes, boxes of different sizes, or arbitrary sexto-epipeds,...
REveFrameBox
Description of a 2D or 3D frame that can be used to visually group a set of objects.
REveRGBAPalette
A generic, speed-optimised mapping from value to RGBA color supporting different wrapping and range t...
REveTrans
REveTrans is a 4x4 transformation matrix for homogeneous coordinates stored internally in a column-ma...
ROOT::Experimental::REveDigitSet
Definition
REveDigitSet.hxx:35
ROOT::Experimental::REveDigitSet::GetDigit
DigitBase_t * GetDigit(Int_t n) const
Definition
REveDigitSet.hxx:128
ROOT::Experimental::REveElement::AddElement
virtual void AddElement(REveElement *el)
Add el to the list of children.
Definition
REveElement.cxx:848
ROOT::Experimental::REveManager::GetEventScene
REveScene * GetEventScene() const
Definition
REveManager.hxx:184
ROOT::Experimental::REveManager::Show
void Show(const RWebDisplayArgs &args="")
Show eve manager in specified browser.
Definition
REveManager.cxx:1127
ROOT::Experimental::REveVectorT< Float_t >
R
TRandom
This is the base class for the ROOT Random number generators.
Definition
TRandom.h:27
TString::Data
const char * Data() const
Definition
TString.h:380
TString::Format
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition
TString.cxx:2356
eveMng
ROOT::Experimental::REveManager * eveMng
Definition
collection_proxies.C:59
RND_BOX
#define RND_BOX(x)
y
Double_t y[n]
Definition
legend1.C:17
x
Double_t x[n]
Definition
legend1.C:17
n
const Int_t n
Definition
legend1.C:16
ROOT::Experimental
Definition
RDirectory.hxx:30
Author
Matevz Tadel
Definition in file
boxset.C
.
tutorials
eve7
boxset.C
ROOT v6-30 - Reference Guide Generated on Tue Oct 29 2024 12:56:06 (GVA Time) using Doxygen 1.9.8