#! /usr/bin/env python """ ntp.py: Example PyROOT program which stores data in a ROOT TNtuple which is then plotted using the ROOT plotting routines. Paul Eugenio PHZ4151C Florida State University April 1, 2019 """ from __future__ import division, print_function import numpy as np import ROOT def func( aX ): """ ... """ return np.exp( -aX ) * np.sin( 3.0 * aX )**2 # Create an instance of a Tntuple object ntuple = ROOT.TNtuple("ntp1", "My First Ntuple", "x:y" ) # define plotting limits and step size xMin = 0.0 xMax = 5.0 deltaX = 0.01 for x in np.arange( xMin, xMax, deltaX ): # Fill the TNtuple with values for x & y ntuple.Fill( x, func(x) ) # Create a plot of func(x) vs x ntuple.Draw("y:x") input("Enter [return] to exit")