48 regions(0), min_theta(0), max_theta(M_PI), min_phi(0), max_phi(2*M_PI),
49 nrs(0), gc(IncludeAll), media(0), nms(0), gcm(IncludeSelected) {
50 vector<EGS_Float> pos;
58 int err = input->
getInput(
"shape name",sname);
60 egsWarning(
"EGS_IsotropicSource: missing/wrong inline shape "
61 "definition and missing wrong 'shape name' input\n");
69 int err = input->
getInput(
"geometry",geom_name);
72 if (!geom)
egsWarning(
"EGS_IsotropicSource: no geometry named %s\n",
76 vector<string> reg_options;
77 reg_options.push_back(
"IncludeAll");
78 reg_options.push_back(
"ExcludeAll");
79 reg_options.push_back(
"IncludeSelected");
80 reg_options.push_back(
"ExcludeSelected");
82 if (gc == IncludeSelected || gc == ExcludeSelected) {
84 err = input->
getInput(
"selected regions",regs);
85 if (err || regs.size() < 1) {
86 egsWarning(
"EGS_IsotropicSource: region selection %d used "
87 "but no 'selected regions' input found\n",gc);
88 gc = gc == IncludeSelected ? IncludeAll : ExcludeAll;
92 regions =
new int [nrs];
93 for (
int j=0; j<nrs; j++) {
100 if (gcm == IncludeSelected || gcm == ExcludeSelected) {
101 vector<string> selectedMedia;
102 err = input->
getInput(
"selected media",selectedMedia);
103 if (err || selectedMedia.size() < 1) {
104 egsWarning(
"EGS_IsotropicSource: medium selection %d used "
105 "but no 'selected media' input found\n",gcm);
107 nms = selectedMedia.size();
108 media =
new int [nms];
109 for (
int j=0; j<nms; j++) {
117 err = input->
getInput(
"min theta", tmp_theta);
119 min_theta = tmp_theta/180.0*M_PI;
122 err = input->
getInput(
"max theta", tmp_theta);
124 max_theta = tmp_theta/180.0*M_PI;
127 err = input->
getInput(
"min phi", tmp_theta);
129 min_phi = tmp_theta/180.0*M_PI;
132 err = input->
getInput(
"max phi", tmp_theta);
134 max_phi = tmp_theta/180.0*M_PI;
137 buf_1 = cos(min_theta);
138 buf_2 = cos(max_theta);
143 void EGS_IsotropicSource::setUp() {
144 otype =
"EGS_IsotropicSource";
149 description =
"Isotropic source from a shape of type ";
170 description +=
" Filtered by regions using option: " + std::to_string(gc);
174 description +=
" Filtered by media using option: " + std::to_string(gcm);
177 for (
auto i=0; i<nms; ++i) {
179 description +=
" " + mediumName +
"(" + std::to_string(media[i]) +
")";
182 description +=
"\n\n Regions are only included if they match both the region filter and the medium filter.";
195 createSourceTemplate<EGS_IsotropicSource>(input,f,
"isotropic source");
int ref()
Increase the reference count to this geometry.
static EGS_BaseGeometry * getGeometry(const string &Name)
Get a pointer to the geometry named Name.
static int getMediumIndex(const string &medname)
Get the index of a medium named medname.
static const char * getMediumName(int ind)
Get the name of medium with index ind.
static EGS_BaseShape * getShape(const string &Name)
Get a pointer to the shape named Name.
static EGS_BaseShape * createShape(EGS_Input *inp)
Create a shape from the information pointed to by inp.
Base class for 'simple' particle sources.
int q
The charge of this simple source.
EGS_BaseSpectrum * s
The energy spectrum of this source.
Base source class. All particle sources must be derived from this class.
string description
A short source description.
const string & getType() const
Get the spectrum type.
EGS_BaseShape * shape
The shape from which particles are emitted.
EGS_IsotropicSource(int Q, EGS_BaseSpectrum *Spec, EGS_BaseShape *Shape, EGS_BaseGeometry *geometry, const string &Name="", EGS_ObjectFactory *f=0)
Constructor.
GeometryConfinement
Geometry confinement options.
EGS_Float min_phi
avoid multi-calculating cos(min_theta) and cos(max_theta)
string otype
The object type.
const string & getObjectType() const
Get the object type.
Attempts to fix broken math header files.
EGS_InfoFunction EGS_EXPORT egsWarning
Always use this function for reporting warnings.