33 #define INCLXX_IN_GEANT4_MODE 1
37 #ifndef G4INCLCascade_hh
38 #define G4INCLCascade_hh 1
92 Config const *
const theConfig;
111 outgoingParticles(n->getStore()->getOutgoingParticles()),
113 for(
ParticleIter p=outgoingParticles.begin();
p!=outgoingParticles.end(); ++
p) {
114 particleMomenta.push_back((*p)->getMomentum());
115 particleKineticEnergies.push_back((*p)->getKineticEnergy());
118 virtual ~RecoilFunctor() {}
126 scaleParticleEnergies(x);
127 return nucleus->getConservationBalance(theEventInfo,
true).energy;
131 void cleanUp(
const G4bool success)
const {
133 scaleParticleEnergies(1.);
142 EventInfo
const &theEventInfo;
144 std::list<ThreeVector> particleMomenta;
146 std::list<G4double> particleKineticEnergies;
152 void scaleParticleEnergies(
const G4double rescale)
const {
154 ThreeVector pBalance = nucleus->getIncomingMomentum();
155 std::list<ThreeVector>::const_iterator iP = particleMomenta.begin();
156 std::list<G4double>::const_iterator iE = particleKineticEnergies.begin();
157 for(
ParticleIter i = outgoingParticles.begin(); i != outgoingParticles.end(); ++i, ++iP, ++iE)
159 const G4double mass = (*i)->getMass();
160 const G4double newKineticEnergy = (*iE) * rescale;
162 (*i)->setMomentum(*iP);
163 (*i)->setEnergy(mass + newKineticEnergy);
164 (*i)->adjustMomentumFromEnergy();
166 pBalance -= (*i)->getMomentum();
169 nucleus->setMomentum(pBalance);
171 const G4double pRem2 = pBalance.mag2();
172 const G4double recoilEnergy = pRem2/
173 (std::sqrt(pRem2+remnantMass*remnantMass) + remnantMass);
174 nucleus->setEnergy(remnantMass + recoilEnergy);
179 class RecoilCMFunctor :
public RootFunctor {
185 RecoilCMFunctor(Nucleus *
const n,
const EventInfo &ei) :
188 theIncomingMomentum(nucleus->getIncomingMomentum()),
189 outgoingParticles(n->getStore()->getOutgoingParticles()),
191 thePTBoostVector = nucleus->getIncomingMomentum()/nucleus->getInitialEnergy();
192 for(
ParticleIter p=outgoingParticles.begin();
p!=outgoingParticles.end(); ++
p) {
193 (*p)->boost(thePTBoostVector);
194 particleCMMomenta.push_back((*p)->getMomentum());
197 virtual ~RecoilCMFunctor() {}
205 scaleParticleCMMomenta(x);
206 return nucleus->getConservationBalance(theEventInfo,
true).energy;
210 void cleanUp(
const G4bool success)
const {
212 scaleParticleCMMomenta(1.);
219 ThreeVector thePTBoostVector;
221 ThreeVector theIncomingMomentum;
225 EventInfo
const &theEventInfo;
227 std::list<ThreeVector> particleCMMomenta;
233 void scaleParticleCMMomenta(
const G4double rescale)
const {
235 ThreeVector remnantMomentum = theIncomingMomentum;
236 std::list<ThreeVector>::const_iterator iP = particleCMMomenta.begin();
237 for(
ParticleIter i = outgoingParticles.begin(); i != outgoingParticles.end(); ++i, ++iP)
239 (*i)->setMomentum(*iP * rescale);
240 (*i)->adjustEnergyFromMomentum();
241 (*i)->boost(-thePTBoostVector);
243 remnantMomentum -= (*i)->getMomentum();
246 nucleus->setMomentum(remnantMomentum);
248 const G4double pRem2 = remnantMomentum.mag2();
249 const G4double recoilEnergy = pRem2/
250 (std::sqrt(pRem2+remnantMass*remnantMass) + remnantMass);
251 nucleus->setEnergy(remnantMass + recoilEnergy);
260 void rescaleOutgoingForRecoil();
262 #ifndef INCLXX_IN_GEANT4_MODE
272 void globalConservationChecks(
G4bool afterRecoil);
299 G4int makeProjectileRemnant();
308 void makeCompoundNucleus();
311 G4bool preCascade(ParticleSpecies
const projectileSpecies,
const G4double kineticEnergy);
323 void initMaxInteractionDistance(ParticleSpecies
const &
p,
const G4double kineticEnergy);
330 void initUniverseRadius(ParticleSpecies
const &
p,
const G4double kineticEnergy,
const G4int A,
const G4int Z);