{ "cells": [ { "cell_type": "markdown", "id": "47b4636c", "metadata": {}, "source": [ "# hist034_TRatioPlot_fit_margin\n", "The last label of the lower plot's y axis is hidden automatically.\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": "e8d29f1f", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:12:47.695981Z", "iopub.status.busy": "2026-05-19T20:12:47.695855Z", "iopub.status.idle": "2026-05-19T20:12:48.279511Z", "shell.execute_reply": "2026-05-19T20:12:48.279117Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "****************************************\n", "Minimizer is Minuit2 / Migrad\n", "Chi2 = 29.7219\n", "NDf = 34\n", "Edm = 7.65715e-08\n", "NCalls = 55\n", "Constant = 395.847 +/- 6.87936 \n", "Mean = 0.00695631 +/- 0.0142942 \n", "Sigma = 1.00274 +/- 0.0101683 \t (limited)\n" ] } ], "source": [ "gStyle->SetOptStat(0);\n", "auto c1 = new TCanvas(\"c1\", \"fit residual simple\");\n", "gPad->SetFrameFillStyle(0);\n", "auto h1 = new TH1D(\"h1\", \"h1\", 50, -5, 5);\n", "h1->FillRandom(\"gaus\", 5000);\n", "TFitResultPtr fitres = h1->Fit(\"gaus\", \"S0\");\n", "h1->Sumw2();\n", "h1->GetXaxis()->SetTitle(\"x\");\n", "h1->GetYaxis()->SetTitle(\"y\");\n", "auto rp1 = new TRatioPlot(h1, \"errfunc\");\n", "rp1->SetGraphDrawOpt(\"L\");\n", "rp1->SetSeparationMargin(0.0);\n", "rp1->Draw();\n", "rp1->GetLowerRefGraph()->SetMinimum(-2);\n", "rp1->GetLowerRefGraph()->SetMaximum(2);" ] }, { "cell_type": "markdown", "id": "a9318ebd", "metadata": {}, "source": [ "Draw all canvases " ] }, { "cell_type": "code", "execution_count": 2, "id": "9e6d4ac9", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:12:48.302469Z", "iopub.status.busy": "2026-05-19T20:12:48.302322Z", "iopub.status.idle": "2026-05-19T20:12:48.613042Z", "shell.execute_reply": "2026-05-19T20:12:48.612457Z" } }, "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 }