PyROOT: Getting boolean array (branch) out of tree

From: Dennis Petschull <dennis.petschull_at_cern.ch>
Date: Tue, 25 Nov 2008 14:38:18 +0100


Hi,

I'm having difficulties retrieving a branch out of a tree using PyROOT. The structure of the tree is the following:

root [0] TFile f("root_output/correl_SI_822_ALFA_32.root") root [1] f.ls()

TFile**         root_output/correl_SI_822_ALFA_32.root
 TFile*         root_output/correl_SI_822_ALFA_32.root
  KEY: TTree correl_tree;1 tree combining data from the SI telescope and ALFA root [2] correl_tree.Print()

*Tree :correl_tree: tree combining data from the SI telescope and ALFA *
*Entries : 50001 : Total = 71643969 bytes File Size = 4760967 *

My python code looks like this:

#++++++++++++++++++++++++++++++++++++++++

from ROOT import TFile
from ROOT import gDirectory

file = TFile( 'root_output/correl_SI_822_ALFA_32.root' )

tree = gDirectory.Get( 'correl_tree' )
entries = tree.GetEntriesFast()

for jentry in xrange(entries):

    ientry = tree.LoadTree( jentry )
    if ientry < 0:

        break

    nb = tree.GetEntry( jentry )
    if nb <= 0:

        continue

    for nEvent in tree.pmfDataMD:

        if nEvent >= 1:
            print nEvent

#++++++++++++++++++++++++++++++++++++++++++++++++

This works for all branches except pmfDataMD ! I guess the problem lies in the boolean nature of the pmfDataMD-branch.

How do extract this boolean branch out of the tree.

Cheers,
Dennis Received on Tue Nov 25 2008 - 14:38:26 CET

This archive was generated by hypermail 2.2.0 : Tue Nov 25 2008 - 17:50:01 CET