BrIOModule::End()

From: Jens Ivar Jordre (jensivar.jordre@fi.uib.no)
Date: Sat Oct 27 2001 - 20:46:24 EDT

  • Next message: Pawel Staszel: "BRAT-2-1-18"

    Howdy brats.
    
    "I'm was about to reduce some data" (This would absolutely be my start line if I 
    was to write a nuclear physical novel.), when I encountered a problem reading 
    from several raw data files. Using bratmain and a configuration script I want to 
    map some selected data processed from runXXXXXXseqYYY.dat into 
    runXXXXXXseqYYY.root, i.e. a one-to-one correspondence between the dat and the 
    root files. The problem occurs when I reach EoF in the first dat file.
    
    The reason is the following. When BrRawDataInput::Event(BrEvent*) runs into EoF, 
      fStatus is set to kStop. However, its calling function 
    BrIOModule::Event(BrEventNode*, BrEventNode*) sets fStatus to kFailure as a 
    result of the EoF. Already here I believe there is some inconsistency.
    
    Anywho, as BrIOModule::End() is currently implemented, including in the fresh 
    BRAT-2-1-16, it calls Close() of its descending module (here BrRawDataInput) if 
    fIOMode includes kBrRunFile. However, if the closure goes without problems the 
    module's fStatus is still kFailure. This is the core problem.
    
    BrModuleContainer::End() therefore stops the pipe line after calling 
    BrIOModule::End() in my input module. This further prevents the file in my 
    BrEventIO futher down the pipe line from being closed. And when calling 
    BrEventIO::Open() (from BrIOModule::Begin()) to open the next root file, there 
    is an error since the previous file was not closed.
    
    One poor possibility is of course to close and delete the file in 
    BrEventIO::Open() and. However, I believe that the right thing to do is to reset 
    the module (BrModule::Reset()) in BrIOModule::End() when the file is properly 
    closed. At some point the input module has to be reset in order to work for the 
    next file.
    
    Actually this argument also applies to BrIOModule::Finish() in the case that 
    fStatus includes kBrJobFile. Even though one would rarely encounter the problem 
    here one should reset the module after successfull file closure.
    
    If there is no objection to this by Monday afternoon EST, I will add Reset() in 
    BrIOModule::End() if the file is properly closed.
    
    Have a nice weekend.
    
    JI
    
    -- 
    Jens Ivar Jřrdre
    e-mail:    JensIvar.Jordre@fi.uib.no
    usually:   Dep. of Phys., Allégt. 55, N-5007 BERGEN, NORWAY
    currently: Bldg 510D, P.O.Box 5000, Upton, NY 11973-5000, USA
    phone:     +1-631-344-4223
    



    This archive was generated by hypermail 2b30 : Sat Oct 27 2001 - 20:45:09 EDT