Celeritas  0.5.0-86+4a8eea4
Classes | 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]

Classes

struct  Input
 

Public Types

Type aliases
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 >
 
- Public Types inherited from celeritas::EventReaderInterface
using VecPrimary = std::vector< Primary >
 
using result_type = VecPrimary
 

Public Member Functions

 PrimaryGenerator (SPConstParticles, Input const &)
 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.
 

Static Public Member Functions

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

Additional Inherited Members

- Protected Member Functions inherited from celeritas::EventReaderInterface
 EventReaderInterface ()=default
 
 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.

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).


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