Hi experts,
I am trying to convert my ROOT TTree file into a CSV for use with XGBoost. I have tried a few methods which I have found on this site, including ROOT tree to CSV file format, but I haven’t had any luck so far. When I try to use this go-based method I get
root2csv: scanning leaves...
root2csv: >>> "Event_" TLeafElement not supported (struct)
panic: reflect: call of reflect.Value.Type on zero Value
goroutine 1 [running]:
reflect.Value.Type(0x0, 0x0, 0x0, 0x0, 0x30)
/usr/local/Cellar/go/1.13.8/libexec/src/reflect/value.go:1877 +0x166
go-hep.org/x/hep/groot/rtree.(*tleafElement).Type(0xc00015dc70, 0x1c, 0xc00015bc58)
/Users/laramason/go/src/go-hep.org/x/hep/groot/rtree/leaf.go:276 +0x4a
main.process(0x7ffeefbff8ba, 0x7, 0x7ffeefbff8d0, 0x28, 0x7ffeefbff8c5, 0x7, 0x0, 0x0)
/Users/laramason/XGBoost/root2csv/main.go:92 +0x2b2
main.main()
/Users/laramason/XGBoost/root2csv/main.go:65 +0x20a
I also tried using methods like the script tmva101_Training.py from the ROOT reference guide, but my ROOT file (from Delphes) seems to be more complicated than most examples on the web, as when I try to access the branches using for instance
data_sig = ROOT.RDataFrame("Delphes", signal_filename).AsNumpy()
I get
Error in <TTreeReaderValueBase::CreateProxy()>: The branch Event contains data of type TClonesArray. It cannot be accessed by a TTreeReaderValue<int>
I can access the tree (‘Delphes’) but I can’t figure out how to access the variables such as ‘Muon.pt’ which are inside a second branch ‘Muon’ (for example).
I have included a sample root file here https://www.dropbox.com/s/k3xyf8laetaalxt/ee_Toall_aTotata_161GeV_M6_10GeV.root?dl=0
Any help on how to convert this to CSV or to use it with XGBoost would be greatly appreciated!
Thanks so much,
Lara
ROOT Version: 6.18/04
Platform: OSX