BLSaveTrajectory Class Reference

List of all members.


Detailed Description

class BLSaveTrajectory is used to save a trajectory from the Center particle run to the visual run.

Neither G4Trajectory nor BLTrajectory can be saved, due to their new/delete functions. The constructor here does a deep copy of the trajectory, including each point.

Much of this source is copied from geant4.6.2.p02.

We don't need operators new and delete, because this class derives from G4Vtrajectory (not G4Trajectory).

Public Member Functions

 BLSaveTrajectory (G4VTrajectory *traj)
 ~BLSaveTrajectory ()
G4bool operator== (const G4VTrajectory &right) const
G4int GetTrackID () const
G4int GetParentID () const
G4String GetParticleName () const
G4double GetCharge () const
G4int GetPDGEncoding () const
G4ThreeVector GetInitialMomentum () const
int GetPointEntries () const
G4VTrajectoryPoint * GetPoint (G4int i) const
void DrawTrajectory (G4int i_mode=0) const
void AppendStep (const G4Step *aStep)
void MergeTrajectory (G4VTrajectory *secondTrajectory)

Private Attributes

G4VisAttributes visAttrib
TrajectoryPointContainer * positionRecord
G4int fTrackID
G4int fParentID
G4int PDGEncoding
G4double PDGCharge
G4String ParticleName
G4ThreeVector initialMomentum


Constructor & Destructor Documentation

BLSaveTrajectory::BLSaveTrajectory ( G4VTrajectory *  traj  ) 

References fParentID, fTrackID, initialMomentum, ParticleName, PDGCharge, PDGEncoding, and positionRecord.

00311 {
00312         positionRecord = new TrajectoryPointContainer();
00313         fTrackID = traj->GetTrackID();
00314         fParentID = traj->GetParentID();
00315         PDGEncoding = traj->GetPDGEncoding();
00316         PDGCharge = traj->GetCharge();
00317         ParticleName = traj->GetParticleName();
00318         initialMomentum = traj->GetInitialMomentum();
00319 
00320         unsigned n = traj->GetPointEntries();
00321         for(unsigned i=0; i<n; ++i) {
00322                 G4TrajectoryPoint *p = 
00323                         dynamic_cast<G4TrajectoryPoint*>(traj->GetPoint(i));
00324                 assert(p != 0);
00325                 G4TrajectoryPoint *q = new G4TrajectoryPoint(*p);
00326                 positionRecord->push_back(q);
00327         }
00328 }

BLSaveTrajectory::~BLSaveTrajectory (  ) 

References GetPoint(), and positionRecord.

00330 {
00331         unsigned n = positionRecord->size();
00332         for(unsigned i=0; i<n; ++i)
00333                 delete GetPoint(i);
00334         positionRecord->clear();
00335         delete positionRecord;
00336 }


Member Function Documentation

G4bool BLSaveTrajectory::operator== ( const G4VTrajectory &  right  )  const [inline]

00153 { ::abort(); }

G4int BLSaveTrajectory::GetTrackID (  )  const [inline]

References fTrackID.

00154 { return fTrackID; }

G4int BLSaveTrajectory::GetParentID (  )  const [inline]

References fParentID.

00155 { return fParentID; }

G4String BLSaveTrajectory::GetParticleName (  )  const [inline]

References ParticleName.

00156 { return ParticleName; }

G4double BLSaveTrajectory::GetCharge (  )  const [inline]

References PDGCharge.

00157 { return PDGCharge; }

G4int BLSaveTrajectory::GetPDGEncoding (  )  const [inline]

References PDGEncoding.

00158 { return PDGEncoding; }

G4ThreeVector BLSaveTrajectory::GetInitialMomentum (  )  const [inline]

References initialMomentum.

00159 { return initialMomentum; }

int BLSaveTrajectory::GetPointEntries (  )  const [inline]

References positionRecord.

00160 { return positionRecord->size(); }

G4VTrajectoryPoint* BLSaveTrajectory::GetPoint ( G4int  i  )  const [inline]

References positionRecord.

Referenced by ~BLSaveTrajectory().

00162                 { return (*positionRecord)[i]; }

void BLSaveTrajectory::DrawTrajectory ( G4int  i_mode = 0  )  const [inline]

References drawTrajectory(), and visAttrib.

00164                 { drawTrajectory(this,visAttrib,i_mode); }

void BLSaveTrajectory::AppendStep ( const G4Step *  aStep  )  [inline]

00165 { ::abort(); }

void BLSaveTrajectory::MergeTrajectory ( G4VTrajectory *  secondTrajectory  )  [inline]

00166 { ::abort(); }


Member Data Documentation

G4VisAttributes BLSaveTrajectory::visAttrib [private]

Referenced by DrawTrajectory().

TrajectoryPointContainer* BLSaveTrajectory::positionRecord [private]

G4int BLSaveTrajectory::fTrackID [private]

Referenced by BLSaveTrajectory(), and GetTrackID().

G4int BLSaveTrajectory::fParentID [private]

Referenced by BLSaveTrajectory(), and GetParentID().

Referenced by BLSaveTrajectory(), and GetPDGEncoding().

G4double BLSaveTrajectory::PDGCharge [private]

Referenced by BLSaveTrajectory(), and GetCharge().

G4String BLSaveTrajectory::ParticleName [private]

G4ThreeVector BLSaveTrajectory::initialMomentum [private]


The documentation for this class was generated from the following file:
g4beamline