{ "cells": [ { "cell_type": "markdown", "id": "f4aef70b", "metadata": {}, "source": [ "# hist063_TH1_seism\n", "\n", "\n", "\n", "\n", "**Author:** Rene Brun \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": "fdd3d00a", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:13:15.474465Z", "iopub.status.busy": "2026-05-19T20:13:15.474334Z", "iopub.status.idle": "2026-05-19T20:13:15.794888Z", "shell.execute_reply": "2026-05-19T20:13:15.794107Z" } }, "outputs": [], "source": [ "TStopwatch sw;\n", "sw.Start();" ] }, { "cell_type": "markdown", "id": "101ba4ad", "metadata": {}, "source": [ "set time offset" ] }, { "cell_type": "code", "execution_count": 2, "id": "f829e1e0", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:13:15.796647Z", "iopub.status.busy": "2026-05-19T20:13:15.796507Z", "iopub.status.idle": "2026-05-19T20:13:19.596800Z", "shell.execute_reply": "2026-05-19T20:13:19.596249Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "
\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "Real Time = 3.912s, Cpu Time = 3.780s\n" ] } ], "source": [ "TDatime dtime;\n", "gStyle->SetTimeOffset(dtime.Convert());\n", "\n", "TCanvas *c1 = new TCanvas(\"c1\", \"Time on axis\", 10, 10, 1000, 500);\n", "c1->SetGrid();\n", "\n", "Float_t bintime = 1; // one bin = 1 second. change it to set the time scale\n", "TH1F *ht = new TH1F(\"ht\", \"The ROOT seism\", 10, 0, 10 * bintime);\n", "Float_t signalval = 1000;\n", "ht->SetMaximum(signalval);\n", "ht->SetMinimum(-signalval);\n", "ht->SetStats(false);\n", "ht->SetLineColor(2);\n", "ht->GetXaxis()->SetTimeDisplay(1);\n", "ht->GetYaxis()->SetNdivisions(520);\n", "ht->Draw();\n", "\n", "for (Int_t i = 1; i < 2300; i++) {\n", " //======= Build a signal : noisy damped sine ======\n", " Float_t noise = gRandom->Gaus(0, 120);\n", " if (i > 700)\n", " noise += signalval * sin((i - 700.) * 6.28 / 30) * exp((700. - i) / 300.);\n", " ht->SetBinContent(i, noise);\n", " c1->Modified();\n", " c1->Update();\n", " gSystem->ProcessEvents(); // canvas can be edited during the loop\n", "}\n", "printf(\"Real Time = %8.3fs, Cpu Time = %8.3fs\\n\", sw.RealTime(), sw.CpuTime());" ] }, { "cell_type": "markdown", "id": "ad5e3cfc", "metadata": {}, "source": [ "Draw all canvases " ] }, { "cell_type": "code", "execution_count": 3, "id": "c5465644", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:13:19.598834Z", "iopub.status.busy": "2026-05-19T20:13:19.598707Z", "iopub.status.idle": "2026-05-19T20:13:19.805721Z", "shell.execute_reply": "2026-05-19T20:13:19.804917Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "
\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "%jsroot on\n", "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 }