// this : #include // Lib : #include // Geant4 : #include static G4Allocator sTrajectoryAllocator; // Beurk. namespace G4Lab { class TrajectoryPoint { public: TrajectoryPoint(G4TrajectoryPoint* aPoint,double aGlobalTime) :fPoint(aPoint),fGlobalTime(aGlobalTime){} virtual ~TrajectoryPoint() { delete fPoint;} G4TrajectoryPoint* point() const { return fPoint;} double globalTime() const { return fGlobalTime;} private: G4TrajectoryPoint* fPoint; double fGlobalTime; Lib::Debug fDebug; // To check memory balance. }; } ////////////////////////////////////////////////////////////////////////////// G4Lab::Trajectory::Trajectory( const G4Track* aTrack ) :G4Trajectory(aTrack) ////////////////////////////////////////////////////////////////////////////// //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// { fKineticEnergy = aTrack->GetKineticEnergy(); fTotalEnergy = aTrack->GetTotalEnergy(); fGlobalTime = aTrack->GetGlobalTime(); /* printf("debug : G4Lab::Trajectory : \"%s\", kineticEnergy : %g, totalEnergy : %g, globalTime : %g\n", GetParticleName().c_str(), fKineticEnergy,fTotalEnergy,fGlobalTime); */ TrajectoryPoint* tp = new TrajectoryPoint( new G4TrajectoryPoint(aTrack->GetPosition()), aTrack->GetGlobalTime()); fPoints.push_back(tp); } ////////////////////////////////////////////////////////////////////////////// G4Lab::Trajectory::Trajectory( Trajectory& aRight ) :G4Trajectory(aRight) ////////////////////////////////////////////////////////////////////////////// //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// { fKineticEnergy = aRight.fKineticEnergy; fTotalEnergy = aRight.fTotalEnergy; fGlobalTime = aRight.fGlobalTime; size_t number = aRight.fPoints.size(); for(size_t index=0;indexpoint(); TrajectoryPoint* tp = new TrajectoryPoint(new G4TrajectoryPoint(*point),aRight.fGlobalTime); fPoints.push_back(tp); } } ////////////////////////////////////////////////////////////////////////////// G4Lab::Trajectory::~Trajectory( ) ////////////////////////////////////////////////////////////////////////////// //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// { size_t number = fPoints.size(); for(size_t index=0;indexGetPostStepPoint()->GetPosition()), aStep->GetPostStepPoint()->GetGlobalTime()); fPoints.push_back(tp); } ////////////////////////////////////////////////////////////////////////////// int G4Lab::Trajectory::GetPointEntries( ) const ////////////////////////////////////////////////////////////////////////////// //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// { return fPoints.size(); } ////////////////////////////////////////////////////////////////////////////// G4VTrajectoryPoint* G4Lab::Trajectory::GetPoint( G4int aIndex ) const ////////////////////////////////////////////////////////////////////////////// //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// { return fPoints[aIndex]->point(); } ////////////////////////////////////////////////////////////////////////////// G4double G4Lab::Trajectory::GetPointGlobalTime( G4int aIndex ) const ////////////////////////////////////////////////////////////////////////////// //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// { return fPoints[aIndex]->globalTime(); } ////////////////////////////////////////////////////////////////////////////// void G4Lab::Trajectory::MergeTrajectory( G4VTrajectory* aTrajectory ) ////////////////////////////////////////////////////////////////////////////// // Transfer points from aTrajectory to this. //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// { if(!aTrajectory) return; Trajectory* tj = (Trajectory*)aTrajectory; size_t number = tj->fPoints.size(); // initial point of the second trajectory should not be merged for(size_t index=1;indexfPoints[index]); } delete tj->fPoints[0]; tj->fPoints.clear(); }