Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // INCL++ intra-nuclear cascade model 26 // INCL++ intra-nuclear cascade model 27 // Alain Boudard, CEA-Saclay, France << 27 // Pekka Kaitaniemi, CEA and Helsinki Institute of Physics 28 // Joseph Cugnon, University of Liege, Belgium << 28 // Davide Mancusi, CEA 29 // Jean-Christophe David, CEA-Saclay, France << 29 // Alain Boudard, CEA 30 // Pekka Kaitaniemi, CEA-Saclay, France, and H << 30 // Sylvie Leray, CEA 31 // Sylvie Leray, CEA-Saclay, France << 31 // Joseph Cugnon, University of Liege 32 // Davide Mancusi, CEA-Saclay, France << 33 // 32 // 34 #define INCLXX_IN_GEANT4_MODE 1 33 #define INCLXX_IN_GEANT4_MODE 1 35 34 36 #include "globals.hh" 35 #include "globals.hh" 37 36 38 #include "G4INCLReflectionChannel.hh" 37 #include "G4INCLReflectionChannel.hh" 39 #include "G4INCLFinalState.hh" 38 #include "G4INCLFinalState.hh" 40 #include "G4INCLRandom.hh" 39 #include "G4INCLRandom.hh" 41 #include "G4INCLINuclearPotential.hh" 40 #include "G4INCLINuclearPotential.hh" 42 41 43 #include <cmath> 42 #include <cmath> 44 43 45 namespace G4INCL { 44 namespace G4INCL { 46 const G4double ReflectionChannel::sinMinRefl 45 const G4double ReflectionChannel::sinMinReflectionAngleSquaredOverFour = std::pow(std::sin(2.*Math::pi/200.),2.); 47 const G4double ReflectionChannel::positionSc 46 const G4double ReflectionChannel::positionScalingFactor = 0.99; 48 47 49 ReflectionChannel::ReflectionChannel(Nucleus 48 ReflectionChannel::ReflectionChannel(Nucleus *n, Particle *p) 50 :theNucleus(n),theParticle(p) 49 :theNucleus(n),theParticle(p) 51 { 50 { 52 } 51 } 53 52 54 ReflectionChannel::~ReflectionChannel() 53 ReflectionChannel::~ReflectionChannel() 55 { 54 { 56 } 55 } 57 56 58 void ReflectionChannel::fillFinalState(Final << 57 FinalState* ReflectionChannel::getFinalState() 59 if(theParticle->getPotentialEnergy() != 0. << 58 { 60 theNucleus->updatePotentialEnergy(thePar << 59 FinalState *fs = new FinalState(); // Create final state for the output 61 } << 62 fs->setTotalEnergyBeforeInteraction(thePar 60 fs->setTotalEnergyBeforeInteraction(theParticle->getEnergy() - theParticle->getPotentialEnergy()); 63 << 61 64 const ThreeVector &oldMomentum = thePartic 62 const ThreeVector &oldMomentum = theParticle->getMomentum(); 65 const ThreeVector thePosition = theParticl << 63 G4double pspr = theParticle->getPosition().dot(oldMomentum); 66 G4double pspr = thePosition.dot(oldMomentu << 67 if(pspr>=0) { // This means that the parti 64 if(pspr>=0) { // This means that the particle is trying to leave; perform a reflection 68 const G4double x2cour = thePosition.mag2 << 65 const G4double x2cour = theParticle->getPosition().mag2(); 69 const ThreeVector newMomentum = oldMomen << 66 const ThreeVector newMomentum = oldMomentum - (theParticle->getPosition() * (2.0 * pspr/x2cour)); 70 const G4double deltaP2 = (newMomentum-ol 67 const G4double deltaP2 = (newMomentum-oldMomentum).mag2(); 71 theParticle->setMomentum(newMomentum); 68 theParticle->setMomentum(newMomentum); 72 const G4double minDeltaP2 = sinMinReflec 69 const G4double minDeltaP2 = sinMinReflectionAngleSquaredOverFour * newMomentum.mag2(); 73 if(deltaP2 < minDeltaP2) { // Avoid extr 70 if(deltaP2 < minDeltaP2) { // Avoid extremely small reflection angles 74 theParticle->setPosition(thePosition * << 71 theParticle->setPosition(theParticle->getPosition() * positionScalingFactor); 75 INCL_DEBUG("Reflection angle for parti << 72 INCL_DEBUG("Reflection angle for particle " << theParticle->getID() << " was too tangential: " << std::endl 76 << " " << deltaP2 << "=deltaP2<mi << 73 << " " << deltaP2 << "=deltaP2<minDeltaP2=" << minDeltaP2 << std::endl 77 << " Resetting the particle posit 74 << " Resetting the particle position to (" 78 << thePosition.getX() << ", " << 75 << theParticle->getPosition().getX() << ", " 79 << thePosition.getY() << ", " << 76 << theParticle->getPosition().getY() << ", " 80 << thePosition.getZ() << ")" << '\ << 77 << theParticle->getPosition().getZ() << ")" << std::endl); 81 } << 82 if(theParticle->getPotentialEnergy() != << 83 theNucleus->updatePotentialEnergy(theP << 84 } 78 } >> 79 theNucleus->updatePotentialEnergy(theParticle); 85 } else { // The particle momentum is alrea 80 } else { // The particle momentum is already directed towards the inside of the nucleus; do nothing 86 // ...but make sure this only happened b 81 // ...but make sure this only happened because of the frozen propagation 87 // assert(theParticle->getPosition().dot(thePa 82 // assert(theParticle->getPosition().dot(theParticle->getPropagationVelocity())>0.); 88 } 83 } 89 84 90 theParticle->thawPropagation(); 85 theParticle->thawPropagation(); 91 fs->addModifiedParticle(theParticle); 86 fs->addModifiedParticle(theParticle); >> 87 return fs; 92 } 88 } 93 } 89 } 94 90 95 91