54#include "egs_advanced_application.h"
55#include "egs_functions.h"
57#include "egs_interface2.h"
58#include "egs_interpolator.h"
59#include "egs_alias_table.h"
61#include "egs_run_control.h"
62#include "egs_scoring.h"
63#include "egs_transformations.h"
64#include "egs_autoenvelope/egs_autoenvelope.h"
65#include "egs_rz/egs_rz.h"
66#include "egs_spheres/egs_spheres.h"
81#define PRINT_PARTICLE(P) cout << "\nParticle in reg "<<P.ir << " at "<<P.x.x << " "<<P.x.y<<" "<<P.x.z << " wt "<<P.wt<< " E "<<P.E << " q "<<P.q << " latch "<<P.latch<<"\n";
82#define PRINT_PARTICLE_WITH_DIR(P) cout << "\nParticle in reg "<<P.ir << " at "<<P.x.x << " "<<P.x.y<<" "<<P.x.z << " dir "<<P.u.x << " "<<P.u.y<<" "<<P.u.z << " wt "<<P.wt<< " E "<<P.E << " q "<<P.q << " latch "<<P.latch<<"\n";
83#define NUM_STUCK_STEPS 1000
84#define SAME_POSITION_TOLERANCE 1E-10
85#define EB_EPSILON 1E-10
272 EGS_AdvancedApplication(argc,argv),
297 for (
int i=-1; i < 2; i++) {
310 for (vector<EB_Phantom>::size_type pp=0; pp <
phantom_geoms.size(); pp++) {
315 map<int, EGS_Interpolator *>::iterator mit =
media_muen.begin();
322 for (vector<EGS_AffineTransform *>::size_type st=0; st <
source_transforms.size(); st++) {
483 int howManyJobsDone();
487 void addRecycledParticlesToStack(EGS_Particle *p,
bool new_hist=
false);
488 void copyParticleToSourceLoc(EGS_Particle *p,
int source,
bool kill_orig,
bool rotate, EGS_Float new_wt);
490 void doPhotonSplitting(
int);
497 int simulateSingleShower();
498 int startNewShower();
514 int initSourceTransforms();
519 vector<EGS_AffineTransform *> createTransforms(EGS_Input *input);
The main egs_brachy application class. See the Main Page for full documentation.
vector< BaseSpectrumScorer * > spectrum_scorers
map< string, vector< EGS_Float > > extra_scoring_mass
int initRunControl()
egs_brachy specific run control initialization
void initPHSPScoring(EGS_Input *)
set up phsp scoring
int checkSourceOverlaps(EGS_Input *)
EnergyScoringStats * escoring
Energy related scoring/stats.
int initSimulation()
set the run mode and then call EGS_AdvancedApplication::initSimulation
void initEDepScoring(EGS_Input *)
energy deposition scoring initialization
int outputData()
Output intermediate results. The egs_brachy version outputs the standard egs++ data along with egs_br...
vector< EGS_AffineTransform * > source_transforms
transforms to locations of all sources
map< string, vector< int > > extra_scoring_reg
void initDoseScaling(EGS_Input *)
Initialize dose scaling factor if requested.
map< int, EGS_I64 > steps_in_phantoms
int outputDataHelper(ostream *)
helper function for outputData
EB_TimingTree timing_blocks
Track CPU times of various functions.
int initRussianRoulette(EGS_Input *)
Initialize Russian roulette variance reduction if requested.
map< string, EGS_ScoringArray * > extra_scoring_doses
string output_volcor_format
text or gzip
int createPhantoms()
set up Phantom objects for any geometries that user has requested scoring for
Publisher pevent_pub
Particle event publisher.
virtual void startNewParticle()
Set source ecut/pcut if different from global ecut/pcut.
void describeUserCode() const
Print information about the egs_brachy user code.
int initRunMode()
Get run mode from the input file.
void describeSimulation()
Describe the simulation.
void enableAusgabCalls(int ncalls, AusgabCall calls[])
enable an array of ausgab calls
void initAusgabCalls()
setup any required ausgab calls
void initMuenData(EGS_Input *)
load muen data for requested media
string output_egsdat_format
text or gzip
vector< string > output_volcor_phantoms
vector of phantom names to output volume correctino files for
string output_voxinfo_format
text or gzip
igzstream * gz_data_in
GZip file for outputing egsdat.
EGS_Float global_e_max_rr
max range rejection energy globally
EB_Application(int argc, char **argv)
egs_brachy constructor
int egsAdvApplicationOutputData(ostream *)
helper function for outputData
void discardTopParticle(int idisc=1)
int gcr_phantom_reg
region of phantom to use for getCurrentResult (default to 0)
EGS_Float effective_histories
int initBCSE(EGS_Input *)
Initialize BCSE variance reduction if requested.
bool source_i_do_rr
enable range rejection in sources
bool output_egsphant
true if user requests egsphant ouput
void printIncludedFiles()
bool global_i_do_rr
enable range rejection outside of sources
EGS_Float source_pcut
pcut for source objects
int egsBrachyReadData(istream *)
helper function for outputData
void initTrackLengthScoring(EGS_Input *)
track length scoring initialization
static string revision
the usercode revision number
EGS_Float global_pcut
pcut for source objects
void getCurrentResult(double &sum, double &sum2, double &norm, double &count)
Reports the current results for this batch of the simulation.
int correctVolumes()
run the volume correction routines
bool output_3ddose_files
false if run mode is 'volume correction only'
void initSpectrumScoring(EGS_Input *)
Initialize all spectrum scoring objects.
map< string, EGS_ScoringArray * > extra_scoring_doses_edep
EB_Phantom * gcr_phantom
phantom object to use in getCurrentResult (defaults to 1st phantom)
EB_Phantom * getPhantomByName(string name)
takes a phantom geometry name and returns the EB_Phantom object
static const EGS_Float DEFAULT_BCSE_FACTOR
map< string, string > media_muen_names
~EB_Application()
egs_brachy destructor
int readDataHelper(istream *)
helper function for outputData
void initScatScoring(EGS_Input *)
energy deposition scoring initialization
EGS_ASwitchedEnvelope * superpos_geom
an ASwitchedEnv cast of simulation geometry.
string output_dose_format
text or gzip
vector< EGS_Float > source_weights
virtual void enterNewRegion()
map< string, vector< EGS_Float > > extra_scoring_vols
void resetCounter()
Reset the application to a 'pristine' state. Adapted from egs_application.cpp to allow combining in t...
EGS_AffineTransform * base_transform
same as source_transforms[0]
EGS_BaseGeometry * source_envelope_geom
geometry that the sources are embedded in
vector< EB_Phantom * > phantom_geoms
pointers to all of the phantom objects
void calcEffectiveHistories()
bool score_scat
true when scatter scoring is enabled
string output_egsphant_format
text or gzip
int egsBrachyOutputData(ostream *)
helper function for outputData
ogzstream * gz_data_out
GZip file for outputing egsdat.
int nbr_split
Number of times to split bremstrahlung phtons.
map< int, EGS_Interpolator * > media_muen
Map from medium index to muen interpolator for that medium.
ebvolcor::Results gen_vc_results
results from general volume correction
EGS_AffineTransform * base_transform_inv
same as source_transforms[0].inverse()
map< int, EGS_I64 > steps_in_sources
bool output_voxinfo
true if user requests voxel info file
bool applied_source_coord_transform
true if a source coordinate transform was composed in
map< int, EGS_I64 > steps_in_other
int ausgab(int iarg)
user scoring of dose, spectra etc
int readData()
Read data required for restarting simulations.
int egsApplicationReadData(istream *)
helper function for outputData
int nsources
total number of particle sources in current simulation
EGS_Float flu_cutoff
fluorescent photon cutoff energy
@ RM_VC_ONLY
Run volume correction routines then quit.
@ RM_SUPERPOSITION
Superposition mode for intersource effects.
@ RM_NORMAL
Standard running mode.
int egsAdvApplicationReadData(istream *)
helper function for outputData
int egsApplicationOutputData(ostream *)
helper function for outputData
GeomInfo ginfo
meta data about the geometries
void clearAusgabCalls()
disable all ausgab calls
ebvolcor::Results source_vc_results
results from source volume correctio box phantom
void initXCCScaling(EGS_Input *)
Initialize cross section scaling if requested.
EGS_Float source_ecut
ecut for source objects
bool score_edep
true when energy deposition is enabled
void initGCRScoring(EGS_Input *)
setup which phantom/region will be used for getCurrentResult
EGS_Float source_e_max_rr
max range rejection energy for source objects
int initScoring()
initialze all scoring and variance reduction parameters
int addState(istream &data)
Add data from a parallel job. Add standard egs++ data as well as egs_brachy specific scoring informat...
EGS_Float global_ecut
ecut for source objects
void initOutputFiles(EGS_Input *)
set up whether to output extra info files
int initVarianceReduction()
initialze all variance reduction parameters
vector< EGS_Vector > p_init_locs
bool score_tlen
true when tracklength estimator is enabled
string getOutputVolcorFormat()
RunMode run_mode
Which run mode are we using (RM_NORMAL, RM_SUPERPOSITION or RM_VC_ONLY */.
RecycleOpts * recycle_opts
int record_n_init
if > 0 write initial pos of record_n_init particles to {input_file}.pinit
ebvolcor::FileResults file_vc_results
results from precomputed volume correction
virtual int runSimulation()
A class to represent a single phantom for scoring dose in egs_brachy.
a class to use for scoring information about total energy initialzed, escaping sources etc
a container for organizing meta data about the geometries
A class for handling latch bits relevant to egs_brachy. The Latch class listens for particle events a...
Volume correction routines for egs_brachy.
ginfo contains classes for organizing information about the geometries present in an egs_brachy simul...
handle particles latch bits for egs_brachy
Functions for loading muen data from a file.
Header file for phantom objects.
Definition of the PHSPControl object.
A simple pub/sub module to allow various egs_brachy classes to subscribe to particle events.
@ PARTICLE_ESCAPING_SOURCE
@ PARTICLE_ESCAPED_SOURCE
class definitions for recycling
Definition of spectrum scoring classes.
Struct used to collect and output results about a volume correction run.