40 #ifndef EGS_COLLIMATED_SOURCE_
41 #define EGS_COLLIMATED_SOURCE_
52 #ifdef BUILD_COLLIMATED_SOURCE_DLL
53 #define EGS_COLLIMATED_SOURCE_EXPORT __declspec(dllexport)
55 #define EGS_COLLIMATED_SOURCE_EXPORT __declspec(dllimport)
57 #define EGS_COLLIMATED_SOURCE_LOCAL
61 #ifdef HAVE_VISIBILITY
62 #define EGS_COLLIMATED_SOURCE_EXPORT __attribute__ ((visibility ("default")))
63 #define EGS_COLLIMATED_SOURCE_LOCAL __attribute__ ((visibility ("hidden")))
65 #define EGS_COLLIMATED_SOURCE_EXPORT
66 #define EGS_COLLIMATED_SOURCE_LOCAL
174 target_shape(tshape), ctry(0), dist(1) {
191 x = source_shape->getRandomPoint(rndm);
194 target_shape->getPointSourceDirection(x,rndm,u,wt);
197 egsFatal(
"EGS_CollimatedSource::getPositionDirection:\n"
198 " my target shape %s, which is of type %s, failed to\n"
199 " return a positive weight after 10000 attempts\n",
200 target_shape->getObjectName().c_str(),
201 target_shape->getObjectType().c_str());
211 return res/(dist*dist);
233 return (s != 0 && source_shape != 0 && target_shape != 0 &&
234 target_shape->supportsDirectionMethod());
Base shape class. All shapes in the EGSnrc C++ class library are derived from EGS_BaseShape.
Base class for 'simple' particle sources.
virtual bool addFluenceData(istream &data)
Add fluence data from the stream data to the current state.
virtual void getPositionDirection(EGS_RandomGenerator *rndm, EGS_Vector &x, EGS_Vector &u, EGS_Float &wt)=0
Sample a particle position and direction.
virtual bool isValid() const
Is this a valid source?
virtual void resetFluenceCounter()
Reset the data related to the sampling of positions and directions to a state with zero sampled parti...
virtual bool storeFluenceState(ostream &data_out) const
Store the fluence state of this source to the data stream data_out.
virtual bool setFluenceState(istream &data)
Set the data related to the sampling of positions and directions to a state contained in the stream d...
virtual EGS_Float getFluence() const =0
Return the fluence this source has emitted so far.
Base class for energy spectra. All energy spectra in the EGSnrc C++ class library are derived from th...
A collimated particle source.
EGS_I64 ctry
number of attempts to sample a particle
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
static void deleteObject(EGS_Object *o)
Delete an object.
Base random number generator class. All random number generators should be derived from this class.
A class representing 3D vectors.
EGS_BaseSource class header file.
Global egspp functions header file.
EGS_RandomGenerator class header file.
EGS_BaseShape and shape classes header file.
EGS_Vector methods for the manipulation of 3D vectors in cartesian co-ordinates.
bool EGS_EXPORT egsStoreI64(ostream &data, EGS_I64 n)
Writes the 64 bit integer n to the output stream data and returns true on success,...
EGS_InfoFunction EGS_EXPORT egsFatal
Always use this function for reporting fatal errors.
bool EGS_EXPORT egsGetI64(istream &data, EGS_I64 &n)
Reads a 64 bit integer from the stream data and assigns it to n. Returns true on success,...