Changeset 11431 for trunk/Mars/mraw


Ignore:
Timestamp:
07/18/11 09:27:48 (13 years ago)
Author:
tbretz
Message:
Outsourced OpenFile and ReadRunHeader to their own funtions.
Location:
trunk/Mars/mraw
Files:
2 edited

Legend:

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

    r9433 r11431  
    162162}
    163163
     164istream *MRawFileRead::OpenFile(const char *filename)
     165{
     166    return new MZlib(filename);
     167}
     168
     169Bool_t MRawFileRead::ReadRunHeader(istream &fin)
     170{
     171    //
     172    // Read RUN HEADER (see specification) from input stream
     173    //
     174    if (!fRawRunHeader->ReadEvt(fin))
     175        if (!fForce)
     176            return kFALSE;
     177
     178    return kTRUE;
     179}
     180
    164181// --------------------------------------------------------------------------
    165182//
     
    188205
    189206    const char *expname = gSystem->ExpandPathName(name);
    190     fIn = new MZlib(expname);
     207    fIn = OpenFile(expname);
    191208
    192209    const Bool_t noexist = !(*fIn);
     
    220237    MRawRunHeader h(*fRawRunHeader);
    221238
    222     //
    223     // Read RUN HEADER (see specification) from input stream
    224     //
    225     if (!fRawRunHeader->ReadEvt(*fIn))
    226         if (!fForce)
    227             return kERROR;
     239    if (!ReadRunHeader(*fIn))
     240        return kERROR;
    228241
    229242    if (!(*fIn))
    230243    {
    231244        *fLog << err << "Error: Accessing file '" << name << "'" << endl;
    232         return kERROR;
     245        return kFALSE;
    233246    }
    234247
  • trunk/Mars/mraw/MRawFileRead.h

    r7579 r11431  
    77
    88class TList;
    9 class MZlib;
    109class MTaskList;
    1110
     
    1817    UInt_t    fNumTotalEvents; //! total number of events in all files
    1918
    20     MZlib    *fIn;             //! input stream (file to read from)
     19    istream  *fIn;             //! input stream (file to read from)
    2120
    2221    MParList *fParList;        //! tasklist to call ReInit from
     
    2524
    2625    Bool_t    fForce;
     26
     27    virtual istream *OpenFile(const char *filename);
     28    virtual Bool_t   ReadRunHeader(istream &fin);
    2729
    2830    Int_t  OpenNextFile(Bool_t print=kTRUE);
Note: See TracChangeset for help on using the changeset viewer.