Revision 1ff8cfc023263a593b0e186877352756557e2553 authored by Rene Brun on 19 November 2004, 06:46:19 UTC, committed by Rene Brun on 19 November 2004, 06:46:19 UTC
# Default 3d Viewer # by default 3-D views are shown in the pad. # if the next line is activated, the default viewer will be OpenGL #Viewer3D.DefaultDrawOption: ogl git-svn-id: http://root.cern.ch/svn/root/trunk@10564 27541ba8-7e3a-0410-8455-c3a389f83636
1 parent 8524938
mrt.py
"""
Build ROOT Ntuple from other source.
This program reads the `aptuple.txt' file row by row, then creates
the Ntuple by adding row by row.
"""
import sys, string
from ROOT import TFile, TNtuple
ifn = 'aptuple.txt'
ofn = 'aptuple.root'
print 'opening file', ifn, '...'
infile = open( 'aptuple.txt', 'r' )
lines = infile.readlines()
title = lines[0]
labels = string.split( lines[1] )
print 'writing file', ofn, '...'
outfile = TFile( ofn, 'RECREATE', 'ROOT file with an NTuple' )
ntuple = TNtuple( 'ntuple', title, string.join( labels, ':') )
for line in lines[2:]:
words = string.split( line )
row = map( float, words )
apply( ntuple.Fill, row )
outfile.Write()
print 'done'
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...