Reading TTree from file

I want to read data from the given root file which contains 1 event. But the value of variable size is being printed wrong every time and I am not able to extract the data from id,pt,y and other variables.
What should do?
I have attached root file and my script to read root file.
tutorial4.root (21.5 KB)
rohit.C (881 Bytes)

Your error is here


entries of TTree starts a 0 and end t->GetEntries() -1

you are basically accessing a random point in the memory with no connection to your size variable.

So you should change your for to


The same is also true for the for that loops over the leaves it should be


Thanks a lot sir

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