Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Loading...
Searching...
No Matches

Detailed Description

Tornado example.

View in nbviewer Open in SWAN

from ROOT import TCanvas, TView, TPolyMarker3D, TPaveText
from ROOT import gROOT, gBenchmark
from math import cos, sin, pi
gBenchmark.Start( 'tornado' )
d = 16
numberOfPoints = 200
numberOfCircles = 40
# create and open a canvas
sky = TCanvas( 'sky', 'Tornado', 300, 10, 700, 500 )
# creating view
rng = numberOfCircles * d
view.SetRange( 0, 0, 0, 4.0*rng, 2.0*rng, rng )
polymarkers = []
for j in range( d, numberOfCircles * d, d ):
# create a PolyMarker3D
pm3d = TPolyMarker3D( numberOfPoints )
# set points
for i in range( 1, numberOfPoints ) :
csin = sin( 2*pi / numberOfPoints * i ) + 1
ccos = cos( 2*pi / numberOfPoints * i ) + 1
esin = sin( 2*pi / (numberOfCircles*d) * j ) + 1
x = j * ( csin + esin );
y = j * ccos;
z = j;
pm3d.SetPoint( i, x, y, z );
# set marker size, color & style
pm3d.SetMarkerColor( 2 + ( d == ( j & d ) ) )
# draw
# save a reference
gBenchmark.Show( 'tornado' )
ct = gBenchmark.GetCpuTime( 'tornado' )
timeStr = 'Execution time: %g sec.' % ct
text = TPaveText( 0.1, 0.81, 0.9, 0.97 )
text.AddText( 'PyROOT example: tornado.py' )
text.AddText( timeStr )
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
The Canvas class.
Definition TCanvas.h:23
A Pave (see TPave) with text, lines or/and boxes inside.
Definition TPaveText.h:21
A 3D polymarker.
Author
Wim Lavrijsen

Definition in file tornado.py.