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 BLAssert, fParentID, fTrackID, initialMomentum, ParticleName, PDGCharge, PDGEncoding, and positionRecord.

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

BLSaveTrajectory::~BLSaveTrajectory (  ) 

References GetPoint(), and positionRecord.

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


Member Function Documentation

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

00154 { ::abort(); }

G4int BLSaveTrajectory::GetTrackID (  )  const [inline]

References fTrackID.

00155 { return fTrackID; }

G4int BLSaveTrajectory::GetParentID (  )  const [inline]

References fParentID.

00156 { return fParentID; }

G4String BLSaveTrajectory::GetParticleName (  )  const [inline]

References ParticleName.

00157 { return ParticleName; }

G4double BLSaveTrajectory::GetCharge (  )  const [inline]

References PDGCharge.

00158 { return PDGCharge; }

G4int BLSaveTrajectory::GetPDGEncoding (  )  const [inline]

References PDGEncoding.

00159 { return PDGEncoding; }

G4ThreeVector BLSaveTrajectory::GetInitialMomentum (  )  const [inline]

References initialMomentum.

00160 { return initialMomentum; }

int BLSaveTrajectory::GetPointEntries (  )  const [inline]

References positionRecord.

00161 { return positionRecord->size(); }

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

References positionRecord.

Referenced by ~BLSaveTrajectory().

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

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

References drawTrajectory(), and visAttrib.

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

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

00166 { ::abort(); }

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

00167 { ::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