{ "cells": [ { "cell_type": "markdown", "id": "fc3e7c9d", "metadata": {}, "source": [ "# hist048_Graphics_candle_hist\n", "\n", "\n", "\n", "\n", "**Author:** Georg Troska \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": "698f2b6b", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:13:01.105101Z", "iopub.status.busy": "2026-05-19T20:13:01.104986Z", "iopub.status.idle": "2026-05-19T20:13:01.441595Z", "shell.execute_reply": "2026-05-19T20:13:01.441062Z" } }, "outputs": [], "source": [ "TCanvas *c1 = new TCanvas(\"c1\", \"Candle Presets\", 800, 600);\n", "c1->Divide(3, 2);\n", "\n", "TRandom *rng = new TRandom();\n", "TH2I *h1 = new TH2I(\"h1\", \"Sin\", 18, 0, 360, 100, -1.5, 1.5);\n", "h1->GetXaxis()->SetTitle(\"Deg\");\n", "\n", "float myRand;\n", "for (int i = 0; i < 360; i += 10) {\n", " for (int j = 0; j < 100; j++) {\n", " myRand = rng->Gaus(sin(i * 3.14 / 180), 0.2);\n", " h1->Fill(i, myRand);\n", " }\n", "}\n", "\n", "for (int i = 1; i < 7; i++) {\n", " c1->cd(i);\n", " TString title = TString::Format(\"CANDLEX%d\", i);\n", " TH2I *myhist = (TH2I *)h1->DrawCopy(title);\n", " myhist->SetTitle(title);\n", "}\n", "\n", "TCanvas *c2 = new TCanvas(\"c2\", \"Violin Presets\", 800, 300);\n", "c2->Divide(2, 1);\n", "\n", "for (int i = 1; i < 3; i++) {\n", " c2->cd(i);\n", " TString title = TString::Format(\"VIOLINX%d\", i);\n", " TH2I *myhist = (TH2I *)h1->DrawCopy(title);\n", " myhist->SetFillColor(kGray + 2);\n", "}\n", "\n", "TCanvas *c3 = new TCanvas(\"c3\", \"Playing with candle and violin-options\", 800, 600);\n", "c3->Divide(3, 2);\n", "TString myopt[6] = {\"1000000\", \"2000000\", \"3000000\", \"1112111\", \"112111\", \"112111\"};\n", "for (int i = 0; i < 6; i++) {\n", " c3->cd(i + 1);\n", " TString title = TString::Format(\"candlex(%s)\", myopt[i].Data());\n", " TH2I *myhist = (TH2I *)h1->DrawCopy(title);\n", " myhist->SetFillColor(kYellow);\n", " if (i == 4) {\n", " TH2I *myhist2 = (TH2I *)h1->DrawCopy(\"candlex(1000000) same\");\n", " myhist2->SetFillColor(kRed);\n", " }\n", " if (i == 5) {\n", " myhist->SetBarWidth(0.2);\n", " myhist->SetBarOffset(0.25);\n", " TH2I *myhist2 = (TH2I *)h1->DrawCopy(\"candlex(2000000) same\");\n", " myhist2->SetFillColor(kRed);\n", " myhist2->SetBarWidth(0.6);\n", " myhist2->SetBarOffset(-0.5);\n", " }\n", " myhist->SetTitle(title);\n", "}" ] }, { "cell_type": "markdown", "id": "f5edb618", "metadata": {}, "source": [ "Draw all canvases " ] }, { "cell_type": "code", "execution_count": 2, "id": "33057f4e", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:13:01.443125Z", "iopub.status.busy": "2026-05-19T20:13:01.443006Z", "iopub.status.idle": "2026-05-19T20:13:01.660551Z", "shell.execute_reply": "2026-05-19T20:13:01.659863Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "