DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Public Member Functions | Protected Attributes | Private Types | List of all members
dd4hep::sim::Geant4EventReaderHepMC Class Reference

Class to populate Geant4 primaries from HepMC(2) files. More...

Inheritance diagram for dd4hep::sim::Geant4EventReaderHepMC:
dd4hep::sim::Geant4EventReader

Public Member Functions

 Geant4EventReaderHepMC (const std::string &nam)
 Initializing constructor. More...
 
virtual ~Geant4EventReaderHepMC ()
 Default destructor. More...
 
virtual EventReaderStatus readParticles (int event_number, Vertices &vertices, std::vector< Particle * > &particles) override
 Read an event and fill a vector of MCParticles. More...
 
virtual EventReaderStatus moveToEvent (int event_number) override
 Move to the indicated event number. More...
 
virtual EventReaderStatus skipEvent () override
 Skip event. To be implemented for sequential sources. More...
 
- Public Member Functions inherited from dd4hep::sim::Geant4EventReader
 Geant4EventReader (const std::string &nam)
 Initializing constructor. More...
 
virtual ~Geant4EventReader ()
 Default destructor. More...
 
Geant4Contextcontext () const
 Get the context (from the input action) More...
 
void setInputAction (Geant4InputAction *action)
 Set the input action. More...
 
const std::string & name () const
 File name. More...
 
bool hasDirectAccess () const
 Flag if direct event access (by event sequence number) is supported (Default: false) More...
 
int currentEventNumber () const
 return current Event Number More...
 
virtual EventReaderStatus readParticles (int event_number, Vertices &vertices, Particles &particles)=0
 Read an event and fill a vector of MCParticles. More...
 
virtual EventReaderStatus setParameters (std::map< std::string, std::string > &)
 pass parameters to the event reader object More...
 
virtual void checkParameters (std::map< std::string, std::string > &)
 make sure that all parameters have been processed, otherwise throw exceptions More...
 
virtual void registerRunParameters ()
 Register Run Parameters. More...
 

Protected Attributes

in_stream m_input
 
EventStreamm_events
 
- Protected Attributes inherited from dd4hep::sim::Geant4EventReader
std::string m_name
 File name to be opened and read. More...
 
bool m_directAccess { false }
 Flag if direct event access is supported. To be explicitly set by subclass constructors. More...
 
int m_currEvent { 0 }
 Current event number. More...
 
Geant4InputActionm_inputAction { nullptr }
 The input action context. More...
 

Private Types

typedef boost::iostreams::stream< dd4hep_file_source< int > > in_stream
 
typedef HepMC::EventStream EventStream
 

Additional Inherited Members

- Public Types inherited from dd4hep::sim::Geant4EventReader
enum  EventReaderStatus {
  EVENT_READER_ERROR =0, EVENT_READER_OK =1, EVENT_READER_NO_DIRECT =2, EVENT_READER_NO_PRIMARIES =4,
  EVENT_READER_NO_FACTORY =6, EVENT_READER_IO_ERROR =8, EVENT_READER_EOF =10
}
 Status codes of the event reader object. Anything with NOT low-bit set is an error. More...
 
typedef Geant4Vertex Vertex
 
typedef Geant4Particle Particle
 
typedef std::vector< Particle * > Particles
 
typedef std::vector< Vertex * > Vertices
 
- Protected Member Functions inherited from dd4hep::sim::Geant4EventReader
template<typename T >
void _getParameterValue (std::map< std::string, std::string > &parameters, std::string const &parameterName, T &parameter, T defaultValue)
 transform the string parameter value into the type of parameter More...
 

Detailed Description

Class to populate Geant4 primaries from HepMC(2) files.

Class to populate Geant4 primary particles and vertices from a file in HepMC format (ASCII)

For details also see: http://hepmc.web.cern.ch/hepmc/ReaderAsciiHepMC2_8cc_source.html

Author
P.Kostka (main author)
M.Frank (code reshuffeling into new DDG4 scheme)
Version
1.0

Definition at line 55 of file Geant4EventReaderHepMC.cpp.

Member Typedef Documentation

◆ EventStream

Definition at line 58 of file Geant4EventReaderHepMC.cpp.

◆ in_stream

typedef boost::iostreams::stream<dd4hep_file_source<int> > dd4hep::sim::Geant4EventReaderHepMC::in_stream
private

Definition at line 56 of file Geant4EventReaderHepMC.cpp.

Constructor & Destructor Documentation

◆ Geant4EventReaderHepMC()

dd4hep::sim::Geant4EventReaderHepMC::Geant4EventReaderHepMC ( const std::string &  nam)
explicit

Initializing constructor.

◆ ~Geant4EventReaderHepMC()

virtual dd4hep::sim::Geant4EventReaderHepMC::~Geant4EventReaderHepMC ( )
virtual

Default destructor.

Member Function Documentation

◆ moveToEvent()

virtual EventReaderStatus dd4hep::sim::Geant4EventReaderHepMC::moveToEvent ( int  event_number)
overridevirtual

Move to the indicated event number.

For pure sequential access, the default implementation will skip events one by one. For technologies supporting direct event access the default implementation will be empty.

Returns

Reimplemented from dd4hep::sim::Geant4EventReader.

◆ readParticles()

virtual EventReaderStatus dd4hep::sim::Geant4EventReaderHepMC::readParticles ( int  event_number,
Vertices vertices,
std::vector< Particle * > &  particles 
)
overridevirtual

Read an event and fill a vector of MCParticles.

◆ skipEvent()

virtual EventReaderStatus dd4hep::sim::Geant4EventReaderHepMC::skipEvent ( )
inlineoverridevirtual

Skip event. To be implemented for sequential sources.

Reimplemented from dd4hep::sim::Geant4EventReader.

Definition at line 72 of file Geant4EventReaderHepMC.cpp.

Member Data Documentation

◆ m_events

EventStream* dd4hep::sim::Geant4EventReaderHepMC::m_events
protected

Definition at line 61 of file Geant4EventReaderHepMC.cpp.

◆ m_input

in_stream dd4hep::sim::Geant4EventReaderHepMC::m_input
protected

Definition at line 60 of file Geant4EventReaderHepMC.cpp.


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