34#define INCLXX_IN_GEANT4_MODE 1
38#ifndef G4INCLCascade_hh
39#define G4INCLCascade_hh 1
89 G4int theA, theZ, theS;
96 Config const *
const theConfig;
104 G4int minRemnantSize;
116 outgoingParticles(n->getStore()->getOutgoingParticles()),
118 for(
ParticleIter p=outgoingParticles.begin(), e=outgoingParticles.end(); p!=e; ++p) {
119 particleMomenta.push_back((*p)->getMomentum());
120 particleKineticEnergies.push_back((*p)->getKineticEnergy());
122 ProjectileRemnant *
const aPR = n->getProjectileRemnant();
123 if(aPR && aPR->getA()>0) {
124 particleMomenta.push_back(aPR->getMomentum());
125 particleKineticEnergies.push_back(aPR->getKineticEnergy());
126 outgoingParticles.push_back(aPR);
129 virtual ~RecoilFunctor() {}
137 scaleParticleEnergies(x);
142 void cleanUp(
const G4bool success)
const {
144 scaleParticleEnergies(1.);
151 ParticleList outgoingParticles;
153 EventInfo
const &theEventInfo;
155 std::list<ThreeVector> particleMomenta;
157 std::list<G4double> particleKineticEnergies;
163 void scaleParticleEnergies(
const G4double rescale)
const {
165 ThreeVector pBalance = nucleus->getIncomingMomentum();
166 std::list<ThreeVector>::const_iterator iP = particleMomenta.begin();
167 std::list<G4double>::const_iterator iE = particleKineticEnergies.begin();
168 for(
ParticleIter i = outgoingParticles.begin(), e = outgoingParticles.end(); i!=e; ++i, ++iP, ++iE)
170 const G4double mass = (*i)->getMass();
171 const G4double newKineticEnergy = (*iE) * rescale;
173 (*i)->setMomentum(*iP);
174 (*i)->setEnergy(mass + newKineticEnergy);
175 (*i)->adjustMomentumFromEnergy();
177 pBalance -= (*i)->getMomentum();
180 nucleus->setMomentum(pBalance);
182 const G4double pRem2 = pBalance.mag2();
183 const G4double recoilEnergy = pRem2/
184 (std::sqrt(pRem2+remnantMass*remnantMass) + remnantMass);
185 nucleus->setEnergy(remnantMass + recoilEnergy);
190 class RecoilCMFunctor :
public RootFunctor {
196 RecoilCMFunctor(Nucleus *
const n,
const EventInfo &ei) :
199 theIncomingMomentum(nucleus->getIncomingMomentum()),
200 outgoingParticles(
n->getStore()->getOutgoingParticles()),
202 thePTBoostVector = nucleus->getIncomingMomentum()/nucleus->getInitialEnergy();
203 for(
ParticleIter p=outgoingParticles.begin(), e=outgoingParticles.end(); p!=e; ++p) {
204 (*p)->boost(thePTBoostVector);
205 particleCMMomenta.push_back((*p)->getMomentum());
207 ProjectileRemnant *
const aPR =
n->getProjectileRemnant();
208 if(aPR && aPR->getA()>0) {
209 aPR->boost(thePTBoostVector);
210 particleCMMomenta.push_back(aPR->getMomentum());
211 outgoingParticles.push_back(aPR);
214 virtual ~RecoilCMFunctor() {}
222 scaleParticleCMMomenta(x);
223 return nucleus->getConservationBalance(theEventInfo,
true).energy;
227 void cleanUp(
const G4bool success)
const {
229 scaleParticleCMMomenta(1.);
236 ThreeVector thePTBoostVector;
238 ThreeVector theIncomingMomentum;
240 ParticleList outgoingParticles;
242 EventInfo
const &theEventInfo;
244 std::list<ThreeVector> particleCMMomenta;
250 void scaleParticleCMMomenta(
const G4double rescale)
const {
252 ThreeVector remnantMomentum = theIncomingMomentum;
253 std::list<ThreeVector>::const_iterator iP = particleCMMomenta.begin();
254 for(
ParticleIter i = outgoingParticles.begin(), e = outgoingParticles.end(); i!=e; ++i, ++iP)
256 (*i)->setMomentum(*iP * rescale);
257 (*i)->adjustEnergyFromMomentum();
258 (*i)->boost(-thePTBoostVector);
260 remnantMomentum -= (*i)->getMomentum();
263 nucleus->setMomentum(remnantMomentum);
265 const G4double pRem2 = remnantMomentum.mag2();
266 const G4double recoilEnergy = pRem2/
267 (std::sqrt(pRem2+remnantMass*remnantMass) + remnantMass);
268 nucleus->setEnergy(remnantMass + recoilEnergy);
277 void rescaleOutgoingForRecoil();
279#ifndef INCLXX_IN_GEANT4_MODE
289 void globalConservationChecks(
G4bool afterRecoil);
316 G4int makeProjectileRemnant();
325 void makeCompoundNucleus();
328 G4bool preCascade(ParticleSpecies
const &projectileSpecies,
const G4double kineticEnergy);
340 void initMaxInteractionDistance(ParticleSpecies
const &p,
const G4double kineticEnergy);
347 void initUniverseRadius(ParticleSpecies
const &p,
const G4double kineticEnergy,
const G4int A,
const G4int Z);
350 void updateGlobalInfo();
G4double S(G4double temp)
Class containing default actions to be performed at intermediate cascade steps.
Simple container for output of event results.
Simple container for output of calculation-wide results.
Static root-finder algorithm.
G4int getTargetA() const
Get the target mass number.
G4double getProjectileKineticEnergy() const
Get the projectile kinetic energy.
ParticleSpecies getProjectileSpecies() const
Get the projectile species.
G4int getTargetS() const
Get the target strangess number.
G4int getTargetZ() const
Get the target charge number.
void finalizeGlobalInfo(Random::SeedVector const &initialSeeds)
INCL(const INCL &rhs)
Dummy copy constructor to silence Coverity warning.
G4bool prepareReaction(const ParticleSpecies &projectileSpecies, const G4double kineticEnergy, const G4int A, const G4int Z, const G4int S)
G4bool initializeTarget(const G4int A, const G4int Z, const G4int S)
const EventInfo & processEvent()
const GlobalInfo & getGlobalInfo() const
INCL & operator=(const INCL &rhs)
Dummy assignment operator to silence Coverity warning.
ConservationBalance getConservationBalance(EventInfo const &theEventInfo, const G4bool afterRecoil) const
Compute charge, mass, energy and momentum balance.
RootFunctor(const G4double x0, const G4double x1)
G4ThreadLocal NuclearMassFn getTableMass
Static pointer to the mass function for nuclei.
ParticleList::const_iterator ParticleIter