42 static bool EGS_COLLIMATED_SOURCE_LOCAL inputSet =
false;
46 source_shape(0), target_shape(0), ctry(0), dist(1) {
54 int err = input->
getInput(
"source shape name",sname);
56 egsWarning(
"EGS_CollimatedSource: missing/wrong inline source "
57 "shape definition and missing/wrong 'source shape name' input\n");
61 egsWarning(
"EGS_CollimatedSource: a shape named %s"
62 " does not exist\n",sname.c_str());
72 int err = input->
getInput(
"target shape name",sname);
74 egsWarning(
"EGS_CollimatedSource: missing/wrong inline target"
75 "shape definition and missing/wrong 'target shape name' input\n");
79 egsWarning(
"EGS_CollimatedSource: a shape named %s"
80 " does not exist\n",sname.c_str());
85 egsWarning(
"EGS_CollimatedSource: the target shape %s, which is"
86 " of type %s, does not support the getPointSourceDirection()"
91 int errd = input->
getInput(
"distance",auxd);
98 void EGS_CollimatedSource::setUp() {
99 otype =
"EGS_CollimatedSource";
104 description =
"Collimated source from a shape of type ";
127 static void setInputs() {
130 setBaseSourceInputs();
132 srcBlockInput->getSingleInput(
"library")->setValues({
"egs_collimated_source"});
135 auto source_shapePtr = srcBlockInput->addBlockInput(
"source shape");
136 auto target_shapePtr = srcBlockInput->addBlockInput(
"target shape");
138 setShapeInputs(source_shapePtr);
139 setShapeInputs(target_shapePtr);
141 srcBlockInput->addSingleInput(
"distance",
false,
"The source-target minimum distance, used for weighting the final result. This input does not impact the physical positioning of the source in any way. See the documentation for details.");
144 EGS_COLLIMATED_SOURCE_EXPORT
string getExample() {
148 # Example of egs_collimated_source
150 library = egs_collimated_source
157 library = egs_rectangle
158 rectangle = -1 -1 1 1
171 EGS_COLLIMATED_SOURCE_EXPORT shared_ptr<EGS_BlockInput> getInputs() {
175 return srcBlockInput;
181 createSourceTemplate<EGS_CollimatedSource>(input,f,
"collimated source");
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.
virtual bool supportsDirectionMethod() const
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 dist
source-target shape min. distance
EGS_CollimatedSource(int Q, EGS_BaseSpectrum *Spec, EGS_BaseShape *sshape, EGS_BaseShape *tshape, const string &Name="", EGS_ObjectFactory *f=0)
EGS_BaseShape * source_shape
the source shape
EGS_BaseShape * target_shape
the target shape
string otype
The object type.
const string & getObjectType() const
Get the object type.
const string & getObjectName() const
Get the object name.
A collimated isotropic source.
EGS_InfoFunction EGS_EXPORT egsWarning
Always use this function for reporting warnings.