# Register the NTuple so the Inspector can see it.
NTupleController.instance().registerNTuple ( ntuple )

# Create dynamic histogram and attach it to NTuple.
# It will automatically adjust its range, title, and labels
dyhist = Display ( "Histogram", ntuple, ('X value',  ) )
canvas.addDisplay ( dyhist )

mean = 45
sigma = 10
gauss = random.gauss

# Generate some data,  fill the static histograms and NTuple.
for i in range(10000):
    x = gauss( mean, sigma )
    sthist.addValues ( (x, ) )
    ntuple.addRow ( (x, ) )
    if i < 1000 :
        sthists.addValues ( (x, ) )  # only fill with first 1000


# Print some statistics from static histogram
# Could do same for dynamic
datarep = sthist.getDataRep()

print "Histogram :"
print "  Title : " + sthist.getTitle()
print "  Entries : %i" % sthist.numberOfEntries()
print "  Mean = %f" % datarep.getMean ( 'x' )
print "  Rms  = %f" % datarep.getRMS ( 'x' )