3

Can you please tell me why uproot doesn't interpret the trees: Evt, AAObject, TObject and t? I am probably doing something wrong here because I am not familiar with root files.

My goal: open data in my root file into pandas DataFrame.

When I try to loop over data in ['Evt'] tree, I get the following error for the following branches AAObject, TObject and t

ValueError: cannot interpret branch b'AAObject' as a Python type
in file: /myfile.root


ValueError: cannot interpret branch b't' as a Python type
in file: /myfile.root

ValueError: cannot interpret branch b'TObject' as a Python type
in file: /myfile.root

This is what I type to explore my file

data = uproot.open("myfile.root")["E"]
data.show() 
data_branch_Evt['Evt']['AAObject'].basket(0)
data_branch_Evt['t'].basket(0)`

Here is the result of data.show()

Evt                        TStreamerInfo              None
AAObject                   TStreamerInfo              None
TObject                    TStreamerInfo              None
fUniqueID                  TStreamerBasicType         asdtype('>u4')
fBits                      TStreamerBasicType         asdtype('>u4')

usr                        TStreamerSTL  asjagged(asdtype('>f8'), 10)
usr_names                  TStreamerSTL asgenobj(STLVector(STLString()))

id                         TStreamerBasicType         asdtype('>i4')
det_id                     TStreamerBasicType         asdtype('>i4')
mc_id                      TStreamerBasicType         asdtype('>i4')
run_id                     TStreamerBasicType         asdtype('>i4')
mc_run_id                  TStreamerBasicType         asdtype('>i4')
frame_index                TStreamerBasicType         asdtype('>i4')
trigger_mask               TStreamerBasicType         asdtype('>u8')
trigger_counter            TStreamerBasicType         asdtype('>u8')
overlays                   TStreamerBasicType         asdtype('>u4')
t                          TStreamerObjectAny         None
t.fSec                     TStreamerBasicType         asdtype('>i4')
t.fNanoSec                 TStreamerBasicType         asdtype('>i4')

hits                       TStreamerSTL               asdtype('>i4')

....etc...`

Thank you!

zineb a
  • 53
  • 3

1 Answers1

1

Not all ROOT types are recognized—there's something in the definition of the class that hasn't been handled yet. Without seeing the file (as a GitHub Issue), I can't diagnose it. We started with a very minimal set of types and added more as needed.

It's not a matter of handling every class on a class-by-class basis, it's about handling class features. For instance, the most recent addition was classes containing vectors of numbers. If you have classes with very conservative contents, such as "only numeric fields," then it should be automatically identified.

What we have to handle as case-by-case items are not types (such as classes), but technically "kinds," or types of types.

Jim Pivarski
  • 5,568
  • 2
  • 35
  • 47