41 static bool EGS_PARALLEL_BEAM_LOCAL inputSet =
false;
45 vector<EGS_Float> dir;
46 if (!input->
getInput(
"direction",dir)) {
47 if (dir.size() != 3)
egsWarning(
"EGS_ParallelBeam: you must input"
48 " 3 numbers in the 'direction' input\n"
49 " but I got %d => ignoring the input\n",dir.size());
54 EGS_Float norm =
uo.length();
56 egsWarning(
"EGS_ParallelBeam: the length of the direction"
57 " vector can not be zero => ignoring your input\n");
75 int err = input->
getInput(
"shape name",sname);
77 egsWarning(
"EGS_ParallelBeam: missing/wrong inline shape "
78 "definition and missing wrong 'shape name' input\n");
88 void EGS_ParallelBeam::setUp() {
89 otype =
"EGS_ParallelBeam";
94 description =
"Parallel beam from a shape of type ";
115 static void setInputs() {
118 setBaseSourceInputs();
120 srcBlockInput->getSingleInput(
"library")->setValues({
"egs_parallel_beam"});
123 auto shapePtr = srcBlockInput->addBlockInput(
"shape");
125 setShapeInputs(shapePtr);
127 srcBlockInput->addSingleInput(
"direction",
true,
"Direction of the beam, as a unit vector: 'ux uy uz'");
130 EGS_PARALLEL_BEAM_EXPORT
string getExample() {
134 # Example of egs_parallel_beam
136 library = egs_parallel_beam
156 EGS_PARALLEL_BEAM_EXPORT shared_ptr<EGS_BlockInput> getInputs() {
160 return srcBlockInput;
165 return createSourceTemplate<EGS_ParallelBeam>(input,f,
"parallel beam");
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.
string otype
The object type.
const string & getObjectType() const
Get the object type.
EGS_Vector uo
The direction of the particles.
EGS_ParallelBeam(int Q, EGS_BaseSpectrum *Spec, EGS_BaseShape *Shape, const string &Name="", EGS_ObjectFactory *f=0)
Constructor.
EGS_BaseShape * shape
The shape.
const EGS_Float epsilon
The epsilon constant for floating point comparisons.
EGS_InfoFunction EGS_EXPORT egsWarning
Always use this function for reporting warnings.