Tracking down a file structure or script problem

Greetings all,

I have a very odd problem that I am trying to resolve. I apologise if this is a stupid question - but I can’t seem to work my way past it.

I have a script (sdp.C) which I inherited from a colleague at the ANU that runs perfectly to analyse one set of data files but fails when I run it against a set of data files with seemingly identical structure.

The error message I receive is
“Error: Symbol TREE is not defined in current scope sdp.C:48:
Error: Failed to evaluate TREE->Draw(“X.PE1>>h1p1”)”

Any work arounds that I have found so far result in no data making it through the sort process.

My questions are:

  1. How can symbol “TREE” not be defined in one ROOT file and yet be defined a very similar ROOT file (same basic structure and history, translated into ROOT from the same data collection system using an identical translation utility and identical setup scripts)?

  2. Is there any step I can do within the script to make sure that the symbol “TREE” is defined (or does the definition have to exist in the ROOT file)?

  3. Is there any step I can do to make sure that “TREE” is defined in the ROOT file?

Thank you for your patience

Russell Leslie
Nuclear Physics

Problem found on both of the following ROOT versions.

ROOT 5.18/00b (branches/v5-18-00-patches@22563, Oct 19 2008, 22:04:00 on linuxx8664gcc)

CINT/ROOT C/C++ Interpreter version 5.16.29, Jan 08, 2008


ROOT 5.22/00 (trunk@26997, De 18 2008, 13:59:00 on win32)

CINT/ROOT C/C++ Interpreter version 5.16.29, Jan 08, 2008
PD1060309_R05.root (15.1 KB)
sdp.C (6.58 KB)

In your file sdp.C, replace

TString tree_name1="TREE"; by

TString tree_name1="PD1060309_R05.root"; and

TTree *T = (TTree*)f1.Get("tree_name1"); by

TTree *TREE = (TTree*)f1.Get(tree_name1);
and before asking the next question, try to think why these 2 changes are required ::slight_smile:


Dear Rene,

Thank you for those two pointers. I apologise if I seem to be turning too quickly to seek assistance - I had tried variations on what you have just suggested in my various attempts to resolve this - but I tried the two steps on an either/or basis never making both changes in the same script.

I can now get past that sticking point and trying working my way past the next one.

The solutions you have suggested seem like they should be universally true for scripts of this type, but I still have the conceptual problem that the script sdp.C does run without any changes (apart from the file referenced by fname1) for a different data set. Unfortunately the ROOT files that it will run on are too big to upload to roottalk.


Try to understand why the Tree name is “PD1060309_R05.root”. This looks more like a file name. “TREE” looks like a reasonable name.


Dear Rene,

Thank you for the clarification and I apologise for not getting the point of your earlier advice.

In transferring the data into ROOT format I had accidentally declared the tree name (which the script had assumed would be “TREE”) to be the same as the file name. I have regenerated all of the ROOT files for the current data run and have checked that we have gotten past this problem now.

On to the next problem. Thank you again for your help