pyROOT Fill ntuple

Hi,

I was trying to find a way to Fill tuple in the python script. I’m actually not sure
what object I have to pass to tuple fill ? I have variable length tuples so I want to use the
prototype function:
Ntuple::Fill(Float_t *array)
Here is what I tried and the error message says that double object can not be assigned a value.

from ROOT import TNtuple,TFile,Double
hFile = TFile(‘ntsimple.root’,‘RECREATE’)
hNtuple = TNtuple(‘T’,‘Simple Ntuple’,‘px:py:pz:pid’)
pars = Double(4)
for i in range(0,1000):
pars[0] = 1.4
hNtuple.Fill(pars)
hFile.Close()

Any Help is appreciated !

Just a shot, 'cause I never tried: In TTree you have to pass first element of an array as a variable, for example numpy array:

var = numpy.array([0], dtype=float)
var = some_value

better example is here:

wlav.web.cern.ch/wlav/pyroot/tpytree.html

Maybe it works the same way with TNtuple.