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

Generate a vector of primaries. More...

#include <PrimaryGenerator.hh>

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

Public Types

Type aliases
using PrimaryGeneratorEngine = std::mt19937
 
using EnergySampler = std::function< real_type(PrimaryGeneratorEngine &)>
 
using PositionSampler = std::function< Real3(PrimaryGeneratorEngine &)>
 
using DirectionSampler = std::function< Real3(PrimaryGeneratorEngine &)>
 
using SPConstParticles = std::shared_ptr< ParticleParams const >
 
using result_type = std::vector< Primary >
 
using Input = inp::PrimaryGenerator
 
- Public Types inherited from celeritas::EventReaderInterface
using VecPrimary = std::vector< Primary >
 
using result_type = VecPrimary
 

Public Member Functions

 PrimaryGenerator (Input const &, ParticleParams const &particles)
 Construct with options and shared particle data.
 
 CELER_DELETE_COPY_MOVE (PrimaryGenerator)
 Prevent copying and moving.
 
result_type operator() () final
 Generate primary particles from a single event.
 
size_type num_events () const override
 Get total number of events.
 
void seed (UniqueEventId)
 Reseed RNG for interaction with celer-g4.
 

Static Public Member Functions

static PrimaryGenerator from_options (SPConstParticles, PrimaryGeneratorOptions const &)
 Construct from user input.
 

Additional Inherited Members

- Protected Member Functions inherited from celeritas::EventReaderInterface
 CELER_DEFAULT_COPY_MOVE (EventReaderInterface)
 

Detailed Description

Generate a vector of primaries.

This simple helper class can be used to generate primary particles of one or more particle types with the energy, position, and direction sampled from distributions. If more than one PDG number is specified, an equal number of each particle type will be produced. Each operator() call will return a single event until num_events events have been generated.

Todo:
Refactor generators so that event ID is an input and vector of primaries (which won't have an event ID) is output.

Member Function Documentation

◆ from_options()

PrimaryGenerator celeritas::PrimaryGenerator::from_options ( SPConstParticles  particles,
PrimaryGeneratorOptions const opts 
)
static

Construct from user input.

This creates a PrimaryGenerator from options read from a JSON input using a few predefined energy, spatial, and angular distributions (that can be extended as needed).

◆ num_events()

size_type celeritas::PrimaryGenerator::num_events ( ) const
inlineoverridevirtual

Get total number of events.

Implements celeritas::EventReaderInterface.

◆ operator()()

auto celeritas::PrimaryGenerator::operator() ( )
finalvirtual

Generate primary particles from a single event.

Implements celeritas::EventReaderInterface.


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