Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4INCL::ReflectionChannel Class Reference

#include <G4INCLReflectionChannel.hh>

+ Inheritance diagram for G4INCL::ReflectionChannel:

Public Member Functions

 ReflectionChannel (Nucleus *n, Particle *p)
 
virtual ~ReflectionChannel ()
 
void fillFinalState (FinalState *fs)
 
- Public Member Functions inherited from G4INCL::IChannel
 IChannel ()
 
virtual ~IChannel ()
 
FinalStategetFinalState ()
 

Detailed Description

Definition at line 48 of file G4INCLReflectionChannel.hh.

Constructor & Destructor Documentation

◆ ReflectionChannel()

G4INCL::ReflectionChannel::ReflectionChannel ( Nucleus * n,
Particle * p )

Definition at line 49 of file G4INCLReflectionChannel.cc.

50 :theNucleus(n),theParticle(p)
51 {
52 }

◆ ~ReflectionChannel()

G4INCL::ReflectionChannel::~ReflectionChannel ( )
virtual

Definition at line 54 of file G4INCLReflectionChannel.cc.

55 {
56 }

Member Function Documentation

◆ fillFinalState()

void G4INCL::ReflectionChannel::fillFinalState ( FinalState * fs)
virtual

Implements G4INCL::IChannel.

Definition at line 58 of file G4INCLReflectionChannel.cc.

58 {
59 if(theParticle->getPotentialEnergy() != 0.){
60 theNucleus->updatePotentialEnergy(theParticle); //D
61 }
62 fs->setTotalEnergyBeforeInteraction(theParticle->getEnergy() - theParticle->getPotentialEnergy());
63
64 const ThreeVector &oldMomentum = theParticle->getMomentum();
65 const ThreeVector thePosition = theParticle->getPosition();
66 G4double pspr = thePosition.dot(oldMomentum);
67 if(pspr>=0) { // This means that the particle is trying to leave; perform a reflection
68 const G4double x2cour = thePosition.mag2();
69 const ThreeVector newMomentum = oldMomentum - (thePosition * (2.0 * pspr/x2cour));
70 const G4double deltaP2 = (newMomentum-oldMomentum).mag2();
71 theParticle->setMomentum(newMomentum);
72 const G4double minDeltaP2 = sinMinReflectionAngleSquaredOverFour * newMomentum.mag2();
73 if(deltaP2 < minDeltaP2) { // Avoid extremely small reflection angles
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 }
82 if(theParticle->getPotentialEnergy() != 0.){
83 theNucleus->updatePotentialEnergy(theParticle);
84 }
85 } else { // The particle momentum is already directed towards the inside of the nucleus; do nothing
86 // ...but make sure this only happened because of the frozen propagation
87// assert(theParticle->getPosition().dot(theParticle->getPropagationVelocity())>0.);
88 }
89
90 theParticle->thawPropagation();
91 fs->addModifiedParticle(theParticle);
92 }
#define INCL_DEBUG(x)
double G4double
Definition G4Types.hh:83
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

The documentation for this class was generated from the following files: