39 #ifndef EGS_COLLIMATED_SOURCE_
40 #define EGS_COLLIMATED_SOURCE_
51 #ifdef BUILD_COLLIMATED_SOURCE_DLL
52 #define EGS_COLLIMATED_SOURCE_EXPORT __declspec(dllexport)
54 #define EGS_COLLIMATED_SOURCE_EXPORT __declspec(dllimport)
56 #define EGS_COLLIMATED_SOURCE_LOCAL
60 #ifdef HAVE_VISIBILITY
61 #define EGS_COLLIMATED_SOURCE_EXPORT __attribute__ ((visibility ("default")))
62 #define EGS_COLLIMATED_SOURCE_LOCAL __attribute__ ((visibility ("hidden")))
64 #define EGS_COLLIMATED_SOURCE_EXPORT
65 #define EGS_COLLIMATED_SOURCE_LOCAL
173 target_shape(tshape), ctry(0), dist(1) {
190 x = source_shape->getRandomPoint(rndm);
193 target_shape->getPointSourceDirection(x,rndm,u,wt);
196 egsFatal(
"EGS_CollimatedSource::getPositionDirection:\n"
197 " my target shape %s, which is of type %s, failed to\n"
198 " return a positive weight after 10000 attempts\n",
199 target_shape->getObjectName().c_str(),
200 target_shape->getObjectType().c_str());
210 return res/(dist*dist);
232 return (s != 0 && source_shape != 0 && target_shape != 0 &&
233 target_shape->supportsDirectionMethod());
virtual void getPositionDirection(EGS_RandomGenerator *rndm, EGS_Vector &x, EGS_Vector &u, EGS_Float &wt)=0
Sample a particle position and direction.
EGS_I64 ctry
number of attempts to sample a particle
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, false on failure.
EGS_BaseSource class 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, false on failure.
A class representing 3D vectors.
Global egspp functions header file.
static void deleteObject(EGS_Object *o)
Delete an object.
Base shape class. All shapes in the EGSnrc C++ class library are derived from EGS_BaseShape.
A collimated particle source.
Base random number generator class. All random number generators should be derived from this class...
EGS_InfoFunction EGS_EXPORT egsFatal
Always use this function for reporting fatal errors.
EGS_RandomGenerator class header file.
EGS_BaseShape and shape classes header file.
EGS_CollimatedSource(int Q, EGS_BaseSpectrum *Spec, EGS_BaseShape *sshape, EGS_BaseShape *tshape, const string &Name="", EGS_ObjectFactory *f=0)
EGS_Float dist
source-target shape min. distance
virtual EGS_Float getFluence() const =0
Return the fluence this source has emitted so far.
virtual bool storeFluenceState(ostream &data_out) const
Store the fluence state of this source to the data stream data_out.
virtual bool addFluenceData(istream &data)
Add fluence data from the stream data to the current state.
virtual void resetFluenceCounter()
Reset the data related to the sampling of positions and directions to a state with zero sampled parti...
Base class for energy spectra. All energy spectra in the EGSnrc C++ class library are derived from th...
Base class for 'simple' particle sources.
virtual bool isValid() const
Is this a valid source?
virtual bool setFluenceState(istream &data)
Set the data related to the sampling of positions and directions to a state contained in the stream d...