EGS Brachy
An egs++ user code for rapid brachytherapy calculations
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
BaseSpectrumScorer Class Referenceabstract

abstract base class for scoring spectrum information More...

#include <spec_scoring.h>

Inheritance diagram for BaseSpectrumScorer:
Inheritance graph
[legend]
Collaboration diagram for BaseSpectrumScorer:
Collaboration graph
[legend]

Public Member Functions

 BaseSpectrumScorer (EGS_Input *input, EGS_BaseSource *src, GeomInfo *ginfo, Publisher *publisher)
 
virtual ~BaseSpectrumScorer ()
 
EGS_Float getBinWidth () const
 
double getParticleEnergy (const EGS_Particle *p) const
 
virtual void update (EB_Message message, void *data=0)
 Receives messages from application. This method handles NEW_HISTORY messages but delegates all other messages to the score methods of the derived classes.
 
virtual void score (EB_Message message, void *data=0)=0
 
void setEffectiveHistories (EGS_Float effective_histories)
 
int outputResults (string root_name)
 , write the scored spectrum to file with filename. Returns 0 on success, all other values indicate a failure
 
virtual string getInfo () const
 
bool isValid () const
 
int outputData (ostream *ofile)
 
int readData (istream *ifile)
 
void resetCounter ()
 
int addState (istream &data)
 
- Public Member Functions inherited from Subscriber
virtual ~Subscriber ()
 

Static Public Member Functions

static BaseSpectrumScorergetSpectrumScorer (EGS_Input *inp, EGS_BaseSource *source, GeomInfo *ginfo, Publisher *publisher)
 factory method for creating one of the derived spectrum scoring classes
 

Public Attributes

int nbins
 number of bins to score spectrum in
 
EGS_ScoringArray * bins
 spectrum scoring array
 
EGS_Float e_min
 minimum spectrum energy to score
 
EGS_Float e_max
 maximum spectrum energy to score
 

Static Public Attributes

static const int DEFAULT_NBINS = 100
 

Protected Member Functions

string outputCSV (string filename)
 output results to csv file
 
string outputXMGR (string filename)
 output results to xmgrace file
 
string outputEGSnrc (string filename)
 output results to EGSnrc tabulated spectrum format
 
int getBin (EGS_Float E) const
 get index of bin that that E falls in
 
virtual string getTitle () const
 
virtual string getSubTitle () const
 
virtual string getYAxisLabel () const
 
virtual string getXAxisLabel () const
 
string getFileName (string root) const
 
virtual string getFileExtension () const
 
virtual void getResult (int bin, EGS_Float &r, EGS_Float &dr)
 set r & dr to result/uncertainty for given bin. Normalization can be done in this routine
 
string getParticleName () const
 Return name of particle we are scoring.
 
virtual void outputTotal ()
 

Protected Attributes

string format
 
int egsnrc_mode
 
int particle_type
 
EGS_I64 cur_history
 
EGS_I64 eff_history
 
EGS_Float bin_width
 
EGS_Float total_scored
 
EGS_BaseSource * source
 
bool valid
 
string fextension
 

Detailed Description

abstract base class for scoring spectrum information

