Problem reading TTree in script

From: James Jackson <james.jackson_at_cern.ch>
Date: Thu, 21 Aug 2008 20:35:11 +0100


Hi,

I have a very simple tree, with one branch, and one entry:



*Tree :Process : Process
information                                    *

*Entries : 1 : Total = 1206 bytes File Size
= 492 *
* : : Tree compression factor =
1.00 *
******************************************************************************
*Br 0 :Process : ProcessId/I:XSec/D:NumEvents/
I *
*Entries : 1 : Total Size= 862 bytes One basket in
memory *
*Baskets : 0 : Basket Size= 32000 bytes Compression=
1.00 *
*............................................................................*

Looking at this with a TBrowser, I can plot each leaf and read off the correct value. Attempting to do this in a script doesn't work:

<code>
struct Process
{

   Int_t procId;
   Double_t xSec;
   Int_t numEvents;
};

Process process;

void test()
{

   TChain proc("Process");
   proc.Add("PhotonJets_120_170/clusterHistos_1.root/diEmAnalysis/ Process");

   proc.SetBranchAddress("Process", &process.procId);    proc.GetEvent(0);

   std::cout << "   ID: " << process.procId << std::endl;
   std::cout << "   XS: " << process.xSec << " (pb)" << std::endl;
   std::cout << "   Number of events: " << process.numEvents <<  
std::endl;
}
</code>

When run:

Processing test.c...

   ID: 125
   XS: 4.24404e-310 (pb)
   Number of events: 0

Process ID is correct, but XS and Number of events are wrong (should be 275 and 20,000). This is using ROOT version 5.20/00, built from source on an Intel Mac running Mac OS X 10.5.4. I would be grateful if anyone could help with this. For information, sometimes when using a TBrowser, trees just vanish from the left hand heirarchical view - I wonder if this build is actually unstable?

Regards,
James Jackson. Received on Thu Aug 21 2008 - 21:35:17 CEST

This archive was generated by hypermail 2.2.0 : Thu Aug 21 2008 - 23:50:01 CEST