G4INCL::ReflectionChannel Class Reference

#include <G4INCLReflectionChannel.hh>

Inheritance diagram for G4INCL::ReflectionChannel:

G4INCL::IChannel

Public Member Functions

 ReflectionChannel (Nucleus *n, Particle *p)
virtual ~ReflectionChannel ()
FinalStategetFinalState ()

Detailed Description

Definition at line 46 of file G4INCLReflectionChannel.hh.


Constructor & Destructor Documentation

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

Definition at line 48 of file G4INCLReflectionChannel.cc.

00049     :theNucleus(n),theParticle(p)
00050   {
00051   }

G4INCL::ReflectionChannel::~ReflectionChannel (  )  [virtual]

Definition at line 53 of file G4INCLReflectionChannel.cc.

00054   {
00055   }


Member Function Documentation

FinalState * G4INCL::ReflectionChannel::getFinalState (  )  [virtual]

Implements G4INCL::IChannel.

Definition at line 57 of file G4INCLReflectionChannel.cc.

References G4INCL::FinalState::addModifiedParticle(), DEBUG, G4INCL::ThreeVector::dot(), G4INCL::Particle::getEnergy(), G4INCL::Particle::getID(), G4INCL::Particle::getMomentum(), G4INCL::Particle::getPosition(), G4INCL::Particle::getPotentialEnergy(), G4INCL::ThreeVector::getX(), G4INCL::ThreeVector::getY(), G4INCL::ThreeVector::getZ(), G4INCL::ThreeVector::mag2(), G4INCL::Particle::setMomentum(), G4INCL::Particle::setPosition(), G4INCL::FinalState::setTotalEnergyBeforeInteraction(), G4INCL::Particle::thawPropagation(), and G4INCL::Nucleus::updatePotentialEnergy().

00058   {
00059     FinalState *fs = new FinalState(); // Create final state for the output
00060     fs->setTotalEnergyBeforeInteraction(theParticle->getEnergy() - theParticle->getPotentialEnergy());
00061 
00062     const ThreeVector &oldMomentum = theParticle->getMomentum();
00063     G4double pspr = theParticle->getPosition().dot(oldMomentum);
00064     if(pspr>=0) { // This means that the particle is trying to leave; perform a reflection
00065       const G4double x2cour = theParticle->getPosition().mag2();
00066       const ThreeVector newMomentum = oldMomentum - (theParticle->getPosition() * (2.0 * pspr/x2cour));
00067       const G4double deltaP2 = (newMomentum-oldMomentum).mag2();
00068       theParticle->setMomentum(newMomentum);
00069       const G4double minDeltaP2 = sinMinReflectionAngleSquaredOverFour * newMomentum.mag2();
00070       if(deltaP2 < minDeltaP2) { // Avoid extremely small reflection angles
00071         theParticle->setPosition(theParticle->getPosition() * positionScalingFactor);
00072         DEBUG("Reflection angle for particle " << theParticle->getID() << " was too tangential: " << std::endl
00073             << "  " << deltaP2 << "=deltaP2<minDeltaP2=" << minDeltaP2 << std::endl
00074             << "  Resetting the particle position to ("
00075             << theParticle->getPosition().getX() << ", "
00076             << theParticle->getPosition().getY() << ", "
00077             << theParticle->getPosition().getZ() << ")" << std::endl);
00078       }
00079       theNucleus->updatePotentialEnergy(theParticle);
00080     } else { // The particle momentum is already directed towards the inside of the nucleus; do nothing
00081       // ...but make sure this only happened because of the frozen propagation
00082 // assert(theParticle->getPosition().dot(theParticle->getPropagationVelocity())>0.);
00083     }
00084 
00085     theParticle->thawPropagation();
00086     fs->addModifiedParticle(theParticle);
00087     return fs;
00088   }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:54:07 2013 for Geant4 by  doxygen 1.4.7