Inputs:

 type               - determines which derived class to initialize ('surface count',
                      'energy weighted surface', 'energy fluence in region')
 particle type      - which kind of particle to score
 minimum energy     - don't score any particles below this energy (defaults to 0.001 MeV)
 maximum energy     - don't score any particles above this energy (defaults to source->getEmax())
 number of bins     - number of scoring bins to use (bin width =  (E_max - E_min) / nbins
 output format      - xmgr, csv, or egsnrc (defaults to xmgr)
 egsnrc format mode - if esgnrc output format is chosen, which mode to use (see egs++ docs)

 geometry           - for 'energy fluence in region' mode  used in conjunction with 'scoring region'
                      input for determining which geometry region to score the spectrum in
 scoring region     - for 'energy fluence in region' mode  used in conjunction with 'geometry'
                      input for determining which geometry region to score the spectrum in
 file extension - if provided the output will be written to
                  sim_input_file.{file extension}.{output format} otherwise the output
                  file will be given a name like sim_input_file.surfcount.agr

Sample input:

:start spectrum scoring:
    type = surface count # surface count, energy weighted surface, energy fluence in region
    particle type = photon # photon, electron, positron
    minimum energy = 0.001
    maximum energy = 1.00
    number of bins = 1000
    output format = xmgr # xmgr (default), csv, egsnrc
    file extension = my_spectrum # (optional)
:stop spectrum scoring:

Definition at line 260 of file spec_scoring.h.

Constructor & Destructor Documentation

◆ BaseSpectrumScorer()

BaseSpectrumScorer::BaseSpectrumScorer ( EGS_Input *  input,
EGS_BaseSource *  src,
GeomInfo ginfo,
Publisher publisher 
)

Definition at line 115 of file spec_scoring.cpp.

◆ ~BaseSpectrumScorer()

BaseSpectrumScorer::~BaseSpectrumScorer ( )
virtual

Definition at line 188 of file spec_scoring.cpp.

Member Function Documentation

◆ addState()

int BaseSpectrumScorer::addState ( istream &  data)

Definition at line 416 of file spec_scoring.cpp.

◆ getBin()

int BaseSpectrumScorer::getBin ( EGS_Float  E) const
protected

get index of bin that that E falls in

Definition at line 198 of file spec_scoring.cpp.

◆ getBinWidth()

EGS_Float BaseSpectrumScorer::getBinWidth ( ) const

Definition at line 203 of file spec_scoring.cpp.

◆ getFileExtension()

virtual string BaseSpectrumScorer::getFileExtension ( ) const
inlineprotectedvirtual

◆ getFileName()

string BaseSpectrumScorer::getFileName ( string  root) const
inlineprotected

Definition at line 308 of file spec_scoring.h.

◆ getInfo()

virtual string BaseSpectrumScorer::getInfo ( ) const
inlinevirtual

Definition at line 376 of file spec_scoring.h.

◆ getParticleEnergy()

double BaseSpectrumScorer::getParticleEnergy ( const EGS_Particle *  p) const

Definition at line 207 of file spec_scoring.cpp.

◆ getParticleName()

string BaseSpectrumScorer::getParticleName ( ) const
inlineprotected

Return name of particle we are scoring.

Definition at line 321 of file spec_scoring.h.

◆ getResult()

void BaseSpectrumScorer::getResult ( int  bin,
EGS_Float &  r,
EGS_Float &  dr 
)
protectedvirtual

set r & dr to result/uncertainty for given bin. Normalization can be done in this routine

Reimplemented in SurfaceCountSpectrum, EnergyWeightedSurfaceSpectrum, FluenceSpectrumInVoxel, and EnergyFluenceSpectrumInVoxel.

Definition at line 377 of file spec_scoring.cpp.

◆ getSpectrumScorer()

BaseSpectrumScorer * BaseSpectrumScorer::getSpectrumScorer ( EGS_Input *  inp,
EGS_BaseSource *  source,
GeomInfo ginfo,
Publisher publisher 
)
static

factory method for creating one of the derived spectrum scoring classes

Definition at line 85 of file spec_scoring.cpp.

◆ getSubTitle()

virtual string BaseSpectrumScorer::getSubTitle ( ) const
inlineprotectedvirtual

Reimplemented in SurfaceCountSpectrum, and EnergyWeightedSurfaceSpectrum.

Definition at line 296 of file spec_scoring.h.

◆ getTitle()

virtual string BaseSpectrumScorer::getTitle ( ) const
inlineprotectedvirtual

◆ getXAxisLabel()

virtual string BaseSpectrumScorer::getXAxisLabel ( ) const
inlineprotectedvirtual

Definition at line 304 of file spec_scoring.h.

◆ getYAxisLabel()

virtual string BaseSpectrumScorer::getYAxisLabel ( ) const
inlineprotectedvirtual

◆ isValid()

bool BaseSpectrumScorer::isValid ( ) const
inline

returns true if scorer was initialized correctly, otherwise false

Definition at line 381 of file spec_scoring.h.

◆ outputCSV()

string BaseSpectrumScorer::outputCSV ( string  filename)
protected

output results to csv file

Definition at line 240 of file spec_scoring.cpp.

◆ outputData()

int BaseSpectrumScorer::outputData ( ostream *  ofile)

Definition at line 381 of file spec_scoring.cpp.

◆ outputEGSnrc()

string BaseSpectrumScorer::outputEGSnrc ( string  filename)
protected

output results to EGSnrc tabulated spectrum format

Definition at line 256 of file spec_scoring.cpp.

◆ outputResults()

int BaseSpectrumScorer::outputResults ( string  root_name)

, write the scored spectrum to file with filename. Returns 0 on success, all other values indicate a failure

Definition at line 212 of file spec_scoring.cpp.

◆ outputTotal()

virtual void BaseSpectrumScorer::outputTotal ( )
inlineprotectedvirtual

◆ outputXMGR()

string BaseSpectrumScorer::outputXMGR ( string  filename)
protected

output results to xmgrace file

Definition at line 309 of file spec_scoring.cpp.

◆ readData()

int BaseSpectrumScorer::readData ( istream *  ifile)

Definition at line 394 of file spec_scoring.cpp.

◆ resetCounter()

void BaseSpectrumScorer::resetCounter ( )

Definition at line 407 of file spec_scoring.cpp.

◆ score()

virtual void BaseSpectrumScorer::score ( EB_Message  message,
void *  data = 0 
)
pure virtual

override in derived classes to do scoring

Implemented in SurfaceCountSpectrum, EnergyWeightedSurfaceSpectrum, FluenceSpectrumInVoxel, and EnergyFluenceSpectrumInVoxel.

◆ setEffectiveHistories()

void BaseSpectrumScorer::setEffectiveHistories ( EGS_Float  effective_histories)

Definition at line 194 of file spec_scoring.cpp.

◆ update()

void BaseSpectrumScorer::update ( EB_Message  message,
void *  data = 0 
)
virtual

Receives messages from application. This method handles NEW_HISTORY messages but delegates all other messages to the score methods of the derived classes.

Implements Subscriber.

Definition at line 366 of file spec_scoring.cpp.

Member Data Documentation

◆ bin_width

EGS_Float BaseSpectrumScorer::bin_width
protected

Definition at line 270 of file spec_scoring.h.

◆ bins

EGS_ScoringArray* BaseSpectrumScorer::bins

spectrum scoring array

Definition at line 345 of file spec_scoring.h.

◆ cur_history

EGS_I64 BaseSpectrumScorer::cur_history
protected

keep track of the current history we are on

Definition at line 267 of file spec_scoring.h.

◆ DEFAULT_NBINS

const int BaseSpectrumScorer::DEFAULT_NBINS = 100
static

Definition at line 341 of file spec_scoring.h.

◆ e_max

EGS_Float BaseSpectrumScorer::e_max

maximum spectrum energy to score

Definition at line 347 of file spec_scoring.h.

◆ e_min

EGS_Float BaseSpectrumScorer::e_min

minimum spectrum energy to score

Definition at line 346 of file spec_scoring.h.

◆ eff_history

EGS_I64 BaseSpectrumScorer::eff_history
protected

effective histories (for normalization)

Definition at line 268 of file spec_scoring.h.

◆ egsnrc_mode

int BaseSpectrumScorer::egsnrc_mode
protected

egsnrc spectrum output format mode

Definition at line 265 of file spec_scoring.h.

◆ fextension

string BaseSpectrumScorer::fextension
protected

file extension to use

Definition at line 277 of file spec_scoring.h.

◆ format

string BaseSpectrumScorer::format
protected

format to output results in

Definition at line 264 of file spec_scoring.h.

◆ nbins

int BaseSpectrumScorer::nbins

number of bins to score spectrum in

Definition at line 344 of file spec_scoring.h.

◆ particle_type

int BaseSpectrumScorer::particle_type
protected

What kind of particle are we interested in

Definition at line 266 of file spec_scoring.h.

◆ source

EGS_BaseSource* BaseSpectrumScorer::source
protected

simulation source, used for limits on energy, normalization etc

Definition at line 273 of file spec_scoring.h.

◆ total_scored

EGS_Float BaseSpectrumScorer::total_scored
protected

Definition at line 271 of file spec_scoring.h.

◆ valid

bool BaseSpectrumScorer::valid
protected

Definition at line 275 of file spec_scoring.h.


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