I run this code in a loop so that I read trees from different experiments. Everything seems to look fine : I have the right number of entries in each run and the histograms are well defined.
The thing is that every histogram is filled with zeros (values…). Every single value from each branch is equal to zero in the histograms I created, and that is not the case when using the TreeViewer to look at he branches etc…
Does anyone have any suggestion about this problem ?
maybe move “new TApplication” to inside of your “main” (btw. I assume you do NOT use this code as interpreted nor ACLiC precompiled -> i.e. I assume you compile and link a standalone executable)
Yes, that’s what I do.
Removing “gROOT->Reset();” and/or moving the TApplication did not change the output, I still get “(I/O error)”.
I built my trees with Double_t variables declared in branches like that :
t1.Branch("CH3_Q1",&CH3_Q1,"CH3_Q1/D");
t1.Branch("CH3_Q2",&CH3_Q32"CH3_Q2/D");
t1.Branch("CH3_Q3",&CH3_Q3,"CH3_Q3/D");
t1.Branch("CH4_Q1",&CH4_Q1,"CH4_Q1/D");
t1.Branch("CH4_Q2",&CH4_Q2,"CH4_Q2/D");
t1.Branch("CH4_Q3",&CH4_Q3,"CH4_Q3/D");
And “T->Print()” gives me this :
If your root file is not too big, post it here, or give a link to it so that we can try it.
Looking at your code again … why do you use “UPDATE” for your “hf”? Maybe you want to say “RECREATE”?
Because I am extracting only one part of the tree into an histogram. I’m using the other branches to make conditions upon filling the histogram or not. Finally, I run the code several times in a shell script to treat several runs and store these histograms in one single root file (to lighten the data analysis…)
So, so far there is nothing obviously wrong and it should work. To make any further progress we would need access to ROOT files so that we can reproduce the problem and/or assert whether the file is corrupted. Can you post this file on some public web server and/or just email it to me.
Okay, so I found my error… When creating the histogram :
Which was supposed to be stored in an another root file, I used the same name than the tree. Apparently, it was conflicting with the tree…
Now it just works fine with a different histogram name !
Nonetheless, thank you all for your time and help !