EGSnrc C++ class library  Report PIRS-898 (2021)
Iwan Kawrakow, Ernesto Mainegra-Hing, Frederic Tessier, Reid Townson and Blake Walters
Public Member Functions | Protected Attributes | List of all members
EGS_BeamSource Class Reference

A BEAM simulation source. More...

#include <egs_beam_source.h>

Inheritance diagram for EGS_BeamSource:
EGS_BaseSource EGS_Object

Public Member Functions

 EGS_BeamSource (EGS_Input *, EGS_ObjectFactory *f=0)
 Create a BEAM simulation source from the input inp.
 
EGS_I64 getNextParticle (EGS_RandomGenerator *rndm, int &q, int &latch, EGS_Float &E, EGS_Float &wt, EGS_Vector &x, EGS_Vector &u)
 
EGS_Float getEmax () const
 
EGS_Float getFluence () const
 
bool storeState (ostream &data) const
 
bool setState (istream &data)
 
bool addState (istream &data)
 
void resetCounter ()
 
bool isValid () const
 
void setCutout (EGS_Float xmin, EGS_Float xmax, EGS_Float ymin, EGS_Float ymax)
 
void containsDynamic (bool &hasdynamic)
 Check if the simulation source contains time indices. More...
 
- Public Member Functions inherited from EGS_BaseSource
 EGS_BaseSource (const string &Name="", EGS_ObjectFactory *f=0)
 Construct a source named Name.
 
 EGS_BaseSource (EGS_Input *input, EGS_ObjectFactory *f=0)
 Construct a source from the input pointed to by inp. More...
 
const char * getSourceDescription () const
 Get a short description of this source. More...
 
virtual void setSimulationChunk (EGS_I64 nstart, EGS_I64 nrun, int npar, int nchunk)
 Set the next simulation chunk to start at nstart and to consist of nrun particles. More...
 
virtual int getCharge () const
 Get the charge of the source. More...
 
virtual void printSampledEmissions ()
 Print statistics on what was sampled from the source.
 
virtual vector< EGS_Ensdf * > getRadionuclideEnsdf ()
 Get the radionuclide ENSDF object from the source. More...
 
EGS_Float getTimeIndex ()
 
void setTimeIndex (EGS_Float temp_time)
 
- Public Member Functions inherited from EGS_Object
 EGS_Object (const string &Name="", EGS_ObjectFactory *f=0)
 Create an EGS_Object named Name belonging to the object factory f. More...
 
 EGS_Object (EGS_Input *inp, EGS_ObjectFactory *f=0)
 Create an EGS_Object from the information pointed to by inp that belongs to object factory f. More...
 
const string & getObjectName () const
 Get the object name.
 
void setObjectName (const string &Name)
 Set the object name to Name.
 
const string & getObjectType () const
 Get the object type.
 
virtual EGS_ObjectcreateObject (EGS_Input *inp)
 Create an object from the infromation pointed to by inp. More...
 
void setName (EGS_Input *inp)
 Set the name of the object from the information provided by inp. More...
 
int ref ()
 Increase the reference count to this object.
 
int deref ()
 Decrease the reference count to this object.
 
void setFactory (EGS_ObjectFactory *f)
 Set the factory to which the object belongs. More...
 

Protected Attributes

EGS_Librarylib
 The BEAMnrc user code library.
 
FinishFunction finish
 
SampleFunction sample
 The function that returns the next particle.
 
MotionSampleFunction motionsample
 
bool is_valid
 
bool time_stored
 true if time index stored
 
string the_file_name
 
ifstream the_file
 
EGS_Float Emax
 
EGS_Float time
 
EGS_I64 count
 
int particle_type
 
EGS_Float Xmin
 
EGS_Float Xmax
 
EGS_Float Ymin
 
EGS_Float Ymax
 
EGS_Float wmin
 
EGS_Float wmax
 
int q_save
 
int latch_save
 
EGS_Float E_save
 
EGS_Float wt_save
 
