{ "cells": [ { "cell_type": "markdown", "id": "2c181776", "metadata": {}, "source": [ "# hist062_TH1_timeonaxis2\n", "\n", "\n", "\n", "\n", "**Author:** Olivier Couet \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:13 PM." ] }, { "cell_type": "code", "execution_count": 1, "id": "85b1897e", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:13:12.788277Z", "iopub.status.busy": "2026-05-19T20:13:12.788165Z", "iopub.status.idle": "2026-05-19T20:13:13.133002Z", "shell.execute_reply": "2026-05-19T20:13:13.132255Z" } }, "outputs": [], "source": [ "auto ct2 = new TCanvas(\"ct2\", \"ct2\", 10, 10, 700, 500);\n", "\n", "TDatime T0(2003, 1, 1, 0, 0, 0);\n", "int X0 = T0.Convert();\n", "gStyle->SetTimeOffset(X0);" ] }, { "cell_type": "markdown", "id": "26d94d56", "metadata": {}, "source": [ "Define the lowest histogram limit as 2002, September 23rd" ] }, { "cell_type": "code", "execution_count": 2, "id": "0a4ccf2a", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:13:13.134718Z", "iopub.status.busy": "2026-05-19T20:13:13.134574Z", "iopub.status.idle": "2026-05-19T20:13:13.338932Z", "shell.execute_reply": "2026-05-19T20:13:13.338284Z" } }, "outputs": [], "source": [ "TDatime T1(2002, 9, 23, 0, 0, 0);\n", "int X1 = T1.Convert() - X0;" ] }, { "cell_type": "markdown", "id": "c2b18a22", "metadata": {}, "source": [ "Define the highest histogram limit as 2003, March 7th" ] }, { "cell_type": "code", "execution_count": 3, "id": "9159a2e3", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:13:13.340997Z", "iopub.status.busy": "2026-05-19T20:13:13.340881Z", "iopub.status.idle": "2026-05-19T20:13:13.545160Z", "shell.execute_reply": "2026-05-19T20:13:13.544516Z" } }, "outputs": [], "source": [ "TDatime T2(2003, 3, 7, 0, 0, 0);\n", "int X2 = T2.Convert(1) - X0;\n", "\n", "auto h1 = new TH1F(\"h1\", \"test\", 100, X1, X2);\n", "\n", "TRandom r;\n", "for (Int_t i = 0; i < 30000; i++) {\n", " Double_t noise = r.Gaus(0.5 * (X1 + X2), 0.1 * (X2 - X1));\n", " h1->Fill(noise);\n", "}\n", "\n", "h1->GetXaxis()->SetTimeDisplay(1);\n", "h1->GetXaxis()->SetLabelSize(0.03);\n", "h1->GetXaxis()->SetTimeFormat(\"%Y/%m/%d\");\n", "h1->Draw();" ] }, { "cell_type": "markdown", "id": "008c2fcb", "metadata": {}, "source": [ "Draw all canvases " ] }, { "cell_type": "code", "execution_count": 4, "id": "6508b92b", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:13:13.547157Z", "iopub.status.busy": "2026-05-19T20:13:13.547041Z", "iopub.status.idle": "2026-05-19T20:13:13.751160Z", "shell.execute_reply": "2026-05-19T20:13:13.750522Z" } }, "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 }