{ "cells": [ { "cell_type": "markdown", "id": "02e106de", "metadata": {}, "source": [ "# inside\n", "\n", "\n", "\n", "\n", "**Author:** Olivier Couet \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": "ec98ec82", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:37:11.813001Z", "iopub.status.busy": "2026-05-19T20:37:11.812854Z", "iopub.status.idle": "2026-05-19T20:37:12.224966Z", "shell.execute_reply": "2026-05-19T20:37:12.215035Z" } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "Info in : created default TCanvas with name c1\n" ] } ], "source": [ "auto el = new TEllipse(0.75, 0.25, .2, .15, 45, 315, 62);\n", "el->Draw();\n", "\n", "auto gr = new TGraph();\n", "double gr_x1[5] = {0.1, 0.3388252, 0.03796561, 0.4176218, 0.1};\n", "double gr_y1[5] = {0.5, 0.9644737, 0.7776316, 0.6960526, 0.5};\n", "gr = new TGraph(5, gr_x1, gr_y1);\n", "gr->Draw(\"L\");\n", "\n", "auto bx = new TBox(.7, .8, .9, .95);\n", "bx->Draw();\n", "\n", "auto pv = new TPave(.05, .1, .3, .2);\n", "pv->Draw();\n", "\n", "auto di = new TDiamond(.05, .25, .3, .4);\n", "di->Draw();\n", "\n", "auto cr = new TCrown(.5, .5, .1, .15);\n", "cr->SetFillColor(19);\n", "cr->Draw();\n", "\n", "for (int i = 0; i < 10000; i++) {\n", " double x = gRandom->Rndm();\n", " double y = gRandom->Rndm();\n", " auto p = new TMarker(x, y, 7);\n", " p->Draw();\n", " if (el->IsInside(x, y) || bx->IsInside(x, y) || pv->IsInside(x, y) || di->IsInside(x, y) || cr->IsInside(x, y) ||\n", " gr->IsInside(x, y)) {\n", " p->SetMarkerColor(kGreen);\n", " } else {\n", " p->SetMarkerColor(kRed);\n", " }\n", "}" ] }, { "cell_type": "markdown", "id": "c58209af", "metadata": {}, "source": [ "Draw all canvases " ] }, { "cell_type": "code", "execution_count": 2, "id": "bfcae17e", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:37:12.239373Z", "iopub.status.busy": "2026-05-19T20:37:12.239231Z", "iopub.status.idle": "2026-05-19T20:37:12.589342Z", "shell.execute_reply": "2026-05-19T20:37:12.588868Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "
\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "%jsroot on\n", "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 }