00001 #include "BDSTrajectoryPoint.hh" 00002 #include <map> 00003 #include "G4Allocator.hh" 00004 #include "G4ProcessType.hh" 00005 #include "G4VProcess.hh" 00006 00007 G4Allocator<BDSTrajectoryPoint> bdsTrajectoryPointAllocator; 00008 00009 BDSTrajectoryPoint::BDSTrajectoryPoint(){ 00010 _currentProcess=NULL; 00011 _isScatteringProcess=false; 00012 _trackID = -1; 00013 } 00014 BDSTrajectoryPoint::BDSTrajectoryPoint(const G4Track* aTrack):G4TrajectoryPoint(aTrack->GetPosition()) 00015 { 00016 _currentProcess=NULL; 00017 _isScatteringProcess=false; 00018 _trackID = -1; 00019 // G4cout << "Getting current process..." << G4endl; 00020 if(aTrack){ 00021 _vertexPosition=aTrack->GetVertexPosition(); 00022 _trackID = aTrack->GetTrackID(); 00023 if(aTrack->GetStep()){ 00024 _currentProcess = aTrack->GetStep()->GetPostStepPoint()->GetProcessDefinedStep(); 00025 // G4cout << "Getting current process type..." << G4endl; 00026 G4ProcessType ptype; 00027 if(_currentProcess){ 00028 ptype = _currentProcess->GetProcessType(); 00029 } else { 00030 ptype = fNotDefined; 00031 } 00032 // G4cout << "Getting isScattering..." << G4endl; 00033 _isScatteringProcess = false; 00034 if(!((ptype == fNotDefined) || (ptype == fTransportation))){ //If the process type is not undefined or transportation... 00035 if ( aTrack -> GetStep() -> GetDeltaMomentum().x() != 0){ //...and the particle changed momentum during the step.. 00036 _isScatteringProcess = true; //...then this is a "scattering" (momentum-changing non-transportation) process. 00037 } 00038 if ( aTrack -> GetStep() -> GetDeltaMomentum().y() != 0){ //same for y and z components of momentum. 00039 _isScatteringProcess = true; 00040 } 00041 if ( aTrack -> GetStep() -> GetDeltaMomentum().z() != 0){ //...and the particle changed momentum during the step.. 00042 _isScatteringProcess = true; 00043 } 00044 } 00045 } 00046 } 00047 } 00048 00049 BDSTrajectoryPoint::~BDSTrajectoryPoint(){ 00050 } 00051 00052 void BDSTrajectoryPoint::printData(){ 00053 G4cout << "BDSTrajectoryPoint> printData" << G4endl; 00054 if(_currentProcess){ 00055 G4cout << "_currentProcess = " << _currentProcess->GetProcessName() << G4endl; 00056 G4cout << "_isScatteringProcess = " << _isScatteringProcess << G4endl; 00057 } 00058 }