Ignore:
Timestamp:
02/14/05 12:13:58 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mraw
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mraw/MRawFileRead.cc

    r5776 r6456  
    165165// This opens the next file in the list and deletes its name from the list.
    166166//
    167 Int_t MRawFileRead::OpenNextFile()
     167Int_t MRawFileRead::OpenNextFile(Bool_t print)
    168168{
    169169    //
     
    217217    }
    218218
     219    if (!print)
     220        return kTRUE;
     221
    219222    //
    220223    // Print Run Header
     
    271274    fNumEvents=0;
    272275    return OpenNextFile()==kTRUE;
     276}
     277
     278Bool_t MRawFileRead::CalcNumTotalEvents()
     279{
     280    fNumTotalEvents = 0;
     281
     282    Bool_t rc = kTRUE;
     283
     284    while (1)
     285    {
     286        switch (OpenNextFile(kFALSE))
     287        {
     288        case kFALSE:
     289            break;
     290        case kERROR:
     291            rc = kFALSE;
     292            break;
     293        case kTRUE:
     294            fNumTotalEvents += fRawRunHeader->GetNumEvents();
     295            continue;
     296        }
     297        break;
     298    }
     299
     300    if (fIn)
     301        delete fIn;
     302    fIn = NULL;
     303
     304    return rc;
    273305}
    274306
     
    301333        return kFALSE;
    302334
    303     //
    304     // Now open next (first) file
    305     //
    306 //      if (!Rewind())
    307 //          return kFALSE;
    308 
     335    *fLog << inf << "Calculating number of total events..." << flush;
     336    if (!CalcNumTotalEvents())
     337        return kFALSE;
     338    *fLog << inf << " " << fNumTotalEvents << " found." << endl;
    309339
    310340    fNumFile=0;
    311     fNumEvents=0; 
     341    fNumEvents=0;
    312342
    313343    return kTRUE;
  • trunk/MagicSoft/Mars/mraw/MRawFileRead.h

    r5776 r6456  
    1212{
    1313private:
    14     TList     *fFileNames; // list of file names
    15     UInt_t     fNumFile;   //! number of next file
    16     UInt_t     fNumEvents; //! input stream (file to read from)
     14    TList     *fFileNames;      // list of file names
     15    UInt_t     fNumFile;        //! number of next file
     16    UInt_t     fNumEvents;      //! input stream (file to read from)
     17    UInt_t     fNumTotalEvents; //! total number of events in all files
    1718
    18     ifstream  *fIn;        //! input stream (file to read from)
     19    ifstream  *fIn;             //! input stream (file to read from)
    1920
    20     MParList  *fParList;   //! tasklist to call ReInit from
     21    MParList  *fParList;        //! tasklist to call ReInit from
    2122
    2223    UInt_t     fInterleave;
    2324
    24     Int_t OpenNextFile();
     25    Int_t  OpenNextFile(Bool_t print=kTRUE);
     26    Bool_t CalcNumTotalEvents();
    2527
    2628    Int_t PreProcess(MParList *pList);
     
    4042    Int_t  AddFile(const char *fname, Int_t entries=-1);
    4143    Bool_t Rewind();
     44    UInt_t GetEntries() { return fNumTotalEvents/fInterleave; }
    4245
    4346    ClassDef(MRawFileRead, 0)   // Task to read the raw data binary file
Note: See TracChangeset for help on using the changeset viewer.