37 #ifndef EGS_PARTICLE_TRACK_
38 #define EGS_PARTICLE_TRACK_
41 #include "egs_config1.h"
68 Vertex() : x(0,0,0), e(0) {};
69 Vertex(EGS_Float px, EGS_Float py, EGS_Float pz) {
75 Vertex(EGS_Float px, EGS_Float py, EGS_Float pz, EGS_Float pe) {
81 Vertex(
const EGS_Vector &px, EGS_Float pe) : x(px), e(pe) {};
95 m_track =
new Vertex* [m_size];
119 int writeTrack(ofstream *trsp);
122 void addVertex(Vertex *x);
129 Vertex *getVertex(
int v);
174 m_totalTracks(0), m_stackMap(NULL), m_isScoring(NULL), m_bufferSize(0),
175 m_buffer(NULL), m_trspFile(NULL) {};
185 m_nTracks(0), m_totalTracks(0), m_isScoring(NULL), m_bufferSize(0), m_buffer(0),
187 m_bufferSize = buf_size;
191 m_stackMap =
new int [m_bufferSize];
192 m_isScoring =
new bool [m_bufferSize];
193 for (
int i = 0; i < m_bufferSize; ++i) {
196 m_isScoring[i] =
false;
200 m_trspFilename = string(fname);
201 m_trspFile =
new ofstream(m_trspFilename.c_str(), ios::binary);
204 m_trspFile->write((
char *)&dummy,
sizeof(
int));
215 for (
int i = 0; i < m_bufferSize; i++) {
225 delete [] m_stackMap;
228 delete [] m_isScoring;
248 return (m_nTracks > 0) ? m_buffer[m_nTracks-1]->getNumVertices() : 0;
269 return m_isScoring[m_nTracks-1];
274 if (m_stackMap[stackIndex] < 0) {
277 return m_isScoring[m_stackMap[stackIndex]];
282 m_isScoring[m_nTracks-1] =
false;
287 if (m_stackMap[stackIndex] >= 0) {
288 m_isScoring[m_stackMap[stackIndex]] =
false;
290 m_stackMap[stackIndex] = -1;
294 void startNewTrack();
303 void startNewTrack(
int stackIndex);
310 if (m_stackMap[stackIndex] >= 0) {
311 m_buffer[m_stackMap[stackIndex]]->setParticleInfo(p);
317 m_buffer[m_nTracks-1]->setParticleInfo(p);
321 int readDataFile(
const char *filename);
326 void reportResults(
bool with_header =
true);
#define EGS_EXPORT
Export symbols from the egspp library.
ofstream * m_trspFile
the file to which data is output
EGS_ParticleTrack()
Initialize the track and allocate minimum memory.
int m_totalTracks
total number of tracks registered
void setCurrentParticleInfo(EGS_ParticleTrack::ParticleInfo *p)
Set the type of the currently tracked particle to p .
EGS_Vector x
interaction (vertex) coordinates
void setEvents(int e)
Save the number of events (for example, decays) tracked so far.
EGS_Vector methods for the manipulation of 3D vectors in cartesian co-ordinates.
void stopScoringParticle()
Stop scoring the current particle.
A class representing a single track of a particle.
A class representing 3D vectors.
Global egspp functions header file.
ParticleInfo * m_pInfo
type of the tracked particle
void setParticleInfo(int stackIndex, EGS_ParticleTrack::ParticleInfo *p)
Set the type of mapped particle to p .
ParticleInfo * getParticleInfo()
Get the type of the particle being tracked.
int m_nEvents
number of events scored
int getEvents()
Get the number of events tracked so far.
void setParticleInfo(ParticleInfo *p)
Define the type of the particle being tracked.
int m_size
current size of the vertex array
Structure describing the particle being tracked.
Structure to store the data for each interaction along the track.
EGS_ParticleTrackContainer(const char *fname, int buf_size)
Constructor.
A class that stores all the tracks in a simulation.
EGS_ParticleTrack ** m_buffer
the tracks array
int getCurrentNumVertices()
Get the number of vertices in the track currently being scorred.
bool isScoringParticle()
Are we still scoring the current particle?
int m_nTracks
number of tracks currently in memory
int m_bufferSize
max number of tracks in memory
void stopScoringParticle(int stackIndex)
Stop scoring the particle mapped by the stack.
~EGS_ParticleTrackContainer()
The Destructor. Deallocate all allocated memory.
int getNumVertices()
Get number of vertices currently in the track.
EGS_Float e
energy of the particle in this vertex
~EGS_ParticleTrack()
The destructor. Deallocate all memory.
EGS_ParticleTrackContainer()
Basic Constructor. Initializes all variables.
string m_trspFilename
filename of output file
bool isScoringParticle(int stackIndex)
Are we still scoring the particle mapped by the stack?
Vertex ** m_track
the array with the vertices
int m_nVertices
current number of vertices in track