Problem to read the Tree

Hello Root Community,
I am a very beginner and try to run these root input file:
man_output.root (35.4 KB)

with this code:
AnalyseParticles.C (11.4 KB)

Something is wrong with the code and I get this error …
Error2

could someone genius help me to fix this problem and make life little easier?
1000 thanks …


The line that fails should be:

tParticles = fIn->Get<TTree*>(name_of_the_tree);
if (tParticles != nullptr) {
   cerr << "Could you find the TTree named " << name_of_the_tree << '\n';
   return 0;
}

Thank you so much Philippe. Should I put in both (name_of_the_tree) and in (“Could you find the TTree named” the name of the TTree or Tree? And I applogize to bother you: where can I find the name of the TTree or Tree? If I check my root.out in the TBrowser, there are two Trees: fNTuple and fCounter
You are so great … Thank you

In your code, you seem to need both:

tParticles = fIn->Get<TTree>(not_seen_on_the_picture);
...
tCounter = fIn->Get<TTree>("fCounter");

The first tree, seem to look for several including “PDGEncoding” which are in neither of the TTree portrayed in the picture. To get a list of the TTree (and histo) in your file:

fIn->ls();

You may want to contact whomever give the file to get more information on what is the content of the files.

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