41 static bool EGS_ANGULAR_SPREAD_SOURCE_LOCAL inputSet =
false;
44 static const EGS_Float FWHM_TO_SIGMA = 0.4246609001440095285;
46 EGS_AngularSpreadSource::EGS_AngularSpreadSource(
EGS_Input *input,
55 int err = input->
getInput(
"source name",sname);
57 egsWarning(
"EGS_AngularSpreadSource: missing/wrong inline source "
58 "definition and missing wrong 'source name' input\n");
61 if (!source)
egsWarning(
"EGS_AngularSpreadSource: a source named %s"
62 " does not exist\n", sname.c_str());
67 int err_fwhm = input->
getInput(
"fwhm",fwhm);
68 int err_sigma = input->
getInput(
"sigma",sigma);
70 if (!err_fwhm && !err_sigma) {
71 egsFatal(
"EGS_AngularSpreadSource: both 'sigma' and 'fwhm' inputs "
72 "provided. Please use only one.\n");
76 egsFatal(
"EGS_AngularSpreadSource: 'fwhm' must be positive, "
80 sigma = FWHM_TO_SIGMA * fwhm;
84 else if (!err_sigma) {
86 egsFatal(
"EGS_AngularSpreadSource: negative 'sigma' input is no "
87 "longer supported. To specify the angular spread as FWHM, "
88 "use the 'fwhm' input key instead.\n");
97 void EGS_AngularSpreadSource::setUp() {
98 otype =
"EGS_AngularSpreadSource";
110 static void setInputs() {
113 setBaseSourceInputs(
false,
false);
115 srcBlockInput->getSingleInput(
"library")->setValues({
"egs_angular_spread_source"});
118 srcBlockInput->addSingleInput(
"source name",
true,
"The name of a previously defined source.");
119 srcBlockInput->addSingleInput(
"sigma",
false,
"If positive, it is the sigma of the Gaussian distribution in degrees. If negative, it is the FWHM of the distribution.");
122 EGS_ANGULAR_SPREAD_SOURCE_EXPORT
string getExample() {
126 # Example of egs_angular_spread_source
128 library = egs_angular_spread_source
131 source name = my_parallel_source
132 #create source called my_parallel_source
138 EGS_ANGULAR_SPREAD_SOURCE_EXPORT shared_ptr<EGS_BlockInput> getInputs() {
142 return srcBlockInput;
148 createSourceTemplate<EGS_AngularSpreadSource>(input,f,
"angular spread source");
EGS_BaseSource * source
The source being transformed.
Base source class. All particle sources must be derived from this class.
const char * getSourceDescription() const
Get a short description of this source.
static EGS_BaseSource * getSource(const string &Name)
Get a pointer to the source named Name.
string description
A short source description.
static EGS_BaseSource * createSource(EGS_Input *)
Create sources from the information pointed to by input.
int ref()
Increase the reference count to this object.
string otype
The object type.
An angular spread source: header.
Attempts to fix broken math header files.
EGS_InfoFunction EGS_EXPORT egsFatal
Always use this function for reporting fatal errors.
EGS_InfoFunction EGS_EXPORT egsWarning
Always use this function for reporting warnings.