SLIC  6.1.1
Simulation for the Linear Collider (SLIC) - Geant4 simulation application
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
EventSourceWithInputFile Class Referenceabstract

An EventSource with an associated input file, such as StdHep or LCIO event files. More...

#include <EventSourceWithInputFile.hh>

Inheritance diagram for EventSourceWithInputFile:
EventSource Module LHEEventSource LcioEventSource StdHepEventSource

Public Member Functions

virtual ~EventSourceWithInputFile ()
 
void beginEvent (const G4Event *event)
 
void beginRun (const G4Run *run)
 
virtual void close ()=0
 
const std::string & getFilename ()
 
bool isEOF ()
 
virtual void open ()=0
 
virtual void printCurrentEvent ()=0
 
virtual void readNextEvent ()=0
 
void reset ()
 
void setFilename (const std::string &filename)
 
unsigned int skipEvents (unsigned int nevents)
 
- Public Member Functions inherited from EventSource
virtual ~EventSource ()
 
virtual void endEvent (const G4Event *event)
 
virtual void endRun (const G4Run *run)
 
virtual void generate (G4Event *event)=0
 
- Public Member Functions inherited from Module
virtual ~Module ()
 
virtual void cleanup ()
 
bool deleteOnExit ()
 
const std::string & getName () const
 
ModuleStatus getStatus () const
 
virtual void initialize ()
 
LogStream & log ()
 
virtual void postTracking (const G4Track *)
 
virtual void preTracking (const G4Track *)
 
virtual void stepping (const G4Step *)
 

Protected Member Functions

 EventSourceWithInputFile (const std::string &name, const std::string &filename="")
 
- Protected Member Functions inherited from EventSource
 EventSource (const std::string &name)
 
- Protected Member Functions inherited from Module
 Module (const std::string &name, bool deleteOnExit=true, bool autoRegister=true)
 

Protected Attributes

bool m_eof
 
bool m_fileIsNew
 
bool m_fileIsOpen
 
bool m_fileIsSet
 
std::string m_filename
 

Additional Inherited Members

- Public Types inherited from Module
enum  ModuleStatus { eOkay = 0 , eNotInitialized = 1 , eBadState = 2 , eFatalError = 3 }
 
- Public Attributes inherited from Module
bool m_deleteOnExit
 
LogStream * m_log
 
std::string m_name
 
ModuleStatus m_status
 

Detailed Description

An EventSource with an associated input file, such as StdHep or LCIO event files.

Definition at line 15 of file EventSourceWithInputFile.hh.

Constructor & Destructor Documentation

◆ EventSourceWithInputFile()

EventSourceWithInputFile ( const std::string &  name,
const std::string &  filename = "" 
)
inlineprotected

Class constructor.

Parameters
[in]nameThe name of the source.
[in]filenameThe file name of the source.

Definition at line 24 of file EventSourceWithInputFile.hh.

◆ ~EventSourceWithInputFile()

virtual ~EventSourceWithInputFile ( )
inlinevirtual

Class destructor.

Definition at line 33 of file EventSourceWithInputFile.hh.

Member Function Documentation

◆ beginEvent()

void beginEvent ( const G4Event *  event)
virtual

Begin of event hook.

Parameters
[in]eventThe Geant4 event.

Reimplemented from EventSource.

Reimplemented in StdHepEventSource, LHEEventSource, and LcioEventSource.

Definition at line 64 of file EventSourceWithInputFile.cc.

References EventSourceWithInputFile::readNextEvent().

Referenced by LcioEventSource::beginEvent(), LHEEventSource::beginEvent(), and StdHepEventSource::beginEvent().

◆ beginRun()

void beginRun ( const G4Run *  run)
virtual

◆ close()

virtual void close ( )
pure virtual

Close the file associated with the source.

Implemented in StdHepEventSource, LHEEventSource, and LcioEventSource.

Referenced by EventSourceWithInputFile::reset().

◆ getFilename()

const std::string & getFilename ( )

Get the file name of the source.

Returns
The file name.

Definition at line 30 of file EventSourceWithInputFile.cc.

References EventSourceWithInputFile::m_filename.

Referenced by EventSourceWithInputFile::beginRun(), LHEEventSource::open(), and StdHepEventSource::open().

◆ isEOF()

bool isEOF ( )

Check if the end of file has been reached.

Definition at line 60 of file EventSourceWithInputFile.cc.

References EventSourceWithInputFile::m_eof.

Referenced by EventSourceManager::isEOF(), and EventSourceWithInputFile::skipEvents().

◆ open()

virtual void open ( )
pure virtual

Open the file associated with the source.

Implemented in StdHepEventSource, LHEEventSource, and LcioEventSource.

Referenced by EventSourceWithInputFile::reset().

◆ printCurrentEvent()

virtual void printCurrentEvent ( )
pure virtual

Dump the current event to std::cout.

Implements EventSource.

Implemented in StdHepEventSource, LHEEventSource, and LcioEventSource.

◆ readNextEvent()

virtual void readNextEvent ( )
pure virtual

◆ reset()

void reset ( )
virtual

Reset the source back to the beginning of the file.

Reimplemented from EventSource.

Definition at line 34 of file EventSourceWithInputFile.cc.

References EventSourceWithInputFile::close(), EventSourceWithInputFile::m_eof, EventSourceWithInputFile::m_fileIsOpen, and EventSourceWithInputFile::open().

Referenced by EventSourceWithInputFile::beginRun().

◆ setFilename()

void setFilename ( const std::string &  filename)

◆ skipEvents()

unsigned int skipEvents ( unsigned int  nevents)
virtual

Skip a number of events in the source's file.

Parameters
[in]neventsThe number of events to skip.

Reimplemented from EventSource.

Definition at line 47 of file EventSourceWithInputFile.cc.

References EventSourceWithInputFile::isEOF(), and EventSourceWithInputFile::readNextEvent().

Referenced by EventSourceWithInputFile::beginRun().

Member Data Documentation

◆ m_eof

bool m_eof
protected

◆ m_fileIsNew

bool m_fileIsNew
protected

◆ m_fileIsOpen

bool m_fileIsOpen
protected

◆ m_fileIsSet

bool m_fileIsSet
protected

◆ m_filename

std::string m_filename
protected

The documentation for this class was generated from the following files: