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)
Hi,
Your error is here
for(i=1;i<=entry;i++)
{
t->GetEntry(i);
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
for(i=0;i<entry;i++)
The same is also true for the for that loops over the leaves it should be
for(j=0;j<mult;j++)
Thanks a lot sir
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.