ROOT
master
Reference Guide
Loading...
Searching...
No Matches
overlay_test.C File Reference
Tutorials
»
Event display tutorials
Detailed Description
Demonstrates usage of
TEveBox
class.
#include <
ROOT/REveBox.hxx
>
#include <
ROOT/REveScene.hxx
>
#include <
ROOT/REveManager.hxx
>
#include <
ROOT/REveTrackPropagator.hxx
>
#include <
ROOT/REveTrack.hxx
>
#include <
ROOT/REveJetCone.hxx
>
#include <
ROOT/REveText.hxx
>
using namespace
ROOT::Experimental
;
const
Double_t
kR_min
= 240;
const
Double_t
kR_max
= 250;
const
Double_t
kZ_d
= 300;
void
makeTracks
(
int
N_Tracks,
REveElement
* trackHolder)
{
TRandom
&
r
= *
gRandom
;
auto
prop
=
new
REveTrackPropagator
();
prop
->SetMagFieldObj(
new
REveMagFieldDuo
(350, 3.5, -2.0));
prop
->SetMaxR(300);
prop
->SetMaxZ(600);
prop
->SetMaxOrbs(6);
// Default is kHelix propagator.
// prop->SetStepper(REX::REveTrackPropagator::kRungeKutta);
double
v
= 0.5;
double
m
= 5;
for
(
int
i = 0; i < N_Tracks; i++)
{
auto
p
=
new
TParticle
();
int
pdg = 11 * (
r
.Integer(2) > 0 ? 1 : -1);
p
->SetPdgCode(pdg);
p
->SetProductionVertex(
r
.Uniform(-
v
,
v
),
r
.Uniform(-
v
,
v
),
r
.Uniform(-
v
,
v
), 1);
p
->SetMomentum(
r
.Uniform(-
m
,
m
),
r
.Uniform(-
m
,
m
),
r
.Uniform(-
m
,
m
)*
r
.Uniform(1, 3), 1);
auto
track =
new
REveTrack
(
p
, 1,
prop
);
track->MakeTrack();
track->SetMainColor(
kBlue
);
track->SetName(
Form
(
"RandomTrack_%d"
, i));
track->SetLineWidth(3);
trackHolder->AddElement(track);
}
}
REveElement
* makeBox(
Float_t
a
=10,
Float_t
d
=5,
Float_t
x
=0,
Float_t
y
=0,
Float_t
z=0)
{
TRandom
&
r
= *
gRandom
;
auto
b
=
new
REveBox
;
b
->SetMainColor(
kCyan
);
b
->SetMainTransparency(0);
#define RND_BOX(x) r.Uniform(-(x), (x))
b
->SetVertex(0,
x
-
a
+
RND_BOX
(
d
),
y
-
a
+
RND_BOX
(
d
), z -
a
+
RND_BOX
(
d
));
b
->SetVertex(1,
x
-
a
+
RND_BOX
(
d
),
y
+
a
+
RND_BOX
(
d
), z -
a
+
RND_BOX
(
d
));
b
->SetVertex(2,
x
+
a
+
RND_BOX
(
d
),
y
+
a
+
RND_BOX
(
d
), z -
a
+
RND_BOX
(
d
));
b
->SetVertex(3,
x
+
a
+
RND_BOX
(
d
),
y
-
a
+
RND_BOX
(
d
), z -
a
+
RND_BOX
(
d
));
b
->SetVertex(4,
x
-
a
+
RND_BOX
(
d
),
y
-
a
+
RND_BOX
(
d
), z +
a
+
RND_BOX
(
d
));
b
->SetVertex(5,
x
-
a
+
RND_BOX
(
d
),
y
+
a
+
RND_BOX
(
d
), z +
a
+
RND_BOX
(
d
));
b
->SetVertex(6,
x
+
a
+
RND_BOX
(
d
),
y
+
a
+
RND_BOX
(
d
), z +
a
+
RND_BOX
(
d
));
b
->SetVertex(7,
x
+
a
+
RND_BOX
(
d
),
y
-
a
+
RND_BOX
(
d
), z +
a
+
RND_BOX
(
d
));
#undef RND_BOX
return
b
;
}
void
makeJets
(
int
N_Jets,
REveElement
*jetHolder)
{
TRandom
&
r
= *
gRandom
;
for
(
int
i = 0; i < N_Jets; i++)
{
auto
jet =
new
REveJetCone
(
Form
(
"Jet_%d"
,i ));
jet->SetCylinder(2*
kR_max
, 2*
kZ_d
);
jet->AddEllipticCone(
r
.Uniform(-0.5, 0.5),
r
.Uniform(0,
TMath::TwoPi
()),
0.1, 0.2);
jet->SetFillColor(
kRed
);
jet->SetLineColor(
kRed
);
jetHolder->AddElement(jet);
}
}
void
makeTexts
(
REveElement
*textHolder)
{
{
auto
text
=
new
REveText
(
Form
(
"Text_0"
));
text
-> SetMainColor(
kViolet
);
REveVector
pos(0.5, 0.5, 0.2);
text
-> SetPosition(pos);
text
-> SetFontSize(0.1);
text
-> SetFont(2);
text
-> SetText(
text
->GetCName());
textHolder->AddElement(
text
);
}
}
void
overlay_test()
{
auto
gEve
= REveManager::Create();
TRandom
&
r
= *
gRandom
;
// create an overlay scene
REveScene
* os =
gEve
->
SpawnNewScene
(
"Overly scene"
,
"OverlayTitle"
);
((
REveViewer
*)(
gEve
->
GetViewers
()->
FirstChild
()))->AddScene(os);
os->SetIsOverlay(
true
);
makeTexts
(os);
auto
jetHolder =
new
REveElement
(
"jets"
);
makeJets
(2,jetHolder);
gEve
->
GetEventScene
()->
AddElement
(jetHolder);
auto
trackHolder =
new
REveElement
(
"Tracks"
);
gEve
->
GetEventScene
()->
AddElement
(trackHolder);
makeTracks
(10, trackHolder);
gEve
->Show();
}
REveBox.hxx
REveJetCone.hxx
REveManager.hxx
REveScene.hxx
REveText.hxx
REveTrackPropagator.hxx
REveTrack.hxx
d
#define d(i)
Definition
RSha256.hxx:102
b
#define b(i)
Definition
RSha256.hxx:100
a
#define a(i)
Definition
RSha256.hxx:99
Float_t
float Float_t
Definition
RtypesCore.h:57
Double_t
double Double_t
Definition
RtypesCore.h:59
kRed
@ kRed
Definition
Rtypes.h:66
kCyan
@ kCyan
Definition
Rtypes.h:66
kBlue
@ kBlue
Definition
Rtypes.h:66
kViolet
@ kViolet
Definition
Rtypes.h:67
gEve
R__EXTERN TEveManager * gEve
Definition
TEveManager.h:243
p
winID h TVirtualViewer3D TVirtualGLPainter p
Definition
TGWin32VirtualGLProxy.cxx:51
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
prop
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 Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h prop
Definition
TGWin32VirtualXProxy.cxx:245
text
Option_t Option_t TPoint TPoint const char text
Definition
TGWin32VirtualXProxy.cxx:68
gRandom
R__EXTERN TRandom * gRandom
Definition
TRandom.h:62
Form
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition
TString.cxx:2489
REveBox
3D box with arbitrary vertices (cuboid).
REveElement
Base class for REveUtil visualization elements, providing hierarchy management, rendering control and...
REveJetCone
Draws a jet cone with leading particle is specified in (eta,phi) and cone radius is given.
REveMagFieldDuo
Implements constant magnetic filed that switches on given axial radius fR2 from vector fBIn to fBOut.
REveScene
Eve representation of TGLScene.
REveTrackPropagator
Holding structure for a number of track rendering parameters.
REveTrack
Visual representation of a track.
REveViewer
Eve representation of a GL view.
ROOT::Experimental::REveText
Definition
REveText.hxx:26
ROOT::Experimental::REveVectorT< Float_t >
TEveElement::AddElement
virtual void AddElement(TEveElement *el)
Add el to the list of children.
Definition
TEveElement.cxx:1324
TEveElement::FirstChild
TEveElement * FirstChild() const
Returns the first child element or 0 if the list is empty.
Definition
TEveElement.cxx:1563
TEveManager::GetViewers
TEveViewerList * GetViewers() const
Definition
TEveManager.h:145
TEveManager::SpawnNewScene
TEveScene * SpawnNewScene(const char *name, const char *title="")
Create a new scene.
Definition
TEveManager.cxx:336
TEveManager::GetEventScene
TEveScene * GetEventScene() const
Definition
TEveManager.h:148
TParticle
Description of the dynamic properties of a particle.
Definition
TParticle.h:26
TRandom
This is the base class for the ROOT Random number generators.
Definition
TRandom.h:27
RND_BOX
#define RND_BOX(x)
makeTracks
void makeTracks(int N_Tracks, REveElement *trackHolder, float *pos)
Definition
error_ellipse.C:11
kR_max
const Double_t kR_max
Definition
calorimeters.C:16
kZ_d
const Double_t kZ_d
Definition
calorimeters.C:17
kR_min
const Double_t kR_min
Definition
calorimeters.C:15
makeJets
void makeJets(int N_Jets, REX::REveElement *jetHolder)
Definition
jets.C:21
y
Double_t y[n]
Definition
legend1.C:17
x
Double_t x[n]
Definition
legend1.C:17
ROOT::Experimental
Definition
RDirectory.hxx:30
TMath::TwoPi
constexpr Double_t TwoPi()
Definition
TMath.h:44
v
@ v
Definition
rootcling_impl.cxx:3699
m
TMarker m
Definition
textangle.C:8
makeTexts
void makeTexts(int N_Texts, REX::REveElement *textHolder)
Definition
texts.C:36
Author
Matevz Tadel
Definition in file
overlay_test.C
.
tutorials
eve7
overlay_test.C
ROOT master - Reference Guide Generated on Wed Dec 11 2024 09:40:19 (GVA Time) using Doxygen 1.9.8