ROOT
6.18/05
Reference Guide
tutorials
eve7
tracks.C
Go to the documentation of this file.
1
/// \file
2
/// \ingroup tutorial_eve7
3
/// This example display only points in web browser
4
///
5
/// \macro_code
6
///
7
8
#include "
TRandom.h
"
9
#include "
TParticle.h
"
10
#include <ROOT/REveElement.hxx>
11
#include <ROOT/REveScene.hxx>
12
#include <ROOT/REveManager.hxx>
13
#include <ROOT/REveTrack.hxx>
14
#include <ROOT/REveTrackPropagator.hxx>
15
16
namespace
REX
=
ROOT::Experimental
;
17
18
void
makeTracks
(
int
N_Tracks
, REX::REveElement* trackHolder)
19
{
20
TRandom
&
r
= *
gRandom
;
21
auto
prop =
new
REX::REveTrackPropagator();
22
prop->SetMagFieldObj(
new
REX::REveMagFieldDuo(350, -3.5, 2.0));
23
prop->SetMaxR(300);
24
prop->SetMaxZ(600);
25
prop->SetMaxOrbs(6);
26
27
double
v
= 0.5;
28
double
m
= 5;
29
30
for
(
int
i = 0; i <
N_Tracks
; i++)
31
{
32
auto
p =
new
TParticle
();
33
34
int
pdg = 11*(
r
.Integer(2) -1);
35
p->SetPdgCode(pdg);
36
37
p->SetProductionVertex(
r
.Uniform(-
v
,
v
),
r
.Uniform(-
v
,
v
),
r
.Uniform(-
v
,
v
), 1);
38
p->SetMomentum(
r
.Uniform(-
m
,
m
),
r
.Uniform(-
m
,
m
),
r
.Uniform(-
m
,
m
)*
r
.Uniform(1, 3), 1);
39
auto
track =
new
REX::REveTrack(p, 1, prop);
40
track->MakeTrack();
41
track->SetMainColor(
kBlue
);
42
track->SetName(
Form
(
"RandomTrack_%d"
,i ));
43
trackHolder->AddElement(track);
44
}
45
}
46
47
void
tracks
()
48
{
49
auto
eveMng
= REX::REveManager::Create();
50
51
auto
trackHolder =
new
REX::REveElement(
"Tracks"
);
52
eveMng
->GetEventScene()->AddElement(trackHolder);
53
makeTracks
(10, trackHolder);
54
55
eveMng
->Show();
56
}
v
SVector< double, 2 > v
Definition:
Dict.h:5
r
ROOT::R::TRInterface & r
Definition:
Object.C:4
kBlue
@ kBlue
Definition:
Rtypes.h:64
TParticle.h
TRandom.h
gRandom
R__EXTERN TRandom * gRandom
Definition:
TRandom.h:62
Form
char * Form(const char *fmt,...)
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
eveMng
REX::REveManager * eveMng
Definition:
collection_proxies.C:40
N_Tracks
const Int_t N_Tracks
Definition:
event_demo.C:46
ROOT::Experimental
Definition:
RDirectory.hxx:30
m
auto * m
Definition:
textangle.C:8
makeTracks
void makeTracks(int N_Tracks, REX::REveElement *trackHolder)
Definition:
tracks.C:18
tracks
void tracks()
Definition:
tracks.C:47