Reading TNonSplitBrowsable in a branch using pyroot

ROOT Version: 5.34/36
Platform: Centos7
Compiler: Not Provided

Hi everyone,
I’m trying to read some information from a root file using pyroot. It also uses some object types from RAT dataframe.

I can access the information in C++, but cannot do the same using pyroot. I have attached a sample root file.Veto.root (218.2 KB) This is the C++ code that works:

TFile *F = new TFile("Veto.root");
T0 = (TTree*)F->Get("T");
RAT::DS::Root *ds = NULL;
RAT::DS::TS *ts;
int nentries = T0->GetEntries();
for (int i=0; i<nentries; ++i)
    ts = ds->GetTS(0);
    Int_t EventId = ts->GetEventID();
    cout << EventId << endl;

In TBrowser, both ds and ts are TBranchElement. But eventID which is stored under ts is a TNonSplitBrowsable. Any ideas how I can read these information?

P.S There are two TLeafElement’s saved under ds and I can access them with pyroot. But anything else saved under branches under ds is not accessible.

I have the following part of the python script if it helps:

File = TFile("Veto.root");#TFile
T = File.Get("T");
nentries = T.GetEntries();
for i in range (nentries):
    print T.ds.runID
    print T.GetLeaf("runID").GetValue()

Thank you very much in advance.

Can you try:

File = TFile("Veto.root")
T = File.T
for entry in T:

Sorry for the confusion. I can access rundID and subrunID because they are saved under ds and are TBranchElement. I want to access, for example, eventID which should be sth like entey.ds.ts.eventID, but it says that it’s a bull pointer.

But ds.ts is a vector<TS*>, isn’t it? You can’t access eventID there.

It seems that the file I was working me was “broken”. T.ds.ts.eventID actually works.
Thanks anyway!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.