Hi Ken, On Sat, 5 Jan 2002, Ken Bloom wrote: > Dear ROOT, > > I have what seems to me like a simple problem...yet I cannot find any > information about it on the ROOT Web site. My apologies if I'm asking about > an already-solved problem. > > I created a TChain that has seven different files as part of it, and I > used the MakeClass method to write a code skeleton for analysis. The Loop > method includes the lines > > Int_t nentries = Int_t(fChain->GetEntries()); > > Int_t nbytes = 0, nb = 0; > for (Int_t jentry=0; jentry<nentries;jentry++) { > Int_t ientry = LoadTree(jentry); //in case of a TChain, ientry is the entry number in the current file > nb = fChain->GetEntry(jentry); nbytes += nb; > > The comment line next to LoadTree seems quite true. fChain->GetEntries() does > seem to return the number of entries in the entire chain (all seven files), hopefully! > yet LoadTree doesn't know what to do once jentry gets to be >larger than the number of entries in the first file in the chain. Why ? That is what LoadTree is supposed to do. Did you try? How can I get LoadTree to > point me to right entry number? How do we know what the "current file" is, > and how can we know the number of entries in that particular file? Use TChain::GetFile() to get a pointer to the current file eg, fChain->GetFile(); Use TChain::GetTree() to get a pointer to the current Tree. For example, to get the number of entries in the current Tree, do fChain->GetTree()->GetEntries(); Rene Brun Thanks for > your help, best wishes. > > Ken > > ------------------------------------------------------------------------------ > Ken Bloom, Karma Adjuster Department of Physics > 734-763-2329 / 734-936-1817 (fax) University of Michigan > kenbloom@umich.edu http://www.umich.edu/~kenbloom >
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:37 MET