Celeritas 0.6.0-dev.115+3b60a5fd
Loading...
Searching...
No Matches
Public Member Functions | List of all members
celeritas::HepMC3PrimaryGenerator Class Referencefinal

HepMC3 reader class for sharing across threads. More...

#include <HepMC3PrimaryGenerator.hh>

Inheritance diagram for celeritas::HepMC3PrimaryGenerator:
Inheritance graph
[legend]

Public Member Functions

 HepMC3PrimaryGenerator (std::string const &filename)
 Construct with a path to a HepMC3-compatible input file.
 
 CELER_DELETE_COPY_MOVE (HepMC3PrimaryGenerator)
 
void GeneratePrimaryVertex (G4Event *g4_event) final
 Add HepMC3 primaries to a Geant4 event.
 
int NumEvents ()
 Get total number of events.
 

Detailed Description

HepMC3 reader class for sharing across threads.

This class should be shared among threads so that events can be correctly split up between them. It should be called from a user's primary generator action:

void MyAction::GeneratePrimaries(G4Event* event)
{
CELER_TRY_HANDLE(generator_->GeneratePrimaryVertex(event),
ExceptionConverter("celer.event.generate"));
}
#define CELER_TRY_HANDLE(STATEMENT, HANDLE_EXCEPTION)
"Try" to execute the statement, and "handle" all thrown errors by calling the given function-like err...
Definition Macros.hh:188
Translate Celeritas C++ exceptions into Geant4 G4Exception calls.
Definition ExceptionConverter.hh:33
Note
This class assumes that all threads will be reading all events sequentially and that events in the HepMC3 file are numbered sequentially from zero.

Member Function Documentation

◆ GeneratePrimaryVertex()

void celeritas::HepMC3PrimaryGenerator::GeneratePrimaryVertex ( G4Event g4_event)
inlinefinal

Add HepMC3 primaries to a Geant4 event.

This function should be called by G4VUserPrimaryGeneratorAction::GeneratePrimaries .


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