{ "cells": [ { "cell_type": "markdown", "id": "f1ff3658", "metadata": {}, "source": [ "# df021_createTGraph\n", "Fill a TGraph using RDataFrame.\n", "\n", "\n", "\n", "\n", "**Author:** Enrico Guiraud, Danilo Piparo (CERN), Massimo Tumolo (Politecnico di Torino) \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:09 PM." ] }, { "cell_type": "code", "execution_count": 1, "id": "3ac1c9b8", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:09:55.170107Z", "iopub.status.busy": "2026-05-19T20:09:55.169991Z", "iopub.status.idle": "2026-05-19T20:09:55.604168Z", "shell.execute_reply": "2026-05-19T20:09:55.599425Z" } }, "outputs": [], "source": [ "ROOT::EnableImplicitMT(2);\n", "\n", "ROOT::RDataFrame d(160);" ] }, { "cell_type": "markdown", "id": "7537d982", "metadata": {}, "source": [ "Create a trivial parabola" ] }, { "cell_type": "code", "execution_count": 2, "id": "0f71244c", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:09:55.620242Z", "iopub.status.busy": "2026-05-19T20:09:55.620095Z", "iopub.status.idle": "2026-05-19T20:09:56.064425Z", "shell.execute_reply": "2026-05-19T20:09:56.063882Z" } }, "outputs": [], "source": [ "auto dd = d.Alias(\"x\", \"rdfentry_\").Define(\"y\", \"x*x\");\n", "\n", "auto graph = dd.Graph(\"x\", \"y\");" ] }, { "cell_type": "markdown", "id": "dea3ff0f", "metadata": {}, "source": [ "This tutorial is ran with multithreading enabled. The order in which points are inserted is not known, so to have a meaningful representation points are sorted." ] }, { "cell_type": "code", "execution_count": 3, "id": "8574bcb8", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:09:56.069269Z", "iopub.status.busy": "2026-05-19T20:09:56.069152Z", "iopub.status.idle": "2026-05-19T20:09:57.154259Z", "shell.execute_reply": "2026-05-19T20:09:57.153772Z" } }, "outputs": [], "source": [ "graph->Sort();\n", "auto c = new TCanvas();\n", "graph->DrawClone(\"APL\");" ] }, { "cell_type": "markdown", "id": "3fffcc29", "metadata": {}, "source": [ "Draw all canvases " ] }, { "cell_type": "code", "execution_count": 4, "id": "9cece4dc", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:09:57.156268Z", "iopub.status.busy": "2026-05-19T20:09:57.156154Z", "iopub.status.idle": "2026-05-19T20:09:57.393691Z", "shell.execute_reply": "2026-05-19T20:09:57.385651Z" } }, "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 }