EGS_Float time_save
 
EGS_Vector x_save
 
EGS_Vector u_save
 
int n_reuse_photon
 
int n_reuse_electron
 
int i_reuse_photon
 
int i_reuse_electron
 
EGS_Float tei
 
EGS_Float txi
 
EGS_Float tyi
 
EGS_Float tzi
 
EGS_Float tui
 
EGS_Float tvi
 
EGS_Float twi
 
EGS_Float twti
 
EGS_Float ttimei
 
int tqi
 
int tlatchi
 
int tiphati
 
EGS_I64 counti
 
bool use_iparticle
 
- Protected Attributes inherited from EGS_BaseSource
string description
 A short source description. More...
 
EGS_Float time_index
 time index corresponding to a particle. This stores the current time index for all objects in the simulation (with the potential exception of beam and iaea_phsp source)
 
- Protected Attributes inherited from EGS_Object
string name
 The object name.
 
string otype
 The object type.
 
int nref
 Number of references to the object.
 
EGS_ObjectFactoryfactory
 The factory this object belongs to.
 

Additional Inherited Members

- Static Public Member Functions inherited from EGS_BaseSource
static EGS_BaseSourcecreateSource (EGS_Input *)
 Create sources from the information pointed to by input. More...
 
static EGS_BaseSourcegetSource (const string &Name)
 Get a pointer to the source named Name. More...
 
static void addKnownSource (EGS_BaseSource *o)
 Add a known source object to the source factory. More...
 
static void addKnownTypeId (const char *name)
 Add a known source object typeid to the source factory. More...
 
- Static Public Member Functions inherited from EGS_Object
static string getUniqueName (const EGS_Object *o=0)
 Create and return a unique object name. More...
 
static void deleteObject (EGS_Object *o)
 Delete an object. More...
 

Detailed Description

A BEAM simulation source.

A BEAM simulation source is a source that dynamically loads a BEAM user code compiled into a shared library and then uses this to peform a full BEAM simulation returning particles crossing the BEAM scoring plane. This is explained in more details in a paper by E. Tonkopi et al.

A beam simulation source is defined using the following input:

library = egs_beam_source
beam code = the name of the BEAMnrc user code
pegs file = the name of the PEGS file to be used in the BEAMnrc simulation
input file = the name of the input file specifying the BEAMnrc simulation
cutout = x1 x2 y1 y2 (optional)
particle type = all or electrons or photons or positrons or charged (optional)
weight window = wmin wmax

If the cutout key is present, all particles not passing through the rectangle specified by its left-upper and right-lower corners (x1,y1) and (x2,y2) will be rejected. With the optional particle type one can select a particular type of particles (default is all). If the weight window key is present, particles having statistical weights less than wmin or greater than wmax will be rejected. This is useful to e.g. reject "phat" particles from a simulation using DBS.

BEWARE: When restarting calculations using this source, one must make sure that the RESTART calculation option is defined in both, the source and the application input files.

A simple example. Note that you must build the required shared library for the accelerator (i.e. use the command 'make library' in the BEAM_EX10MeVe directory).

:start source definition:
    :start source:
        library = egs_beam_source
        name    = my_source
        beam code = BEAM_EX10MeVe
        pegs file = 521icru
        input file = EX10MeVe
        particle type = all
    :stop source:

    simulation source = my_source

:stop source definition:
A simple example

Definition at line 138 of file egs_beam_source.h.

Member Function Documentation

◆ containsDynamic()

void EGS_BeamSource::containsDynamic ( bool &  hasdynamic)
virtual

Check if the simulation source contains time indices.

Parameters
hasdynamicBoolean flag to indicate if time indices are included in particles returned by the source.

Reimplemented from EGS_BaseSource.

Definition at line 347 of file egs_beam_source.cpp.

References time_stored.

Member Data Documentation

◆ finish

FinishFunction EGS_BeamSource::finish
protected

The function to be called at the end of the simulation

Definition at line 188 of file egs_beam_source.h.


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