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
 
EGS_Float getMu ()
 
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)
 
- Public Member Functions inherited from EGS_BaseSource
 EGS_BaseSource (const string &Name="", EGS_ObjectFactory *f=0)
 Construct a source named Name. More...
 
 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...
 
- 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 pmu
 
- Protected Attributes inherited from EGS_BaseSource
string description
 A short source description. More...
 
- 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 monitor unit index, mu, 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 1 = xiso(1) yiso(1) ziso(1) dsource(1) theta(1) phi(1) phicol(1) mu(1)
       control point 2 = xiso(2) yiso(2) ziso(2) dsource(2) theta(2) phi(2) phicol(2) mu(2)
       .
       .
       .
       control point N = xiso(N) yiso(N) ziso(N) dsource(N) theta(N) phi(N) phicol(N) mu(N)
    :stop motion:
:stop source:

Control points must be defined such that mu(i+1)>=mu(i), where mu(i) is the value of mu for control point i. The mu(i) are automatically normalized by mu(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 mu(i)<R<=mu(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)]/[mu(i+1)-mu(i)]*[R-mu(i)] Note that this scheme for generating incident source coordinates really only makes sense if mu(1)=0.0. However, the source can function with mu(1)>0.0, in the case where a user desires to eliminate particles associated with a range of mu 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 mu(2)-mu(1)=mu(4)-mu(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 1 = 0 0 0 100 0 0 0 0
            control point 2 = 0 0 0 100 360 0 0 0.5
            control point 3 = 0 0 0 100 90 0 0 0.5
            control point 4 = 0 0 0 100 90 360 0 1.0
        :stop motion:
    :stop source:

    simulation source = my_source

:stop source definition:

Definition at line 169 of file egs_dynamic_source.h.


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