44 regions(0), min_theta(0), max_theta(M_PI), min_phi(0), max_phi(2*M_PI),
45 nrs(0), gc(IncludeAll) {
46 vector<EGS_Float> pos;
54 int err = input->
getInput(
"shape name",sname);
56 egsWarning(
"EGS_IsotropicSource: missing/wrong inline shape "
57 "definition and missing wrong 'shape name' input\n");
65 int err = input->
getInput(
"geometry",geom_name);
68 if (!geom)
egsWarning(
"EGS_IsotropicSource: no geometry named %s\n",
71 vector<string> reg_options;
72 reg_options.push_back(
"IncludeAll");
73 reg_options.push_back(
"ExcludeAll");
74 reg_options.push_back(
"IncludeSelected");
75 reg_options.push_back(
"ExcludeSelected");
77 if (gc == IncludeSelected || gc == ExcludeSelected) {
79 err = input->
getInput(
"selected regions",regs);
80 if (err || regs.size() < 1) {
81 egsWarning(
"EGS_IsotropicSource: region selection %d used "
82 "but no 'selected regions' input found\n",gc);
83 gc = gc == IncludeSelected ? IncludeAll : ExcludeAll;
87 regions =
new int [nrs];
88 for (
int j=0; j<nrs; j++) {
95 err = input->
getInput(
"min theta", tmp_theta);
97 min_theta = tmp_theta/180.0*M_PI;
100 err = input->
getInput(
"max theta", tmp_theta);
102 max_theta = tmp_theta/180.0*M_PI;
105 err = input->
getInput(
"min phi", tmp_theta);
107 min_phi = tmp_theta/180.0*M_PI;
110 err = input->
getInput(
"max phi", tmp_theta);
112 max_phi = tmp_theta/180.0*M_PI;
115 buf_1 = cos(min_theta);
116 buf_2 = cos(max_theta);
121 void EGS_IsotropicSource::setUp() {
122 otype =
"EGS_IsotropicSource";
127 description =
"Isotropic source from a shape of type ";
155 createSourceTemplate<EGS_IsotropicSource>(input,f,
"isotropic source");
GeometryConfinement
Geometry confinement options.
static EGS_BaseShape * createShape(EGS_Input *inp)
Create a shape from the information pointed to by inp.
static EGS_BaseShape * getShape(const string &Name)
Get a pointer to the shape named Name.
EGS_IsotropicSource(int Q, EGS_BaseSpectrum *Spec, EGS_BaseShape *Shape, EGS_BaseGeometry *geometry, const string &Name="", EGS_ObjectFactory *f=0)
Constructor.
EGS_BaseSpectrum * s
The energy spectrum of this source.
static EGS_BaseGeometry * getGeometry(const string &Name)
Get a pointer to the geometry named Name.
Attempts to fix broken math header files.
int q
The charge of this simple source.
const string & getObjectType() const
Get the object type.
int ref()
Increase the reference count to this geometry.
EGS_Float min_phi
avoid multi-calculating cos(min_theta) and cos(max_theta)
const string & getType() const
Get the spectrum type.
EGS_BaseShape * shape
The shape from which particles are emitted.
string otype
The object type.
Base class for 'simple' particle sources.
Base source class. All particle sources must be derived from this class.
string description
A short source description.
EGS_InfoFunction EGS_EXPORT egsWarning
Always use this function for reporting warnings.