33 #define INCLXX_IN_GEANT4_MODE 1
37 #ifndef G4INCLCascade_hh
38 #define G4INCLCascade_hh 1
92 Config const *
const theConfig;
100 G4int minRemnantSize;
112 outgoingParticles(n->getStore()->getOutgoingParticles()),
114 for(
ParticleIter p=outgoingParticles.begin(), e=outgoingParticles.end();
p!=e; ++
p) {
115 particleMomenta.push_back((*p)->getMomentum());
116 particleKineticEnergies.push_back((*p)->getKineticEnergy());
119 if(aPR && aPR->getA()>0) {
120 particleMomenta.push_back(aPR->getMomentum());
121 particleKineticEnergies.push_back(aPR->getKineticEnergy());
122 outgoingParticles.push_back(aPR);
125 virtual ~RecoilFunctor() {}
133 scaleParticleEnergies(x);
134 return nucleus->getConservationBalance(theEventInfo,
true).energy;
138 void cleanUp(
const G4bool success)
const {
140 scaleParticleEnergies(1.);
149 EventInfo
const &theEventInfo;
151 std::list<ThreeVector> particleMomenta;
153 std::list<G4double> particleKineticEnergies;
159 void scaleParticleEnergies(
const G4double rescale)
const {
161 ThreeVector pBalance = nucleus->getIncomingMomentum();
162 std::list<ThreeVector>::const_iterator iP = particleMomenta.begin();
163 std::list<G4double>::const_iterator iE = particleKineticEnergies.begin();
164 for(
ParticleIter i = outgoingParticles.begin(), e = outgoingParticles.end(); i!=e; ++i, ++iP, ++iE)
166 const G4double mass = (*i)->getMass();
167 const G4double newKineticEnergy = (*iE) * rescale;
169 (*i)->setMomentum(*iP);
170 (*i)->setEnergy(mass + newKineticEnergy);
171 (*i)->adjustMomentumFromEnergy();
173 pBalance -= (*i)->getMomentum();
176 nucleus->setMomentum(pBalance);
178 const G4double pRem2 = pBalance.mag2();
179 const G4double recoilEnergy = pRem2/
180 (std::sqrt(pRem2+remnantMass*remnantMass) + remnantMass);
181 nucleus->setEnergy(remnantMass + recoilEnergy);
186 class RecoilCMFunctor :
public RootFunctor {
192 RecoilCMFunctor(Nucleus *
const n,
const EventInfo &ei) :
195 theIncomingMomentum(nucleus->getIncomingMomentum()),
196 outgoingParticles(n->getStore()->getOutgoingParticles()),
198 thePTBoostVector = nucleus->getIncomingMomentum()/nucleus->getInitialEnergy();
199 for(
ParticleIter p=outgoingParticles.begin(), e=outgoingParticles.end();
p!=e; ++
p) {
200 (*p)->boost(thePTBoostVector);
201 particleCMMomenta.push_back((*p)->getMomentum());
203 ProjectileRemnant *
const aPR = n->getProjectileRemnant();
204 if(aPR && aPR->getA()>0) {
205 aPR->boost(thePTBoostVector);
206 particleCMMomenta.push_back(aPR->getMomentum());
207 outgoingParticles.push_back(aPR);
210 virtual ~RecoilCMFunctor() {}
218 scaleParticleCMMomenta(x);
219 return nucleus->getConservationBalance(theEventInfo,
true).energy;
223 void cleanUp(
const G4bool success)
const {
225 scaleParticleCMMomenta(1.);
232 ThreeVector thePTBoostVector;
234 ThreeVector theIncomingMomentum;
238 EventInfo
const &theEventInfo;
240 std::list<ThreeVector> particleCMMomenta;
246 void scaleParticleCMMomenta(
const G4double rescale)
const {
248 ThreeVector remnantMomentum = theIncomingMomentum;
249 std::list<ThreeVector>::const_iterator iP = particleCMMomenta.begin();
250 for(
ParticleIter i = outgoingParticles.begin(), e = outgoingParticles.end(); i!=e; ++i, ++iP)
252 (*i)->setMomentum(*iP * rescale);
253 (*i)->adjustEnergyFromMomentum();
254 (*i)->boost(-thePTBoostVector);
256 remnantMomentum -= (*i)->getMomentum();
259 nucleus->setMomentum(remnantMomentum);
261 const G4double pRem2 = remnantMomentum.mag2();
262 const G4double recoilEnergy = pRem2/
263 (std::sqrt(pRem2+remnantMass*remnantMass) + remnantMass);
264 nucleus->setEnergy(remnantMass + recoilEnergy);
273 void rescaleOutgoingForRecoil();
275 #ifndef INCLXX_IN_GEANT4_MODE
285 void globalConservationChecks(
G4bool afterRecoil);
312 G4int makeProjectileRemnant();
321 void makeCompoundNucleus();
324 G4bool preCascade(ParticleSpecies
const projectileSpecies,
const G4double kineticEnergy);
336 void initMaxInteractionDistance(ParticleSpecies
const &
p,
const G4double kineticEnergy);
343 void initUniverseRadius(ParticleSpecies
const &
p,
const G4double kineticEnergy,
const G4int A,
const G4int Z);
346 void updateGlobalInfo();
INCL & operator=(const INCL &rhs)
Dummy assignment operator to silence Coverity warning.
const GlobalInfo & getGlobalInfo() const
G4bool prepareReaction(const ParticleSpecies &projectileSpecies, const G4double kineticEnergy, const G4int A, const G4int Z)
G4int getTargetZ() const
Get the target charge number.
void finalizeGlobalInfo()
Class containing default actions to be performed at intermediate cascade steps.
UnorderedVector< Particle * > ParticleList
INCL(Config const *const config)
Simple container for output of calculation-wide results.
Simple container for output of event results.
G4int getTargetA() const
Get the target mass number.
const EventInfo & processEvent()
G4bool initializeTarget(const G4int A, const G4int Z)
ParticleSpecies getProjectileSpecies() const
Get the projectile species.
G4ThreadLocal NuclearMassFn getTableMass
Static pointer to the mass function for nuclei.
RootFunctor(const G4double x0, const G4double x1)
ProjectileRemnant * getProjectileRemnant() const
Get the projectile remnant.
G4double getProjectileKineticEnergy() const
Get the projectile kinetic energy.
ParticleList::const_iterator ParticleIter
Static root-finder algorithm.