39 #ifndef EGS_PARTICLE_TRACK_ 
   40 #define EGS_PARTICLE_TRACK_ 
   43 #include "egs_config1.h" 
   71         Vertex() : x(0,0,0), e(0) {};
 
   72         Vertex(EGS_Float px, EGS_Float py, EGS_Float pz) {
 
   78         Vertex(EGS_Float px, EGS_Float py, EGS_Float pz, EGS_Float pe) {
 
   84         Vertex(
const EGS_Vector &px, EGS_Float pe) : x(px), e(pe) {};
 
   98         m_track = 
new Vertex* [m_size];
 
  122     int writeTrack(ofstream *trsp, 
bool incltime);
 
  125     void addVertex(Vertex *x);
 
  132     Vertex *getVertex(
int v);
 
  149     void setTimeIndex(EGS_Float time) {
 
  164     EGS_Float       time_index;
 
  187         m_totalTracks(0), m_stackMap(NULL), m_isScoring(NULL), m_bufferSize(0),
 
  188         m_buffer(NULL), m_trspFile(NULL) {};
 
  198         m_nTracks(0), m_totalTracks(0), m_isScoring(NULL), m_bufferSize(0), m_buffer(0),
 
  200         m_bufferSize = buf_size;
 
  201         strncpy(head_inctime, 
"include time index=", 20);
 
  206         incltime = time_bool;
 
  208         m_stackMap = 
new int [m_bufferSize];
 
  209         m_isScoring = 
new bool [m_bufferSize];
 
  210         for (
int i = 0; i < m_bufferSize; ++i) {
 
  213             m_isScoring[i] = 
false;
 
  217         m_trspFilename = string(fname);
 
  218         m_trspFile = 
new ofstream(m_trspFilename.c_str(), ios::binary);
 
  222         m_trspFile->write(head_inctime, 
sizeof(head_inctime));
 
  223         m_trspFile->write((
char *)&incltime, 
sizeof(
bool));
 
  227         m_trspFile->write((
char *)&dummy, 
sizeof(
int));
 
  239             for (
int i = 0; i < m_bufferSize; i++) {
 
  249             delete [] m_stackMap;
 
  252             delete [] m_isScoring;
 
  272         return (m_nTracks > 0) ? m_buffer[m_nTracks-1]->getNumVertices() : 0;
 
  293         return m_isScoring[m_nTracks-1];
 
  298         if (m_stackMap[stackIndex] < 0) {
 
  301         return m_isScoring[m_stackMap[stackIndex]];
 
  306         m_isScoring[m_nTracks-1] = 
false;
 
  311         if (m_stackMap[stackIndex] >= 0) {
 
  312             m_isScoring[m_stackMap[stackIndex]] = 
false;
 
  314         m_stackMap[stackIndex] = -1;
 
  318     void startNewTrack();
 
  327     void startNewTrack(
int stackIndex);
 
  334         if (m_stackMap[stackIndex] >= 0) {
 
  335             m_buffer[m_stackMap[stackIndex]]->setParticleInfo(p);
 
  341         m_buffer[m_nTracks-1]->setParticleInfo(p);
 
  344     void setCurrentTimeIndex(EGS_Float time) {
 
  345         m_buffer[m_nTracks-1]->setTimeIndex(time);
 
  349     int readDataFile(
const char *filename);
 
  354     void reportResults(
bool with_header = 
true);
 
  356     void tracksFileSort();
 
  390     char head_inctime[20];
 
A class that stores all the tracks in a simulation.
 
string m_trspFilename
filename of output file
 
void setParticleInfo(int stackIndex, EGS_ParticleTrack::ParticleInfo *p)
Set the type of mapped particle to p .
 
~EGS_ParticleTrackContainer()
The Destructor. Deallocate all allocated memory.
 
bool isScoringParticle(int stackIndex)
Are we still scoring the particle mapped by the stack?
 
EGS_ParticleTrack ** m_buffer
the tracks array
 
EGS_ParticleTrackContainer()
Basic Constructor. Initializes all variables.
 
int getCurrentNumVertices()
Get the number of vertices in the track currently being scorred.
 
int m_nEvents
number of events scored
 
void setEvents(int e)
Save the number of events (for example, decays) tracked so far.
 
int m_nTracks
number of tracks currently in memory
 
void stopScoringParticle()
Stop scoring the current particle.
 
int m_totalTracks
total number of tracks registered
 
bool isScoringParticle()
Are we still scoring the current particle?
 
int m_bufferSize
max number of tracks in memory
 
void stopScoringParticle(int stackIndex)
Stop scoring the particle mapped by the stack.
 
ofstream * m_trspFile
the file to which data is output
 
void setCurrentParticleInfo(EGS_ParticleTrack::ParticleInfo *p)
Set the type of the currently tracked particle to p .
 
EGS_ParticleTrackContainer(const char *fname, int buf_size, bool time_bool)
Constructor.
 
int getEvents()
Get the number of events tracked so far.
 
A class representing a single track of a particle.
 
EGS_ParticleTrack()
Initialize the track and allocate minimum memory.
 
Vertex ** m_track
the array with the vertices
 
EGS_Float getTimeIndex()
Get the time index of the particle being tracked.
 
int m_nVertices
current number of vertices in track
 
void setParticleInfo(ParticleInfo *p)
Define the type of the particle being tracked.
 
ParticleInfo * getParticleInfo()
Get the type of the particle being tracked.
 
~EGS_ParticleTrack()
The destructor. Deallocate all memory.
 
ParticleInfo * m_pInfo
type of the tracked particle
 
int m_size
current size of the vertex array
 
int getNumVertices()
Get number of vertices currently in the track.
 
A class representing 3D vectors.
 
Global egspp functions header file.
 
#define EGS_EXPORT
Export symbols from the egspp library.
 
EGS_Vector methods for the manipulation of 3D vectors in cartesian co-ordinates.
 
Structure describing the particle being tracked.
 
Structure to store the data for each interaction along the track.
 
EGS_Float e
energy of the particle in this vertex
 
EGS_Vector x
interaction (vertex) coordinates