45 static bool EGS_FANO_SOURCE_LOCAL inputSet =
false;
50 regions(0), nrs(0), min_theta(0), max_theta(M_PI), min_phi(0), max_phi(2*M_PI),
51 max_mass_density(0.0) {
53 vector<EGS_Float> pos;
56 egsWarning(
"EGS_FanoSource: trying to construct the shape\n");
62 int err = input->
getInput(
"shape name",sname);
64 egsWarning(
"EGS_FanoSource: missing/wrong inline shape "
65 "definition and missing wrong 'shape name' input\n");
73 int err = input->
getInput(
"geometry",geom_name);
76 if (!geom)
egsFatal(
"EGS_FanoSource: no geometry named %s in input file!\n",
79 int errF = input->
getInput(
"max mass density", max_mass_density);
81 egsFatal(
"EGS_FanoSource: A Fano source requires a maximum density input.\n");
86 egsFatal(
"EGS_FanoSource: A Fano source requires a valid geometry name.\n");
90 err = input->
getInput(
"min theta", tmp_theta);
92 min_theta = tmp_theta/180.0*M_PI;
95 err = input->
getInput(
"max theta", tmp_theta);
97 max_theta = tmp_theta/180.0*M_PI;
100 err = input->
getInput(
"min phi", tmp_theta);
102 min_phi = tmp_theta/180.0*M_PI;
105 err = input->
getInput(
"max phi", tmp_theta);
107 max_phi = tmp_theta/180.0*M_PI;
110 buf_1 = cos(min_theta);
111 buf_2 = cos(max_theta);
116 void EGS_FanoSource::setUp() {
117 otype =
"EGS_FanoSource";
138 ostringstream str_density;
139 str_density << scientific << max_mass_density;
140 description +=
"\n maximum density = " + str_density.str() +
" g/cm3";
150 static void setInputs() {
153 setBaseSourceInputs();
155 srcBlockInput->getSingleInput(
"library")->setValues({
"egs_fano_source"});
158 auto shapePtr = srcBlockInput->addBlockInput(
"shape");
159 setShapeInputs(shapePtr);
161 srcBlockInput->addSingleInput(
"geometry",
true,
"The name of a predefined geometry");
162 srcBlockInput->addSingleInput(
"max mass density",
true,
"The maximum mass density within the geometry");
165 EGS_FANO_SOURCE_EXPORT
string getExample() {
169 # Example of egs_fano_source
171 library = egs_fano_source
172 name = my_fano_source
185 max mass density = 1.2
187 #create a geometry called some_name
193 EGS_FANO_SOURCE_EXPORT shared_ptr<EGS_BlockInput> getInputs() {
197 return srcBlockInput;
202 return createSourceTemplate<EGS_FanoSource>(input, f,
"fano source");
const string & getName() const
Get the name of this geometry.
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 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_Float min_phi
avoid multi-calculating cos(min_theta) and cos(max_theta)
EGS_FanoSource(int Q, EGS_BaseSpectrum *Spec, EGS_BaseShape *Shape, EGS_BaseGeometry *geometry, const string &Name="", EGS_ObjectFactory *f=0)
Constructor.
EGS_BaseShape * shape
The shape from which particles are emitted.
string otype
The object type.
const string & getObjectType() const
Get the object type.
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.