Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
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 ()
 
- Public Member Functions inherited from G4INCL::IChannel
 IChannel ()
 
virtual ~IChannel ()
 

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.

49  :theNucleus(n),theParticle(p)
50  {
51  }
const char * p
Definition: xmltok.h:285
const G4int n
G4INCL::ReflectionChannel::~ReflectionChannel ( )
virtual

Definition at line 53 of file G4INCLReflectionChannel.cc.

54  {
55  }

Member Function Documentation

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

Implements G4INCL::IChannel.

Definition at line 57 of file G4INCLReflectionChannel.cc.

References G4INCL::FinalState::addModifiedParticle(), 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(), INCL_DEBUG, G4INCL::ThreeVector::mag2(), G4INCL::Particle::setMomentum(), G4INCL::Particle::setPosition(), G4INCL::FinalState::setTotalEnergyBeforeInteraction(), G4INCL::Particle::thawPropagation(), and G4INCL::Nucleus::updatePotentialEnergy().

58  {
59  FinalState *fs = new FinalState(); // Create final state for the output
60  fs->setTotalEnergyBeforeInteraction(theParticle->getEnergy() - theParticle->getPotentialEnergy());
61 
62  const ThreeVector &oldMomentum = theParticle->getMomentum();
63  G4double pspr = theParticle->getPosition().dot(oldMomentum);
64  if(pspr>=0) { // This means that the particle is trying to leave; perform a reflection
65  const G4double x2cour = theParticle->getPosition().mag2();
66  const ThreeVector newMomentum = oldMomentum - (theParticle->getPosition() * (2.0 * pspr/x2cour));
67  const G4double deltaP2 = (newMomentum-oldMomentum).mag2();
68  theParticle->setMomentum(newMomentum);
69  const G4double minDeltaP2 = sinMinReflectionAngleSquaredOverFour * newMomentum.mag2();
70  if(deltaP2 < minDeltaP2) { // Avoid extremely small reflection angles
71  theParticle->setPosition(theParticle->getPosition() * positionScalingFactor);
72  INCL_DEBUG("Reflection angle for particle " << theParticle->getID() << " was too tangential: " << std::endl
73  << " " << deltaP2 << "=deltaP2<minDeltaP2=" << minDeltaP2 << std::endl
74  << " Resetting the particle position to ("
75  << theParticle->getPosition().getX() << ", "
76  << theParticle->getPosition().getY() << ", "
77  << theParticle->getPosition().getZ() << ")" << std::endl);
78  }
79  theNucleus->updatePotentialEnergy(theParticle);
80  } else { // The particle momentum is already directed towards the inside of the nucleus; do nothing
81  // ...but make sure this only happened because of the frozen propagation
82 // assert(theParticle->getPosition().dot(theParticle->getPropagationVelocity())>0.);
83  }
84 
85  theParticle->thawPropagation();
86  fs->addModifiedParticle(theParticle);
87  return fs;
88  }
void updatePotentialEnergy(Particle *p) const
Update the particle potential energy.
G4double dot(const ThreeVector &v) const
const G4INCL::ThreeVector & getMomentum() const
G4double getEnergy() const
void thawPropagation()
Unfreeze particle propagation.
G4double mag2() const
G4double getPotentialEnergy() const
Get the particle potential energy.
virtual void setPosition(const G4INCL::ThreeVector &position)
const G4INCL::ThreeVector & getPosition() const
G4double getX() const
double G4double
Definition: G4Types.hh:76
#define INCL_DEBUG(x)
G4double getZ() const
long getID() const
virtual void setMomentum(const G4INCL::ThreeVector &momentum)
G4double getY() const

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