{ "cells": [ { "cell_type": "markdown", "id": "a8030ee3", "metadata": {}, "source": [ "# hist032_TRatioPlot_fit_lines\n", "\n", "By default, dashed lines are drawn at certain points. You can either disable them, or specify\n", "where you want them to appear.\n", "\n", "\n", "\n", "\n", "**Author:** Paul Gessinger \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:12 PM." ] }, { "cell_type": "code", "execution_count": 1, "id": "093b90ce", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:12:42.729846Z", "iopub.status.busy": "2026-05-19T20:12:42.729729Z", "iopub.status.idle": "2026-05-19T20:12:43.339958Z", "shell.execute_reply": "2026-05-19T20:12:43.339534Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "****************************************\n", "Minimizer is Minuit2 / Migrad\n", "Chi2 = 22.1778\n", "NDf = 33\n", "Edm = 6.53577e-08\n", "NCalls = 55\n", "Constant = 158.988 +/- 4.47298 \n", "Mean = 0.00662197 +/- 0.0225355 \n", "Sigma = 0.993481 +/- 0.0169678 \t (limited)\n" ] } ], "source": [ "gStyle->SetOptStat(0);\n", "auto c1 = new TCanvas(\"c1\", \"fit residual simple\");\n", "auto h1 = new TH1D(\"h1\", \"h1\", 50, -5, 5);\n", "h1->FillRandom(\"gaus\", 2000);\n", "h1->Fit(\"gaus\", \"0\");\n", "h1->GetXaxis()->SetTitle(\"x\");\n", "h1->GetYaxis()->SetTitle(\"y\");\n", "auto rp1 = new TRatioPlot(h1);\n", "std::vector lines = {-3, -2, -1, 0, 1, 2, 3};\n", "rp1->SetGridlines(lines);\n", "rp1->Draw();\n", "rp1->GetLowerRefGraph()->SetMinimum(-4);\n", "rp1->GetLowerRefGraph()->SetMaximum(4);" ] }, { "cell_type": "markdown", "id": "95e04de5", "metadata": {}, "source": [ "Draw all canvases " ] }, { "cell_type": "code", "execution_count": 2, "id": "2e169eda", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:12:43.342035Z", "iopub.status.busy": "2026-05-19T20:12:43.341905Z", "iopub.status.idle": "2026-05-19T20:12:43.652407Z", "shell.execute_reply": "2026-05-19T20:12:43.651390Z" } }, "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 }