Read TTree custom class

Hello

I would like to read a TTree, but the “traditional” (setbranchaddress method) and “newer” (TTreeReader) way fails.

This is the output of TTree::Print()

myTree->Print()
******************************************************************************
*Tree    :myTree:                                                        *
*Entries :   425875 : Total =        22288300 bytes  File  Size =    3928110 *
*        :          : Tree compression factor =   1.00                       *
******************************************************************************
*Br    0 :myBranch.    : myClass                                         *
*Entries :   425875 : Total  Size=   22287910 bytes  All baskets in memory   *
*Baskets :      747 : Basket Size=      32000 bytes  Compression=   1.00     *
*............................................................................*

This is the output of TTree::Show():

myTree->Show(0)
Error in <TBufferFile::CheckByteCount>: object of class myClass read too few bytes: 37 instead of 44
======> EVENT:0
 myBranch.          = (myClass*)0x2c626f0

The pointer points to the same memory direction for different entries.

I would appreciate any suggestion in order to read this tree.

Thank you for your time.

Regards.

either the ROOT file is corrupted, or you don’t have the correct data description informations for your class (and the instance(s) that are stored inside the tree.)

if you could put the file somewhere visible, I could try to have a look at it.

Hello

You were right, the TFile was corrupted. Thank you for your time :slight_smile:

Greetings

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