{ "cells": [ { "cell_type": "markdown", "id": "914da701", "metadata": {}, "source": [ "# hist031_TRatioPlot_residual_fit\n", "\n", "Since the lower plot is not created until `TRatioPlot::Draw` is called, you can only use the method\n", "afterwards.\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": "ce48239c", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:12:41.466155Z", "iopub.status.busy": "2026-05-19T20:12:41.466042Z", "iopub.status.idle": "2026-05-19T20:12:42.038473Z", "shell.execute_reply": "2026-05-19T20:12:42.037822Z" } }, "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", "c1->SetLogy();\n", "auto h1 = new TH1D(\"h1\", \"h1\", 50, -5, 5);\n", "h1->FillRandom(\"gaus\", 2000);\n", "h1->Fit(\"gaus\", \"0\");\n", "h1->SetMinimum(0.001);\n", "h1->GetXaxis()->SetTitle(\"x\");\n", "h1->GetYaxis()->SetTitle(\"y\");\n", "auto rp1 = new TRatioPlot(h1);\n", "rp1->Draw();\n", "rp1->GetLowerRefGraph()->SetMinimum(-2);\n", "rp1->GetLowerRefGraph()->SetMaximum(2);" ] }, { "cell_type": "markdown", "id": "65356413", "metadata": {}, "source": [ "Draw all canvases " ] }, { "cell_type": "code", "execution_count": 2, "id": "58b94f6a", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:12:42.040073Z", "iopub.status.busy": "2026-05-19T20:12:42.039931Z", "iopub.status.idle": "2026-05-19T20:12:42.344711Z", "shell.execute_reply": "2026-05-19T20:12:42.344060Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "