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
00033
00034
00045
00046
00047
00048
00049 #include "G4Step.hh"
00050 #include "G4UserLimits.hh"
00051 #include "G4VParticleChange.hh"
00052 #include "G4EnergyLossTables.hh"
00053
00054
00055
00056
00057 #include "processes/MJProcessesMinEkineCuts.hh"
00058
00059
00060
00061 MJProcessesMinEkineCuts::MJProcessesMinEkineCuts( const G4String& aName ) : MJProcessesSpecialCuts(aName) {
00062 if (verboseLevel>1) {
00063 G4cout << GetProcessName() << " is created "<< G4endl;
00064 }
00065 SetProcessType(fUserDefined);
00066 }
00067
00068
00069
00070 MJProcessesMinEkineCuts::~MJProcessesMinEkineCuts() {;}
00071
00072 MJProcessesMinEkineCuts::MJProcessesMinEkineCuts(MJProcessesMinEkineCuts&) : MJProcessesSpecialCuts() {}
00073
00074 G4double MJProcessesMinEkineCuts::PostStepGetPhysicalInteractionLength( const G4Track& aTrack, G4double, G4ForceCondition* condition ) {
00075
00076 *condition = NotForced;
00077
00078 G4double proposedStep = DBL_MAX;
00079
00080 G4UserLimits* pUserLimits = aTrack.GetVolume()->GetLogicalVolume()->GetUserLimits();
00081 const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
00082 G4ParticleDefinition* aParticleDef = aTrack.GetDefinition();
00083
00084 if (pUserLimits && aParticleDef->GetPDGCharge() != 0.0) {
00085
00086 G4double temp = DBL_MAX;
00087 G4double eKine = aParticle->GetKineticEnergy();
00088 const G4MaterialCutsCouple* couple = aTrack.GetMaterialCutsCouple();
00089 G4double eMin = pUserLimits->GetUserMinEkine(aTrack);
00090
00091 G4double rangeNow = DBL_MAX;
00092
00093 rangeNow = G4EnergyLossTables::GetRange(aParticleDef,eKine,couple);
00094
00095 if (eKine < eMin ) {
00096 proposedStep = 0.;
00097 } else {
00098
00099 G4double rangeMin = G4EnergyLossTables::GetRange(aParticleDef,eMin,couple);
00100 temp = rangeNow - rangeMin;
00101 if (proposedStep > temp) proposedStep = temp;
00102 }
00103 }
00104 return proposedStep;
00105 }