Changeset 1568 for trunk/MagicSoft/Mars/mfileio/MReadTree.cc
- Timestamp:
- 10/30/02 17:09:31 (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mfileio/MReadTree.cc
r1527 r1568 98 98 MReadTree::MReadTree(const char *tname, const char *fname, 99 99 const char *name, const char *title) 100 : fNumEntry(0), f BranchChoosing(kFALSE), fAutoEnable(kTRUE), fProgress(NULL)100 : fNumEntry(0), fNumEntries(0), fBranchChoosing(kFALSE), fAutoEnable(kTRUE), fProgress(NULL) 101 101 { 102 102 fName = name ? name : "MReadTree"; … … 119 119 120 120 if (fname) 121 fChain->Add(fname); 121 if (fChain->Add(fname)>0) 122 SetBit(kChainWasChanged); 122 123 } 123 124 … … 198 199 // returns the number of file which were added 199 200 // 200 return fChain->Add(fname); 201 202 const Int_t numfiles = fChain->Add(fname); 203 204 if (numfiles>0) 205 SetBit(kChainWasChanged); 206 207 return numfiles; 201 208 } 202 209 … … 215 222 while ((obj=Next())) 216 223 rc += AddFile(obj->GetTitle()); 224 225 if (rc>0) 226 SetBit(kChainWasChanged); 217 227 218 228 return rc; … … 391 401 } 392 402 */ 403 } 404 405 // -------------------------------------------------------------------------- 406 // 407 // If the chain has been changed (by calling AddFile or using a file 408 // in the constructors argument) the number of entries is newly 409 // calculated from the files in the chain - this may take a while. 410 // The number of entries is returned. 411 // 412 UInt_t MReadTree::GetEntries() 413 { 414 if (TestBit(kChainWasChanged)) 415 { 416 fNumEntries = (UInt_t)fChain->GetEntries(); 417 ResetBit(kChainWasChanged); 418 } 419 return fNumEntries; 393 420 } 394 421 … … 433 460 // get number of events in this tree 434 461 // 435 fNumEntries = (UInt_t)fChain->GetEntries(); 436 437 if (!fNumEntries) 462 if (!GetEntries()) 438 463 { 439 464 *fLog << warn << dbginf << "No entries found in file(s)" << endl; … … 616 641 // 617 642 #if ROOT_VERSION_CODE < ROOT_VERSION(3,03,01) 618 if (fNumEntry >= fNumEntries)643 if (fNumEntry >= GetEntries()) 619 644 return kFALSE; 620 645 #endif … … 666 691 Bool_t MReadTree::DecEventNum(UInt_t dec) 667 692 { 668 if (fNumEntry-dec >= fNumEntries)693 if (fNumEntry-dec >= GetEntries()) 669 694 { 670 695 *fLog << warn << GetDescriptor() << ": DecEventNum, WARNING - Event " << fNumEntry << "-"; … … 684 709 Bool_t MReadTree::IncEventNum(UInt_t inc) 685 710 { 686 if (fNumEntry+inc >= fNumEntries)711 if (fNumEntry+inc >= GetEntries()) 687 712 { 688 713 *fLog << warn << GetDescriptor() << ": IncEventNum, WARNING - Event " << fNumEntry << "+"; … … 704 729 Bool_t MReadTree::SetEventNum(UInt_t nr) 705 730 { 706 if (nr >= fNumEntries)731 if (nr >= GetEntries()) 707 732 { 708 733 *fLog << warn << GetDescriptor() << ": SetEventNum, WARNING - " << nr << " out of Range." << endl;
Note:
See TracChangeset
for help on using the changeset viewer.