ROOT
master
Reference Guide
Loading...
Searching...
No Matches
boxset.C File Reference
Tutorials
»
Visualisation tutorials
»
Event display tutorials
Detailed Description
Demonstrates usage of
REveBoxSet
class.
TEveBoxSet
*
boxset
(
Float_t
x
= 0,
Float_t
y
= 0,
Float_t
z = 0,
Int_t
num = 100,
Bool_t
registerSet
=
kTRUE
)
{
TEveManager::Create
();
TRandom
r
(0);
auto
pal
=
new
TEveRGBAPalette
(0, 130);
auto
frm
=
new
TEveFrameBox
();
frm
->SetAABoxCenterHalfSize(0, 0, 0, 12, 12, 12);
frm
->SetFrameColor(
kCyan
);
frm
->SetBackColorRGBA(120, 120, 120, 20);
frm
->SetDrawBack(
kTRUE
);
auto
q
=
new
TEveBoxSet
(
"BoxSet"
);
q
->SetPalette(
pal
);
q
->SetFrame(
frm
);
q
->Reset(
TEveBoxSet::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();
TEveTrans
&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
) {
gEve
->
AddElement
(
q
);
gEve
->
Redraw3D
(
kTRUE
);
}
return
q
;
}
TEveBoxSet
*
boxset_colisval
(
Float_t
x
= 0,
Float_t
y
= 0,
Float_t
z = 0,
Int_t
num = 100,
Bool_t
registerSet
=
kTRUE
)
{
TEveManager::Create
();
TRandom
r
(0);
auto
q
=
new
TEveBoxSet
(
"BoxSet"
);
q
->Reset(
TEveBoxSet::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();
TEveTrans
&t =
q
->RefMainTrans();
t.
SetPos
(
x
,
y
, z);
if
(
registerSet
) {
gEve
->
AddElement
(
q
);
gEve
->
Redraw3D
(
kTRUE
);
}
return
q
;
}
TEveBoxSet
*
boxset_single_color
(
Float_t
x
= 0,
Float_t
y
= 0,
Float_t
z = 0,
Int_t
num = 100,
Bool_t
registerSet
=
kTRUE
)
{
TEveManager::Create
();
TRandom
r
(0);
auto
q
=
new
TEveBoxSet
(
"BoxSet"
);
q
->UseSingleColor();
q
->SetMainColor(
kCyan
- 2);
q
->SetMainTransparency(50);
q
->Reset(
TEveBoxSet::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();
TEveTrans
&t =
q
->RefMainTrans();
t.
SetPos
(
x
,
y
, z);
if
(
registerSet
) {
gEve
->
AddElement
(
q
);
gEve
->
Redraw3D
(
kTRUE
);
}
return
q
;
}
TEveBoxSet
*
boxset_freebox
(
Int_t
num = 100,
Bool_t
registerSet
=
kTRUE
)
{
TEveManager::Create
();
TRandom
r
(0);
auto
pal
=
new
TEveRGBAPalette
(0, 130);
auto
q
=
new
TEveBoxSet
(
"BoxSet"
);
q
->SetPalette(
pal
);
q
->Reset(
TEveBoxSet::kBT_FreeBox
,
kFALSE
, 64);
#define RND_BOX(x) (Float_t) r.Uniform(-(x), (x))
Float_t
verts
[24];
for
(
Int_t
i = 0; i < num; ++i) {
Float_t
x
=
RND_BOX
(10);
Float_t
y
=
RND_BOX
(10);
Float_t
z =
RND_BOX
(10);
Float_t
a
=
r
.Uniform(0.2, 0.5);
Float_t
d
= 0.05;
Float_t
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);
if
(
registerSet
) {
gEve
->
AddElement
(
q
);
gEve
->
Redraw3D
(
kTRUE
);
}
return
q
;
}
TEveBoxSet
*
boxset_hex
(
Float_t
x
= 0,
Float_t
y
= 0,
Float_t
z = 0,
Int_t
num = 100,
Bool_t
registerSet
=
kTRUE
)
{
TEveManager::Create
();
TRandom
r
(0);
auto
q
=
new
TEveBoxSet
(
"BoxSet"
);
q
->Reset(
TEveBoxSet::kBT_Hex
,
kTRUE
, 64);
for
(
Int_t
i = 0; i < num; ++i) {
q
->AddHex(
TEveVector
(
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
);
TEveTrans
&t =
q
->RefMainTrans();
t.
SetPos
(
x
,
y
, z);
if
(
registerSet
) {
gEve
->
AddElement
(
q
);
gEve
->
Redraw3D
(
kTRUE
);
}
return
q
;
}
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
Float_t
float Float_t
Definition
RtypesCore.h:57
kFALSE
constexpr Bool_t kFALSE
Definition
RtypesCore.h:94
kTRUE
constexpr Bool_t kTRUE
Definition
RtypesCore.h:93
kCyan
@ kCyan
Definition
Rtypes.h:66
TRangeDynCast
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Definition
TCollection.h:358
gEve
R__EXTERN TEveManager * gEve
Definition
TEveManager.h:243
TEveVector
TEveVectorT< Float_t > TEveVector
Definition
TEveVector.h:123
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
ROOT::Detail::TRangeCast
Definition
TCollection.h:311
TEveBoxSet
Collection of 3D primitives (fixed-size boxes, boxes of different sizes, or arbitrary sexto-epipeds,...
Definition
TEveBoxSet.h:22
TEveBoxSet::kBT_AABox
@ kBT_AABox
Definition
TEveBoxSet.h:32
TEveBoxSet::kBT_Hex
@ kBT_Hex
Definition
TEveBoxSet.h:36
TEveBoxSet::kBT_FreeBox
@ kBT_FreeBox
Definition
TEveBoxSet.h:31
TEveFrameBox
Description of a 2D or 3D frame that can be used to visually group a set of objects.
Definition
TEveFrameBox.h:19
TEveManager::AddElement
void AddElement(TEveElement *element, TEveElement *parent=nullptr)
Add an element.
Definition
TEveManager.cxx:527
TEveManager::Create
static TEveManager * Create(Bool_t map_window=kTRUE, Option_t *opt="FIV")
If global TEveManager* gEve is not set initialize it.
Definition
TEveManager.cxx:887
TEveManager::Redraw3D
void Redraw3D(Bool_t resetCameras=kFALSE, Bool_t dropLogicals=kFALSE)
Definition
TEveManager.h:168
TEveRGBAPalette
A generic, speed-optimised mapping from value to RGBA color supporting different wrapping and range t...
Definition
TEveRGBAPalette.h:25
TEveTrans
TEveTrans is a 4x4 transformation matrix for homogeneous coordinates stored internally in a column-ma...
Definition
TEveTrans.h:27
TEveTrans::SetPos
void SetPos(Double_t x, Double_t y, Double_t z)
Set position (base-vec 4).
Definition
TEveTrans.cxx:506
TRandom
This is the base class for the ROOT Random number generators.
Definition
TRandom.h:27
RND_BOX
#define RND_BOX(x)
y
Double_t y[n]
Definition
legend1.C:17
x
Double_t x[n]
Definition
legend1.C:17
Author
Matevz Tadel
Definition in file
boxset.C
.
tutorials
visualisation
eve7
boxset.C
ROOT master - Reference Guide Generated on Tue Jan 21 2025 04:12:41 (GVA Time) using Doxygen 1.10.0