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

A source with time-varying rotations/translations. More...

#include <egs_dynamic_source.h>

Inheritance diagram for EGS_DynamicSource:
EGS_BaseSource EGS_Object

Classes

struct  EGS_ControlPoint
 

Public Member Functions

 EGS_DynamicSource (EGS_BaseSource *Source, vector< EGS_ControlPoint > cpts, const string &Name="", EGS_ObjectFactory *f=0)
 Construct a dynamic source using Source as the source and cpts as the control points. Not sure if this will ever be used but here just in case.
 
 EGS_DynamicSource (EGS_Input *, EGS_ObjectFactory *f=0)
 Construct a dynamic source from the user input.
 
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_in)
 
void resetCounter ()
 
bool isValid () const
 
void setSimulationChunk (EGS_I64 nstart, EGS_I64 nrun, int npar, int nchunk)
 
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 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 Member Functions

int getCoord (const EGS_Float rand, EGS_ControlPoint &ipt)
 
void setUp ()
 

Protected Attributes

EGS_BaseSourcesource
 The source being rotated.
 
vector< EGS_ControlPointcpts
 
int ncpts
 
bool valid
 
bool sync
 
EGS_Float ptime
 
- 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 source with time-varying rotations/translations.

The dynamic source allows the user to simulate dynamic motion of any other source. The user specifies a number of control points, where each control point comprises a set of incident polar coordinates plus a monitor unit index. The polar coordinates are: (xiso,yiso,ziso) = coordinates of isocentre of rotation (cm) dsource = length of vector from isocentre to source origin (cm). With no rotations, +ve dsource is along the -Z axis. theta = angle of rotation of dsource about the Y-axis (deg). +ve values define clockwise rotations. Angle is defined relative to the -Z axis. phi = angle of rotation of dsource about Z-axis (deg). +ve values define clockwise rotations. Angle is defined relative to the +X-axis. phicol = angle of rotation of source about -dsource (deg). +ve value defines clockwise rotations. The time index controls dynamic motion as described below. The generic input is:

:start source:
    library = egs_dynamic_source
    name = some_name
    source name = the name of a previously defined source
    synchronize motion = yes or no (default)
    :start motion:
       control point = xiso(1) yiso(1) ziso(1) dsource(1) theta(1) phi(1) phicol(1) timeIndex(1)
       control point = xiso(2) yiso(2) ziso(2) dsource(2) theta(2) phi(2) phicol(2) timeIndex(2)
       .
       .
       .
       control point = xiso(N) yiso(N) ziso(N) dsource(N) theta(N) phi(N) phicol(N) timeIndex(N)
    :stop motion:
:stop source:

Control points must be defined such that timeIndex(i+1)>=timeIndex(i), where timeIndex(i) is the value of time index for control point i. The timeIndex(i) are automatically normalized by timeIndex(N), where N is the number of control points. Continuous, dynamic motion between control points is simulated by choosing a random number, R, on (0,1] and, for timeIndex(i)<R<=timeIndex(i+1), setting incident source coordinate, P, where P is one of xiso, yiso, ziso, dsource, theta, phi, or phicol, using: P=P(i)+[P(i+1)-P(i)]/[timeIndex(i+1)-timeIndex(i)]*[R-timeIndex(i)]

It is generally expected that the user provide timeIndex(1)=0.0. However, the geometry can function with timeIndex(1)>0.0, in the case where a user desires to eliminate particles associated with a range of timeIndex values, but there will be a lot of warning messages.

A simple example is shown below. This first defines a monoenergetic (1 MV) photon source in the Z-direction collimated to a 2x2 field centred on the Z-axis. The control points place the source a distance, dsource, of 100 cm above the isocentre at (0,0,0). Control points 1 and 2 rotate the source clockwise around the Y-axis (phi=0) through theta=0-360 degrees, while control points 3 and 4 rotate the source clockwise around the Z-axis (phi=90 degrees) through phi=0-360 degrees. Note that time(2)-time(1)=time(4)-time(3), so the rotations around Z and Y are carried out for an equal number of incident photons. If the source being made to move dynamically supplies its own monitor unit index (iaea_phsp_source and egs_beam_source only), then the dynamic motion can be synchronized with the motion of component modules (MLC's, jaws) within the source by setting "synchronize motion" to "yes".

:start source definition:
    :start source:
        library = egs_parallel_beam
        name = my_parallel_source
        :start shape:
            library = egs_rectangle
            rectangle = -.1 -.1 .1 .1
        :stop shape:
        direction = 0 0 1
        charge = 0
        :start spectrum:
            type = monoenergetic
            energy = 1.0
        :stop spectrum:
    :stop source:
    :start source:
        library = egs_dynamic_source
        name = my_source
        source name = my_parallel_source
        :start motion:
            control point = 0 0 0 100 0 0 0 0
            control point = 0 0 0 100 360 0 0 0.5
            control point = 0 0 0 100 90 0 0 0.5
            control point = 0 0 0 100 90 360 0 1.0
        :stop motion:
    :stop source:

    simulation source = my_source

:stop source definition:

Definition at line 167 of file egs_dynamic_source.h.

Member Function Documentation

◆ containsDynamic()

void EGS_DynamicSource::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 200 of file egs_dynamic_source.cpp.


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