uproot

How to access a TGraph with uproot?


I'm trying to access a ROOT TGraph with uproot. In the uproot tutorial (https://github.com/scikit-hep/uproot#histograms-tprofiles-tgraphs-and-others) TGraphs are mentioned, but no where is written how to load them to python. Could somebody show me a code sniplet of how to do that? Thank you already!


Solution

  • Following the example given for a histogram, it's tfile["tgraph_name"], where tfile is the open file object and "tgraph_name" is the name of the TGraph. The object this returns has all of the data that a TGraph contains, but only has the methods defined here. (uproot-methods is a separate package so that you can freely add methods that you feel are missing.)