hep.io.stdhep
Class StdhepReader

java.lang.Object
  extended by hep.io.mcfio.MCFIOReader
      extended by hep.io.stdhep.StdhepReader

public class StdhepReader
extends hep.io.mcfio.MCFIOReader

A class for reading stdhep files.

Version:
$Id: StdhepReader.java 9150 2006-10-16 19:56:07Z tonyj $
Author:
Tony Johnson (tonyj@slac.stanford.edu)

Field Summary
static int EVENTHEADER
           
static int EVENTTABLE
           
static int FILEHEADER
           
static int MCF_DEFAULT_TABLE_SIZE
           
static int MCF_XDR_F_TITLE_LENGTH
           
static int MCF_XDR_VERSION_LENGTH
           
static int MCFIO_STDHEP
           
static int MCFIO_STDHEPBEG
           
static int MCFIO_STDHEPEND
           
static int MCFIO_STDHEPEV4
           
static int MCFIO_STDHEPM
           
static String STDHEP_VERSION
           
 
Constructor Summary
StdhepReader(InputStream stream)
          Open a stdhep file for reading.
StdhepReader(String file)
          Open a stdhep file for reading.
 
Method Summary
protected  hep.io.mcfio.MCFIOBlock createUserBlock(int id)
          Overrides the createUserBlock from MCFIO to create the necessary stdhep records.
 StdhepRecord goToRecord(int runNumber, int eventNumber)
          Finds the event with run number and event number specified
 StdhepRecord nextRecord()
          Read the next stdhep record from the file.
 void skip(int nEvents)
          Skip a number of records.
 
Methods inherited from class hep.io.mcfio.MCFIOReader
close, getComment, getDate, getNumberOfEvents, getNumberOfEventsExpected, getTitle, nextEvent, rewind
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MCFIO_STDHEP

public static final int MCFIO_STDHEP
See Also:
Constant Field Values

MCFIO_STDHEPM

public static final int MCFIO_STDHEPM
See Also:
Constant Field Values

MCFIO_STDHEPBEG

public static final int MCFIO_STDHEPBEG
See Also:
Constant Field Values

MCFIO_STDHEPEND

public static final int MCFIO_STDHEPEND
See Also:
Constant Field Values

MCFIO_STDHEPEV4

public static final int MCFIO_STDHEPEV4
See Also:
Constant Field Values

STDHEP_VERSION

public static final String STDHEP_VERSION
See Also:
Constant Field Values

MCF_XDR_F_TITLE_LENGTH

public static final int MCF_XDR_F_TITLE_LENGTH
See Also:
Constant Field Values

MCF_XDR_VERSION_LENGTH

public static final int MCF_XDR_VERSION_LENGTH
See Also:
Constant Field Values

MCF_DEFAULT_TABLE_SIZE

public static final int MCF_DEFAULT_TABLE_SIZE
See Also:
Constant Field Values

FILEHEADER

public static final int FILEHEADER
See Also:
Constant Field Values

EVENTTABLE

public static final int EVENTTABLE
See Also:
Constant Field Values

EVENTHEADER

public static final int EVENTHEADER
See Also:
Constant Field Values
Constructor Detail

StdhepReader

public StdhepReader(String file)
             throws IOException
Open a stdhep file for reading.

Throws:
IOException

StdhepReader

public StdhepReader(InputStream stream)
             throws IOException
Open a stdhep file for reading.

Throws:
IOException
Method Detail

nextRecord

public StdhepRecord nextRecord()
                        throws IOException
Read the next stdhep record from the file. The record may be a begin run, end run, or event record.

Throws:
IOException

goToRecord

public StdhepRecord goToRecord(int runNumber,
                               int eventNumber)
                        throws IOException
Finds the event with run number and event number specified

Throws:
EOFException - if the specified event is not found.
IOException

skip

public void skip(int nEvents)
          throws IOException
Skip a number of records. Attention, skipping events efficiently in stdhep files is unfortunately broken due to a bug in the stdhep format. The underlying MCFIO format allows for skipping through events quite efficiently, but it is not possible to tell whether a stdhep record is an event or a begin or end run record without completely unpacking it, so the following method works, but is fairly useless since you cannot tell how many events were actually skipped.

Overrides:
skip in class hep.io.mcfio.MCFIOReader
Throws:
IOException

createUserBlock

protected hep.io.mcfio.MCFIOBlock createUserBlock(int id)
                                           throws IOException
Overrides the createUserBlock from MCFIO to create the necessary stdhep records. Override this method to add support for your own record types.

Overrides:
createUserBlock in class hep.io.mcfio.MCFIOReader
Throws:
IOException


Copyright © 2000-2007 FreeHEP. All Rights Reserved.