ROOT
v6-32
Reference Guide
Loading...
Searching...
No Matches
boxset_cones.C File Reference
Tutorials
»
Event display tutorials
Detailed Description
Demonstrates usage of 'cone' mode in
REveBoxSet
class.
using namespace
ROOT::Experimental
;
REveBoxSet
* elliptic_boxset_cones(
Float_t
x
=0,
Float_t
y
=0,
Float_t
z=0,
Int_t
num=100)
{
auto
eveMng
=
REveManager::Create
();
using namespace
TMath
;
REveManager::Create
();
auto
lines =
new
REveStraightLineSet
(
"StraightLines"
);
lines->SetLineColor(
kYellow
);
lines->SetLineWidth(2);
TRandom
r
(0);
auto
cones =
new
REveBoxSet
(
"EllipticConeSet"
);
bool
valIsColor =
true
;
cones->Reset(
REveBoxSet::kBT_InstancedScaledRotated
, valIsColor, 64);
cones->SetPickable(
kTRUE
);
Float_t
a
= 40;
// max distance between cones
REveVector
dir, pos;
Float_t
theta, phi,
height
, rad;
for
(
Int_t
i
=0;
i
<num; ++
i
) {
theta =
r
.Uniform(0,
TMath::Pi
());
phi =
r
.Uniform (-
TMath::Pi
(),
TMath::Pi
());
height
=
r
.Uniform(5, 15);
rad =
r
.Uniform(3, 5);
dir.
Set
(
Cos
(phi)*
Cos
(theta),
Sin
(phi)*
Cos
(theta),
Sin
(theta));
dir *=
height
;
pos.
Set
(
r
.Uniform(-
a
,
a
),
r
.Uniform(-
a
,
a
),
r
.Uniform(-
a
,
a
));
cones->AddEllipticCone(pos, dir, rad, 0.5*rad,
r
.Uniform(0,360));
if
(
i
%2 == 0)
cones->DigitColor(
kRed
);
else
cones->DigitColor(
kGreen
);
// draw axis line 30% longer than cone height
REveVector
end = pos + dir*1.3f;
lines->AddLine(pos.
fX
, pos.
fY
, pos.
fZ
, end.fX, end.fY, end.fZ);
}
// by default cone cap not drawn
if
(
r
.Integer(2)>0) cones->SetDrawConeCap(
kTRUE
);
cones->RefitPlex();
REveTrans
& t = cones->RefMainTrans();
t.SetPos(
x
,
y
, z);
cones->SetPickable(1);
cones->SetAlwaysSecSelect(1);
eveMng
->GetEventScene()->AddElement(cones);
eveMng
->GetEventScene()->AddElement(lines);
REveViewer
*
v
= (
REveViewer
*)
eveMng
->GetViewers()->FirstChild();
v
->SetAxesType(
REveViewer::kAxesOrigin
);
eveMng
->Show();
return
cones;
}
REveBoxSet
* boxset_cones(
Float_t
x
=0,
Float_t
y
=0,
Float_t
z=0,
Int_t
num=100)
{
auto
eveMng
=
REveManager::Create
();
using namespace
TMath
;
auto
lines =
new
REveStraightLineSet
(
"StraightLines"
);
lines->SetLineColor(
kYellow
);
lines->SetLineWidth(2);
TRandom
r
(0);
auto
pal =
new
REveRGBAPalette
(0, 500);
auto
cones =
new
REveBoxSet
(
"ConeSet"
);
cones->SetPalette(pal);
bool
valIsColor =
false
;
cones->Reset(
REveBoxSet::kBT_InstancedScaledRotated
, valIsColor, 64);
Float_t
a
= 40;
// max distance between cones
REveVector
dir, pos;
Float_t
theta, phi,
height
, rad;
for
(
Int_t
i
=0;
i
<num; ++
i
) {
theta =
r
.Uniform(0,
TMath::Pi
());
phi =
r
.Uniform (-
TMath::Pi
(),
TMath::Pi
());
height
=
r
.Uniform(5, 15);
rad =
r
.Uniform(3, 5);
dir.
Set
(
Cos
(phi)*
Cos
(theta),
Sin
(phi)*
Cos
(theta),
Sin
(theta));
dir *=
height
;
pos.
Set
(
r
.Uniform(-
a
,
a
),
r
.Uniform(-
a
,
a
),
r
.Uniform(-
a
,
a
));
cones->AddCone(pos, dir, rad);
cones->DigitValue(
r
.Uniform(0, 500));
// draw axis line 30% longer than cone height
REveVector
end
= pos + dir*1.3f;
lines->AddLine(pos.
fX
, pos.
fY
, pos.
fZ
,
end
.fX,
end
.fY,
end
.fZ);
}
cones->SetPickable(1);
cones->SetAlwaysSecSelect(1);
// by default cone cap not drawn
if
(
r
.Integer(2)>0) cones->SetDrawConeCap(
kTRUE
);
cones->RefitPlex();
REveTrans
& t = cones->RefMainTrans();
t.SetPos(
x
,
y
, z);
eveMng
->GetEventScene()->AddElement(cones);
eveMng
->GetEventScene()->AddElement(lines);
eveMng
->GetEventScene()->AddElement(pal);
eveMng
->Show();
return
cones;
}
a
#define a(i)
Definition
RSha256.hxx:99
Int_t
int Int_t
Definition
RtypesCore.h:45
Float_t
float Float_t
Definition
RtypesCore.h:57
kTRUE
constexpr Bool_t kTRUE
Definition
RtypesCore.h:100
kRed
@ kRed
Definition
Rtypes.h:66
kGreen
@ kGreen
Definition
Rtypes.h:66
kYellow
@ kYellow
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
height
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
Definition
TGWin32VirtualXProxy.cxx:164
i
Int_t i
Definition
TGraphAsymmErrors.cxx:1306
REveBoxSet
Collection of 3D primitives (fixed-size boxes, boxes of different sizes, or arbitrary sexto-epipeds,...
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...
REveViewer
Eve representation of a GL view.
ROOT::Experimental::REveBoxSet::kBT_InstancedScaledRotated
@ kBT_InstancedScaledRotated
Definition
REveBoxSet.hxx:36
ROOT::Experimental::REveManager::Create
static REveManager * Create()
If global REveManager* REX::gEve is not set initialize it.
Definition
REveManager.cxx:676
ROOT::Experimental::REveStraightLineSet
REveStraightLineSet Set of straight lines with optional markers along the lines.
Definition
REveStraightLineSet.hxx:42
ROOT::Experimental::REveVectorT::fX
TT fX
Definition
REveVector.hxx:31
ROOT::Experimental::REveVectorT::fZ
TT fZ
Definition
REveVector.hxx:31
ROOT::Experimental::REveVectorT::fY
TT fY
Definition
REveVector.hxx:31
ROOT::Experimental::REveVectorT::Set
void Set(const Float_t *v)
Definition
REveVector.hxx:80
ROOT::Experimental::REveViewer::kAxesOrigin
@ kAxesOrigin
Definition
REveViewer.hxx:31
TRandom
This is the base class for the ROOT Random number generators.
Definition
TRandom.h:27
eveMng
ROOT::Experimental::REveManager * eveMng
Definition
collection_proxies.C:59
y
Double_t y[n]
Definition
legend1.C:17
x
Double_t x[n]
Definition
legend1.C:17
ROOT::Experimental
Definition
RDirectory.hxx:30
ROOT::Experimental::REveVector
REveVectorT< Float_t > REveVector
Definition
REveVector.hxx:119
TMVA_SOFIE_GNN.end
end
Definition
TMVA_SOFIE_GNN.py:206
TMath
TMath.
Definition
TMathBase.h:35
TMath::Cos
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Definition
TMath.h:594
TMath::Pi
constexpr Double_t Pi()
Definition
TMath.h:37
TMath::Sin
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Definition
TMath.h:588
v
@ v
Definition
rootcling_impl.cxx:3687
Author
Alja Mrak-Tadel
Definition in file
boxset_cones.C
.
tutorials
eve7
boxset_cones.C
ROOT v6-32 - Reference Guide Generated on Sun May 17 2026 02:44:20 (GVA Time) using Doxygen 1.13.2