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

A collimated particle source. More...

#include <egs_collimated_source.h>

Inheritance diagram for EGS_CollimatedSource:
EGS_BaseSimpleSource EGS_BaseSource EGS_Object

Public Member Functions

 EGS_CollimatedSource (int Q, EGS_BaseSpectrum *Spec, EGS_BaseShape *sshape, EGS_BaseShape *tshape, const string &Name="", EGS_ObjectFactory *f=0)
 EGS_CollimatedSource (EGS_Input *, EGS_ObjectFactory *f=0)
void getPositionDirection (EGS_RandomGenerator *rndm, EGS_Vector &x, EGS_Vector &u, EGS_Float &wt)
EGS_Float getFluence () const
bool storeFluenceState (ostream &data) const
bool setFluenceState (istream &data)
bool addFluenceData (istream &data)
bool isValid () const
void resetFluenceCounter ()
- Public Member Functions inherited from EGS_BaseSimpleSource
 EGS_BaseSimpleSource (int Q, EGS_BaseSpectrum *Spec, const string &Name="", EGS_ObjectFactory *f=0)
 Constructor. More...
 EGS_BaseSimpleSource (EGS_Input *input, EGS_ObjectFactory *f=0)
 Construct a 'simple' particle source from the information pointed to by input. More...
 ~EGS_BaseSimpleSource ()
 Destructor. More...
virtual EGS_I64 getNextParticle (EGS_RandomGenerator *rndm, int &Q, int &latch, EGS_Float &E, EGS_Float &wt, EGS_Vector &x, EGS_Vector &u)
 Sample the next source particle from the source probability distribution. More...
virtual EGS_Float getEmax () const
 Get the maximum energy of the source. More...
virtual int getCharge () const
 Get the charge of the source. More...
virtual bool storeState (ostream &data_out) const
 Store the source state to the data stream data_out. More...
virtual bool addState (istream &data)
 Add the source state from the stream data to the current state. More...
virtual void resetCounter ()
 Reset the source to a state with zero sampled particles. More...
virtual bool setState (istream &data)
 Set the source state according to the data in the stream data. More...
- 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 void setSimulationChunk (EGS_I64 nstart, EGS_I64 nrun)
 Set the next simulation chunk to start at nstart and to consist of nrun particles. More...
virtual EGS_Float getMu ()
- 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

void setUp ()
- Protected Member Functions inherited from EGS_BaseSimpleSource
virtual void setLatch (int &latch)

Protected Attributes

 the source shape
 the target shape
EGS_I64 ctry
 number of attempts to sample a particle
EGS_Float dist
 source-target shape min. distance
- Protected Attributes inherited from EGS_BaseSimpleSource
int q
 The charge of this simple source.
 The energy spectrum of this source.
string type
 A short description of the source type.
EGS_I64 count
 Number of statistically independent particles delivered so far.
- 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.
 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 collimated particle source.

A collimated source is an isotropic source collimated in such a way as to irradiate only a certain area or solid angle. The particle positions $\vec{x}$ for this source are picked from any shape (the source shape). The particle directions are determined by picking a position $\vec{x}'$ from another shape (the target shape) and setting the direction to be $\vec{u}=(\vec{x}'-\vec{x})/|\vec{x}'-\vec{x}|$. In order to get a proper isotropic source collimated to the area of the target shape, the statistical weight of the particles must be adjusted accordingly (basically set to the scalar product of the surface normal and $\vec{x}'-\vec{x}$ divided by the distance between $\vec{x}'$ and $\vec{x}$ to the third power and multiplied by the surface area from which points $\vec{x}'$ are being picked). This is done in a special method of the target shape called getPointSourceDirection() . Not all shapes support this method. The shapes that support this method and can therefore be used as a target shape in a collimated source are boxes, spheres, cylinders, circles, ellipses, rectangles or "rectangular rings", polygons and triangles .

The fluence calculated by getFluence() is determined as $N/d^2$, where N is the number of source particles and d is provided by the user as distance, the minimum distance between the source and target shapes. This accounts for the solid angle within which particles are generated. If distance is not provided, it defaults to 1, which will likely be an incorrect normalization.

A collimated source is defined as follows:

:start source:
    library = egs_collimated_source
    name = some_name
    :start source shape:
        definition of the source shape
    :stop source shape:
    :start target shape:
        definition of the target shape
    :stop target shape:
    :start spectrum:
        definition of the spectrum
    :stop spectrum:
    distance = source-target shape min. distance
    charge = -1 or 0 or 1 for electrons or photons or positrons
:stop source:

It is worth noting that the functionality of sources 1, 11, 12, 14, 15 and 16 from the RZ series of user codes and source 3 in DOSXYZnrc can be reproduced with the collimated source from the EGSnrc C++ class library.

A simple example:

:start source definition:
    :start source:
        library = egs_collimated_source
        name = my_source
        :start source shape:
            type = point
            position = 0 0 5
        :stop source shape:
        :start target shape:
            library   = egs_rectangle
            rectangle = -1 -1 1 1
        :stop target shape:
        distance = 5
        charge = -1
        :start spectrum:
            type = monoenergetic
            energy = 20
        :stop spectrum:
    :stop source:

    simulation source = my_source

:stop source definition:
A simple example

Definition at line 159 of file egs_collimated_source.h.

Constructor & Destructor Documentation

EGS_CollimatedSource::EGS_CollimatedSource ( int  Q,
EGS_BaseSpectrum Spec,
EGS_BaseShape sshape,
EGS_BaseShape tshape,
const string &  Name = "",
EGS_ObjectFactory f = 0 

Construct a collimated source with charge Q, spectrum Spec, source shape sshape and target shape tshape.

Definition at line 169 of file egs_collimated_source.h.

EGS_CollimatedSource::EGS_CollimatedSource ( EGS_Input input,
EGS_ObjectFactory f = 0 

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