Q: When I try accessing the output D3PD with Python (PyROOT), my script crashes with an error like this: "SystemError: problem in C++; program state has been reset", at the point when I get the entries from the TTree with "TTree.GetEntry()" command.


The problem:

I get a crash with the error message above running a script like this:

import ROOT
#open the .root file
f = ROOT.TFile( "OutputFile.root" )
#open the TTree
tree = f.Get( "MyAnalysisTree" )
tree.GetEntry( 0 )

The script does not crash if we load !MyAnalysisInfoTree instead of "MyAnalysisTree", with tree = f.Get( "!MyAnalysisInfoTree" ).

This because the !InfoTree stores only simple plain ROOT objects, while the Tree stores physics data, and in order to store them in an effective way, it uses data structures as vector< TLorentzVector > and vector< vector < int > >.

Unfortunately current ROOT version (at time I'm writing) does not support natively those objects, thus we need to load the Python dictionary module from ATLASWatchMan, !ATLASWatchMan.Bindings, after the !ROOT module.


The Solution:

import ROOT
import ATLASWatchMan.Bindings

#open the .root file
f = ROOT.TFile( "OutputD3PD.root" )

#open the TTree
tree = f.Get( "GeneralSearchTree" ); tree.GetEntry( 0 )


-- RiccardoMariaBianchi - 23-Oct-2009

Edit | Attach | Watch | Print version | History: r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r1 - 2009-10-23 - RiccardoMariaBianchi
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback