{ "cells": [ { "cell_type": "markdown", "id": "453f9bd1", "metadata": {}, "source": [ "# pdf006_Gamma_LogNormal\n", "Tutorial illustrating the use of TMath::GammaDist and TMath::LogNormal\n", "\n", "\n", "\n", "\n", "**Author:** Anna Kreshuk \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:26 PM." ] }, { "cell_type": "code", "execution_count": 1, "id": "aa17497e", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:26:41.194741Z", "iopub.status.busy": "2026-05-19T20:26:41.194580Z", "iopub.status.idle": "2026-05-19T20:26:41.553224Z", "shell.execute_reply": "2026-05-19T20:26:41.552330Z" } }, "outputs": [], "source": [ "TCanvas *myc = new TCanvas(\"c1\",\"gamma and lognormal\",10,10,600,800);\n", "myc->Divide(1,2);\n", "TPad *pad1 = (TPad *)myc->cd(1);\n", "pad1->SetLogy();\n", "pad1->SetGrid();" ] }, { "cell_type": "markdown", "id": "1d99ca68", "metadata": {}, "source": [ "TMath::GammaDist" ] }, { "cell_type": "code", "execution_count": 2, "id": "b769430e", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:26:41.555131Z", "iopub.status.busy": "2026-05-19T20:26:41.555010Z", "iopub.status.idle": "2026-05-19T20:26:41.762220Z", "shell.execute_reply": "2026-05-19T20:26:41.761530Z" } }, "outputs": [], "source": [ "TF1 *fgamma = new TF1(\"fgamma\", \"TMath::GammaDist(x, [0], [1], [2])\", 0, 10);\n", "fgamma->SetParameters(0.5, 0, 1);\n", "TF1 *f1 = fgamma->DrawCopy();\n", "f1->SetMinimum(1e-5);\n", "f1->SetLineColor(kRed);\n", "fgamma->SetParameters(1, 0, 1);\n", "TF1 *f2 = fgamma->DrawCopy(\"same\");\n", "f2->SetLineColor(kGreen);\n", "fgamma->SetParameters(2, 0, 1);\n", "TF1 *f3 = fgamma->DrawCopy(\"same\");\n", "f3->SetLineColor(kBlue);\n", "fgamma->SetParameters(5, 0, 1);\n", "TF1 *f4 = fgamma->DrawCopy(\"same\");\n", "f4->SetLineColor(kMagenta);\n", "TLegend *legend1 = new TLegend(.2,.15,.5,.4);\n", "legend1->AddEntry(f1,\"gamma = 0.5 mu = 0 beta = 1\",\"l\");\n", "legend1->AddEntry(f2,\"gamma = 1 mu = 0 beta = 1\",\"l\");\n", "legend1->AddEntry(f3,\"gamma = 2 mu = 0 beta = 1\",\"l\");\n", "legend1->AddEntry(f4,\"gamma = 5 mu = 0 beta = 1\",\"l\");\n", "legend1->Draw();" ] }, { "cell_type": "markdown", "id": "af589d68", "metadata": {}, "source": [ "TMath::LogNormal" ] }, { "cell_type": "code", "execution_count": 3, "id": "dac4a689", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:26:41.764126Z", "iopub.status.busy": "2026-05-19T20:26:41.764000Z", "iopub.status.idle": "2026-05-19T20:26:41.971087Z", "shell.execute_reply": "2026-05-19T20:26:41.970403Z" } }, "outputs": [], "source": [ "TPad *pad2 = (TPad *)myc->cd(2);\n", "pad2->SetLogy();\n", "pad2->SetGrid();\n", "TF1 *flog = new TF1(\"flog\", \"TMath::LogNormal(x, [0], [1], [2])\", 0, 5);\n", "flog->SetParameters(0.5, 0, 1);\n", "TF1 *g1 = flog->DrawCopy();\n", "g1->SetLineColor(kRed);\n", "flog->SetParameters(1, 0, 1);\n", "TF1 *g2 = flog->DrawCopy(\"same\");\n", "g2->SetLineColor(kGreen);\n", "flog->SetParameters(2, 0, 1);\n", "TF1 *g3 = flog->DrawCopy(\"same\");\n", "g3->SetLineColor(kBlue);\n", "flog->SetParameters(5, 0, 1);\n", "TF1 *g4 = flog->DrawCopy(\"same\");\n", "g4->SetLineColor(kMagenta);\n", "TLegend *legend2 = new TLegend(.2,.15,.5,.4);\n", "legend2->AddEntry(g1,\"sigma = 0.5 theta = 0 m = 1\",\"l\");\n", "legend2->AddEntry(g2,\"sigma = 1 theta = 0 m = 1\",\"l\");\n", "legend2->AddEntry(g3,\"sigma = 2 theta = 0 m = 1\",\"l\");\n", "legend2->AddEntry(g4,\"sigma = 5 theta = 0 m = 1\",\"l\");\n", "legend2->Draw();" ] }, { "cell_type": "markdown", "id": "893b3eb2", "metadata": {}, "source": [ "Draw all canvases " ] }, { "cell_type": "code", "execution_count": 4, "id": "da6795b3", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:26:41.972625Z", "iopub.status.busy": "2026-05-19T20:26:41.972496Z", "iopub.status.idle": "2026-05-19T20:26:42.289166Z", "shell.execute_reply": "2026-05-19T20:26:42.288434Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "