{ "cells": [ { "cell_type": "markdown", "id": "14300132", "metadata": {}, "source": [ "# mass_spectrum\n", "and text. It has been written using the TCanvas ToolBar to produce a first\n", "draft and was then modified for fine adjustments. Note also the use\n", "of C functions. They allow to simplify the macro reading and editing by\n", "avoiding code repetition or defining some graphics attributes in one single\n", "place. This technique to generate drawings may appear not very user friendly\n", "compare to all the \"wysiwyg\" graphics editors available. In some cases it can\n", "be more powerful than a GUI interface because it allows to generate very\n", "precise drawing and using computation to generate them.\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": "markdown", "id": "0b62b368", "metadata": {}, "source": [ " Definition of a helper function: " ] }, { "cell_type": "code", "execution_count": 1, "id": "63cd2b04", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:37:19.575229Z", "iopub.status.busy": "2026-05-19T20:37:19.575086Z", "iopub.status.idle": "2026-05-19T20:37:19.580938Z", "shell.execute_reply": "2026-05-19T20:37:19.580631Z" } }, "outputs": [], "source": [ "%%cpp -d\n", "\n", "void hline(Double_t x, Double_t y)\n", "{\n", " Double_t dx = 0.1;\n", " TLine *l = new TLine(x, y, x + dx, y);\n", " l->Draw();\n", " l->SetLineWidth(4);\n", "}" ] }, { "cell_type": "markdown", "id": "c5c4bd98", "metadata": {}, "source": [ " Definition of a helper function: " ] }, { "cell_type": "code", "execution_count": 2, "id": "703a68a7", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:37:19.597238Z", "iopub.status.busy": "2026-05-19T20:37:19.597114Z", "iopub.status.idle": "2026-05-19T20:37:19.600561Z", "shell.execute_reply": "2026-05-19T20:37:19.600224Z" } }, "outputs": [], "source": [ "%%cpp -d\n", "void DrawArrow(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Int_t ls)\n", "{\n", " TArrow *arr = new TArrow(x1, y1, x2, y2, 0.025, \"|>\");\n", " arr->SetFillColor(1);\n", " arr->SetFillStyle(1001);\n", " arr->SetLineStyle(ls);\n", " arr->SetAngle(19);\n", " arr->Draw();\n", "}" ] }, { "cell_type": "code", "execution_count": 3, "id": "21cdeeea", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:37:19.605199Z", "iopub.status.busy": "2026-05-19T20:37:19.605082Z", "iopub.status.idle": "2026-05-19T20:37:20.104617Z", "shell.execute_reply": "2026-05-19T20:37:20.103579Z" } }, "outputs": [], "source": [ "TCanvas *C = new TCanvas(\"C\", \"C\", 800, 500);\n", "\n", "hline(0.10, 0.25);\n", "hline(0.10, 0.80);\n", "hline(0.30, 0.90);\n", "hline(0.30, 0.35);\n", "hline(0.45, 0.60);\n", "hline(0.58, 0.68);\n", "hline(0.73, 0.70);\n", "hline(0.89, 0.75);\n", "\n", "DrawArrow(0.32, 0.90, 0.32, 0.35, 1);\n", "DrawArrow(0.34, 0.90, 0.34, 0.35, 1);\n", "DrawArrow(0.36, 0.90, 0.36, 0.60, 1);\n", "DrawArrow(0.38, 0.90, 0.38, 0.70, 1);\n", "\n", "DrawArrow(0.30, 0.90, 0.18, 0.25, 1);\n", "DrawArrow(0.30, 0.35, 0.19, 0.25, 1);\n", "DrawArrow(0.40, 0.90, 0.47, 0.61, 1);\n", "\n", "DrawArrow(0.15, 0.25, 0.15, 0.19, 1);\n", "DrawArrow(0.15, 0.80, 0.15, 0.74, 1);\n", "\n", "DrawArrow(0.50, 0.60, 0.50, 0.54, 1);\n", "DrawArrow(0.60, 0.68, 0.60, 0.62, 1);\n", "DrawArrow(0.94, 0.75, 0.94, 0.69, 1);\n", "\n", "DrawArrow(0.32, 0.35, 0.32, 0.19, 1);\n", "DrawArrow(0.36, 0.35, 0.36, 0.19, 1);\n", "DrawArrow(0.38, 0.35, 0.38, 0.19, 1);\n", "\n", "DrawArrow(0.40, 0.90, 0.60, 0.68, 1);\n", "DrawArrow(0.40, 0.90, 0.90, 0.75, 1);\n", "DrawArrow(0.45, 0.60, 0.35, 0.35, 1);\n", "DrawArrow(0.30, 0.90, 0.18, 0.80, 2);\n", "DrawArrow(0.67, 0.68, 0.36, 0.35, 1);\n", "DrawArrow(0.78, 0.70, 0.37, 0.35, 2);\n", "DrawArrow(0.91, 0.75, 0.39, 0.35, 1);\n", "\n", "TLatex l1;\n", "l1.SetTextSize(0.035);\n", "l1.SetTextAlign(22);\n", "l1.SetTextFont(132);\n", "l1.DrawLatex(0.15, 0.73, \"hadrons\");\n", "l1.DrawLatex(0.15, 0.18, \"hadrons\");\n", "l1.DrawLatex(0.32, 0.18, \"hadrons\");\n", "l1.DrawLatex(0.38, 0.59, \"hadrons\");\n", "l1.DrawLatex(0.50, 0.53, \"hadrons\");\n", "l1.DrawLatex(0.94, 0.68, \"hadrons\");\n", "l1.DrawLatex(0.58, 0.62, \"hadrons\");\n", "l1.DrawLatex(0.41, 0.18, \"radiative\");\n", "\n", "TLatex l2;\n", "l2.SetTextSize(0.038);\n", "l2.SetTextAlign(22);\n", "l2.SetTextFont(132);\n", "l2.DrawLatex(0.07, 0.08, \"#font[12]{J^{PC}} =\");\n", "l2.DrawLatex(0.15, 0.08, \"0^{-+}\");\n", "l2.DrawLatex(0.35, 0.08, \"1^{--}\");\n", "l2.DrawLatex(0.50, 0.08, \"0^{++}\");\n", "l2.DrawLatex(0.62, 0.08, \"1^{++}\");\n", "l2.DrawLatex(0.77, 0.08, \"1^{+-}\");\n", "l2.DrawLatex(0.93, 0.08, \"2^{++}\");\n", "l2.DrawLatex(0.15, 0.83, \"#eta_{c}(2S)\");\n", "l2.DrawLatex(0.15, 0.28, \"#eta_{c}(1S)\");\n", "l2.DrawLatex(0.35, 0.93, \"#psi(2S)\");\n", "l2.DrawLatex(0.45, 0.35, \"#font[12]{J}/#psi(1S)\");\n", "l2.DrawLatex(0.51, 0.63, \"#chi_{c0}(1P)\");\n", "l2.DrawLatex(0.63, 0.71, \"#chi_{c1}(1P)\");\n", "l2.DrawLatex(0.78, 0.73, \"h_{c1}(1P)\");\n", "l2.DrawLatex(0.94, 0.78, \"#chi_{c2}(1P)\");\n", "\n", "TLatex l3;\n", "l3.SetTextSize(0.037);\n", "l3.SetTextAlign(11);\n", "l3.SetTextFont(132);\n", "l3.DrawLatex(0.23, 0.86, \"#font[152]{g}\");\n", "l3.DrawLatex(0.23, 0.57, \"#font[152]{g}\");\n", "l3.DrawLatex(0.44, 0.77, \"#font[152]{g}\");\n", "l3.DrawLatex(0.40, 0.50, \"#font[152]{g}\");\n", "l3.DrawLatex(0.45, 0.46, \"#font[152]{g}\");\n", "l3.DrawLatex(0.71, 0.61, \"#font[152]{g}\");\n", "l3.DrawLatex(0.24, 0.31, \"#font[152]{g}\");\n", "l3.DrawLatex(0.38, 0.81, \"#font[152]{g^{*}}\");\n", "l3.DrawLatex(0.355, 0.16, \"#font[152]{g^{*}}\");\n", "l3.DrawLatex(0.295, 0.50, \"#pi#pi\");\n", "l3.DrawLatex(0.345, 0.53, \"#eta,#pi^{0}\");\n", "l3.DrawLatex(0.70, 0.65, \"#pi^{0}\");" ] }, { "cell_type": "markdown", "id": "6390a3ad", "metadata": {}, "source": [ "Draw all canvases " ] }, { "cell_type": "code", "execution_count": 4, "id": "6423710a", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:37:20.106239Z", "iopub.status.busy": "2026-05-19T20:37:20.106111Z", "iopub.status.idle": "2026-05-19T20:37:20.330816Z", "shell.execute_reply": "2026-05-19T20:37:20.330347Z" } }, "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 }