Home | News | Documentation | Download

RDataFrame `GetBranchNames: unsupported branch type`

Hi all,

I just tried to take a loook at analyzing some data using RDataFrame again, and hit the following problem:

root [1] auto df = ROOT::RDataFrame("MEs", "dqmio.root");
root [2] *df.Count()
(unsigned long long) 840840
root [3] auto only_CSC = [](TString name){ return name == "CSC/CSCOfflineMonitor/Occupancy/hOStripsAndWiresAndCLCT";};
root [4] auto csc_df = df.Filter(only_CSC, {"name"});
Error in <TRint::HandleTermInput()>: std::runtime_error caught: GetBranchNames: unsupported branch type

This is using ROOT 6.14/08, provided as default on lxplus7. It used to work in ROOT 6.12/07 (provided by CMSSW), using the old names:

root [0] auto df =  ROOT::Experimental::TDataFrame("MEs", "dqmio.root");
root [1] *df.Count()
(unsigned long long) 840840
root [2] auto only_CSC = [](TString name){ return name == "CSC/CSCOfflineMonitor/Occupancy/hOStripsAndWiresAndCLCT";};
root [3] auto csc_df = df.Filter(only_CSC, {"name"});
root [4] *csc_df.Count()
(unsigned long long) 13347

One of the branches contains TH2F objects, is this the problem? The error message is not very helpful…

You can check out the file here:

It would be fun to look at this data using RDataFrame, given it will need some non-trivial filtering and operations applied to make sense.



ROOT Version: 6.14/08
Platform: CC7 (lxplus7)
Compiler: linuxx8664gcc

Hi Marcel,
well done switching ROOT versions, v6.12 is a lot of time in RDF years :slight_smile:
If you can, you should use v6.16 (available on lxplus7 as /cvmfs/sft.cern.ch/lcg/views/LCG_95/x86_64-centos7-gcc8-dbg/setup.sh) as there is also an important gap in performance, features and bugfixes in RDF between v6.14 and v6.16.

Now, about your specific issue: indeed it seems RDF (both v6.14 and v6.16) is not able to operate on your value branch, which contains a TH2. The technical reason is that we added some extra features since v6.12 which do not support TBranchObjects.
I opened a jira ticket, you can keep track of the progress on the issue there (and you should ping us there if you see no progress in the next 3-4 weeks, and this is a blocker for you).


it seems that the problems with TBranchObjects go deeper than RDF. Here’s a PR that seems to fix the RDF-related issues, but I can’t give a time estimate for a fix to the deeper problems.

Is it an option to move away from TBranchObjects and use e.g. TBranchElements instead?


Ciao Enrico,

thanks for the quick response.

For the urgency of this in general: We don’t really use RDataFrame currently, this is just for my personal experiments and I thought about using it in future versions of our tools. So not urgent, but if we can’t handle TH1/TH2 objects and do non-trivial operations on them (fitting?), we can’t use it for what I planned.

For TBranchElements: I don’t know much about the details here. I wrote the file using the most naive code I could come up with. If you can suggest a better way to write a TTree of histograms, I’d be interested.

The code I used to write the tree is [1], I do the round-trip via JSON and SQLite mostly because I had that format anyways and could not find an easy way to write a TTree of objects in Python…



[1] https://github.com/cms-sw/cmssw/compare/master...schneiml:dqm-root-to-sqlite#diff-6b88da977b5e099ad42379a350fba3ceR249

for some reason passing splitlevel 0 produces a TBranchObject instead of a TBranchElement – I’m not sure if it’s a bug or a feature, I’ll investigate:

TH2F *value;
TTree t;
t.Branch("value", &value,128*1024, 0)->IsA()->GetName(); // returns TBranchObject
t.Branch("value", &value,128*1024)->IsA()->GetName(); // returns TBranchElement

Could you try removing the splitlevel=0 and see if that makes TTreeReader (and therefore RDataFrame) happy?

If it can be useful in the future, RDataFrame supports reading SQLite files directly with MakeSQLiteDataFrame.

Hi Enrico,

I just re-generated the root file without that last 0 (I think I stole that from the CMSSW code that originally wrote the data), and things look a lot better. Now using 6.16/00, I get the same output as with 6.12 before.

Now I need to actually make some plots to see if things work correctly…

For reading the SQLite data directly: That was the original plan, but for the beginning, the ROOT file is a lot smaller and is also readable with older ROOT versions, while FromJSON is another rather recent feature. I might give that a try at some point.

Thanks a lot,


1 Like

Cool, let us know how that goes so we can mark this thread as solved :slight_smile:

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

In case someone ends up here: reading TBranchObjects with RDF and TTreeReader was fixed in v6.22/02 or v6.24.