EGS Brachy
An egs++ user code for rapid brachytherapy calculations
Loading...
Searching...
No Matches
/Users/marc/Developer/EGSnrc/HEN_HOUSE/user_codes/egs_brachy/egs_brachy/phsp.h
Go to the documentation of this file.
1/*
2################################################################################
3#
4# egs_brachy phsp.h
5# Copyright (C) 2016 Rowan Thomson, Dave Rogers, Randle Taylor, and Marc
6# Chamberland
7#
8# This file is part of egs_brachy
9#
10# egs_brachy is free software: you can redistribute it and/or modify it
11# under the terms of the GNU Affero General Public License as published
12# by the Free Software Foundation, either version 3 of the License, or
13# (at your option) any later version.
14#
15# egs_brachy is distributed in the hope that it will be useful, but
16# WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18# Affero General Public License for more details:
19# <http://www.gnu.org/licenses/>.
20#
21################################################################################
22#
23# When egs_brachy is used for publications, please cite our paper:
24# M. J. P. Chamberland, R. E. P. Taylor, D. W. O. Rogers, and R. M. Thomson,
25# egs brachy: a versatile and fast Monte Carlo code for brachytherapy,
26# Phys. Med. Biol. 61, 8214-8231 (2016).
27#
28################################################################################
29#
30# Author: Randle Taylor, 2016
31#
32# Contributors: Marc Chamberland
33# Dave Rogers
34# Rowan Thomson
35#
36################################################################################
37*/
38
44#include "egs_functions.h"
45#include "egs_input.h"
46#include "egs_advanced_application.h"
47#include "egs_transformations.h"
48#include "pubsub.h"
49#include "iaea_phsp.h"
50
51class PHSPControl : public Subscriber {
52
53 enum ACCESS {
54 READ = 1,
55 WRITE = 2,
56 APPEND = 3
57 };
58
67
68 IAEA_I32 mode;
69 string fname;
70 IAEA_I32 id;
71
72 IAEA_I64 num_written;
73
74
75 EGS_AffineTransform *transform;
78 EGS_Float boundary_step;
83
85
87 void initSource();
88
90 void writeParticle(EGS_Particle *p);
91
92
94 short getIAEAParticleType(const EGS_Particle *p);
95
96
97
98public:
99
101 PHSPControl(EGS_Input *inp, EGS_AffineTransform *trans, EGS_AdvancedApplication *app, Publisher *pub);
102
104 void finish(EGS_I64 n_orig_particles);
105
107 void destroySource();
108
109
111 void outputResults();
112
114 void update(EB_Message message, void *particle);
115
116};
117
bool kill_after_scoring
Set wt = 0 for particle after scoring if true.
Definition phsp.h:82
void initSource()
create/open new source and set extra numbers
Definition phsp.cpp:163
@ READ
IAEA Read mode.
Definition phsp.h:54
@ APPEND
IAEA Append mode.
Definition phsp.h:56
@ WRITE
IAEA Write mode.
Definition phsp.h:55
EGS_AffineTransform * transform
Definition phsp.h:75
void outputResults()
output file name and number of particles written
Definition phsp.cpp:199
void finish(EGS_I64 n_orig_particles)
set final number of particles written and destroy source
Definition phsp.cpp:193
void update(EB_Message message, void *particle)
receive PARTICLE_ESCAPED_SOURCE message
Definition phsp.cpp:185
void writeParticle(EGS_Particle *p)
write a single particle to the phsp
Definition phsp.cpp:117
IAEA_I32 mode
Access mode.
Definition phsp.h:68
IAEA_I32 id
IAEA Source ID (just set to 1 currently)
Definition phsp.h:70
bool print_header
User has requested the phsp header gets printed after run.
Definition phsp.h:84
short getIAEAParticleType(const EGS_Particle *p)
convert a particle to its IAEA Particle type
Definition phsp.cpp:103
PARTICLE_TYPE
Definition phsp.h:59
@ PROTON
Definition phsp.h:65
@ ALL_TYPES
Definition phsp.h:60
@ PHOTON
Definition phsp.h:61
@ NEUTRON
Definition phsp.h:64
@ ELECTRON
Definition phsp.h:62
@ POSITRON
Definition phsp.h:63
void destroySource()
destroy the source
Definition phsp.cpp:221
string fname
root name of phsp header
Definition phsp.h:69
IAEA_I64 num_written
Number of particles written to phsp file.
Definition phsp.h:72
EGS_Float boundary_step
Definition phsp.h:78
A simple pub/sub module to allow various egs_brachy classes to subscribe to particle events.
EB_Message
Definition pubsub.h:54