58 {
61 }
63
64 const ThreeVector &oldMomentum = theParticle->
getMomentum();
65 const ThreeVector thePosition = theParticle->
getPosition();
67 if(pspr>=0) {
68 const G4double x2cour = thePosition.mag2();
69 const ThreeVector newMomentum = oldMomentum - (thePosition * (2.0 * pspr/x2cour));
70 const G4double deltaP2 = (newMomentum-oldMomentum).mag2();
72 const G4double minDeltaP2 = sinMinReflectionAngleSquaredOverFour * newMomentum.mag2();
73 if(deltaP2 < minDeltaP2) {
74 theParticle->
setPosition(thePosition * positionScalingFactor);
75 INCL_DEBUG(
"Reflection angle for particle " << theParticle->
getID() <<
" was too tangential: " <<
'\n'
76 << " " << deltaP2 << "=deltaP2<minDeltaP2=" << minDeltaP2 << '\n'
77 << " Resetting the particle position to ("
78 << thePosition.getX() << ", "
79 << thePosition.getY() << ", "
80 << thePosition.getZ() << ")" << '\n');
81 }
84 }
85 } else {
86
87
88 }
89
91 fs->addModifiedParticle(theParticle);
92 }
void updatePotentialEnergy(Particle *p) const
Update the particle potential energy.
G4double getEnergy() const
G4double getPotentialEnergy() const
Get the particle potential energy.
const G4INCL::ThreeVector & getPosition() const
const G4INCL::ThreeVector & getMomentum() const
virtual void setMomentum(const G4INCL::ThreeVector &momentum)
void thawPropagation()
Unfreeze particle propagation.
virtual void setPosition(const G4INCL::ThreeVector &position)
G4double dot(const ThreeVector &v) const