00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // INCL++ intra-nuclear cascade model 00027 // Pekka Kaitaniemi, CEA and Helsinki Institute of Physics 00028 // Davide Mancusi, CEA 00029 // Alain Boudard, CEA 00030 // Sylvie Leray, CEA 00031 // Joseph Cugnon, University of Liege 00032 // 00033 #define INCLXX_IN_GEANT4_MODE 1 00034 00035 #include "globals.hh" 00036 00037 #include "G4INCLReflectionChannel.hh" 00038 #include "G4INCLFinalState.hh" 00039 #include "G4INCLRandom.hh" 00040 #include "G4INCLINuclearPotential.hh" 00041 00042 #include <cmath> 00043 00044 namespace G4INCL { 00045 const G4double ReflectionChannel::sinMinReflectionAngleSquaredOverFour = std::pow(std::sin(2.*Math::pi/200.),2.); 00046 const G4double ReflectionChannel::positionScalingFactor = 0.99; 00047 00048 ReflectionChannel::ReflectionChannel(Nucleus *n, Particle *p) 00049 :theNucleus(n),theParticle(p) 00050 { 00051 } 00052 00053 ReflectionChannel::~ReflectionChannel() 00054 { 00055 } 00056 00057 FinalState* ReflectionChannel::getFinalState() 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 } 00089 } 00090