{ "cells": [ { "cell_type": "markdown", "id": "d5b7b84e", "metadata": {}, "source": [ "# pstable\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 Monday, December 15, 2025 at 04:27 AM." ] }, { "cell_type": "code", "execution_count": 1, "id": "485c50be", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2025-12-15T03:27:30.587583Z", "iopub.status.busy": "2025-12-15T03:27:30.587358Z", "iopub.status.idle": "2025-12-15T03:27:31.114797Z", "shell.execute_reply": "2025-12-15T03:27:31.092736Z" } }, "outputs": [], "source": [ "void table(Float_t x1, Float_t x2, Float_t yrange, TText &t, const char **symbol, Bool_t octal);" ] }, { "cell_type": "markdown", "id": "6295f4e4", "metadata": {}, "source": [ " Definition of a helper function: " ] }, { "cell_type": "code", "execution_count": 2, "id": "e8ea0541", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2025-12-15T03:27:31.126188Z", "iopub.status.busy": "2025-12-15T03:27:31.125986Z", "iopub.status.idle": "2025-12-15T03:27:31.150381Z", "shell.execute_reply": "2025-12-15T03:27:31.149874Z" } }, "outputs": [], "source": [ "%%cpp -d\n", "void table(Float_t x1, Float_t x2, Float_t yrange, TText &t, const char **symbol, Bool_t octal)\n", "{\n", " Int_t i;\n", " Int_t n = 0;\n", " for (i = 0; i < 1000; i++) {\n", " if (!strcmp(symbol[i], \"END\"))\n", " break;\n", " n++;\n", " }\n", " Float_t y1 = 2.5;\n", " Float_t y2 = yrange - 0.5;\n", " Float_t dx = (x2 - x1) / 5;\n", " Float_t dy = (y2 - 1 - y1) / (n + 1);\n", " Float_t y = y2 - 1 - 0.7 * dy;\n", " Float_t xc0 = x1 + 0.5 * dx;\n", " Float_t xc1 = xc0 + dx;\n", " Float_t xc2 = xc1 + dx;\n", " Float_t xc3 = xc2 + dx;\n", " Float_t xc4 = xc3 + dx;\n", " TLine line;\n", " line.DrawLine(x1, y1, x1, y2);\n", " line.DrawLine(x1, y1, x2, y1);\n", " line.DrawLine(x1, y2, x2, y2);\n", " line.DrawLine(x2, y1, x2, y2);\n", " line.DrawLine(x1, y2 - 1, x2, y2 - 1);\n", " line.DrawLine(x1 + dx, y1, x1 + dx, y2);\n", " line.DrawLine(x1 + 2 * dx, y1, x1 + 2 * dx, y2);\n", " line.DrawLine(x1 + 3 * dx, y1, x1 + 3 * dx, y2);\n", " line.DrawLine(x1 + 4 * dx, y1, x1 + 4 * dx, y2);\n", " TText tit(0, 0, \"a\");\n", " tit.SetTextSize(0.015);\n", " tit.SetTextFont(72);\n", " tit.SetTextAlign(22);\n", " tit.DrawText(xc0, y2 - 0.6, \"Input\");\n", " tit.DrawText(xc1, y2 - 0.6, \"Roman\");\n", " tit.DrawText(xc2, y2 - 0.6, \"Greek\");\n", " tit.DrawText(xc3, y2 - 0.6, \"Special\");\n", " tit.DrawText(xc4, y2 - 0.6, \"Zapf\");\n", " char text[12];\n", " for (i = 0; i < n; i++) {\n", " if (octal) {\n", " unsigned char value = *symbol[i];\n", " snprintf(text, 12, \"@\\\\ %3o\", value);\n", " } else {\n", " strcpy(text, symbol[i]);\n", " }\n", " t.DrawText(xc0, y, text);\n", " snprintf(text, 12, \"%s\", symbol[i]);\n", " t.DrawText(xc1, y, text);\n", " snprintf(text, 12, \"`%s\", symbol[i]);\n", " t.DrawText(xc2, y, text);\n", " snprintf(text, 12, \"'%s\", symbol[i]);\n", " t.DrawText(xc3, y, text);\n", " snprintf(text, 12, \"~%s\", symbol[i]);\n", " t.DrawText(xc4, y, text);\n", " y -= dy;\n", " }\n", "}" ] }, { "cell_type": "code", "execution_count": 3, "id": "3dc62b25", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2025-12-15T03:27:31.153343Z", "iopub.status.busy": "2025-12-15T03:27:31.153202Z", "iopub.status.idle": "2025-12-15T03:27:31.489122Z", "shell.execute_reply": "2025-12-15T03:27:31.488585Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "
\n", "
\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "
\n", "
\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "
\n", "
\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stderr", "output_type": "stream", "text": [ "Info in : ps file pstable1.ps has been created\n", "Info in : ps file pstable2.ps has been created\n", "Info in : ps file pstable3.ps has been created\n" ] } ], "source": [ "const char *symbol1[] = {\"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\", \"I\", \"J\", \"K\", \"L\", \"M\", \"N\", \"O\", \"P\",\n", " \"Q\", \"R\", \"S\", \"T\", \"U\", \"V\", \"W\", \"X\", \"Y\", \"Z\", \"0\", \"1\", \"2\", \"3\", \"4\", \"5\",\n", " \"6\", \"7\", \"8\", \"9\", \".\", \",\", \"+\", \"-\", \"*\", \"/\", \"=\", \"(\", \")\", \"{\", \"}\", \"END\"};\n", "\n", "const char *symbol2[] = {\"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\", \"i\", \"j\", \"k\", \"l\",\n", " \"m\", \"n\", \"o\", \"p\", \"q\", \"r\", \"s\", \"t\", \"u\", \"v\", \"w\", \"x\",\n", " \"y\", \"z\", \":\", \";\", \"@\", \"\\\\\", \"_\", \"|\", \"%\", \"@'\", \"<\", \">\",\n", " \"[\", \"]\", \"\\42\", \"@\\43\", \"@\\136\", \"@\\77\", \"@\\41\", \"@&\", \"$\", \"@\\176\", \" \", \"END\"};\n", "\n", "const char *symbol3[] = {\"\\241\", \"\\242\", \"\\243\", \"\\244\", \"\\245\", \"\\246\", \"\\247\", \"\\250\", \"\\251\", \"\\252\",\n", " \"\\253\", \"\\254\", \"\\255\", \"\\256\", \"\\257\", \"\\260\", \"\\261\", \"\\262\", \"\\263\", \"\\264\",\n", " \"\\265\", \"\\266\", \"\\267\", \"\\270\", \"\\271\", \"\\272\", \"\\273\", \"\\274\", \"\\275\", \"\\276\",\n", " \"\\277\", \"\\300\", \"\\301\", \"\\302\", \"\\303\", \"\\304\", \"\\305\", \"\\306\", \"\\307\", \"\\310\",\n", " \"\\311\", \"\\312\", \"\\313\", \"\\314\", \"\\315\", \"\\316\", \"\\317\", \"END\"};\n", "\n", "const char *symbol4[] = {\"\\321\", \"\\322\", \"\\323\", \"\\324\", \"\\325\", \"\\326\", \"\\327\", \"\\330\", \"\\331\", \"\\332\",\n", " \"\\333\", \"\\334\", \"\\335\", \"\\336\", \"\\337\", \"\\340\", \"\\341\", \"\\342\", \"\\343\", \"\\344\",\n", " \"\\345\", \"\\346\", \"\\347\", \"\\340\", \"\\351\", \"\\352\", \"\\353\", \"\\354\", \"\\355\", \"\\356\",\n", " \"\\357\", \"\\360\", \"\\361\", \"\\362\", \"\\363\", \"\\364\", \"\\365\", \"\\366\", \"\\367\", \"\\370\",\n", " \"\\371\", \"\\372\", \"\\373\", \"\\374\", \"\\375\", \"\\376\", \"\\377\", \"END\"};\n", "\n", "const char *symbol5[] = {\"\\177\", \"\\200\", \"\\201\", \"\\202\", \"\\203\", \"\\204\", \"\\205\", \"\\206\", \"\\207\",\n", " \"\\210\", \"\\211\", \"\\212\", \"\\213\", \"\\214\", \"\\215\", \"\\216\", \"\\217\", \"\\220\",\n", " \"\\221\", \"\\222\", \"\\223\", \"\\224\", \"\\225\", \"\\226\", \"\\227\", \"\\230\", \"\\231\",\n", " \"\\232\", \"\\233\", \"\\234\", \"\\235\", \"\\236\", \"\\237\", \"\\240\", \"END\"};\n", "\n", "Float_t xrange = 18;\n", "Float_t yrange = 25;\n", "Int_t w = 650;\n", "Int_t h = w * yrange / xrange;\n", "\n", "TCanvas *c1 = new TCanvas(\"c1\", \"c1\", 200, 10, w, h);\n", "c1->Range(0, 0, xrange, yrange);\n", "\n", "TText t(0, 0, \"a\");\n", "t.SetTextSize(0.02);\n", "t.SetTextFont(62);\n", "t.SetTextAlign(22);\n", "\n", "table(0.5, 0.5 * xrange - 0.5, yrange, t, symbol1, 0);\n", "table(0.5 * xrange + 0.5, xrange - 0.5, yrange, t, symbol2, 0);\n", "TText tlabel(0, 0, \"a\");\n", "tlabel.SetTextFont(72);\n", "tlabel.SetTextSize(0.018);\n", "tlabel.SetTextAlign(22);\n", "tlabel.DrawText(0.5 * xrange, 1.3, \"Input characters are standard keyboard characters\");\n", "c1->Modified();\n", "c1->Update();\n", "c1->Print(\"pstable1.ps\");\n", "\n", "TCanvas *c2 = new TCanvas(\"c2\", \"c2\", 220, 20, w, h);\n", "c2->Range(0, 0, xrange, yrange);\n", "\n", "table(0.5, 0.5 * xrange - 0.5, yrange, t, symbol3, 1);\n", "table(0.5 * xrange + 0.5, xrange - 0.5, yrange, t, symbol4, 1);\n", "tlabel.DrawText(0.5 * xrange, 1.3, \"Input characters using backslash and octal numbers\");\n", "c2->Modified();\n", "c2->Update();\n", "c2->Print(\"pstable2.ps\");\n", "\n", "TCanvas *c3 = new TCanvas(\"c3\", \"c3\", 240, 20, w, h);\n", "c3->Range(0, 0, xrange, yrange);\n", "\n", "table(0.5, 0.5 * xrange - 0.5, yrange, t, symbol5, 1);\n", "tlabel.DrawText(0.5 * xrange, 1.3, \"Input characters using backslash and octal numbers\");\n", "c3->Modified();\n", "c3->Update();\n", "c3->Print(\"pstable3.ps\");" ] }, { "cell_type": "markdown", "id": "d348a10c", "metadata": {}, "source": [ "Draw all canvases " ] }, { "cell_type": "code", "execution_count": 4, "id": "026ee194", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2025-12-15T03:27:31.491319Z", "iopub.status.busy": "2025-12-15T03:27:31.491154Z", "iopub.status.idle": "2025-12-15T03:27:31.765069Z", "shell.execute_reply": "2025-12-15T03:27:31.758735Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "
\n", "
\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "
\n", "
\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\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 }