00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 #include "G4Step.hh"
00051
00053 G4Step::G4Step()
00055 : fTotalEnergyDeposit(0.0),fNonIonizingEnergyDeposit(0.0),
00056 fStepLength(0.), fpTrack(0),
00057 fpSteppingControlFlag(NormalCondition),
00058 fFirstStepInVolume(false),
00059 fLastStepInVolume(false),
00060 fSecondary(0),
00061 nSecondaryByLastStep(0), secondaryInCurrentStep(),
00062 fpVectorOfAuxiliaryPointsPointer(0)
00063 {
00064 fpPreStepPoint = new G4StepPoint();
00065 fpPostStepPoint = new G4StepPoint();
00066
00067 secondaryInCurrentStep = new std::vector<CT>;
00068 }
00069
00071 G4Step::~G4Step()
00073 {
00074 delete fpPreStepPoint;
00075 delete fpPostStepPoint;
00076
00077 secondaryInCurrentStep->clear();
00078 delete secondaryInCurrentStep;
00079
00080 if (fSecondary !=0 ) {
00081 fSecondary->clear();
00082 delete fSecondary;
00083 }
00084 }
00085
00086
00087
00089 G4Step::G4Step(const G4Step& right)
00091 : fTotalEnergyDeposit(right.fTotalEnergyDeposit),
00092 fNonIonizingEnergyDeposit(right.fNonIonizingEnergyDeposit),
00093 fStepLength(right.fStepLength),
00094 fpTrack(right.fpTrack),
00095 fpSteppingControlFlag(right.fpSteppingControlFlag),
00096 fFirstStepInVolume(right.fFirstStepInVolume),
00097 fLastStepInVolume(right.fLastStepInVolume),
00098 nSecondaryByLastStep(right.nSecondaryByLastStep),
00099 secondaryInCurrentStep(right.secondaryInCurrentStep),
00100 fpVectorOfAuxiliaryPointsPointer(right.fpVectorOfAuxiliaryPointsPointer)
00101 {
00102 if (right.fpPreStepPoint !=0) {
00103 fpPreStepPoint = new G4StepPoint(*(right.fpPreStepPoint));
00104 } else {
00105 fpPreStepPoint = new G4StepPoint();
00106 }
00107 if (right.fpPostStepPoint !=0) {
00108 fpPostStepPoint = new G4StepPoint(*(right.fpPostStepPoint));
00109 } else {
00110 fpPostStepPoint = new G4StepPoint();
00111 }
00112
00113 if (right.fSecondary !=0) {
00114 fSecondary = new G4TrackVector(*(right.fSecondary));
00115 } else {
00116 fSecondary = new G4TrackVector();
00117 }
00118 secondaryInCurrentStep = new std::vector<CT>;
00119 }
00120
00122 G4Step& G4Step::operator=(const G4Step & right)
00123
00124 {
00125 if (this != &right){
00126 fTotalEnergyDeposit = right.fTotalEnergyDeposit;
00127 fNonIonizingEnergyDeposit = right.fNonIonizingEnergyDeposit;
00128 fStepLength = right.fStepLength;
00129 fpTrack = right.fpTrack;
00130 fpSteppingControlFlag = right.fpSteppingControlFlag;
00131 fFirstStepInVolume = right.fFirstStepInVolume;
00132 fLastStepInVolume = right.fLastStepInVolume;
00133 nSecondaryByLastStep = right.nSecondaryByLastStep;
00134 secondaryInCurrentStep = right.secondaryInCurrentStep;
00135 fpVectorOfAuxiliaryPointsPointer = right.fpVectorOfAuxiliaryPointsPointer;
00136
00137 if (fpPreStepPoint !=0 ) delete fpPreStepPoint;
00138 if (right.fpPreStepPoint !=0) {
00139 fpPreStepPoint = new G4StepPoint(*(right.fpPreStepPoint));
00140 } else {
00141 fpPreStepPoint = new G4StepPoint();
00142 }
00143 if (fpPostStepPoint !=0 ) delete fpPostStepPoint;
00144 if (right.fpPostStepPoint !=0) {
00145 fpPostStepPoint = new G4StepPoint(*(right.fpPostStepPoint));
00146 } else {
00147 fpPostStepPoint = new G4StepPoint();
00148 }
00149 if (right.fSecondary !=0) {
00150 fSecondary = new G4TrackVector(*(right.fSecondary));
00151 } else {
00152 fSecondary = new G4TrackVector();
00153 }
00154 }
00155 return *this;
00156 }
00157
00159 G4ThreeVector G4Step::GetDeltaMomentum() const
00161 {
00162 static G4bool isFirstTime = true;
00163 if (isFirstTime) {
00164 isFirstTime = false;
00165 #ifdef G4VERBOSE
00166 G4Exception( "G4Step::GetDeltaMomentum()","Warning", JustWarning,
00167 "This method is obsolete and will be removed soon");
00168 #endif
00169 }
00170
00171 return fpPostStepPoint->GetMomentum()
00172 - fpPreStepPoint->GetMomentum();
00173 }
00174
00176 G4double G4Step::GetDeltaEnergy() const
00178 {
00179 static G4bool isFirstTime = true;
00180 if (isFirstTime) {
00181 isFirstTime = false;
00182 #ifdef G4VERBOSE
00183 G4Exception( "G4Step::GetDeltaEnergy()","Warning", JustWarning,
00184 "This method is obsolete and will be removed soon");
00185 #endif
00186 }
00187
00188 return fpPostStepPoint->GetKineticEnergy()
00189 - fpPreStepPoint->GetKineticEnergy();
00190 }
00191
00193 const std::vector<const G4Track*>* G4Step::GetSecondaryInCurrentStep() const
00195 {
00196 secondaryInCurrentStep->clear();
00197 G4int nSecondary = fSecondary->size();
00198 for (G4int i=nSecondaryByLastStep; i<nSecondary; i++) {
00199 secondaryInCurrentStep->push_back((*fSecondary)[i]);
00200 }
00201 return secondaryInCurrentStep;
00202 }
00203