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 |
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 }
G4bool BLSaveTrajectory::operator== | ( | const G4VTrajectory & | right | ) | const [inline] |
G4int BLSaveTrajectory::GetTrackID | ( | ) | const [inline] |
G4int BLSaveTrajectory::GetParentID | ( | ) | const [inline] |
G4String BLSaveTrajectory::GetParticleName | ( | ) | const [inline] |
G4double BLSaveTrajectory::GetCharge | ( | ) | const [inline] |
G4int BLSaveTrajectory::GetPDGEncoding | ( | ) | const [inline] |
G4ThreeVector BLSaveTrajectory::GetInitialMomentum | ( | ) | const [inline] |
int BLSaveTrajectory::GetPointEntries | ( | ) | const [inline] |
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] |
void BLSaveTrajectory::MergeTrajectory | ( | G4VTrajectory * | secondTrajectory | ) | [inline] |
G4VisAttributes BLSaveTrajectory::visAttrib [private] |
Referenced by DrawTrajectory().
TrajectoryPointContainer* BLSaveTrajectory::positionRecord [private] |
Referenced by BLSaveTrajectory(), GetPoint(), GetPointEntries(), and ~BLSaveTrajectory().
G4int BLSaveTrajectory::fTrackID [private] |
Referenced by BLSaveTrajectory(), and GetTrackID().
G4int BLSaveTrajectory::fParentID [private] |
Referenced by BLSaveTrajectory(), and GetParentID().
G4int BLSaveTrajectory::PDGEncoding [private] |
Referenced by BLSaveTrajectory(), and GetPDGEncoding().
G4double BLSaveTrajectory::PDGCharge [private] |
Referenced by BLSaveTrajectory(), and GetCharge().
G4String BLSaveTrajectory::ParticleName [private] |
Referenced by BLSaveTrajectory(), and GetParticleName().
G4ThreeVector BLSaveTrajectory::initialMomentum [private] |
Referenced by BLSaveTrajectory(), and GetInitialMomentum().