ROOT on compile

Hey,
So I compile root on a formal compiler (scons). The issue I am having is retrieving information from a TTree branch containing a C/C++ array. When I look into the branch in the cint root interface all of the data is there; however, when I try to do the same on the compile I get random numbers (as though the values of the variables were never set. Consider this code (assuming I did everything else beforehand correctly):

int main() { TTree * rEvent = NULL; TREE * Event = new TREE(rEvent); for(int x = 0; x < rEvent->GetEntries(); x++) { Event->GetEntry(x); for(int y = 0; y < Event->nTracks; y++) cout << Event->q[y] << '\t' << y << '\t' << x << endl; cout << endl; } return 0; }

Where:

“TREE” is a class generated by root from the method TTree::MakeClass(char*)
nTracks is a member of “TREE”
q[5] is a member of “TREE” (note that there is a maximum of 5 elements in the array)
*There are a lot of events in the file it reads

Hi,

can you give us the exact type of the branch? And / or an example file demonstrating the problem?

Cheers, Axel.

[quote=“Axel”]Hi,

can you give us the exact type of the branch? And / or an example file demonstrating the problem?

Cheers, Axel.[/quote]

So, in a seperate file, I create the tree with some branches:

UInt_t nTracks = 0; Double_t pid[5]; . . . TFile * f = new TFile("someFile.root", "RECREATE"); TTree * rootTree = new TTree("rootTree", "TTree Holding Particle Data"); rootTree->SetAutoSave(); . . . rootTree->Branch("nTracks", /* unsigned int */ &nTracks, "nTracks/i"); rootTree->Branch("pid", /* Array of Double_t */ pid, "pid[nTracks]/D"); . . . for(/* conditions */) { /* <do stuff> */ rootTree->Fill(); }

And then the code I mentioned before where the output is nonsence.

Replace

TTree * rEvent = NULL; TREE * Event = new TREE(rEvent); by

TREE * Event = new TREE();
Rene