Ignore:
Timestamp:
12/10/07 17:45:36 (17 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mfileio/MReadReports.cc

    r7838 r8780  
    317317
    318318    fPosEntry.Set(i);
     319    fPosEntry.Reset();
    319320
    320321    // Force that with the next call to Process the required events are read
     
    415416    while (fChains->GetSize())
    416417    {
     418        // Find the next tree to read from checking the time-stamps
     419        // of the next events which would be read
    417420        const Int_t nmin=FindNext();
    418421        if (nmin<0)
     
    422425        }
    423426
    424         TChain *chain = (TChain*)fChains->At(nmin);
    425 
    426         MTask *task = (MTask*)fTrees->GetList()->At(nmin);
    427 
    428         //Int_t before = chain->GetTreeNumber();
    429         if (chain->GetEntry(++fPosEntry[nmin])>0)
    430         {
    431             const Int_t rc = task->CallProcess();
    432             if (rc)
    433                 return rc;
    434         }
    435 
    436         *fLog << dbg << "Removing chain " << chain->GetName() << " from list" << flush;
    437 
    438         delete *GetTime(chain);        // Delete MTime*
    439         *fLog << "." << flush;
    440         delete fChains->Remove(chain); // Remove chain from TList
    441         *fLog << "." << flush;
    442 
    443         // FIXME: Maybe MTaskList should have a member function to
    444         //        reorder the tasks?
    445 
    446         // Move this task to the end of the list so that nmin still
    447         // corresponds to the correct task in the list.
    448         const_cast<TList*>(fTrees->GetList())->Remove(task);
    449         *fLog << "." << flush;
    450         const_cast<TList*>(fTrees->GetList())->AddLast(task);
    451         *fLog << "done." << endl;
    452     }
    453 
    454     return kFALSE;
     427        // Read the event from this tree
     428        MTask *task = static_cast<MTask*>(fTrees->GetList()->At(nmin));
     429        const Int_t rc = task->CallProcess();
     430
     431        // Read the time-stamp of the next event
     432        TChain *chain = static_cast<TChain*>(fChains->At(nmin));
     433        const Int_t cnt = chain->GetEntry(++fPosEntry[nmin]);
     434
     435        // In case there is no further time-stamp of an error reading the
     436        // event we remove this time-stamp from the list of time-stamps to
     437        // be checked for reading the next events, because there is none.
     438        if (cnt<=0 || rc==kFALSE)
     439        {
     440            *fLog << dbg << "Removing chain " << chain->GetName() << " from list" << flush;
     441
     442            delete *GetTime(chain);        // Delete MTime*
     443            *fLog << "." << flush;
     444            delete fChains->Remove(chain); // Remove chain from TList
     445            *fLog << "." << flush;
     446
     447            // FIXME: Maybe MTaskList should have a member function to
     448            //        reorder the tasks?
     449
     450            // Move this task to the end of the list so that nmin still
     451            // corresponds to the correct task in the list.
     452            const_cast<TList*>(fTrees->GetList())->Remove(task);
     453            *fLog << "." << flush;
     454            const_cast<TList*>(fTrees->GetList())->AddLast(task);
     455            *fLog << "done." << endl;
     456        }
     457
     458        // If something else than kFALSE (means: stop reading from this
     459        // tree) has happened we return the return code of the processing
     460        if (rc!=kFALSE)
     461            return rc;
     462    }
     463
     464    return kFALSE;
    455465}
    456466
Note: See TracChangeset for help on using the changeset viewer.