{ "cells": [ { "cell_type": "markdown", "id": "052a5c94", "metadata": {}, "source": [ "# tornado\n", "\n", "\n", "\n", "\n", "**Author:** Rene Brun \n", "This notebook tutorial was automatically generated with ROOTBOOK-izer from the macro found in the ROOT repository on Tuesday, May 19, 2026 at 08:37 PM." ] }, { "cell_type": "code", "execution_count": 1, "id": "87cb6788", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:37:34.588473Z", "iopub.status.busy": "2026-05-19T20:37:34.588348Z", "iopub.status.idle": "2026-05-19T20:37:34.913106Z", "shell.execute_reply": "2026-05-19T20:37:34.912412Z" } }, "outputs": [], "source": [ "gBenchmark->Start(\"tornado\");\n", "\n", "double PI = 3.141592653;\n", "int d = 16;\n", "int numberOfPoints = 200;\n", "int numberOfCircles = 40;" ] }, { "cell_type": "markdown", "id": "e3d0a0df", "metadata": {}, "source": [ "create and open a canvas" ] }, { "cell_type": "code", "execution_count": 2, "id": "9b76df46", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:37:34.915113Z", "iopub.status.busy": "2026-05-19T20:37:34.914989Z", "iopub.status.idle": "2026-05-19T20:37:35.126533Z", "shell.execute_reply": "2026-05-19T20:37:35.125835Z" } }, "outputs": [], "source": [ "TCanvas *sky = new TCanvas(\"sky\", \"Tornado\", 300, 10, 700, 500);\n", "sky->SetFillColor(14);" ] }, { "cell_type": "markdown", "id": "76fcf612", "metadata": {}, "source": [ "creating view" ] }, { "cell_type": "code", "execution_count": 3, "id": "1d2b29e7", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:37:35.128627Z", "iopub.status.busy": "2026-05-19T20:37:35.128486Z", "iopub.status.idle": "2026-05-19T20:37:35.340055Z", "shell.execute_reply": "2026-05-19T20:37:35.339462Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "
\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "tornado : Real Time = 0.56 seconds Cpu Time = 0.28 seconds\n" ] } ], "source": [ "TView *view = TView::CreateView(1, 0, 0);\n", "float range = numberOfCircles * d;\n", "view->SetRange(0, 0, 0, 4.0 * range, 2.0 * range, range);\n", "\n", "for (int j = d; j < numberOfCircles * d; j += d) {\n", "\n", " // create a PolyMarker3D\n", " TPolyMarker3D *pm3d = new TPolyMarker3D(numberOfPoints);\n", "\n", " float x, y, z;\n", "\n", " // set points\n", " for (int i = 1; i < numberOfPoints; i++) {\n", " float csin = sin(2 * PI / (double)numberOfPoints * (double)i) + 1;\n", " float ccos = cos(2 * PI / (double)numberOfPoints * (double)i) + 1;\n", " float esin = sin(2 * PI / (double)(numberOfCircles * d) * (double)j) + 1;\n", " x = j * (csin + esin);\n", " y = j * ccos;\n", " z = j;\n", " pm3d->SetPoint(i, x, y, z);\n", " }\n", "\n", " // set marker size, color & style\n", " pm3d->SetMarkerSize(1);\n", " pm3d->SetMarkerColor(2 + (d == (j & d)));\n", " pm3d->SetMarkerStyle(3);\n", "\n", " // draw\n", " pm3d->Draw();\n", "}\n", "\n", "gBenchmark->Show(\"tornado\");\n", "\n", "Float_t ct = gBenchmark->GetCpuTime(\"tornado\");\n", "\n", "TPaveText *text = new TPaveText(0.1, 0.81, 0.9, 0.97);\n", "text->SetFillColor(42);\n", "text->AddText(\"ROOT example: tornado.C\");\n", "text->AddText(Form(\"Execution time: %g sec.\", ct));\n", "text->Draw();\n", "sky->Update();" ] }, { "cell_type": "markdown", "id": "fee1291e", "metadata": {}, "source": [ "Draw all canvases " ] }, { "cell_type": "code", "execution_count": 4, "id": "f482f98e", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:37:35.341840Z", "iopub.status.busy": "2026-05-19T20:37:35.341708Z", "iopub.status.idle": "2026-05-19T20:37:35.553559Z", "shell.execute_reply": "2026-05-19T20:37:35.552428Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "
\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "gROOT->GetListOfCanvases()->Draw()" ] } ], "metadata": { "kernelspec": { "display_name": "ROOT C++", "language": "c++", "name": "root" }, "language_info": { "codemirror_mode": "text/x-c++src", "file_extension": ".C", "mimetype": " text/x-c++src", "name": "c++" } }, "nbformat": 4, "nbformat_minor": 5 }