G4INCLCoulombNone.cc

Go to the documentation of this file.
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 
00044 #include "G4INCLCoulombNone.hh"
00045 #include "G4INCLIntersection.hh"
00046 
00047 namespace G4INCL {
00048 
00049   ParticleEntryAvatar *CoulombNone::bringToSurface(Particle * const p, Nucleus * const n) const {
00050     Intersection intersection = IntersectionFactory::getEarlierTrajectoryIntersection(p->getPosition(), p->getPropagationVelocity(), n->getUniverseRadius());
00051     if(intersection.exists) { // If the particle enters the nucleus
00052       p->setPosition(intersection.position);
00053       return new ParticleEntryAvatar(0.0, n, p);
00054     } else // If the particle does NOT enter the nucleus
00055       return NULL;
00056   }
00057 
00058   IAvatarList CoulombNone::bringToSurface(Cluster * const c, Nucleus * const n) const {
00059     // The avatar list that we will return
00060     IAvatarList theAvatarList;
00061 
00062     // Loop over the particles in the cluster
00063     ParticleList projectiles = c->getParticles();
00064     std::list<Intersection> theIntersections;
00065     G4double theFirstEntryTime = 1E+60; // a large time
00066     G4int theFirstID = 0;
00067     for(ParticleIter p=projectiles.begin(); p!=projectiles.end(); ++p) {
00068       // Check if the particle enters the nucleus
00069       Intersection intersection(IntersectionFactory::getEarlierTrajectoryIntersection(
00070             (*p)->getPosition(),
00071             (*p)->getPropagationVelocity(),
00072             n->getUniverseRadius()));
00073       // Store the intersections
00074       theIntersections.push_back(intersection);
00075       if(intersection.exists) {
00076         // Position the particle at the entry point
00077         (*p)->setPosition(intersection.position);
00078 
00079         // Keep track of the first entering particle
00080         if(intersection.time < theFirstEntryTime) {
00081           theFirstEntryTime = intersection.time;
00082           theFirstID = (*p)->getID();
00083         }
00084       }
00085     }
00086 
00087     std::list<Intersection>::const_iterator intIter = theIntersections.begin();
00088     for( ParticleIter p=projectiles.begin(); p!=projectiles.end(); ++p, ++intIter) {
00089 
00090       if((*intIter).exists) {
00091         // If the particle enters the nucleus, generate a ParticleEntryAvatar
00092         // for it and add it to the list of avatars that we will return
00093         if((*p)->getID() == theFirstID) {
00094           // The first particle always enters exactly at t=0 (in order to
00095           // avoid negative entry times due to rounding)
00096           theAvatarList.push_back(new ParticleEntryAvatar(0.0, n, *p));
00097         } else
00098           theAvatarList.push_back(new ParticleEntryAvatar(intIter->time - theFirstEntryTime, n, *p));
00099       }
00100 
00101    }
00102 
00103     return theAvatarList;
00104   }
00105 
00106 }

Generated on Mon May 27 17:48:34 2013 for Geant4 by  doxygen 1.4.7