13 import sys, string, os
14 from ROOT
import TFile, TNtuple
17 ifn = os.path.expandvars(
"${ROOTSYS}/tutorials/pyroot/aptuple.txt")
20 print 'opening file', ifn,
'...' 21 infile =
open( ifn,
'r' ) 22 lines = infile.readlines() 24 labels = string.split( lines[1] ) 26 print 'writing file', ofn,
'...' 27 outfile =
TFile( ofn,
'RECREATE',
'ROOT file with an NTuple' )
28 ntuple =
TNtuple(
'ntuple', title, string.join( labels,
':') )
30 for line
in lines[2:]:
31 words = string.split( line )
32 row = map( float, words )
33 apply( ntuple.Fill, row )
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
A simple TTree restricted to a list of float variables only.
decltype(auto) constexpr apply(F &&f, Tuple &&t)