User Tools

Site Tools


root:pythonrootconstructors

How use a ROOT constructor which needs pointers as arguments in python

For example to create a histogram with variable bin width, the constructor needs a pointer to the array of the lowEdges (xbins).

TH1D::TH1D(const char* name, const char* title, Int_t nbinsx, const Float_t* xbins)

To make pyRoot understand the pointer use the array class.

from ROOT import *
from array import array

binLowE = [2,4,9,15,20,22]
uniformTau = TH1D("uniformTau","",5,array('d',binLowE))
root/pythonrootconstructors.txt · Last modified: 2009/07/25 13:22 by decianm